History

Merge branch 'perf/urgent' into perf/core, to pick up fixes

Ingo Molnar committed 7 years ago

Commit 65133032 parents 27a0a90 652521d585 files · +5323 −3247Browse files

Unified · Split

585 files
  1. .mailmap +3 −1
  2. Documentation/arm64/silicon-errata.rst +2 −0
  3. Documentation/dev-tools/kasan.rst +3 −0
  4. Documentation/devicetree/bindings/arm/rockchip.yaml +2 −2
  5. Documentation/devicetree/bindings/interrupt-controller/atmel,aic.txt +5 −2
  6. Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml +3 −6
  7. Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml +42 −44
  8. Documentation/devicetree/bindings/regulator/fixed-regulator.yaml +2 −2
  9. Documentation/devicetree/bindings/riscv/cpus.yaml +13 −16
  10. Documentation/networking/device_drivers/pensando/ionic.rst +3 −1
  11. Documentation/networking/net_dim.txt +18 −18
  12. MAINTAINERS +17 −13
  13. Makefile +3 −3
  14. arch/arm/boot/dts/am3874-iceboard.dts +1 −8
  15. arch/arm/boot/dts/bcm2835-rpi-zero-w.dts +1 −0
  16. arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi +8 −0
  17. arch/arm/boot/dts/imx6-logicpd-som.dtsi +4 −0
  18. arch/arm/boot/dts/imx7s.dtsi +4 −4
  19. arch/arm/boot/dts/logicpd-torpedo-som.dtsi +4 −0
  20. arch/arm/boot/dts/mt7629-rfb.dts +12 −1
  21. arch/arm/boot/dts/mt7629.dtsi +0 −2
  22. arch/arm/boot/dts/omap4-droid4-xt894.dts +1 −1
  23. arch/arm/boot/dts/omap4-panda-common.dtsi +1 −1
  24. arch/arm/boot/dts/omap4-sdp.dts +1 −1
  25. arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi +1 −1
  26. arch/arm/boot/dts/omap5-board-common.dtsi +1 −1
  27. arch/arm/boot/dts/omap54xx-clocks.dtsi +1 −1
  28. arch/arm/boot/dts/stm32mp157-pinctrl.dtsi +4 −4
  29. arch/arm/boot/dts/sun7i-a20.dtsi +2 −3
  30. arch/arm/boot/dts/vf610-zii-scu4-aib.dts +2 −0
  31. arch/arm/configs/davinci_all_defconfig +1 −0
  32. arch/arm/configs/imx_v6_v7_defconfig +1 −0
  33. arch/arm/configs/omap2plus_defconfig +6 −6
  34. arch/arm/include/asm/domain.h +4 −4
  35. arch/arm/include/asm/uaccess.h +2 −2
  36. arch/arm/kernel/head-common.S +3 −2
  37. arch/arm/kernel/head-nommu.S +2 −0
  38. arch/arm/mach-davinci/dm365.c +2 −2
  39. arch/arm/mach-omap2/pdata-quirks.c +11 −0
  40. arch/arm/mm/alignment.c +49 −21
  41. arch/arm/mm/proc-v7m.S +2 −4
  42. arch/arm64/Kconfig +17 −0
  43. arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts +9 −0
  44. arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +6 −0
  45. arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +0 −9
  46. arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi +3 −2
  47. arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi +1 −2
  48. arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi +18 −18
  49. arch/arm64/boot/dts/freescale/imx8mm.dtsi +3 −3
  50. arch/arm64/boot/dts/freescale/imx8mn.dtsi +3 −3
  51. arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi +2 −2
  52. arch/arm64/boot/dts/freescale/imx8mq.dtsi +2 −2
  53. arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts +7 −6
  54. arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts +1 −1
  55. arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts +2 −2
  56. arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts +5 −7
  57. arch/arm64/include/asm/asm-uaccess.h +3 −4
  58. arch/arm64/include/asm/cpucaps.h +3 −1
  59. arch/arm64/include/asm/memory.h +8 −2
  60. arch/arm64/include/asm/pgtable.h +0 −3
  61. arch/arm64/include/asm/sysreg.h +1 −1
  62. arch/arm64/kernel/cpu_errata.c +38 −0
  63. arch/arm64/kernel/cpufeature.c +10 −5
  64. arch/arm64/kernel/entry.S +5 −3
  65. arch/arm64/kernel/hibernate.c +8 −1
  66. arch/arm64/kernel/process.c +18 −0
  67. arch/arm64/kvm/hyp/switch.c +67 −2
  68. arch/arm64/kvm/sys_regs.c +4 −0
  69. arch/arm64/mm/fault.c +5 −1
  70. arch/mips/bcm63xx/prom.c +1 −1
  71. arch/mips/include/asm/bmips.h +5 −5
  72. arch/mips/include/asm/vdso/gettimeofday.h +3 −1
  73. arch/mips/kernel/smp-bmips.c +4 −4
  74. arch/mips/mm/tlbex.c +15 −8
  75. arch/parisc/include/asm/cache.h +1 −1
  76. arch/parisc/include/asm/ldcw.h +1 −1
  77. arch/parisc/mm/ioremap.c +7 −5
  78. arch/powerpc/kvm/book3s_xive.c +16 −8
  79. arch/powerpc/kvm/book3s_xive.h +12 −0
  80. arch/powerpc/kvm/book3s_xive_native.c +4 −2
  81. arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts +1 −0
  82. arch/riscv/include/asm/bug.h +3 −13
  83. arch/riscv/include/asm/pgtable.h +9 −14
  84. arch/riscv/include/asm/tlbflush.h +0 −4
  85. arch/riscv/kernel/traps.c +6 −20
  86. arch/riscv/mm/init.c +1 −1
  87. arch/s390/boot/startup.c +11 −3
  88. arch/s390/kernel/machine_kexec_reloc.c +1 −0
  89. arch/sparc/Kconfig +0 −1
  90. arch/x86/boot/compressed/acpi.c +24 −24
  91. arch/x86/boot/compressed/misc.c +19 −6
  92. arch/x86/events/amd/ibs.c +5 −3
  93. arch/x86/events/intel/uncore.c +38 −6
  94. arch/x86/events/intel/uncore.h +0 −12
  95. arch/x86/hyperv/hv_apic.c +15 −5
  96. arch/x86/include/asm/kvm_host.h +1 −1
  97. arch/x86/include/asm/vmware.h +9 −5
  98. arch/x86/kernel/apic/x2apic_cluster.c +2 −1
  99. arch/x86/kernel/cpu/mshyperv.c +4 −0
  100. arch/x86/kernel/head64.c +20 −2
  101. arch/x86/kvm/cpuid.c +1 −1
  102. arch/x86/kvm/lapic.c +0 −5
  103. arch/x86/kvm/lapic.h +5 −0
  104. arch/x86/kvm/svm.c +3 −3
  105. arch/x86/kvm/vmx/nested.c +36 −28
  106. arch/x86/kvm/vmx/nested.h +12 −1
  107. arch/x86/kvm/vmx/vmx.c +0 −12
  108. arch/x86/kvm/x86.c +10 −9
  109. arch/x86/xen/enlighten_pv.c +8 −0
  110. arch/xtensa/boot/dts/virt.dts +1 −1
  111. arch/xtensa/include/asm/bitops.h +1 −1
  112. arch/xtensa/include/asm/uaccess.h +53 −41
  113. arch/xtensa/kernel/xtensa_ksyms.c +0 −7
  114. block/blk-cgroup.c +51 −18
  115. block/blk-rq-qos.h +5 −8
  116. block/elevator.c +2 −1
  117. drivers/acpi/cppc_acpi.c +1 −1
  118. drivers/acpi/hmat/hmat.c +1 −1
  119. drivers/acpi/nfit/core.c +1 −1
  120. drivers/acpi/processor_driver.c +4 −5
  121. drivers/acpi/processor_perflib.c +14 −12
  122. drivers/acpi/processor_thermal.c +14 −12
  123. drivers/acpi/sleep.c +0 −13
  124. drivers/amba/bus.c +11 −3
  125. drivers/android/binder.c +0 −7
  126. drivers/android/binder_alloc.c +4 −2
  127. drivers/ata/ahci.c +3 −1
  128. drivers/ata/libahci_platform.c +14 −24
  129. drivers/base/core.c +3 −0
  130. drivers/base/memory.c +3 −0
  131. drivers/base/power/qos.c +2 −68
  132. drivers/block/nbd.c +34 −7
  133. drivers/block/rbd.c +6 −3
  134. drivers/block/zram/zram_drv.c +3 −2
  135. drivers/bus/ti-sysc.c +14 −4
  136. drivers/cpufreq/cpufreq.c +29 −43
  137. drivers/cpufreq/intel_pstate.c +15 −15
  138. drivers/cpufreq/ppc_cbe_cpufreq_pmi.c +7 −8
  139. drivers/cpuidle/cpuidle-haltpoll.c +4 −0
  140. drivers/dma-buf/dma-resv.c +1 −1
  141. drivers/edac/ghes_edac.c +4 −0
  142. drivers/firmware/dmi_scan.c +1 −1
  143. drivers/gpio/gpio-intel-mid.c +6 −3
  144. drivers/gpio/gpio-lynxpoint.c +6 −4
  145. drivers/gpio/gpio-merrifield.c +6 −3
  146. drivers/gpio/gpiolib.c +21 −1
  147. drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c +6 −1
  148. drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 −6
  149. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +35 −0
  150. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 −35
  151. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 −1
  152. drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +15 −5
  153. drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h +1 −0
  154. drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +23 −12
  155. drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +1 −1
  156. drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +21 −10
  157. drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +22 −11
  158. drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +1 −1
  159. drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c +1 −1
  160. drivers/gpu/drm/arm/display/komeda/komeda_kms.c +2 −1
  161. drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +2 −2
  162. drivers/gpu/drm/drm_edid.c +3 −0
  163. drivers/gpu/drm/i915/display/intel_bios.c +16 −6
  164. drivers/gpu/drm/i915/gem/i915_gem_mman.c +7 −0
  165. drivers/gpu/drm/i915/gem/i915_gem_object.h +6 −0
  166. drivers/gpu/drm/i915/gem/i915_gem_object_types.h +2 −1
  167. drivers/gpu/drm/i915/gem/i915_gem_userptr.c +1 −0
  168. drivers/gpu/drm/i915/gt/intel_lrc.c +43 −20
  169. drivers/gpu/drm/i915/i915_gem.c +3 −0
  170. drivers/gpu/drm/msm/dsi/dsi_host.c +4 −2
  171. drivers/gpu/drm/panfrost/panfrost_gpu.c +3 −0
  172. drivers/gpu/drm/panfrost/panfrost_job.c +11 −5
  173. drivers/gpu/drm/radeon/radeon_drv.c +0 −8
  174. drivers/gpu/drm/tiny/Kconfig +0 −1
  175. drivers/gpu/drm/ttm/ttm_bo.c +5 −4
  176. drivers/gpu/drm/ttm/ttm_bo_vm.c +7 −9
  177. drivers/i2c/busses/i2c-aspeed.c +34 −20
  178. drivers/i2c/busses/i2c-mt65xx.c +1 −1
  179. drivers/i2c/busses/i2c-stm32f7.c +13 −8
  180. drivers/input/misc/da9063_onkey.c +1 −4
  181. drivers/input/misc/soc_button_array.c +12 −5
  182. drivers/input/mouse/elantech.c +29 −26
  183. drivers/input/rmi4/rmi_driver.c +5 −1
  184. drivers/input/touchscreen/goodix.c +50 −8
  185. drivers/input/touchscreen/st1232.c +4 −2
  186. drivers/iommu/amd_iommu.c +7 −5
  187. drivers/iommu/amd_iommu_types.h +2 −2
  188. drivers/iommu/arm-smmu.c +1 −0
  189. drivers/iommu/intel-iommu.c +9 −1
  190. drivers/iommu/io-pgtable-arm.c +45 −13
  191. drivers/iommu/ipmmu-vmsa.c +1 −2
  192. drivers/iommu/rockchip-iommu.c +14 −5
  193. drivers/irqchip/irq-al-fic.c +12 −0
  194. drivers/irqchip/irq-atmel-aic5.c +10 −0
  195. drivers/irqchip/irq-gic-v3-its.c +18 −3
  196. drivers/irqchip/irq-gic-v3.c +1 −1
  197. drivers/irqchip/irq-sifive-plic.c +17 −16
  198. drivers/macintosh/windfarm_cpufreq_clamp.c +22 −16
  199. drivers/md/dm-cache-target.c +2 −26
  200. drivers/md/dm-clone-target.c +2 −2
  201. drivers/md/dm-snap.c +77 −17
  202. drivers/md/raid0.c +1 −1
  203. drivers/memstick/host/jmb38x_ms.c +1 −1
  204. drivers/mfd/mt6397-core.c +40 −24
  205. drivers/mmc/host/cqhci.c +2 −1
  206. drivers/mmc/host/mxs-mmc.c +4 −3
  207. drivers/mmc/host/renesas_sdhi_core.c +19 −12
  208. drivers/mmc/host/sdhci-iproc.c +1 −0
  209. drivers/mmc/host/sdhci-omap.c +1 −1
  210. drivers/mmc/host/sh_mmcif.c +2 −4
  211. drivers/net/bonding/bond_main.c +1 −1
  212. drivers/net/dsa/b53/b53_common.c +0 −1
  213. drivers/net/dsa/microchip/ksz8795.c +0 −4
  214. drivers/net/dsa/microchip/ksz8795_spi.c +4 −3
  215. drivers/net/dsa/microchip/ksz9477_i2c.c +4 −2
  216. drivers/net/dsa/microchip/ksz9477_reg.h +2 −2
  217. drivers/net/dsa/microchip/ksz9477_spi.c +4 −2
  218. drivers/net/dsa/microchip/ksz_common.c +1 −1
  219. drivers/net/dsa/microchip/ksz_common.h +17 −3
  220. drivers/net/dsa/sja1105/sja1105.h +2 −2
  221. drivers/net/dsa/sja1105/sja1105_dynamic_config.h +2 −2
  222. drivers/net/dsa/sja1105/sja1105_ptp.h +2 −2
  223. drivers/net/dsa/sja1105/sja1105_static_config.h +2 −2
  224. drivers/net/dsa/sja1105/sja1105_tas.h +2 −2
  225. drivers/net/ethernet/aquantia/atlantic/aq_main.c +1 −3
  226. drivers/net/ethernet/aquantia/atlantic/aq_nic.c +18 −16
  227. drivers/net/ethernet/aquantia/atlantic/aq_ring.c +2 −1
  228. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +18 −5
  229. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c +15 −2
  230. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h +5 −2
  231. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h +19 −0
  232. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +1 −1
  233. drivers/net/ethernet/broadcom/Kconfig +3 −1
  234. drivers/net/ethernet/broadcom/genet/bcmgenet.c +26 −15
  235. drivers/net/ethernet/broadcom/genet/bcmgenet.h +2 −1
  236. drivers/net/ethernet/broadcom/genet/bcmmii.c +56 −61
  237. drivers/net/ethernet/cadence/macb_main.c +6 −6
  238. drivers/net/ethernet/cavium/common/cavium_ptp.h +1 −1
  239. drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +49 −1
  240. drivers/net/ethernet/freescale/dpaa2/dpni.h +4 −1
  241. drivers/net/ethernet/hisilicon/hns3/hnae3.h +2 −0
  242. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +20 −1
  243. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +1 −0
  244. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +9 −2
  245. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +25 −3
  246. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +1 −0
  247. drivers/net/ethernet/i825xx/lasi_82596.c +3 −1
  248. drivers/net/ethernet/i825xx/lib82596.c +2 −2
  249. drivers/net/ethernet/i825xx/sni_82596.c +3 −1
  250. drivers/net/ethernet/ibm/ibmvnic.c +3 −5
  251. drivers/net/ethernet/mediatek/mtk_eth_soc.c +1 −0
  252. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +4 −6
  253. drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c +1 −0
  254. drivers/net/ethernet/nxp/lpc_eth.c +0 −3
  255. drivers/net/ethernet/pensando/ionic/ionic_lif.h +2 −0
  256. drivers/net/ethernet/pensando/ionic/ionic_stats.c +19 −10
  257. drivers/net/ethernet/realtek/r8169_main.c +11 −24
  258. drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +2 −1
  259. drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +1 −1
  260. drivers/net/ethernet/stmicro/stmmac/dwmac5.c +1 −0
  261. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +9 −5
  262. drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +1 −1
  263. drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +9 −2
  264. drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +1 −1
  265. drivers/net/ethernet/ti/davinci_cpdma.c +1 −1
  266. drivers/net/netdevsim/fib.c +2 −1
  267. drivers/net/phy/bcm7xxx.c +1 −0
  268. drivers/net/phy/micrel.c +37 −5
  269. drivers/net/phy/phy-c45.c +2 −0
  270. drivers/net/phy/phy.c +0 −3
  271. drivers/net/phy/phy_device.c +10 −1
  272. drivers/net/phy/phylink.c +1 −1
  273. drivers/net/tun.c +2 −2
  274. drivers/net/usb/hso.c +9 −4
  275. drivers/net/usb/lan78xx.c +6 −6
  276. drivers/net/usb/qmi_wwan.c +1 −0
  277. drivers/net/usb/sr9800.c +1 −1
  278. drivers/net/wireless/ath/ath10k/core.c +9 −6
  279. drivers/net/wireless/intel/iwlwifi/fw/acpi.c +6 −4
  280. drivers/net/wireless/intel/iwlwifi/fw/dbg.c +1 −0
  281. drivers/net/wireless/intel/iwlwifi/iwl-io.h +6 −6
  282. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +30 −13
  283. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 −4
  284. drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c +25 −11
  285. drivers/net/wireless/intel/iwlwifi/pcie/drv.c +137 −137
  286. drivers/net/wireless/intel/iwlwifi/pcie/trans.c +19 −6
  287. drivers/net/wireless/mac80211_hwsim.c +1 −1
  288. drivers/net/wireless/ralink/rt2x00/rt2x00.h +0 −1
  289. drivers/net/wireless/ralink/rt2x00/rt2x00debug.c +1 −1
  290. drivers/net/xen-netback/interface.c +0 −1
  291. drivers/nfc/pn533/usb.c +8 −1
  292. drivers/nvme/host/core.c +68 −26
  293. drivers/nvme/host/fabrics.h +1 −2
  294. drivers/nvme/host/nvme.h +4 −1
  295. drivers/nvme/host/pci.c +49 −34
  296. drivers/nvme/host/rdma.c +8 −0
  297. drivers/nvme/host/tcp.c +11 −0
  298. drivers/nvme/target/loop.c +3 −1
  299. drivers/of/of_reserved_mem.c +3 −1
  300. drivers/of/unittest.c +1 −0
  301. drivers/opp/core.c +3 −13
  302. drivers/opp/of.c +7 −2
  303. drivers/parisc/sba_iommu.c +0 −8
  304. drivers/pci/pci.c +11 −13
  305. drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c +54 −70
  306. drivers/pinctrl/aspeed/pinmux-aspeed.h +2 −1
  307. drivers/pinctrl/bcm/pinctrl-iproc-gpio.c +2 −10
  308. drivers/pinctrl/bcm/pinctrl-ns2-mux.c +2 −2
  309. drivers/pinctrl/berlin/pinctrl-as370.c +1 −1
  310. drivers/pinctrl/intel/pinctrl-cherryview.c +0 −4
  311. drivers/pinctrl/intel/pinctrl-intel.c +14 −13
  312. drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +13 −13
  313. drivers/pinctrl/pinctrl-stmfx.c +1 −1
  314. drivers/platform/x86/classmate-laptop.c +0 −12
  315. drivers/platform/x86/i2c-multi-instantiate.c +1 −0
  316. drivers/platform/x86/intel_punit_ipc.c +1 −2
  317. drivers/ptp/Kconfig +2 −2
  318. drivers/regulator/core.c +13 −0
  319. drivers/regulator/da9062-regulator.c +47 −71
  320. drivers/regulator/fixed.c +2 −3
  321. drivers/regulator/lochnagar-regulator.c +1 −0
  322. drivers/regulator/of_regulator.c +18 −9
  323. drivers/regulator/pfuze100-regulator.c +7 −1
  324. drivers/regulator/qcom-rpmh-regulator.c +2 −2
  325. drivers/regulator/ti-abb-regulator.c +8 −18
  326. drivers/s390/crypto/zcrypt_api.c +1 −2
  327. drivers/s390/net/qeth_l2_main.c +15 −8
  328. drivers/s390/scsi/zfcp_fsf.c +13 −3
  329. drivers/scsi/Kconfig +1 −1
  330. drivers/scsi/ch.c +0 −1
  331. drivers/scsi/device_handler/scsi_dh_alua.c +16 −5
  332. drivers/scsi/hpsa.c +4 −0
  333. drivers/scsi/lpfc/lpfc_init.c +0 −2
  334. drivers/scsi/lpfc/lpfc_scsi.c +0 −2
  335. drivers/scsi/qla2xxx/qla_isr.c +0 −2
  336. drivers/scsi/qla2xxx/qla_os.c +4 −0
  337. drivers/scsi/scsi_error.c +3 −0
  338. drivers/scsi/scsi_lib.c +3 −1
  339. drivers/scsi/scsi_sysfs.c +10 −1
  340. drivers/scsi/sd.c +2 −1
  341. drivers/scsi/sni_53c710.c +1 −3
  342. drivers/soc/imx/soc-imx-scu.c +1 −1
  343. drivers/staging/wlan-ng/cfg80211.c +2 −4
  344. drivers/target/target_core_device.c +0 −21
  345. drivers/thermal/cpu_cooling.c +7 −7
  346. drivers/tty/serial/8250/8250_men_mcb.c +4 −4
  347. drivers/usb/cdns3/core.c +3 −1
  348. drivers/usb/cdns3/gadget.c +20 −15
  349. drivers/usb/class/usblp.c +3 −1
  350. drivers/usb/gadget/udc/lpc32xx_udc.c +3 −3
  351. drivers/usb/misc/ldusb.c +12 −11
  352. drivers/usb/misc/legousbtower.c +2 −5
  353. drivers/usb/serial/ti_usb_3410_5052.c +4 −8
  354. drivers/vfio/vfio_iommu_type1.c +1 −1
  355. drivers/vhost/test.c +2 −0
  356. drivers/xen/pvcalls-back.c +1 −1
  357. fs/btrfs/block-group.c +1 −0
  358. fs/btrfs/ctree.h +1 −4
  359. fs/btrfs/delalloc-space.c +2 −5
  360. fs/btrfs/disk-io.c +0 −6
  361. fs/btrfs/file.c +20 −23
  362. fs/btrfs/inode-map.c +2 −2
  363. fs/btrfs/inode.c +6 −6
  364. fs/btrfs/ioctl.c +2 −4
  365. fs/btrfs/qgroup.c +2 −2
  366. fs/btrfs/relocation.c +5 −4
  367. fs/ceph/mds_client.c +11 −10
  368. fs/cifs/cifsfs.c +7 −1
  369. fs/cifs/cifsglob.h +5 −0
  370. fs/cifs/cifsproto.h +1 −0
  371. fs/cifs/connect.c +15 −3
  372. fs/cifs/file.c +18 −11
  373. fs/cifs/inode.c +2 −2
  374. fs/cifs/smb1ops.c +3 −0
  375. fs/cifs/smb2file.c +1 −1
  376. fs/cifs/transport.c +23 −19
  377. fs/dax.c +3 −2
  378. fs/direct-io.c +1 −2
  379. fs/fs-writeback.c +1 −1
  380. fs/gfs2/ops_fstype.c +1 −0
  381. fs/io_uring.c +172 −117
  382. fs/libfs.c +1 −2
  383. fs/ocfs2/file.c +2 −0
  384. fs/ocfs2/journal.c +2 −1
  385. fs/ocfs2/localalloc.c +2 −1
  386. fs/proc/meminfo.c +2 −2
  387. fs/proc/page.c +16 −12
  388. fs/readdir.c +2 −2
  389. fs/xfs/libxfs/xfs_fs.h +4 −4
  390. include/acpi/processor.h +10 −10
  391. include/linux/bitmap.h +2 −1
  392. include/linux/cpufreq.h +5 −2
  393. include/linux/export.h +5 −9
  394. include/linux/gpio/driver.h +8 −0
  395. include/linux/micrel_phy.h +1 −1
  396. include/linux/page_ext.h +9 −1
  397. include/linux/perf_event.h +1 −1
  398. include/linux/pm_qos.h +44 −12
  399. include/linux/sched.h +1 −0
  400. include/linux/skbuff.h +3 −2
  401. include/linux/sysfs.h +2 −2
  402. include/linux/tcp.h +3 −3
  403. include/linux/xarray.h +2 −2
  404. include/net/cfg80211.h +8 −0
  405. include/net/llc_conn.h +1 −1
  406. include/net/net_namespace.h +17 −8
  407. include/net/request_sock.h +2 −2
  408. include/net/sctp/sctp.h +5 −0
  409. include/net/sock.h +22 −11
  410. include/net/tcp.h +6 −4
  411. include/scsi/scsi_eh.h +1 −0
  412. include/sound/hda_register.h +3 −0
  413. include/sound/simple_card_utils.h +4 −4
  414. include/trace/events/btrfs.h +2 −1
  415. include/trace/events/rxrpc.h +9 −9
  416. include/trace/events/sock.h +2 −2
  417. kernel/events/core.c +2 −2
  418. kernel/events/uprobes.c +11 −2
  419. kernel/gen_kheaders.sh +7 −4
  420. kernel/kthread.c +3 −3
  421. kernel/power/main.c +1 −0
  422. kernel/power/qos.c +240 −0
  423. kernel/stop_machine.c +6 −4
  424. kernel/sysctl.c +2 −2
  425. kernel/time/hrtimer.c +4 −4
  426. kernel/time/posix-cpu-timers.c +3 −3
  427. kernel/time/sched_clock.c +2 −0
  428. kernel/trace/trace_event_perf.c +4 −0
  429. kernel/trace/trace_events_hist.c +2 −0
  430. lib/generic-radix-tree.c +26 −6
  431. lib/test_meminit.c +27 −0
  432. lib/test_user_copy.c +28 −9
  433. lib/vdso/gettimeofday.c +5 −4
  434. mm/compaction.c +4 −3
  435. mm/filemap.c +1 −0
  436. mm/gup.c +8 −6
  437. mm/huge_memory.c +7 −2
  438. mm/hugetlb.c +2 −3
  439. mm/init-mm.c +1 −0
  440. mm/kmemleak.c +21 −9
  441. mm/memblock.c +3 −3
  442. mm/memcontrol.c +12 −6
  443. mm/memory-failure.c +21 −15
  444. mm/memory_hotplug.c +15 −57
  445. mm/memremap.c +7 −4
  446. mm/page_alloc.c +4 −2
  447. mm/page_ext.c +9 −14
  448. mm/page_owner.c +23 −37
  449. mm/rmap.c +1 −0
  450. mm/slab.c +3 −0
  451. mm/slab_common.c +5 −4
  452. mm/slub.c +27 −8
  453. mm/truncate.c +12 −0
  454. mm/vmscan.c +6 −8
  455. net/bridge/netfilter/nf_conntrack_bridge.c +3 −0
  456. net/core/datagram.c +1 −1
  457. net/core/filter.c +5 −3
  458. net/core/net_namespace.c +11 −6
  459. net/core/request_sock.c +1 −1
  460. net/core/skbuff.c +13 −10
  461. net/core/sock.c +18 −14
  462. net/dsa/dsa2.c +1 −1
  463. net/ipv4/inet_connection_sock.c +3 −3
  464. net/ipv4/inet_diag.c +1 −1
  465. net/ipv4/ip_output.c +3 −0
  466. net/ipv4/route.c +7 −4
  467. net/ipv4/tcp.c +45 −30
  468. net/ipv4/tcp_diag.c +3 −2
  469. net/ipv4/tcp_fastopen.c +1 −1
  470. net/ipv4/tcp_input.c +22 −15
  471. net/ipv4/tcp_ipv4.c +17 −13
  472. net/ipv4/tcp_minisocks.c +11 −6
  473. net/ipv4/tcp_output.c +16 −16
  474. net/ipv4/tcp_timer.c +6 −5
  475. net/ipv6/ip6_gre.c +1 −0
  476. net/ipv6/ip6_output.c +3 −0
  477. net/ipv6/netfilter.c +3 −0
  478. net/ipv6/tcp_ipv6.c +10 −8
  479. net/llc/af_llc.c +20 −14
  480. net/llc/llc_c_ac.c +6 −2
  481. net/llc/llc_conn.c +18 −51
  482. net/llc/llc_if.c +8 −4
  483. net/llc/llc_s_ac.c +9 −3
  484. net/llc/llc_sap.c +8 −15
  485. net/mac80211/mlme.c +3 −2
  486. net/mac80211/rx.c +10 −1
  487. net/mac80211/scan.c +28 −2
  488. net/netfilter/nf_conntrack_core.c +2 −2
  489. net/openvswitch/actions.c +3 −2
  490. net/rxrpc/ar-internal.h +1 −0
  491. net/rxrpc/call_accept.c +3 −2
  492. net/rxrpc/call_object.c +20 −14
  493. net/rxrpc/conn_client.c +7 −2
  494. net/rxrpc/conn_object.c +7 −6
  495. net/rxrpc/conn_service.c +1 −1
  496. net/rxrpc/peer_event.c +9 −2
  497. net/rxrpc/peer_object.c +10 −6
  498. net/rxrpc/recvmsg.c +3 −3
  499. net/rxrpc/sendmsg.c +2 −1
  500. net/sched/act_api.c +13 −10
  501. net/sched/act_mirred.c +5 −1
  502. net/sched/act_mpls.c +8 −4
  503. net/sched/cls_api.c +33 −3
  504. net/sched/em_meta.c +2 −2
  505. net/sched/sch_api.c +1 −2
  506. net/sched/sch_etf.c +1 −1
  507. net/sched/sch_netem.c +8 −3
  508. net/sched/sch_taprio.c +4 −0
  509. net/sctp/diag.c +1 −1
  510. net/sctp/input.c +11 −5
  511. net/sctp/socket.c +2 −2
  512. net/smc/smc_core.c +4 −1
  513. net/smc/smc_rx.c +21 −8
  514. net/tipc/socket.c +4 −4
  515. net/vmw_vsock/virtio_transport_common.c +14 −3
  516. net/wireless/nl80211.c +1 −1
  517. net/wireless/reg.c +1 −0
  518. net/wireless/reg.h +0 −8
  519. net/wireless/scan.c +13 −10
  520. net/wireless/wext-sme.c +6 −2
  521. net/x25/x25_dev.c +1 −1
  522. net/xdp/xsk.c +27 −15
  523. samples/bpf/asm_goto_workaround.h +12 −1
  524. samples/bpf/task_fd_query_user.c +1 −0
  525. scripts/coccinelle/api/devm_platform_ioremap_resource.cocci +0 −60
  526. scripts/gdb/linux/dmesg.py +12 −4
  527. scripts/gdb/linux/symbols.py +7 −1
  528. scripts/gdb/linux/utils.py +13 −12
  529. scripts/mod/modpost.c +40 −19
  530. scripts/mod/modpost.h +1 −0
  531. scripts/nsdeps +1 −1
  532. scripts/setlocalversion +1 −1
  533. sound/hda/ext/hdac_ext_controller.c +5 −0
  534. sound/pci/hda/hda_intel.c +6 −0
  535. sound/pci/hda/patch_hdmi.c +2 −0
  536. sound/pci/hda/patch_realtek.c +35 −3
  537. sound/soc/codecs/max98373.c +12 −8
  538. sound/soc/codecs/msm8916-wcd-digital.c +22 −0
  539. sound/soc/codecs/rt5651.c +3 −0
  540. sound/soc/codecs/rt5682.c +10 −2
  541. sound/soc/codecs/wm8994.c +26 −17
  542. sound/soc/codecs/wm_adsp.c +7 −3
  543. sound/soc/intel/boards/sof_rt5682.c +56 −4
  544. sound/soc/rockchip/rockchip_i2s.c +1 −1
  545. sound/soc/samsung/arndale_rt5631.c +30 −4
  546. sound/soc/sh/rcar/core.c +1 −0
  547. sound/soc/soc-pcm.c +12 −5
  548. sound/soc/soc-topology.c +1 −1
  549. sound/soc/sof/control.c +18 −8
  550. sound/soc/sof/intel/Kconfig +10 −0
  551. sound/soc/sof/intel/bdw.c +7 −0
  552. sound/soc/sof/intel/byt.c +6 −0
  553. sound/soc/sof/intel/hda-ctrl.c +4 −8
  554. sound/soc/sof/intel/hda-loader.c +1 −0
  555. sound/soc/sof/intel/hda-stream.c +38 −7
  556. sound/soc/sof/intel/hda.c +7 −0
  557. sound/soc/sof/intel/hda.h +4 −1
  558. sound/soc/sof/loader.c +2 −2
  559. sound/soc/sof/pcm.c +24 −11
  560. sound/soc/sof/topology.c +3 −1
  561. sound/soc/stm/stm32_sai_sub.c +11 −10
  562. sound/usb/pcm.c +3 −0
  563. sound/usb/validate.c +1 −1
  564. tools/bpf/Makefile +5 −1
  565. tools/lib/bpf/Makefile +23 −10
  566. tools/lib/bpf/libbpf_internal.h +16 −0
  567. tools/lib/bpf/xsk.c +2 −2
  568. tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c +1 −1
  569. tools/testing/selftests/bpf/prog_tests/tcp_rtt.c +2 −1
  570. tools/testing/selftests/bpf/test_flow_dissector.sh +3 −0
  571. tools/testing/selftests/bpf/test_lwt_ip_encap.sh +3 −3
  572. tools/testing/selftests/kvm/.gitignore +2 −0
  573. tools/testing/selftests/kvm/include/x86_64/vmx.h +2 −0
  574. tools/testing/selftests/kvm/lib/x86_64/vmx.c +10 −0
  575. tools/testing/selftests/kvm/x86_64/sync_regs_test.c +11 −10
  576. tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c +1 −5
  577. tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c +2 −0
  578. tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c +2 −11
  579. tools/testing/selftests/kvm/x86_64/vmx_tsc_adjust_test.c +1 −5
  580. tools/testing/selftests/vm/gup_benchmark.c +1 −1
  581. tools/virtio/crypto/hash.h +0 −0
  582. tools/virtio/linux/dma-mapping.h +2 −0
  583. tools/virtio/xen/xen.h +6 −0
  584. virt/kvm/arm/pmu.c +35 −13
  585. virt/kvm/kvm_main.c +16 −13
.mailmap+3−1
@@ -196,7 +196,8 @@ Oleksij Rempel <linux@rempel-privat.de> <o.rempel@pengutronix.de> · 195 unmodified lines
196196 Oleksij Rempel <linux@rempel-privat.de> <ore@pengutronix.de>
197197 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
198198 Patrick Mochel <mochel@digitalimplant.org>
199−Paul Burton <paul.burton@mips.com> <paul.burton@imgtec.com>
199+Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com>
200+Paul Burton <paulburton@kernel.org> <paul.burton@mips.com>
200201 Peter A Jonsson <pj@ludd.ltu.se>
201202 Peter Oruba <peter@oruba.de>
202203 Peter Oruba <peter.oruba@amd.com>
@@ -229,6 +230,7 @@ Shuah Khan <shuah@kernel.org> <shuahkhan@gmail.com> · 26 unmodified lines
229230 Shuah Khan <shuah@kernel.org> <shuah.khan@hp.com>
230231 Shuah Khan <shuah@kernel.org> <shuahkh@osg.samsung.com>
231232 Shuah Khan <shuah@kernel.org> <shuah.kh@samsung.com>
233+Simon Arlott <simon@octiron.net> <simon@fire.lp0.eu>
232234 Simon Kelley <simon@thekelleys.org.uk>
233235 Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
234236 Stephen Hemminger <shemminger@osdl.org>
Documentation/arm64/silicon-errata.rst+2−0
@@ -107,6 +107,8 @@ stable kernels. · 106 unmodified lines
107107 +----------------+-----------------+-----------------+-----------------------------+
108108 | Cavium | ThunderX2 SMMUv3| #126 | N/A |
109109 +----------------+-----------------+-----------------+-----------------------------+
110+| Cavium | ThunderX2 Core | #219 | CAVIUM_TX2_ERRATUM_219 |
111++----------------+-----------------+-----------------+-----------------------------+
110112 +----------------+-----------------+-----------------+-----------------------------+
111113 | Freescale/NXP | LS2080A/LS1043A | A-008585 | FSL_ERRATUM_A008585 |
112114 +----------------+-----------------+-----------------+-----------------------------+
Documentation/dev-tools/kasan.rst+3−0
@@ -41,6 +41,9 @@ smaller binary while the latter is 1.1 - 2 times faster. · 40 unmodified lines
4141 Both KASAN modes work with both SLUB and SLAB memory allocators.
4242 For better bug detection and nicer reporting, enable CONFIG_STACKTRACE.
4343
44+To augment reports with last allocation and freeing stack of the physical page,
45+it is recommended to enable also CONFIG_PAGE_OWNER and boot with page_owner=on.
46+
4447 To disable instrumentation for specific files or directories, add a line
4548 similar to the following to the respective kernel Makefile:
4649
Documentation/devicetree/bindings/arm/rockchip.yaml+2−2
@@ -496,12 +496,12 @@ properties: · 495 unmodified lines
496496
497497 - description: Theobroma Systems RK3368-uQ7 with Haikou baseboard
498498 items:
499− - const: tsd,rk3368-uq7-haikou
499+ - const: tsd,rk3368-lion-haikou
500500 - const: rockchip,rk3368
501501
502502 - description: Theobroma Systems RK3399-Q7 with Haikou baseboard
503503 items:
504− - const: tsd,rk3399-q7-haikou
504+ - const: tsd,rk3399-puma-haikou
505505 - const: rockchip,rk3399
506506
507507 - description: Tronsmart Orion R68 Meta
Documentation/devicetree/bindings/interrupt-controller/atmel,aic.txt+5−2
@@ -1,8 +1,11 @@
11 * Advanced Interrupt Controller (AIC)
22
33 Required properties:
4−- compatible: Should be "atmel,<chip>-aic"
5− <chip> can be "at91rm9200", "sama5d2", "sama5d3" or "sama5d4"
4+- compatible: Should be:
5+ - "atmel,<chip>-aic" where <chip> can be "at91rm9200", "sama5d2",
6+ "sama5d3" or "sama5d4"
7+ - "microchip,<chip>-aic" where <chip> can be "sam9x60"
8+
69 - interrupt-controller: Identifies the node as an interrupt controller.
710 - #interrupt-cells: The number of cells to define the interrupts. It should be 3.
811 The first cell is the IRQ number (aka "Peripheral IDentifier" on datasheet).
Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml+3−6
@@ -1,7 +1,7 @@
11 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
22 %YAML 1.2
33 ---
4−$id: http://devicetree.org/schemas/arm/allwinner,sun4i-a10-csi.yaml#
4+$id: http://devicetree.org/schemas/media/allwinner,sun4i-a10-csi.yaml#
55 $schema: http://devicetree.org/meta-schemas/core.yaml#
66
77 title: Allwinner A10 CMOS Sensor Interface (CSI) Device Tree Bindings
@@ -27,14 +27,12 @@ properties: · 19 unmodified lines
2727 clocks:
2828 items:
2929 - description: The CSI interface clock
30− - description: The CSI module clock
3130 - description: The CSI ISP clock
3231 - description: The CSI DRAM clock
3332
3433 clock-names:
3534 items:
3635 - const: bus
37− - const: mod
3836 - const: isp
3937 - const: ram
4038
@@ -89,9 +87,8 @@ examples: · 48 unmodified lines
8987 compatible = "allwinner,sun7i-a20-csi0";
9088 reg = <0x01c09000 0x1000>;
9189 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
92− clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI0>,
93− <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>;
94− clock-names = "bus", "mod", "isp", "ram";
90+ clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>;
91+ clock-names = "bus", "isp", "ram";
9592 resets = <&ccu RST_CSI0>;
9693
9794 port {
Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml+42−44
@@ -33,13 +33,13 @@ patternProperties: · 32 unmodified lines
3333 allOf:
3434 - $ref: "/schemas/types.yaml#/definitions/string"
3535 - enum: [ ADC0, ADC1, ADC10, ADC11, ADC12, ADC13, ADC14, ADC15,
36− ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, ESPI,
37− ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, FWSPIWP, GPIT0, GPIT1,
38− GPIT2, GPIT3, GPIT4, GPIT5, GPIT6, GPIT7, GPIU0, GPIU1, GPIU2,
39− GPIU3, GPIU4, GPIU5, GPIU6, GPIU7, I2C1, I2C10, I2C11, I2C12,
40− I2C13, I2C14, I2C15, I2C16, I2C2, I2C3, I2C4, I2C5, I2C6, I2C7,
41− I2C8, I2C9, I3C3, I3C4, I3C5, I3C6, JTAGM, LHPD, LHSIRQ, LPC,
42− LPCHC, LPCPD, LPCPME, LPCSMI, LSIRQ, MACLINK1, MACLINK2,
36+ ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, EMMC,
37+ ESPI, ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, FWSPIWP, GPIT0,
38+ GPIT1, GPIT2, GPIT3, GPIT4, GPIT5, GPIT6, GPIT7, GPIU0, GPIU1,
39+ GPIU2, GPIU3, GPIU4, GPIU5, GPIU6, GPIU7, I2C1, I2C10, I2C11,
40+ I2C12, I2C13, I2C14, I2C15, I2C16, I2C2, I2C3, I2C4, I2C5, I2C6,
41+ I2C7, I2C8, I2C9, I3C3, I3C4, I3C5, I3C6, JTAGM, LHPD, LHSIRQ,
42+ LPC, LPCHC, LPCPD, LPCPME, LPCSMI, LSIRQ, MACLINK1, MACLINK2,
4343 MACLINK3, MACLINK4, MDIO1, MDIO2, MDIO3, MDIO4, NCTS1, NCTS2,
4444 NCTS3, NCTS4, NDCD1, NDCD2, NDCD3, NDCD4, NDSR1, NDSR2, NDSR3,
4545 NDSR4, NDTR1, NDTR2, NDTR3, NDTR4, NRI1, NRI2, NRI3, NRI4, NRTS1,
@@ -48,47 +48,45 @@ patternProperties: · 2 unmodified lines
4848 PWM8, PWM9, RGMII1, RGMII2, RGMII3, RGMII4, RMII1, RMII2, RMII3,
4949 RMII4, RXD1, RXD2, RXD3, RXD4, SALT1, SALT10, SALT11, SALT12,
5050 SALT13, SALT14, SALT15, SALT16, SALT2, SALT3, SALT4, SALT5,
51− SALT6, SALT7, SALT8, SALT9, SD1, SD2, SD3, SD3DAT4, SD3DAT5,
52− SD3DAT6, SD3DAT7, SGPM1, SGPS1, SIOONCTRL, SIOPBI, SIOPBO,
53− SIOPWREQ, SIOPWRGD, SIOS3, SIOS5, SIOSCI, SPI1, SPI1ABR, SPI1CS1,
54− SPI1WP, SPI2, SPI2CS1, SPI2CS2, TACH0, TACH1, TACH10, TACH11,
55− TACH12, TACH13, TACH14, TACH15, TACH2, TACH3, TACH4, TACH5,
56− TACH6, TACH7, TACH8, TACH9, THRU0, THRU1, THRU2, THRU3, TXD1,
57− TXD2, TXD3, TXD4, UART10, UART11, UART12, UART13, UART6, UART7,
58− UART8, UART9, VB, VGAHS, VGAVS, WDTRST1, WDTRST2, WDTRST3,
59− WDTRST4, ]
51+ SALT6, SALT7, SALT8, SALT9, SD1, SD2, SGPM1, SGPS1, SIOONCTRL,
52+ SIOPBI, SIOPBO, SIOPWREQ, SIOPWRGD, SIOS3, SIOS5, SIOSCI, SPI1,
53+ SPI1ABR, SPI1CS1, SPI1WP, SPI2, SPI2CS1, SPI2CS2, TACH0, TACH1,
54+ TACH10, TACH11, TACH12, TACH13, TACH14, TACH15, TACH2, TACH3,
55+ TACH4, TACH5, TACH6, TACH7, TACH8, TACH9, THRU0, THRU1, THRU2,
56+ THRU3, TXD1, TXD2, TXD3, TXD4, UART10, UART11, UART12, UART13,
57+ UART6, UART7, UART8, UART9, VB, VGAHS, VGAVS, WDTRST1, WDTRST2,
58+ WDTRST3, WDTRST4, ]
6059 groups:
6160 allOf:
6261 - $ref: "/schemas/types.yaml#/definitions/string"
6362 - enum: [ ADC0, ADC1, ADC10, ADC11, ADC12, ADC13, ADC14, ADC15,
64− ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, ESPI,
65− ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID, FWQSPID, FWSPIWP, GPIT0,
66− GPIT1, GPIT2, GPIT3, GPIT4, GPIT5, GPIT6, GPIT7, GPIU0, GPIU1,
67− GPIU2, GPIU3, GPIU4, GPIU5, GPIU6, GPIU7, HVI3C3, HVI3C4, I2C1,
68− I2C10, I2C11, I2C12, I2C13, I2C14, I2C15, I2C16, I2C2, I2C3,
69− I2C4, I2C5, I2C6, I2C7, I2C8, I2C9, I3C3, I3C4, I3C5, I3C6,
70− JTAGM, LHPD, LHSIRQ, LPC, LPCHC, LPCPD, LPCPME, LPCSMI, LSIRQ,
71− MACLINK1, MACLINK2, MACLINK3, MACLINK4, MDIO1, MDIO2, MDIO3,
72− MDIO4, NCTS1, NCTS2, NCTS3, NCTS4, NDCD1, NDCD2, NDCD3, NDCD4,
73− NDSR1, NDSR2, NDSR3, NDSR4, NDTR1, NDTR2, NDTR3, NDTR4, NRI1,
74− NRI2, NRI3, NRI4, NRTS1, NRTS2, NRTS3, NRTS4, OSCCLK, PEWAKE,
75− PWM0, PWM1, PWM10G0, PWM10G1, PWM11G0, PWM11G1, PWM12G0, PWM12G1,
76− PWM13G0, PWM13G1, PWM14G0, PWM14G1, PWM15G0, PWM15G1, PWM2, PWM3,
77− PWM4, PWM5, PWM6, PWM7, PWM8G0, PWM8G1, PWM9G0, PWM9G1, QSPI1,
78− QSPI2, RGMII1, RGMII2, RGMII3, RGMII4, RMII1, RMII2, RMII3,
79− RMII4, RXD1, RXD2, RXD3, RXD4, SALT1, SALT10G0, SALT10G1,
80− SALT11G0, SALT11G1, SALT12G0, SALT12G1, SALT13G0, SALT13G1,
81− SALT14G0, SALT14G1, SALT15G0, SALT15G1, SALT16G0, SALT16G1,
82− SALT2, SALT3, SALT4, SALT5, SALT6, SALT7, SALT8, SALT9G0,
83− SALT9G1, SD1, SD2, SD3, SD3DAT4, SD3DAT5, SD3DAT6, SD3DAT7,
84− SGPM1, SGPS1, SIOONCTRL, SIOPBI, SIOPBO, SIOPWREQ, SIOPWRGD,
85− SIOS3, SIOS5, SIOSCI, SPI1, SPI1ABR, SPI1CS1, SPI1WP, SPI2,
86− SPI2CS1, SPI2CS2, TACH0, TACH1, TACH10, TACH11, TACH12, TACH13,
87− TACH14, TACH15, TACH2, TACH3, TACH4, TACH5, TACH6, TACH7, TACH8,
88− TACH9, THRU0, THRU1, THRU2, THRU3, TXD1, TXD2, TXD3, TXD4,
89− UART10, UART11, UART12G0, UART12G1, UART13G0, UART13G1, UART6,
90− UART7, UART8, UART9, VB, VGAHS, VGAVS, WDTRST1, WDTRST2, WDTRST3,
91− WDTRST4, ]
63+ ADC2, ADC3, ADC4, ADC5, ADC6, ADC7, ADC8, ADC9, BMCINT, EMMCG1,
64+ EMMCG4, EMMCG8, ESPI, ESPIALT, FSI1, FSI2, FWSPIABR, FWSPID,
65+ FWQSPID, FWSPIWP, GPIT0, GPIT1, GPIT2, GPIT3, GPIT4, GPIT5,
66+ GPIT6, GPIT7, GPIU0, GPIU1, GPIU2, GPIU3, GPIU4, GPIU5, GPIU6,
67+ GPIU7, HVI3C3, HVI3C4, I2C1, I2C10, I2C11, I2C12, I2C13, I2C14,
68+ I2C15, I2C16, I2C2, I2C3, I2C4, I2C5, I2C6, I2C7, I2C8, I2C9,
69+ I3C3, I3C4, I3C5, I3C6, JTAGM, LHPD, LHSIRQ, LPC, LPCHC, LPCPD,
70+ LPCPME, LPCSMI, LSIRQ, MACLINK1, MACLINK2, MACLINK3, MACLINK4,
71+ MDIO1, MDIO2, MDIO3, MDIO4, NCTS1, NCTS2, NCTS3, NCTS4, NDCD1,
72+ NDCD2, NDCD3, NDCD4, NDSR1, NDSR2, NDSR3, NDSR4, NDTR1, NDTR2,
73+ NDTR3, NDTR4, NRI1, NRI2, NRI3, NRI4, NRTS1, NRTS2, NRTS3, NRTS4,
74+ OSCCLK, PEWAKE, PWM0, PWM1, PWM10G0, PWM10G1, PWM11G0, PWM11G1,
75+ PWM12G0, PWM12G1, PWM13G0, PWM13G1, PWM14G0, PWM14G1, PWM15G0,
76+ PWM15G1, PWM2, PWM3, PWM4, PWM5, PWM6, PWM7, PWM8G0, PWM8G1,
77+ PWM9G0, PWM9G1, QSPI1, QSPI2, RGMII1, RGMII2, RGMII3, RGMII4,
78+ RMII1, RMII2, RMII3, RMII4, RXD1, RXD2, RXD3, RXD4, SALT1,
79+ SALT10G0, SALT10G1, SALT11G0, SALT11G1, SALT12G0, SALT12G1,
80+ SALT13G0, SALT13G1, SALT14G0, SALT14G1, SALT15G0, SALT15G1,
81+ SALT16G0, SALT16G1, SALT2, SALT3, SALT4, SALT5, SALT6, SALT7,
82+ SALT8, SALT9G0, SALT9G1, SD1, SD2, SD3, SGPM1, SGPS1, SIOONCTRL,
83+ SIOPBI, SIOPBO, SIOPWREQ, SIOPWRGD, SIOS3, SIOS5, SIOSCI, SPI1,
84+ SPI1ABR, SPI1CS1, SPI1WP, SPI2, SPI2CS1, SPI2CS2, TACH0, TACH1,
85+ TACH10, TACH11, TACH12, TACH13, TACH14, TACH15, TACH2, TACH3,
86+ TACH4, TACH5, TACH6, TACH7, TACH8, TACH9, THRU0, THRU1, THRU2,
87+ THRU3, TXD1, TXD2, TXD3, TXD4, UART10, UART11, UART12G0,
88+ UART12G1, UART13G0, UART13G1, UART6, UART7, UART8, UART9, VB,
89+ VGAHS, VGAVS, WDTRST1, WDTRST2, WDTRST3, WDTRST4, ]
9290
9391 required:
9492 - compatible
Documentation/devicetree/bindings/regulator/fixed-regulator.yaml+2−2
@@ -30,8 +30,8 @@ if: · 29 unmodified lines
3030 properties:
3131 compatible:
3232 enum:
33− - const: regulator-fixed
34− - const: regulator-fixed-clock
33+ - regulator-fixed
34+ - regulator-fixed-clock
3535
3636 regulator-name: true
3737
Documentation/devicetree/bindings/riscv/cpus.yaml+13−16
@@ -24,15 +24,17 @@ description: | · 23 unmodified lines
2424
2525 properties:
2626 compatible:
27− items:
28− - enum:
29− - sifive,rocket0
30− - sifive,e5
31− - sifive,e51
32− - sifive,u54-mc
33− - sifive,u54
34− - sifive,u5
35− - const: riscv
27+ oneOf:
28+ - items:
29+ - enum:
30+ - sifive,rocket0
31+ - sifive,e5
32+ - sifive,e51
33+ - sifive,u54-mc
34+ - sifive,u54
35+ - sifive,u5
36+ - const: riscv
37+ - const: riscv # Simulator only
3638 description:
3739 Identifies that the hart uses the RISC-V instruction set
3840 and identifies the type of the hart.
@@ -66,12 +68,8 @@ properties: · 27 unmodified lines
6668 insensitive, letters in the riscv,isa string must be all
6769 lowercase to simplify parsing.
6870
69− timebase-frequency:
70− type: integer
71− minimum: 1
72− description:
73− Specifies the clock frequency of the system timer in Hz.
74− This value is common to all harts on a single system image.
71+ # RISC-V requires 'timebase-frequency' in /cpus, so disallow it here
72+ timebase-frequency: false
7573
7674 interrupt-controller:
7775 type: object
@@ -93,7 +91,6 @@ properties: · 15 unmodified lines
9391
9492 required:
9593 - riscv,isa
96− - timebase-frequency
9794 - interrupt-controller
9895
9996 examples:
Documentation/networking/device_drivers/pensando/ionic.rst+3−1
@@ -36,8 +36,10 @@ Support · 35 unmodified lines
3636 =======
3737 For general Linux networking support, please use the netdev mailing
3838 list, which is monitored by Pensando personnel::
39+
3940 netdev@vger.kernel.org
4041
4142 For more specific support needs, please use the Pensando driver support
4243 email::
43− drivers@pensando.io
44+
45+ drivers@pensando.io
Documentation/networking/net_dim.txt+18−18
@@ -92,16 +92,16 @@ under some conditions. · 91 unmodified lines
9292 Part III: Registering a Network Device to DIM
9393 ==============================================
9494
95−Net DIM API exposes the main function net_dim(struct net_dim *dim,
96−struct net_dim_sample end_sample). This function is the entry point to the Net
95+Net DIM API exposes the main function net_dim(struct dim *dim,
96+struct dim_sample end_sample). This function is the entry point to the Net
9797 DIM algorithm and has to be called every time the driver would like to check if
9898 it should change interrupt moderation parameters. The driver should provide two
99−data structures: struct net_dim and struct net_dim_sample. Struct net_dim
99+data structures: struct dim and struct dim_sample. Struct dim
100100 describes the state of DIM for a specific object (RX queue, TX queue,
101101 other queues, etc.). This includes the current selected profile, previous data
102102 samples, the callback function provided by the driver and more.
103−Struct net_dim_sample describes a data sample, which will be compared to the
104−data sample stored in struct net_dim in order to decide on the algorithm's next
103+Struct dim_sample describes a data sample, which will be compared to the
104+data sample stored in struct dim in order to decide on the algorithm's next
105105 step. The sample should include bytes, packets and interrupts, measured by
106106 the driver.
107107
@@ -110,9 +110,9 @@ main net_dim() function. The recommended method is to call net_dim() on each · 2 unmodified lines
110110 interrupt. Since Net DIM has a built-in moderation and it might decide to skip
111111 iterations under certain conditions, there is no need to moderate the net_dim()
112112 calls as well. As mentioned above, the driver needs to provide an object of type
113−struct net_dim to the net_dim() function call. It is advised for each entity
114−using Net DIM to hold a struct net_dim as part of its data structure and use it
115−as the main Net DIM API object. The struct net_dim_sample should hold the latest
113+struct dim to the net_dim() function call. It is advised for each entity
114+using Net DIM to hold a struct dim as part of its data structure and use it
115+as the main Net DIM API object. The struct dim_sample should hold the latest
116116 bytes, packets and interrupts count. No need to perform any calculations, just
117117 include the raw data.
118118
@@ -132,19 +132,19 @@ usage is not complete but it should make the outline of the usage clear. · 13 unmodified lines
132132
133133 my_driver.c:
134134
135−#include <linux/net_dim.h>
135+#include <linux/dim.h>
136136
137137 /* Callback for net DIM to schedule on a decision to change moderation */
138138 void my_driver_do_dim_work(struct work_struct *work)
139139 {
140− /* Get struct net_dim from struct work_struct */
141− struct net_dim *dim = container_of(work, struct net_dim,
142− work);
140+ /* Get struct dim from struct work_struct */
141+ struct dim *dim = container_of(work, struct dim,
142+ work);
143143 /* Do interrupt moderation related stuff */
144144 ...
145145
146146 /* Signal net DIM work is done and it should move to next iteration */
147− dim->state = NET_DIM_START_MEASURE;
147+ dim->state = DIM_START_MEASURE;
148148 }
149149
150150 /* My driver's interrupt handler */
@@ -152,13 +152,13 @@ int my_driver_handle_interrupt(struct my_driver_entity *my_entity, ...) · 1 unmodified line
152152 {
153153 ...
154154 /* A struct to hold current measured data */
155− struct net_dim_sample dim_sample;
155+ struct dim_sample dim_sample;
156156 ...
157157 /* Initiate data sample struct with current data */
158− net_dim_sample(my_entity->events,
159− my_entity->packets,
160− my_entity->bytes,
161− &dim_sample);
158+ dim_update_sample(my_entity->events,
159+ my_entity->packets,
160+ my_entity->bytes,
161+ &dim_sample);
162162 /* Call net DIM */
163163 net_dim(&my_entity->dim, dim_sample);
164164 ...
MAINTAINERS+17−13
@@ -2323,11 +2323,13 @@ F: drivers/edac/altera_edac. · 2322 unmodified lines
23232323
23242324 ARM/SPREADTRUM SoC SUPPORT
23252325 M: Orson Zhai <orsonzhai@gmail.com>
2326−M: Baolin Wang <baolin.wang@linaro.org>
2326+M: Baolin Wang <baolin.wang7@gmail.com>
23272327 M: Chunyan Zhang <zhang.lyra@gmail.com>
23282328 S: Maintained
23292329 F: arch/arm64/boot/dts/sprd
23302330 N: sprd
2331+N: sc27xx
2332+N: sc2731
23312333
23322334 ARM/STI ARCHITECTURE
23332335 M: Patrice Chotard <patrice.chotard@st.com>
@@ -3096,7 +3098,7 @@ S: Supported · 762 unmodified lines
30963098 F: arch/arm64/net/
30973099
30983100 BPF JIT for MIPS (32-BIT AND 64-BIT)
3099−M: Paul Burton <paul.burton@mips.com>
3101+M: Paul Burton <paulburton@kernel.org>
31003102 L: netdev@vger.kernel.org
31013103 L: bpf@vger.kernel.org
31023104 S: Maintained
@@ -3183,7 +3185,7 @@ N: bcm216* · 80 unmodified lines
31833185 N: kona
31843186 F: arch/arm/mach-bcm/
31853187
3186−BROADCOM BCM2835 ARM ARCHITECTURE
3188+BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE
31873189 M: Eric Anholt <eric@anholt.net>
31883190 M: Stefan Wahren <wahrenst@gmx.net>
31893191 L: bcm-kernel-feedback-list@broadcom.com
@@ -3191,6 +3193,7 @@ L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) · 1 unmodified line
31913193 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
31923194 T: git git://github.com/anholt/linux
31933195 S: Maintained
3196+N: bcm2711
31943197 N: bcm2835
31953198 F: drivers/staging/vc04_services
31963199
@@ -3237,8 +3240,6 @@ S: Maintained · 40 unmodified lines
32373240 F: drivers/usb/gadget/udc/bcm63xx_udc.*
32383241
32393242 BROADCOM BCM7XXX ARM ARCHITECTURE
3240−M: Brian Norris <computersforpeace@gmail.com>
3241−M: Gregory Fong <gregory.0xf0@gmail.com>
32423243 M: Florian Fainelli <f.fainelli@gmail.com>
32433244 M: bcm-kernel-feedback-list@broadcom.com
32443245 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@ -8001,7 +8002,7 @@ S: Maintained · 4756 unmodified lines
80018002 F: drivers/usb/atm/ueagle-atm.c
80028003
80038004 IMGTEC ASCII LCD DRIVER
8004−M: Paul Burton <paul.burton@mips.com>
8005+M: Paul Burton <paulburton@kernel.org>
80058006 S: Maintained
80068007 F: Documentation/devicetree/bindings/auxdisplay/img-ascii-lcd.txt
80078008 F: drivers/auxdisplay/img-ascii-lcd.c
@@ -9122,7 +9123,7 @@ F: drivers/auxdisplay/ks0108.c · 1114 unmodified lines
91229123 F: include/linux/ks0108.h
91239124
91249125 L3MDEV
9125−M: David Ahern <dsa@cumulusnetworks.com>
9126+M: David Ahern <dsahern@kernel.org>
91269127 L: netdev@vger.kernel.org
91279128 S: Maintained
91289129 F: net/l3mdev
@@ -10255,7 +10256,7 @@ MEDIATEK ETHERNET DRIVER · 1126 unmodified lines
1025510256 M: Felix Fietkau <nbd@openwrt.org>
1025610257 M: John Crispin <john@phrozen.org>
1025710258 M: Sean Wang <sean.wang@mediatek.com>
10258−M: Nelson Chang <nelson.chang@mediatek.com>
10259+M: Mark Lee <Mark-MC.Lee@mediatek.com>
1025910260 L: netdev@vger.kernel.org
1026010261 S: Maintained
1026110262 F: drivers/net/ethernet/mediatek/
@@ -10828,7 +10829,7 @@ F: drivers/usb/image/microtek.* · 566 unmodified lines
1082810829
1082910830 MIPS
1083010831 M: Ralf Baechle <ralf@linux-mips.org>
10831−M: Paul Burton <paul.burton@mips.com>
10832+M: Paul Burton <paulburton@kernel.org>
1083210833 M: James Hogan <jhogan@kernel.org>
1083310834 L: linux-mips@vger.kernel.org
1083410835 W: http://www.linux-mips.org/
@@ -10842,7 +10843,7 @@ F: arch/mips/ · 7 unmodified lines
1084210843 F: drivers/platform/mips/
1084310844
1084410845 MIPS BOSTON DEVELOPMENT BOARD
10845−M: Paul Burton <paul.burton@mips.com>
10846+M: Paul Burton <paulburton@kernel.org>
1084610847 L: linux-mips@vger.kernel.org
1084710848 S: Maintained
1084810849 F: Documentation/devicetree/bindings/clock/img,boston-clock.txt
@@ -10852,7 +10853,7 @@ F: drivers/clk/imgtec/clk-boston.c · 3 unmodified lines
1085210853 F: include/dt-bindings/clock/boston-clock.h
1085310854
1085410855 MIPS GENERIC PLATFORM
10855−M: Paul Burton <paul.burton@mips.com>
10856+M: Paul Burton <paulburton@kernel.org>
1085610857 L: linux-mips@vger.kernel.org
1085710858 S: Supported
1085810859 F: Documentation/devicetree/bindings/power/mti,mips-cpc.txt
@@ -12312,12 +12313,15 @@ F: arch/parisc/ · 1453 unmodified lines
1231212313 F: Documentation/parisc/
1231312314 F: drivers/parisc/
1231412315 F: drivers/char/agp/parisc-agp.c
12316+F: drivers/input/misc/hp_sdc_rtc.c
1231512317 F: drivers/input/serio/gscps2.c
12318+F: drivers/input/serio/hp_sdc*
1231612319 F: drivers/parport/parport_gsc.*
1231712320 F: drivers/tty/serial/8250/8250_gsc.c
1231812321 F: drivers/video/fbdev/sti*
1231912322 F: drivers/video/console/sti*
1232012323 F: drivers/video/logo/logo_parisc*
12324+F: include/linux/hp_sdc.h
1232112325
1232212326 PARMAN
1232312327 M: Jiri Pirko <jiri@mellanox.com>
@@ -13368,7 +13372,7 @@ S: Maintained · 1044 unmodified lines
1336813372 F: drivers/scsi/qla1280.[ch]
1336913373
1337013374 QLOGIC QLA2XXX FC-SCSI DRIVER
13371−M: qla2xxx-upstream@qlogic.com
13375+M: hmadhani@marvell.com
1337213376 L: linux-scsi@vger.kernel.org
1337313377 S: Supported
1337413378 F: Documentation/scsi/LICENSE.qla2xxx
@@ -17437,7 +17441,7 @@ F: include/linux/regulator/ · 4062 unmodified lines
1743717441 K: regulator_get_optional
1743817442
1743917443 VRF
17440−M: David Ahern <dsa@cumulusnetworks.com>
17444+M: David Ahern <dsahern@kernel.org>
1744117445 M: Shrijeet Mukherjee <shrijeet@gmail.com>
1744217446 L: netdev@vger.kernel.org
1744317447 S: Maintained
Makefile+3−3
@@ -2,8 +2,8 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 4
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
6−NAME = Nesting Opossum
5+EXTRAVERSION = -rc5
6+NAME = Kleptomaniac Octopus
77
88 # *DOCUMENTATION*
99 # To see a list of typical targets execute "make help"
@@ -1037,7 +1037,7 @@ export KBUILD_VMLINUX_OBJS := $(head-y) $(init-y) $(core-y) $(libs-y2) \ · 1027 unmodified lines
10371037 export KBUILD_VMLINUX_LIBS := $(libs-y1)
10381038 export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
10391039 export LDFLAGS_vmlinux
1040−# used by scripts/package/Makefile
1040+# used by scripts/Makefile.package
10411041 export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) LICENSES arch include scripts tools)
10421042
10431043 vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
arch/arm/boot/dts/am3874-iceboard.dts+1−8
@@ -111,13 +111,13 @@ · 110 unmodified lines
111111 reg = <0x70>;
112112 #address-cells = <1>;
113113 #size-cells = <0>;
114+ i2c-mux-idle-disconnect;
114115
115116 i2c@0 {
116117 /* FMC A */
117118 #address-cells = <1>;
118119 #size-cells = <0>;
119120 reg = <0>;
120− i2c-mux-idle-disconnect;
121121 };
122122
123123 i2c@1 {
@@ -125,7 +125,6 @@ · 1 unmodified line
125125 #address-cells = <1>;
126126 #size-cells = <0>;
127127 reg = <1>;
128− i2c-mux-idle-disconnect;
129128 };
130129
131130 i2c@2 {
@@ -133,7 +132,6 @@ · 1 unmodified line
133132 #address-cells = <1>;
134133 #size-cells = <0>;
135134 reg = <2>;
136− i2c-mux-idle-disconnect;
137135 };
138136
139137 i2c@3 {
@@ -141,7 +139,6 @@ · 1 unmodified line
141139 #address-cells = <1>;
142140 #size-cells = <0>;
143141 reg = <3>;
144− i2c-mux-idle-disconnect;
145142 };
146143
147144 i2c@4 {
@@ -149,14 +146,12 @@ · 1 unmodified line
149146 #address-cells = <1>;
150147 #size-cells = <0>;
151148 reg = <4>;
152− i2c-mux-idle-disconnect;
153149 };
154150
155151 i2c@5 {
156152 #address-cells = <1>;
157153 #size-cells = <0>;
158154 reg = <5>;
159− i2c-mux-idle-disconnect;
160155
161156 ina230@40 { compatible = "ti,ina230"; reg = <0x40>; shunt-resistor = <5000>; };
162157 ina230@41 { compatible = "ti,ina230"; reg = <0x41>; shunt-resistor = <5000>; };
@@ -182,14 +177,12 @@ · 19 unmodified lines
182177 #address-cells = <1>;
183178 #size-cells = <0>;
184179 reg = <6>;
185− i2c-mux-idle-disconnect;
186180 };
187181
188182 i2c@7 {
189183 #address-cells = <1>;
190184 #size-cells = <0>;
191185 reg = <7>;
192− i2c-mux-idle-disconnect;
193186
194187 u41: pca9575@20 {
195188 compatible = "nxp,pca9575";
arch/arm/boot/dts/bcm2835-rpi-zero-w.dts+1−0
@@ -113,6 +113,7 @@ · 112 unmodified lines
113113 #address-cells = <1>;
114114 #size-cells = <0>;
115115 pinctrl-0 = <&emmc_gpio34 &gpclk2_gpio43>;
116+ bus-width = <4>;
116117 mmc-pwrseq = <&wifi_pwrseq>;
117118 non-removable;
118119 status = "okay";
arch/arm/boot/dts/bcm2837-rpi-cm3.dtsi+8−0
@@ -9,6 +9,14 @@ · 8 unmodified lines
99 reg = <0 0x40000000>;
1010 };
1111
12+ leds {
13+ /*
14+ * Since there is no upstream GPIO driver yet,
15+ * remove the incomplete node.
16+ */
17+ /delete-node/ act;
18+ };
19+
1220 reg_3v3: fixed-regulator {
1321 compatible = "regulator-fixed";
1422 regulator-name = "3V3";
arch/arm/boot/dts/imx6-logicpd-som.dtsi+4−0
@@ -207,6 +207,10 @@ · 206 unmodified lines
207207 vin-supply = <&sw1c_reg>;
208208 };
209209
210+&snvs_poweroff {
211+ status = "okay";
212+};
213+
210214 &iomuxc {
211215 pinctrl-names = "default";
212216 pinctrl-0 = <&pinctrl_hog>;
arch/arm/boot/dts/imx7s.dtsi+4−4
@@ -448,7 +448,7 @@ · 447 unmodified lines
448448 compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
449449 reg = <0x302d0000 0x10000>;
450450 interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
451− clocks = <&clks IMX7D_CLK_DUMMY>,
451+ clocks = <&clks IMX7D_GPT1_ROOT_CLK>,
452452 <&clks IMX7D_GPT1_ROOT_CLK>;
453453 clock-names = "ipg", "per";
454454 };
@@ -457,7 +457,7 @@ · 2 unmodified lines
457457 compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
458458 reg = <0x302e0000 0x10000>;
459459 interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
460− clocks = <&clks IMX7D_CLK_DUMMY>,
460+ clocks = <&clks IMX7D_GPT2_ROOT_CLK>,
461461 <&clks IMX7D_GPT2_ROOT_CLK>;
462462 clock-names = "ipg", "per";
463463 status = "disabled";
@@ -467,7 +467,7 @@ · 3 unmodified lines
467467 compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
468468 reg = <0x302f0000 0x10000>;
469469 interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
470− clocks = <&clks IMX7D_CLK_DUMMY>,
470+ clocks = <&clks IMX7D_GPT3_ROOT_CLK>,
471471 <&clks IMX7D_GPT3_ROOT_CLK>;
472472 clock-names = "ipg", "per";
473473 status = "disabled";
@@ -477,7 +477,7 @@ · 3 unmodified lines
477477 compatible = "fsl,imx7d-gpt", "fsl,imx6sx-gpt";
478478 reg = <0x30300000 0x10000>;
479479 interrupts = <GIC_SPI 52 IRQ_TYPE_LEVEL_HIGH>;
480− clocks = <&clks IMX7D_CLK_DUMMY>,
480+ clocks = <&clks IMX7D_GPT4_ROOT_CLK>,
481481 <&clks IMX7D_GPT4_ROOT_CLK>;
482482 clock-names = "ipg", "per";
483483 status = "disabled";
arch/arm/boot/dts/logicpd-torpedo-som.dtsi+4−0
@@ -192,3 +192,7 @@ · 191 unmodified lines
192192 &twl_gpio {
193193 ti,use-leds;
194194 };
195+
196+&twl_keypad {
197+ status = "disabled";
198+};
arch/arm/boot/dts/mt7629-rfb.dts+12−1
@@ -66,9 +66,21 @@ · 65 unmodified lines
6666 pinctrl-1 = <&ephy_leds_pins>;
6767 status = "okay";
6868
69+ gmac0: mac@0 {
70+ compatible = "mediatek,eth-mac";
71+ reg = <0>;
72+ phy-mode = "2500base-x";
73+ fixed-link {
74+ speed = <2500>;
75+ full-duplex;
76+ pause;
77+ };
78+ };
79+
6980 gmac1: mac@1 {
7081 compatible = "mediatek,eth-mac";
7182 reg = <1>;
83+ phy-mode = "gmii";
7284 phy-handle = <&phy0>;
7385 };
7486
@@ -78,7 +90,6 @@ · 3 unmodified lines
7890
7991 phy0: ethernet-phy@0 {
8092 reg = <0>;
81− phy-mode = "gmii";
8293 };
8394 };
8495 };
arch/arm/boot/dts/mt7629.dtsi+0−2
@@ -468,14 +468,12 @@ · 467 unmodified lines
468468 compatible = "mediatek,mt7629-sgmiisys", "syscon";
469469 reg = <0x1b128000 0x3000>;
470470 #clock-cells = <1>;
471− mediatek,physpeed = "2500";
472471 };
473472
474473 sgmiisys1: syscon@1b130000 {
475474 compatible = "mediatek,mt7629-sgmiisys", "syscon";
476475 reg = <0x1b130000 0x3000>;
477476 #clock-cells = <1>;
478− mediatek,physpeed = "2500";
479477 };
480478 };
481479 };
arch/arm/boot/dts/omap4-droid4-xt894.dts+1−1
@@ -369,7 +369,7 @@ · 368 unmodified lines
369369 compatible = "ti,wl1285", "ti,wl1283";
370370 reg = <2>;
371371 /* gpio_100 with gpmc_wait2 pad as wakeirq */
372− interrupts-extended = <&gpio4 4 IRQ_TYPE_EDGE_RISING>,
372+ interrupts-extended = <&gpio4 4 IRQ_TYPE_LEVEL_HIGH>,
373373 <&omap4_pmx_core 0x4e>;
374374 interrupt-names = "irq", "wakeup";
375375 ref-clock-frequency = <26000000>;
arch/arm/boot/dts/omap4-panda-common.dtsi+1−1
@@ -474,7 +474,7 @@ · 473 unmodified lines
474474 compatible = "ti,wl1271";
475475 reg = <2>;
476476 /* gpio_53 with gpmc_ncs3 pad as wakeup */
477− interrupts-extended = <&gpio2 21 IRQ_TYPE_EDGE_RISING>,
477+ interrupts-extended = <&gpio2 21 IRQ_TYPE_LEVEL_HIGH>,
478478 <&omap4_pmx_core 0x3a>;
479479 interrupt-names = "irq", "wakeup";
480480 ref-clock-frequency = <38400000>;
arch/arm/boot/dts/omap4-sdp.dts+1−1
@@ -512,7 +512,7 @@ · 511 unmodified lines
512512 compatible = "ti,wl1281";
513513 reg = <2>;
514514 interrupt-parent = <&gpio1>;
515− interrupts = <21 IRQ_TYPE_EDGE_RISING>; /* gpio 53 */
515+ interrupts = <21 IRQ_TYPE_LEVEL_HIGH>; /* gpio 53 */
516516 ref-clock-frequency = <26000000>;
517517 tcxo-clock-frequency = <26000000>;
518518 };
arch/arm/boot/dts/omap4-var-som-om44-wlan.dtsi+1−1
@@ -69,7 +69,7 @@ · 68 unmodified lines
6969 compatible = "ti,wl1271";
7070 reg = <2>;
7171 interrupt-parent = <&gpio2>;
72− interrupts = <9 IRQ_TYPE_EDGE_RISING>; /* gpio 41 */
72+ interrupts = <9 IRQ_TYPE_LEVEL_HIGH>; /* gpio 41 */
7373 ref-clock-frequency = <38400000>;
7474 };
7575 };
arch/arm/boot/dts/omap5-board-common.dtsi+1−1
@@ -362,7 +362,7 @@ · 361 unmodified lines
362362 pinctrl-names = "default";
363363 pinctrl-0 = <&wlcore_irq_pin>;
364364 interrupt-parent = <&gpio1>;
365− interrupts = <14 IRQ_TYPE_EDGE_RISING>; /* gpio 14 */
365+ interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; /* gpio 14 */
366366 ref-clock-frequency = <26000000>;
367367 };
368368 };
arch/arm/boot/dts/omap54xx-clocks.dtsi+1−1
@@ -1146,7 +1146,7 @@ · 1145 unmodified lines
11461146 };
11471147 };
11481148
1149− gpu_cm: clock-controller@1500 {
1149+ gpu_cm: gpu_cm@1500 {
11501150 compatible = "ti,omap4-cm";
11511151 reg = <0x1500 0x100>;
11521152 #address-cells = <1>;
arch/arm/boot/dts/stm32mp157-pinctrl.dtsi+4−4
@@ -609,13 +609,13 @@ · 608 unmodified lines
609609 <STM32_PINMUX('F', 6, AF9)>; /* QSPI_BK1_IO3 */
610610 bias-disable;
611611 drive-push-pull;
612− slew-rate = <3>;
612+ slew-rate = <1>;
613613 };
614614 pins2 {
615615 pinmux = <STM32_PINMUX('B', 6, AF10)>; /* QSPI_BK1_NCS */
616616 bias-pull-up;
617617 drive-push-pull;
618− slew-rate = <3>;
618+ slew-rate = <1>;
619619 };
620620 };
621621
@@ -637,13 +637,13 @@ · 15 unmodified lines
637637 <STM32_PINMUX('G', 7, AF11)>; /* QSPI_BK2_IO3 */
638638 bias-disable;
639639 drive-push-pull;
640− slew-rate = <3>;
640+ slew-rate = <1>;
641641 };
642642 pins2 {
643643 pinmux = <STM32_PINMUX('C', 0, AF10)>; /* QSPI_BK2_NCS */
644644 bias-pull-up;
645645 drive-push-pull;
646− slew-rate = <3>;
646+ slew-rate = <1>;
647647 };
648648 };
649649
arch/arm/boot/dts/sun7i-a20.dtsi+2−3
@@ -380,9 +380,8 @@ · 379 unmodified lines
380380 compatible = "allwinner,sun7i-a20-csi0";
381381 reg = <0x01c09000 0x1000>;
382382 interrupts = <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
383− clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI0>,
384− <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>;
385− clock-names = "bus", "mod", "isp", "ram";
383+ clocks = <&ccu CLK_AHB_CSI0>, <&ccu CLK_CSI_SCLK>, <&ccu CLK_DRAM_CSI0>;
384+ clock-names = "bus", "isp", "ram";
386385 resets = <&ccu RST_CSI0>;
387386 status = "disabled";
388387 };
arch/arm/boot/dts/vf610-zii-scu4-aib.dts+2−0
@@ -602,6 +602,7 @@ · 601 unmodified lines
602602 #address-cells = <1>;
603603 #size-cells = <0>;
604604 reg = <0x70>;
605+ i2c-mux-idle-disconnect;
605606
606607 sff0_i2c: i2c@1 {
607608 #address-cells = <1>;
@@ -640,6 +641,7 @@ · 32 unmodified lines
640641 reg = <0x71>;
641642 #address-cells = <1>;
642643 #size-cells = <0>;
644+ i2c-mux-idle-disconnect;
643645
644646 sff5_i2c: i2c@1 {
645647 #address-cells = <1>;
arch/arm/configs/davinci_all_defconfig+1−0
@@ -167,6 +167,7 @@ CONFIG_FB=y · 166 unmodified lines
167167 CONFIG_FIRMWARE_EDID=y
168168 CONFIG_FB_DA8XX=y
169169 CONFIG_BACKLIGHT_PWM=m
170+CONFIG_BACKLIGHT_GPIO=m
170171 CONFIG_FRAMEBUFFER_CONSOLE=y
171172 CONFIG_LOGO=y
172173 CONFIG_SOUND=m
arch/arm/configs/imx_v6_v7_defconfig+1−0
@@ -276,6 +276,7 @@ CONFIG_VIDEO_OV5640=m · 275 unmodified lines
276276 CONFIG_VIDEO_OV5645=m
277277 CONFIG_IMX_IPUV3_CORE=y
278278 CONFIG_DRM=y
279+CONFIG_DRM_MSM=y
279280 CONFIG_DRM_PANEL_LVDS=y
280281 CONFIG_DRM_PANEL_SIMPLE=y
281282 CONFIG_DRM_PANEL_SEIKO_43WVF1G=y
arch/arm/configs/omap2plus_defconfig+6−6
@@ -356,15 +356,15 @@ CONFIG_DRM_OMAP_CONNECTOR_HDMI=m · 355 unmodified lines
356356 CONFIG_DRM_OMAP_CONNECTOR_ANALOG_TV=m
357357 CONFIG_DRM_OMAP_PANEL_DPI=m
358358 CONFIG_DRM_OMAP_PANEL_DSI_CM=m
359−CONFIG_DRM_OMAP_PANEL_SONY_ACX565AKM=m
360−CONFIG_DRM_OMAP_PANEL_LGPHILIPS_LB035Q02=m
361−CONFIG_DRM_OMAP_PANEL_SHARP_LS037V7DW01=m
362−CONFIG_DRM_OMAP_PANEL_TPO_TD028TTEC1=m
363−CONFIG_DRM_OMAP_PANEL_TPO_TD043MTEA1=m
364−CONFIG_DRM_OMAP_PANEL_NEC_NL8048HL11=m
365359 CONFIG_DRM_TILCDC=m
366360 CONFIG_DRM_PANEL_SIMPLE=m
367361 CONFIG_DRM_TI_TFP410=m
362+CONFIG_DRM_PANEL_LG_LB035Q02=m
363+CONFIG_DRM_PANEL_NEC_NL8048HL11=m
364+CONFIG_DRM_PANEL_SHARP_LS037V7DW01=m
365+CONFIG_DRM_PANEL_SONY_ACX565AKM=m
366+CONFIG_DRM_PANEL_TPO_TD028TTEC1=m
367+CONFIG_DRM_PANEL_TPO_TD043MTEA1=m
368368 CONFIG_FB=y
369369 CONFIG_FIRMWARE_EDID=y
370370 CONFIG_FB_MODE_HELPERS=y
arch/arm/include/asm/domain.h+4−4
@@ -82,7 +82,7 @@ · 81 unmodified lines
8282 #ifndef __ASSEMBLY__
8383
8484 #ifdef CONFIG_CPU_CP15_MMU
85−static inline unsigned int get_domain(void)
85+static __always_inline unsigned int get_domain(void)
8686 {
8787 unsigned int domain;
8888
@@ -94,7 +94,7 @@ static inline unsigned int get_domain(void) · 5 unmodified lines
9494 return domain;
9595 }
9696
97−static inline void set_domain(unsigned val)
97+static __always_inline void set_domain(unsigned int val)
9898 {
9999 asm volatile(
100100 "mcr p15, 0, %0, c3, c0 @ set domain"
@@ -102,12 +102,12 @@ static inline void set_domain(unsigned val) · 1 unmodified line
102102 isb();
103103 }
104104 #else
105−static inline unsigned int get_domain(void)
105+static __always_inline unsigned int get_domain(void)
106106 {
107107 return 0;
108108 }
109109
110−static inline void set_domain(unsigned val)
110+static __always_inline void set_domain(unsigned int val)
111111 {
112112 }
113113 #endif
arch/arm/include/asm/uaccess.h+2−2
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 * perform such accesses (eg, via list poison values) which could then
2323 * be exploited for priviledge escalation.
2424 */
25−static inline unsigned int uaccess_save_and_enable(void)
25+static __always_inline unsigned int uaccess_save_and_enable(void)
2626 {
2727 #ifdef CONFIG_CPU_SW_DOMAIN_PAN
2828 unsigned int old_domain = get_domain();
@@ -37,7 +37,7 @@ static inline unsigned int uaccess_save_and_enable(void) · 8 unmodified lines
3737 #endif
3838 }
3939
40−static inline void uaccess_restore(unsigned int flags)
40+static __always_inline void uaccess_restore(unsigned int flags)
4141 {
4242 #ifdef CONFIG_CPU_SW_DOMAIN_PAN
4343 /* Restore the user access mask */
arch/arm/kernel/head-common.S+3−2
@@ -68,7 +68,7 @@ ENDPROC(__vet_atags) · 67 unmodified lines
6868 * The following fragment of code is executed with the MMU on in MMU mode,
6969 * and uses absolute addresses; this is not position independent.
7070 *
71− * r0 = cp#15 control register
71+ * r0 = cp#15 control register (exc_ret for M-class)
7272 * r1 = machine ID
7373 * r2 = atags/dtb pointer
7474 * r9 = processor ID
@@ -137,7 +137,8 @@ __mmap_switched_data: · 62 unmodified lines
137137 #ifdef CONFIG_CPU_CP15
138138 .long cr_alignment @ r3
139139 #else
140− .long 0 @ r3
140+M_CLASS(.long exc_ret) @ r3
141+AR_CLASS(.long 0) @ r3
141142 #endif
142143 .size __mmap_switched_data, . - __mmap_switched_data
143144
arch/arm/kernel/head-nommu.S+2−0
@@ -201,6 +201,8 @@ M_CLASS(streq r3, [r12, #PMSAv8_MAIR1]) · 200 unmodified lines
201201 bic r0, r0, #V7M_SCB_CCR_IC
202202 #endif
203203 str r0, [r12, V7M_SCB_CCR]
204+ /* Pass exc_ret to __mmap_switched */
205+ mov r0, r10
204206 #endif /* CONFIG_CPU_CP15 elif CONFIG_CPU_V7M */
205207 ret lr
206208 ENDPROC(__after_proc_init)
arch/arm/mach-davinci/dm365.c+2−2
@@ -462,8 +462,8 @@ static s8 dm365_queue_priority_mapping[][2] = { · 461 unmodified lines
462462 };
463463
464464 static const struct dma_slave_map dm365_edma_map[] = {
465− { "davinci-mcbsp.0", "tx", EDMA_FILTER_PARAM(0, 2) },
466− { "davinci-mcbsp.0", "rx", EDMA_FILTER_PARAM(0, 3) },
465+ { "davinci-mcbsp", "tx", EDMA_FILTER_PARAM(0, 2) },
466+ { "davinci-mcbsp", "rx", EDMA_FILTER_PARAM(0, 3) },
467467 { "davinci_voicecodec", "tx", EDMA_FILTER_PARAM(0, 2) },
468468 { "davinci_voicecodec", "rx", EDMA_FILTER_PARAM(0, 3) },
469469 { "spi_davinci.2", "tx", EDMA_FILTER_PARAM(0, 10) },
arch/arm/mach-omap2/pdata-quirks.c+11−0
@@ -89,6 +89,13 @@ static struct iommu_platform_data omap3_iommu_pdata = { · 88 unmodified lines
8989 .reset_name = "mmu",
9090 .assert_reset = omap_device_assert_hardreset,
9191 .deassert_reset = omap_device_deassert_hardreset,
92+ .device_enable = omap_device_enable,
93+ .device_idle = omap_device_idle,
94+};
95+
96+static struct iommu_platform_data omap3_iommu_isp_pdata = {
97+ .device_enable = omap_device_enable,
98+ .device_idle = omap_device_idle,
9299 };
93100
94101 static int omap3_sbc_t3730_twl_callback(struct device *dev,
@@ -424,6 +431,8 @@ static struct iommu_platform_data omap4_iommu_pdata = { · 329 unmodified lines
424431 .reset_name = "mmu_cache",
425432 .assert_reset = omap_device_assert_hardreset,
426433 .deassert_reset = omap_device_deassert_hardreset,
434+ .device_enable = omap_device_enable,
435+ .device_idle = omap_device_idle,
427436 };
428437 #endif
429438
@@ -617,6 +626,8 @@ static struct of_dev_auxdata omap_auxdata_lookup[] = { · 187 unmodified lines
617626 #ifdef CONFIG_ARCH_OMAP3
618627 OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
619628 &omap3_iommu_pdata),
629+ OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu",
630+ &omap3_iommu_isp_pdata),
620631 OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000,
621632 "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
622633 OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000,
arch/arm/mm/alignment.c+49−21
@@ -324,7 +324,7 @@ union offset_union { · 323 unmodified lines
324324 __put32_unaligned_check("strbt", val, addr)
325325
326326 static void
327−do_alignment_finish_ldst(unsigned long addr, unsigned long instr, struct pt_regs *regs, union offset_union offset)
327+do_alignment_finish_ldst(unsigned long addr, u32 instr, struct pt_regs *regs, union offset_union offset)
328328 {
329329 if (!LDST_U_BIT(instr))
330330 offset.un = -offset.un;
@@ -337,7 +337,7 @@ do_alignment_finish_ldst(unsigned long addr, unsigned long instr, struct pt_regs · 6 unmodified lines
337337 }
338338
339339 static int
340−do_alignment_ldrhstrh(unsigned long addr, unsigned long instr, struct pt_regs *regs)
340+do_alignment_ldrhstrh(unsigned long addr, u32 instr, struct pt_regs *regs)
341341 {
342342 unsigned int rd = RD_BITS(instr);
343343
@@ -386,8 +386,7 @@ do_alignment_ldrhstrh(unsigned long addr, unsigned long instr, struct pt_regs *r · 42 unmodified lines
386386 }
387387
388388 static int
389−do_alignment_ldrdstrd(unsigned long addr, unsigned long instr,
390− struct pt_regs *regs)
389+do_alignment_ldrdstrd(unsigned long addr, u32 instr, struct pt_regs *regs)
391390 {
392391 unsigned int rd = RD_BITS(instr);
393392 unsigned int rd2;
@@ -449,7 +448,7 @@ do_alignment_ldrdstrd(unsigned long addr, unsigned long instr, · 55 unmodified lines
449448 }
450449
451450 static int
452−do_alignment_ldrstr(unsigned long addr, unsigned long instr, struct pt_regs *regs)
451+do_alignment_ldrstr(unsigned long addr, u32 instr, struct pt_regs *regs)
453452 {
454453 unsigned int rd = RD_BITS(instr);
455454
@@ -498,7 +497,7 @@ do_alignment_ldrstr(unsigned long addr, unsigned long instr, struct pt_regs *reg · 42 unmodified lines
498497 * PU = 10 A B
499498 */
500499 static int
501−do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *regs)
500+do_alignment_ldmstm(unsigned long addr, u32 instr, struct pt_regs *regs)
502501 {
503502 unsigned int rd, rn, correction, nr_regs, regbits;
504503 unsigned long eaddr, newaddr;
@@ -539,7 +538,7 @@ do_alignment_ldmstm(unsigned long addr, unsigned long instr, struct pt_regs *reg · 34 unmodified lines
539538 * processor for us.
540539 */
541540 if (addr != eaddr) {
542− pr_err("LDMSTM: PC = %08lx, instr = %08lx, "
541+ pr_err("LDMSTM: PC = %08lx, instr = %08x, "
543542 "addr = %08lx, eaddr = %08lx\n",
544543 instruction_pointer(regs), instr, addr, eaddr);
545544 show_regs(regs);
@@ -716,10 +715,10 @@ thumb2arm(u16 tinstr) · 170 unmodified lines
716715 * 2. Register name Rt from ARMv7 is same as Rd from ARMv6 (Rd is Rt)
717716 */
718717 static void *
719−do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs,
718+do_alignment_t32_to_handler(u32 *pinstr, struct pt_regs *regs,
720719 union offset_union *poffset)
721720 {
722− unsigned long instr = *pinstr;
721+ u32 instr = *pinstr;
723722 u16 tinst1 = (instr >> 16) & 0xffff;
724723 u16 tinst2 = instr & 0xffff;
725724
@@ -767,17 +766,48 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs, · 41 unmodified lines
767766 return NULL;
768767 }
769768
769+static int alignment_get_arm(struct pt_regs *regs, u32 *ip, u32 *inst)
770+{
771+ u32 instr = 0;
772+ int fault;
773+
774+ if (user_mode(regs))
775+ fault = get_user(instr, ip);
776+ else
777+ fault = probe_kernel_address(ip, instr);
778+
779+ *inst = __mem_to_opcode_arm(instr);
780+
781+ return fault;
782+}
783+
784+static int alignment_get_thumb(struct pt_regs *regs, u16 *ip, u16 *inst)
785+{
786+ u16 instr = 0;
787+ int fault;
788+
789+ if (user_mode(regs))
790+ fault = get_user(instr, ip);
791+ else
792+ fault = probe_kernel_address(ip, instr);
793+
794+ *inst = __mem_to_opcode_thumb16(instr);
795+
796+ return fault;
797+}
798+
770799 static int
771800 do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
772801 {
773802 union offset_union uninitialized_var(offset);
774− unsigned long instr = 0, instrptr;
775− int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
803+ unsigned long instrptr;
804+ int (*handler)(unsigned long addr, u32 instr, struct pt_regs *regs);
776805 unsigned int type;
777− unsigned int fault;
806+ u32 instr = 0;
778807 u16 tinstr = 0;
779808 int isize = 4;
780809 int thumb2_32b = 0;
810+ int fault;
781811
782812 if (interrupts_enabled(regs))
783813 local_irq_enable();
@@ -786,15 +816,14 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 2 unmodified lines
786816
787817 if (thumb_mode(regs)) {
788818 u16 *ptr = (u16 *)(instrptr & ~1);
789− fault = probe_kernel_address(ptr, tinstr);
790− tinstr = __mem_to_opcode_thumb16(tinstr);
819+
820+ fault = alignment_get_thumb(regs, ptr, &tinstr);
791821 if (!fault) {
792822 if (cpu_architecture() >= CPU_ARCH_ARMv7 &&
793823 IS_T32(tinstr)) {
794824 /* Thumb-2 32-bit */
795− u16 tinst2 = 0;
796− fault = probe_kernel_address(ptr + 1, tinst2);
797− tinst2 = __mem_to_opcode_thumb16(tinst2);
825+ u16 tinst2;
826+ fault = alignment_get_thumb(regs, ptr + 1, &tinst2);
798827 instr = __opcode_thumb32_compose(tinstr, tinst2);
799828 thumb2_32b = 1;
800829 } else {
@@ -803,8 +832,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 2 unmodified lines
803832 }
804833 }
805834 } else {
806− fault = probe_kernel_address((void *)instrptr, instr);
807− instr = __mem_to_opcode_arm(instr);
835+ fault = alignment_get_arm(regs, (void *)instrptr, &instr);
808836 }
809837
810838 if (fault) {
@@ -926,7 +954,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 115 unmodified lines
926954 * Oops, we didn't handle the instruction.
927955 */
928956 pr_err("Alignment trap: not handling instruction "
929− "%0*lx at [<%08lx>]\n",
957+ "%0*x at [<%08lx>]\n",
930958 isize << 1,
931959 isize == 2 ? tinstr : instr, instrptr);
932960 ai_skipped += 1;
@@ -936,7 +964,7 @@ do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 3 unmodified lines
936964 ai_user += 1;
937965
938966 if (ai_usermode & UM_WARN)
939− printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*lx "
967+ printk("Alignment trap: %s (%d) PC=0x%08lx Instr=0x%0*x "
940968 "Address=0x%08lx FSR 0x%03x\n", current->comm,
941969 task_pid_nr(current), instrptr,
942970 isize << 1,
arch/arm/mm/proc-v7m.S+2−4
@@ -132,13 +132,11 @@ __v7m_setup_cont: · 131 unmodified lines
132132 dsb
133133 mov r6, lr @ save LR
134134 ldr sp, =init_thread_union + THREAD_START_SP
135− stmia sp, {r0-r3, r12}
136135 cpsie i
137136 svc #0
138137 1: cpsid i
139− ldr r0, =exc_ret
140− orr lr, lr, #EXC_RET_THREADMODE_PROCESSSTACK
141− str lr, [r0]
138+ /* Calculate exc_ret */
139+ orr r10, lr, #EXC_RET_THREADMODE_PROCESSSTACK
142140 ldmia sp, {r0-r3, r12}
143141 str r5, [r12, #11 * 4] @ restore the original SVC vector entry
144142 mov lr, r6 @ restore LR
arch/arm64/Kconfig+17−0
@@ -616,6 +616,23 @@ config CAVIUM_ERRATUM_30115 · 615 unmodified lines
616616
617617 If unsure, say Y.
618618
619+config CAVIUM_TX2_ERRATUM_219
620+ bool "Cavium ThunderX2 erratum 219: PRFM between TTBR change and ISB fails"
621+ default y
622+ help
623+ On Cavium ThunderX2, a load, store or prefetch instruction between a
624+ TTBR update and the corresponding context synchronizing operation can
625+ cause a spurious Data Abort to be delivered to any hardware thread in
626+ the CPU core.
627+
628+ Work around the issue by avoiding the problematic code sequence and
629+ trapping KVM guest TTBRx_EL1 writes to EL2 when SMT is enabled. The
630+ trap handler performs the corresponding register access, skips the
631+ instruction and ensures context synchronization by virtue of the
632+ exception return.
633+
634+ If unsure, say Y.
635+
619636 config QCOM_FALKOR_ERRATUM_1003
620637 bool "Falkor E1003: Incorrect translation due to ASID change"
621638 default y
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts+9−0
@@ -63,3 +63,12 @@ · 62 unmodified lines
6363 reg = <1>;
6464 };
6565 };
66+
67+&reg_dc1sw {
68+ /*
69+ * Ethernet PHY needs 30ms to properly power up and some more
70+ * to initialize. 100ms should be plenty of time to finish
71+ * whole process.
72+ */
73+ regulator-enable-ramp-delay = <100000>;
74+};
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts+6−0
@@ -159,6 +159,12 @@ · 158 unmodified lines
159159 };
160160
161161 &reg_dc1sw {
162+ /*
163+ * Ethernet PHY needs 30ms to properly power up and some more
164+ * to initialize. 100ms should be plenty of time to finish
165+ * whole process.
166+ */
167+ regulator-enable-ramp-delay = <100000>;
162168 regulator-name = "vcc-phy";
163169 };
164170
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi+0−9
@@ -142,15 +142,6 @@ · 141 unmodified lines
142142 clock-output-names = "ext-osc32k";
143143 };
144144
145− pmu {
146− compatible = "arm,cortex-a53-pmu";
147− interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_HIGH>,
148− <GIC_SPI 153 IRQ_TYPE_LEVEL_HIGH>,
149− <GIC_SPI 154 IRQ_TYPE_LEVEL_HIGH>,
150− <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>;
151− interrupt-affinity = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>;
152− };
153−
154145 psci {
155146 compatible = "arm,psci-0.2";
156147 method = "smc";
arch/arm64/boot/dts/broadcom/stingray/stingray-pinctrl.dtsi+3−2
@@ -42,13 +42,14 @@ · 41 unmodified lines
4242
4343 pinmux: pinmux@14029c {
4444 compatible = "pinctrl-single";
45− reg = <0x0014029c 0x250>;
45+ reg = <0x0014029c 0x26c>;
4646 #address-cells = <1>;
4747 #size-cells = <1>;
4848 pinctrl-single,register-width = <32>;
4949 pinctrl-single,function-mask = <0xf>;
5050 pinctrl-single,gpio-range = <
51− &range 0 154 MODE_GPIO
51+ &range 0 91 MODE_GPIO
52+ &range 95 60 MODE_GPIO
5253 >;
5354 range: gpio-range {
5455 #pinctrl-single,gpio-range-cells = <3>;
arch/arm64/boot/dts/broadcom/stingray/stingray.dtsi+1−2
@@ -464,8 +464,7 @@ · 463 unmodified lines
464464 <&pinmux 108 16 27>,
465465 <&pinmux 135 77 6>,
466466 <&pinmux 141 67 4>,
467− <&pinmux 145 149 6>,
468− <&pinmux 151 91 4>;
467+ <&pinmux 145 149 6>;
469468 };
470469
471470 i2c1: i2c@e0000 {
arch/arm64/boot/dts/freescale/fsl-lx2160a.dtsi+18−18
@@ -33,7 +33,7 @@ · 32 unmodified lines
3333 i-cache-line-size = <64>;
3434 i-cache-sets = <192>;
3535 next-level-cache = <&cluster0_l2>;
36− cpu-idle-states = <&cpu_pw20>;
36+ cpu-idle-states = <&cpu_pw15>;
3737 };
3838
3939 cpu@1 {
@@ -49,7 +49,7 @@ · 9 unmodified lines
4949 i-cache-line-size = <64>;
5050 i-cache-sets = <192>;
5151 next-level-cache = <&cluster0_l2>;
52− cpu-idle-states = <&cpu_pw20>;
52+ cpu-idle-states = <&cpu_pw15>;
5353 };
5454
5555 cpu@100 {
@@ -65,7 +65,7 @@ · 9 unmodified lines
6565 i-cache-line-size = <64>;
6666 i-cache-sets = <192>;
6767 next-level-cache = <&cluster1_l2>;
68− cpu-idle-states = <&cpu_pw20>;
68+ cpu-idle-states = <&cpu_pw15>;
6969 };
7070
7171 cpu@101 {
@@ -81,7 +81,7 @@ · 9 unmodified lines
8181 i-cache-line-size = <64>;
8282 i-cache-sets = <192>;
8383 next-level-cache = <&cluster1_l2>;
84− cpu-idle-states = <&cpu_pw20>;
84+ cpu-idle-states = <&cpu_pw15>;
8585 };
8686
8787 cpu@200 {
@@ -97,7 +97,7 @@ · 9 unmodified lines
9797 i-cache-line-size = <64>;
9898 i-cache-sets = <192>;
9999 next-level-cache = <&cluster2_l2>;
100− cpu-idle-states = <&cpu_pw20>;
100+ cpu-idle-states = <&cpu_pw15>;
101101 };
102102
103103 cpu@201 {
@@ -113,7 +113,7 @@ · 9 unmodified lines
113113 i-cache-line-size = <64>;
114114 i-cache-sets = <192>;
115115 next-level-cache = <&cluster2_l2>;
116− cpu-idle-states = <&cpu_pw20>;
116+ cpu-idle-states = <&cpu_pw15>;
117117 };
118118
119119 cpu@300 {
@@ -129,7 +129,7 @@ · 9 unmodified lines
129129 i-cache-line-size = <64>;
130130 i-cache-sets = <192>;
131131 next-level-cache = <&cluster3_l2>;
132− cpu-idle-states = <&cpu_pw20>;
132+ cpu-idle-states = <&cpu_pw15>;
133133 };
134134
135135 cpu@301 {
@@ -145,7 +145,7 @@ · 9 unmodified lines
145145 i-cache-line-size = <64>;
146146 i-cache-sets = <192>;
147147 next-level-cache = <&cluster3_l2>;
148− cpu-idle-states = <&cpu_pw20>;
148+ cpu-idle-states = <&cpu_pw15>;
149149 };
150150
151151 cpu@400 {
@@ -161,7 +161,7 @@ · 9 unmodified lines
161161 i-cache-line-size = <64>;
162162 i-cache-sets = <192>;
163163 next-level-cache = <&cluster4_l2>;
164− cpu-idle-states = <&cpu_pw20>;
164+ cpu-idle-states = <&cpu_pw15>;
165165 };
166166
167167 cpu@401 {
@@ -177,7 +177,7 @@ · 9 unmodified lines
177177 i-cache-line-size = <64>;
178178 i-cache-sets = <192>;
179179 next-level-cache = <&cluster4_l2>;
180− cpu-idle-states = <&cpu_pw20>;
180+ cpu-idle-states = <&cpu_pw15>;
181181 };
182182
183183 cpu@500 {
@@ -193,7 +193,7 @@ · 9 unmodified lines
193193 i-cache-line-size = <64>;
194194 i-cache-sets = <192>;
195195 next-level-cache = <&cluster5_l2>;
196− cpu-idle-states = <&cpu_pw20>;
196+ cpu-idle-states = <&cpu_pw15>;
197197 };
198198
199199 cpu@501 {
@@ -209,7 +209,7 @@ · 9 unmodified lines
209209 i-cache-line-size = <64>;
210210 i-cache-sets = <192>;
211211 next-level-cache = <&cluster5_l2>;
212− cpu-idle-states = <&cpu_pw20>;
212+ cpu-idle-states = <&cpu_pw15>;
213213 };
214214
215215 cpu@600 {
@@ -225,7 +225,7 @@ · 9 unmodified lines
225225 i-cache-line-size = <64>;
226226 i-cache-sets = <192>;
227227 next-level-cache = <&cluster6_l2>;
228− cpu-idle-states = <&cpu_pw20>;
228+ cpu-idle-states = <&cpu_pw15>;
229229 };
230230
231231 cpu@601 {
@@ -241,7 +241,7 @@ · 9 unmodified lines
241241 i-cache-line-size = <64>;
242242 i-cache-sets = <192>;
243243 next-level-cache = <&cluster6_l2>;
244− cpu-idle-states = <&cpu_pw20>;
244+ cpu-idle-states = <&cpu_pw15>;
245245 };
246246
247247 cpu@700 {
@@ -257,7 +257,7 @@ · 9 unmodified lines
257257 i-cache-line-size = <64>;
258258 i-cache-sets = <192>;
259259 next-level-cache = <&cluster7_l2>;
260− cpu-idle-states = <&cpu_pw20>;
260+ cpu-idle-states = <&cpu_pw15>;
261261 };
262262
263263 cpu@701 {
@@ -273,7 +273,7 @@ · 9 unmodified lines
273273 i-cache-line-size = <64>;
274274 i-cache-sets = <192>;
275275 next-level-cache = <&cluster7_l2>;
276− cpu-idle-states = <&cpu_pw20>;
276+ cpu-idle-states = <&cpu_pw15>;
277277 };
278278
279279 cluster0_l2: l2-cache0 {
@@ -340,9 +340,9 @@ · 60 unmodified lines
340340 cache-level = <2>;
341341 };
342342
343− cpu_pw20: cpu-pw20 {
343+ cpu_pw15: cpu-pw15 {
344344 compatible = "arm,idle-state";
345− idle-state-name = "PW20";
345+ idle-state-name = "PW15";
346346 arm,psci-suspend-param = <0x0>;
347347 entry-latency-us = <2000>;
348348 exit-latency-us = <2000>;
arch/arm64/boot/dts/freescale/imx8mm.dtsi+3−3
@@ -694,7 +694,7 @@ · 693 unmodified lines
694694 compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
695695 reg = <0x30b40000 0x10000>;
696696 interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
697− clocks = <&clk IMX8MM_CLK_DUMMY>,
697+ clocks = <&clk IMX8MM_CLK_IPG_ROOT>,
698698 <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
699699 <&clk IMX8MM_CLK_USDHC1_ROOT>;
700700 clock-names = "ipg", "ahb", "per";
@@ -710,7 +710,7 @@ · 9 unmodified lines
710710 compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
711711 reg = <0x30b50000 0x10000>;
712712 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
713− clocks = <&clk IMX8MM_CLK_DUMMY>,
713+ clocks = <&clk IMX8MM_CLK_IPG_ROOT>,
714714 <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
715715 <&clk IMX8MM_CLK_USDHC2_ROOT>;
716716 clock-names = "ipg", "ahb", "per";
@@ -724,7 +724,7 @@ · 7 unmodified lines
724724 compatible = "fsl,imx8mm-usdhc", "fsl,imx7d-usdhc";
725725 reg = <0x30b60000 0x10000>;
726726 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
727− clocks = <&clk IMX8MM_CLK_DUMMY>,
727+ clocks = <&clk IMX8MM_CLK_IPG_ROOT>,
728728 <&clk IMX8MM_CLK_NAND_USDHC_BUS>,
729729 <&clk IMX8MM_CLK_USDHC3_ROOT>;
730730 clock-names = "ipg", "ahb", "per";
arch/arm64/boot/dts/freescale/imx8mn.dtsi+3−3
@@ -569,7 +569,7 @@ · 568 unmodified lines
569569 compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc";
570570 reg = <0x30b40000 0x10000>;
571571 interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
572− clocks = <&clk IMX8MN_CLK_DUMMY>,
572+ clocks = <&clk IMX8MN_CLK_IPG_ROOT>,
573573 <&clk IMX8MN_CLK_NAND_USDHC_BUS>,
574574 <&clk IMX8MN_CLK_USDHC1_ROOT>;
575575 clock-names = "ipg", "ahb", "per";
@@ -585,7 +585,7 @@ · 9 unmodified lines
585585 compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc";
586586 reg = <0x30b50000 0x10000>;
587587 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
588− clocks = <&clk IMX8MN_CLK_DUMMY>,
588+ clocks = <&clk IMX8MN_CLK_IPG_ROOT>,
589589 <&clk IMX8MN_CLK_NAND_USDHC_BUS>,
590590 <&clk IMX8MN_CLK_USDHC2_ROOT>;
591591 clock-names = "ipg", "ahb", "per";
@@ -599,7 +599,7 @@ · 7 unmodified lines
599599 compatible = "fsl,imx8mn-usdhc", "fsl,imx7d-usdhc";
600600 reg = <0x30b60000 0x10000>;
601601 interrupts = <GIC_SPI 24 IRQ_TYPE_LEVEL_HIGH>;
602− clocks = <&clk IMX8MN_CLK_DUMMY>,
602+ clocks = <&clk IMX8MN_CLK_IPG_ROOT>,
603603 <&clk IMX8MN_CLK_NAND_USDHC_BUS>,
604604 <&clk IMX8MN_CLK_USDHC3_ROOT>;
605605 clock-names = "ipg", "ahb", "per";
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi+2−2
@@ -89,8 +89,8 @@ · 88 unmodified lines
8989 regulator-min-microvolt = <900000>;
9090 regulator-max-microvolt = <1000000>;
9191 gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
92− states = <1000000 0x0
93− 900000 0x1>;
92+ states = <1000000 0x1
93+ 900000 0x0>;
9494 regulator-always-on;
9595 };
9696 };
arch/arm64/boot/dts/freescale/imx8mq.dtsi+2−2
@@ -850,7 +850,7 @@ · 849 unmodified lines
850850 "fsl,imx7d-usdhc";
851851 reg = <0x30b40000 0x10000>;
852852 interrupts = <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>;
853− clocks = <&clk IMX8MQ_CLK_DUMMY>,
853+ clocks = <&clk IMX8MQ_CLK_IPG_ROOT>,
854854 <&clk IMX8MQ_CLK_NAND_USDHC_BUS>,
855855 <&clk IMX8MQ_CLK_USDHC1_ROOT>;
856856 clock-names = "ipg", "ahb", "per";
@@ -867,7 +867,7 @@ · 10 unmodified lines
867867 "fsl,imx7d-usdhc";
868868 reg = <0x30b50000 0x10000>;
869869 interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
870− clocks = <&clk IMX8MQ_CLK_DUMMY>,
870+ clocks = <&clk IMX8MQ_CLK_IPG_ROOT>,
871871 <&clk IMX8MQ_CLK_NAND_USDHC_BUS>,
872872 <&clk IMX8MQ_CLK_USDHC2_ROOT>;
873873 clock-names = "ipg", "ahb", "per";
arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts+7−6
@@ -60,11 +60,6 @@ · 59 unmodified lines
6060 gpio = <&gpiosb 0 GPIO_ACTIVE_HIGH>;
6161 };
6262
63− usb3_phy: usb3-phy {
64− compatible = "usb-nop-xceiv";
65− vcc-supply = <&exp_usb3_vbus>;
66− };
67−
6863 vsdc_reg: vsdc-reg {
6964 compatible = "regulator-gpio";
7065 regulator-name = "vsdc";
@@ -255,10 +250,16 @@ · 184 unmodified lines
255250 status = "okay";
256251 };
257252
253+&comphy2 {
254+ connector {
255+ compatible = "usb-a-connector";
256+ phy-supply = <&exp_usb3_vbus>;
257+ };
258+};
259+
258260 &usb3 {
259261 status = "okay";
260262 phys = <&comphy2 0>;
261− usb-phy = <&usb3_phy>;
262263 };
263264
264265 &mdio {
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts+1−1
@@ -44,7 +44,7 @@ · 43 unmodified lines
4444 power-supply = <&pp3300_disp>;
4545
4646 panel-timing {
47− clock-frequency = <266604720>;
47+ clock-frequency = <266666667>;
4848 hactive = <2400>;
4949 hfront-porch = <48>;
5050 hback-porch = <84>;
arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts+2−2
@@ -644,7 +644,7 @@ · 643 unmodified lines
644644 status = "okay";
645645
646646 u2phy0_host: host-port {
647− phy-supply = <&vcc5v0_host>;
647+ phy-supply = <&vcc5v0_typec>;
648648 status = "okay";
649649 };
650650
@@ -712,7 +712,7 @@ · 61 unmodified lines
712712
713713 &usbdrd_dwc3_0 {
714714 status = "okay";
715− dr_mode = "otg";
715+ dr_mode = "host";
716716 };
717717
718718 &usbdrd3_1 {
arch/arm64/boot/dts/rockchip/rk3399-rockpro64.dts+5−7
@@ -173,7 +173,7 @@ · 172 unmodified lines
173173 regulator-always-on;
174174 regulator-boot-on;
175175 regulator-min-microvolt = <800000>;
176− regulator-max-microvolt = <1400000>;
176+ regulator-max-microvolt = <1700000>;
177177 vin-supply = <&vcc5v0_sys>;
178178 };
179179 };
@@ -247,8 +247,8 @@ · 67 unmodified lines
247247 rk808: pmic@1b {
248248 compatible = "rockchip,rk808";
249249 reg = <0x1b>;
250− interrupt-parent = <&gpio1>;
251− interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
250+ interrupt-parent = <&gpio3>;
251+ interrupts = <10 IRQ_TYPE_LEVEL_LOW>;
252252 #clock-cells = <1>;
253253 clock-output-names = "xin32k", "rk808-clkout2";
254254 pinctrl-names = "default";
@@ -574,7 +574,7 @@ · 319 unmodified lines
574574
575575 pmic {
576576 pmic_int_l: pmic-int-l {
577− rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
577+ rockchip,pins = <3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>;
578578 };
579579
580580 vsel1_gpio: vsel1-gpio {
@@ -624,7 +624,6 @@ · 43 unmodified lines
624624
625625 &sdmmc {
626626 bus-width = <4>;
627− cap-mmc-highspeed;
628627 cap-sd-highspeed;
629628 cd-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
630629 disable-wp;
@@ -636,8 +635,7 @@ · 5 unmodified lines
636635
637636 &sdhci {
638637 bus-width = <8>;
639− mmc-hs400-1_8v;
640− mmc-hs400-enhanced-strobe;
638+ mmc-hs200-1_8v;
641639 non-removable;
642640 status = "okay";
643641 };
arch/arm64/include/asm/asm-uaccess.h+3−4
@@ -78,10 +78,9 @@ alternative_else_nop_endif · 77 unmodified lines
7878 /*
7979 * Remove the address tag from a virtual address, if present.
8080 */
81− .macro clear_address_tag, dst, addr
82− tst \addr, #(1 << 55)
83− bic \dst, \addr, #(0xff << 56)
84− csel \dst, \dst, \addr, eq
81+ .macro untagged_addr, dst, addr
82+ sbfx \dst, \addr, #0, #56
83+ and \dst, \dst, \addr
8584 .endm
8685
8786 #endif
arch/arm64/include/asm/cpucaps.h+3−1
@@ -52,7 +52,9 @@ · 51 unmodified lines
5252 #define ARM64_HAS_IRQ_PRIO_MASKING 42
5353 #define ARM64_HAS_DCPODP 43
5454 #define ARM64_WORKAROUND_1463225 44
55+#define ARM64_WORKAROUND_CAVIUM_TX2_219_TVM 45
56+#define ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM 46
5557
56−#define ARM64_NCAPS 45
58+#define ARM64_NCAPS 47
5759
5860 #endif /* __ASM_CPUCAPS_H */
arch/arm64/include/asm/memory.h+8−2
@@ -215,12 +215,18 @@ static inline unsigned long kaslr_offset(void) · 214 unmodified lines
215215 * up with a tagged userland pointer. Clear the tag to get a sane pointer to
216216 * pass on to access_ok(), for instance.
217217 */
218−#define untagged_addr(addr) \
218+#define __untagged_addr(addr) \
219219 ((__force __typeof__(addr))sign_extend64((__force u64)(addr), 55))
220220
221+#define untagged_addr(addr) ({ \
222+ u64 __addr = (__force u64)addr; \
223+ __addr &= __untagged_addr(__addr); \
224+ (__force __typeof__(addr))__addr; \
225+})
226+
221227 #ifdef CONFIG_KASAN_SW_TAGS
222228 #define __tag_shifted(tag) ((u64)(tag) << 56)
223−#define __tag_reset(addr) untagged_addr(addr)
229+#define __tag_reset(addr) __untagged_addr(addr)
224230 #define __tag_get(addr) (__u8)((u64)(addr) >> 56)
225231 #else
226232 #define __tag_shifted(tag) 0UL
arch/arm64/include/asm/pgtable.h+0−3
@@ -876,9 +876,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma, · 875 unmodified lines
876876
877877 #define update_mmu_cache_pmd(vma, address, pmd) do { } while (0)
878878
879−#define kc_vaddr_to_offset(v) ((v) & ~PAGE_END)
880−#define kc_offset_to_vaddr(o) ((o) | PAGE_END)
881−
882879 #ifdef CONFIG_ARM64_PA_BITS_52
883880 #define phys_to_ttbr(addr) (((addr) | ((addr) >> 46)) & TTBR_BADDR_MASK_52)
884881 #else
arch/arm64/include/asm/sysreg.h+1−1
@@ -212,7 +212,7 @@ · 211 unmodified lines
212212 #define SYS_FAR_EL1 sys_reg(3, 0, 6, 0, 0)
213213 #define SYS_PAR_EL1 sys_reg(3, 0, 7, 4, 0)
214214
215−#define SYS_PAR_EL1_F BIT(1)
215+#define SYS_PAR_EL1_F BIT(0)
216216 #define SYS_PAR_EL1_FST GENMASK(6, 1)
217217
218218 /*** Statistical Profiling Extension ***/
arch/arm64/kernel/cpu_errata.c+38−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <asm/cpu.h>
1313 #include <asm/cputype.h>
1414 #include <asm/cpufeature.h>
15+#include <asm/smp_plat.h>
1516
1617 static bool __maybe_unused
1718 is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope)
@@ -623,6 +624,30 @@ check_branch_predictor(const struct arm64_cpu_capabilities *entry, int scope) · 605 unmodified lines
623624 return (need_wa > 0);
624625 }
625626
627+static const __maybe_unused struct midr_range tx2_family_cpus[] = {
628+ MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
629+ MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
630+ {},
631+};
632+
633+static bool __maybe_unused
634+needs_tx2_tvm_workaround(const struct arm64_cpu_capabilities *entry,
635+ int scope)
636+{
637+ int i;
638+
639+ if (!is_affected_midr_range_list(entry, scope) ||
640+ !is_hyp_mode_available())
641+ return false;
642+
643+ for_each_possible_cpu(i) {
644+ if (MPIDR_AFFINITY_LEVEL(cpu_logical_map(i), 0) != 0)
645+ return true;
646+ }
647+
648+ return false;
649+}
650+
626651 #ifdef CONFIG_HARDEN_EL2_VECTORS
627652
628653 static const struct midr_range arm64_harden_el2_vectors[] = {
@@ -851,6 +876,19 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 222 unmodified lines
851876 .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM,
852877 .matches = has_cortex_a76_erratum_1463225,
853878 },
879+#endif
880+#ifdef CONFIG_CAVIUM_TX2_ERRATUM_219
881+ {
882+ .desc = "Cavium ThunderX2 erratum 219 (KVM guest sysreg trapping)",
883+ .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_TVM,
884+ ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
885+ .matches = needs_tx2_tvm_workaround,
886+ },
887+ {
888+ .desc = "Cavium ThunderX2 erratum 219 (PRFM removal)",
889+ .capability = ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM,
890+ ERRATA_MIDR_RANGE_LIST(tx2_family_cpus),
891+ },
854892 #endif
855893 {
856894 }
arch/arm64/kernel/cpufeature.c+10−5
@@ -176,11 +176,16 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr1[] = { · 175 unmodified lines
176176 };
177177
178178 static const struct arm64_ftr_bits ftr_id_aa64zfr0[] = {
179− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SM4_SHIFT, 4, 0),
180− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SHA3_SHIFT, 4, 0),
181− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_BITPERM_SHIFT, 4, 0),
182− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_AES_SHIFT, 4, 0),
183− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SVEVER_SHIFT, 4, 0),
179+ ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE),
180+ FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SM4_SHIFT, 4, 0),
181+ ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE),
182+ FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SHA3_SHIFT, 4, 0),
183+ ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE),
184+ FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_BITPERM_SHIFT, 4, 0),
185+ ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE),
186+ FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_AES_SHIFT, 4, 0),
187+ ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_SVE),
188+ FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ZFR0_SVEVER_SHIFT, 4, 0),
184189 ARM64_FTR_END,
185190 };
186191
arch/arm64/kernel/entry.S+5−3
@@ -604,7 +604,7 @@ el1_da: · 603 unmodified lines
604604 */
605605 mrs x3, far_el1
606606 inherit_daif pstate=x23, tmp=x2
607− clear_address_tag x0, x3
607+ untagged_addr x0, x3
608608 mov x2, sp // struct pt_regs
609609 bl do_mem_abort
610610
@@ -680,7 +680,7 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKING · 69 unmodified lines
680680 orr x24, x24, x0
681681 alternative_else_nop_endif
682682 cbnz x24, 1f // preempt count != 0 || NMI return path
683− bl preempt_schedule_irq // irq en/disable is done inside
683+ bl arm64_preempt_schedule_irq // irq en/disable is done inside
684684 1:
685685 #endif
686686
@@ -808,7 +808,7 @@ el0_da: · 121 unmodified lines
808808 mrs x26, far_el1
809809 ct_user_exit_irqoff
810810 enable_daif
811− clear_address_tag x0, x26
811+ untagged_addr x0, x26
812812 mov x1, x25
813813 mov x2, sp
814814 bl do_mem_abort
@@ -1071,7 +1071,9 @@ alternative_insn isb, nop, ARM64_WORKAROUND_QCOM_FALKOR_E1003 · 256 unmodified lines
10711071 #else
10721072 ldr x30, =vectors
10731073 #endif
1074+alternative_if_not ARM64_WORKAROUND_CAVIUM_TX2_219_PRFM
10741075 prfm plil1strm, [x30, #(1b - tramp_vectors)]
1076+alternative_else_nop_endif
10751077 msr vbar_el1, x30
10761078 add x30, x30, #(1b - tramp_vectors)
10771079 isb
arch/arm64/kernel/hibernate.c+8−1
@@ -201,6 +201,7 @@ static int create_safe_exec_page(void *src_start, size_t length, · 200 unmodified lines
201201 gfp_t mask)
202202 {
203203 int rc = 0;
204+ pgd_t *trans_pgd;
204205 pgd_t *pgdp;
205206 pud_t *pudp;
206207 pmd_t *pmdp;
@@ -215,7 +216,13 @@ static int create_safe_exec_page(void *src_start, size_t length, · 8 unmodified lines
215216 memcpy((void *)dst, src_start, length);
216217 __flush_icache_range(dst, dst + length);
217218
218− pgdp = pgd_offset_raw(allocator(mask), dst_addr);
219+ trans_pgd = allocator(mask);
220+ if (!trans_pgd) {
221+ rc = -ENOMEM;
222+ goto out;
223+ }
224+
225+ pgdp = pgd_offset_raw(trans_pgd, dst_addr);
219226 if (pgd_none(READ_ONCE(*pgdp))) {
220227 pudp = allocator(mask);
221228 if (!pudp) {
arch/arm64/kernel/process.c+18−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/sched/task.h>
1818 #include <linux/sched/task_stack.h>
1919 #include <linux/kernel.h>
20+#include <linux/lockdep.h>
2021 #include <linux/mm.h>
2122 #include <linux/stddef.h>
2223 #include <linux/sysctl.h>
@@ -44,6 +45,7 @@ · 21 unmodified lines
4445 #include <asm/alternative.h>
4546 #include <asm/arch_gicv3.h>
4647 #include <asm/compat.h>
48+#include <asm/cpufeature.h>
4749 #include <asm/cacheflush.h>
4850 #include <asm/exec.h>
4951 #include <asm/fpsimd.h>
@@ -631,3 +633,19 @@ static int __init tagged_addr_init(void) · 581 unmodified lines
631633
632634 core_initcall(tagged_addr_init);
633635 #endif /* CONFIG_ARM64_TAGGED_ADDR_ABI */
636+
637+asmlinkage void __sched arm64_preempt_schedule_irq(void)
638+{
639+ lockdep_assert_irqs_disabled();
640+
641+ /*
642+ * Preempting a task from an IRQ means we leave copies of PSTATE
643+ * on the stack. cpufeature's enable calls may modify PSTATE, but
644+ * resuming one of these preempted tasks would undo those changes.
645+ *
646+ * Only allow a task to be preempted once cpufeatures have been
647+ * enabled.
648+ */
649+ if (static_branch_likely(&arm64_const_caps_ready))
650+ preempt_schedule_irq();
651+}
arch/arm64/kvm/hyp/switch.c+67−2
@@ -124,6 +124,9 @@ static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu) · 123 unmodified lines
124124 {
125125 u64 hcr = vcpu->arch.hcr_el2;
126126
127+ if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM))
128+ hcr |= HCR_TVM;
129+
127130 write_sysreg(hcr, hcr_el2);
128131
129132 if (cpus_have_const_cap(ARM64_HAS_RAS_EXTN) && (hcr & HCR_VSE))
@@ -174,8 +177,10 @@ static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu) · 44 unmodified lines
174177 * the crucial bit is "On taking a vSError interrupt,
175178 * HCR_EL2.VSE is cleared to 0."
176179 */
177− if (vcpu->arch.hcr_el2 & HCR_VSE)
178− vcpu->arch.hcr_el2 = read_sysreg(hcr_el2);
180+ if (vcpu->arch.hcr_el2 & HCR_VSE) {
181+ vcpu->arch.hcr_el2 &= ~HCR_VSE;
182+ vcpu->arch.hcr_el2 |= read_sysreg(hcr_el2) & HCR_VSE;
183+ }
179184
180185 if (has_vhe())
181186 deactivate_traps_vhe();
@@ -380,6 +385,61 @@ static bool __hyp_text __hyp_handle_fpsimd(struct kvm_vcpu *vcpu) · 198 unmodified lines
380385 return true;
381386 }
382387
388+static bool __hyp_text handle_tx2_tvm(struct kvm_vcpu *vcpu)
389+{
390+ u32 sysreg = esr_sys64_to_sysreg(kvm_vcpu_get_hsr(vcpu));
391+ int rt = kvm_vcpu_sys_get_rt(vcpu);
392+ u64 val = vcpu_get_reg(vcpu, rt);
393+
394+ /*
395+ * The normal sysreg handling code expects to see the traps,
396+ * let's not do anything here.
397+ */
398+ if (vcpu->arch.hcr_el2 & HCR_TVM)
399+ return false;
400+
401+ switch (sysreg) {
402+ case SYS_SCTLR_EL1:
403+ write_sysreg_el1(val, SYS_SCTLR);
404+ break;
405+ case SYS_TTBR0_EL1:
406+ write_sysreg_el1(val, SYS_TTBR0);
407+ break;
408+ case SYS_TTBR1_EL1:
409+ write_sysreg_el1(val, SYS_TTBR1);
410+ break;
411+ case SYS_TCR_EL1:
412+ write_sysreg_el1(val, SYS_TCR);
413+ break;
414+ case SYS_ESR_EL1:
415+ write_sysreg_el1(val, SYS_ESR);
416+ break;
417+ case SYS_FAR_EL1:
418+ write_sysreg_el1(val, SYS_FAR);
419+ break;
420+ case SYS_AFSR0_EL1:
421+ write_sysreg_el1(val, SYS_AFSR0);
422+ break;
423+ case SYS_AFSR1_EL1:
424+ write_sysreg_el1(val, SYS_AFSR1);
425+ break;
426+ case SYS_MAIR_EL1:
427+ write_sysreg_el1(val, SYS_MAIR);
428+ break;
429+ case SYS_AMAIR_EL1:
430+ write_sysreg_el1(val, SYS_AMAIR);
431+ break;
432+ case SYS_CONTEXTIDR_EL1:
433+ write_sysreg_el1(val, SYS_CONTEXTIDR);
434+ break;
435+ default:
436+ return false;
437+ }
438+
439+ __kvm_skip_instr(vcpu);
440+ return true;
441+}
442+
383443 /*
384444 * Return true when we were able to fixup the guest exit and should return to
385445 * the guest, false when we should restore the host state and return to the
@@ -399,6 +459,11 @@ static bool __hyp_text fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 13 unmodified lines
399459 if (*exit_code != ARM_EXCEPTION_TRAP)
400460 goto exit;
401461
462+ if (cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) &&
463+ kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_SYS64 &&
464+ handle_tx2_tvm(vcpu))
465+ return true;
466+
402467 /*
403468 * We trap the first access to the FP/SIMD to save the host context
404469 * and restore the guest context lazily.
arch/arm64/kvm/sys_regs.c+4−0
@@ -632,6 +632,8 @@ static void reset_pmcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r) · 631 unmodified lines
632632 */
633633 val = ((pmcr & ~ARMV8_PMU_PMCR_MASK)
634634 | (ARMV8_PMU_PMCR_MASK & 0xdecafbad)) & (~ARMV8_PMU_PMCR_E);
635+ if (!system_supports_32bit_el0())
636+ val |= ARMV8_PMU_PMCR_LC;
635637 __vcpu_sys_reg(vcpu, r->reg) = val;
636638 }
637639
@@ -682,6 +684,8 @@ static bool access_pmcr(struct kvm_vcpu *vcpu, struct sys_reg_params *p, · 44 unmodified lines
682684 val = __vcpu_sys_reg(vcpu, PMCR_EL0);
683685 val &= ~ARMV8_PMU_PMCR_MASK;
684686 val |= p->regval & ARMV8_PMU_PMCR_MASK;
687+ if (!system_supports_32bit_el0())
688+ val |= ARMV8_PMU_PMCR_LC;
685689 __vcpu_sys_reg(vcpu, PMCR_EL0) = val;
686690 kvm_pmu_handle_pmcr(vcpu, val);
687691 kvm_vcpu_pmu_restore_guest(vcpu);
arch/arm64/mm/fault.c+5−1
@@ -268,8 +268,12 @@ static bool __kprobes is_spurious_el1_translation_fault(unsigned long addr, · 267 unmodified lines
268268 par = read_sysreg(par_el1);
269269 local_irq_restore(flags);
270270
271+ /*
272+ * If we now have a valid translation, treat the translation fault as
273+ * spurious.
274+ */
271275 if (!(par & SYS_PAR_EL1_F))
272− return false;
276+ return true;
273277
274278 /*
275279 * If we got a different type of fault from the AT instruction,
arch/mips/bcm63xx/prom.c+1−1
@@ -84,7 +84,7 @@ void __init prom_init(void) · 83 unmodified lines
8484 * Here we will start up CPU1 in the background and ask it to
8585 * reconfigure itself then go back to sleep.
8686 */
87− memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
87+ memcpy((void *)0xa0000200, bmips_smp_movevec, 0x20);
8888 __sync();
8989 set_c0_cause(C_SW0);
9090 cpumask_set_cpu(1, &bmips_booted_mask);
arch/mips/include/asm/bmips.h+5−5
@@ -75,11 +75,11 @@ static inline int register_bmips_smp_ops(void) · 74 unmodified lines
7575 #endif
7676 }
7777
78−extern char bmips_reset_nmi_vec;
79−extern char bmips_reset_nmi_vec_end;
80−extern char bmips_smp_movevec;
81−extern char bmips_smp_int_vec;
82−extern char bmips_smp_int_vec_end;
78+extern char bmips_reset_nmi_vec[];
79+extern char bmips_reset_nmi_vec_end[];
80+extern char bmips_smp_movevec[];
81+extern char bmips_smp_int_vec[];
82+extern char bmips_smp_int_vec_end[];
8383
8484 extern int bmips_smp_enabled;
8585 extern int bmips_cpu_offset;
arch/mips/include/asm/vdso/gettimeofday.h+3−1
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424
2525 #define VDSO_HAS_CLOCK_GETRES 1
2626
27+#define __VDSO_USE_SYSCALL ULLONG_MAX
28+
2729 #ifdef CONFIG_MIPS_CLOCK_VSYSCALL
2830
2931 static __always_inline long gettimeofday_fallback(
@@ -205,7 +207,7 @@ static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) · 175 unmodified lines
205207 break;
206208 #endif
207209 default:
208− cycle_now = 0;
210+ cycle_now = __VDSO_USE_SYSCALL;
209211 break;
210212 }
211213
arch/mips/kernel/smp-bmips.c+4−4
@@ -464,10 +464,10 @@ static void bmips_wr_vec(unsigned long dst, char *start, char *end) · 463 unmodified lines
464464
465465 static inline void bmips_nmi_handler_setup(void)
466466 {
467− bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
468− &bmips_reset_nmi_vec_end);
469− bmips_wr_vec(BMIPS_WARM_RESTART_VEC, &bmips_smp_int_vec,
470− &bmips_smp_int_vec_end);
467+ bmips_wr_vec(BMIPS_NMI_RESET_VEC, bmips_reset_nmi_vec,
468+ bmips_reset_nmi_vec_end);
469+ bmips_wr_vec(BMIPS_WARM_RESTART_VEC, bmips_smp_int_vec,
470+ bmips_smp_int_vec_end);
471471 }
472472
473473 struct reset_vec_info {
arch/mips/mm/tlbex.c+15−8
@@ -653,6 +653,13 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, · 652 unmodified lines
653653 int restore_scratch)
654654 {
655655 if (restore_scratch) {
656+ /*
657+ * Ensure the MFC0 below observes the value written to the
658+ * KScratch register by the prior MTC0.
659+ */
660+ if (scratch_reg >= 0)
661+ uasm_i_ehb(p);
662+
656663 /* Reset default page size */
657664 if (PM_DEFAULT_MASK >> 16) {
658665 uasm_i_lui(p, tmp, PM_DEFAULT_MASK >> 16);
@@ -667,12 +674,10 @@ static void build_restore_pagemask(u32 **p, struct uasm_reloc **r, · 8 unmodified lines
667674 uasm_i_mtc0(p, 0, C0_PAGEMASK);
668675 uasm_il_b(p, r, lid);
669676 }
670− if (scratch_reg >= 0) {
671− uasm_i_ehb(p);
677+ if (scratch_reg >= 0)
672678 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
673− } else {
679+ else
674680 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
675− }
676681 } else {
677682 /* Reset default page size */
678683 if (PM_DEFAULT_MASK >> 16) {
@@ -921,6 +926,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, · 242 unmodified lines
921926 }
922927 if (mode != not_refill && check_for_high_segbits) {
923928 uasm_l_large_segbits_fault(l, *p);
929+
930+ if (mode == refill_scratch && scratch_reg >= 0)
931+ uasm_i_ehb(p);
932+
924933 /*
925934 * We get here if we are an xsseg address, or if we are
926935 * an xuseg address above (PGDIR_SHIFT+PGDIR_BITS) boundary.
@@ -939,12 +948,10 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, · 12 unmodified lines
939948 uasm_i_jr(p, ptr);
940949
941950 if (mode == refill_scratch) {
942− if (scratch_reg >= 0) {
943− uasm_i_ehb(p);
951+ if (scratch_reg >= 0)
944952 UASM_i_MFC0(p, 1, c0_kscratch(), scratch_reg);
945− } else {
953+ else
946954 UASM_i_LW(p, 1, scratchpad_offset(0), 0);
947− }
948955 } else {
949956 uasm_i_nop(p);
950957 }
arch/parisc/include/asm/cache.h+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222
2323 #define ARCH_DMA_MINALIGN L1_CACHE_BYTES
2424
25−#define __read_mostly __attribute__((__section__(".data..read_mostly")))
25+#define __read_mostly __section(.data..read_mostly)
2626
2727 void parisc_cache_init(void); /* initializes cache-flushing */
2828 void disable_sr_hashing_asm(int); /* low level support for above */
arch/parisc/include/asm/ldcw.h+1−1
@@ -52,7 +52,7 @@ · 51 unmodified lines
5252 })
5353
5454 #ifdef CONFIG_SMP
55−# define __lock_aligned __attribute__((__section__(".data..lock_aligned")))
55+# define __lock_aligned __section(.data..lock_aligned)
5656 #endif
5757
5858 #endif /* __PARISC_LDCW_H */
arch/parisc/mm/ioremap.c+7−5
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 * arch/parisc/mm/ioremap.c
44 *
55 * (C) Copyright 1995 1996 Linus Torvalds
6− * (C) Copyright 2001-2006 Helge Deller <deller@gmx.de>
6+ * (C) Copyright 2001-2019 Helge Deller <deller@gmx.de>
77 * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
88 */
99
@@ -84,7 +84,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l · 74 unmodified lines
8484 addr = (void __iomem *) area->addr;
8585 if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
8686 phys_addr, pgprot)) {
87− vfree(addr);
87+ vunmap(addr);
8888 return NULL;
8989 }
9090
@@ -92,9 +92,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l · 1 unmodified line
9292 }
9393 EXPORT_SYMBOL(__ioremap);
9494
95−void iounmap(const volatile void __iomem *addr)
95+void iounmap(const volatile void __iomem *io_addr)
9696 {
97− if (addr > high_memory)
98− return vfree((void *) (PAGE_MASK & (unsigned long __force) addr));
97+ unsigned long addr = (unsigned long)io_addr & PAGE_MASK;
98+
99+ if (is_vmalloc_addr((void *)addr))
100+ vunmap((void *)addr);
99101 }
100102 EXPORT_SYMBOL(iounmap);
arch/powerpc/kvm/book3s_xive.c+16−8
@@ -1217,6 +1217,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev, · 1216 unmodified lines
12171217 struct kvmppc_xive *xive = dev->private;
12181218 struct kvmppc_xive_vcpu *xc;
12191219 int i, r = -EBUSY;
1220+ u32 vp_id;
12201221
12211222 pr_devel("connect_vcpu(cpu=%d)\n", cpu);
12221223
@@ -1228,25 +1229,32 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev, · 5 unmodified lines
12281229 return -EPERM;
12291230 if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT)
12301231 return -EBUSY;
1231− if (kvmppc_xive_find_server(vcpu->kvm, cpu)) {
1232− pr_devel("Duplicate !\n");
1233− return -EEXIST;
1234− }
12351232 if (cpu >= (KVM_MAX_VCPUS * vcpu->kvm->arch.emul_smt_mode)) {
12361233 pr_devel("Out of bounds !\n");
12371234 return -EINVAL;
12381235 }
1239− xc = kzalloc(sizeof(*xc), GFP_KERNEL);
1240− if (!xc)
1241− return -ENOMEM;
12421236
12431237 /* We need to synchronize with queue provisioning */
12441238 mutex_lock(&xive->lock);
1239+
1240+ vp_id = kvmppc_xive_vp(xive, cpu);
1241+ if (kvmppc_xive_vp_in_use(xive->kvm, vp_id)) {
1242+ pr_devel("Duplicate !\n");
1243+ r = -EEXIST;
1244+ goto bail;
1245+ }
1246+
1247+ xc = kzalloc(sizeof(*xc), GFP_KERNEL);
1248+ if (!xc) {
1249+ r = -ENOMEM;
1250+ goto bail;
1251+ }
1252+
12451253 vcpu->arch.xive_vcpu = xc;
12461254 xc->xive = xive;
12471255 xc->vcpu = vcpu;
12481256 xc->server_num = cpu;
1249− xc->vp_id = kvmppc_xive_vp(xive, cpu);
1257+ xc->vp_id = vp_id;
12501258 xc->mfrr = 0xff;
12511259 xc->valid = true;
12521260
arch/powerpc/kvm/book3s_xive.h+12−0
@@ -220,6 +220,18 @@ static inline u32 kvmppc_xive_vp(struct kvmppc_xive *xive, u32 server) · 219 unmodified lines
220220 return xive->vp_base + kvmppc_pack_vcpu_id(xive->kvm, server);
221221 }
222222
223+static inline bool kvmppc_xive_vp_in_use(struct kvm *kvm, u32 vp_id)
224+{
225+ struct kvm_vcpu *vcpu = NULL;
226+ int i;
227+
228+ kvm_for_each_vcpu(i, vcpu, kvm) {
229+ if (vcpu->arch.xive_vcpu && vp_id == vcpu->arch.xive_vcpu->vp_id)
230+ return true;
231+ }
232+ return false;
233+}
234+
223235 /*
224236 * Mapping between guest priorities and host priorities
225237 * is as follow.
arch/powerpc/kvm/book3s_xive_native.c+4−2
@@ -106,6 +106,7 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, · 105 unmodified lines
106106 struct kvmppc_xive *xive = dev->private;
107107 struct kvmppc_xive_vcpu *xc = NULL;
108108 int rc;
109+ u32 vp_id;
109110
110111 pr_devel("native_connect_vcpu(server=%d)\n", server_num);
111112
@@ -124,7 +125,8 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, · 12 unmodified lines
124125
125126 mutex_lock(&xive->lock);
126127
127− if (kvmppc_xive_find_server(vcpu->kvm, server_num)) {
128+ vp_id = kvmppc_xive_vp(xive, server_num);
129+ if (kvmppc_xive_vp_in_use(xive->kvm, vp_id)) {
128130 pr_devel("Duplicate !\n");
129131 rc = -EEXIST;
130132 goto bail;
@@ -141,7 +143,7 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, · 10 unmodified lines
141143 xc->vcpu = vcpu;
142144 xc->server_num = server_num;
143145
144− xc->vp_id = kvmppc_xive_vp(xive, server_num);
146+ xc->vp_id = vp_id;
145147 xc->valid = true;
146148 vcpu->arch.irq_type = KVMPPC_IRQ_XIVE;
147149
arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 compatible = "sifive,hifive-unleashed-a00", "sifive,fu540-c000";
1414
1515 chosen {
16+ stdout-path = "serial0";
1617 };
1718
1819 cpus {
arch/riscv/include/asm/bug.h+3−13
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212
1313 #include <asm/asm.h>
1414
15−#ifdef CONFIG_GENERIC_BUG
1615 #define __INSN_LENGTH_MASK _UL(0x3)
1716 #define __INSN_LENGTH_32 _UL(0x3)
1817 #define __COMPRESSED_INSN_MASK _UL(0xffff)
@@ -20,7 +19,6 @@ · 1 unmodified line
2019 #define __BUG_INSN_32 _UL(0x00100073) /* ebreak */
2120 #define __BUG_INSN_16 _UL(0x9002) /* c.ebreak */
2221
23−#ifndef __ASSEMBLY__
2422 typedef u32 bug_insn_t;
2523
2624 #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS
@@ -43,6 +41,7 @@ typedef u32 bug_insn_t; · 16 unmodified lines
4341 RISCV_SHORT " %2"
4442 #endif
4543
44+#ifdef CONFIG_GENERIC_BUG
4645 #define __BUG_FLAGS(flags) \
4746 do { \
4847 __asm__ __volatile__ ( \
@@ -58,14 +57,10 @@ do { \ · 9 unmodified lines
5857 "i" (flags), \
5958 "i" (sizeof(struct bug_entry))); \
6059 } while (0)
61−
62−#endif /* !__ASSEMBLY__ */
6360 #else /* CONFIG_GENERIC_BUG */
64−#ifndef __ASSEMBLY__
6561 #define __BUG_FLAGS(flags) do { \
6662 __asm__ __volatile__ ("ebreak\n"); \
6763 } while (0)
68−#endif /* !__ASSEMBLY__ */
6964 #endif /* CONFIG_GENERIC_BUG */
7065
7166 #define BUG() do { \
@@ -79,15 +74,10 @@ do { \ · 7 unmodified lines
7974
8075 #include <asm-generic/bug.h>
8176
82−#ifndef __ASSEMBLY__
83−
8477 struct pt_regs;
8578 struct task_struct;
8679
87−extern void die(struct pt_regs *regs, const char *str);
88−extern void do_trap(struct pt_regs *regs, int signo, int code,
89− unsigned long addr);
90−
91−#endif /* !__ASSEMBLY__ */
80+void die(struct pt_regs *regs, const char *str);
81+void do_trap(struct pt_regs *regs, int signo, int code, unsigned long addr);
9282
9383 #endif /* _ASM_RISCV_BUG_H */
arch/riscv/include/asm/pgtable.h+9−14
@@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[]; · 86 unmodified lines
8787 #define VMALLOC_END (PAGE_OFFSET - 1)
8888 #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE)
8989
90−#define FIXADDR_TOP VMALLOC_START
91−#ifdef CONFIG_64BIT
92−#define FIXADDR_SIZE PMD_SIZE
93−#else
94−#define FIXADDR_SIZE PGDIR_SIZE
95−#endif
96−#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
97−
9890 /*
9991 * Roughly size the vmemmap space to be large enough to fit enough
10092 * struct pages to map half the virtual address space. Then
@@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[]; · 7 unmodified lines
108100
109101 #define vmemmap ((struct page *)VMEMMAP_START)
110102
103+#define FIXADDR_TOP (VMEMMAP_START)
104+#ifdef CONFIG_64BIT
105+#define FIXADDR_SIZE PMD_SIZE
106+#else
107+#define FIXADDR_SIZE PGDIR_SIZE
108+#endif
109+#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
110+
111111 /*
112112 * ZERO_PAGE is a global shared page that is always zero,
113113 * used for zero-mapped memory areas, etc.
@@ -184,10 +184,7 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t prot) · 70 unmodified lines
184184 return __pte((pfn << _PAGE_PFN_SHIFT) | pgprot_val(prot));
185185 }
186186
187−static inline pte_t mk_pte(struct page *page, pgprot_t prot)
188−{
189− return pfn_pte(page_to_pfn(page), prot);
190−}
187+#define mk_pte(page, prot) pfn_pte(page_to_pfn(page), prot)
191188
192189 #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
193190
@@ -428,9 +425,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, · 234 unmodified lines
428425 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
429426 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
430427
431−#ifdef CONFIG_FLATMEM
432428 #define kern_addr_valid(addr) (1) /* FIXME */
433−#endif
434429
435430 extern void *dtb_early_va;
436431 extern void setup_bootmem(void);
arch/riscv/include/asm/tlbflush.h+0−4
@@ -10,10 +10,6 @@ · 9 unmodified lines
1010 #include <linux/mm_types.h>
1111 #include <asm/smp.h>
1212
13−/*
14− * Flush entire local TLB. 'sfence.vma' implicitly fences with the instruction
15− * cache as well, so a 'fence.i' is not necessary.
16− */
1713 static inline void local_flush_tlb_all(void)
1814 {
1915 __asm__ __volatile__ ("sfence.vma" : : : "memory");
arch/riscv/kernel/traps.c+6−20
@@ -111,7 +111,6 @@ DO_ERROR_INFO(do_trap_ecall_s, · 110 unmodified lines
111111 DO_ERROR_INFO(do_trap_ecall_m,
112112 SIGILL, ILL_ILLTRP, "environment call from M-mode");
113113
114−#ifdef CONFIG_GENERIC_BUG
115114 static inline unsigned long get_break_insn_length(unsigned long pc)
116115 {
117116 bug_insn_t insn;
@@ -120,28 +119,15 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 2 unmodified lines
120119 return 0;
121120 return (((insn & __INSN_LENGTH_MASK) == __INSN_LENGTH_32) ? 4UL : 2UL);
122121 }
123−#endif /* CONFIG_GENERIC_BUG */
124122
125123 asmlinkage void do_trap_break(struct pt_regs *regs)
126124 {
127− if (!user_mode(regs)) {
128− enum bug_trap_type type;
129−
130− type = report_bug(regs->sepc, regs);
131− switch (type) {
132−#ifdef CONFIG_GENERIC_BUG
133− case BUG_TRAP_TYPE_WARN:
134− regs->sepc += get_break_insn_length(regs->sepc);
135− return;
136− case BUG_TRAP_TYPE_BUG:
137−#endif /* CONFIG_GENERIC_BUG */
138− default:
139− die(regs, "Kernel BUG");
140− }
141− } else {
142− force_sig_fault(SIGTRAP, TRAP_BRKPT,
143− (void __user *)(regs->sepc));
144− }
125+ if (user_mode(regs))
126+ force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->sepc);
127+ else if (report_bug(regs->sepc, regs) == BUG_TRAP_TYPE_WARN)
128+ regs->sepc += get_break_insn_length(regs->sepc);
129+ else
130+ die(regs, "Kernel BUG");
145131 }
146132
147133 #ifdef CONFIG_GENERIC_BUG
arch/riscv/mm/init.c+1−1
@@ -458,7 +458,7 @@ void __init paging_init(void) · 457 unmodified lines
458458 zone_sizes_init();
459459 }
460460
461−#ifdef CONFIG_SPARSEMEM
461+#ifdef CONFIG_SPARSEMEM_VMEMMAP
462462 int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
463463 struct vmem_altmap *altmap)
464464 {
arch/s390/boot/startup.c+11−3
@@ -101,10 +101,18 @@ static void handle_relocs(unsigned long offset) · 100 unmodified lines
101101 dynsym = (Elf64_Sym *) vmlinux.dynsym_start;
102102 for (rela = rela_start; rela < rela_end; rela++) {
103103 loc = rela->r_offset + offset;
104− val = rela->r_addend + offset;
104+ val = rela->r_addend;
105105 r_sym = ELF64_R_SYM(rela->r_info);
106− if (r_sym)
107− val += dynsym[r_sym].st_value;
106+ if (r_sym) {
107+ if (dynsym[r_sym].st_shndx != SHN_UNDEF)
108+ val += dynsym[r_sym].st_value + offset;
109+ } else {
110+ /*
111+ * 0 == undefined symbol table index (STN_UNDEF),
112+ * used for R_390_RELATIVE, only add KASLR offset
113+ */
114+ val += offset;
115+ }
108116 r_type = ELF64_R_TYPE(rela->r_info);
109117 rc = arch_kexec_do_relocs(r_type, (void *) loc, val, 0);
110118 if (rc)
arch/s390/kernel/machine_kexec_reloc.c+1−0
@@ -27,6 +27,7 @@ int arch_kexec_do_relocs(int r_type, void *loc, unsigned long val, · 26 unmodified lines
2727 *(u32 *)loc = val;
2828 break;
2929 case R_390_64: /* Direct 64 bit. */
30+ case R_390_GLOB_DAT:
3031 *(u64 *)loc = val;
3132 break;
3233 case R_390_PC16: /* PC relative 16 bit. */
arch/sparc/Kconfig+0−1
@@ -29,7 +29,6 @@ config SPARC · 28 unmodified lines
2929 select RTC_DRV_M48T59
3030 select RTC_SYSTOHC
3131 select HAVE_ARCH_JUMP_LABEL if SPARC64
32− select HAVE_FAST_GUP if SPARC64
3332 select GENERIC_IRQ_SHOW
3433 select ARCH_WANT_IPC_PARSE_VERSION
3534 select GENERIC_PCI_IOMAP
arch/x86/boot/compressed/acpi.c+24−24
@@ -20,30 +20,6 @@ · 19 unmodified lines
2020 */
2121 struct mem_vector immovable_mem[MAX_NUMNODES*2];
2222
23−/*
24− * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
25− * digits, and '\0' for termination.
26− */
27−#define MAX_ADDR_LEN 19
28−
29−static acpi_physical_address get_cmdline_acpi_rsdp(void)
30−{
31− acpi_physical_address addr = 0;
32−
33−#ifdef CONFIG_KEXEC
34− char val[MAX_ADDR_LEN] = { };
35− int ret;
36−
37− ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
38− if (ret < 0)
39− return 0;
40−
41− if (kstrtoull(val, 16, &addr))
42− return 0;
43−#endif
44− return addr;
45−}
46−
4723 /*
4824 * Search EFI system tables for RSDP. If both ACPI_20_TABLE_GUID and
4925 * ACPI_TABLE_GUID are found, take the former, which has more features.
@@ -298,6 +274,30 @@ acpi_physical_address get_rsdp_addr(void) · 248 unmodified lines
298274 }
299275
300276 #if defined(CONFIG_RANDOMIZE_BASE) && defined(CONFIG_MEMORY_HOTREMOVE)
277+/*
278+ * Max length of 64-bit hex address string is 19, prefix "0x" + 16 hex
279+ * digits, and '\0' for termination.
280+ */
281+#define MAX_ADDR_LEN 19
282+
283+static acpi_physical_address get_cmdline_acpi_rsdp(void)
284+{
285+ acpi_physical_address addr = 0;
286+
287+#ifdef CONFIG_KEXEC
288+ char val[MAX_ADDR_LEN] = { };
289+ int ret;
290+
291+ ret = cmdline_find_option("acpi_rsdp", val, MAX_ADDR_LEN);
292+ if (ret < 0)
293+ return 0;
294+
295+ if (kstrtoull(val, 16, &addr))
296+ return 0;
297+#endif
298+ return addr;
299+}
300+
301301 /* Compute SRAT address from RSDP. */
302302 static unsigned long get_acpi_srat_table(void)
303303 {
arch/x86/boot/compressed/misc.c+19−6
@@ -345,6 +345,7 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, · 344 unmodified lines
345345 {
346346 const unsigned long kernel_total_size = VO__end - VO__text;
347347 unsigned long virt_addr = LOAD_PHYSICAL_ADDR;
348+ unsigned long needed_size;
348349
349350 /* Retain x86 boot parameters pointer passed from startup_32/64. */
350351 boot_params = rmode;
@@ -379,26 +380,38 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, · 28 unmodified lines
379380 free_mem_ptr = heap; /* Heap */
380381 free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
381382
383+ /*
384+ * The memory hole needed for the kernel is the larger of either
385+ * the entire decompressed kernel plus relocation table, or the
386+ * entire decompressed kernel plus .bss and .brk sections.
387+ *
388+ * On X86_64, the memory is mapped with PMD pages. Round the
389+ * size up so that the full extent of PMD pages mapped is
390+ * included in the check against the valid memory table
391+ * entries. This ensures the full mapped area is usable RAM
392+ * and doesn't include any reserved areas.
393+ */
394+ needed_size = max(output_len, kernel_total_size);
395+#ifdef CONFIG_X86_64
396+ needed_size = ALIGN(needed_size, MIN_KERNEL_ALIGN);
397+#endif
398+
382399 /* Report initial kernel position details. */
383400 debug_putaddr(input_data);
384401 debug_putaddr(input_len);
385402 debug_putaddr(output);
386403 debug_putaddr(output_len);
387404 debug_putaddr(kernel_total_size);
405+ debug_putaddr(needed_size);
388406
389407 #ifdef CONFIG_X86_64
390408 /* Report address of 32-bit trampoline */
391409 debug_putaddr(trampoline_32bit);
392410 #endif
393411
394− /*
395− * The memory hole needed for the kernel is the larger of either
396− * the entire decompressed kernel plus relocation table, or the
397− * entire decompressed kernel plus .bss and .brk sections.
398− */
399412 choose_random_location((unsigned long)input_data, input_len,
400413 (unsigned long *)&output,
401− max(output_len, kernel_total_size),
414+ needed_size,
402415 &virt_addr);
403416
404417 /* Validate memory location choices. */
arch/x86/events/amd/ibs.c+5−3
@@ -377,7 +377,8 @@ static inline void perf_ibs_disable_event(struct perf_ibs *perf_ibs, · 376 unmodified lines
377377 struct hw_perf_event *hwc, u64 config)
378378 {
379379 config &= ~perf_ibs->cnt_mask;
380− wrmsrl(hwc->config_base, config);
380+ if (boot_cpu_data.x86 == 0x10)
381+ wrmsrl(hwc->config_base, config);
381382 config &= ~perf_ibs->enable_mask;
382383 wrmsrl(hwc->config_base, config);
383384 }
@@ -553,7 +554,8 @@ static struct perf_ibs perf_ibs_op = { · 169 unmodified lines
553554 },
554555 .msr = MSR_AMD64_IBSOPCTL,
555556 .config_mask = IBS_OP_CONFIG_MASK,
556− .cnt_mask = IBS_OP_MAX_CNT,
557+ .cnt_mask = IBS_OP_MAX_CNT | IBS_OP_CUR_CNT |
558+ IBS_OP_CUR_CNT_RAND,
557559 .enable_mask = IBS_OP_ENABLE,
558560 .valid_mask = IBS_OP_VAL,
559561 .max_period = IBS_OP_MAX_CNT << 4,
@@ -614,7 +616,7 @@ fail: · 54 unmodified lines
614616 if (event->attr.sample_type & PERF_SAMPLE_RAW)
615617 offset_max = perf_ibs->offset_max;
616618 else if (check_rip)
617− offset_max = 2;
619+ offset_max = 3;
618620 else
619621 offset_max = 1;
620622 do {
arch/x86/events/intel/uncore.c+38−6
@@ -502,10 +502,8 @@ void uncore_pmu_event_start(struct perf_event *event, int flags) · 501 unmodified lines
502502 local64_set(&event->hw.prev_count, uncore_read_counter(box, event));
503503 uncore_enable_event(box, event);
504504
505− if (box->n_active == 1) {
506− uncore_enable_box(box);
505+ if (box->n_active == 1)
507506 uncore_pmu_start_hrtimer(box);
508− }
509507 }
510508
511509 void uncore_pmu_event_stop(struct perf_event *event, int flags)
@@ -529,10 +527,8 @@ void uncore_pmu_event_stop(struct perf_event *event, int flags) · 17 unmodified lines
529527 WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED);
530528 hwc->state |= PERF_HES_STOPPED;
531529
532− if (box->n_active == 0) {
533− uncore_disable_box(box);
530+ if (box->n_active == 0)
534531 uncore_pmu_cancel_hrtimer(box);
535− }
536532 }
537533
538534 if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
@@ -778,6 +774,40 @@ static int uncore_pmu_event_init(struct perf_event *event) · 239 unmodified lines
778774 return ret;
779775 }
780776
777+static void uncore_pmu_enable(struct pmu *pmu)
778+{
779+ struct intel_uncore_pmu *uncore_pmu;
780+ struct intel_uncore_box *box;
781+
782+ uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu);
783+ if (!uncore_pmu)
784+ return;
785+
786+ box = uncore_pmu_to_box(uncore_pmu, smp_processor_id());
787+ if (!box)
788+ return;
789+
790+ if (uncore_pmu->type->ops->enable_box)
791+ uncore_pmu->type->ops->enable_box(box);
792+}
793+
794+static void uncore_pmu_disable(struct pmu *pmu)
795+{
796+ struct intel_uncore_pmu *uncore_pmu;
797+ struct intel_uncore_box *box;
798+
799+ uncore_pmu = container_of(pmu, struct intel_uncore_pmu, pmu);
800+ if (!uncore_pmu)
801+ return;
802+
803+ box = uncore_pmu_to_box(uncore_pmu, smp_processor_id());
804+ if (!box)
805+ return;
806+
807+ if (uncore_pmu->type->ops->disable_box)
808+ uncore_pmu->type->ops->disable_box(box);
809+}
810+
781811 static ssize_t uncore_get_attr_cpumask(struct device *dev,
782812 struct device_attribute *attr, char *buf)
783813 {
@@ -803,6 +833,8 @@ static int uncore_pmu_register(struct intel_uncore_pmu *pmu) · 19 unmodified lines
803833 pmu->pmu = (struct pmu) {
804834 .attr_groups = pmu->type->attr_groups,
805835 .task_ctx_nr = perf_invalid_context,
836+ .pmu_enable = uncore_pmu_enable,
837+ .pmu_disable = uncore_pmu_disable,
806838 .event_init = uncore_pmu_event_init,
807839 .add = uncore_pmu_event_add,
808840 .del = uncore_pmu_event_del,
arch/x86/events/intel/uncore.h+0−12
@@ -441,18 +441,6 @@ static inline int uncore_freerunning_hw_config(struct intel_uncore_box *box, · 440 unmodified lines
441441 return -EINVAL;
442442 }
443443
444−static inline void uncore_disable_box(struct intel_uncore_box *box)
445−{
446− if (box->pmu->type->ops->disable_box)
447− box->pmu->type->ops->disable_box(box);
448−}
449−
450−static inline void uncore_enable_box(struct intel_uncore_box *box)
451−{
452− if (box->pmu->type->ops->enable_box)
453− box->pmu->type->ops->enable_box(box);
454−}
455−
456444 static inline void uncore_disable_event(struct intel_uncore_box *box,
457445 struct perf_event *event)
458446 {
arch/x86/hyperv/hv_apic.c+15−5
@@ -260,11 +260,21 @@ void __init hv_apic_init(void) · 259 unmodified lines
260260 }
261261
262262 if (ms_hyperv.hints & HV_X64_APIC_ACCESS_RECOMMENDED) {
263− pr_info("Hyper-V: Using MSR based APIC access\n");
263+ pr_info("Hyper-V: Using enlightened APIC (%s mode)",
264+ x2apic_enabled() ? "x2apic" : "xapic");
265+ /*
266+ * With x2apic, architectural x2apic MSRs are equivalent to the
267+ * respective synthetic MSRs, so there's no need to override
268+ * the apic accessors. The only exception is
269+ * hv_apic_eoi_write, because it benefits from lazy EOI when
270+ * available, but it works for both xapic and x2apic modes.
271+ */
264272 apic_set_eoi_write(hv_apic_eoi_write);
265− apic->read = hv_apic_read;
266− apic->write = hv_apic_write;
267− apic->icr_write = hv_apic_icr_write;
268− apic->icr_read = hv_apic_icr_read;
273+ if (!x2apic_enabled()) {
274+ apic->read = hv_apic_read;
275+ apic->write = hv_apic_write;
276+ apic->icr_write = hv_apic_icr_write;
277+ apic->icr_read = hv_apic_icr_read;
278+ }
269279 }
270280 }
arch/x86/include/asm/kvm_host.h+1−1
@@ -1189,7 +1189,7 @@ struct kvm_x86_ops { · 1188 unmodified lines
11891189 int (*set_nested_state)(struct kvm_vcpu *vcpu,
11901190 struct kvm_nested_state __user *user_kvm_nested_state,
11911191 struct kvm_nested_state *kvm_state);
1192− void (*get_vmcs12_pages)(struct kvm_vcpu *vcpu);
1192+ bool (*get_vmcs12_pages)(struct kvm_vcpu *vcpu);
11931193
11941194 int (*smi_allowed)(struct kvm_vcpu *vcpu);
11951195 int (*pre_enter_smm)(struct kvm_vcpu *vcpu, char *smstate);
arch/x86/include/asm/vmware.h+9−5
@@ -4,6 +4,7 @@ · 3 unmodified lines
44
55 #include <asm/cpufeatures.h>
66 #include <asm/alternative.h>
7+#include <linux/stringify.h>
78
89 /*
910 * The hypercall definitions differ in the low word of the %edx argument
@@ -20,8 +21,8 @@ · 10 unmodified lines
2021 */
2122
2223 /* Old port-based version */
23−#define VMWARE_HYPERVISOR_PORT "0x5658"
24−#define VMWARE_HYPERVISOR_PORT_HB "0x5659"
24+#define VMWARE_HYPERVISOR_PORT 0x5658
25+#define VMWARE_HYPERVISOR_PORT_HB 0x5659
2526
2627 /* Current vmcall / vmmcall version */
2728 #define VMWARE_HYPERVISOR_HB BIT(0)
@@ -29,7 +30,8 @@ · 1 unmodified line
2930
3031 /* The low bandwidth call. The low word of edx is presumed clear. */
3132 #define VMWARE_HYPERCALL \
32− ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT ", %%dx; inl (%%dx)", \
33+ ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT) ", %%dx; " \
34+ "inl (%%dx), %%eax", \
3335 "vmcall", X86_FEATURE_VMCALL, \
3436 "vmmcall", X86_FEATURE_VMW_VMMCALL)
3537
@@ -38,7 +40,8 @@ · 2 unmodified lines
3840 * HB and OUT bits set.
3941 */
4042 #define VMWARE_HYPERCALL_HB_OUT \
41− ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep outsb", \
43+ ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
44+ "rep outsb", \
4245 "vmcall", X86_FEATURE_VMCALL, \
4346 "vmmcall", X86_FEATURE_VMW_VMMCALL)
4447
@@ -47,7 +50,8 @@ · 2 unmodified lines
4750 * HB bit set.
4851 */
4952 #define VMWARE_HYPERCALL_HB_IN \
50− ALTERNATIVE_2("movw $" VMWARE_HYPERVISOR_PORT_HB ", %%dx; rep insb", \
53+ ALTERNATIVE_2("movw $" __stringify(VMWARE_HYPERVISOR_PORT_HB) ", %%dx; " \
54+ "rep insb", \
5155 "vmcall", X86_FEATURE_VMCALL, \
5256 "vmmcall", X86_FEATURE_VMW_VMMCALL)
5357 #endif
arch/x86/kernel/apic/x2apic_cluster.c+2−1
@@ -156,7 +156,8 @@ static int x2apic_dead_cpu(unsigned int dead_cpu) · 155 unmodified lines
156156 {
157157 struct cluster_mask *cmsk = per_cpu(cluster_masks, dead_cpu);
158158
159− cpumask_clear_cpu(dead_cpu, &cmsk->mask);
159+ if (cmsk)
160+ cpumask_clear_cpu(dead_cpu, &cmsk->mask);
160161 free_cpumask_var(per_cpu(ipi_mask, dead_cpu));
161162 return 0;
162163 }
arch/x86/kernel/cpu/mshyperv.c+4−0
@@ -216,6 +216,10 @@ static void __init ms_hyperv_init_platform(void) · 215 unmodified lines
216216 int hv_host_info_ecx;
217217 int hv_host_info_edx;
218218
219+#ifdef CONFIG_PARAVIRT
220+ pv_info.name = "Hyper-V";
221+#endif
222+
219223 /*
220224 * Extract the features and hints
221225 */
arch/x86/kernel/head64.c+20−2
@@ -222,13 +222,31 @@ unsigned long __head __startup_64(unsigned long physaddr, · 221 unmodified lines
222222 * we might write invalid pmds, when the kernel is relocated
223223 * cleanup_highmap() fixes this up along with the mappings
224224 * beyond _end.
225+ *
226+ * Only the region occupied by the kernel image has so far
227+ * been checked against the table of usable memory regions
228+ * provided by the firmware, so invalidate pages outside that
229+ * region. A page table entry that maps to a reserved area of
230+ * memory would allow processor speculation into that area,
231+ * and on some hardware (particularly the UV platform) even
232+ * speculative access to some reserved areas is caught as an
233+ * error, causing the BIOS to halt the system.
225234 */
226235
227236 pmd = fixup_pointer(level2_kernel_pgt, physaddr);
228− for (i = 0; i < PTRS_PER_PMD; i++) {
237+
238+ /* invalidate pages before the kernel image */
239+ for (i = 0; i < pmd_index((unsigned long)_text); i++)
240+ pmd[i] &= ~_PAGE_PRESENT;
241+
242+ /* fixup pages that are part of the kernel image */
243+ for (; i <= pmd_index((unsigned long)_end); i++)
229244 if (pmd[i] & _PAGE_PRESENT)
230245 pmd[i] += load_delta;
231− }
246+
247+ /* invalidate pages after the kernel image */
248+ for (; i < PTRS_PER_PMD; i++)
249+ pmd[i] &= ~_PAGE_PRESENT;
232250
233251 /*
234252 * Fixup phys_base - remove the memory encryption mask to obtain
arch/x86/kvm/cpuid.c+1−1
@@ -363,7 +363,7 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index) · 362 unmodified lines
363363
364364 /* cpuid 7.0.ecx*/
365365 const u32 kvm_cpuid_7_0_ecx_x86_features =
366− F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ |
366+ F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) |
367367 F(AVX512_VPOPCNTDQ) | F(UMIP) | F(AVX512_VBMI2) | F(GFNI) |
368368 F(VAES) | F(VPCLMULQDQ) | F(AVX512_VNNI) | F(AVX512_BITALG) |
369369 F(CLDEMOTE) | F(MOVDIRI) | F(MOVDIR64B) | 0 /*WAITPKG*/;
arch/x86/kvm/lapic.c+0−5
@@ -111,11 +111,6 @@ static inline int apic_enabled(struct kvm_lapic *apic) · 110 unmodified lines
111111 (LVT_MASK | APIC_MODE_MASK | APIC_INPUT_POLARITY | \
112112 APIC_LVT_REMOTE_IRR | APIC_LVT_LEVEL_TRIGGER)
113113
114−static inline u8 kvm_xapic_id(struct kvm_lapic *apic)
115−{
116− return kvm_lapic_get_reg(apic, APIC_ID) >> 24;
117−}
118−
119114 static inline u32 kvm_x2apic_id(struct kvm_lapic *apic)
120115 {
121116 return apic->vcpu->vcpu_id;
arch/x86/kvm/lapic.h+5−0
@@ -242,4 +242,9 @@ static inline enum lapic_mode kvm_apic_mode(u64 apic_base) · 241 unmodified lines
242242 return apic_base & (MSR_IA32_APICBASE_ENABLE | X2APIC_ENABLE);
243243 }
244244
245+static inline u8 kvm_xapic_id(struct kvm_lapic *apic)
246+{
247+ return kvm_lapic_get_reg(apic, APIC_ID) >> 24;
248+}
249+
245250 #endif
arch/x86/kvm/svm.c+3−3
@@ -4591,6 +4591,7 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu) · 4590 unmodified lines
45914591 int ret = 0;
45924592 struct vcpu_svm *svm = to_svm(vcpu);
45934593 u32 ldr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_LDR);
4594+ u32 id = kvm_xapic_id(vcpu->arch.apic);
45944595
45954596 if (ldr == svm->ldr_reg)
45964597 return 0;
@@ -4598,7 +4599,7 @@ static int avic_handle_ldr_update(struct kvm_vcpu *vcpu) · 1 unmodified line
45984599 avic_invalidate_logical_id_entry(vcpu);
45994600
46004601 if (ldr)
4601− ret = avic_ldr_write(vcpu, vcpu->vcpu_id, ldr);
4602+ ret = avic_ldr_write(vcpu, id, ldr);
46024603
46034604 if (!ret)
46044605 svm->ldr_reg = ldr;
@@ -4610,8 +4611,7 @@ static int avic_handle_apic_id_update(struct kvm_vcpu *vcpu) · 5 unmodified lines
46104611 {
46114612 u64 *old, *new;
46124613 struct vcpu_svm *svm = to_svm(vcpu);
4613− u32 apic_id_reg = kvm_lapic_get_reg(vcpu->arch.apic, APIC_ID);
4614− u32 id = (apic_id_reg >> 24) & 0xff;
4614+ u32 id = kvm_xapic_id(vcpu->arch.apic);
46154615
46164616 if (vcpu->vcpu_id == id)
46174617 return 0;
arch/x86/kvm/vmx/nested.c+36−28
@@ -2917,7 +2917,7 @@ static int nested_vmx_check_vmentry_hw(struct kvm_vcpu *vcpu) · 2916 unmodified lines
29172917 static inline bool nested_vmx_prepare_msr_bitmap(struct kvm_vcpu *vcpu,
29182918 struct vmcs12 *vmcs12);
29192919
2920−static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
2920+static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu)
29212921 {
29222922 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
29232923 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -2937,19 +2937,18 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) · 13 unmodified lines
29372937 vmx->nested.apic_access_page = NULL;
29382938 }
29392939 page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->apic_access_addr);
2940− /*
2941− * If translation failed, no matter: This feature asks
2942− * to exit when accessing the given address, and if it
2943− * can never be accessed, this feature won't do
2944− * anything anyway.
2945− */
29462940 if (!is_error_page(page)) {
29472941 vmx->nested.apic_access_page = page;
29482942 hpa = page_to_phys(vmx->nested.apic_access_page);
29492943 vmcs_write64(APIC_ACCESS_ADDR, hpa);
29502944 } else {
2951− secondary_exec_controls_clearbit(vmx,
2952− SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES);
2945+ pr_debug_ratelimited("%s: no backing 'struct page' for APIC-access address in vmcs12\n",
2946+ __func__);
2947+ vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
2948+ vcpu->run->internal.suberror =
2949+ KVM_INTERNAL_ERROR_EMULATION;
2950+ vcpu->run->internal.ndata = 0;
2951+ return false;
29532952 }
29542953 }
29552954
@@ -2994,6 +2993,7 @@ static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) · 38 unmodified lines
29942993 exec_controls_setbit(vmx, CPU_BASED_USE_MSR_BITMAPS);
29952994 else
29962995 exec_controls_clearbit(vmx, CPU_BASED_USE_MSR_BITMAPS);
2996+ return true;
29972997 }
29982998
29992999 /*
@@ -3032,13 +3032,15 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, · 32 unmodified lines
30323032 /*
30333033 * If from_vmentry is false, this is being called from state restore (either RSM
30343034 * or KVM_SET_NESTED_STATE). Otherwise it's called from vmlaunch/vmresume.
3035−+ *
3036−+ * Returns:
3037−+ * 0 - success, i.e. proceed with actual VMEnter
3038−+ * 1 - consistency check VMExit
3039−+ * -1 - consistency check VMFail
3035+ *
3036+ * Returns:
3037+ * NVMX_ENTRY_SUCCESS: Entered VMX non-root mode
3038+ * NVMX_ENTRY_VMFAIL: Consistency check VMFail
3039+ * NVMX_ENTRY_VMEXIT: Consistency check VMExit
3040+ * NVMX_ENTRY_KVM_INTERNAL_ERROR: KVM internal error
30403041 */
3041−int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry)
3042+enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,
3043+ bool from_vmentry)
30423044 {
30433045 struct vcpu_vmx *vmx = to_vmx(vcpu);
30443046 struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
@@ -3081,11 +3083,12 @@ int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) · 36 unmodified lines
30813083 prepare_vmcs02_early(vmx, vmcs12);
30823084
30833085 if (from_vmentry) {
3084− nested_get_vmcs12_pages(vcpu);
3086+ if (unlikely(!nested_get_vmcs12_pages(vcpu)))
3087+ return NVMX_VMENTRY_KVM_INTERNAL_ERROR;
30853088
30863089 if (nested_vmx_check_vmentry_hw(vcpu)) {
30873090 vmx_switch_vmcs(vcpu, &vmx->vmcs01);
3088− return -1;
3091+ return NVMX_VMENTRY_VMFAIL;
30893092 }
30903093
30913094 if (nested_vmx_check_guest_state(vcpu, vmcs12, &exit_qual))
@@ -3149,7 +3152,7 @@ int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry) · 57 unmodified lines
31493152 * returned as far as L1 is concerned. It will only return (and set
31503153 * the success flag) when L2 exits (see nested_vmx_vmexit()).
31513154 */
3152− return 0;
3155+ return NVMX_VMENTRY_SUCCESS;
31533156
31543157 /*
31553158 * A failed consistency check that leads to a VMExit during L1's
@@ -3165,14 +3168,14 @@ vmentry_fail_vmexit: · 9 unmodified lines
31653168 vmx_switch_vmcs(vcpu, &vmx->vmcs01);
31663169
31673170 if (!from_vmentry)
3168− return 1;
3171+ return NVMX_VMENTRY_VMEXIT;
31693172
31703173 load_vmcs12_host_state(vcpu, vmcs12);
31713174 vmcs12->vm_exit_reason = exit_reason | VMX_EXIT_REASONS_FAILED_VMENTRY;
31723175 vmcs12->exit_qualification = exit_qual;
31733176 if (enable_shadow_vmcs || vmx->nested.hv_evmcs)
31743177 vmx->nested.need_vmcs12_to_shadow_sync = true;
3175− return 1;
3178+ return NVMX_VMENTRY_VMEXIT;
31763179 }
31773180
31783181 /*
@@ -3182,9 +3185,9 @@ vmentry_fail_vmexit: · 3 unmodified lines
31823185 static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
31833186 {
31843187 struct vmcs12 *vmcs12;
3188+ enum nvmx_vmentry_status status;
31853189 struct vcpu_vmx *vmx = to_vmx(vcpu);
31863190 u32 interrupt_shadow = vmx_get_interrupt_shadow(vcpu);
3187− int ret;
31883191
31893192 if (!nested_vmx_check_permission(vcpu))
31903193 return 1;
@@ -3244,13 +3247,9 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) · 53 unmodified lines
32443247 * the nested entry.
32453248 */
32463249 vmx->nested.nested_run_pending = 1;
3247− ret = nested_vmx_enter_non_root_mode(vcpu, true);
3248− vmx->nested.nested_run_pending = !ret;
3249− if (ret > 0)
3250− return 1;
3251− else if (ret)
3252− return nested_vmx_failValid(vcpu,
3253− VMXERR_ENTRY_INVALID_CONTROL_FIELD);
3250+ status = nested_vmx_enter_non_root_mode(vcpu, true);
3251+ if (unlikely(status != NVMX_VMENTRY_SUCCESS))
3252+ goto vmentry_failed;
32543253
32553254 /* Hide L1D cache contents from the nested guest. */
32563255 vmx->vcpu.arch.l1tf_flush_l1d = true;
@@ -3281,6 +3280,15 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) · 24 unmodified lines
32813280 return kvm_vcpu_halt(vcpu);
32823281 }
32833282 return 1;
3283+
3284+vmentry_failed:
3285+ vmx->nested.nested_run_pending = 0;
3286+ if (status == NVMX_VMENTRY_KVM_INTERNAL_ERROR)
3287+ return 0;
3288+ if (status == NVMX_VMENTRY_VMEXIT)
3289+ return 1;
3290+ WARN_ON_ONCE(status != NVMX_VMENTRY_VMFAIL);
3291+ return nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD);
32843292 }
32853293
32863294 /*
arch/x86/kvm/vmx/nested.h+12−1
@@ -6,6 +6,16 @@ · 5 unmodified lines
66 #include "vmcs12.h"
77 #include "vmx.h"
88
9+/*
10+ * Status returned by nested_vmx_enter_non_root_mode():
11+ */
12+enum nvmx_vmentry_status {
13+ NVMX_VMENTRY_SUCCESS, /* Entered VMX non-root mode */
14+ NVMX_VMENTRY_VMFAIL, /* Consistency check VMFail */
15+ NVMX_VMENTRY_VMEXIT, /* Consistency check VMExit */
16+ NVMX_VMENTRY_KVM_INTERNAL_ERROR,/* KVM internal error */
17+};
18+
919 void vmx_leave_nested(struct kvm_vcpu *vcpu);
1020 void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps,
1121 bool apicv);
@@ -13,7 +23,8 @@ void nested_vmx_hardware_unsetup(void); · 1 unmodified line
1323 __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcpu *));
1424 void nested_vmx_vcpu_setup(void);
1525 void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu);
16−int nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu, bool from_vmentry);
26+enum nvmx_vmentry_status nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,
27+ bool from_vmentry);
1728 bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason);
1829 void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
1930 u32 exit_intr_info, unsigned long exit_qualification);
arch/x86/kvm/vmx/vmx.c+0−12
@@ -5543,14 +5543,6 @@ static int handle_encls(struct kvm_vcpu *vcpu) · 5542 unmodified lines
55435543 return 1;
55445544 }
55455545
5546−static int handle_unexpected_vmexit(struct kvm_vcpu *vcpu)
5547−{
5548− kvm_skip_emulated_instruction(vcpu);
5549− WARN_ONCE(1, "Unexpected VM-Exit Reason = 0x%x",
5550− vmcs_read32(VM_EXIT_REASON));
5551− return 1;
5552−}
5553−
55545546 /*
55555547 * The exit handlers return 1 if the exit was handled fully and guest execution
55565548 * may resume. Otherwise they set the kvm_run parameter to indicate what needs
@@ -5602,15 +5594,11 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { · 45 unmodified lines
56025594 [EXIT_REASON_INVVPID] = handle_vmx_instruction,
56035595 [EXIT_REASON_RDRAND] = handle_invalid_op,
56045596 [EXIT_REASON_RDSEED] = handle_invalid_op,
5605− [EXIT_REASON_XSAVES] = handle_unexpected_vmexit,
5606− [EXIT_REASON_XRSTORS] = handle_unexpected_vmexit,
56075597 [EXIT_REASON_PML_FULL] = handle_pml_full,
56085598 [EXIT_REASON_INVPCID] = handle_invpcid,
56095599 [EXIT_REASON_VMFUNC] = handle_vmx_instruction,
56105600 [EXIT_REASON_PREEMPTION_TIMER] = handle_preemption_timer,
56115601 [EXIT_REASON_ENCLS] = handle_encls,
5612− [EXIT_REASON_UMWAIT] = handle_unexpected_vmexit,
5613− [EXIT_REASON_TPAUSE] = handle_unexpected_vmexit,
56145602 };
56155603
56165604 static const int kvm_vmx_max_exit_handlers =
arch/x86/kvm/x86.c+10−9
@@ -360,8 +360,7 @@ EXPORT_SYMBOL_GPL(kvm_set_apic_base); · 359 unmodified lines
360360 asmlinkage __visible void kvm_spurious_fault(void)
361361 {
362362 /* Fault while not rebooting. We want the trace. */
363− if (!kvm_rebooting)
364− BUG();
363+ BUG_ON(!kvm_rebooting);
365364 }
366365 EXPORT_SYMBOL_GPL(kvm_spurious_fault);
367366
@@ -2537,6 +2536,7 @@ static int kvm_pv_enable_async_pf(struct kvm_vcpu *vcpu, u64 data) · 2169 unmodified lines
25372536 static void kvmclock_reset(struct kvm_vcpu *vcpu)
25382537 {
25392538 vcpu->arch.pv_time_enabled = false;
2539+ vcpu->arch.time = 0;
25402540 }
25412541
25422542 static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa)
@@ -2702,8 +2702,6 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 159 unmodified lines
27022702 case MSR_KVM_SYSTEM_TIME: {
27032703 struct kvm_arch *ka = &vcpu->kvm->arch;
27042704
2705− kvmclock_reset(vcpu);
2706−
27072705 if (vcpu->vcpu_id == 0 && !msr_info->host_initiated) {
27082706 bool tmp = (msr == MSR_KVM_SYSTEM_TIME);
27092707
@@ -2717,14 +2715,13 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 7 unmodified lines
27172715 kvm_make_request(KVM_REQ_GLOBAL_CLOCK_UPDATE, vcpu);
27182716
27192717 /* we verify if the enable bit is set... */
2718+ vcpu->arch.pv_time_enabled = false;
27202719 if (!(data & 1))
27212720 break;
27222721
2723− if (kvm_gfn_to_hva_cache_init(vcpu->kvm,
2722+ if (!kvm_gfn_to_hva_cache_init(vcpu->kvm,
27242723 &vcpu->arch.pv_time, data & ~1ULL,
27252724 sizeof(struct pvclock_vcpu_time_info)))
2726− vcpu->arch.pv_time_enabled = false;
2727− else
27282725 vcpu->arch.pv_time_enabled = true;
27292726
27302727 break;
@@ -7941,8 +7938,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 5210 unmodified lines
79417938 bool req_immediate_exit = false;
79427939
79437940 if (kvm_request_pending(vcpu)) {
7944− if (kvm_check_request(KVM_REQ_GET_VMCS12_PAGES, vcpu))
7945− kvm_x86_ops->get_vmcs12_pages(vcpu);
7941+ if (kvm_check_request(KVM_REQ_GET_VMCS12_PAGES, vcpu)) {
7942+ if (unlikely(!kvm_x86_ops->get_vmcs12_pages(vcpu))) {
7943+ r = 0;
7944+ goto out;
7945+ }
7946+ }
79467947 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
79477948 kvm_mmu_unload(vcpu);
79487949 if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu))
arch/x86/xen/enlighten_pv.c+8−0
@@ -117,6 +117,14 @@ static void __init xen_banner(void) · 116 unmodified lines
117117 printk(KERN_INFO "Xen version: %d.%d%s%s\n",
118118 version >> 16, version & 0xffff, extra.extraversion,
119119 xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : "");
120+
121+#ifdef CONFIG_X86_32
122+ pr_warn("WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!\n"
123+ "Support for running as 32-bit PV-guest under Xen will soon be removed\n"
124+ "from the Linux kernel!\n"
125+ "Please use either a 64-bit kernel or switch to HVM or PVH mode!\n"
126+ "WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!\n");
127+#endif
120128 }
121129
122130 static void __init xen_pv_init_platform(void)
arch/xtensa/boot/dts/virt.dts+1−1
@@ -56,7 +56,7 @@ · 55 unmodified lines
5656 reg = <0xf0100000 0x03f00000>;
5757
5858 // BUS_ADDRESS(3) CPU_PHYSICAL(1) SIZE(2)
59− ranges = <0x01000000 0x0 0xf0000000 0xf0000000 0x0 0x00010000>,
59+ ranges = <0x01000000 0x0 0x00000000 0xf0000000 0x0 0x00010000>,
6060 <0x02000000 0x0 0xf4000000 0xf4000000 0x0 0x08000000>;
6161
6262 // PCI_DEVICE(3) INT#(1) CONTROLLER(PHANDLE) CONTROLLER_DATA(2)
arch/xtensa/include/asm/bitops.h+1−1
@@ -148,7 +148,7 @@ static inline void change_bit(unsigned int bit, volatile unsigned long *p) · 147 unmodified lines
148148 " getex %0\n"
149149 " beqz %0, 1b\n"
150150 : "=&a" (tmp)
151− : "a" (~mask), "a" (p)
151+ : "a" (mask), "a" (p)
152152 : "memory");
153153 }
154154
arch/xtensa/include/asm/uaccess.h+53−41
@@ -100,7 +100,7 @@ do { \ · 99 unmodified lines
100100 case 4: __put_user_asm(x, ptr, retval, 4, "s32i", __cb); break; \
101101 case 8: { \
102102 __typeof__(*ptr) __v64 = x; \
103− retval = __copy_to_user(ptr, &__v64, 8); \
103+ retval = __copy_to_user(ptr, &__v64, 8) ? -EFAULT : 0; \
104104 break; \
105105 } \
106106 default: __put_user_bad(); \
@@ -132,14 +132,14 @@ do { \ · 25 unmodified lines
132132 #define __check_align_1 ""
133133
134134 #define __check_align_2 \
135− " _bbci.l %3, 0, 1f \n" \
136− " movi %0, %4 \n" \
135+ " _bbci.l %[addr], 0, 1f \n" \
136+ " movi %[err], %[efault] \n" \
137137 " _j 2f \n"
138138
139139 #define __check_align_4 \
140− " _bbsi.l %3, 0, 0f \n" \
141− " _bbci.l %3, 1, 1f \n" \
142− "0: movi %0, %4 \n" \
140+ " _bbsi.l %[addr], 0, 0f \n" \
141+ " _bbci.l %[addr], 1, 1f \n" \
142+ "0: movi %[err], %[efault] \n" \
143143 " _j 2f \n"
144144
145145
@@ -151,40 +151,40 @@ do { \ · 5 unmodified lines
151151 * WARNING: If you modify this macro at all, verify that the
152152 * __check_align_* macros still work.
153153 */
154−#define __put_user_asm(x, addr, err, align, insn, cb) \
154+#define __put_user_asm(x_, addr_, err_, align, insn, cb)\
155155 __asm__ __volatile__( \
156156 __check_align_##align \
157− "1: "insn" %2, %3, 0 \n" \
157+ "1: "insn" %[x], %[addr], 0 \n" \
158158 "2: \n" \
159159 " .section .fixup,\"ax\" \n" \
160160 " .align 4 \n" \
161161 " .literal_position \n" \
162162 "5: \n" \
163− " movi %1, 2b \n" \
164− " movi %0, %4 \n" \
165− " jx %1 \n" \
163+ " movi %[tmp], 2b \n" \
164+ " movi %[err], %[efault] \n" \
165+ " jx %[tmp] \n" \
166166 " .previous \n" \
167167 " .section __ex_table,\"a\" \n" \
168168 " .long 1b, 5b \n" \
169169 " .previous" \
170− :"=r" (err), "=r" (cb) \
171− :"r" ((int)(x)), "r" (addr), "i" (-EFAULT), "0" (err))
170+ :[err] "+r"(err_), [tmp] "=r"(cb) \
171+ :[x] "r"(x_), [addr] "r"(addr_), [efault] "i"(-EFAULT))
172172
173173 #define __get_user_nocheck(x, ptr, size) \
174174 ({ \
175− long __gu_err, __gu_val; \
176− __get_user_size(__gu_val, (ptr), (size), __gu_err); \
177− (x) = (__force __typeof__(*(ptr)))__gu_val; \
175+ long __gu_err; \
176+ __get_user_size((x), (ptr), (size), __gu_err); \
178177 __gu_err; \
179178 })
180179
181180 #define __get_user_check(x, ptr, size) \
182181 ({ \
183− long __gu_err = -EFAULT, __gu_val = 0; \
182+ long __gu_err = -EFAULT; \
184183 const __typeof__(*(ptr)) *__gu_addr = (ptr); \
185− if (access_ok(__gu_addr, size)) \
186− __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
187− (x) = (__force __typeof__(*(ptr)))__gu_val; \
184+ if (access_ok(__gu_addr, size)) \
185+ __get_user_size((x), __gu_addr, (size), __gu_err); \
186+ else \
187+ (x) = 0; \
188188 __gu_err; \
189189 })
190190
@@ -198,8 +198,17 @@ do { \ · 7 unmodified lines
198198 case 1: __get_user_asm(x, ptr, retval, 1, "l8ui", __cb); break;\
199199 case 2: __get_user_asm(x, ptr, retval, 2, "l16ui", __cb); break;\
200200 case 4: __get_user_asm(x, ptr, retval, 4, "l32i", __cb); break;\
201− case 8: retval = __copy_from_user(&x, ptr, 8); break; \
202− default: (x) = __get_user_bad(); \
201+ case 8: { \
202+ u64 __x; \
203+ if (unlikely(__copy_from_user(&__x, ptr, 8))) { \
204+ retval = -EFAULT; \
205+ (x) = 0; \
206+ } else { \
207+ (x) = *(__force __typeof__((ptr)))&__x; \
208+ } \
209+ break; \
210+ } \
211+ default: (x) = 0; __get_user_bad(); \
203212 } \
204213 } while (0)
205214
@@ -208,25 +217,28 @@ do { \ · 2 unmodified lines
208217 * WARNING: If you modify this macro at all, verify that the
209218 * __check_align_* macros still work.
210219 */
211−#define __get_user_asm(x, addr, err, align, insn, cb) \
212−__asm__ __volatile__( \
213− __check_align_##align \
214− "1: "insn" %2, %3, 0 \n" \
215− "2: \n" \
216− " .section .fixup,\"ax\" \n" \
217− " .align 4 \n" \
218− " .literal_position \n" \
219− "5: \n" \
220− " movi %1, 2b \n" \
221− " movi %2, 0 \n" \
222− " movi %0, %4 \n" \
223− " jx %1 \n" \
224− " .previous \n" \
225− " .section __ex_table,\"a\" \n" \
226− " .long 1b, 5b \n" \
227− " .previous" \
228− :"=r" (err), "=r" (cb), "=r" (x) \
229− :"r" (addr), "i" (-EFAULT), "0" (err))
220+#define __get_user_asm(x_, addr_, err_, align, insn, cb) \
221+do { \
222+ u32 __x = 0; \
223+ __asm__ __volatile__( \
224+ __check_align_##align \
225+ "1: "insn" %[x], %[addr], 0 \n" \
226+ "2: \n" \
227+ " .section .fixup,\"ax\" \n" \
228+ " .align 4 \n" \
229+ " .literal_position \n" \
230+ "5: \n" \
231+ " movi %[tmp], 2b \n" \
232+ " movi %[err], %[efault] \n" \
233+ " jx %[tmp] \n" \
234+ " .previous \n" \
235+ " .section __ex_table,\"a\" \n" \
236+ " .long 1b, 5b \n" \
237+ " .previous" \
238+ :[err] "+r"(err_), [tmp] "=r"(cb), [x] "+r"(__x) \
239+ :[addr] "r"(addr_), [efault] "i"(-EFAULT)); \
240+ (x_) = (__force __typeof__(*(addr_)))__x; \
241+} while (0)
230242
231243
232244 /*
arch/xtensa/kernel/xtensa_ksyms.c+0−7
@@ -119,13 +119,6 @@ EXPORT_SYMBOL(__invalidate_icache_range); · 118 unmodified lines
119119 // FIXME EXPORT_SYMBOL(screen_info);
120120 #endif
121121
122−EXPORT_SYMBOL(outsb);
123−EXPORT_SYMBOL(outsw);
124−EXPORT_SYMBOL(outsl);
125−EXPORT_SYMBOL(insb);
126−EXPORT_SYMBOL(insw);
127−EXPORT_SYMBOL(insl);
128−
129122 extern long common_exception_return;
130123 EXPORT_SYMBOL(common_exception_return);
131124
block/blk-cgroup.c+51−18
@@ -1362,7 +1362,7 @@ int blkcg_activate_policy(struct request_queue *q, · 1361 unmodified lines
13621362 const struct blkcg_policy *pol)
13631363 {
13641364 struct blkg_policy_data *pd_prealloc = NULL;
1365− struct blkcg_gq *blkg;
1365+ struct blkcg_gq *blkg, *pinned_blkg = NULL;
13661366 int ret;
13671367
13681368 if (blkcg_policy_enabled(q, pol))
@@ -1370,49 +1370,82 @@ int blkcg_activate_policy(struct request_queue *q, · 1 unmodified line
13701370
13711371 if (queue_is_mq(q))
13721372 blk_mq_freeze_queue(q);
1373−pd_prealloc:
1374− if (!pd_prealloc) {
1375− pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q, &blkcg_root);
1376− if (!pd_prealloc) {
1377− ret = -ENOMEM;
1378− goto out_bypass_end;
1379− }
1380− }
1381−
1373+retry:
13821374 spin_lock_irq(&q->queue_lock);
13831375
1384− /* blkg_list is pushed at the head, reverse walk to init parents first */
1376+ /* blkg_list is pushed at the head, reverse walk to allocate parents first */
13851377 list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) {
13861378 struct blkg_policy_data *pd;
13871379
13881380 if (blkg->pd[pol->plid])
13891381 continue;
13901382
1391− pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q, &blkcg_root);
1392− if (!pd)
1393− swap(pd, pd_prealloc);
1383+ /* If prealloc matches, use it; otherwise try GFP_NOWAIT */
1384+ if (blkg == pinned_blkg) {
1385+ pd = pd_prealloc;
1386+ pd_prealloc = NULL;
1387+ } else {
1388+ pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q,
1389+ blkg->blkcg);
1390+ }
1391+
13941392 if (!pd) {
1393+ /*
1394+ * GFP_NOWAIT failed. Free the existing one and
1395+ * prealloc for @blkg w/ GFP_KERNEL.
1396+ */
1397+ if (pinned_blkg)
1398+ blkg_put(pinned_blkg);
1399+ blkg_get(blkg);
1400+ pinned_blkg = blkg;
1401+
13951402 spin_unlock_irq(&q->queue_lock);
1396− goto pd_prealloc;
1403+
1404+ if (pd_prealloc)
1405+ pol->pd_free_fn(pd_prealloc);
1406+ pd_prealloc = pol->pd_alloc_fn(GFP_KERNEL, q,
1407+ blkg->blkcg);
1408+ if (pd_prealloc)
1409+ goto retry;
1410+ else
1411+ goto enomem;
13971412 }
13981413
13991414 blkg->pd[pol->plid] = pd;
14001415 pd->blkg = blkg;
14011416 pd->plid = pol->plid;
1402− if (pol->pd_init_fn)
1403− pol->pd_init_fn(pd);
14041417 }
14051418
1419+ /* all allocated, init in the same order */
1420+ if (pol->pd_init_fn)
1421+ list_for_each_entry_reverse(blkg, &q->blkg_list, q_node)
1422+ pol->pd_init_fn(blkg->pd[pol->plid]);
1423+
14061424 __set_bit(pol->plid, q->blkcg_pols);
14071425 ret = 0;
14081426
14091427 spin_unlock_irq(&q->queue_lock);
1410−out_bypass_end:
1428+out:
14111429 if (queue_is_mq(q))
14121430 blk_mq_unfreeze_queue(q);
1431+ if (pinned_blkg)
1432+ blkg_put(pinned_blkg);
14131433 if (pd_prealloc)
14141434 pol->pd_free_fn(pd_prealloc);
14151435 return ret;
1436+
1437+enomem:
1438+ /* alloc failed, nothing's initialized yet, free everything */
1439+ spin_lock_irq(&q->queue_lock);
1440+ list_for_each_entry(blkg, &q->blkg_list, q_node) {
1441+ if (blkg->pd[pol->plid]) {
1442+ pol->pd_free_fn(blkg->pd[pol->plid]);
1443+ blkg->pd[pol->plid] = NULL;
1444+ }
1445+ }
1446+ spin_unlock_irq(&q->queue_lock);
1447+ ret = -ENOMEM;
1448+ goto out;
14161449 }
14171450 EXPORT_SYMBOL_GPL(blkcg_activate_policy);
14181451
block/blk-rq-qos.h+5−8
@@ -108,16 +108,13 @@ static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) · 107 unmodified lines
108108
109109 static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos)
110110 {
111− struct rq_qos *cur, *prev = NULL;
112− for (cur = q->rq_qos; cur; cur = cur->next) {
113− if (cur == rqos) {
114− if (prev)
115− prev->next = rqos->next;
116− else
117− q->rq_qos = cur;
111+ struct rq_qos **cur;
112+
113+ for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
114+ if (*cur == rqos) {
115+ *cur = rqos->next;
118116 break;
119117 }
120− prev = cur;
121118 }
122119
123120 blk_mq_debugfs_unregister_rqos(rqos);
block/elevator.c+2−1
@@ -616,7 +616,8 @@ out: · 615 unmodified lines
616616
617617 static inline bool elv_support_iosched(struct request_queue *q)
618618 {
619− if (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED))
619+ if (!q->mq_ops ||
620+ (q->tag_set && (q->tag_set->flags & BLK_MQ_F_NO_SCHED)))
620621 return false;
621622 return true;
622623 }
drivers/acpi/cppc_acpi.c+1−1
@@ -905,8 +905,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr) · 904 unmodified lines
905905 pcc_data[pcc_ss_id]->refcount--;
906906 if (!pcc_data[pcc_ss_id]->refcount) {
907907 pcc_mbox_free_channel(pcc_data[pcc_ss_id]->pcc_channel);
908− pcc_data[pcc_ss_id]->pcc_channel_acquired = 0;
909908 kfree(pcc_data[pcc_ss_id]);
909+ pcc_data[pcc_ss_id] = NULL;
910910 }
911911 }
912912 }
drivers/acpi/hmat/hmat.c+1−1
@@ -403,7 +403,7 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade · 402 unmodified lines
403403 pr_info("HMAT: Memory Flags:%04x Processor Domain:%d Memory Domain:%d\n",
404404 p->flags, p->processor_PD, p->memory_PD);
405405
406− if (p->flags & ACPI_HMAT_MEMORY_PD_VALID) {
406+ if (p->flags & ACPI_HMAT_MEMORY_PD_VALID && hmat_revision == 1) {
407407 target = find_mem_target(p->memory_PD);
408408 if (!target) {
409409 pr_debug("HMAT: Memory Domain missing from SRAT\n");
drivers/acpi/nfit/core.c+1−1
@@ -1322,7 +1322,7 @@ static ssize_t scrub_show(struct device *dev, · 1321 unmodified lines
13221322 nfit_device_lock(dev);
13231323 nd_desc = dev_get_drvdata(dev);
13241324 if (!nd_desc) {
1325− device_unlock(dev);
1325+ nfit_device_unlock(dev);
13261326 return rc;
13271327 }
13281328 acpi_desc = to_acpi_desc(nd_desc);
drivers/acpi/processor_driver.c+4−5
@@ -290,14 +290,13 @@ static int acpi_processor_notifier(struct notifier_block *nb, · 289 unmodified lines
290290 unsigned long event, void *data)
291291 {
292292 struct cpufreq_policy *policy = data;
293− int cpu = policy->cpu;
294293
295294 if (event == CPUFREQ_CREATE_POLICY) {
296− acpi_thermal_cpufreq_init(cpu);
297− acpi_processor_ppc_init(cpu);
295+ acpi_thermal_cpufreq_init(policy);
296+ acpi_processor_ppc_init(policy);
298297 } else if (event == CPUFREQ_REMOVE_POLICY) {
299− acpi_processor_ppc_exit(cpu);
300− acpi_thermal_cpufreq_exit(cpu);
298+ acpi_processor_ppc_exit(policy);
299+ acpi_thermal_cpufreq_exit(policy);
301300 }
302301
303302 return 0;
drivers/acpi/processor_perflib.c+14−12
@@ -81,10 +81,10 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) · 80 unmodified lines
8181 pr->performance_platform_limit = (int)ppc;
8282
8383 if (ppc >= pr->performance->state_count ||
84− unlikely(!dev_pm_qos_request_active(&pr->perflib_req)))
84+ unlikely(!freq_qos_request_active(&pr->perflib_req)))
8585 return 0;
8686
87− ret = dev_pm_qos_update_request(&pr->perflib_req,
87+ ret = freq_qos_update_request(&pr->perflib_req,
8888 pr->performance->states[ppc].core_frequency * 1000);
8989 if (ret < 0) {
9090 pr_warn("Failed to update perflib freq constraint: CPU%d (%d)\n",
@@ -157,26 +157,28 @@ void acpi_processor_ignore_ppc_init(void) · 66 unmodified lines
157157 ignore_ppc = 0;
158158 }
159159
160−void acpi_processor_ppc_init(int cpu)
160+void acpi_processor_ppc_init(struct cpufreq_policy *policy)
161161 {
162+ int cpu = policy->cpu;
162163 struct acpi_processor *pr = per_cpu(processors, cpu);
163164 int ret;
164165
165− ret = dev_pm_qos_add_request(get_cpu_device(cpu),
166− &pr->perflib_req, DEV_PM_QOS_MAX_FREQUENCY,
167− INT_MAX);
168− if (ret < 0) {
166+ if (!pr)
167+ return;
168+
169+ ret = freq_qos_add_request(&policy->constraints, &pr->perflib_req,
170+ FREQ_QOS_MAX, INT_MAX);
171+ if (ret < 0)
169172 pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
170173 ret);
171− return;
172− }
173174 }
174175
175−void acpi_processor_ppc_exit(int cpu)
176+void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
176177 {
177− struct acpi_processor *pr = per_cpu(processors, cpu);
178+ struct acpi_processor *pr = per_cpu(processors, policy->cpu);
178179
179− dev_pm_qos_remove_request(&pr->perflib_req);
180+ if (pr)
181+ freq_qos_remove_request(&pr->perflib_req);
180182 }
181183
182184 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
drivers/acpi/processor_thermal.c+14−12
@@ -105,7 +105,7 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 104 unmodified lines
105105
106106 pr = per_cpu(processors, i);
107107
108− if (unlikely(!dev_pm_qos_request_active(&pr->thermal_req)))
108+ if (unlikely(!freq_qos_request_active(&pr->thermal_req)))
109109 continue;
110110
111111 policy = cpufreq_cpu_get(i);
@@ -116,7 +116,7 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 4 unmodified lines
116116
117117 cpufreq_cpu_put(policy);
118118
119− ret = dev_pm_qos_update_request(&pr->thermal_req, max_freq);
119+ ret = freq_qos_update_request(&pr->thermal_req, max_freq);
120120 if (ret < 0) {
121121 pr_warn("Failed to update thermal freq constraint: CPU%d (%d)\n",
122122 pr->id, ret);
@@ -125,26 +125,28 @@ static int cpufreq_set_cur_state(unsigned int cpu, int state) · 2 unmodified lines
125125 return 0;
126126 }
127127
128−void acpi_thermal_cpufreq_init(int cpu)
128+void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
129129 {
130+ int cpu = policy->cpu;
130131 struct acpi_processor *pr = per_cpu(processors, cpu);
131132 int ret;
132133
133− ret = dev_pm_qos_add_request(get_cpu_device(cpu),
134− &pr->thermal_req, DEV_PM_QOS_MAX_FREQUENCY,
135− INT_MAX);
136− if (ret < 0) {
134+ if (!pr)
135+ return;
136+
137+ ret = freq_qos_add_request(&policy->constraints, &pr->thermal_req,
138+ FREQ_QOS_MAX, INT_MAX);
139+ if (ret < 0)
137140 pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
138141 ret);
139− return;
140− }
141142 }
142143
143−void acpi_thermal_cpufreq_exit(int cpu)
144+void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
144145 {
145− struct acpi_processor *pr = per_cpu(processors, cpu);
146+ struct acpi_processor *pr = per_cpu(processors, policy->cpu);
146147
147− dev_pm_qos_remove_request(&pr->thermal_req);
148+ if (pr)
149+ freq_qos_remove_request(&pr->thermal_req);
148150 }
149151 #else /* ! CONFIG_CPU_FREQ */
150152 static int cpufreq_get_max_state(unsigned int cpu)
drivers/acpi/sleep.c+0−13
@@ -361,19 +361,6 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { · 360 unmodified lines
361361 DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
362362 },
363363 },
364− /*
365− * https://bugzilla.kernel.org/show_bug.cgi?id=196907
366− * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power
367− * S0 Idle firmware interface.
368− */
369− {
370− .callback = init_default_s3,
371− .ident = "Dell XPS13 9360",
372− .matches = {
373− DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
374− DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"),
375− },
376− },
377364 /*
378365 * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using
379366 * the Low Power S0 Idle firmware interface (see
drivers/amba/bus.c+11−3
@@ -409,9 +409,11 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent) · 408 unmodified lines
409409 */
410410 rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node);
411411 if (IS_ERR(rstc)) {
412− if (PTR_ERR(rstc) != -EPROBE_DEFER)
413− dev_err(&dev->dev, "Can't get amba reset!\n");
414− return PTR_ERR(rstc);
412+ ret = PTR_ERR(rstc);
413+ if (ret != -EPROBE_DEFER)
414+ dev_err(&dev->dev, "can't get reset: %d\n",
415+ ret);
416+ goto err_reset;
415417 }
416418 reset_control_deassert(rstc);
417419 reset_control_put(rstc);
@@ -472,6 +474,12 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent) · 54 unmodified lines
472474 release_resource(&dev->res);
473475 err_out:
474476 return ret;
477+
478+ err_reset:
479+ amba_put_disable_pclk(dev);
480+ iounmap(tmp);
481+ dev_pm_domain_detach(&dev->dev, true);
482+ goto err_release;
475483 }
476484
477485 /*
drivers/android/binder.c+0−7
@@ -97,10 +97,6 @@ DEFINE_SHOW_ATTRIBUTE(proc); · 96 unmodified lines
9797 #define SZ_1K 0x400
9898 #endif
9999
100−#ifndef SZ_4M
101−#define SZ_4M 0x400000
102−#endif
103−
104100 #define FORBIDDEN_MMAP_FLAGS (VM_WRITE)
105101
106102 enum {
@@ -5177,9 +5173,6 @@ static int binder_mmap(struct file *filp, struct vm_area_struct *vma) · 5070 unmodified lines
51775173 if (proc->tsk != current->group_leader)
51785174 return -EINVAL;
51795175
5180− if ((vma->vm_end - vma->vm_start) > SZ_4M)
5181− vma->vm_end = vma->vm_start + SZ_4M;
5182−
51835176 binder_debug(BINDER_DEBUG_OPEN_CLOSE,
51845177 "%s: %d %lx-%lx (%ld K) vma %lx pagep %lx\n",
51855178 __func__, proc->pid, vma->vm_start, vma->vm_end,
drivers/android/binder_alloc.c+4−2
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <asm/cacheflush.h>
2323 #include <linux/uaccess.h>
2424 #include <linux/highmem.h>
25+#include <linux/sizes.h>
2526 #include "binder_alloc.h"
2627 #include "binder_trace.h"
2728
@@ -689,7 +690,9 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, · 661 unmodified lines
689690 alloc->buffer = (void __user *)vma->vm_start;
690691 mutex_unlock(&binder_alloc_mmap_lock);
691692
692− alloc->pages = kcalloc((vma->vm_end - vma->vm_start) / PAGE_SIZE,
693+ alloc->buffer_size = min_t(unsigned long, vma->vm_end - vma->vm_start,
694+ SZ_4M);
695+ alloc->pages = kcalloc(alloc->buffer_size / PAGE_SIZE,
693696 sizeof(alloc->pages[0]),
694697 GFP_KERNEL);
695698 if (alloc->pages == NULL) {
@@ -697,7 +700,6 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, · 1 unmodified line
697700 failure_string = "alloc page array";
698701 goto err_alloc_pages_failed;
699702 }
700− alloc->buffer_size = vma->vm_end - vma->vm_start;
701703
702704 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
703705 if (!buffer) {
drivers/ata/ahci.c+3−1
@@ -1600,7 +1600,9 @@ static void ahci_intel_pcs_quirk(struct pci_dev *pdev, struct ahci_host_priv *hp · 1599 unmodified lines
16001600 */
16011601 if (!id || id->vendor != PCI_VENDOR_ID_INTEL)
16021602 return;
1603− if (((enum board_ids) id->driver_data) < board_ahci_pcs7)
1603+
1604+ /* Skip applying the quirk on Denverton and beyond */
1605+ if (((enum board_ids) id->driver_data) >= board_ahci_pcs7)
16041606 return;
16051607
16061608 /*
drivers/ata/libahci_platform.c+14−24
@@ -153,17 +153,13 @@ int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv) · 152 unmodified lines
153153 {
154154 int rc, i;
155155
156− if (hpriv->ahci_regulator) {
157− rc = regulator_enable(hpriv->ahci_regulator);
158− if (rc)
159− return rc;
160− }
156+ rc = regulator_enable(hpriv->ahci_regulator);
157+ if (rc)
158+ return rc;
161159
162− if (hpriv->phy_regulator) {
163− rc = regulator_enable(hpriv->phy_regulator);
164− if (rc)
165− goto disable_ahci_pwrs;
166− }
160+ rc = regulator_enable(hpriv->phy_regulator);
161+ if (rc)
162+ goto disable_ahci_pwrs;
167163
168164 for (i = 0; i < hpriv->nports; i++) {
169165 if (!hpriv->target_pwrs[i])
@@ -181,11 +177,9 @@ disable_target_pwrs: · 11 unmodified lines
181177 if (hpriv->target_pwrs[i])
182178 regulator_disable(hpriv->target_pwrs[i]);
183179
184− if (hpriv->phy_regulator)
185− regulator_disable(hpriv->phy_regulator);
180+ regulator_disable(hpriv->phy_regulator);
186181 disable_ahci_pwrs:
187− if (hpriv->ahci_regulator)
188− regulator_disable(hpriv->ahci_regulator);
182+ regulator_disable(hpriv->ahci_regulator);
189183 return rc;
190184 }
191185 EXPORT_SYMBOL_GPL(ahci_platform_enable_regulators);
@@ -207,10 +201,8 @@ void ahci_platform_disable_regulators(struct ahci_host_priv *hpriv) · 15 unmodified lines
207201 regulator_disable(hpriv->target_pwrs[i]);
208202 }
209203
210− if (hpriv->ahci_regulator)
211− regulator_disable(hpriv->ahci_regulator);
212− if (hpriv->phy_regulator)
213− regulator_disable(hpriv->phy_regulator);
204+ regulator_disable(hpriv->ahci_regulator);
205+ regulator_disable(hpriv->phy_regulator);
214206 }
215207 EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators);
216208 /**
@@ -359,7 +351,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port, · 142 unmodified lines
359351 struct regulator *target_pwr;
360352 int rc = 0;
361353
362− target_pwr = regulator_get_optional(dev, "target");
354+ target_pwr = regulator_get(dev, "target");
363355
364356 if (!IS_ERR(target_pwr))
365357 hpriv->target_pwrs[port] = target_pwr;
@@ -436,16 +428,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, · 70 unmodified lines
436428 hpriv->clks[i] = clk;
437429 }
438430
439− hpriv->ahci_regulator = devm_regulator_get_optional(dev, "ahci");
431+ hpriv->ahci_regulator = devm_regulator_get(dev, "ahci");
440432 if (IS_ERR(hpriv->ahci_regulator)) {
441433 rc = PTR_ERR(hpriv->ahci_regulator);
442− if (rc == -EPROBE_DEFER)
434+ if (rc != 0)
443435 goto err_out;
444− rc = 0;
445− hpriv->ahci_regulator = NULL;
446436 }
447437
448− hpriv->phy_regulator = devm_regulator_get_optional(dev, "phy");
438+ hpriv->phy_regulator = devm_regulator_get(dev, "phy");
449439 if (IS_ERR(hpriv->phy_regulator)) {
450440 rc = PTR_ERR(hpriv->phy_regulator);
451441 if (rc == -EPROBE_DEFER)
drivers/base/core.c+3−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 */
1010
1111 #include <linux/acpi.h>
12+#include <linux/cpufreq.h>
1213 #include <linux/device.h>
1314 #include <linux/err.h>
1415 #include <linux/fwnode.h>
@@ -3179,6 +3180,8 @@ void device_shutdown(void) · 3164 unmodified lines
31793180 wait_for_device_probe();
31803181 device_block_probing();
31813182
3183+ cpufreq_suspend();
3184+
31823185 spin_lock(&devices_kset->list_lock);
31833186 /*
31843187 * Walk the devices list backward, shutting down each in turn.
drivers/base/memory.c+3−0
@@ -540,6 +540,9 @@ static ssize_t soft_offline_page_store(struct device *dev, · 539 unmodified lines
540540 pfn >>= PAGE_SHIFT;
541541 if (!pfn_valid(pfn))
542542 return -ENXIO;
543+ /* Only online pages can be soft-offlined (esp., not ZONE_DEVICE). */
544+ if (!pfn_to_online_page(pfn))
545+ return -EIO;
543546 ret = soft_offline_page(pfn_to_page(pfn), 0);
544547 return ret == 0 ? count : ret;
545548 }
drivers/base/power/qos.c+2−68
@@ -115,20 +115,10 @@ s32 dev_pm_qos_read_value(struct device *dev, enum dev_pm_qos_req_type type) · 114 unmodified lines
115115
116116 spin_lock_irqsave(&dev->power.lock, flags);
117117
118− switch (type) {
119− case DEV_PM_QOS_RESUME_LATENCY:
118+ if (type == DEV_PM_QOS_RESUME_LATENCY) {
120119 ret = IS_ERR_OR_NULL(qos) ? PM_QOS_RESUME_LATENCY_NO_CONSTRAINT
121120 : pm_qos_read_value(&qos->resume_latency);
122− break;
123− case DEV_PM_QOS_MIN_FREQUENCY:
124− ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE
125− : pm_qos_read_value(&qos->min_frequency);
126− break;
127− case DEV_PM_QOS_MAX_FREQUENCY:
128− ret = IS_ERR_OR_NULL(qos) ? PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE
129− : pm_qos_read_value(&qos->max_frequency);
130− break;
131− default:
121+ } else {
132122 WARN_ON(1);
133123 ret = 0;
134124 }
@@ -169,14 +159,6 @@ static int apply_constraint(struct dev_pm_qos_request *req, · 34 unmodified lines
169159 req->dev->power.set_latency_tolerance(req->dev, value);
170160 }
171161 break;
172− case DEV_PM_QOS_MIN_FREQUENCY:
173− ret = pm_qos_update_target(&qos->min_frequency,
174− &req->data.pnode, action, value);
175− break;
176− case DEV_PM_QOS_MAX_FREQUENCY:
177− ret = pm_qos_update_target(&qos->max_frequency,
178− &req->data.pnode, action, value);
179− break;
180162 case DEV_PM_QOS_FLAGS:
181163 ret = pm_qos_update_flags(&qos->flags, &req->data.flr,
182164 action, value);
@@ -227,24 +209,6 @@ static int dev_pm_qos_constraints_allocate(struct device *dev) · 44 unmodified lines
227209 c->no_constraint_value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
228210 c->type = PM_QOS_MIN;
229211
230− c = &qos->min_frequency;
231− plist_head_init(&c->list);
232− c->target_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
233− c->default_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
234− c->no_constraint_value = PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
235− c->type = PM_QOS_MAX;
236− c->notifiers = ++n;
237− BLOCKING_INIT_NOTIFIER_HEAD(n);
238−
239− c = &qos->max_frequency;
240− plist_head_init(&c->list);
241− c->target_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
242− c->default_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
243− c->no_constraint_value = PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
244− c->type = PM_QOS_MIN;
245− c->notifiers = ++n;
246− BLOCKING_INIT_NOTIFIER_HEAD(n);
247−
248212 INIT_LIST_HEAD(&qos->flags.list);
249213
250214 spin_lock_irq(&dev->power.lock);
@@ -305,18 +269,6 @@ void dev_pm_qos_constraints_destroy(struct device *dev) · 54 unmodified lines
305269 memset(req, 0, sizeof(*req));
306270 }
307271
308− c = &qos->min_frequency;
309− plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
310− apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE);
311− memset(req, 0, sizeof(*req));
312− }
313−
314− c = &qos->max_frequency;
315− plist_for_each_entry_safe(req, tmp, &c->list, data.pnode) {
316− apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE);
317− memset(req, 0, sizeof(*req));
318− }
319−
320272 f = &qos->flags;
321273 list_for_each_entry_safe(req, tmp, &f->list, data.flr.node) {
322274 apply_constraint(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
@@ -428,8 +380,6 @@ static int __dev_pm_qos_update_request(struct dev_pm_qos_request *req, · 105 unmodified lines
428380 switch(req->type) {
429381 case DEV_PM_QOS_RESUME_LATENCY:
430382 case DEV_PM_QOS_LATENCY_TOLERANCE:
431− case DEV_PM_QOS_MIN_FREQUENCY:
432− case DEV_PM_QOS_MAX_FREQUENCY:
433383 curr_value = req->data.pnode.prio;
434384 break;
435385 case DEV_PM_QOS_FLAGS:
@@ -557,14 +507,6 @@ int dev_pm_qos_add_notifier(struct device *dev, struct notifier_block *notifier, · 121 unmodified lines
557507 ret = blocking_notifier_chain_register(dev->power.qos->resume_latency.notifiers,
558508 notifier);
559509 break;
560− case DEV_PM_QOS_MIN_FREQUENCY:
561− ret = blocking_notifier_chain_register(dev->power.qos->min_frequency.notifiers,
562− notifier);
563− break;
564− case DEV_PM_QOS_MAX_FREQUENCY:
565− ret = blocking_notifier_chain_register(dev->power.qos->max_frequency.notifiers,
566− notifier);
567− break;
568510 default:
569511 WARN_ON(1);
570512 ret = -EINVAL;
@@ -604,14 +546,6 @@ int dev_pm_qos_remove_notifier(struct device *dev, · 33 unmodified lines
604546 ret = blocking_notifier_chain_unregister(dev->power.qos->resume_latency.notifiers,
605547 notifier);
606548 break;
607− case DEV_PM_QOS_MIN_FREQUENCY:
608− ret = blocking_notifier_chain_unregister(dev->power.qos->min_frequency.notifiers,
609− notifier);
610− break;
611− case DEV_PM_QOS_MAX_FREQUENCY:
612− ret = blocking_notifier_chain_unregister(dev->power.qos->max_frequency.notifiers,
613− notifier);
614− break;
615549 default:
616550 WARN_ON(1);
617551 ret = -EINVAL;
drivers/block/nbd.c+34−7
@@ -385,17 +385,16 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req, · 384 unmodified lines
385385 struct nbd_device *nbd = cmd->nbd;
386386 struct nbd_config *config;
387387
388+ if (!mutex_trylock(&cmd->lock))
389+ return BLK_EH_RESET_TIMER;
390+
388391 if (!refcount_inc_not_zero(&nbd->config_refs)) {
389392 cmd->status = BLK_STS_TIMEOUT;
393+ mutex_unlock(&cmd->lock);
390394 goto done;
391395 }
392396 config = nbd->config;
393397
394− if (!mutex_trylock(&cmd->lock)) {
395− nbd_config_put(nbd);
396− return BLK_EH_RESET_TIMER;
397− }
398−
399398 if (config->num_connections > 1) {
400399 dev_err_ratelimited(nbd_to_dev(nbd),
401400 "Connection timed out, retrying (%d/%d alive)\n",
@@ -711,6 +710,12 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index) · 309 unmodified lines
711710 ret = -ENOENT;
712711 goto out;
713712 }
713+ if (cmd->status != BLK_STS_OK) {
714+ dev_err(disk_to_dev(nbd->disk), "Command already handled %p\n",
715+ req);
716+ ret = -ENOENT;
717+ goto out;
718+ }
714719 if (test_bit(NBD_CMD_REQUEUED, &cmd->flags)) {
715720 dev_err(disk_to_dev(nbd->disk), "Raced with timeout on req %p\n",
716721 req);
@@ -792,7 +797,10 @@ static bool nbd_clear_req(struct request *req, void *data, bool reserved) · 75 unmodified lines
792797 {
793798 struct nbd_cmd *cmd = blk_mq_rq_to_pdu(req);
794799
800+ mutex_lock(&cmd->lock);
795801 cmd->status = BLK_STS_IOERR;
802+ mutex_unlock(&cmd->lock);
803+
796804 blk_mq_complete_request(req);
797805 return true;
798806 }
@@ -972,6 +980,25 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx, · 173 unmodified lines
972980 return ret;
973981 }
974982
983+static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd,
984+ int *err)
985+{
986+ struct socket *sock;
987+
988+ *err = 0;
989+ sock = sockfd_lookup(fd, err);
990+ if (!sock)
991+ return NULL;
992+
993+ if (sock->ops->shutdown == sock_no_shutdown) {
994+ dev_err(disk_to_dev(nbd->disk), "Unsupported socket: shutdown callout must be supported.\n");
995+ *err = -EINVAL;
996+ return NULL;
997+ }
998+
999+ return sock;
1000+}
1001+
9751002 static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
9761003 bool netlink)
9771004 {
@@ -981,7 +1008,7 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, · 3 unmodified lines
9811008 struct nbd_sock *nsock;
9821009 int err;
9831010
984− sock = sockfd_lookup(arg, &err);
1011+ sock = nbd_get_socket(nbd, arg, &err);
9851012 if (!sock)
9861013 return err;
9871014
@@ -1033,7 +1060,7 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) · 45 unmodified lines
10331060 int i;
10341061 int err;
10351062
1036− sock = sockfd_lookup(arg, &err);
1063+ sock = nbd_get_socket(nbd, arg, &err);
10371064 if (!sock)
10381065 return err;
10391066
drivers/block/rbd.c+6−3
@@ -6639,10 +6639,13 @@ static int rbd_add_acquire_lock(struct rbd_device *rbd_dev) · 6638 unmodified lines
66396639 queue_delayed_work(rbd_dev->task_wq, &rbd_dev->lock_dwork, 0);
66406640 ret = wait_for_completion_killable_timeout(&rbd_dev->acquire_wait,
66416641 ceph_timeout_jiffies(rbd_dev->opts->lock_timeout));
6642− if (ret > 0)
6642+ if (ret > 0) {
66436643 ret = rbd_dev->acquire_err;
6644− else if (!ret)
6645− ret = -ETIMEDOUT;
6644+ } else {
6645+ cancel_delayed_work_sync(&rbd_dev->lock_dwork);
6646+ if (!ret)
6647+ ret = -ETIMEDOUT;
6648+ }
66466649
66476650 if (ret) {
66486651 rbd_warn(rbd_dev, "failed to acquire exclusive lock: %ld", ret);
drivers/block/zram/zram_drv.c+3−2
@@ -413,13 +413,14 @@ static void reset_bdev(struct zram *zram) · 412 unmodified lines
413413 static ssize_t backing_dev_show(struct device *dev,
414414 struct device_attribute *attr, char *buf)
415415 {
416+ struct file *file;
416417 struct zram *zram = dev_to_zram(dev);
417− struct file *file = zram->backing_dev;
418418 char *p;
419419 ssize_t ret;
420420
421421 down_read(&zram->init_lock);
422− if (!zram->backing_dev) {
422+ file = zram->backing_dev;
423+ if (!file) {
423424 memcpy(buf, "none\n", 5);
424425 up_read(&zram->init_lock);
425426 return 5;
drivers/bus/ti-sysc.c+14−4
@@ -74,6 +74,7 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = { · 73 unmodified lines
7474 * @clk_disable_quirk: module specific clock disable quirk
7575 * @reset_done_quirk: module specific reset done quirk
7676 * @module_enable_quirk: module specific enable quirk
77+ * @module_disable_quirk: module specific disable quirk
7778 */
7879 struct sysc {
7980 struct device *dev;
@@ -100,6 +101,7 @@ struct sysc { · 20 unmodified lines
100101 void (*clk_disable_quirk)(struct sysc *sysc);
101102 void (*reset_done_quirk)(struct sysc *sysc);
102103 void (*module_enable_quirk)(struct sysc *sysc);
104+ void (*module_disable_quirk)(struct sysc *sysc);
103105 };
104106
105107 static void sysc_parse_dts_quirks(struct sysc *ddata, struct device_node *np,
@@ -959,6 +961,9 @@ static int sysc_disable_module(struct device *dev) · 853 unmodified lines
959961 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
960962 return 0;
961963
964+ if (ddata->module_disable_quirk)
965+ ddata->module_disable_quirk(ddata);
966+
962967 regbits = ddata->cap->regbits;
963968 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
964969
@@ -1248,6 +1253,9 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 283 unmodified lines
12481253 SYSC_MODULE_QUIRK_SGX),
12491254 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0,
12501255 SYSC_MODULE_QUIRK_WDT),
1256+ /* Watchdog on am3 and am4 */
1257+ SYSC_QUIRK("wdt", 0x44e35000, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0,
1258+ SYSC_MODULE_QUIRK_WDT | SYSC_QUIRK_SWSUP_SIDLE),
12511259
12521260 #ifdef DEBUG
12531261 SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0),
@@ -1440,14 +1448,14 @@ static void sysc_reset_done_quirk_wdt(struct sysc *ddata) · 186 unmodified lines
14401448 !(val & 0x10), 100,
14411449 MAX_MODULE_SOFTRESET_WAIT);
14421450 if (error)
1443− dev_warn(ddata->dev, "wdt disable spr failed\n");
1451+ dev_warn(ddata->dev, "wdt disable step1 failed\n");
14441452
1445− sysc_write(ddata, wps, 0x5555);
1453+ sysc_write(ddata, spr, 0x5555);
14461454 error = readl_poll_timeout(ddata->module_va + wps, val,
14471455 !(val & 0x10), 100,
14481456 MAX_MODULE_SOFTRESET_WAIT);
14491457 if (error)
1450− dev_warn(ddata->dev, "wdt disable wps failed\n");
1458+ dev_warn(ddata->dev, "wdt disable step2 failed\n");
14511459 }
14521460
14531461 static void sysc_init_module_quirks(struct sysc *ddata)
@@ -1471,8 +1479,10 @@ static void sysc_init_module_quirks(struct sysc *ddata) · 17 unmodified lines
14711479 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX)
14721480 ddata->module_enable_quirk = sysc_module_enable_quirk_sgx;
14731481
1474− if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_WDT)
1482+ if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_WDT) {
14751483 ddata->reset_done_quirk = sysc_reset_done_quirk_wdt;
1484+ ddata->module_disable_quirk = sysc_reset_done_quirk_wdt;
1485+ }
14761486 }
14771487
14781488 static int sysc_clockdomain_init(struct sysc *ddata)
drivers/cpufreq/cpufreq.c+29−43
@@ -720,7 +720,7 @@ static ssize_t store_##file_name \ · 719 unmodified lines
720720 if (ret != 1) \
721721 return -EINVAL; \
722722 \
723− ret = dev_pm_qos_update_request(policy->object##_freq_req, val);\
723+ ret = freq_qos_update_request(policy->object##_freq_req, val);\
724724 return ret >= 0 ? count : ret; \
725725 }
726726
@@ -1202,19 +1202,21 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) · 475 unmodified lines
12021202 goto err_free_real_cpus;
12031203 }
12041204
1205+ freq_constraints_init(&policy->constraints);
1206+
12051207 policy->nb_min.notifier_call = cpufreq_notifier_min;
12061208 policy->nb_max.notifier_call = cpufreq_notifier_max;
12071209
1208− ret = dev_pm_qos_add_notifier(dev, &policy->nb_min,
1209− DEV_PM_QOS_MIN_FREQUENCY);
1210+ ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MIN,
1211+ &policy->nb_min);
12101212 if (ret) {
12111213 dev_err(dev, "Failed to register MIN QoS notifier: %d (%*pbl)\n",
12121214 ret, cpumask_pr_args(policy->cpus));
12131215 goto err_kobj_remove;
12141216 }
12151217
1216− ret = dev_pm_qos_add_notifier(dev, &policy->nb_max,
1217− DEV_PM_QOS_MAX_FREQUENCY);
1218+ ret = freq_qos_add_notifier(&policy->constraints, FREQ_QOS_MAX,
1219+ &policy->nb_max);
12181220 if (ret) {
12191221 dev_err(dev, "Failed to register MAX QoS notifier: %d (%*pbl)\n",
12201222 ret, cpumask_pr_args(policy->cpus));
@@ -1232,8 +1234,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) · 11 unmodified lines
12321234 return policy;
12331235
12341236 err_min_qos_notifier:
1235− dev_pm_qos_remove_notifier(dev, &policy->nb_min,
1236− DEV_PM_QOS_MIN_FREQUENCY);
1237+ freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN,
1238+ &policy->nb_min);
12371239 err_kobj_remove:
12381240 cpufreq_policy_put_kobj(policy);
12391241 err_free_real_cpus:
@@ -1250,7 +1252,6 @@ err_free_policy: · 10 unmodified lines
12501252
12511253 static void cpufreq_policy_free(struct cpufreq_policy *policy)
12521254 {
1253− struct device *dev = get_cpu_device(policy->cpu);
12541255 unsigned long flags;
12551256 int cpu;
12561257
@@ -1262,10 +1263,13 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) · 5 unmodified lines
12621263 per_cpu(cpufreq_cpu_data, cpu) = NULL;
12631264 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
12641265
1265− dev_pm_qos_remove_notifier(dev, &policy->nb_max,
1266− DEV_PM_QOS_MAX_FREQUENCY);
1267− dev_pm_qos_remove_notifier(dev, &policy->nb_min,
1268− DEV_PM_QOS_MIN_FREQUENCY);
1266+ freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MAX,
1267+ &policy->nb_max);
1268+ freq_qos_remove_notifier(&policy->constraints, FREQ_QOS_MIN,
1269+ &policy->nb_min);
1270+
1271+ /* Cancel any pending policy->update work before freeing the policy. */
1272+ cancel_work_sync(&policy->update);
12691273
12701274 if (policy->max_freq_req) {
12711275 /*
@@ -1274,10 +1278,10 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy) · 2 unmodified lines
12741278 */
12751279 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
12761280 CPUFREQ_REMOVE_POLICY, policy);
1277− dev_pm_qos_remove_request(policy->max_freq_req);
1281+ freq_qos_remove_request(policy->max_freq_req);
12781282 }
12791283
1280− dev_pm_qos_remove_request(policy->min_freq_req);
1284+ freq_qos_remove_request(policy->min_freq_req);
12811285 kfree(policy->min_freq_req);
12821286
12831287 cpufreq_policy_put_kobj(policy);
@@ -1357,8 +1361,6 @@ static int cpufreq_online(unsigned int cpu) · 73 unmodified lines
13571361 cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
13581362
13591363 if (new_policy) {
1360− struct device *dev = get_cpu_device(cpu);
1361−
13621364 for_each_cpu(j, policy->related_cpus) {
13631365 per_cpu(cpufreq_cpu_data, j) = policy;
13641366 add_cpu_dev_symlink(policy, j);
@@ -1369,36 +1371,31 @@ static int cpufreq_online(unsigned int cpu) · 4 unmodified lines
13691371 if (!policy->min_freq_req)
13701372 goto out_destroy_policy;
13711373
1372− ret = dev_pm_qos_add_request(dev, policy->min_freq_req,
1373− DEV_PM_QOS_MIN_FREQUENCY,
1374− policy->min);
1374+ ret = freq_qos_add_request(&policy->constraints,
1375+ policy->min_freq_req, FREQ_QOS_MIN,
1376+ policy->min);
13751377 if (ret < 0) {
13761378 /*
1377− * So we don't call dev_pm_qos_remove_request() for an
1379+ * So we don't call freq_qos_remove_request() for an
13781380 * uninitialized request.
13791381 */
13801382 kfree(policy->min_freq_req);
13811383 policy->min_freq_req = NULL;
1382−
1383− dev_err(dev, "Failed to add min-freq constraint (%d)\n",
1384− ret);
13851384 goto out_destroy_policy;
13861385 }
13871386
13881387 /*
13891388 * This must be initialized right here to avoid calling
1390− * dev_pm_qos_remove_request() on uninitialized request in case
1389+ * freq_qos_remove_request() on uninitialized request in case
13911390 * of errors.
13921391 */
13931392 policy->max_freq_req = policy->min_freq_req + 1;
13941393
1395− ret = dev_pm_qos_add_request(dev, policy->max_freq_req,
1396− DEV_PM_QOS_MAX_FREQUENCY,
1397− policy->max);
1394+ ret = freq_qos_add_request(&policy->constraints,
1395+ policy->max_freq_req, FREQ_QOS_MAX,
1396+ policy->max);
13981397 if (ret < 0) {
13991398 policy->max_freq_req = NULL;
1400− dev_err(dev, "Failed to add max-freq constraint (%d)\n",
1401− ret);
14021399 goto out_destroy_policy;
14031400 }
14041401
@@ -2374,7 +2371,6 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, · 969 unmodified lines
23742371 struct cpufreq_policy *new_policy)
23752372 {
23762373 struct cpufreq_governor *old_gov;
2377− struct device *cpu_dev = get_cpu_device(policy->cpu);
23782374 int ret;
23792375
23802376 pr_debug("setting new policy for CPU %u: %u - %u kHz\n",
@@ -2386,8 +2382,8 @@ int cpufreq_set_policy(struct cpufreq_policy *policy, · 5 unmodified lines
23862382 * PM QoS framework collects all the requests from users and provide us
23872383 * the final aggregated value here.
23882384 */
2389− new_policy->min = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MIN_FREQUENCY);
2390− new_policy->max = dev_pm_qos_read_value(cpu_dev, DEV_PM_QOS_MAX_FREQUENCY);
2385+ new_policy->min = freq_qos_read_value(&policy->constraints, FREQ_QOS_MIN);
2386+ new_policy->max = freq_qos_read_value(&policy->constraints, FREQ_QOS_MAX);
23912387
23922388 /* verify the cpu speed can be set within this limit */
23932389 ret = cpufreq_driver->verify(new_policy);
@@ -2518,7 +2514,7 @@ static int cpufreq_boost_set_sw(int state) · 124 unmodified lines
25182514 break;
25192515 }
25202516
2521− ret = dev_pm_qos_update_request(policy->max_freq_req, policy->max);
2517+ ret = freq_qos_update_request(policy->max_freq_req, policy->max);
25222518 if (ret < 0)
25232519 break;
25242520 }
@@ -2737,14 +2733,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver) · 212 unmodified lines
27372733 }
27382734 EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
27392735
2740−/*
2741− * Stop cpufreq at shutdown to make sure it isn't holding any locks
2742− * or mutexes when secondary CPUs are halted.
2743− */
2744−static struct syscore_ops cpufreq_syscore_ops = {
2745− .shutdown = cpufreq_suspend,
2746−};
2747−
27482736 struct kobject *cpufreq_global_kobject;
27492737 EXPORT_SYMBOL(cpufreq_global_kobject);
27502738
@@ -2756,8 +2744,6 @@ static int __init cpufreq_core_init(void) · 5 unmodified lines
27562744 cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
27572745 BUG_ON(!cpufreq_global_kobject);
27582746
2759− register_syscore_ops(&cpufreq_syscore_ops);
2760−
27612747 return 0;
27622748 }
27632749 module_param(off, int, 0444);
drivers/cpufreq/intel_pstate.c+15−15
@@ -1088,10 +1088,10 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b, · 1087 unmodified lines
10881088
10891089 static struct cpufreq_driver intel_pstate;
10901090
1091−static void update_qos_request(enum dev_pm_qos_req_type type)
1091+static void update_qos_request(enum freq_qos_req_type type)
10921092 {
10931093 int max_state, turbo_max, freq, i, perf_pct;
1094− struct dev_pm_qos_request *req;
1094+ struct freq_qos_request *req;
10951095 struct cpufreq_policy *policy;
10961096
10971097 for_each_possible_cpu(i) {
@@ -1112,7 +1112,7 @@ static void update_qos_request(enum dev_pm_qos_req_type type) · 14 unmodified lines
11121112 else
11131113 turbo_max = cpu->pstate.turbo_pstate;
11141114
1115− if (type == DEV_PM_QOS_MIN_FREQUENCY) {
1115+ if (type == FREQ_QOS_MIN) {
11161116 perf_pct = global.min_perf_pct;
11171117 } else {
11181118 req++;
@@ -1122,7 +1122,7 @@ static void update_qos_request(enum dev_pm_qos_req_type type) · 3 unmodified lines
11221122 freq = DIV_ROUND_UP(turbo_max * perf_pct, 100);
11231123 freq *= cpu->pstate.scaling;
11241124
1125− if (dev_pm_qos_update_request(req, freq) < 0)
1125+ if (freq_qos_update_request(req, freq) < 0)
11261126 pr_warn("Failed to update freq constraint: CPU%d\n", i);
11271127 }
11281128 }
@@ -1153,7 +1153,7 @@ static ssize_t store_max_perf_pct(struct kobject *a, struct kobj_attribute *b, · 24 unmodified lines
11531153 if (intel_pstate_driver == &intel_pstate)
11541154 intel_pstate_update_policies();
11551155 else
1156− update_qos_request(DEV_PM_QOS_MAX_FREQUENCY);
1156+ update_qos_request(FREQ_QOS_MAX);
11571157
11581158 mutex_unlock(&intel_pstate_driver_lock);
11591159
@@ -1187,7 +1187,7 @@ static ssize_t store_min_perf_pct(struct kobject *a, struct kobj_attribute *b, · 27 unmodified lines
11871187 if (intel_pstate_driver == &intel_pstate)
11881188 intel_pstate_update_policies();
11891189 else
1190− update_qos_request(DEV_PM_QOS_MIN_FREQUENCY);
1190+ update_qos_request(FREQ_QOS_MIN);
11911191
11921192 mutex_unlock(&intel_pstate_driver_lock);
11931193
@@ -2381,7 +2381,7 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 1187 unmodified lines
23812381 static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy)
23822382 {
23832383 int max_state, turbo_max, min_freq, max_freq, ret;
2384− struct dev_pm_qos_request *req;
2384+ struct freq_qos_request *req;
23852385 struct cpudata *cpu;
23862386 struct device *dev;
23872387
@@ -2416,15 +2416,15 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) · 28 unmodified lines
24162416 max_freq = DIV_ROUND_UP(turbo_max * global.max_perf_pct, 100);
24172417 max_freq *= cpu->pstate.scaling;
24182418
2419− ret = dev_pm_qos_add_request(dev, req, DEV_PM_QOS_MIN_FREQUENCY,
2420− min_freq);
2419+ ret = freq_qos_add_request(&policy->constraints, req, FREQ_QOS_MIN,
2420+ min_freq);
24212421 if (ret < 0) {
24222422 dev_err(dev, "Failed to add min-freq constraint (%d)\n", ret);
24232423 goto free_req;
24242424 }
24252425
2426− ret = dev_pm_qos_add_request(dev, req + 1, DEV_PM_QOS_MAX_FREQUENCY,
2427− max_freq);
2426+ ret = freq_qos_add_request(&policy->constraints, req + 1, FREQ_QOS_MAX,
2427+ max_freq);
24282428 if (ret < 0) {
24292429 dev_err(dev, "Failed to add max-freq constraint (%d)\n", ret);
24302430 goto remove_min_req;
@@ -2435,7 +2435,7 @@ static int intel_cpufreq_cpu_init(struct cpufreq_policy *policy) · 4 unmodified lines
24352435 return 0;
24362436
24372437 remove_min_req:
2438− dev_pm_qos_remove_request(req);
2438+ freq_qos_remove_request(req);
24392439 free_req:
24402440 kfree(req);
24412441 pstate_exit:
@@ -2446,12 +2446,12 @@ pstate_exit: · 4 unmodified lines
24462446
24472447 static int intel_cpufreq_cpu_exit(struct cpufreq_policy *policy)
24482448 {
2449− struct dev_pm_qos_request *req;
2449+ struct freq_qos_request *req;
24502450
24512451 req = policy->driver_data;
24522452
2453− dev_pm_qos_remove_request(req + 1);
2454− dev_pm_qos_remove_request(req);
2453+ freq_qos_remove_request(req + 1);
2454+ freq_qos_remove_request(req);
24552455 kfree(req);
24562456
24572457 return intel_pstate_cpu_exit(policy);
drivers/cpufreq/ppc_cbe_cpufreq_pmi.c+7−8
@@ -65,7 +65,7 @@ EXPORT_SYMBOL_GPL(cbe_cpufreq_set_pmode_pmi); · 64 unmodified lines
6565 static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg)
6666 {
6767 struct cpufreq_policy *policy;
68− struct dev_pm_qos_request *req;
68+ struct freq_qos_request *req;
6969 u8 node, slow_mode;
7070 int cpu, ret;
7171
@@ -86,7 +86,7 @@ static void cbe_cpufreq_handle_pmi(pmi_message_t pmi_msg) · 14 unmodified lines
8686
8787 req = policy->driver_data;
8888
89− ret = dev_pm_qos_update_request(req,
89+ ret = freq_qos_update_request(req,
9090 policy->freq_table[slow_mode].frequency);
9191 if (ret < 0)
9292 pr_warn("Failed to update freq constraint: %d\n", ret);
@@ -103,7 +103,7 @@ static struct pmi_handler cbe_pmi_handler = { · 10 unmodified lines
103103
104104 void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy)
105105 {
106− struct dev_pm_qos_request *req;
106+ struct freq_qos_request *req;
107107 int ret;
108108
109109 if (!cbe_cpufreq_has_pmi)
@@ -113,9 +113,8 @@ void cbe_cpufreq_pmi_policy_init(struct cpufreq_policy *policy) · 3 unmodified lines
113113 if (!req)
114114 return;
115115
116− ret = dev_pm_qos_add_request(get_cpu_device(policy->cpu), req,
117− DEV_PM_QOS_MAX_FREQUENCY,
118− policy->freq_table[0].frequency);
116+ ret = freq_qos_add_request(&policy->constraints, req, FREQ_QOS_MAX,
117+ policy->freq_table[0].frequency);
119118 if (ret < 0) {
120119 pr_err("Failed to add freq constraint (%d)\n", ret);
121120 kfree(req);
@@ -128,10 +127,10 @@ EXPORT_SYMBOL_GPL(cbe_cpufreq_pmi_policy_init); · 6 unmodified lines
128127
129128 void cbe_cpufreq_pmi_policy_exit(struct cpufreq_policy *policy)
130129 {
131− struct dev_pm_qos_request *req = policy->driver_data;
130+ struct freq_qos_request *req = policy->driver_data;
132131
133132 if (cbe_cpufreq_has_pmi) {
134− dev_pm_qos_remove_request(req);
133+ freq_qos_remove_request(req);
135134 kfree(req);
136135 }
137136 }
drivers/cpuidle/cpuidle-haltpoll.c+4−0
@@ -95,6 +95,10 @@ static int __init haltpoll_init(void) · 94 unmodified lines
9595 int ret;
9696 struct cpuidle_driver *drv = &haltpoll_driver;
9797
98+ /* Do not load haltpoll if idle= is passed */
99+ if (boot_option_idle_override != IDLE_NO_OVERRIDE)
100+ return -ENODEV;
101+
98102 cpuidle_poll_state_init(drv);
99103
100104 if (!kvm_para_available() ||
drivers/dma-buf/dma-resv.c+1−1
@@ -471,7 +471,7 @@ unlock: · 470 unmodified lines
471471 if (pfence_excl)
472472 *pfence_excl = fence_excl;
473473 else if (fence_excl)
474− shared[++shared_count] = fence_excl;
474+ shared[shared_count++] = fence_excl;
475475
476476 if (!shared_count) {
477477 kfree(shared);
drivers/edac/ghes_edac.c+4−0
@@ -553,7 +553,11 @@ void ghes_edac_unregister(struct ghes *ghes) · 552 unmodified lines
553553 if (!ghes_pvt)
554554 return;
555555
556+ if (atomic_dec_return(&ghes_init))
557+ return;
558+
556559 mci = ghes_pvt->mci;
560+ ghes_pvt = NULL;
557561 edac_mc_del_mc(mci->pdev);
558562 edac_mc_free(mci);
559563 }
drivers/firmware/dmi_scan.c+1−1
@@ -408,7 +408,7 @@ static void __init save_mem_devices(const struct dmi_header *dm, void *v) · 407 unmodified lines
408408 bytes = ~0ull;
409409 else if (size & 0x8000)
410410 bytes = (u64)(size & 0x7fff) << 10;
411− else if (size != 0x7fff)
411+ else if (size != 0x7fff || dm->length < 0x20)
412412 bytes = (u64)size << 20;
413413 else
414414 bytes = (u64)get_unaligned((u32 *)&d[0x1C]) << 20;
drivers/gpio/gpio-intel-mid.c+6−3
@@ -293,8 +293,9 @@ static void intel_mid_irq_handler(struct irq_desc *desc) · 292 unmodified lines
293293 chip->irq_eoi(data);
294294 }
295295
296−static void intel_mid_irq_init_hw(struct intel_mid_gpio *priv)
296+static int intel_mid_irq_init_hw(struct gpio_chip *chip)
297297 {
298+ struct intel_mid_gpio *priv = gpiochip_get_data(chip);
298299 void __iomem *reg;
299300 unsigned base;
300301
@@ -309,6 +310,8 @@ static void intel_mid_irq_init_hw(struct intel_mid_gpio *priv) · 8 unmodified lines
309310 reg = gpio_reg(&priv->chip, base, GEDR);
310311 writel(~0, reg);
311312 }
313+
314+ return 0;
312315 }
313316
314317 static int __maybe_unused intel_gpio_runtime_idle(struct device *dev)
@@ -372,6 +375,7 @@ static int intel_gpio_probe(struct pci_dev *pdev, · 57 unmodified lines
372375
373376 girq = &priv->chip.irq;
374377 girq->chip = &intel_mid_irqchip;
378+ girq->init_hw = intel_mid_irq_init_hw;
375379 girq->parent_handler = intel_mid_irq_handler;
376380 girq->num_parents = 1;
377381 girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
@@ -384,9 +388,8 @@ static int intel_gpio_probe(struct pci_dev *pdev, · 6 unmodified lines
384388 girq->default_type = IRQ_TYPE_NONE;
385389 girq->handler = handle_simple_irq;
386390
387− intel_mid_irq_init_hw(priv);
388−
389391 pci_set_drvdata(pdev, priv);
392+
390393 retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);
391394 if (retval) {
392395 dev_err(&pdev->dev, "gpiochip_add error %d\n", retval);
drivers/gpio/gpio-lynxpoint.c+6−4
@@ -294,8 +294,9 @@ static struct irq_chip lp_irqchip = { · 293 unmodified lines
294294 .flags = IRQCHIP_SKIP_SET_WAKE,
295295 };
296296
297−static void lp_gpio_irq_init_hw(struct lp_gpio *lg)
297+static int lp_gpio_irq_init_hw(struct gpio_chip *chip)
298298 {
299+ struct lp_gpio *lg = gpiochip_get_data(chip);
299300 unsigned long reg;
300301 unsigned base;
301302
@@ -307,6 +308,8 @@ static void lp_gpio_irq_init_hw(struct lp_gpio *lg) · 5 unmodified lines
307308 reg = lp_gpio_reg(&lg->chip, base, LP_INT_STAT);
308309 outl(0xffffffff, reg);
309310 }
311+
312+ return 0;
310313 }
311314
312315 static int lp_gpio_probe(struct platform_device *pdev)
@@ -364,6 +367,7 @@ static int lp_gpio_probe(struct platform_device *pdev) · 51 unmodified lines
364367
365368 girq = &gc->irq;
366369 girq->chip = &lp_irqchip;
370+ girq->init_hw = lp_gpio_irq_init_hw;
367371 girq->parent_handler = lp_gpio_irq_handler;
368372 girq->num_parents = 1;
369373 girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
@@ -373,9 +377,7 @@ static int lp_gpio_probe(struct platform_device *pdev) · 3 unmodified lines
373377 return -ENOMEM;
374378 girq->parents[0] = (unsigned)irq_rc->start;
375379 girq->default_type = IRQ_TYPE_NONE;
376− girq->handler = handle_simple_irq;
377−
378− lp_gpio_irq_init_hw(lg);
380+ girq->handler = handle_bad_irq;
379381 }
380382
381383 ret = devm_gpiochip_add_data(dev, gc, lg);
drivers/gpio/gpio-merrifield.c+6−3
@@ -362,8 +362,9 @@ static void mrfld_irq_handler(struct irq_desc *desc) · 361 unmodified lines
362362 chained_irq_exit(irqchip, desc);
363363 }
364364
365−static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
365+static int mrfld_irq_init_hw(struct gpio_chip *chip)
366366 {
367+ struct mrfld_gpio *priv = gpiochip_get_data(chip);
367368 void __iomem *reg;
368369 unsigned int base;
369370
@@ -375,6 +376,8 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv) · 5 unmodified lines
375376 reg = gpio_reg(&priv->chip, base, GFER);
376377 writel(0, reg);
377378 }
379+
380+ return 0;
378381 }
379382
380383 static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
@@ -447,6 +450,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 66 unmodified lines
447450
448451 girq = &priv->chip.irq;
449452 girq->chip = &mrfld_irqchip;
453+ girq->init_hw = mrfld_irq_init_hw;
450454 girq->parent_handler = mrfld_irq_handler;
451455 girq->num_parents = 1;
452456 girq->parents = devm_kcalloc(&pdev->dev, girq->num_parents,
@@ -455,11 +459,10 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id · 2 unmodified lines
455459 if (!girq->parents)
456460 return -ENOMEM;
457461 girq->parents[0] = pdev->irq;
462+ girq->first = irq_base;
458463 girq->default_type = IRQ_TYPE_NONE;
459464 girq->handler = handle_bad_irq;
460465
461− mrfld_irq_init_hw(priv);
462−
463466 pci_set_drvdata(pdev, priv);
464467 retval = devm_gpiochip_add_data(&pdev->dev, &priv->chip, priv);
465468 if (retval) {
drivers/gpio/gpiolib.c+21−1
@@ -86,6 +86,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gpiochip, · 85 unmodified lines
8686 struct lock_class_key *lock_key,
8787 struct lock_class_key *request_key);
8888 static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
89+static int gpiochip_irqchip_init_hw(struct gpio_chip *gpiochip);
8990 static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip);
9091 static void gpiochip_irqchip_free_valid_mask(struct gpio_chip *gpiochip);
9192
@@ -1406,6 +1407,10 @@ int gpiochip_add_data_with_key(struct gpio_chip *chip, void *data, · 1314 unmodified lines
14061407
14071408 machine_gpiochip_add(chip);
14081409
1410+ ret = gpiochip_irqchip_init_hw(chip);
1411+ if (ret)
1412+ goto err_remove_acpi_chip;
1413+
14091414 ret = gpiochip_irqchip_init_valid_mask(chip);
14101415 if (ret)
14111416 goto err_remove_acpi_chip;
@@ -1622,6 +1627,16 @@ static struct gpio_chip *find_chip_by_name(const char *name) · 210 unmodified lines
16221627 * The following is irqchip helper code for gpiochips.
16231628 */
16241629
1630+static int gpiochip_irqchip_init_hw(struct gpio_chip *gc)
1631+{
1632+ struct gpio_irq_chip *girq = &gc->irq;
1633+
1634+ if (!girq->init_hw)
1635+ return 0;
1636+
1637+ return girq->init_hw(gc);
1638+}
1639+
16251640 static int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gc)
16261641 {
16271642 struct gpio_irq_chip *girq = &gc->irq;
@@ -2446,8 +2461,13 @@ static inline int gpiochip_add_irqchip(struct gpio_chip *gpiochip, · 818 unmodified lines
24462461 {
24472462 return 0;
24482463 }
2449−
24502464 static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip) {}
2465+
2466+static inline int gpiochip_irqchip_init_hw(struct gpio_chip *gpiochip)
2467+{
2468+ return 0;
2469+}
2470+
24512471 static inline int gpiochip_irqchip_init_valid_mask(struct gpio_chip *gpiochip)
24522472 {
24532473 return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c+6−1
@@ -140,7 +140,12 @@ int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp, · 139 unmodified lines
140140 return 0;
141141
142142 error_free:
143− while (i--) {
143+ for (i = 0; i < last_entry; ++i) {
144+ struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
145+
146+ amdgpu_bo_unref(&bo);
147+ }
148+ for (i = first_userptr; i < num_entries; ++i) {
144149 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(array[i].tv.bo);
145150
146151 amdgpu_bo_unref(&bo);
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c+2−6
@@ -536,7 +536,6 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, · 535 unmodified lines
536536
537537 list_for_each_entry(lobj, validated, tv.head) {
538538 struct amdgpu_bo *bo = ttm_to_amdgpu_bo(lobj->tv.bo);
539− bool binding_userptr = false;
540539 struct mm_struct *usermm;
541540
542541 usermm = amdgpu_ttm_tt_get_usermm(bo->tbo.ttm);
@@ -553,7 +552,6 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, · 10 unmodified lines
553552
554553 amdgpu_ttm_tt_set_user_pages(bo->tbo.ttm,
555554 lobj->user_pages);
556− binding_userptr = true;
557555 }
558556
559557 if (p->evictable == lobj)
@@ -563,10 +561,8 @@ static int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p, · 3 unmodified lines
563561 if (r)
564562 return r;
565563
566− if (binding_userptr) {
567− kvfree(lobj->user_pages);
568− lobj->user_pages = NULL;
569− }
564+ kvfree(lobj->user_pages);
565+ lobj->user_pages = NULL;
570566 }
571567 return 0;
572568 }
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+35−0
@@ -1048,6 +1048,41 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 1047 unmodified lines
10481048 return -ENODEV;
10491049 }
10501050
1051+#ifdef CONFIG_DRM_AMDGPU_SI
1052+ if (!amdgpu_si_support) {
1053+ switch (flags & AMD_ASIC_MASK) {
1054+ case CHIP_TAHITI:
1055+ case CHIP_PITCAIRN:
1056+ case CHIP_VERDE:
1057+ case CHIP_OLAND:
1058+ case CHIP_HAINAN:
1059+ dev_info(&pdev->dev,
1060+ "SI support provided by radeon.\n");
1061+ dev_info(&pdev->dev,
1062+ "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
1063+ );
1064+ return -ENODEV;
1065+ }
1066+ }
1067+#endif
1068+#ifdef CONFIG_DRM_AMDGPU_CIK
1069+ if (!amdgpu_cik_support) {
1070+ switch (flags & AMD_ASIC_MASK) {
1071+ case CHIP_KAVERI:
1072+ case CHIP_BONAIRE:
1073+ case CHIP_HAWAII:
1074+ case CHIP_KABINI:
1075+ case CHIP_MULLINS:
1076+ dev_info(&pdev->dev,
1077+ "CIK support provided by radeon.\n");
1078+ dev_info(&pdev->dev,
1079+ "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
1080+ );
1081+ return -ENODEV;
1082+ }
1083+ }
1084+#endif
1085+
10511086 /* Get rid of things like offb */
10521087 ret = drm_fb_helper_remove_conflicting_pci_framebuffers(pdev, 0, "amdgpudrmfb");
10531088 if (ret)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+0−35
@@ -144,41 +144,6 @@ int amdgpu_driver_load_kms(struct drm_device *dev, unsigned long flags) · 143 unmodified lines
144144 struct amdgpu_device *adev;
145145 int r, acpi_status;
146146
147−#ifdef CONFIG_DRM_AMDGPU_SI
148− if (!amdgpu_si_support) {
149− switch (flags & AMD_ASIC_MASK) {
150− case CHIP_TAHITI:
151− case CHIP_PITCAIRN:
152− case CHIP_VERDE:
153− case CHIP_OLAND:
154− case CHIP_HAINAN:
155− dev_info(dev->dev,
156− "SI support provided by radeon.\n");
157− dev_info(dev->dev,
158− "Use radeon.si_support=0 amdgpu.si_support=1 to override.\n"
159− );
160− return -ENODEV;
161− }
162− }
163−#endif
164−#ifdef CONFIG_DRM_AMDGPU_CIK
165− if (!amdgpu_cik_support) {
166− switch (flags & AMD_ASIC_MASK) {
167− case CHIP_KAVERI:
168− case CHIP_BONAIRE:
169− case CHIP_HAWAII:
170− case CHIP_KABINI:
171− case CHIP_MULLINS:
172− dev_info(dev->dev,
173− "CIK support provided by radeon.\n");
174− dev_info(dev->dev,
175− "Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n"
176− );
177− return -ENODEV;
178− }
179− }
180−#endif
181−
182147 adev = kzalloc(sizeof(struct amdgpu_device), GFP_KERNEL);
183148 if (adev == NULL) {
184149 return -ENOMEM;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+2−1
@@ -453,7 +453,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, · 452 unmodified lines
453453 .interruptible = (bp->type != ttm_bo_type_kernel),
454454 .no_wait_gpu = false,
455455 .resv = bp->resv,
456− .flags = TTM_OPT_FLAG_ALLOW_RES_EVICT
456+ .flags = bp->type != ttm_bo_type_kernel ?
457+ TTM_OPT_FLAG_ALLOW_RES_EVICT : 0
457458 };
458459 struct amdgpu_bo *bo;
459460 unsigned long page_align, size = bp->size;
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c+15−5
@@ -429,13 +429,14 @@ void amdgpu_vce_free_handles(struct amdgpu_device *adev, struct drm_file *filp) · 428 unmodified lines
429429 * Open up a stream for HW test
430430 */
431431 int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
432+ struct amdgpu_bo *bo,
432433 struct dma_fence **fence)
433434 {
434435 const unsigned ib_size_dw = 1024;
435436 struct amdgpu_job *job;
436437 struct amdgpu_ib *ib;
437438 struct dma_fence *f = NULL;
438− uint64_t dummy;
439+ uint64_t addr;
439440 int i, r;
440441
441442 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -444,7 +445,7 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 2 unmodified lines
444445
445446 ib = &job->ibs[0];
446447
447− dummy = ib->gpu_addr + 1024;
448+ addr = amdgpu_bo_gpu_offset(bo);
448449
449450 /* stitch together an VCE create msg */
450451 ib->length_dw = 0;
@@ -476,8 +477,8 @@ int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle, · 25 unmodified lines
476477
477478 ib->ptr[ib->length_dw++] = 0x00000014; /* len */
478479 ib->ptr[ib->length_dw++] = 0x05000005; /* feedback buffer */
479− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
480− ib->ptr[ib->length_dw++] = dummy;
480+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
481+ ib->ptr[ib->length_dw++] = addr;
481482 ib->ptr[ib->length_dw++] = 0x00000001;
482483
483484 for (i = ib->length_dw; i < ib_size_dw; ++i)
@@ -1110,13 +1111,20 @@ int amdgpu_vce_ring_test_ring(struct amdgpu_ring *ring) · 626 unmodified lines
11101111 int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout)
11111112 {
11121113 struct dma_fence *fence = NULL;
1114+ struct amdgpu_bo *bo = NULL;
11131115 long r;
11141116
11151117 /* skip vce ring1/2 ib test for now, since it's not reliable */
11161118 if (ring != &ring->adev->vce.ring[0])
11171119 return 0;
11181120
1119− r = amdgpu_vce_get_create_msg(ring, 1, NULL);
1121+ r = amdgpu_bo_create_reserved(ring->adev, 512, PAGE_SIZE,
1122+ AMDGPU_GEM_DOMAIN_VRAM,
1123+ &bo, NULL, NULL);
1124+ if (r)
1125+ return r;
1126+
1127+ r = amdgpu_vce_get_create_msg(ring, 1, bo, NULL);
11201128 if (r)
11211129 goto error;
11221130
@@ -1132,5 +1140,7 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 9 unmodified lines
11321140
11331141 error:
11341142 dma_fence_put(fence);
1143+ amdgpu_bo_unreserve(bo);
1144+ amdgpu_bo_unref(&bo);
11351145 return r;
11361146 }
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.h+1−0
@@ -59,6 +59,7 @@ int amdgpu_vce_entity_init(struct amdgpu_device *adev); · 58 unmodified lines
5959 int amdgpu_vce_suspend(struct amdgpu_device *adev);
6060 int amdgpu_vce_resume(struct amdgpu_device *adev);
6161 int amdgpu_vce_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
62+ struct amdgpu_bo *bo,
6263 struct dma_fence **fence);
6364 int amdgpu_vce_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
6465 bool direct, struct dma_fence **fence);
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c+23−12
@@ -569,13 +569,14 @@ int amdgpu_vcn_enc_ring_test_ring(struct amdgpu_ring *ring) · 568 unmodified lines
569569 }
570570
571571 static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
572− struct dma_fence **fence)
572+ struct amdgpu_bo *bo,
573+ struct dma_fence **fence)
573574 {
574575 const unsigned ib_size_dw = 16;
575576 struct amdgpu_job *job;
576577 struct amdgpu_ib *ib;
577578 struct dma_fence *f = NULL;
578− uint64_t dummy;
579+ uint64_t addr;
579580 int i, r;
580581
581582 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -583,14 +584,14 @@ static int amdgpu_vcn_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t hand · 1 unmodified line
583584 return r;
584585
585586 ib = &job->ibs[0];
586− dummy = ib->gpu_addr + 1024;
587+ addr = amdgpu_bo_gpu_offset(bo);
587588
588589 ib->length_dw = 0;
589590 ib->ptr[ib->length_dw++] = 0x00000018;
590591 ib->ptr[ib->length_dw++] = 0x00000001; /* session info */
591592 ib->ptr[ib->length_dw++] = handle;
592− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
593− ib->ptr[ib->length_dw++] = dummy;
593+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
594+ ib->ptr[ib->length_dw++] = addr;
594595 ib->ptr[ib->length_dw++] = 0x0000000b;
595596
596597 ib->ptr[ib->length_dw++] = 0x00000014;
@@ -621,13 +622,14 @@ err: · 24 unmodified lines
621622 }
622623
623624 static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
624− struct dma_fence **fence)
625+ struct amdgpu_bo *bo,
626+ struct dma_fence **fence)
625627 {
626628 const unsigned ib_size_dw = 16;
627629 struct amdgpu_job *job;
628630 struct amdgpu_ib *ib;
629631 struct dma_fence *f = NULL;
630− uint64_t dummy;
632+ uint64_t addr;
631633 int i, r;
632634
633635 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -635,14 +637,14 @@ static int amdgpu_vcn_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han · 1 unmodified line
635637 return r;
636638
637639 ib = &job->ibs[0];
638− dummy = ib->gpu_addr + 1024;
640+ addr = amdgpu_bo_gpu_offset(bo);
639641
640642 ib->length_dw = 0;
641643 ib->ptr[ib->length_dw++] = 0x00000018;
642644 ib->ptr[ib->length_dw++] = 0x00000001;
643645 ib->ptr[ib->length_dw++] = handle;
644− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
645− ib->ptr[ib->length_dw++] = dummy;
646+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
647+ ib->ptr[ib->length_dw++] = addr;
646648 ib->ptr[ib->length_dw++] = 0x0000000b;
647649
648650 ib->ptr[ib->length_dw++] = 0x00000014;
@@ -675,13 +677,20 @@ err: · 26 unmodified lines
675677 int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
676678 {
677679 struct dma_fence *fence = NULL;
680+ struct amdgpu_bo *bo = NULL;
678681 long r;
679682
680− r = amdgpu_vcn_enc_get_create_msg(ring, 1, NULL);
683+ r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE,
684+ AMDGPU_GEM_DOMAIN_VRAM,
685+ &bo, NULL, NULL);
686+ if (r)
687+ return r;
688+
689+ r = amdgpu_vcn_enc_get_create_msg(ring, 1, bo, NULL);
681690 if (r)
682691 goto error;
683692
684− r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, &fence);
693+ r = amdgpu_vcn_enc_get_destroy_msg(ring, 1, bo, &fence);
685694 if (r)
686695 goto error;
687696
@@ -693,6 +702,8 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 5 unmodified lines
693702
694703 error:
695704 dma_fence_put(fence);
705+ amdgpu_bo_unreserve(bo);
706+ amdgpu_bo_unref(&bo);
696707 return r;
697708 }
698709
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c+1−1
@@ -1129,7 +1129,7 @@ static void sdma_v5_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring) · 1128 unmodified lines
11291129 amdgpu_ring_write(ring, addr & 0xfffffffc);
11301130 amdgpu_ring_write(ring, upper_32_bits(addr) & 0xffffffff);
11311131 amdgpu_ring_write(ring, seq); /* reference */
1132− amdgpu_ring_write(ring, 0xfffffff); /* mask */
1132+ amdgpu_ring_write(ring, 0xffffffff); /* mask */
11331133 amdgpu_ring_write(ring, SDMA_PKT_POLL_REGMEM_DW5_RETRY_COUNT(0xfff) |
11341134 SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(4)); /* retry count, poll interval */
11351135 }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c+21−10
@@ -206,13 +206,14 @@ static int uvd_v6_0_enc_ring_test_ring(struct amdgpu_ring *ring) · 205 unmodified lines
206206 * Open up a stream for HW test
207207 */
208208 static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
209+ struct amdgpu_bo *bo,
209210 struct dma_fence **fence)
210211 {
211212 const unsigned ib_size_dw = 16;
212213 struct amdgpu_job *job;
213214 struct amdgpu_ib *ib;
214215 struct dma_fence *f = NULL;
215− uint64_t dummy;
216+ uint64_t addr;
216217 int i, r;
217218
218219 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -220,15 +221,15 @@ static int uvd_v6_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle · 1 unmodified line
220221 return r;
221222
222223 ib = &job->ibs[0];
223− dummy = ib->gpu_addr + 1024;
224+ addr = amdgpu_bo_gpu_offset(bo);
224225
225226 ib->length_dw = 0;
226227 ib->ptr[ib->length_dw++] = 0x00000018;
227228 ib->ptr[ib->length_dw++] = 0x00000001; /* session info */
228229 ib->ptr[ib->length_dw++] = handle;
229230 ib->ptr[ib->length_dw++] = 0x00010000;
230− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
231− ib->ptr[ib->length_dw++] = dummy;
231+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
232+ ib->ptr[ib->length_dw++] = addr;
232233
233234 ib->ptr[ib->length_dw++] = 0x00000014;
234235 ib->ptr[ib->length_dw++] = 0x00000002; /* task info */
@@ -268,13 +269,14 @@ err: · 33 unmodified lines
268269 */
269270 static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring,
270271 uint32_t handle,
272+ struct amdgpu_bo *bo,
271273 struct dma_fence **fence)
272274 {
273275 const unsigned ib_size_dw = 16;
274276 struct amdgpu_job *job;
275277 struct amdgpu_ib *ib;
276278 struct dma_fence *f = NULL;
277− uint64_t dummy;
279+ uint64_t addr;
278280 int i, r;
279281
280282 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -282,15 +284,15 @@ static int uvd_v6_0_enc_get_destroy_msg(struct amdgpu_ring *ring, · 1 unmodified line
282284 return r;
283285
284286 ib = &job->ibs[0];
285− dummy = ib->gpu_addr + 1024;
287+ addr = amdgpu_bo_gpu_offset(bo);
286288
287289 ib->length_dw = 0;
288290 ib->ptr[ib->length_dw++] = 0x00000018;
289291 ib->ptr[ib->length_dw++] = 0x00000001; /* session info */
290292 ib->ptr[ib->length_dw++] = handle;
291293 ib->ptr[ib->length_dw++] = 0x00010000;
292− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
293− ib->ptr[ib->length_dw++] = dummy;
294+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
295+ ib->ptr[ib->length_dw++] = addr;
294296
295297 ib->ptr[ib->length_dw++] = 0x00000014;
296298 ib->ptr[ib->length_dw++] = 0x00000002; /* task info */
@@ -327,13 +329,20 @@ err: · 30 unmodified lines
327329 static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
328330 {
329331 struct dma_fence *fence = NULL;
332+ struct amdgpu_bo *bo = NULL;
330333 long r;
331334
332− r = uvd_v6_0_enc_get_create_msg(ring, 1, NULL);
335+ r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE,
336+ AMDGPU_GEM_DOMAIN_VRAM,
337+ &bo, NULL, NULL);
338+ if (r)
339+ return r;
340+
341+ r = uvd_v6_0_enc_get_create_msg(ring, 1, bo, NULL);
333342 if (r)
334343 goto error;
335344
336− r = uvd_v6_0_enc_get_destroy_msg(ring, 1, &fence);
345+ r = uvd_v6_0_enc_get_destroy_msg(ring, 1, bo, &fence);
337346 if (r)
338347 goto error;
339348
@@ -345,6 +354,8 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 5 unmodified lines
345354
346355 error:
347356 dma_fence_put(fence);
357+ amdgpu_bo_unreserve(bo);
358+ amdgpu_bo_unref(&bo);
348359 return r;
349360 }
350361
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c+22−11
@@ -214,13 +214,14 @@ static int uvd_v7_0_enc_ring_test_ring(struct amdgpu_ring *ring) · 213 unmodified lines
214214 * Open up a stream for HW test
215215 */
216216 static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
217+ struct amdgpu_bo *bo,
217218 struct dma_fence **fence)
218219 {
219220 const unsigned ib_size_dw = 16;
220221 struct amdgpu_job *job;
221222 struct amdgpu_ib *ib;
222223 struct dma_fence *f = NULL;
223− uint64_t dummy;
224+ uint64_t addr;
224225 int i, r;
225226
226227 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -228,15 +229,15 @@ static int uvd_v7_0_enc_get_create_msg(struct amdgpu_ring *ring, uint32_t handle · 1 unmodified line
228229 return r;
229230
230231 ib = &job->ibs[0];
231− dummy = ib->gpu_addr + 1024;
232+ addr = amdgpu_bo_gpu_offset(bo);
232233
233234 ib->length_dw = 0;
234235 ib->ptr[ib->length_dw++] = 0x00000018;
235236 ib->ptr[ib->length_dw++] = 0x00000001; /* session info */
236237 ib->ptr[ib->length_dw++] = handle;
237238 ib->ptr[ib->length_dw++] = 0x00000000;
238− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
239− ib->ptr[ib->length_dw++] = dummy;
239+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
240+ ib->ptr[ib->length_dw++] = addr;
240241
241242 ib->ptr[ib->length_dw++] = 0x00000014;
242243 ib->ptr[ib->length_dw++] = 0x00000002; /* task info */
@@ -275,13 +276,14 @@ err: · 32 unmodified lines
275276 * Close up a stream for HW test or if userspace failed to do so
276277 */
277278 static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
278− struct dma_fence **fence)
279+ struct amdgpu_bo *bo,
280+ struct dma_fence **fence)
279281 {
280282 const unsigned ib_size_dw = 16;
281283 struct amdgpu_job *job;
282284 struct amdgpu_ib *ib;
283285 struct dma_fence *f = NULL;
284− uint64_t dummy;
286+ uint64_t addr;
285287 int i, r;
286288
287289 r = amdgpu_job_alloc_with_ib(ring->adev, ib_size_dw * 4, &job);
@@ -289,15 +291,15 @@ static int uvd_v7_0_enc_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handl · 1 unmodified line
289291 return r;
290292
291293 ib = &job->ibs[0];
292− dummy = ib->gpu_addr + 1024;
294+ addr = amdgpu_bo_gpu_offset(bo);
293295
294296 ib->length_dw = 0;
295297 ib->ptr[ib->length_dw++] = 0x00000018;
296298 ib->ptr[ib->length_dw++] = 0x00000001;
297299 ib->ptr[ib->length_dw++] = handle;
298300 ib->ptr[ib->length_dw++] = 0x00000000;
299− ib->ptr[ib->length_dw++] = upper_32_bits(dummy);
300− ib->ptr[ib->length_dw++] = dummy;
301+ ib->ptr[ib->length_dw++] = upper_32_bits(addr);
302+ ib->ptr[ib->length_dw++] = addr;
301303
302304 ib->ptr[ib->length_dw++] = 0x00000014;
303305 ib->ptr[ib->length_dw++] = 0x00000002;
@@ -334,13 +336,20 @@ err: · 30 unmodified lines
334336 static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout)
335337 {
336338 struct dma_fence *fence = NULL;
339+ struct amdgpu_bo *bo = NULL;
337340 long r;
338341
339− r = uvd_v7_0_enc_get_create_msg(ring, 1, NULL);
342+ r = amdgpu_bo_create_reserved(ring->adev, 128 * 1024, PAGE_SIZE,
343+ AMDGPU_GEM_DOMAIN_VRAM,
344+ &bo, NULL, NULL);
345+ if (r)
346+ return r;
347+
348+ r = uvd_v7_0_enc_get_create_msg(ring, 1, bo, NULL);
340349 if (r)
341350 goto error;
342351
343− r = uvd_v7_0_enc_get_destroy_msg(ring, 1, &fence);
352+ r = uvd_v7_0_enc_get_destroy_msg(ring, 1, bo, &fence);
344353 if (r)
345354 goto error;
346355
@@ -352,6 +361,8 @@ static int uvd_v7_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 5 unmodified lines
352361
353362 error:
354363 dma_fence_put(fence);
364+ amdgpu_bo_unreserve(bo);
365+ amdgpu_bo_unref(&bo);
355366 return r;
356367 }
357368
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c+1−1
@@ -655,7 +655,7 @@ static int polaris10_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, · 654 unmodified lines
655655 count = SMU_MAX_SMIO_LEVELS;
656656 for (level = 0; level < count; level++) {
657657 table->SmioTable2.Pattern[level].Voltage =
658− PP_HOST_TO_SMC_US(data->mvdd_voltage_table.entries[count].value * VOLTAGE_SCALE);
658+ PP_HOST_TO_SMC_US(data->mvdd_voltage_table.entries[level].value * VOLTAGE_SCALE);
659659 /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/
660660 table->SmioTable2.Pattern[level].Smio =
661661 (uint8_t) level;
drivers/gpu/drm/amd/powerplay/smumgr/vegam_smumgr.c+1−1
@@ -456,7 +456,7 @@ static int vegam_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr, · 455 unmodified lines
456456 count = SMU_MAX_SMIO_LEVELS;
457457 for (level = 0; level < count; level++) {
458458 table->SmioTable2.Pattern[level].Voltage = PP_HOST_TO_SMC_US(
459− data->mvdd_voltage_table.entries[count].value * VOLTAGE_SCALE);
459+ data->mvdd_voltage_table.entries[level].value * VOLTAGE_SCALE);
460460 /* Index into DpmTable.Smio. Drive bits from Smio entry to get this voltage level.*/
461461 table->SmioTable2.Pattern[level].Smio =
462462 (uint8_t) level;
drivers/gpu/drm/arm/display/komeda/komeda_kms.c+2−1
@@ -82,7 +82,8 @@ static void komeda_kms_commit_tail(struct drm_atomic_state *old_state) · 81 unmodified lines
8282
8383 drm_atomic_helper_commit_modeset_disables(dev, old_state);
8484
85− drm_atomic_helper_commit_planes(dev, old_state, 0);
85+ drm_atomic_helper_commit_planes(dev, old_state,
86+ DRM_PLANE_COMMIT_ACTIVE_ONLY);
8687
8788 drm_atomic_helper_commit_modeset_enables(dev, old_state);
8889
drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c+2−2
@@ -564,8 +564,8 @@ komeda_splitter_validate(struct komeda_splitter *splitter, · 563 unmodified lines
564564 }
565565
566566 if (!in_range(&splitter->vsize, dflow->in_h)) {
567− DRM_DEBUG_ATOMIC("split in_in: %d exceed the acceptable range.\n",
568− dflow->in_w);
567+ DRM_DEBUG_ATOMIC("split in_h: %d exceeds the acceptable range.\n",
568+ dflow->in_h);
569569 return -EINVAL;
570570 }
571571
drivers/gpu/drm/drm_edid.c+3−0
@@ -159,6 +159,9 @@ static const struct edid_quirk { · 158 unmodified lines
159159 /* Medion MD 30217 PG */
160160 { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75 },
161161
162+ /* Lenovo G50 */
163+ { "SDC", 18514, EDID_QUIRK_FORCE_6BPC },
164+
162165 /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
163166 { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC },
164167
drivers/gpu/drm/i915/display/intel_bios.c+16−6
@@ -1270,7 +1270,7 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, · 1269 unmodified lines
12701270 DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, "
12711271 "disabling port %c DVI/HDMI support\n",
12721272 port_name(port), info->alternate_ddc_pin,
1273− port_name(p), port_name(port));
1273+ port_name(p), port_name(p));
12741274
12751275 /*
12761276 * If we have multiple ports supposedly sharing the
@@ -1278,9 +1278,14 @@ static void sanitize_ddc_pin(struct drm_i915_private *dev_priv, · 1 unmodified line
12781278 * port. Otherwise they share the same ddc bin and
12791279 * system couldn't communicate with them separately.
12801280 *
1281− * Give child device order the priority, first come first
1282− * served.
1281+ * Give inverse child device order the priority,
1282+ * last one wins. Yes, there are real machines
1283+ * (eg. Asrock B250M-HDV) where VBT has both
1284+ * port A and port E with the same AUX ch and
1285+ * we must pick port E :(
12831286 */
1287+ info = &dev_priv->vbt.ddi_port_info[p];
1288+
12841289 info->supports_dvi = false;
12851290 info->supports_hdmi = false;
12861291 info->alternate_ddc_pin = 0;
@@ -1316,7 +1321,7 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv, · 29 unmodified lines
13161321 DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, "
13171322 "disabling port %c DP support\n",
13181323 port_name(port), info->alternate_aux_channel,
1319− port_name(p), port_name(port));
1324+ port_name(p), port_name(p));
13201325
13211326 /*
13221327 * If we have multiple ports supposedlt sharing the
@@ -1324,9 +1329,14 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv, · 1 unmodified line
13241329 * port. Otherwise they share the same aux channel
13251330 * and system couldn't communicate with them separately.
13261331 *
1327− * Give child device order the priority, first come first
1328− * served.
1332+ * Give inverse child device order the priority,
1333+ * last one wins. Yes, there are real machines
1334+ * (eg. Asrock B250M-HDV) where VBT has both
1335+ * port A and port E with the same AUX ch and
1336+ * we must pick port E :(
13291337 */
1338+ info = &dev_priv->vbt.ddi_port_info[p];
1339+
13301340 info->supports_dp = false;
13311341 info->alternate_aux_channel = 0;
13321342 }
drivers/gpu/drm/i915/gem/i915_gem_mman.c+7−0
@@ -364,6 +364,7 @@ err: · 363 unmodified lines
364364 return VM_FAULT_OOM;
365365 case -ENOSPC:
366366 case -EFAULT:
367+ case -ENODEV: /* bad object, how did you get here! */
367368 return VM_FAULT_SIGBUS;
368369 default:
369370 WARN_ONCE(ret, "unhandled error in %s: %i\n", __func__, ret);
@@ -475,10 +476,16 @@ i915_gem_mmap_gtt(struct drm_file *file, · 105 unmodified lines
475476 if (!obj)
476477 return -ENOENT;
477478
479+ if (i915_gem_object_never_bind_ggtt(obj)) {
480+ ret = -ENODEV;
481+ goto out;
482+ }
483+
478484 ret = create_mmap_offset(obj);
479485 if (ret == 0)
480486 *offset = drm_vma_node_offset_addr(&obj->base.vma_node);
481487
488+out:
482489 i915_gem_object_put(obj);
483490 return ret;
484491 }
drivers/gpu/drm/i915/gem/i915_gem_object.h+6−0
@@ -152,6 +152,12 @@ i915_gem_object_is_proxy(const struct drm_i915_gem_object *obj) · 151 unmodified lines
152152 return obj->ops->flags & I915_GEM_OBJECT_IS_PROXY;
153153 }
154154
155+static inline bool
156+i915_gem_object_never_bind_ggtt(const struct drm_i915_gem_object *obj)
157+{
158+ return obj->ops->flags & I915_GEM_OBJECT_NO_GGTT;
159+}
160+
155161 static inline bool
156162 i915_gem_object_needs_async_cancel(const struct drm_i915_gem_object *obj)
157163 {
drivers/gpu/drm/i915/gem/i915_gem_object_types.h+2−1
@@ -32,7 +32,8 @@ struct drm_i915_gem_object_ops { · 31 unmodified lines
3232 #define I915_GEM_OBJECT_HAS_STRUCT_PAGE BIT(0)
3333 #define I915_GEM_OBJECT_IS_SHRINKABLE BIT(1)
3434 #define I915_GEM_OBJECT_IS_PROXY BIT(2)
35−#define I915_GEM_OBJECT_ASYNC_CANCEL BIT(3)
35+#define I915_GEM_OBJECT_NO_GGTT BIT(3)
36+#define I915_GEM_OBJECT_ASYNC_CANCEL BIT(4)
3637
3738 /* Interface between the GEM object and its backing storage.
3839 * get_pages() is called once prior to the use of the associated set
drivers/gpu/drm/i915/gem/i915_gem_userptr.c+1−0
@@ -702,6 +702,7 @@ i915_gem_userptr_dmabuf_export(struct drm_i915_gem_object *obj) · 701 unmodified lines
702702 static const struct drm_i915_gem_object_ops i915_gem_userptr_ops = {
703703 .flags = I915_GEM_OBJECT_HAS_STRUCT_PAGE |
704704 I915_GEM_OBJECT_IS_SHRINKABLE |
705+ I915_GEM_OBJECT_NO_GGTT |
705706 I915_GEM_OBJECT_ASYNC_CANCEL,
706707 .get_pages = i915_gem_userptr_get_pages,
707708 .put_pages = i915_gem_userptr_put_pages,
drivers/gpu/drm/i915/gt/intel_lrc.c+43−20
@@ -234,6 +234,13 @@ static void execlists_init_reg_state(u32 *reg_state, · 233 unmodified lines
234234 struct intel_engine_cs *engine,
235235 struct intel_ring *ring);
236236
237+static void mark_eio(struct i915_request *rq)
238+{
239+ if (!i915_request_signaled(rq))
240+ dma_fence_set_error(&rq->fence, -EIO);
241+ i915_request_mark_complete(rq);
242+}
243+
237244 static inline u32 intel_hws_preempt_address(struct intel_engine_cs *engine)
238245 {
239246 return (i915_ggtt_offset(engine->status_page.vma) +
@@ -1236,6 +1243,7 @@ static void execlists_dequeue(struct intel_engine_cs *engine) · 996 unmodified lines
12361243 submit = true;
12371244 last = rq;
12381245 }
1246+ i915_request_put(rq);
12391247
12401248 /*
12411249 * Hmm, we have a bunch of virtual engine requests,
@@ -2574,12 +2582,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 1332 unmodified lines
25742582 __execlists_reset(engine, true);
25752583
25762584 /* Mark all executing requests as skipped. */
2577− list_for_each_entry(rq, &engine->active.requests, sched.link) {
2578− if (!i915_request_signaled(rq))
2579− dma_fence_set_error(&rq->fence, -EIO);
2580−
2581− i915_request_mark_complete(rq);
2582− }
2585+ list_for_each_entry(rq, &engine->active.requests, sched.link)
2586+ mark_eio(rq);
25832587
25842588 /* Flush the queued requests to the timeline list (for retiring). */
25852589 while ((rb = rb_first_cached(&execlists->queue))) {
@@ -2587,9 +2591,8 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 1 unmodified line
25872591 int i;
25882592
25892593 priolist_for_each_request_consume(rq, rn, p, i) {
2594+ mark_eio(rq);
25902595 __i915_request_submit(rq);
2591− dma_fence_set_error(&rq->fence, -EIO);
2592− i915_request_mark_complete(rq);
25932596 }
25942597
25952598 rb_erase_cached(&p->node, &execlists->queue);
@@ -2605,13 +2608,15 @@ static void execlists_cancel_requests(struct intel_engine_cs *engine) · 9 unmodified lines
26052608 RB_CLEAR_NODE(rb);
26062609
26072610 spin_lock(&ve->base.active.lock);
2608− if (ve->request) {
2609− ve->request->engine = engine;
2610− __i915_request_submit(ve->request);
2611− dma_fence_set_error(&ve->request->fence, -EIO);
2612− i915_request_mark_complete(ve->request);
2611+ rq = fetch_and_zero(&ve->request);
2612+ if (rq) {
2613+ mark_eio(rq);
2614+
2615+ rq->engine = engine;
2616+ __i915_request_submit(rq);
2617+ i915_request_put(rq);
2618+
26132619 ve->base.execlists.queue_priority_hint = INT_MIN;
2614− ve->request = NULL;
26152620 }
26162621 spin_unlock(&ve->base.active.lock);
26172622 }
@@ -3615,6 +3620,8 @@ submit_engine: · 997 unmodified lines
36153620 static void virtual_submit_request(struct i915_request *rq)
36163621 {
36173622 struct virtual_engine *ve = to_virtual_engine(rq->engine);
3623+ struct i915_request *old;
3624+ unsigned long flags;
36183625
36193626 GEM_TRACE("%s: rq=%llx:%lld\n",
36203627 ve->base.name,
@@ -3623,15 +3630,31 @@ static void virtual_submit_request(struct i915_request *rq) · 2 unmodified lines
36233630
36243631 GEM_BUG_ON(ve->base.submit_request != virtual_submit_request);
36253632
3626− GEM_BUG_ON(ve->request);
3627− GEM_BUG_ON(!list_empty(virtual_queue(ve)));
3633+ spin_lock_irqsave(&ve->base.active.lock, flags);
3634+
3635+ old = ve->request;
3636+ if (old) { /* background completion event from preempt-to-busy */
3637+ GEM_BUG_ON(!i915_request_completed(old));
3638+ __i915_request_submit(old);
3639+ i915_request_put(old);
3640+ }
36283641
3629− ve->base.execlists.queue_priority_hint = rq_prio(rq);
3630− WRITE_ONCE(ve->request, rq);
3642+ if (i915_request_completed(rq)) {
3643+ __i915_request_submit(rq);
36313644
3632− list_move_tail(&rq->sched.link, virtual_queue(ve));
3645+ ve->base.execlists.queue_priority_hint = INT_MIN;
3646+ ve->request = NULL;
3647+ } else {
3648+ ve->base.execlists.queue_priority_hint = rq_prio(rq);
3649+ ve->request = i915_request_get(rq);
3650+
3651+ GEM_BUG_ON(!list_empty(virtual_queue(ve)));
3652+ list_move_tail(&rq->sched.link, virtual_queue(ve));
3653+
3654+ tasklet_schedule(&ve->base.execlists.tasklet);
3655+ }
36333656
3634− tasklet_schedule(&ve->base.execlists.tasklet);
3657+ spin_unlock_irqrestore(&ve->base.active.lock, flags);
36353658 }
36363659
36373660 static struct ve_bond *
drivers/gpu/drm/i915/i915_gem.c+3−0
@@ -969,6 +969,9 @@ i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj, · 968 unmodified lines
969969
970970 lockdep_assert_held(&obj->base.dev->struct_mutex);
971971
972+ if (i915_gem_object_never_bind_ggtt(obj))
973+ return ERR_PTR(-ENODEV);
974+
972975 if (flags & PIN_MAPPABLE &&
973976 (!view || view->type == I915_GGTT_VIEW_NORMAL)) {
974977 /* If the required space is larger than the available
drivers/gpu/drm/msm/dsi/dsi_host.c+4−2
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626 #include "dsi_cfg.h"
2727 #include "msm_kms.h"
2828
29+#define DSI_RESET_TOGGLE_DELAY_MS 20
30+
2931 static int dsi_get_version(const void __iomem *base, u32 *major, u32 *minor)
3032 {
3133 u32 ver;
@@ -986,7 +988,7 @@ static void dsi_sw_reset(struct msm_dsi_host *msm_host) · 954 unmodified lines
986988 wmb(); /* clocks need to be enabled before reset */
987989
988990 dsi_write(msm_host, REG_DSI_RESET, 1);
989− wmb(); /* make sure reset happen */
991+ msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */
990992 dsi_write(msm_host, REG_DSI_RESET, 0);
991993 }
992994
@@ -1396,7 +1398,7 @@ static void dsi_sw_reset_restore(struct msm_dsi_host *msm_host) · 403 unmodified lines
13961398
13971399 /* dsi controller can only be reset while clocks are running */
13981400 dsi_write(msm_host, REG_DSI_RESET, 1);
1399− wmb(); /* make sure reset happen */
1401+ msleep(DSI_RESET_TOGGLE_DELAY_MS); /* make sure reset happen */
14001402 dsi_write(msm_host, REG_DSI_RESET, 0);
14011403 wmb(); /* controller out of reset */
14021404 dsi_write(msm_host, REG_DSI_CTRL, data0);
drivers/gpu/drm/panfrost/panfrost_gpu.c+3−0
@@ -208,6 +208,9 @@ static void panfrost_gpu_init_features(struct panfrost_device *pfdev) · 207 unmodified lines
208208 pfdev->features.mem_features = gpu_read(pfdev, GPU_MEM_FEATURES);
209209 pfdev->features.mmu_features = gpu_read(pfdev, GPU_MMU_FEATURES);
210210 pfdev->features.thread_features = gpu_read(pfdev, GPU_THREAD_FEATURES);
211+ pfdev->features.max_threads = gpu_read(pfdev, GPU_THREAD_MAX_THREADS);
212+ pfdev->features.thread_max_workgroup_sz = gpu_read(pfdev, GPU_THREAD_MAX_WORKGROUP_SIZE);
213+ pfdev->features.thread_max_barrier_sz = gpu_read(pfdev, GPU_THREAD_MAX_BARRIER_SIZE);
211214 pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES);
212215 for (i = 0; i < 4; i++)
213216 pfdev->features.texture_features[i] = gpu_read(pfdev, GPU_TEXTURE_FEATURES(i));
drivers/gpu/drm/panfrost/panfrost_job.c+11−5
@@ -381,13 +381,19 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) · 380 unmodified lines
381381 job_read(pfdev, JS_TAIL_LO(js)),
382382 sched_job);
383383
384− mutex_lock(&pfdev->reset_lock);
384+ if (!mutex_trylock(&pfdev->reset_lock))
385+ return;
385386
386− for (i = 0; i < NUM_JOB_SLOTS; i++)
387− drm_sched_stop(&pfdev->js->queue[i].sched, sched_job);
387+ for (i = 0; i < NUM_JOB_SLOTS; i++) {
388+ struct drm_gpu_scheduler *sched = &pfdev->js->queue[i].sched;
389+
390+ drm_sched_stop(sched, sched_job);
391+ if (js != i)
392+ /* Ensure any timeouts on other slots have finished */
393+ cancel_delayed_work_sync(&sched->work_tdr);
394+ }
388395
389− if (sched_job)
390− drm_sched_increase_karma(sched_job);
396+ drm_sched_increase_karma(sched_job);
391397
392398 spin_lock_irqsave(&pfdev->js->job_lock, flags);
393399 for (i = 0; i < NUM_JOB_SLOTS; i++) {
drivers/gpu/drm/radeon/radeon_drv.c+0−8
@@ -379,19 +379,11 @@ radeon_pci_remove(struct pci_dev *pdev) · 378 unmodified lines
379379 static void
380380 radeon_pci_shutdown(struct pci_dev *pdev)
381381 {
382− struct drm_device *ddev = pci_get_drvdata(pdev);
383−
384382 /* if we are running in a VM, make sure the device
385383 * torn down properly on reboot/shutdown
386384 */
387385 if (radeon_device_is_virtual())
388386 radeon_pci_remove(pdev);
389−
390− /* Some adapters need to be suspended before a
391− * shutdown occurs in order to prevent an error
392− * during kexec.
393− */
394− radeon_suspend_kms(ddev, true, true, false);
395387 }
396388
397389 static int radeon_pmops_suspend(struct device *dev)
drivers/gpu/drm/tiny/Kconfig+0−1
@@ -63,7 +63,6 @@ config TINYDRM_REPAPER · 62 unmodified lines
6363 depends on DRM && SPI
6464 select DRM_KMS_HELPER
6565 select DRM_KMS_CMA_HELPER
66− depends on THERMAL || !THERMAL
6766 help
6867 DRM driver for the following Pervasive Displays panels:
6968 1.44" TFT EPD Panel (E1144CS021)
drivers/gpu/drm/ttm/ttm_bo.c+5−4
@@ -185,8 +185,9 @@ static void ttm_bo_add_mem_to_lru(struct ttm_buffer_object *bo, · 184 unmodified lines
185185 list_add_tail(&bo->lru, &man->lru[bo->priority]);
186186 kref_get(&bo->list_kref);
187187
188− if (bo->ttm && !(bo->ttm->page_flags &
189− (TTM_PAGE_FLAG_SG | TTM_PAGE_FLAG_SWAPPED))) {
188+ if (!(man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm &&
189+ !(bo->ttm->page_flags & (TTM_PAGE_FLAG_SG |
190+ TTM_PAGE_FLAG_SWAPPED))) {
190191 list_add_tail(&bo->swap, &bdev->glob->swap_lru[bo->priority]);
191192 kref_get(&bo->list_kref);
192193 }
@@ -878,11 +879,11 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, · 685 unmodified lines
878879
879880 if (!bo) {
880881 if (busy_bo)
881− ttm_bo_get(busy_bo);
882+ kref_get(&busy_bo->list_kref);
882883 spin_unlock(&glob->lru_lock);
883884 ret = ttm_mem_evict_wait_busy(busy_bo, ctx, ticket);
884885 if (busy_bo)
885− ttm_bo_put(busy_bo);
886+ kref_put(&busy_bo->list_kref, ttm_bo_release_list);
886887 return ret;
887888 }
888889
drivers/gpu/drm/ttm/ttm_bo_vm.c+7−9
@@ -278,15 +278,13 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) · 277 unmodified lines
278278 else
279279 ret = vmf_insert_pfn(&cvma, address, pfn);
280280
281− /*
282− * Somebody beat us to this PTE or prefaulting to
283− * an already populated PTE, or prefaulting error.
284− */
285−
286− if (unlikely((ret == VM_FAULT_NOPAGE && i > 0)))
287− break;
288− else if (unlikely(ret & VM_FAULT_ERROR))
289− goto out_io_unlock;
281+ /* Never error on prefaulted PTEs */
282+ if (unlikely((ret & VM_FAULT_ERROR))) {
283+ if (i == 0)
284+ goto out_io_unlock;
285+ else
286+ break;
287+ }
290288
291289 address += PAGE_SIZE;
292290 if (unlikely(++page_offset >= page_last))
drivers/i2c/busses/i2c-aspeed.c+34−20
@@ -108,6 +108,12 @@ · 107 unmodified lines
108108 #define ASPEED_I2CD_S_TX_CMD BIT(2)
109109 #define ASPEED_I2CD_M_TX_CMD BIT(1)
110110 #define ASPEED_I2CD_M_START_CMD BIT(0)
111+#define ASPEED_I2CD_MASTER_CMDS_MASK \
112+ (ASPEED_I2CD_M_STOP_CMD | \
113+ ASPEED_I2CD_M_S_RX_CMD_LAST | \
114+ ASPEED_I2CD_M_RX_CMD | \
115+ ASPEED_I2CD_M_TX_CMD | \
116+ ASPEED_I2CD_M_START_CMD)
111117
112118 /* 0x18 : I2CD Slave Device Address Register */
113119 #define ASPEED_I2CD_DEV_ADDR_MASK GENMASK(6, 0)
@@ -336,18 +342,19 @@ static void aspeed_i2c_do_start(struct aspeed_i2c_bus *bus) · 222 unmodified lines
336342 struct i2c_msg *msg = &bus->msgs[bus->msgs_index];
337343 u8 slave_addr = i2c_8bit_addr_from_msg(msg);
338344
339− bus->master_state = ASPEED_I2C_MASTER_START;
340−
341345 #if IS_ENABLED(CONFIG_I2C_SLAVE)
342346 /*
343347 * If it's requested in the middle of a slave session, set the master
344348 * state to 'pending' then H/W will continue handling this master
345349 * command when the bus comes back to the idle state.
346350 */
347− if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE)
351+ if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE) {
348352 bus->master_state = ASPEED_I2C_MASTER_PENDING;
353+ return;
354+ }
349355 #endif /* CONFIG_I2C_SLAVE */
350356
357+ bus->master_state = ASPEED_I2C_MASTER_START;
351358 bus->buf_index = 0;
352359
353360 if (msg->flags & I2C_M_RD) {
@@ -422,20 +429,6 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) · 68 unmodified lines
422429 }
423430 }
424431
425−#if IS_ENABLED(CONFIG_I2C_SLAVE)
426− /*
427− * A pending master command will be started by H/W when the bus comes
428− * back to idle state after completing a slave operation so change the
429− * master state from 'pending' to 'start' at here if slave is inactive.
430− */
431− if (bus->master_state == ASPEED_I2C_MASTER_PENDING) {
432− if (bus->slave_state != ASPEED_I2C_SLAVE_INACTIVE)
433− goto out_no_complete;
434−
435− bus->master_state = ASPEED_I2C_MASTER_START;
436− }
437−#endif /* CONFIG_I2C_SLAVE */
438−
439432 /* Master is not currently active, irq was for someone else. */
440433 if (bus->master_state == ASPEED_I2C_MASTER_INACTIVE ||
441434 bus->master_state == ASPEED_I2C_MASTER_PENDING)
@@ -462,11 +455,15 @@ static u32 aspeed_i2c_master_irq(struct aspeed_i2c_bus *bus, u32 irq_status) · 20 unmodified lines
462455 #if IS_ENABLED(CONFIG_I2C_SLAVE)
463456 /*
464457 * If a peer master starts a xfer immediately after it queues a
465− * master command, change its state to 'pending' then H/W will
466− * continue the queued master xfer just after completing the
467− * slave mode session.
458+ * master command, clear the queued master command and change
459+ * its state to 'pending'. To simplify handling of pending
460+ * cases, it uses S/W solution instead of H/W command queue
461+ * handling.
468462 */
469463 if (unlikely(irq_status & ASPEED_I2CD_INTR_SLAVE_MATCH)) {
464+ writel(readl(bus->base + ASPEED_I2C_CMD_REG) &
465+ ~ASPEED_I2CD_MASTER_CMDS_MASK,
466+ bus->base + ASPEED_I2C_CMD_REG);
470467 bus->master_state = ASPEED_I2C_MASTER_PENDING;
471468 dev_dbg(bus->dev,
472469 "master goes pending due to a slave start\n");
@@ -629,6 +626,14 @@ static irqreturn_t aspeed_i2c_bus_irq(int irq, void *dev_id) · 156 unmodified lines
629626 irq_handled |= aspeed_i2c_master_irq(bus,
630627 irq_remaining);
631628 }
629+
630+ /*
631+ * Start a pending master command at here if a slave operation is
632+ * completed.
633+ */
634+ if (bus->master_state == ASPEED_I2C_MASTER_PENDING &&
635+ bus->slave_state == ASPEED_I2C_SLAVE_INACTIVE)
636+ aspeed_i2c_do_start(bus);
632637 #else
633638 irq_handled = aspeed_i2c_master_irq(bus, irq_remaining);
634639 #endif /* CONFIG_I2C_SLAVE */
@@ -691,6 +696,15 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap, · 56 unmodified lines
691696 ASPEED_I2CD_BUS_BUSY_STS))
692697 aspeed_i2c_recover_bus(bus);
693698
699+ /*
700+ * If timed out and the state is still pending, drop the pending
701+ * master command.
702+ */
703+ spin_lock_irqsave(&bus->lock, flags);
704+ if (bus->master_state == ASPEED_I2C_MASTER_PENDING)
705+ bus->master_state = ASPEED_I2C_MASTER_INACTIVE;
706+ spin_unlock_irqrestore(&bus->lock, flags);
707+
694708 return -ETIMEDOUT;
695709 }
696710
drivers/i2c/busses/i2c-mt65xx.c+1−1
@@ -875,7 +875,7 @@ static irqreturn_t mtk_i2c_irq(int irqno, void *dev_id) · 874 unmodified lines
875875
876876 static u32 mtk_i2c_functionality(struct i2c_adapter *adap)
877877 {
878− if (adap->quirks->flags & I2C_AQ_NO_ZERO_LEN)
878+ if (i2c_check_quirks(adap, I2C_AQ_NO_ZERO_LEN))
879879 return I2C_FUNC_I2C |
880880 (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
881881 else
drivers/i2c/busses/i2c-stm32f7.c+13−8
@@ -305,7 +305,7 @@ struct stm32f7_i2c_dev { · 304 unmodified lines
305305 struct regmap *regmap;
306306 };
307307
308−/**
308+/*
309309 * All these values are coming from I2C Specification, Version 6.0, 4th of
310310 * April 2014.
311311 *
@@ -1192,6 +1192,8 @@ static void stm32f7_i2c_slave_start(struct stm32f7_i2c_dev *i2c_dev) · 880 unmodified lines
11921192 STM32F7_I2C_CR1_TXIE;
11931193 stm32f7_i2c_set_bits(base + STM32F7_I2C_CR1, mask);
11941194
1195+ /* Write 1st data byte */
1196+ writel_relaxed(value, base + STM32F7_I2C_TXDR);
11951197 } else {
11961198 /* Notify i2c slave that new write transfer is starting */
11971199 i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
@@ -1501,7 +1503,7 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data) · 303 unmodified lines
15011503 void __iomem *base = i2c_dev->base;
15021504 struct device *dev = i2c_dev->dev;
15031505 struct stm32_i2c_dma *dma = i2c_dev->dma;
1504− u32 mask, status;
1506+ u32 status;
15051507
15061508 status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR);
15071509
@@ -1526,12 +1528,15 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data) · 18 unmodified lines
15261528 f7_msg->result = -EINVAL;
15271529 }
15281530
1529− /* Disable interrupts */
1530− if (stm32f7_i2c_is_slave_registered(i2c_dev))
1531− mask = STM32F7_I2C_XFER_IRQ_MASK;
1532− else
1533− mask = STM32F7_I2C_ALL_IRQ_MASK;
1534− stm32f7_i2c_disable_irq(i2c_dev, mask);
1531+ if (!i2c_dev->slave_running) {
1532+ u32 mask;
1533+ /* Disable interrupts */
1534+ if (stm32f7_i2c_is_slave_registered(i2c_dev))
1535+ mask = STM32F7_I2C_XFER_IRQ_MASK;
1536+ else
1537+ mask = STM32F7_I2C_ALL_IRQ_MASK;
1538+ stm32f7_i2c_disable_irq(i2c_dev, mask);
1539+ }
15351540
15361541 /* Disable dma */
15371542 if (i2c_dev->use_dma) {
drivers/input/misc/da9063_onkey.c+1−4
@@ -232,10 +232,7 @@ static int da9063_onkey_probe(struct platform_device *pdev) · 231 unmodified lines
232232 onkey->input->phys = onkey->phys;
233233 onkey->input->dev.parent = &pdev->dev;
234234
235− if (onkey->key_power)
236− input_set_capability(onkey->input, EV_KEY, KEY_POWER);
237−
238− input_set_capability(onkey->input, EV_KEY, KEY_SLEEP);
235+ input_set_capability(onkey->input, EV_KEY, KEY_POWER);
239236
240237 INIT_DELAYED_WORK(&onkey->work, da9063_poll_on);
241238
drivers/input/misc/soc_button_array.c+12−5
@@ -92,11 +92,18 @@ soc_button_device_create(struct platform_device *pdev, · 91 unmodified lines
9292 continue;
9393
9494 gpio = soc_button_lookup_gpio(&pdev->dev, info->acpi_index);
95− if (gpio < 0 && gpio != -ENOENT) {
96− error = gpio;
97− goto err_free_mem;
98− } else if (!gpio_is_valid(gpio)) {
99− /* Skip GPIO if not present */
95+ if (!gpio_is_valid(gpio)) {
96+ /*
97+ * Skip GPIO if not present. Note we deliberately
98+ * ignore -EPROBE_DEFER errors here. On some devices
99+ * Intel is using so called virtual GPIOs which are not
100+ * GPIOs at all but some way for AML code to check some
101+ * random status bits without need a custom opregion.
102+ * In some cases the resources table we parse points to
103+ * such a virtual GPIO, since these are not real GPIOs
104+ * we do not have a driver for these so they will never
105+ * show up, therefore we ignore -EPROBE_DEFER.
106+ */
100107 continue;
101108 }
102109
drivers/input/mouse/elantech.c+29−26
@@ -1827,31 +1827,6 @@ static int elantech_create_smbus(struct psmouse *psmouse, · 1826 unmodified lines
18271827 leave_breadcrumbs);
18281828 }
18291829
1830−static bool elantech_use_host_notify(struct psmouse *psmouse,
1831− struct elantech_device_info *info)
1832−{
1833− if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
1834− return true;
1835−
1836− switch (info->bus) {
1837− case ETP_BUS_PS2_ONLY:
1838− /* expected case */
1839− break;
1840− case ETP_BUS_SMB_HST_NTFY_ONLY:
1841− case ETP_BUS_PS2_SMB_HST_NTFY:
1842− /* SMbus implementation is stable since 2018 */
1843− if (dmi_get_bios_year() >= 2018)
1844− return true;
1845− /* fall through */
1846− default:
1847− psmouse_dbg(psmouse,
1848− "Ignoring SMBus bus provider %d\n", info->bus);
1849− break;
1850− }
1851−
1852− return false;
1853−}
1854−
18551830 /**
18561831 * elantech_setup_smbus - called once the PS/2 devices are enumerated
18571832 * and decides to instantiate a SMBus InterTouch device.
@@ -1871,7 +1846,7 @@ static int elantech_setup_smbus(struct psmouse *psmouse, · 13 unmodified lines
18711846 * i2c_blacklist_pnp_ids.
18721847 * Old ICs are up to the user to decide.
18731848 */
1874− if (!elantech_use_host_notify(psmouse, info) ||
1849+ if (!ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version) ||
18751850 psmouse_matches_pnp_id(psmouse, i2c_blacklist_pnp_ids))
18761851 return -ENXIO;
18771852 }
@@ -1891,6 +1866,34 @@ static int elantech_setup_smbus(struct psmouse *psmouse, · 13 unmodified lines
18911866 return 0;
18921867 }
18931868
1869+static bool elantech_use_host_notify(struct psmouse *psmouse,
1870+ struct elantech_device_info *info)
1871+{
1872+ if (ETP_NEW_IC_SMBUS_HOST_NOTIFY(info->fw_version))
1873+ return true;
1874+
1875+ switch (info->bus) {
1876+ case ETP_BUS_PS2_ONLY:
1877+ /* expected case */
1878+ break;
1879+ case ETP_BUS_SMB_ALERT_ONLY:
1880+ /* fall-through */
1881+ case ETP_BUS_PS2_SMB_ALERT:
1882+ psmouse_dbg(psmouse, "Ignoring SMBus provider through alert protocol.\n");
1883+ break;
1884+ case ETP_BUS_SMB_HST_NTFY_ONLY:
1885+ /* fall-through */
1886+ case ETP_BUS_PS2_SMB_HST_NTFY:
1887+ return true;
1888+ default:
1889+ psmouse_dbg(psmouse,
1890+ "Ignoring SMBus bus provider %d.\n",
1891+ info->bus);
1892+ }
1893+
1894+ return false;
1895+}
1896+
18941897 int elantech_init_smbus(struct psmouse *psmouse)
18951898 {
18961899 struct elantech_device_info info;
drivers/input/rmi4/rmi_driver.c+5−1
@@ -146,7 +146,7 @@ static int rmi_process_interrupt_requests(struct rmi_device *rmi_dev) · 145 unmodified lines
146146 }
147147
148148 mutex_lock(&data->irq_mutex);
149− bitmap_and(data->irq_status, data->irq_status, data->current_irq_mask,
149+ bitmap_and(data->irq_status, data->irq_status, data->fn_irq_bits,
150150 data->irq_count);
151151 /*
152152 * At this point, irq_status has all bits that are set in the
@@ -385,6 +385,8 @@ static int rmi_driver_set_irq_bits(struct rmi_device *rmi_dev, · 232 unmodified lines
385385 bitmap_copy(data->current_irq_mask, data->new_irq_mask,
386386 data->num_of_irq_regs);
387387
388+ bitmap_or(data->fn_irq_bits, data->fn_irq_bits, mask, data->irq_count);
389+
388390 error_unlock:
389391 mutex_unlock(&data->irq_mutex);
390392 return error;
@@ -398,6 +400,8 @@ static int rmi_driver_clear_irq_bits(struct rmi_device *rmi_dev, · 7 unmodified lines
398400 struct device *dev = &rmi_dev->dev;
399401
400402 mutex_lock(&data->irq_mutex);
403+ bitmap_andnot(data->fn_irq_bits,
404+ data->fn_irq_bits, mask, data->irq_count);
401405 bitmap_andnot(data->new_irq_mask,
402406 data->current_irq_mask, mask, data->irq_count);
403407
drivers/input/touchscreen/goodix.c+50−8
@@ -53,6 +53,7 @@ struct goodix_ts_data { · 52 unmodified lines
5353 const char *cfg_name;
5454 struct completion firmware_loading_complete;
5555 unsigned long irq_flags;
56+ unsigned int contact_size;
5657 };
5758
5859 #define GOODIX_GPIO_INT_NAME "irq"
@@ -62,6 +63,7 @@ struct goodix_ts_data { · 3 unmodified lines
6263 #define GOODIX_MAX_WIDTH 4096
6364 #define GOODIX_INT_TRIGGER 1
6465 #define GOODIX_CONTACT_SIZE 8
66+#define GOODIX_MAX_CONTACT_SIZE 9
6567 #define GOODIX_MAX_CONTACTS 10
6668
6769 #define GOODIX_CONFIG_MAX_LENGTH 240
@@ -144,6 +146,19 @@ static const struct dmi_system_id rotated_screen[] = { · 76 unmodified lines
144146 {}
145147 };
146148
149+static const struct dmi_system_id nine_bytes_report[] = {
150+#if defined(CONFIG_DMI) && defined(CONFIG_X86)
151+ {
152+ .ident = "Lenovo YogaBook",
153+ /* YB1-X91L/F and YB1-X90L/F */
154+ .matches = {
155+ DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9")
156+ }
157+ },
158+#endif
159+ {}
160+};
161+
147162 /**
148163 * goodix_i2c_read - read data from a register of the i2c slave device.
149164 *
@@ -249,7 +264,7 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) · 99 unmodified lines
249264 max_timeout = jiffies + msecs_to_jiffies(GOODIX_BUFFER_STATUS_TIMEOUT);
250265 do {
251266 error = goodix_i2c_read(ts->client, GOODIX_READ_COOR_ADDR,
252− data, GOODIX_CONTACT_SIZE + 1);
267+ data, ts->contact_size + 1);
253268 if (error) {
254269 dev_err(&ts->client->dev, "I2C transfer error: %d\n",
255270 error);
@@ -262,12 +277,12 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) · 6 unmodified lines
262277 return -EPROTO;
263278
264279 if (touch_num > 1) {
265− data += 1 + GOODIX_CONTACT_SIZE;
280+ data += 1 + ts->contact_size;
266281 error = goodix_i2c_read(ts->client,
267282 GOODIX_READ_COOR_ADDR +
268− 1 + GOODIX_CONTACT_SIZE,
283+ 1 + ts->contact_size,
269284 data,
270− GOODIX_CONTACT_SIZE *
285+ ts->contact_size *
271286 (touch_num - 1));
272287 if (error)
273288 return error;
@@ -286,7 +301,7 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) · 12 unmodified lines
286301 return 0;
287302 }
288303
289−static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data)
304+static void goodix_ts_report_touch_8b(struct goodix_ts_data *ts, u8 *coor_data)
290305 {
291306 int id = coor_data[0] & 0x0F;
292307 int input_x = get_unaligned_le16(&coor_data[1]);
@@ -301,6 +316,21 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) · 8 unmodified lines
301316 input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w);
302317 }
303318
319+static void goodix_ts_report_touch_9b(struct goodix_ts_data *ts, u8 *coor_data)
320+{
321+ int id = coor_data[1] & 0x0F;
322+ int input_x = get_unaligned_le16(&coor_data[3]);
323+ int input_y = get_unaligned_le16(&coor_data[5]);
324+ int input_w = get_unaligned_le16(&coor_data[7]);
325+
326+ input_mt_slot(ts->input_dev, id);
327+ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
328+ touchscreen_report_pos(ts->input_dev, &ts->prop,
329+ input_x, input_y, true);
330+ input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, input_w);
331+ input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, input_w);
332+}
333+
304334 /**
305335 * goodix_process_events - Process incoming events
306336 *
@@ -311,7 +341,7 @@ static void goodix_ts_report_touch(struct goodix_ts_data *ts, u8 *coor_data) · 4 unmodified lines
311341 */
312342 static void goodix_process_events(struct goodix_ts_data *ts)
313343 {
314− u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
344+ u8 point_data[1 + GOODIX_MAX_CONTACT_SIZE * GOODIX_MAX_CONTACTS];
315345 int touch_num;
316346 int i;
317347
@@ -326,8 +356,12 @@ static void goodix_process_events(struct goodix_ts_data *ts) · 8 unmodified lines
326356 input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4));
327357
328358 for (i = 0; i < touch_num; i++)
329− goodix_ts_report_touch(ts,
330− &point_data[1 + GOODIX_CONTACT_SIZE * i]);
359+ if (ts->contact_size == 9)
360+ goodix_ts_report_touch_9b(ts,
361+ &point_data[1 + ts->contact_size * i]);
362+ else
363+ goodix_ts_report_touch_8b(ts,
364+ &point_data[1 + ts->contact_size * i]);
331365
332366 input_mt_sync_frame(ts->input_dev);
333367 input_sync(ts->input_dev);
@@ -730,6 +764,13 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) · 396 unmodified lines
730764 "Applying '180 degrees rotated screen' quirk\n");
731765 }
732766
767+ if (dmi_check_system(nine_bytes_report)) {
768+ ts->contact_size = 9;
769+
770+ dev_dbg(&ts->client->dev,
771+ "Non-standard 9-bytes report format quirk\n");
772+ }
773+
733774 error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
734775 INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
735776 if (error) {
@@ -810,6 +851,7 @@ static int goodix_ts_probe(struct i2c_client *client, · 74 unmodified lines
810851 ts->client = client;
811852 i2c_set_clientdata(client, ts);
812853 init_completion(&ts->firmware_loading_complete);
854+ ts->contact_size = GOODIX_CONTACT_SIZE;
813855
814856 error = goodix_get_gpio_config(ts);
815857 if (error)
drivers/input/touchscreen/st1232.c+4−2
@@ -81,8 +81,10 @@ static int st1232_ts_read_data(struct st1232_ts_data *ts) · 80 unmodified lines
8181 for (i = 0, y = 0; i < ts->chip_info->max_fingers; i++, y += 3) {
8282 finger[i].is_valid = buf[i + y] >> 7;
8383 if (finger[i].is_valid) {
84− finger[i].x = ((buf[i + y] & 0x0070) << 4) | buf[i + 1];
85− finger[i].y = ((buf[i + y] & 0x0007) << 8) | buf[i + 2];
84+ finger[i].x = ((buf[i + y] & 0x0070) << 4) |
85+ buf[i + y + 1];
86+ finger[i].y = ((buf[i + y] & 0x0007) << 8) |
87+ buf[i + y + 2];
8688
8789 /* st1232 includes a z-axis / touch strength */
8890 if (ts->chip_info->have_z)
drivers/iommu/amd_iommu.c+7−5
@@ -583,7 +583,8 @@ static void iommu_print_event(struct amd_iommu *iommu, void *__evt) · 582 unmodified lines
583583 retry:
584584 type = (event[1] >> EVENT_TYPE_SHIFT) & EVENT_TYPE_MASK;
585585 devid = (event[0] >> EVENT_DEVID_SHIFT) & EVENT_DEVID_MASK;
586− pasid = PPR_PASID(*(u64 *)&event[0]);
586+ pasid = (event[0] & EVENT_DOMID_MASK_HI) |
587+ (event[1] & EVENT_DOMID_MASK_LO);
587588 flags = (event[1] >> EVENT_FLAGS_SHIFT) & EVENT_FLAGS_MASK;
588589 address = (u64)(((u64)event[3]) << 32) | event[2];
589590
@@ -616,7 +617,7 @@ retry: · 26 unmodified lines
616617 address, flags);
617618 break;
618619 case EVENT_TYPE_PAGE_TAB_ERR:
619− dev_err(dev, "Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x domain=0x%04x address=0x%llx flags=0x%04x]\n",
620+ dev_err(dev, "Event logged [PAGE_TAB_HARDWARE_ERROR device=%02x:%02x.%x pasid=0x%04x address=0x%llx flags=0x%04x]\n",
620621 PCI_BUS_NUM(devid), PCI_SLOT(devid), PCI_FUNC(devid),
621622 pasid, address, flags);
622623 break;
@@ -1463,6 +1464,7 @@ static void free_pagetable(struct protection_domain *domain) · 840 unmodified lines
14631464 * to 64 bits.
14641465 */
14651466 static bool increase_address_space(struct protection_domain *domain,
1467+ unsigned long address,
14661468 gfp_t gfp)
14671469 {
14681470 unsigned long flags;
@@ -1471,8 +1473,8 @@ static bool increase_address_space(struct protection_domain *domain, · 2 unmodified lines
14711473
14721474 spin_lock_irqsave(&domain->lock, flags);
14731475
1474− if (WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL))
1475− /* address space already 64 bit large */
1476+ if (address <= PM_LEVEL_SIZE(domain->mode) ||
1477+ WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL))
14761478 goto out;
14771479
14781480 pte = (void *)get_zeroed_page(gfp);
@@ -1505,7 +1507,7 @@ static u64 *alloc_pte(struct protection_domain *domain, · 26 unmodified lines
15051507 BUG_ON(!is_power_of_2(page_size));
15061508
15071509 while (address > PM_LEVEL_SIZE(domain->mode))
1508− *updated = increase_address_space(domain, gfp) || *updated;
1510+ *updated = increase_address_space(domain, address, gfp) || *updated;
15091511
15101512 level = domain->mode - 1;
15111513 pte = &domain->pt_root[PM_LEVEL_INDEX(level, address)];
drivers/iommu/amd_iommu_types.h+2−2
@@ -130,8 +130,8 @@ · 129 unmodified lines
130130 #define EVENT_TYPE_INV_PPR_REQ 0x9
131131 #define EVENT_DEVID_MASK 0xffff
132132 #define EVENT_DEVID_SHIFT 0
133−#define EVENT_DOMID_MASK 0xffff
134−#define EVENT_DOMID_SHIFT 0
133+#define EVENT_DOMID_MASK_LO 0xffff
134+#define EVENT_DOMID_MASK_HI 0xf0000
135135 #define EVENT_FLAGS_MASK 0xfff
136136 #define EVENT_FLAGS_SHIFT 0x10
137137
drivers/iommu/arm-smmu.c+1−0
@@ -812,6 +812,7 @@ static int arm_smmu_init_domain_context(struct iommu_domain *domain, · 811 unmodified lines
812812 return 0;
813813
814814 out_clear_smmu:
815+ __arm_smmu_free_bitmap(smmu->context_map, cfg->cbndx);
815816 smmu_domain->smmu = NULL;
816817 out_unlock:
817818 mutex_unlock(&smmu_domain->init_mutex);
drivers/iommu/intel-iommu.c+9−1
@@ -3471,7 +3471,7 @@ static bool iommu_need_mapping(struct device *dev) · 3470 unmodified lines
34713471 if (dev->coherent_dma_mask && dev->coherent_dma_mask < dma_mask)
34723472 dma_mask = dev->coherent_dma_mask;
34733473
3474− if (dma_mask >= dma_get_required_mask(dev))
3474+ if (dma_mask >= dma_direct_get_required_mask(dev))
34753475 return false;
34763476
34773477 /*
@@ -3775,6 +3775,13 @@ static int intel_map_sg(struct device *dev, struct scatterlist *sglist, int nele · 297 unmodified lines
37753775 return nelems;
37763776 }
37773777
3778+static u64 intel_get_required_mask(struct device *dev)
3779+{
3780+ if (!iommu_need_mapping(dev))
3781+ return dma_direct_get_required_mask(dev);
3782+ return DMA_BIT_MASK(32);
3783+}
3784+
37783785 static const struct dma_map_ops intel_dma_ops = {
37793786 .alloc = intel_alloc_coherent,
37803787 .free = intel_free_coherent,
@@ -3787,6 +3794,7 @@ static const struct dma_map_ops intel_dma_ops = { · 6 unmodified lines
37873794 .dma_supported = dma_direct_supported,
37883795 .mmap = dma_common_mmap,
37893796 .get_sgtable = dma_common_get_sgtable,
3797+ .get_required_mask = intel_get_required_mask,
37903798 };
37913799
37923800 static void
drivers/iommu/io-pgtable-arm.c+45−13
@@ -166,6 +166,9 @@ · 165 unmodified lines
166166 #define ARM_MALI_LPAE_TTBR_READ_INNER BIT(2)
167167 #define ARM_MALI_LPAE_TTBR_SHARE_OUTER BIT(4)
168168
169+#define ARM_MALI_LPAE_MEMATTR_IMP_DEF 0x88ULL
170+#define ARM_MALI_LPAE_MEMATTR_WRITE_ALLOC 0x8DULL
171+
169172 /* IOPTE accessors */
170173 #define iopte_deref(pte,d) __va(iopte_to_paddr(pte, d))
171174
@@ -1015,27 +1018,56 @@ arm_32_lpae_alloc_pgtable_s2(struct io_pgtable_cfg *cfg, void *cookie) · 843 unmodified lines
10151018 static struct io_pgtable *
10161019 arm_mali_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg, void *cookie)
10171020 {
1018− struct io_pgtable *iop;
1021+ struct arm_lpae_io_pgtable *data;
10191022
1020− if (cfg->ias != 48 || cfg->oas > 40)
1023+ /* No quirks for Mali (hopefully) */
1024+ if (cfg->quirks)
1025+ return NULL;
1026+
1027+ if (cfg->ias > 48 || cfg->oas > 40)
10211028 return NULL;
10221029
10231030 cfg->pgsize_bitmap &= (SZ_4K | SZ_2M | SZ_1G);
1024− iop = arm_64_lpae_alloc_pgtable_s1(cfg, cookie);
1025− if (iop) {
1026− u64 mair, ttbr;
10271031
1028− /* Copy values as union fields overlap */
1029− mair = cfg->arm_lpae_s1_cfg.mair[0];
1030− ttbr = cfg->arm_lpae_s1_cfg.ttbr[0];
1032+ data = arm_lpae_alloc_pgtable(cfg);
1033+ if (!data)
1034+ return NULL;
10311035
1032− cfg->arm_mali_lpae_cfg.memattr = mair;
1033− cfg->arm_mali_lpae_cfg.transtab = ttbr |
1034− ARM_MALI_LPAE_TTBR_READ_INNER |
1035− ARM_MALI_LPAE_TTBR_ADRMODE_TABLE;
1036+ /* Mali seems to need a full 4-level table regardless of IAS */
1037+ if (data->levels < ARM_LPAE_MAX_LEVELS) {
1038+ data->levels = ARM_LPAE_MAX_LEVELS;
1039+ data->pgd_size = sizeof(arm_lpae_iopte);
10361040 }
1041+ /*
1042+ * MEMATTR: Mali has no actual notion of a non-cacheable type, so the
1043+ * best we can do is mimic the out-of-tree driver and hope that the
1044+ * "implementation-defined caching policy" is good enough. Similarly,
1045+ * we'll use it for the sake of a valid attribute for our 'device'
1046+ * index, although callers should never request that in practice.
1047+ */
1048+ cfg->arm_mali_lpae_cfg.memattr =
1049+ (ARM_MALI_LPAE_MEMATTR_IMP_DEF
1050+ << ARM_LPAE_MAIR_ATTR_SHIFT(ARM_LPAE_MAIR_ATTR_IDX_NC)) |
1051+ (ARM_MALI_LPAE_MEMATTR_WRITE_ALLOC
1052+ << ARM_LPAE_MAIR_ATTR_SHIFT(ARM_LPAE_MAIR_ATTR_IDX_CACHE)) |
1053+ (ARM_MALI_LPAE_MEMATTR_IMP_DEF
1054+ << ARM_LPAE_MAIR_ATTR_SHIFT(ARM_LPAE_MAIR_ATTR_IDX_DEV));
10371055
1038− return iop;
1056+ data->pgd = __arm_lpae_alloc_pages(data->pgd_size, GFP_KERNEL, cfg);
1057+ if (!data->pgd)
1058+ goto out_free_data;
1059+
1060+ /* Ensure the empty pgd is visible before TRANSTAB can be written */
1061+ wmb();
1062+
1063+ cfg->arm_mali_lpae_cfg.transtab = virt_to_phys(data->pgd) |
1064+ ARM_MALI_LPAE_TTBR_READ_INNER |
1065+ ARM_MALI_LPAE_TTBR_ADRMODE_TABLE;
1066+ return &data->iop;
1067+
1068+out_free_data:
1069+ kfree(data);
1070+ return NULL;
10391071 }
10401072
10411073 struct io_pgtable_init_fns io_pgtable_arm_64_lpae_s1_init_fns = {
drivers/iommu/ipmmu-vmsa.c+1−2
@@ -1086,8 +1086,6 @@ static int ipmmu_probe(struct platform_device *pdev) · 1085 unmodified lines
10861086
10871087 mmu->num_ctx = min(IPMMU_CTX_MAX, mmu->features->number_of_contexts);
10881088
1089− irq = platform_get_irq(pdev, 0);
1090−
10911089 /*
10921090 * Determine if this IPMMU instance is a root device by checking for
10931091 * the lack of has_cache_leaf_nodes flag or renesas,ipmmu-main property.
@@ -1106,6 +1104,7 @@ static int ipmmu_probe(struct platform_device *pdev) · 12 unmodified lines
11061104
11071105 /* Root devices have mandatory IRQs */
11081106 if (ipmmu_is_root(mmu)) {
1107+ irq = platform_get_irq(pdev, 0);
11091108 if (irq < 0) {
11101109 dev_err(&pdev->dev, "no IRQ found\n");
11111110 return irq;
drivers/iommu/rockchip-iommu.c+14−5
@@ -100,6 +100,7 @@ struct rk_iommu { · 99 unmodified lines
100100 struct device *dev;
101101 void __iomem **bases;
102102 int num_mmu;
103+ int num_irq;
103104 struct clk_bulk_data *clocks;
104105 int num_clocks;
105106 bool reset_disabled;
@@ -1136,7 +1137,7 @@ static int rk_iommu_probe(struct platform_device *pdev) · 1030 unmodified lines
11361137 struct rk_iommu *iommu;
11371138 struct resource *res;
11381139 int num_res = pdev->num_resources;
1139− int err, i, irq;
1140+ int err, i;
11401141
11411142 iommu = devm_kzalloc(dev, sizeof(*iommu), GFP_KERNEL);
11421143 if (!iommu)
@@ -1163,6 +1164,10 @@ static int rk_iommu_probe(struct platform_device *pdev) · 20 unmodified lines
11631164 if (iommu->num_mmu == 0)
11641165 return PTR_ERR(iommu->bases[0]);
11651166
1167+ iommu->num_irq = platform_irq_count(pdev);
1168+ if (iommu->num_irq < 0)
1169+ return iommu->num_irq;
1170+
11661171 iommu->reset_disabled = device_property_read_bool(dev,
11671172 "rockchip,disable-mmu-reset");
11681173
@@ -1219,8 +1224,9 @@ static int rk_iommu_probe(struct platform_device *pdev) · 50 unmodified lines
12191224
12201225 pm_runtime_enable(dev);
12211226
1222− i = 0;
1223− while ((irq = platform_get_irq(pdev, i++)) != -ENXIO) {
1227+ for (i = 0; i < iommu->num_irq; i++) {
1228+ int irq = platform_get_irq(pdev, i);
1229+
12241230 if (irq < 0)
12251231 return irq;
12261232
@@ -1245,10 +1251,13 @@ err_unprepare_clocks: · 18 unmodified lines
12451251 static void rk_iommu_shutdown(struct platform_device *pdev)
12461252 {
12471253 struct rk_iommu *iommu = platform_get_drvdata(pdev);
1248− int i = 0, irq;
1254+ int i;
1255+
1256+ for (i = 0; i < iommu->num_irq; i++) {
1257+ int irq = platform_get_irq(pdev, i);
12491258
1250− while ((irq = platform_get_irq(pdev, i++)) != -ENXIO)
12511259 devm_free_irq(iommu->dev, irq, iommu);
1260+ }
12521261
12531262 pm_runtime_force_suspend(&pdev->dev);
12541263 }
drivers/irqchip/irq-al-fic.c+12−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515
1616 /* FIC Registers */
1717 #define AL_FIC_CAUSE 0x00
18+#define AL_FIC_SET_CAUSE 0x08
1819 #define AL_FIC_MASK 0x10
1920 #define AL_FIC_CONTROL 0x28
2021
@@ -126,6 +127,16 @@ static void al_fic_irq_handler(struct irq_desc *desc) · 105 unmodified lines
126127 chained_irq_exit(irqchip, desc);
127128 }
128129
130+static int al_fic_irq_retrigger(struct irq_data *data)
131+{
132+ struct irq_chip_generic *gc = irq_data_get_irq_chip_data(data);
133+ struct al_fic *fic = gc->private;
134+
135+ writel_relaxed(BIT(data->hwirq), fic->base + AL_FIC_SET_CAUSE);
136+
137+ return 1;
138+}
139+
129140 static int al_fic_register(struct device_node *node,
130141 struct al_fic *fic)
131142 {
@@ -159,6 +170,7 @@ static int al_fic_register(struct device_node *node, · 27 unmodified lines
159170 gc->chip_types->chip.irq_unmask = irq_gc_mask_clr_bit;
160171 gc->chip_types->chip.irq_ack = irq_gc_ack_clr_bit;
161172 gc->chip_types->chip.irq_set_type = al_fic_irq_set_type;
173+ gc->chip_types->chip.irq_retrigger = al_fic_irq_retrigger;
162174 gc->chip_types->chip.flags = IRQCHIP_SKIP_SET_WAKE;
163175 gc->private = fic;
164176
drivers/irqchip/irq-atmel-aic5.c+10−0
@@ -313,6 +313,7 @@ static void __init sama5d3_aic_irq_fixup(void) · 312 unmodified lines
313313 static const struct of_device_id aic5_irq_fixups[] __initconst = {
314314 { .compatible = "atmel,sama5d3", .data = sama5d3_aic_irq_fixup },
315315 { .compatible = "atmel,sama5d4", .data = sama5d3_aic_irq_fixup },
316+ { .compatible = "microchip,sam9x60", .data = sama5d3_aic_irq_fixup },
316317 { /* sentinel */ },
317318 };
318319
@@ -390,3 +391,12 @@ static int __init sama5d4_aic5_of_init(struct device_node *node, · 71 unmodified lines
390391 return aic5_of_init(node, parent, NR_SAMA5D4_IRQS);
391392 }
392393 IRQCHIP_DECLARE(sama5d4_aic5, "atmel,sama5d4-aic", sama5d4_aic5_of_init);
394+
395+#define NR_SAM9X60_IRQS 50
396+
397+static int __init sam9x60_aic5_of_init(struct device_node *node,
398+ struct device_node *parent)
399+{
400+ return aic5_of_init(node, parent, NR_SAM9X60_IRQS);
401+}
402+IRQCHIP_DECLARE(sam9x60_aic5, "microchip,sam9x60-aic", sam9x60_aic5_of_init);
drivers/irqchip/irq-gic-v3-its.c+18−3
@@ -175,6 +175,22 @@ static DEFINE_IDA(its_vpeid_ida); · 174 unmodified lines
175175 #define gic_data_rdist_rd_base() (gic_data_rdist()->rd_base)
176176 #define gic_data_rdist_vlpi_base() (gic_data_rdist_rd_base() + SZ_128K)
177177
178+static u16 get_its_list(struct its_vm *vm)
179+{
180+ struct its_node *its;
181+ unsigned long its_list = 0;
182+
183+ list_for_each_entry(its, &its_nodes, entry) {
184+ if (!its->is_v4)
185+ continue;
186+
187+ if (vm->vlpi_count[its->list_nr])
188+ __set_bit(its->list_nr, &its_list);
189+ }
190+
191+ return (u16)its_list;
192+}
193+
178194 static struct its_collection *dev_event_to_col(struct its_device *its_dev,
179195 u32 event)
180196 {
@@ -976,17 +992,15 @@ static void its_send_vmapp(struct its_node *its, · 795 unmodified lines
976992
977993 static void its_send_vmovp(struct its_vpe *vpe)
978994 {
979− struct its_cmd_desc desc;
995+ struct its_cmd_desc desc = {};
980996 struct its_node *its;
981997 unsigned long flags;
982998 int col_id = vpe->col_idx;
983999
9841000 desc.its_vmovp_cmd.vpe = vpe;
985− desc.its_vmovp_cmd.its_list = (u16)its_list_map;
9861001
9871002 if (!its_list_map) {
9881003 its = list_first_entry(&its_nodes, struct its_node, entry);
989− desc.its_vmovp_cmd.seq_num = 0;
9901004 desc.its_vmovp_cmd.col = &its->collections[col_id];
9911005 its_send_single_vcommand(its, its_build_vmovp_cmd, &desc);
9921006 return;
@@ -1003,6 +1017,7 @@ static void its_send_vmovp(struct its_vpe *vpe) · 10 unmodified lines
10031017 raw_spin_lock_irqsave(&vmovp_lock, flags);
10041018
10051019 desc.its_vmovp_cmd.seq_num = vmovp_seq_num++;
1020+ desc.its_vmovp_cmd.its_list = get_its_list(vpe->its_vm);
10061021
10071022 /* Emit VMOVPs */
10081023 list_for_each_entry(its, &its_nodes, entry) {
drivers/irqchip/irq-gic-v3.c+1−1
@@ -59,7 +59,7 @@ static struct gic_chip_data gic_data __read_mostly; · 58 unmodified lines
5959 static DEFINE_STATIC_KEY_TRUE(supports_deactivate_key);
6060
6161 #define GIC_ID_NR (1U << GICD_TYPER_ID_BITS(gic_data.rdists.gicd_typer))
62−#define GIC_LINE_NR max(GICD_TYPER_SPIS(gic_data.rdists.gicd_typer), 1020U)
62+#define GIC_LINE_NR min(GICD_TYPER_SPIS(gic_data.rdists.gicd_typer), 1020U)
6363 #define GIC_ESPI_NR GICD_TYPER_ESPIS(gic_data.rdists.gicd_typer)
6464
6565 /*
drivers/irqchip/irq-sifive-plic.c+17−16
@@ -97,7 +97,7 @@ static inline void plic_irq_toggle(const struct cpumask *mask, · 96 unmodified lines
9797 }
9898 }
9999
100−static void plic_irq_enable(struct irq_data *d)
100+static void plic_irq_unmask(struct irq_data *d)
101101 {
102102 unsigned int cpu = cpumask_any_and(irq_data_get_affinity_mask(d),
103103 cpu_online_mask);
@@ -106,7 +106,7 @@ static void plic_irq_enable(struct irq_data *d) · 2 unmodified lines
106106 plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1);
107107 }
108108
109−static void plic_irq_disable(struct irq_data *d)
109+static void plic_irq_mask(struct irq_data *d)
110110 {
111111 plic_irq_toggle(cpu_possible_mask, d->hwirq, 0);
112112 }
@@ -125,10 +125,8 @@ static int plic_set_affinity(struct irq_data *d, · 12 unmodified lines
125125 if (cpu >= nr_cpu_ids)
126126 return -EINVAL;
127127
128− if (!irqd_irq_disabled(d)) {
129− plic_irq_toggle(cpu_possible_mask, d->hwirq, 0);
130− plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1);
131− }
128+ plic_irq_toggle(cpu_possible_mask, d->hwirq, 0);
129+ plic_irq_toggle(cpumask_of(cpu), d->hwirq, 1);
132130
133131 irq_data_update_effective_affinity(d, cpumask_of(cpu));
134132
@@ -136,14 +134,18 @@ static int plic_set_affinity(struct irq_data *d, · 1 unmodified line
136134 }
137135 #endif
138136
137+static void plic_irq_eoi(struct irq_data *d)
138+{
139+ struct plic_handler *handler = this_cpu_ptr(&plic_handlers);
140+
141+ writel(d->hwirq, handler->hart_base + CONTEXT_CLAIM);
142+}
143+
139144 static struct irq_chip plic_chip = {
140145 .name = "SiFive PLIC",
141− /*
142− * There is no need to mask/unmask PLIC interrupts. They are "masked"
143− * by reading claim and "unmasked" when writing it back.
144− */
145− .irq_enable = plic_irq_enable,
146− .irq_disable = plic_irq_disable,
146+ .irq_mask = plic_irq_mask,
147+ .irq_unmask = plic_irq_unmask,
148+ .irq_eoi = plic_irq_eoi,
147149 #ifdef CONFIG_SMP
148150 .irq_set_affinity = plic_set_affinity,
149151 #endif
@@ -152,7 +154,7 @@ static struct irq_chip plic_chip = { · 2 unmodified lines
152154 static int plic_irqdomain_map(struct irq_domain *d, unsigned int irq,
153155 irq_hw_number_t hwirq)
154156 {
155− irq_set_chip_and_handler(irq, &plic_chip, handle_simple_irq);
157+ irq_set_chip_and_handler(irq, &plic_chip, handle_fasteoi_irq);
156158 irq_set_chip_data(irq, NULL);
157159 irq_set_noprobe(irq);
158160 return 0;
@@ -188,7 +190,6 @@ static void plic_handle_irq(struct pt_regs *regs) · 29 unmodified lines
188190 hwirq);
189191 else
190192 generic_handle_irq(irq);
191− writel(hwirq, claim);
192193 }
193194 csr_set(sie, SIE_SEIE);
194195 }
@@ -251,8 +252,8 @@ static int __init plic_init(struct device_node *node, · 56 unmodified lines
251252 continue;
252253 }
253254
254− /* skip context holes */
255− if (parent.args[0] == -1)
255+ /* skip contexts other than supervisor external interrupt */
256+ if (parent.args[0] != IRQ_S_EXT)
256257 continue;
257258
258259 hartid = plic_find_hart_id(parent.np);
drivers/macintosh/windfarm_cpufreq_clamp.c+22−16
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818
1919 static int clamped;
2020 static struct wf_control *clamp_control;
21−static struct dev_pm_qos_request qos_req;
21+static struct freq_qos_request qos_req;
2222 static unsigned int min_freq, max_freq;
2323
2424 static int clamp_set(struct wf_control *ct, s32 value)
@@ -35,7 +35,7 @@ static int clamp_set(struct wf_control *ct, s32 value) · 10 unmodified lines
3535 }
3636 clamped = value;
3737
38− return dev_pm_qos_update_request(&qos_req, freq);
38+ return freq_qos_update_request(&qos_req, freq);
3939 }
4040
4141 static int clamp_get(struct wf_control *ct, s32 *value)
@@ -77,38 +77,44 @@ static int __init wf_cpufreq_clamp_init(void) · 35 unmodified lines
7777
7878 min_freq = policy->cpuinfo.min_freq;
7979 max_freq = policy->cpuinfo.max_freq;
80+
81+ ret = freq_qos_add_request(&policy->constraints, &qos_req, FREQ_QOS_MAX,
82+ max_freq);
83+
8084 cpufreq_cpu_put(policy);
8185
86+ if (ret < 0) {
87+ pr_err("%s: Failed to add freq constraint (%d)\n", __func__,
88+ ret);
89+ return ret;
90+ }
91+
8292 dev = get_cpu_device(0);
8393 if (unlikely(!dev)) {
8494 pr_warn("%s: No cpu device for cpu0\n", __func__);
85− return -ENODEV;
95+ ret = -ENODEV;
96+ goto fail;
8697 }
8798
8899 clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL);
89− if (clamp == NULL)
90− return -ENOMEM;
91−
92− ret = dev_pm_qos_add_request(dev, &qos_req, DEV_PM_QOS_MAX_FREQUENCY,
93− max_freq);
94− if (ret < 0) {
95− pr_err("%s: Failed to add freq constraint (%d)\n", __func__,
96− ret);
97− goto free;
100+ if (clamp == NULL) {
101+ ret = -ENOMEM;
102+ goto fail;
98103 }
99104
100105 clamp->ops = &clamp_ops;
101106 clamp->name = "cpufreq-clamp";
102107 ret = wf_register_control(clamp);
103108 if (ret)
104− goto fail;
109+ goto free;
110+
105111 clamp_control = clamp;
106112 return 0;
107− fail:
108− dev_pm_qos_remove_request(&qos_req);
109113
110114 free:
111115 kfree(clamp);
116+ fail:
117+ freq_qos_remove_request(&qos_req);
112118 return ret;
113119 }
114120
@@ -116,7 +122,7 @@ static void __exit wf_cpufreq_clamp_exit(void) · 1 unmodified line
116122 {
117123 if (clamp_control) {
118124 wf_unregister_control(clamp_control);
119− dev_pm_qos_remove_request(&qos_req);
125+ freq_qos_remove_request(&qos_req);
120126 }
121127 }
122128
drivers/md/dm-cache-target.c+2−26
@@ -542,7 +542,7 @@ static void wake_migration_worker(struct cache *cache) · 541 unmodified lines
542542
543543 static struct dm_bio_prison_cell_v2 *alloc_prison_cell(struct cache *cache)
544544 {
545− return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOWAIT);
545+ return dm_bio_prison_alloc_cell_v2(cache->prison, GFP_NOIO);
546546 }
547547
548548 static void free_prison_cell(struct cache *cache, struct dm_bio_prison_cell_v2 *cell)
@@ -554,9 +554,7 @@ static struct dm_cache_migration *alloc_migration(struct cache *cache) · 5 unmodified lines
554554 {
555555 struct dm_cache_migration *mg;
556556
557− mg = mempool_alloc(&cache->migration_pool, GFP_NOWAIT);
558− if (!mg)
559− return NULL;
557+ mg = mempool_alloc(&cache->migration_pool, GFP_NOIO);
560558
561559 memset(mg, 0, sizeof(*mg));
562560
@@ -664,10 +662,6 @@ static bool bio_detain_shared(struct cache *cache, dm_oblock_t oblock, struct bi · 101 unmodified lines
664662 struct dm_bio_prison_cell_v2 *cell_prealloc, *cell;
665663
666664 cell_prealloc = alloc_prison_cell(cache); /* FIXME: allow wait if calling from worker */
667− if (!cell_prealloc) {
668− defer_bio(cache, bio);
669− return false;
670− }
671665
672666 build_key(oblock, end, &key);
673667 r = dm_cell_get_v2(cache->prison, &key, lock_level(bio), bio, cell_prealloc, &cell);
@@ -1493,11 +1487,6 @@ static int mg_lock_writes(struct dm_cache_migration *mg) · 819 unmodified lines
14931487 struct dm_bio_prison_cell_v2 *prealloc;
14941488
14951489 prealloc = alloc_prison_cell(cache);
1496− if (!prealloc) {
1497− DMERR_LIMIT("%s: alloc_prison_cell failed", cache_device_name(cache));
1498− mg_complete(mg, false);
1499− return -ENOMEM;
1500− }
15011490
15021491 /*
15031492 * Prevent writes to the block, but allow reads to continue.
@@ -1535,11 +1524,6 @@ static int mg_start(struct cache *cache, struct policy_work *op, struct bio *bio · 31 unmodified lines
15351524 }
15361525
15371526 mg = alloc_migration(cache);
1538− if (!mg) {
1539− policy_complete_background_work(cache->policy, op, false);
1540− background_work_end(cache);
1541− return -ENOMEM;
1542− }
15431527
15441528 mg->op = op;
15451529 mg->overwrite_bio = bio;
@@ -1628,10 +1612,6 @@ static int invalidate_lock(struct dm_cache_migration *mg) · 82 unmodified lines
16281612 struct dm_bio_prison_cell_v2 *prealloc;
16291613
16301614 prealloc = alloc_prison_cell(cache);
1631− if (!prealloc) {
1632− invalidate_complete(mg, false);
1633− return -ENOMEM;
1634− }
16351615
16361616 build_key(mg->invalidate_oblock, oblock_succ(mg->invalidate_oblock), &key);
16371617 r = dm_cell_lock_v2(cache->prison, &key,
@@ -1669,10 +1649,6 @@ static int invalidate_start(struct cache *cache, dm_cblock_t cblock, · 31 unmodified lines
16691649 return -EPERM;
16701650
16711651 mg = alloc_migration(cache);
1672− if (!mg) {
1673− background_work_end(cache);
1674− return -ENOMEM;
1675− }
16761652
16771653 mg->overwrite_bio = bio;
16781654 mg->invalidate_cblock = cblock;
drivers/md/dm-clone-target.c+2−2
@@ -591,8 +591,8 @@ static struct hash_table_bucket *get_hash_table_bucket(struct clone *clone, · 590 unmodified lines
591591 *
592592 * NOTE: Must be called with the bucket lock held
593593 */
594−struct dm_clone_region_hydration *__hash_find(struct hash_table_bucket *bucket,
595− unsigned long region_nr)
594+static struct dm_clone_region_hydration *__hash_find(struct hash_table_bucket *bucket,
595+ unsigned long region_nr)
596596 {
597597 struct dm_clone_region_hydration *hd;
598598
drivers/md/dm-snap.c+77−17
@@ -18,7 +18,6 @@ · 17 unmodified lines
1818 #include <linux/vmalloc.h>
1919 #include <linux/log2.h>
2020 #include <linux/dm-kcopyd.h>
21−#include <linux/semaphore.h>
2221
2322 #include "dm.h"
2423
@@ -107,8 +106,8 @@ struct dm_snapshot { · 82 unmodified lines
107106 /* The on disk metadata handler */
108107 struct dm_exception_store *store;
109108
110− /* Maximum number of in-flight COW jobs. */
111− struct semaphore cow_count;
109+ unsigned in_progress;
110+ struct wait_queue_head in_progress_wait;
112111
113112 struct dm_kcopyd_client *kcopyd_client;
114113
@@ -162,8 +161,8 @@ struct dm_snapshot { · 47 unmodified lines
162161 */
163162 #define DEFAULT_COW_THRESHOLD 2048
164163
165−static int cow_threshold = DEFAULT_COW_THRESHOLD;
166−module_param_named(snapshot_cow_threshold, cow_threshold, int, 0644);
164+static unsigned cow_threshold = DEFAULT_COW_THRESHOLD;
165+module_param_named(snapshot_cow_threshold, cow_threshold, uint, 0644);
167166 MODULE_PARM_DESC(snapshot_cow_threshold, "Maximum number of chunks being copied on write");
168167
169168 DECLARE_DM_KCOPYD_THROTTLE_WITH_MODULE_PARM(snapshot_copy_throttle,
@@ -1327,7 +1326,7 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 1157 unmodified lines
13271326 goto bad_hash_tables;
13281327 }
13291328
1330− sema_init(&s->cow_count, (cow_threshold > 0) ? cow_threshold : INT_MAX);
1329+ init_waitqueue_head(&s->in_progress_wait);
13311330
13321331 s->kcopyd_client = dm_kcopyd_client_create(&dm_kcopyd_throttle);
13331332 if (IS_ERR(s->kcopyd_client)) {
@@ -1509,9 +1508,56 @@ static void snapshot_dtr(struct dm_target *ti) · 175 unmodified lines
15091508
15101509 dm_put_device(ti, s->origin);
15111510
1511+ WARN_ON(s->in_progress);
1512+
15121513 kfree(s);
15131514 }
15141515
1516+static void account_start_copy(struct dm_snapshot *s)
1517+{
1518+ spin_lock(&s->in_progress_wait.lock);
1519+ s->in_progress++;
1520+ spin_unlock(&s->in_progress_wait.lock);
1521+}
1522+
1523+static void account_end_copy(struct dm_snapshot *s)
1524+{
1525+ spin_lock(&s->in_progress_wait.lock);
1526+ BUG_ON(!s->in_progress);
1527+ s->in_progress--;
1528+ if (likely(s->in_progress <= cow_threshold) &&
1529+ unlikely(waitqueue_active(&s->in_progress_wait)))
1530+ wake_up_locked(&s->in_progress_wait);
1531+ spin_unlock(&s->in_progress_wait.lock);
1532+}
1533+
1534+static bool wait_for_in_progress(struct dm_snapshot *s, bool unlock_origins)
1535+{
1536+ if (unlikely(s->in_progress > cow_threshold)) {
1537+ spin_lock(&s->in_progress_wait.lock);
1538+ if (likely(s->in_progress > cow_threshold)) {
1539+ /*
1540+ * NOTE: this throttle doesn't account for whether
1541+ * the caller is servicing an IO that will trigger a COW
1542+ * so excess throttling may result for chunks not required
1543+ * to be COW'd. But if cow_threshold was reached, extra
1544+ * throttling is unlikely to negatively impact performance.
1545+ */
1546+ DECLARE_WAITQUEUE(wait, current);
1547+ __add_wait_queue(&s->in_progress_wait, &wait);
1548+ __set_current_state(TASK_UNINTERRUPTIBLE);
1549+ spin_unlock(&s->in_progress_wait.lock);
1550+ if (unlock_origins)
1551+ up_read(&_origins_lock);
1552+ io_schedule();
1553+ remove_wait_queue(&s->in_progress_wait, &wait);
1554+ return false;
1555+ }
1556+ spin_unlock(&s->in_progress_wait.lock);
1557+ }
1558+ return true;
1559+}
1560+
15151561 /*
15161562 * Flush a list of buffers.
15171563 */
@@ -1527,7 +1573,7 @@ static void flush_bios(struct bio *bio) · 9 unmodified lines
15271573 }
15281574 }
15291575
1530−static int do_origin(struct dm_dev *origin, struct bio *bio);
1576+static int do_origin(struct dm_dev *origin, struct bio *bio, bool limit);
15311577
15321578 /*
15331579 * Flush a list of buffers.
@@ -1540,7 +1586,7 @@ static void retry_origin_bios(struct dm_snapshot *s, struct bio *bio) · 6 unmodified lines
15401586 while (bio) {
15411587 n = bio->bi_next;
15421588 bio->bi_next = NULL;
1543− r = do_origin(s->origin, bio);
1589+ r = do_origin(s->origin, bio, false);
15441590 if (r == DM_MAPIO_REMAPPED)
15451591 generic_make_request(bio);
15461592 bio = n;
@@ -1732,7 +1778,7 @@ static void copy_callback(int read_err, unsigned long write_err, void *context) · 185 unmodified lines
17321778 rb_link_node(&pe->out_of_order_node, parent, p);
17331779 rb_insert_color(&pe->out_of_order_node, &s->out_of_order_tree);
17341780 }
1735− up(&s->cow_count);
1781+ account_end_copy(s);
17361782 }
17371783
17381784 /*
@@ -1756,7 +1802,7 @@ static void start_copy(struct dm_snap_pending_exception *pe) · 17 unmodified lines
17561802 dest.count = src.count;
17571803
17581804 /* Hand over to kcopyd */
1759− down(&s->cow_count);
1805+ account_start_copy(s);
17601806 dm_kcopyd_copy(s->kcopyd_client, &src, 1, &dest, 0, copy_callback, pe);
17611807 }
17621808
@@ -1776,7 +1822,7 @@ static void start_full_bio(struct dm_snap_pending_exception *pe, · 13 unmodified lines
17761822 pe->full_bio = bio;
17771823 pe->full_bio_end_io = bio->bi_end_io;
17781824
1779− down(&s->cow_count);
1825+ account_start_copy(s);
17801826 callback_data = dm_kcopyd_prepare_callback(s->kcopyd_client,
17811827 copy_callback, pe);
17821828
@@ -1866,7 +1912,7 @@ static void zero_callback(int read_err, unsigned long write_err, void *context) · 83 unmodified lines
18661912 struct bio *bio = context;
18671913 struct dm_snapshot *s = bio->bi_private;
18681914
1869− up(&s->cow_count);
1915+ account_end_copy(s);
18701916 bio->bi_status = write_err ? BLK_STS_IOERR : 0;
18711917 bio_endio(bio);
18721918 }
@@ -1880,7 +1926,7 @@ static void zero_exception(struct dm_snapshot *s, struct dm_exception *e, · 7 unmodified lines
18801926 dest.sector = bio->bi_iter.bi_sector;
18811927 dest.count = s->store->chunk_size;
18821928
1883− down(&s->cow_count);
1929+ account_start_copy(s);
18841930 WARN_ON_ONCE(bio->bi_private);
18851931 bio->bi_private = s;
18861932 dm_kcopyd_zero(s->kcopyd_client, 1, &dest, 0, zero_callback, bio);
@@ -1916,6 +1962,11 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio) · 29 unmodified lines
19161962 if (!s->valid)
19171963 return DM_MAPIO_KILL;
19181964
1965+ if (bio_data_dir(bio) == WRITE) {
1966+ while (unlikely(!wait_for_in_progress(s, false)))
1967+ ; /* wait_for_in_progress() has slept */
1968+ }
1969+
19191970 down_read(&s->lock);
19201971 dm_exception_table_lock(&lock);
19211972
@@ -2112,7 +2163,7 @@ redirect_to_origin: · 190 unmodified lines
21122163
21132164 if (bio_data_dir(bio) == WRITE) {
21142165 up_write(&s->lock);
2115− return do_origin(s->origin, bio);
2166+ return do_origin(s->origin, bio, false);
21162167 }
21172168
21182169 out_unlock:
@@ -2487,15 +2538,24 @@ next_snapshot: · 368 unmodified lines
24872538 /*
24882539 * Called on a write from the origin driver.
24892540 */
2490−static int do_origin(struct dm_dev *origin, struct bio *bio)
2541+static int do_origin(struct dm_dev *origin, struct bio *bio, bool limit)
24912542 {
24922543 struct origin *o;
24932544 int r = DM_MAPIO_REMAPPED;
24942545
2546+again:
24952547 down_read(&_origins_lock);
24962548 o = __lookup_origin(origin->bdev);
2497− if (o)
2549+ if (o) {
2550+ if (limit) {
2551+ struct dm_snapshot *s;
2552+ list_for_each_entry(s, &o->snapshots, list)
2553+ if (unlikely(!wait_for_in_progress(s, true)))
2554+ goto again;
2555+ }
2556+
24982557 r = __origin_write(&o->snapshots, bio->bi_iter.bi_sector, bio);
2558+ }
24992559 up_read(&_origins_lock);
25002560
25012561 return r;
@@ -2608,7 +2668,7 @@ static int origin_map(struct dm_target *ti, struct bio *bio) · 106 unmodified lines
26082668 dm_accept_partial_bio(bio, available_sectors);
26092669
26102670 /* Only tell snapshots if this is a write */
2611− return do_origin(o->dev, bio);
2671+ return do_origin(o->dev, bio, true);
26122672 }
26132673
26142674 /*
drivers/md/raid0.c+1−1
@@ -154,7 +154,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) · 153 unmodified lines
154154 } else {
155155 pr_err("md/raid0:%s: cannot assemble multi-zone RAID0 with default_layout setting\n",
156156 mdname(mddev));
157− pr_err("md/raid0: please set raid.default_layout to 1 or 2\n");
157+ pr_err("md/raid0: please set raid0.default_layout to 1 or 2\n");
158158 err = -ENOTSUPP;
159159 goto abort;
160160 }
drivers/memstick/host/jmb38x_ms.c+1−1
@@ -941,7 +941,7 @@ static int jmb38x_ms_probe(struct pci_dev *pdev, · 940 unmodified lines
941941 if (!cnt) {
942942 rc = -ENODEV;
943943 pci_dev_busy = 1;
944− goto err_out;
944+ goto err_out_int;
945945 }
946946
947947 jm = kzalloc(sizeof(struct jmb38x_ms)
drivers/mfd/mt6397-core.c+40−24
@@ -129,11 +129,27 @@ static int mt6397_irq_resume(struct device *dev) · 128 unmodified lines
129129 static SIMPLE_DEV_PM_OPS(mt6397_pm_ops, mt6397_irq_suspend,
130130 mt6397_irq_resume);
131131
132+struct chip_data {
133+ u32 cid_addr;
134+ u32 cid_shift;
135+};
136+
137+static const struct chip_data mt6323_core = {
138+ .cid_addr = MT6323_CID,
139+ .cid_shift = 0,
140+};
141+
142+static const struct chip_data mt6397_core = {
143+ .cid_addr = MT6397_CID,
144+ .cid_shift = 0,
145+};
146+
132147 static int mt6397_probe(struct platform_device *pdev)
133148 {
134149 int ret;
135150 unsigned int id;
136151 struct mt6397_chip *pmic;
152+ const struct chip_data *pmic_core;
137153
138154 pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
139155 if (!pmic)
@@ -149,28 +165,30 @@ static int mt6397_probe(struct platform_device *pdev) · 9 unmodified lines
149165 if (!pmic->regmap)
150166 return -ENODEV;
151167
152− platform_set_drvdata(pdev, pmic);
168+ pmic_core = of_device_get_match_data(&pdev->dev);
169+ if (!pmic_core)
170+ return -ENODEV;
153171
154− ret = regmap_read(pmic->regmap, MT6397_CID, &id);
172+ ret = regmap_read(pmic->regmap, pmic_core->cid_addr, &id);
155173 if (ret) {
156− dev_err(pmic->dev, "Failed to read chip id: %d\n", ret);
174+ dev_err(&pdev->dev, "Failed to read chip id: %d\n", ret);
157175 return ret;
158176 }
159177
178+ pmic->chip_id = (id >> pmic_core->cid_shift) & 0xff;
179+
180+ platform_set_drvdata(pdev, pmic);
181+
160182 pmic->irq = platform_get_irq(pdev, 0);
161183 if (pmic->irq <= 0)
162184 return pmic->irq;
163185
164− switch (id & 0xff) {
165− case MT6323_CHIP_ID:
166− pmic->int_con[0] = MT6323_INT_CON0;
167− pmic->int_con[1] = MT6323_INT_CON1;
168− pmic->int_status[0] = MT6323_INT_STATUS0;
169− pmic->int_status[1] = MT6323_INT_STATUS1;
170− ret = mt6397_irq_init(pmic);
171− if (ret)
172− return ret;
186+ ret = mt6397_irq_init(pmic);
187+ if (ret)
188+ return ret;
173189
190+ switch (pmic->chip_id) {
191+ case MT6323_CHIP_ID:
174192 ret = devm_mfd_add_devices(&pdev->dev, -1, mt6323_devs,
175193 ARRAY_SIZE(mt6323_devs), NULL,
176194 0, pmic->irq_domain);
@@ -178,21 +196,13 @@ static int mt6397_probe(struct platform_device *pdev) · 1 unmodified line
178196
179197 case MT6391_CHIP_ID:
180198 case MT6397_CHIP_ID:
181− pmic->int_con[0] = MT6397_INT_CON0;
182− pmic->int_con[1] = MT6397_INT_CON1;
183− pmic->int_status[0] = MT6397_INT_STATUS0;
184− pmic->int_status[1] = MT6397_INT_STATUS1;
185− ret = mt6397_irq_init(pmic);
186− if (ret)
187− return ret;
188−
189199 ret = devm_mfd_add_devices(&pdev->dev, -1, mt6397_devs,
190200 ARRAY_SIZE(mt6397_devs), NULL,
191201 0, pmic->irq_domain);
192202 break;
193203
194204 default:
195− dev_err(&pdev->dev, "unsupported chip: %d\n", id);
205+ dev_err(&pdev->dev, "unsupported chip: %d\n", pmic->chip_id);
196206 return -ENODEV;
197207 }
198208
@@ -205,9 +215,15 @@ static int mt6397_probe(struct platform_device *pdev) · 6 unmodified lines
205215 }
206216
207217 static const struct of_device_id mt6397_of_match[] = {
208− { .compatible = "mediatek,mt6397" },
209− { .compatible = "mediatek,mt6323" },
210− { }
218+ {
219+ .compatible = "mediatek,mt6323",
220+ .data = &mt6323_core,
221+ }, {
222+ .compatible = "mediatek,mt6397",
223+ .data = &mt6397_core,
224+ }, {
225+ /* sentinel */
226+ }
211227 };
212228 MODULE_DEVICE_TABLE(of, mt6397_of_match);
213229
drivers/mmc/host/cqhci.c+2−1
@@ -611,7 +611,8 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) · 610 unmodified lines
611611 cq_host->slot[tag].flags = 0;
612612
613613 cq_host->qcnt += 1;
614−
614+ /* Make sure descriptors are ready before ringing the doorbell */
615+ wmb();
615616 cqhci_writel(cq_host, 1 << tag, CQHCI_TDBR);
616617 if (!(cqhci_readl(cq_host, CQHCI_TDBR) & (1 << tag)))
617618 pr_debug("%s: cqhci: doorbell not set for tag %d\n",
drivers/mmc/host/mxs-mmc.c+4−3
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/interrupt.h>
1818 #include <linux/dma-mapping.h>
1919 #include <linux/dmaengine.h>
20+#include <linux/dma/mxs-dma.h>
2021 #include <linux/highmem.h>
2122 #include <linux/clk.h>
2223 #include <linux/err.h>
@@ -266,7 +267,7 @@ static void mxs_mmc_bc(struct mxs_mmc_host *host) · 243 unmodified lines
266267 ssp->ssp_pio_words[2] = cmd1;
267268 ssp->dma_dir = DMA_NONE;
268269 ssp->slave_dirn = DMA_TRANS_NONE;
269− desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK);
270+ desc = mxs_mmc_prep_dma(host, MXS_DMA_CTRL_WAIT4END);
270271 if (!desc)
271272 goto out;
272273
@@ -311,7 +312,7 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host) · 38 unmodified lines
311312 ssp->ssp_pio_words[2] = cmd1;
312313 ssp->dma_dir = DMA_NONE;
313314 ssp->slave_dirn = DMA_TRANS_NONE;
314− desc = mxs_mmc_prep_dma(host, DMA_CTRL_ACK);
315+ desc = mxs_mmc_prep_dma(host, MXS_DMA_CTRL_WAIT4END);
315316 if (!desc)
316317 goto out;
317318
@@ -441,7 +442,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host) · 123 unmodified lines
441442 host->data = data;
442443 ssp->dma_dir = dma_data_dir;
443444 ssp->slave_dirn = slave_dirn;
444− desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
445+ desc = mxs_mmc_prep_dma(host, DMA_PREP_INTERRUPT | MXS_DMA_CTRL_WAIT4END);
445446 if (!desc)
446447 goto out;
447448
drivers/mmc/host/renesas_sdhi_core.c+19−12
@@ -646,8 +646,8 @@ int renesas_sdhi_probe(struct platform_device *pdev, · 645 unmodified lines
646646 struct tmio_mmc_dma *dma_priv;
647647 struct tmio_mmc_host *host;
648648 struct renesas_sdhi *priv;
649+ int num_irqs, irq, ret, i;
649650 struct resource *res;
650− int irq, ret, i;
651651 u16 ver;
652652
653653 of_data = of_device_get_match_data(&pdev->dev);
@@ -825,24 +825,31 @@ int renesas_sdhi_probe(struct platform_device *pdev, · 171 unmodified lines
825825 host->hs400_complete = renesas_sdhi_hs400_complete;
826826 }
827827
828− i = 0;
829− while (1) {
828+ num_irqs = platform_irq_count(pdev);
829+ if (num_irqs < 0) {
830+ ret = num_irqs;
831+ goto eirq;
832+ }
833+
834+ /* There must be at least one IRQ source */
835+ if (!num_irqs) {
836+ ret = -ENXIO;
837+ goto eirq;
838+ }
839+
840+ for (i = 0; i < num_irqs; i++) {
830841 irq = platform_get_irq(pdev, i);
831− if (irq < 0)
832− break;
833− i++;
842+ if (irq < 0) {
843+ ret = irq;
844+ goto eirq;
845+ }
846+
834847 ret = devm_request_irq(&pdev->dev, irq, tmio_mmc_irq, 0,
835848 dev_name(&pdev->dev), host);
836849 if (ret)
837850 goto eirq;
838851 }
839852
840− /* There must be at least one IRQ source */
841− if (!i) {
842− ret = irq;
843− goto eirq;
844− }
845−
846853 dev_info(&pdev->dev, "%s base at 0x%08lx max clock rate %u MHz\n",
847854 mmc_hostname(host->mmc), (unsigned long)
848855 (platform_get_resource(pdev, IORESOURCE_MEM, 0)->start),
drivers/mmc/host/sdhci-iproc.c+1−0
@@ -262,6 +262,7 @@ static const struct sdhci_iproc_data bcm2835_data = { · 261 unmodified lines
262262 };
263263
264264 static const struct sdhci_pltfm_data sdhci_bcm2711_pltfm_data = {
265+ .quirks = SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12,
265266 .ops = &sdhci_iproc_32only_ops,
266267 };
267268
drivers/mmc/host/sdhci-omap.c+1−1
@@ -372,7 +372,7 @@ static int sdhci_omap_execute_tuning(struct mmc_host *mmc, u32 opcode) · 371 unmodified lines
372372 * on temperature
373373 */
374374 if (temperature < -20000)
375− phase_delay = min(max_window + 4 * max_len - 24,
375+ phase_delay = min(max_window + 4 * (max_len - 1) - 24,
376376 max_window +
377377 DIV_ROUND_UP(13 * max_len, 16) * 4);
378378 else if (temperature < 20000)
drivers/mmc/host/sh_mmcif.c+2−4
@@ -1393,11 +1393,9 @@ static int sh_mmcif_probe(struct platform_device *pdev) · 1392 unmodified lines
13931393 const char *name;
13941394
13951395 irq[0] = platform_get_irq(pdev, 0);
1396− irq[1] = platform_get_irq(pdev, 1);
1397− if (irq[0] < 0) {
1398− dev_err(dev, "Get irq error\n");
1396+ irq[1] = platform_get_irq_optional(pdev, 1);
1397+ if (irq[0] < 0)
13991398 return -ENXIO;
1400− }
14011399
14021400 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
14031401 reg = devm_ioremap_resource(dev, res);
drivers/net/bonding/bond_main.c+1−1
@@ -4039,7 +4039,7 @@ out: · 4038 unmodified lines
40394039 * this to-be-skipped slave to send a packet out.
40404040 */
40414041 old_arr = rtnl_dereference(bond->slave_arr);
4042− for (idx = 0; idx < old_arr->count; idx++) {
4042+ for (idx = 0; old_arr != NULL && idx < old_arr->count; idx++) {
40434043 if (skipslave == old_arr->arr[idx]) {
40444044 old_arr->arr[idx] =
40454045 old_arr->arr[old_arr->count-1];
drivers/net/dsa/b53/b53_common.c+0−1
@@ -1845,7 +1845,6 @@ int b53_mirror_add(struct dsa_switch *ds, int port, · 1844 unmodified lines
18451845 loc = B53_EG_MIR_CTL;
18461846
18471847 b53_read16(dev, B53_MGMT_PAGE, loc, &reg);
1848− reg &= ~MIRROR_MASK;
18491848 reg |= BIT(port);
18501849 b53_write16(dev, B53_MGMT_PAGE, loc, reg);
18511850
drivers/net/dsa/microchip/ksz8795.c+0−4
@@ -1224,10 +1224,6 @@ static int ksz8795_switch_init(struct ksz_device *dev) · 1223 unmodified lines
12241224 {
12251225 int i;
12261226
1227− mutex_init(&dev->stats_mutex);
1228− mutex_init(&dev->alu_mutex);
1229− mutex_init(&dev->vlan_mutex);
1230−
12311227 dev->ds->ops = &ksz8795_switch_ops;
12321228
12331229 for (i = 0; i < ARRAY_SIZE(ksz8795_switch_chips); i++) {
drivers/net/dsa/microchip/ksz8795_spi.c+4−3
@@ -25,6 +25,7 @@ KSZ_REGMAP_TABLE(ksz8795, 16, SPI_ADDR_SHIFT, · 24 unmodified lines
2525
2626 static int ksz8795_spi_probe(struct spi_device *spi)
2727 {
28+ struct regmap_config rc;
2829 struct ksz_device *dev;
2930 int i, ret;
3031
@@ -33,9 +34,9 @@ static int ksz8795_spi_probe(struct spi_device *spi) · 2 unmodified lines
3334 return -ENOMEM;
3435
3536 for (i = 0; i < ARRAY_SIZE(ksz8795_regmap_config); i++) {
36− dev->regmap[i] = devm_regmap_init_spi(spi,
37− &ksz8795_regmap_config
38− [i]);
37+ rc = ksz8795_regmap_config[i];
38+ rc.lock_arg = &dev->regmap_mutex;
39+ dev->regmap[i] = devm_regmap_init_spi(spi, &rc);
3940 if (IS_ERR(dev->regmap[i])) {
4041 ret = PTR_ERR(dev->regmap[i]);
4142 dev_err(&spi->dev,
drivers/net/dsa/microchip/ksz9477_i2c.c+4−2
@@ -17,6 +17,7 @@ KSZ_REGMAP_TABLE(ksz9477, not_used, 16, 0, 0); · 16 unmodified lines
1717 static int ksz9477_i2c_probe(struct i2c_client *i2c,
1818 const struct i2c_device_id *i2c_id)
1919 {
20+ struct regmap_config rc;
2021 struct ksz_device *dev;
2122 int i, ret;
2223
@@ -25,8 +26,9 @@ static int ksz9477_i2c_probe(struct i2c_client *i2c, · 2 unmodified lines
2526 return -ENOMEM;
2627
2728 for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) {
28− dev->regmap[i] = devm_regmap_init_i2c(i2c,
29− &ksz9477_regmap_config[i]);
29+ rc = ksz9477_regmap_config[i];
30+ rc.lock_arg = &dev->regmap_mutex;
31+ dev->regmap[i] = devm_regmap_init_i2c(i2c, &rc);
3032 if (IS_ERR(dev->regmap[i])) {
3133 ret = PTR_ERR(dev->regmap[i]);
3234 dev_err(&i2c->dev,
drivers/net/dsa/microchip/ksz9477_reg.h+2−2
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: GPL-2.0
2− *
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
33 * Microchip KSZ9477 register definitions
44 *
55 * Copyright (C) 2017-2018 Microchip Technology Inc.
drivers/net/dsa/microchip/ksz9477_spi.c+4−2
@@ -24,6 +24,7 @@ KSZ_REGMAP_TABLE(ksz9477, 32, SPI_ADDR_SHIFT, · 23 unmodified lines
2424
2525 static int ksz9477_spi_probe(struct spi_device *spi)
2626 {
27+ struct regmap_config rc;
2728 struct ksz_device *dev;
2829 int i, ret;
2930
@@ -32,8 +33,9 @@ static int ksz9477_spi_probe(struct spi_device *spi) · 2 unmodified lines
3233 return -ENOMEM;
3334
3435 for (i = 0; i < ARRAY_SIZE(ksz9477_regmap_config); i++) {
35− dev->regmap[i] = devm_regmap_init_spi(spi,
36− &ksz9477_regmap_config[i]);
36+ rc = ksz9477_regmap_config[i];
37+ rc.lock_arg = &dev->regmap_mutex;
38+ dev->regmap[i] = devm_regmap_init_spi(spi, &rc);
3739 if (IS_ERR(dev->regmap[i])) {
3840 ret = PTR_ERR(dev->regmap[i]);
3941 dev_err(&spi->dev,
drivers/net/dsa/microchip/ksz_common.c+1−1
@@ -436,7 +436,7 @@ int ksz_switch_register(struct ksz_device *dev, · 435 unmodified lines
436436 }
437437
438438 mutex_init(&dev->dev_mutex);
439− mutex_init(&dev->stats_mutex);
439+ mutex_init(&dev->regmap_mutex);
440440 mutex_init(&dev->alu_mutex);
441441 mutex_init(&dev->vlan_mutex);
442442
drivers/net/dsa/microchip/ksz_common.h+17−3
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: GPL-2.0
2− * Microchip switch driver common header
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/* Microchip switch driver common header
33 *
44 * Copyright (C) 2017-2019 Microchip Technology Inc.
55 */
@@ -47,7 +47,7 @@ struct ksz_device { · 41 unmodified lines
4747 const char *name;
4848
4949 struct mutex dev_mutex; /* device access */
50− struct mutex stats_mutex; /* status access */
50+ struct mutex regmap_mutex; /* regmap access */
5151 struct mutex alu_mutex; /* ALU access */
5252 struct mutex vlan_mutex; /* vlan access */
5353 const struct ksz_dev_ops *dev_ops;
@@ -290,6 +290,18 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset, · 236 unmodified lines
290290 ksz_write32(dev, dev->dev_ops->get_port_addr(port, offset), data);
291291 }
292292
293+static inline void ksz_regmap_lock(void *__mtx)
294+{
295+ struct mutex *mtx = __mtx;
296+ mutex_lock(mtx);
297+}
298+
299+static inline void ksz_regmap_unlock(void *__mtx)
300+{
301+ struct mutex *mtx = __mtx;
302+ mutex_unlock(mtx);
303+}
304+
293305 /* Regmap tables generation */
294306 #define KSZ_SPI_OP_RD 3
295307 #define KSZ_SPI_OP_WR 2
@@ -314,6 +326,8 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset, · 18 unmodified lines
314326 .write_flag_mask = \
315327 KSZ_SPI_OP_FLAG_MASK(KSZ_SPI_OP_WR, swp, \
316328 regbits, regpad), \
329+ .lock = ksz_regmap_lock, \
330+ .unlock = ksz_regmap_unlock, \
317331 .reg_format_endian = REGMAP_ENDIAN_BIG, \
318332 .val_format_endian = REGMAP_ENDIAN_BIG \
319333 }
drivers/net/dsa/sja1105/sja1105.h+2−2
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: GPL-2.0
2− * Copyright (c) 2018, Sensor-Technik Wiedemann GmbH
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/* Copyright (c) 2018, Sensor-Technik Wiedemann GmbH
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #ifndef _SJA1105_H
drivers/net/dsa/sja1105/sja1105_dynamic_config.h+2−2
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: GPL-2.0
2− * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
33 */
44 #ifndef _SJA1105_DYNAMIC_CONFIG_H
55 #define _SJA1105_DYNAMIC_CONFIG_H
drivers/net/dsa/sja1105/sja1105_ptp.h+2−2
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: GPL-2.0
2− * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
33 */
44 #ifndef _SJA1105_PTP_H
55 #define _SJA1105_PTP_H
drivers/net/dsa/sja1105/sja1105_static_config.h+2−2
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: BSD-3-Clause
2− * Copyright (c) 2016-2018, NXP Semiconductors
1+/* SPDX-License-Identifier: BSD-3-Clause */
2+/* Copyright (c) 2016-2018, NXP Semiconductors
33 * Copyright (c) 2018-2019, Vladimir Oltean <olteanv@gmail.com>
44 */
55 #ifndef _SJA1105_STATIC_CONFIG_H
drivers/net/dsa/sja1105/sja1105_tas.h+2−2
@@ -1,5 +1,5 @@
1−/* SPDX-License-Identifier: GPL-2.0
2− * Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/* Copyright (c) 2019, Vladimir Oltean <olteanv@gmail.com>
33 */
44 #ifndef _SJA1105_TAS_H
55 #define _SJA1105_TAS_H
drivers/net/ethernet/aquantia/atlantic/aq_main.c+1−3
@@ -194,9 +194,7 @@ static void aq_ndev_set_multicast_settings(struct net_device *ndev) · 193 unmodified lines
194194 {
195195 struct aq_nic_s *aq_nic = netdev_priv(ndev);
196196
197− aq_nic_set_packet_filter(aq_nic, ndev->flags);
198−
199− aq_nic_set_multicast_list(aq_nic, ndev);
197+ (void)aq_nic_set_multicast_list(aq_nic, ndev);
200198 }
201199
202200 static int aq_ndo_vlan_rx_add_vid(struct net_device *ndev, __be16 proto,
drivers/net/ethernet/aquantia/atlantic/aq_nic.c+18−16
@@ -631,9 +631,12 @@ err_exit: · 630 unmodified lines
631631
632632 int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev)
633633 {
634− unsigned int packet_filter = self->packet_filter;
634+ const struct aq_hw_ops *hw_ops = self->aq_hw_ops;
635+ struct aq_nic_cfg_s *cfg = &self->aq_nic_cfg;
636+ unsigned int packet_filter = ndev->flags;
635637 struct netdev_hw_addr *ha = NULL;
636638 unsigned int i = 0U;
639+ int err = 0;
637640
638641 self->mc_list.count = 0;
639642 if (netdev_uc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) {
@@ -641,29 +644,28 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) · 1 unmodified line
641644 } else {
642645 netdev_for_each_uc_addr(ha, ndev) {
643646 ether_addr_copy(self->mc_list.ar[i++], ha->addr);
644−
645− if (i >= AQ_HW_MULTICAST_ADDRESS_MAX)
646− break;
647647 }
648648 }
649649
650− if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) {
651− packet_filter |= IFF_ALLMULTI;
652− } else {
653− netdev_for_each_mc_addr(ha, ndev) {
654− ether_addr_copy(self->mc_list.ar[i++], ha->addr);
655−
656− if (i >= AQ_HW_MULTICAST_ADDRESS_MAX)
657− break;
650+ cfg->is_mc_list_enabled = !!(packet_filter & IFF_MULTICAST);
651+ if (cfg->is_mc_list_enabled) {
652+ if (i + netdev_mc_count(ndev) > AQ_HW_MULTICAST_ADDRESS_MAX) {
653+ packet_filter |= IFF_ALLMULTI;
654+ } else {
655+ netdev_for_each_mc_addr(ha, ndev) {
656+ ether_addr_copy(self->mc_list.ar[i++],
657+ ha->addr);
658+ }
658659 }
659660 }
660661
661662 if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) {
662− packet_filter |= IFF_MULTICAST;
663663 self->mc_list.count = i;
664− self->aq_hw_ops->hw_multicast_list_set(self->aq_hw,
665− self->mc_list.ar,
666− self->mc_list.count);
664+ err = hw_ops->hw_multicast_list_set(self->aq_hw,
665+ self->mc_list.ar,
666+ self->mc_list.count);
667+ if (err < 0)
668+ return err;
667669 }
668670 return aq_nic_set_packet_filter(self, packet_filter);
669671 }
drivers/net/ethernet/aquantia/atlantic/aq_ring.c+2−1
@@ -313,6 +313,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 312 unmodified lines
313313 break;
314314
315315 buff->is_error |= buff_->is_error;
316+ buff->is_cso_err |= buff_->is_cso_err;
316317
317318 } while (!buff_->is_eop);
318319
@@ -320,7 +321,7 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 1 unmodified line
320321 err = 0;
321322 goto err_exit;
322323 }
323− if (buff->is_error) {
324+ if (buff->is_error || buff->is_cso_err) {
324325 buff_ = buff;
325326 do {
326327 next_ = buff_->next,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c+18−5
@@ -818,14 +818,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 817 unmodified lines
818818 cfg->is_vlan_force_promisc);
819819
820820 hw_atl_rpfl2multicast_flr_en_set(self,
821− IS_FILTER_ENABLED(IFF_ALLMULTI), 0);
821+ IS_FILTER_ENABLED(IFF_ALLMULTI) &&
822+ IS_FILTER_ENABLED(IFF_MULTICAST), 0);
822823
823824 hw_atl_rpfl2_accept_all_mc_packets_set(self,
824− IS_FILTER_ENABLED(IFF_ALLMULTI));
825+ IS_FILTER_ENABLED(IFF_ALLMULTI) &&
826+ IS_FILTER_ENABLED(IFF_MULTICAST));
825827
826828 hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
827829
828− cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST);
829830
830831 for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i)
831832 hw_atl_rpfl2_uc_flr_en_set(self,
@@ -968,14 +969,26 @@ static int hw_atl_b0_hw_interrupt_moderation_set(struct aq_hw_s *self) · 136 unmodified lines
968969
969970 static int hw_atl_b0_hw_stop(struct aq_hw_s *self)
970971 {
972+ int err;
973+ u32 val;
974+
971975 hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK);
972976
973977 /* Invalidate Descriptor Cache to prevent writing to the cached
974978 * descriptors and to the data pointer of those descriptors
975979 */
976− hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1);
980+ hw_atl_rdm_rx_dma_desc_cache_init_tgl(self);
977981
978− return aq_hw_err_from_flags(self);
982+ err = aq_hw_err_from_flags(self);
983+
984+ if (err)
985+ goto err_exit;
986+
987+ readx_poll_timeout_atomic(hw_atl_rdm_rx_dma_desc_cache_init_done_get,
988+ self, val, val == 1, 1000U, 10000U);
989+
990+err_exit:
991+ return err;
979992 }
980993
981994 static int hw_atl_b0_hw_ring_tx_stop(struct aq_hw_s *self,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c+15−2
@@ -606,12 +606,25 @@ void hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s *aq_hw, u32 rx_flow_ctl_mode · 605 unmodified lines
606606 HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode);
607607 }
608608
609−void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init)
609+void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw)
610610 {
611+ u32 val;
612+
613+ val = aq_hw_read_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR,
614+ HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK,
615+ HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT);
616+
611617 aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR,
612618 HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK,
613619 HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT,
614− init);
620+ val ^ 1);
621+}
622+
623+u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw)
624+{
625+ return aq_hw_read_reg_bit(aq_hw, RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR,
626+ RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK,
627+ RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT);
615628 }
616629
617630 void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h+5−2
@@ -313,8 +313,11 @@ void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, · 312 unmodified lines
313313 u32 rx_pkt_buff_size_per_tc,
314314 u32 buffer);
315315
316−/* set rdm rx dma descriptor cache init */
317−void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init);
316+/* toggle rdm rx dma descriptor cache init */
317+void hw_atl_rdm_rx_dma_desc_cache_init_tgl(struct aq_hw_s *aq_hw);
318+
319+/* get rdm rx dma descriptor cache init done */
320+u32 hw_atl_rdm_rx_dma_desc_cache_init_done_get(struct aq_hw_s *aq_hw);
318321
319322 /* set rx xoff enable (per tc) */
320323 void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc,
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h+19−0
@@ -318,6 +318,25 @@ · 317 unmodified lines
318318 /* default value of bitfield rdm_desc_init_i */
319319 #define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0
320320
321+/* rdm_desc_init_done_i bitfield definitions
322+ * preprocessor definitions for the bitfield rdm_desc_init_done_i.
323+ * port="pif_rdm_desc_init_done_i"
324+ */
325+
326+/* register address for bitfield rdm_desc_init_done_i */
327+#define RDM_RX_DMA_DESC_CACHE_INIT_DONE_ADR 0x00005a10
328+/* bitmask for bitfield rdm_desc_init_done_i */
329+#define RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSK 0x00000001U
330+/* inverted bitmask for bitfield rdm_desc_init_done_i */
331+#define RDM_RX_DMA_DESC_CACHE_INIT_DONE_MSKN 0xfffffffe
332+/* lower bit position of bitfield rdm_desc_init_done_i */
333+#define RDM_RX_DMA_DESC_CACHE_INIT_DONE_SHIFT 0U
334+/* width of bitfield rdm_desc_init_done_i */
335+#define RDM_RX_DMA_DESC_CACHE_INIT_DONE_WIDTH 1
336+/* default value of bitfield rdm_desc_init_done_i */
337+#define RDM_RX_DMA_DESC_CACHE_INIT_DONE_DEFAULT 0x0
338+
339+
321340 /* rx int_desc_wrb_en bitfield definitions
322341 * preprocessor definitions for the bitfield "int_desc_wrb_en".
323342 * port="pif_rdm_int_desc_wrb_en_i"
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c+1−1
@@ -337,7 +337,7 @@ static int aq_fw2x_get_phy_temp(struct aq_hw_s *self, int *temp) · 336 unmodified lines
337337 /* Convert PHY temperature from 1/256 degree Celsius
338338 * to 1/1000 degree Celsius.
339339 */
340− *temp = temp_res * 1000 / 256;
340+ *temp = (temp_res & 0xFFFF) * 1000 / 256;
341341
342342 return 0;
343343 }
drivers/net/ethernet/broadcom/Kconfig+3−1
@@ -8,7 +8,6 @@ config NET_VENDOR_BROADCOM · 7 unmodified lines
88 default y
99 depends on (SSB_POSSIBLE && HAS_DMA) || PCI || BCM63XX || \
1010 SIBYTE_SB1xxx_SOC
11− select DIMLIB
1211 ---help---
1312 If you have a network (Ethernet) chipset belonging to this class,
1413 say Y.
@@ -69,6 +68,7 @@ config BCMGENET · 54 unmodified lines
6968 select FIXED_PHY
7069 select BCM7XXX_PHY
7170 select MDIO_BCM_UNIMAC
71+ select DIMLIB
7272 help
7373 This driver supports the built-in Ethernet MACs found in the
7474 Broadcom BCM7xxx Set Top Box family chipset.
@@ -188,6 +188,7 @@ config SYSTEMPORT · 113 unmodified lines
188188 select MII
189189 select PHYLIB
190190 select FIXED_PHY
191+ select DIMLIB
191192 help
192193 This driver supports the built-in Ethernet MACs found in the
193194 Broadcom BCM7xxx Set Top Box family chipset using an internal
@@ -200,6 +201,7 @@ config BNXT · 6 unmodified lines
200201 select LIBCRC32C
201202 select NET_DEVLINK
202203 select PAGE_POOL
204+ select DIMLIB
203205 ---help---
204206 This driver supports Broadcom NetXtreme-C/E 10/25/40/50 gigabit
205207 Ethernet cards. To compile this driver as a module, choose M here:
drivers/net/ethernet/broadcom/genet/bcmgenet.c+26−15
@@ -2018,6 +2018,8 @@ static void bcmgenet_link_intr_enable(struct bcmgenet_priv *priv) · 2017 unmodified lines
20182018 */
20192019 if (priv->internal_phy) {
20202020 int0_enable |= UMAC_IRQ_LINK_EVENT;
2021+ if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
2022+ int0_enable |= UMAC_IRQ_PHY_DET_R;
20212023 } else if (priv->ext_phy) {
20222024 int0_enable |= UMAC_IRQ_LINK_EVENT;
20232025 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
@@ -2611,11 +2613,14 @@ static void bcmgenet_irq_task(struct work_struct *work) · 587 unmodified lines
26112613 priv->irq0_stat = 0;
26122614 spin_unlock_irq(&priv->lock);
26132615
2616+ if (status & UMAC_IRQ_PHY_DET_R &&
2617+ priv->dev->phydev->autoneg != AUTONEG_ENABLE)
2618+ phy_init_hw(priv->dev->phydev);
2619+
26142620 /* Link UP/DOWN event */
2615− if (status & UMAC_IRQ_LINK_EVENT) {
2616− priv->dev->phydev->link = !!(status & UMAC_IRQ_LINK_UP);
2621+ if (status & UMAC_IRQ_LINK_EVENT)
26172622 phy_mac_interrupt(priv->dev->phydev);
2618− }
2623+
26192624 }
26202625
26212626 /* bcmgenet_isr1: handle Rx and Tx priority queues */
@@ -2710,7 +2715,7 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) · 88 unmodified lines
27102715 }
27112716
27122717 /* all other interested interrupts handled in bottom half */
2713− status &= UMAC_IRQ_LINK_EVENT;
2718+ status &= (UMAC_IRQ_LINK_EVENT | UMAC_IRQ_PHY_DET_R);
27142719 if (status) {
27152720 /* Save irq status for bottom-half processing. */
27162721 spin_lock_irqsave(&priv->lock, flags);
@@ -2874,6 +2879,12 @@ static int bcmgenet_open(struct net_device *dev) · 157 unmodified lines
28742879 if (priv->internal_phy)
28752880 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
28762881
2882+ ret = bcmgenet_mii_connect(dev);
2883+ if (ret) {
2884+ netdev_err(dev, "failed to connect to PHY\n");
2885+ goto err_clk_disable;
2886+ }
2887+
28772888 /* take MAC out of reset */
28782889 bcmgenet_umac_reset(priv);
28792890
@@ -2883,6 +2894,12 @@ static int bcmgenet_open(struct net_device *dev) · 3 unmodified lines
28832894 reg = bcmgenet_umac_readl(priv, UMAC_CMD);
28842895 priv->crc_fwd_en = !!(reg & CMD_CRC_FWD);
28852896
2897+ ret = bcmgenet_mii_config(dev, true);
2898+ if (ret) {
2899+ netdev_err(dev, "unsupported PHY\n");
2900+ goto err_disconnect_phy;
2901+ }
2902+
28862903 bcmgenet_set_hw_addr(priv, dev->dev_addr);
28872904
28882905 if (priv->internal_phy) {
@@ -2898,7 +2915,7 @@ static int bcmgenet_open(struct net_device *dev) · 9 unmodified lines
28982915 ret = bcmgenet_init_dma(priv);
28992916 if (ret) {
29002917 netdev_err(dev, "failed to initialize DMA\n");
2901− goto err_clk_disable;
2918+ goto err_disconnect_phy;
29022919 }
29032920
29042921 /* Always enable ring 16 - descriptor ring */
@@ -2921,25 +2938,19 @@ static int bcmgenet_open(struct net_device *dev) · 16 unmodified lines
29212938 goto err_irq0;
29222939 }
29232940
2924− ret = bcmgenet_mii_probe(dev);
2925− if (ret) {
2926− netdev_err(dev, "failed to connect to PHY\n");
2927− goto err_irq1;
2928− }
2929−
29302941 bcmgenet_netif_start(dev);
29312942
29322943 netif_tx_start_all_queues(dev);
29332944
29342945 return 0;
29352946
2936−err_irq1:
2937− free_irq(priv->irq1, priv);
29382947 err_irq0:
29392948 free_irq(priv->irq0, priv);
29402949 err_fini_dma:
29412950 bcmgenet_dma_teardown(priv);
29422951 bcmgenet_fini_dma(priv);
2952+err_disconnect_phy:
2953+ phy_disconnect(dev->phydev);
29432954 err_clk_disable:
29442955 if (priv->internal_phy)
29452956 bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
@@ -3620,6 +3631,8 @@ static int bcmgenet_resume(struct device *d) · 674 unmodified lines
36203631 if (priv->internal_phy)
36213632 bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
36223633
3634+ phy_init_hw(dev->phydev);
3635+
36233636 bcmgenet_umac_reset(priv);
36243637
36253638 init_umac(priv);
@@ -3628,8 +3641,6 @@ static int bcmgenet_resume(struct device *d) · 2 unmodified lines
36283641 if (priv->wolopts)
36293642 clk_disable_unprepare(priv->clk_wol);
36303643
3631− phy_init_hw(dev->phydev);
3632−
36333644 /* Speed settings must be restored */
36343645 bcmgenet_mii_config(priv->dev, false);
36353646
drivers/net/ethernet/broadcom/genet/bcmgenet.h+2−1
@@ -366,6 +366,7 @@ struct bcmgenet_mib_counters { · 365 unmodified lines
366366 #define EXT_PWR_DOWN_PHY_EN (1 << 20)
367367
368368 #define EXT_RGMII_OOB_CTRL 0x0C
369+#define RGMII_MODE_EN_V123 (1 << 0)
369370 #define RGMII_LINK (1 << 4)
370371 #define OOB_DISABLE (1 << 5)
371372 #define RGMII_MODE_EN (1 << 6)
@@ -719,8 +720,8 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF); · 347 unmodified lines
719720
720721 /* MDIO routines */
721722 int bcmgenet_mii_init(struct net_device *dev);
723+int bcmgenet_mii_connect(struct net_device *dev);
722724 int bcmgenet_mii_config(struct net_device *dev, bool init);
723−int bcmgenet_mii_probe(struct net_device *dev);
724725 void bcmgenet_mii_exit(struct net_device *dev);
725726 void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
726727 void bcmgenet_mii_setup(struct net_device *dev);
drivers/net/ethernet/broadcom/genet/bcmmii.c+56−61
@@ -173,6 +173,46 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) · 172 unmodified lines
173173 bcmgenet_fixed_phy_link_update);
174174 }
175175
176+int bcmgenet_mii_connect(struct net_device *dev)
177+{
178+ struct bcmgenet_priv *priv = netdev_priv(dev);
179+ struct device_node *dn = priv->pdev->dev.of_node;
180+ struct phy_device *phydev;
181+ u32 phy_flags = 0;
182+ int ret;
183+
184+ /* Communicate the integrated PHY revision */
185+ if (priv->internal_phy)
186+ phy_flags = priv->gphy_rev;
187+
188+ /* Initialize link state variables that bcmgenet_mii_setup() uses */
189+ priv->old_link = -1;
190+ priv->old_speed = -1;
191+ priv->old_duplex = -1;
192+ priv->old_pause = -1;
193+
194+ if (dn) {
195+ phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,
196+ phy_flags, priv->phy_interface);
197+ if (!phydev) {
198+ pr_err("could not attach to PHY\n");
199+ return -ENODEV;
200+ }
201+ } else {
202+ phydev = dev->phydev;
203+ phydev->dev_flags = phy_flags;
204+
205+ ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
206+ priv->phy_interface);
207+ if (ret) {
208+ pr_err("could not attach to PHY\n");
209+ return -ENODEV;
210+ }
211+ }
212+
213+ return 0;
214+}
215+
176216 int bcmgenet_mii_config(struct net_device *dev, bool init)
177217 {
178218 struct bcmgenet_priv *priv = netdev_priv(dev);
@@ -258,74 +298,29 @@ int bcmgenet_mii_config(struct net_device *dev, bool init) · 79 unmodified lines
258298 */
259299 if (priv->ext_phy) {
260300 reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
261− reg |= RGMII_MODE_EN | id_mode_dis;
301+ reg |= id_mode_dis;
302+ if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
303+ reg |= RGMII_MODE_EN_V123;
304+ else
305+ reg |= RGMII_MODE_EN;
262306 bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
263307 }
264308
265− if (init)
266− dev_info(kdev, "configuring instance for %s\n", phy_name);
267−
268− return 0;
269−}
270−
271−int bcmgenet_mii_probe(struct net_device *dev)
272−{
273− struct bcmgenet_priv *priv = netdev_priv(dev);
274− struct device_node *dn = priv->pdev->dev.of_node;
275− struct phy_device *phydev;
276− u32 phy_flags;
277− int ret;
278−
279− /* Communicate the integrated PHY revision */
280− phy_flags = priv->gphy_rev;
281−
282− /* Initialize link state variables that bcmgenet_mii_setup() uses */
283− priv->old_link = -1;
284− priv->old_speed = -1;
285− priv->old_duplex = -1;
286− priv->old_pause = -1;
287−
288− if (dn) {
289− phydev = of_phy_connect(dev, priv->phy_dn, bcmgenet_mii_setup,
290− phy_flags, priv->phy_interface);
291− if (!phydev) {
292− pr_err("could not attach to PHY\n");
293− return -ENODEV;
294− }
295− } else {
296− phydev = dev->phydev;
297− phydev->dev_flags = phy_flags;
309+ if (init) {
310+ linkmode_copy(phydev->advertising, phydev->supported);
298311
299− ret = phy_connect_direct(dev, phydev, bcmgenet_mii_setup,
300− priv->phy_interface);
301− if (ret) {
302− pr_err("could not attach to PHY\n");
303− return -ENODEV;
304− }
305− }
312+ /* The internal PHY has its link interrupts routed to the
313+ * Ethernet MAC ISRs. On GENETv5 there is a hardware issue
314+ * that prevents the signaling of link UP interrupts when
315+ * the link operates at 10Mbps, so fallback to polling for
316+ * those versions of GENET.
317+ */
318+ if (priv->internal_phy && !GENET_IS_V5(priv))
319+ phydev->irq = PHY_IGNORE_INTERRUPT;
306320
307− /* Configure port multiplexer based on what the probed PHY device since
308− * reading the 'max-speed' property determines the maximum supported
309− * PHY speed which is needed for bcmgenet_mii_config() to configure
310− * things appropriately.
311− */
312− ret = bcmgenet_mii_config(dev, true);
313− if (ret) {
314− phy_disconnect(dev->phydev);
315− return ret;
321+ dev_info(kdev, "configuring instance for %s\n", phy_name);
316322 }
317323
318− linkmode_copy(phydev->advertising, phydev->supported);
319−
320− /* The internal PHY has its link interrupts routed to the
321− * Ethernet MAC ISRs. On GENETv5 there is a hardware issue
322− * that prevents the signaling of link UP interrupts when
323− * the link operates at 10Mbps, so fallback to polling for
324− * those versions of GENET.
325− */
326− if (priv->internal_phy && !GENET_IS_V5(priv))
327− dev->phydev->irq = PHY_IGNORE_INTERRUPT;
328−
329324 return 0;
330325 }
331326
drivers/net/ethernet/cadence/macb_main.c+6−6
@@ -3405,17 +3405,17 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk, · 3404 unmodified lines
34053405 return err;
34063406 }
34073407
3408− *tx_clk = devm_clk_get(&pdev->dev, "tx_clk");
3408+ *tx_clk = devm_clk_get_optional(&pdev->dev, "tx_clk");
34093409 if (IS_ERR(*tx_clk))
3410− *tx_clk = NULL;
3410+ return PTR_ERR(*tx_clk);
34113411
3412− *rx_clk = devm_clk_get(&pdev->dev, "rx_clk");
3412+ *rx_clk = devm_clk_get_optional(&pdev->dev, "rx_clk");
34133413 if (IS_ERR(*rx_clk))
3414− *rx_clk = NULL;
3414+ return PTR_ERR(*rx_clk);
34153415
3416− *tsu_clk = devm_clk_get(&pdev->dev, "tsu_clk");
3416+ *tsu_clk = devm_clk_get_optional(&pdev->dev, "tsu_clk");
34173417 if (IS_ERR(*tsu_clk))
3418− *tsu_clk = NULL;
3418+ return PTR_ERR(*tsu_clk);
34193419
34203420 err = clk_prepare_enable(*pclk);
34213421 if (err) {
drivers/net/ethernet/cavium/common/cavium_ptp.h+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+/* SPDX-License-Identifier: GPL-2.0 */
22 /* cavium_ptp.h - PTP 1588 clock on Cavium hardware
33 * Copyright (c) 2003-2015, 2017 Cavium, Inc.
44 */
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c+49−1
@@ -1235,6 +1235,8 @@ static void dpaa2_eth_set_rx_taildrop(struct dpaa2_eth_priv *priv, bool enable) · 1234 unmodified lines
12351235 priv->rx_td_enabled = enable;
12361236 }
12371237
1238+static void update_tx_fqids(struct dpaa2_eth_priv *priv);
1239+
12381240 static int link_state_update(struct dpaa2_eth_priv *priv)
12391241 {
12401242 struct dpni_link_state state = {0};
@@ -1261,6 +1263,7 @@ static int link_state_update(struct dpaa2_eth_priv *priv) · 20 unmodified lines
12611263 goto out;
12621264
12631265 if (state.up) {
1266+ update_tx_fqids(priv);
12641267 netif_carrier_on(priv->net_dev);
12651268 netif_tx_start_all_queues(priv->net_dev);
12661269 } else {
@@ -2533,6 +2536,47 @@ static int set_pause(struct dpaa2_eth_priv *priv) · 1266 unmodified lines
25332536 return 0;
25342537 }
25352538
2539+static void update_tx_fqids(struct dpaa2_eth_priv *priv)
2540+{
2541+ struct dpni_queue_id qid = {0};
2542+ struct dpaa2_eth_fq *fq;
2543+ struct dpni_queue queue;
2544+ int i, j, err;
2545+
2546+ /* We only use Tx FQIDs for FQID-based enqueue, so check
2547+ * if DPNI version supports it before updating FQIDs
2548+ */
2549+ if (dpaa2_eth_cmp_dpni_ver(priv, DPNI_ENQUEUE_FQID_VER_MAJOR,
2550+ DPNI_ENQUEUE_FQID_VER_MINOR) < 0)
2551+ return;
2552+
2553+ for (i = 0; i < priv->num_fqs; i++) {
2554+ fq = &priv->fq[i];
2555+ if (fq->type != DPAA2_TX_CONF_FQ)
2556+ continue;
2557+ for (j = 0; j < dpaa2_eth_tc_count(priv); j++) {
2558+ err = dpni_get_queue(priv->mc_io, 0, priv->mc_token,
2559+ DPNI_QUEUE_TX, j, fq->flowid,
2560+ &queue, &qid);
2561+ if (err)
2562+ goto out_err;
2563+
2564+ fq->tx_fqid[j] = qid.fqid;
2565+ if (fq->tx_fqid[j] == 0)
2566+ goto out_err;
2567+ }
2568+ }
2569+
2570+ priv->enqueue = dpaa2_eth_enqueue_fq;
2571+
2572+ return;
2573+
2574+out_err:
2575+ netdev_info(priv->net_dev,
2576+ "Error reading Tx FQID, fallback to QDID-based enqueue\n");
2577+ priv->enqueue = dpaa2_eth_enqueue_qd;
2578+}
2579+
25362580 /* Configure the DPNI object this interface is associated with */
25372581 static int setup_dpni(struct fsl_mc_device *ls_dev)
25382582 {
@@ -3306,6 +3350,9 @@ static irqreturn_t dpni_irq0_handler_thread(int irq_num, void *arg) · 767 unmodified lines
33063350 if (status & DPNI_IRQ_EVENT_LINK_CHANGED)
33073351 link_state_update(netdev_priv(net_dev));
33083352
3353+ if (status & DPNI_IRQ_EVENT_ENDPOINT_CHANGED)
3354+ set_mac_addr(netdev_priv(net_dev));
3355+
33093356 return IRQ_HANDLED;
33103357 }
33113358
@@ -3331,7 +3378,8 @@ static int setup_irqs(struct fsl_mc_device *ls_dev) · 19 unmodified lines
33313378 }
33323379
33333380 err = dpni_set_irq_mask(ls_dev->mc_io, 0, ls_dev->mc_handle,
3334− DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED);
3381+ DPNI_IRQ_INDEX, DPNI_IRQ_EVENT_LINK_CHANGED |
3382+ DPNI_IRQ_EVENT_ENDPOINT_CHANGED);
33353383 if (err < 0) {
33363384 dev_err(&ls_dev->dev, "dpni_set_irq_mask(): %d\n", err);
33373385 goto free_irq;
drivers/net/ethernet/freescale/dpaa2/dpni.h+4−1
@@ -133,9 +133,12 @@ int dpni_reset(struct fsl_mc_io *mc_io, · 132 unmodified lines
133133 */
134134 #define DPNI_IRQ_INDEX 0
135135 /**
136− * IRQ event - indicates a change in link state
136+ * IRQ events:
137+ * indicates a change in link state
138+ * indicates a change in endpoint
137139 */
138140 #define DPNI_IRQ_EVENT_LINK_CHANGED 0x00000001
141+#define DPNI_IRQ_EVENT_ENDPOINT_CHANGED 0x00000002
139142
140143 int dpni_set_irq_enable(struct fsl_mc_io *mc_io,
141144 u32 cmd_flags,
drivers/net/ethernet/hisilicon/hns3/hnae3.h+2−0
@@ -32,6 +32,8 @@ · 31 unmodified lines
3232
3333 #define HNAE3_MOD_VERSION "1.0"
3434
35+#define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */
36+
3537 /* Device IDs */
3638 #define HNAE3_DEV_ID_GE 0xA220
3739 #define HNAE3_DEV_ID_25GE 0xA221
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+20−1
@@ -906,6 +906,9 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) · 905 unmodified lines
906906 hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number),
907907 HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S);
908908
909+ /* nic's msix numbers is always equals to the roce's. */
910+ hdev->num_nic_msi = hdev->num_roce_msi;
911+
909912 /* PF should have NIC vectors and Roce vectors,
910913 * NIC vectors are queued before Roce vectors.
911914 */
@@ -915,6 +918,15 @@ static int hclge_query_pf_resource(struct hclge_dev *hdev) · 3 unmodified lines
915918 hdev->num_msi =
916919 hnae3_get_field(__le16_to_cpu(req->pf_intr_vector_number),
917920 HCLGE_PF_VEC_NUM_M, HCLGE_PF_VEC_NUM_S);
921+
922+ hdev->num_nic_msi = hdev->num_msi;
923+ }
924+
925+ if (hdev->num_nic_msi < HNAE3_MIN_VECTOR_NUM) {
926+ dev_err(&hdev->pdev->dev,
927+ "Just %u msi resources, not enough for pf(min:2).\n",
928+ hdev->num_nic_msi);
929+ return -EINVAL;
918930 }
919931
920932 return 0;
@@ -1507,6 +1519,10 @@ static int hclge_assign_tqp(struct hclge_vport *vport, u16 num_tqps) · 586 unmodified lines
15071519 kinfo->rss_size = min_t(u16, hdev->rss_size_max,
15081520 vport->alloc_tqps / hdev->tm_info.num_tc);
15091521
1522+ /* ensure one to one mapping between irq and queue at default */
1523+ kinfo->rss_size = min_t(u16, kinfo->rss_size,
1524+ (hdev->num_nic_msi - 1) / hdev->tm_info.num_tc);
1525+
15101526 return 0;
15111527 }
15121528
@@ -2285,7 +2301,8 @@ static int hclge_init_msi(struct hclge_dev *hdev) · 772 unmodified lines
22852301 int vectors;
22862302 int i;
22872303
2288− vectors = pci_alloc_irq_vectors(pdev, 1, hdev->num_msi,
2304+ vectors = pci_alloc_irq_vectors(pdev, HNAE3_MIN_VECTOR_NUM,
2305+ hdev->num_msi,
22892306 PCI_IRQ_MSI | PCI_IRQ_MSIX);
22902307 if (vectors < 0) {
22912308 dev_err(&pdev->dev,
@@ -2300,6 +2317,7 @@ static int hclge_init_msi(struct hclge_dev *hdev) · 8 unmodified lines
23002317
23012318 hdev->num_msi = vectors;
23022319 hdev->num_msi_left = vectors;
2320+
23032321 hdev->base_msi_vector = pdev->irq;
23042322 hdev->roce_base_vector = hdev->base_msi_vector +
23052323 hdev->roce_base_msix_offset;
@@ -3903,6 +3921,7 @@ static int hclge_get_vector(struct hnae3_handle *handle, u16 vector_num, · 1597 unmodified lines
39033921 int alloc = 0;
39043922 int i, j;
39053923
3924+ vector_num = min_t(u16, hdev->num_nic_msi - 1, vector_num);
39063925 vector_num = min(hdev->num_msi_left, vector_num);
39073926
39083927 for (j = 0; j < vector_num; j++) {
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h+1−0
@@ -763,6 +763,7 @@ struct hclge_dev { · 762 unmodified lines
763763 u32 base_msi_vector;
764764 u16 *vector_status;
765765 int *vector_irq;
766+ u16 num_nic_msi; /* Num of nic vectors for this PF */
766767 u16 num_roce_msi; /* Num of roce vectors for this PF */
767768 int roce_base_vector;
768769
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c+9−2
@@ -537,9 +537,16 @@ static void hclge_tm_vport_tc_info_update(struct hclge_vport *vport) · 536 unmodified lines
537537 kinfo->rss_size = kinfo->req_rss_size;
538538 } else if (kinfo->rss_size > max_rss_size ||
539539 (!kinfo->req_rss_size && kinfo->rss_size < max_rss_size)) {
540+ /* if user not set rss, the rss_size should compare with the
541+ * valid msi numbers to ensure one to one map between tqp and
542+ * irq as default.
543+ */
544+ if (!kinfo->req_rss_size)
545+ max_rss_size = min_t(u16, max_rss_size,
546+ (hdev->num_nic_msi - 1) /
547+ kinfo->num_tc);
548+
540549 /* Set to the maximum specification value (max_rss_size). */
541− dev_info(&hdev->pdev->dev, "rss changes from %d to %d\n",
542− kinfo->rss_size, max_rss_size);
543550 kinfo->rss_size = max_rss_size;
544551 }
545552
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c+25−3
@@ -411,6 +411,13 @@ static int hclgevf_knic_setup(struct hclgevf_dev *hdev) · 410 unmodified lines
411411 kinfo->tqp[i] = &hdev->htqp[i].q;
412412 }
413413
414+ /* after init the max rss_size and tqps, adjust the default tqp numbers
415+ * and rss size with the actual vector numbers
416+ */
417+ kinfo->num_tqps = min_t(u16, hdev->num_nic_msix - 1, kinfo->num_tqps);
418+ kinfo->rss_size = min_t(u16, kinfo->num_tqps / kinfo->num_tc,
419+ kinfo->rss_size);
420+
414421 return 0;
415422 }
416423
@@ -502,6 +509,7 @@ static int hclgevf_get_vector(struct hnae3_handle *handle, u16 vector_num, · 85 unmodified lines
502509 int alloc = 0;
503510 int i, j;
504511
512+ vector_num = min_t(u16, hdev->num_nic_msix - 1, vector_num);
505513 vector_num = min(hdev->num_msi_left, vector_num);
506514
507515 for (j = 0; j < vector_num; j++) {
@@ -2246,13 +2254,14 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) · 1738 unmodified lines
22462254 int vectors;
22472255 int i;
22482256
2249− if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B))
2257+ if (hnae3_dev_roce_supported(hdev))
22502258 vectors = pci_alloc_irq_vectors(pdev,
22512259 hdev->roce_base_msix_offset + 1,
22522260 hdev->num_msi,
22532261 PCI_IRQ_MSIX);
22542262 else
2255− vectors = pci_alloc_irq_vectors(pdev, 1, hdev->num_msi,
2263+ vectors = pci_alloc_irq_vectors(pdev, HNAE3_MIN_VECTOR_NUM,
2264+ hdev->num_msi,
22562265 PCI_IRQ_MSI | PCI_IRQ_MSIX);
22572266
22582267 if (vectors < 0) {
@@ -2268,6 +2277,7 @@ static int hclgevf_init_msi(struct hclgevf_dev *hdev) · 9 unmodified lines
22682277
22692278 hdev->num_msi = vectors;
22702279 hdev->num_msi_left = vectors;
2280+
22712281 hdev->base_msi_vector = pdev->irq;
22722282 hdev->roce_base_vector = pdev->irq + hdev->roce_base_msix_offset;
22732283
@@ -2533,7 +2543,7 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) · 259 unmodified lines
25332543
25342544 req = (struct hclgevf_query_res_cmd *)desc.data;
25352545
2536− if (hnae3_get_bit(hdev->ae_dev->flag, HNAE3_DEV_SUPPORT_ROCE_B)) {
2546+ if (hnae3_dev_roce_supported(hdev)) {
25372547 hdev->roce_base_msix_offset =
25382548 hnae3_get_field(__le16_to_cpu(req->msixcap_localid_ba_rocee),
25392549 HCLGEVF_MSIX_OFT_ROCEE_M,
@@ -2542,6 +2552,9 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) · 2 unmodified lines
25422552 hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number),
25432553 HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S);
25442554
2555+ /* nic's msix numbers is always equals to the roce's. */
2556+ hdev->num_nic_msix = hdev->num_roce_msix;
2557+
25452558 /* VF should have NIC vectors and Roce vectors, NIC vectors
25462559 * are queued before Roce vectors. The offset is fixed to 64.
25472560 */
@@ -2551,6 +2564,15 @@ static int hclgevf_query_vf_resource(struct hclgevf_dev *hdev) · 3 unmodified lines
25512564 hdev->num_msi =
25522565 hnae3_get_field(__le16_to_cpu(req->vf_intr_vector_number),
25532566 HCLGEVF_VEC_NUM_M, HCLGEVF_VEC_NUM_S);
2567+
2568+ hdev->num_nic_msix = hdev->num_msi;
2569+ }
2570+
2571+ if (hdev->num_nic_msix < HNAE3_MIN_VECTOR_NUM) {
2572+ dev_err(&hdev->pdev->dev,
2573+ "Just %u msi resources, not enough for vf(min:2).\n",
2574+ hdev->num_nic_msix);
2575+ return -EINVAL;
25542576 }
25552577
25562578 return 0;
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h+1−0
@@ -270,6 +270,7 @@ struct hclgevf_dev { · 269 unmodified lines
270270 u16 num_msi;
271271 u16 num_msi_left;
272272 u16 num_msi_used;
273+ u16 num_nic_msix; /* Num of nic vectors for this VF */
273274 u16 num_roce_msix; /* Num of roce vectors for this VF */
274275 u16 roce_base_msix_offset;
275276 int roce_base_vector;
drivers/net/ethernet/i825xx/lasi_82596.c+3−1
@@ -96,6 +96,8 @@ · 95 unmodified lines
9696
9797 #define OPT_SWAP_PORT 0x0001 /* Need to wordswp on the MPU port */
9898
99+#define LIB82596_DMA_ATTR DMA_ATTR_NON_CONSISTENT
100+
99101 #define DMA_WBACK(ndev, addr, len) \
100102 do { dma_cache_sync((ndev)->dev.parent, (void *)addr, len, DMA_TO_DEVICE); } while (0)
101103
@@ -200,7 +202,7 @@ static int __exit lan_remove_chip(struct parisc_device *pdev) · 98 unmodified lines
200202
201203 unregister_netdev (dev);
202204 dma_free_attrs(&pdev->dev, sizeof(struct i596_private), lp->dma,
203− lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
205+ lp->dma_addr, LIB82596_DMA_ATTR);
204206 free_netdev (dev);
205207 return 0;
206208 }
drivers/net/ethernet/i825xx/lib82596.c+2−2
@@ -1065,7 +1065,7 @@ static int i82596_probe(struct net_device *dev) · 1064 unmodified lines
10651065
10661066 dma = dma_alloc_attrs(dev->dev.parent, sizeof(struct i596_dma),
10671067 &lp->dma_addr, GFP_KERNEL,
1068− DMA_ATTR_NON_CONSISTENT);
1068+ LIB82596_DMA_ATTR);
10691069 if (!dma) {
10701070 printk(KERN_ERR "%s: Couldn't get shared memory\n", __FILE__);
10711071 return -ENOMEM;
@@ -1087,7 +1087,7 @@ static int i82596_probe(struct net_device *dev) · 15 unmodified lines
10871087 i = register_netdev(dev);
10881088 if (i) {
10891089 dma_free_attrs(dev->dev.parent, sizeof(struct i596_dma),
1090− dma, lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
1090+ dma, lp->dma_addr, LIB82596_DMA_ATTR);
10911091 return i;
10921092 }
10931093
drivers/net/ethernet/i825xx/sni_82596.c+3−1
@@ -24,6 +24,8 @@ · 23 unmodified lines
2424
2525 static const char sni_82596_string[] = "snirm_82596";
2626
27+#define LIB82596_DMA_ATTR 0
28+
2729 #define DMA_WBACK(priv, addr, len) do { } while (0)
2830 #define DMA_INV(priv, addr, len) do { } while (0)
2931 #define DMA_WBACK_INV(priv, addr, len) do { } while (0)
@@ -152,7 +154,7 @@ static int sni_82596_driver_remove(struct platform_device *pdev) · 122 unmodified lines
152154
153155 unregister_netdev(dev);
154156 dma_free_attrs(dev->dev.parent, sizeof(struct i596_private), lp->dma,
155− lp->dma_addr, DMA_ATTR_NON_CONSISTENT);
157+ lp->dma_addr, LIB82596_DMA_ATTR);
156158 iounmap(lp->ca);
157159 iounmap(lp->mpu_port);
158160 free_netdev (dev);
drivers/net/ethernet/ibm/ibmvnic.c+3−5
@@ -2878,12 +2878,10 @@ static int enable_scrq_irq(struct ibmvnic_adapter *adapter, · 2877 unmodified lines
28782878
28792879 if (test_bit(0, &adapter->resetting) &&
28802880 adapter->reset_reason == VNIC_RESET_MOBILITY) {
2881− u64 val = (0xff000000) | scrq->hw_irq;
2881+ struct irq_desc *desc = irq_to_desc(scrq->irq);
2882+ struct irq_chip *chip = irq_desc_get_chip(desc);
28822883
2883− rc = plpar_hcall_norets(H_EOI, val);
2884− if (rc)
2885− dev_err(dev, "H_EOI FAILED irq 0x%llx. rc=%ld\n",
2886− val, rc);
2884+ chip->irq_eoi(&desc->irq_data);
28872885 }
28882886
28892887 rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
drivers/net/ethernet/mediatek/mtk_eth_soc.c+1−0
@@ -261,6 +261,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, · 260 unmodified lines
261261 ge_mode = 0;
262262 switch (state->interface) {
263263 case PHY_INTERFACE_MODE_MII:
264+ case PHY_INTERFACE_MODE_GMII:
264265 ge_mode = 1;
265266 break;
266267 case PHY_INTERFACE_MODE_REVMII:
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c+4−6
@@ -788,12 +788,10 @@ again: · 787 unmodified lines
788788 * it means that all the previous stes are the same,
789789 * if so, this rule is duplicated.
790790 */
791− if (mlx5dr_ste_is_last_in_rule(nic_matcher,
792− matched_ste->ste_chain_location)) {
793− mlx5dr_info(dmn, "Duplicate rule inserted, aborting!!\n");
794− return NULL;
795− }
796− return matched_ste;
791+ if (!mlx5dr_ste_is_last_in_rule(nic_matcher, ste_location))
792+ return matched_ste;
793+
794+ mlx5dr_dbg(dmn, "Duplicate rule inserted\n");
797795 }
798796
799797 if (!skip_rehash && dr_rule_need_enlarge_hash(cur_htbl, dmn, nic_dmn)) {
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c+1−0
@@ -99,6 +99,7 @@ static void mlxsw_sp_rx_drop_listener(struct sk_buff *skb, u8 local_port, · 98 unmodified lines
9999 devlink = priv_to_devlink(mlxsw_sp->core);
100100 in_devlink_port = mlxsw_core_port_devlink_port_get(mlxsw_sp->core,
101101 local_port);
102+ skb_push(skb, ETH_HLEN);
102103 devlink_trap_report(devlink, skb, trap_ctx, in_devlink_port);
103104 consume_skb(skb);
104105 }
drivers/net/ethernet/nxp/lpc_eth.c+0−3
@@ -1356,9 +1356,6 @@ static int lpc_eth_drv_probe(struct platform_device *pdev) · 1355 unmodified lines
13561356 if (!is_valid_ether_addr(ndev->dev_addr))
13571357 eth_hw_addr_random(ndev);
13581358
1359− /* Reset the ethernet controller */
1360− __lpc_eth_reset(pldat);
1361−
13621359 /* then shut everything down to save power */
13631360 __lpc_eth_shutdown(pldat);
13641361
drivers/net/ethernet/pensando/ionic/ionic_lif.h+2−0
@@ -182,6 +182,8 @@ struct ionic_lif { · 181 unmodified lines
182182
183183 #define lif_to_txqcq(lif, i) ((lif)->txqcqs[i].qcq)
184184 #define lif_to_rxqcq(lif, i) ((lif)->rxqcqs[i].qcq)
185+#define lif_to_txstats(lif, i) ((lif)->txqcqs[i].stats->tx)
186+#define lif_to_rxstats(lif, i) ((lif)->rxqcqs[i].stats->rx)
185187 #define lif_to_txq(lif, i) (&lif_to_txqcq((lif), i)->q)
186188 #define lif_to_rxq(lif, i) (&lif_to_txqcq((lif), i)->q)
187189
drivers/net/ethernet/pensando/ionic/ionic_stats.c+19−10
@@ -117,7 +117,8 @@ static u64 ionic_sw_stats_get_count(struct ionic_lif *lif) · 116 unmodified lines
117117 /* rx stats */
118118 total += MAX_Q(lif) * IONIC_NUM_RX_STATS;
119119
120− if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
120+ if (test_bit(IONIC_LIF_UP, lif->state) &&
121+ test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
121122 /* tx debug stats */
122123 total += MAX_Q(lif) * (IONIC_NUM_DBG_CQ_STATS +
123124 IONIC_NUM_TX_Q_STATS +
@@ -149,7 +150,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf) · 25 unmodified lines
149150 *buf += ETH_GSTRING_LEN;
150151 }
151152
152− if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
153+ if (test_bit(IONIC_LIF_UP, lif->state) &&
154+ test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
153155 for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
154156 snprintf(*buf, ETH_GSTRING_LEN,
155157 "txq_%d_%s",
@@ -187,7 +189,8 @@ static void ionic_sw_stats_get_strings(struct ionic_lif *lif, u8 **buf) · 31 unmodified lines
187189 *buf += ETH_GSTRING_LEN;
188190 }
189191
190− if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
192+ if (test_bit(IONIC_LIF_UP, lif->state) &&
193+ test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
191194 for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
192195 snprintf(*buf, ETH_GSTRING_LEN,
193196 "rxq_%d_cq_%s",
@@ -223,6 +226,8 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) · 29 unmodified lines
223226 {
224227 struct ionic_lif_sw_stats lif_stats;
225228 struct ionic_qcq *txqcq, *rxqcq;
229+ struct ionic_tx_stats *txstats;
230+ struct ionic_rx_stats *rxstats;
226231 int i, q_num;
227232
228233 ionic_get_lif_stats(lif, &lif_stats);
@@ -233,15 +238,17 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) · 4 unmodified lines
233238 }
234239
235240 for (q_num = 0; q_num < MAX_Q(lif); q_num++) {
236− txqcq = lif_to_txqcq(lif, q_num);
241+ txstats = &lif_to_txstats(lif, q_num);
237242
238243 for (i = 0; i < IONIC_NUM_TX_STATS; i++) {
239− **buf = IONIC_READ_STAT64(&txqcq->stats->tx,
244+ **buf = IONIC_READ_STAT64(txstats,
240245 &ionic_tx_stats_desc[i]);
241246 (*buf)++;
242247 }
243248
244− if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
249+ if (test_bit(IONIC_LIF_UP, lif->state) &&
250+ test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
251+ txqcq = lif_to_txqcq(lif, q_num);
245252 for (i = 0; i < IONIC_NUM_TX_Q_STATS; i++) {
246253 **buf = IONIC_READ_STAT64(&txqcq->q,
247254 &ionic_txq_stats_desc[i]);
@@ -258,22 +265,24 @@ static void ionic_sw_stats_get_values(struct ionic_lif *lif, u64 **buf) · 10 unmodified lines
258265 (*buf)++;
259266 }
260267 for (i = 0; i < IONIC_MAX_NUM_SG_CNTR; i++) {
261− **buf = txqcq->stats->tx.sg_cntr[i];
268+ **buf = txstats->sg_cntr[i];
262269 (*buf)++;
263270 }
264271 }
265272 }
266273
267274 for (q_num = 0; q_num < MAX_Q(lif); q_num++) {
268− rxqcq = lif_to_rxqcq(lif, q_num);
275+ rxstats = &lif_to_rxstats(lif, q_num);
269276
270277 for (i = 0; i < IONIC_NUM_RX_STATS; i++) {
271− **buf = IONIC_READ_STAT64(&rxqcq->stats->rx,
278+ **buf = IONIC_READ_STAT64(rxstats,
272279 &ionic_rx_stats_desc[i]);
273280 (*buf)++;
274281 }
275282
276− if (test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
283+ if (test_bit(IONIC_LIF_UP, lif->state) &&
284+ test_bit(IONIC_LIF_SW_DEBUG_STATS, lif->state)) {
285+ rxqcq = lif_to_rxqcq(lif, q_num);
277286 for (i = 0; i < IONIC_NUM_DBG_CQ_STATS; i++) {
278287 **buf = IONIC_READ_STAT64(&rxqcq->cq,
279288 &ionic_dbg_cq_stats_desc[i]);
drivers/net/ethernet/realtek/r8169_main.c+11−24
@@ -4146,6 +4146,14 @@ static void rtl_hw_jumbo_disable(struct rtl8169_private *tp) · 4145 unmodified lines
41464146 rtl_lock_config_regs(tp);
41474147 }
41484148
4149+static void rtl_jumbo_config(struct rtl8169_private *tp, int mtu)
4150+{
4151+ if (mtu > ETH_DATA_LEN)
4152+ rtl_hw_jumbo_enable(tp);
4153+ else
4154+ rtl_hw_jumbo_disable(tp);
4155+}
4156+
41494157 DECLARE_RTL_COND(rtl_chipcmd_cond)
41504158 {
41514159 return RTL_R8(tp, ChipCmd) & CmdReset;
@@ -4442,11 +4450,6 @@ static void rtl8168g_set_pause_thresholds(struct rtl8169_private *tp, · 290 unmodified lines
44424450 static void rtl_hw_start_8168bb(struct rtl8169_private *tp)
44434451 {
44444452 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
4445−
4446− if (tp->dev->mtu <= ETH_DATA_LEN) {
4447− rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B |
4448− PCI_EXP_DEVCTL_NOSNOOP_EN);
4449− }
44504453 }
44514454
44524455 static void rtl_hw_start_8168bef(struct rtl8169_private *tp)
@@ -4462,9 +4465,6 @@ static void __rtl_hw_start_8168cp(struct rtl8169_private *tp) · 9 unmodified lines
44624465
44634466 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
44644467
4465− if (tp->dev->mtu <= ETH_DATA_LEN)
4466− rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
4467−
44684468 rtl_disable_clock_request(tp);
44694469 }
44704470
@@ -4490,9 +4490,6 @@ static void rtl_hw_start_8168cp_2(struct rtl8169_private *tp) · 19 unmodified lines
44904490 rtl_set_def_aspm_entry_latency(tp);
44914491
44924492 RTL_W8(tp, Config3, RTL_R8(tp, Config3) & ~Beacon_en);
4493−
4494− if (tp->dev->mtu <= ETH_DATA_LEN)
4495− rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
44964493 }
44974494
44984495 static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp)
@@ -4503,9 +4500,6 @@ static void rtl_hw_start_8168cp_3(struct rtl8169_private *tp) · 4 unmodified lines
45034500
45044501 /* Magic. */
45054502 RTL_W8(tp, DBG_REG, 0x20);
4506−
4507− if (tp->dev->mtu <= ETH_DATA_LEN)
4508− rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
45094503 }
45104504
45114505 static void rtl_hw_start_8168c_1(struct rtl8169_private *tp)
@@ -4611,9 +4605,6 @@ static void rtl_hw_start_8168e_1(struct rtl8169_private *tp) · 99 unmodified lines
46114605
46124606 rtl_ephy_init(tp, e_info_8168e_1);
46134607
4614− if (tp->dev->mtu <= ETH_DATA_LEN)
4615− rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
4616−
46174608 rtl_disable_clock_request(tp);
46184609
46194610 /* Reset tx FIFO pointer */
@@ -4636,9 +4627,6 @@ static void rtl_hw_start_8168e_2(struct rtl8169_private *tp) · 16 unmodified lines
46364627
46374628 rtl_ephy_init(tp, e_info_8168e_2);
46384629
4639− if (tp->dev->mtu <= ETH_DATA_LEN)
4640− rtl_tx_performance_tweak(tp, PCI_EXP_DEVCTL_READRQ_4096B);
4641−
46424630 rtl_eri_write(tp, 0xc0, ERIAR_MASK_0011, 0x0000);
46434631 rtl_eri_write(tp, 0xb8, ERIAR_MASK_0011, 0x0000);
46444632 rtl_set_fifo_size(tp, 0x10, 0x10, 0x02, 0x06);
@@ -5485,6 +5473,8 @@ static void rtl_hw_start(struct rtl8169_private *tp) · 840 unmodified lines
54855473 rtl_set_rx_tx_desc_registers(tp);
54865474 rtl_lock_config_regs(tp);
54875475
5476+ rtl_jumbo_config(tp, tp->dev->mtu);
5477+
54885478 /* Initially a 10 us delay. Turned it into a PCI commit. - FR */
54895479 RTL_R16(tp, CPlusCmd);
54905480 RTL_W8(tp, ChipCmd, CmdTxEnb | CmdRxEnb);
@@ -5498,10 +5488,7 @@ static int rtl8169_change_mtu(struct net_device *dev, int new_mtu) · 7 unmodified lines
54985488 {
54995489 struct rtl8169_private *tp = netdev_priv(dev);
55005490
5501− if (new_mtu > ETH_DATA_LEN)
5502− rtl_hw_jumbo_enable(tp);
5503− else
5504− rtl_hw_jumbo_disable(tp);
5491+ rtl_jumbo_config(tp, new_mtu);
55055492
55065493 dev->mtu = new_mtu;
55075494 netdev_update_features(dev);
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+2−1
@@ -651,7 +651,8 @@ static void sun8i_dwmac_set_filter(struct mac_device_info *hw, · 650 unmodified lines
651651 }
652652 }
653653 } else {
654− netdev_info(dev, "Too many address, switching to promiscuous\n");
654+ if (!(readl(ioaddr + EMAC_RX_FRM_FLT) & EMAC_FRM_FLT_RXALL))
655+ netdev_info(dev, "Too many address, switching to promiscuous\n");
655656 v = EMAC_FRM_FLT_RXALL;
656657 }
657658
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c+1−1
@@ -448,7 +448,7 @@ static void dwmac4_set_filter(struct mac_device_info *hw, · 447 unmodified lines
448448 value |= GMAC_PACKET_FILTER_HPF;
449449
450450 /* Handle multiple unicast addresses */
451− if (netdev_uc_count(dev) > GMAC_MAX_PERFECT_ADDRESSES) {
451+ if (netdev_uc_count(dev) > hw->unicast_filter_entries) {
452452 /* Switch to promiscuous mode if more than 128 addrs
453453 * are required
454454 */
drivers/net/ethernet/stmicro/stmmac/dwmac5.c+1−0
@@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, · 514 unmodified lines
515515
516516 if (!enable) {
517517 val |= PPSCMDx(index, 0x5);
518+ val |= PPSEN0;
518519 writel(val, ioaddr + MAC_PPS_CONTROL);
519520 return 0;
520521 }
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+9−5
@@ -2610,7 +2610,7 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) · 2609 unmodified lines
26102610 }
26112611
26122612 if (priv->hw->pcs)
2613− stmmac_pcs_ctrl_ane(priv, priv->hw, 1, priv->hw->ps, 0);
2613+ stmmac_pcs_ctrl_ane(priv, priv->ioaddr, 1, priv->hw->ps, 0);
26142614
26152615 /* set TX and RX rings length */
26162616 stmmac_set_rings_length(priv);
@@ -4742,8 +4742,10 @@ int stmmac_suspend(struct device *dev) · 2125 unmodified lines
47424742 stmmac_mac_set(priv, priv->ioaddr, false);
47434743 pinctrl_pm_select_sleep_state(priv->device);
47444744 /* Disable clock in case of PWM is off */
4745− clk_disable(priv->plat->pclk);
4746− clk_disable(priv->plat->stmmac_clk);
4745+ if (priv->plat->clk_ptp_ref)
4746+ clk_disable_unprepare(priv->plat->clk_ptp_ref);
4747+ clk_disable_unprepare(priv->plat->pclk);
4748+ clk_disable_unprepare(priv->plat->stmmac_clk);
47474749 }
47484750 mutex_unlock(&priv->lock);
47494751
@@ -4806,8 +4808,10 @@ int stmmac_resume(struct device *dev) · 56 unmodified lines
48064808 } else {
48074809 pinctrl_pm_select_default_state(priv->device);
48084810 /* enable the clk previously disabled */
4809− clk_enable(priv->plat->stmmac_clk);
4810− clk_enable(priv->plat->pclk);
4811+ clk_prepare_enable(priv->plat->stmmac_clk);
4812+ clk_prepare_enable(priv->plat->pclk);
4813+ if (priv->plat->clk_ptp_ref)
4814+ clk_prepare_enable(priv->plat->clk_ptp_ref);
48114815 /* reset the phy so that it's ready */
48124816 if (priv->mii)
48134817 stmmac_mdio_reset(priv->mii);
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c+1−1
@@ -164,7 +164,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp, · 163 unmodified lines
164164 /* structure describing a PTP hardware clock */
165165 static struct ptp_clock_info stmmac_ptp_clock_ops = {
166166 .owner = THIS_MODULE,
167− .name = "stmmac_ptp_clock",
167+ .name = "stmmac ptp",
168168 .max_adj = 62500000,
169169 .n_alarm = 0,
170170 .n_ext_ts = 0,
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c+9−2
@@ -487,8 +487,8 @@ static int stmmac_filter_check(struct stmmac_priv *priv) · 486 unmodified lines
487487
488488 static int stmmac_test_hfilt(struct stmmac_priv *priv)
489489 {
490− unsigned char gd_addr[ETH_ALEN] = {0x01, 0x00, 0xcc, 0xcc, 0xdd, 0xdd};
491− unsigned char bd_addr[ETH_ALEN] = {0x09, 0x00, 0xaa, 0xaa, 0xbb, 0xbb};
490+ unsigned char gd_addr[ETH_ALEN] = {0x01, 0xee, 0xdd, 0xcc, 0xbb, 0xaa};
491+ unsigned char bd_addr[ETH_ALEN] = {0x01, 0x01, 0x02, 0x03, 0x04, 0x05};
492492 struct stmmac_packet_attrs attr = { };
493493 int ret;
494494
@@ -496,6 +496,9 @@ static int stmmac_test_hfilt(struct stmmac_priv *priv) · 1 unmodified line
496496 if (ret)
497497 return ret;
498498
499+ if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins)
500+ return -EOPNOTSUPP;
501+
499502 ret = dev_mc_add(priv->dev, gd_addr);
500503 if (ret)
501504 return ret;
@@ -573,6 +576,8 @@ static int stmmac_test_mcfilt(struct stmmac_priv *priv) · 71 unmodified lines
573576
574577 if (stmmac_filter_check(priv))
575578 return -EOPNOTSUPP;
579+ if (!priv->hw->multicast_filter_bins)
580+ return -EOPNOTSUPP;
576581
577582 /* Remove all MC addresses */
578583 __dev_mc_unsync(priv->dev, NULL);
@@ -611,6 +616,8 @@ static int stmmac_test_ucfilt(struct stmmac_priv *priv) · 32 unmodified lines
611616
612617 if (stmmac_filter_check(priv))
613618 return -EOPNOTSUPP;
619+ if (!priv->hw->multicast_filter_bins)
620+ return -EOPNOTSUPP;
614621
615622 /* Remove all UC addresses */
616623 __dev_uc_unsync(priv->dev, NULL);
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c+1−1
@@ -510,7 +510,7 @@ static struct stmmac_flow_entry *tc_find_flow(struct stmmac_priv *priv, · 509 unmodified lines
510510 return NULL;
511511 }
512512
513−struct {
513+static struct {
514514 int (*fn)(struct stmmac_priv *priv, struct flow_cls_offload *cls,
515515 struct stmmac_flow_entry *entry);
516516 } tc_flow_parsers[] = {
drivers/net/ethernet/ti/davinci_cpdma.c+1−1
@@ -722,7 +722,7 @@ static void cpdma_chan_set_descs(struct cpdma_ctlr *ctlr, · 721 unmodified lines
722722 * cpdma_chan_split_pool - Splits ctrl pool between all channels.
723723 * Has to be called under ctlr lock
724724 */
725−int cpdma_chan_split_pool(struct cpdma_ctlr *ctlr)
725+static int cpdma_chan_split_pool(struct cpdma_ctlr *ctlr)
726726 {
727727 int tx_per_ch_desc = 0, rx_per_ch_desc = 0;
728728 int free_rx_num = 0, free_tx_num = 0;
drivers/net/netdevsim/fib.c+2−1
@@ -241,8 +241,8 @@ static struct pernet_operations nsim_fib_net_ops = { · 240 unmodified lines
241241
242242 void nsim_fib_exit(void)
243243 {
244− unregister_pernet_subsys(&nsim_fib_net_ops);
245244 unregister_fib_notifier(&nsim_fib_nb);
245+ unregister_pernet_subsys(&nsim_fib_net_ops);
246246 }
247247
248248 int nsim_fib_init(void)
@@ -258,6 +258,7 @@ int nsim_fib_init(void) · 9 unmodified lines
258258 err = register_fib_notifier(&nsim_fib_nb, nsim_fib_dump_inconsistent);
259259 if (err < 0) {
260260 pr_err("Failed to register fib notifier\n");
261+ unregister_pernet_subsys(&nsim_fib_net_ops);
261262 goto err_out;
262263 }
263264
drivers/net/phy/bcm7xxx.c+1−0
@@ -572,6 +572,7 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) · 571 unmodified lines
572572 .name = _name, \
573573 /* PHY_BASIC_FEATURES */ \
574574 .flags = PHY_IS_INTERNAL, \
575+ .soft_reset = genphy_soft_reset, \
575576 .config_init = bcm7xxx_config_init, \
576577 .suspend = bcm7xxx_suspend, \
577578 .resume = bcm7xxx_config_init, \
drivers/net/phy/micrel.c+37−5
@@ -341,6 +341,35 @@ static int ksz8041_config_aneg(struct phy_device *phydev) · 340 unmodified lines
341341 return genphy_config_aneg(phydev);
342342 }
343343
344+static int ksz8051_ksz8795_match_phy_device(struct phy_device *phydev,
345+ const u32 ksz_phy_id)
346+{
347+ int ret;
348+
349+ if ((phydev->phy_id & MICREL_PHY_ID_MASK) != ksz_phy_id)
350+ return 0;
351+
352+ ret = phy_read(phydev, MII_BMSR);
353+ if (ret < 0)
354+ return ret;
355+
356+ /* KSZ8051 PHY and KSZ8794/KSZ8795/KSZ8765 switch share the same
357+ * exact PHY ID. However, they can be told apart by the extended
358+ * capability registers presence. The KSZ8051 PHY has them while
359+ * the switch does not.
360+ */
361+ ret &= BMSR_ERCAP;
362+ if (ksz_phy_id == PHY_ID_KSZ8051)
363+ return ret;
364+ else
365+ return !ret;
366+}
367+
368+static int ksz8051_match_phy_device(struct phy_device *phydev)
369+{
370+ return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ8051);
371+}
372+
344373 static int ksz8081_config_init(struct phy_device *phydev)
345374 {
346375 /* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line
@@ -364,6 +393,11 @@ static int ksz8061_config_init(struct phy_device *phydev) · 17 unmodified lines
364393 return kszphy_config_init(phydev);
365394 }
366395
396+static int ksz8795_match_phy_device(struct phy_device *phydev)
397+{
398+ return ksz8051_ksz8795_match_phy_device(phydev, PHY_ID_KSZ87XX);
399+}
400+
367401 static int ksz9021_load_values_from_of(struct phy_device *phydev,
368402 const struct device_node *of_node,
369403 u16 reg,
@@ -1017,8 +1051,6 @@ static struct phy_driver ksphy_driver[] = { · 647 unmodified lines
10171051 .suspend = genphy_suspend,
10181052 .resume = genphy_resume,
10191053 }, {
1020− .phy_id = PHY_ID_KSZ8051,
1021− .phy_id_mask = MICREL_PHY_ID_MASK,
10221054 .name = "Micrel KSZ8051",
10231055 /* PHY_BASIC_FEATURES */
10241056 .driver_data = &ksz8051_type,
@@ -1029,6 +1061,7 @@ static struct phy_driver ksphy_driver[] = { · 4 unmodified lines
10291061 .get_sset_count = kszphy_get_sset_count,
10301062 .get_strings = kszphy_get_strings,
10311063 .get_stats = kszphy_get_stats,
1064+ .match_phy_device = ksz8051_match_phy_device,
10321065 .suspend = genphy_suspend,
10331066 .resume = genphy_resume,
10341067 }, {
@@ -1141,13 +1174,12 @@ static struct phy_driver ksphy_driver[] = { · 106 unmodified lines
11411174 .suspend = genphy_suspend,
11421175 .resume = genphy_resume,
11431176 }, {
1144− .phy_id = PHY_ID_KSZ8795,
1145− .phy_id_mask = MICREL_PHY_ID_MASK,
1146− .name = "Micrel KSZ8795",
1177+ .name = "Micrel KSZ87XX Switch",
11471178 /* PHY_BASIC_FEATURES */
11481179 .config_init = kszphy_config_init,
11491180 .config_aneg = ksz8873mll_config_aneg,
11501181 .read_status = ksz8873mll_read_status,
1182+ .match_phy_device = ksz8795_match_phy_device,
11511183 .suspend = genphy_suspend,
11521184 .resume = genphy_resume,
11531185 }, {
drivers/net/phy/phy-c45.c+2−0
@@ -323,6 +323,8 @@ int genphy_c45_read_pma(struct phy_device *phydev) · 322 unmodified lines
323323 {
324324 int val;
325325
326+ linkmode_zero(phydev->lp_advertising);
327+
326328 val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1);
327329 if (val < 0)
328330 return val;
drivers/net/phy/phy.c+0−3
@@ -572,9 +572,6 @@ int phy_start_aneg(struct phy_device *phydev) · 571 unmodified lines
572572 if (AUTONEG_DISABLE == phydev->autoneg)
573573 phy_sanitize_settings(phydev);
574574
575− /* Invalidate LP advertising flags */
576− linkmode_zero(phydev->lp_advertising);
577−
578575 err = phy_config_aneg(phydev);
579576 if (err < 0)
580577 goto out_unlock;
drivers/net/phy/phy_device.c+10−1
@@ -1787,7 +1787,14 @@ int genphy_read_lpa(struct phy_device *phydev) · 1786 unmodified lines
17871787 {
17881788 int lpa, lpagb;
17891789
1790− if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
1790+ if (phydev->autoneg == AUTONEG_ENABLE) {
1791+ if (!phydev->autoneg_complete) {
1792+ mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising,
1793+ 0);
1794+ mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
1795+ return 0;
1796+ }
1797+
17911798 if (phydev->is_gigabit_capable) {
17921799 lpagb = phy_read(phydev, MII_STAT1000);
17931800 if (lpagb < 0)
@@ -1815,6 +1822,8 @@ int genphy_read_lpa(struct phy_device *phydev) · 21 unmodified lines
18151822 return lpa;
18161823
18171824 mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa);
1825+ } else {
1826+ linkmode_zero(phydev->lp_advertising);
18181827 }
18191828
18201829 return 0;
drivers/net/phy/phylink.c+1−1
@@ -576,7 +576,7 @@ static int phylink_register_sfp(struct phylink *pl, · 575 unmodified lines
576576
577577 /**
578578 * phylink_create() - create a phylink instance
579− * @ndev: a pointer to the &struct net_device
579+ * @config: a pointer to the target &struct phylink_config
580580 * @fwnode: a pointer to a &struct fwnode_handle describing the network
581581 * interface
582582 * @iface: the desired link mode defined by &typedef phy_interface_t
drivers/net/tun.c+2−2
@@ -526,8 +526,8 @@ static void tun_flow_update(struct tun_struct *tun, u32 rxhash, · 525 unmodified lines
526526 e = tun_flow_find(head, rxhash);
527527 if (likely(e)) {
528528 /* TODO: keep queueing to old queue until it's empty? */
529− if (e->queue_index != queue_index)
530− e->queue_index = queue_index;
529+ if (READ_ONCE(e->queue_index) != queue_index)
530+ WRITE_ONCE(e->queue_index, queue_index);
531531 if (e->updated != jiffies)
532532 e->updated = jiffies;
533533 sock_rps_record_flow_hash(e->rps_rxhash);
drivers/net/usb/hso.c+9−4
@@ -186,7 +186,7 @@ struct hso_tiocmget { · 185 unmodified lines
186186 int intr_completed;
187187 struct usb_endpoint_descriptor *endp;
188188 struct urb *urb;
189− struct hso_serial_state_notification serial_state_notification;
189+ struct hso_serial_state_notification *serial_state_notification;
190190 u16 prev_UART_state_bitmap;
191191 struct uart_icount icount;
192192 };
@@ -1432,7 +1432,7 @@ static int tiocmget_submit_urb(struct hso_serial *serial, · 1239 unmodified lines
14321432 usb_rcvintpipe(usb,
14331433 tiocmget->endp->
14341434 bEndpointAddress & 0x7F),
1435− &tiocmget->serial_state_notification,
1435+ tiocmget->serial_state_notification,
14361436 sizeof(struct hso_serial_state_notification),
14371437 tiocmget_intr_callback, serial,
14381438 tiocmget->endp->bInterval);
@@ -1479,7 +1479,7 @@ static void tiocmget_intr_callback(struct urb *urb) · 40 unmodified lines
14791479 /* wIndex should be the USB interface number of the port to which the
14801480 * notification applies, which should always be the Modem port.
14811481 */
1482− serial_state_notification = &tiocmget->serial_state_notification;
1482+ serial_state_notification = tiocmget->serial_state_notification;
14831483 if (serial_state_notification->bmRequestType != BM_REQUEST_TYPE ||
14841484 serial_state_notification->bNotification != B_NOTIFICATION ||
14851485 le16_to_cpu(serial_state_notification->wValue) != W_VALUE ||
@@ -2565,6 +2565,8 @@ static void hso_free_tiomget(struct hso_serial *serial) · 1079 unmodified lines
25652565 usb_free_urb(tiocmget->urb);
25662566 tiocmget->urb = NULL;
25672567 serial->tiocmget = NULL;
2568+ kfree(tiocmget->serial_state_notification);
2569+ tiocmget->serial_state_notification = NULL;
25682570 kfree(tiocmget);
25692571 }
25702572 }
@@ -2615,10 +2617,13 @@ static struct hso_device *hso_create_bulk_serial_device( · 44 unmodified lines
26152617 num_urbs = 2;
26162618 serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
26172619 GFP_KERNEL);
2620+ serial->tiocmget->serial_state_notification
2621+ = kzalloc(sizeof(struct hso_serial_state_notification),
2622+ GFP_KERNEL);
26182623 /* it isn't going to break our heart if serial->tiocmget
26192624 * allocation fails don't bother checking this.
26202625 */
2621− if (serial->tiocmget) {
2626+ if (serial->tiocmget && serial->tiocmget->serial_state_notification) {
26222627 tiocmget = serial->tiocmget;
26232628 tiocmget->endp = hso_get_ep(interface,
26242629 USB_ENDPOINT_XFER_INT,
drivers/net/usb/lan78xx.c+6−6
@@ -3782,10 +3782,14 @@ static int lan78xx_probe(struct usb_interface *intf, · 3781 unmodified lines
37823782 /* driver requires remote-wakeup capability during autosuspend. */
37833783 intf->needs_remote_wakeup = 1;
37843784
3785+ ret = lan78xx_phy_init(dev);
3786+ if (ret < 0)
3787+ goto out4;
3788+
37853789 ret = register_netdev(netdev);
37863790 if (ret != 0) {
37873791 netif_err(dev, probe, netdev, "couldn't register the device\n");
3788− goto out4;
3792+ goto out5;
37893793 }
37903794
37913795 usb_set_intfdata(intf, dev);
@@ -3798,14 +3802,10 @@ static int lan78xx_probe(struct usb_interface *intf, · 6 unmodified lines
37983802 pm_runtime_set_autosuspend_delay(&udev->dev,
37993803 DEFAULT_AUTOSUSPEND_DELAY);
38003804
3801− ret = lan78xx_phy_init(dev);
3802− if (ret < 0)
3803− goto out5;
3804−
38053805 return 0;
38063806
38073807 out5:
3808− unregister_netdev(netdev);
3808+ phy_disconnect(netdev->phydev);
38093809 out4:
38103810 usb_free_urb(dev->urb_intr);
38113811 out3:
drivers/net/usb/qmi_wwan.c+1−0
@@ -1327,6 +1327,7 @@ static const struct usb_device_id products[] = { · 1326 unmodified lines
13271327 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
13281328 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
13291329 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
1330+ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */
13301331 {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
13311332 {QMI_FIXED_INTF(0x1bc7, 0x1101, 3)}, /* Telit ME910 dual modem */
13321333 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
drivers/net/usb/sr9800.c+1−1
@@ -335,7 +335,7 @@ static void sr_set_multicast(struct net_device *net) · 334 unmodified lines
335335 static int sr_mdio_read(struct net_device *net, int phy_id, int loc)
336336 {
337337 struct usbnet *dev = netdev_priv(net);
338− __le16 res;
338+ __le16 res = 0;
339339
340340 mutex_lock(&dev->phy_mutex);
341341 sr_set_sw_mii(dev);
drivers/net/wireless/ath/ath10k/core.c+9−6
@@ -2118,12 +2118,15 @@ static int ath10k_init_uart(struct ath10k *ar) · 2117 unmodified lines
21182118 return ret;
21192119 }
21202120
2121− if (!uart_print && ar->hw_params.uart_pin_workaround) {
2122− ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin,
2123− ar->hw_params.uart_pin);
2124− if (ret) {
2125− ath10k_warn(ar, "failed to set UART TX pin: %d", ret);
2126− return ret;
2121+ if (!uart_print) {
2122+ if (ar->hw_params.uart_pin_workaround) {
2123+ ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin,
2124+ ar->hw_params.uart_pin);
2125+ if (ret) {
2126+ ath10k_warn(ar, "failed to set UART TX pin: %d",
2127+ ret);
2128+ return ret;
2129+ }
21272130 }
21282131
21292132 return 0;
drivers/net/wireless/intel/iwlwifi/fw/acpi.c+6−4
@@ -162,12 +162,13 @@ int iwl_acpi_get_mcc(struct device *dev, char *mcc) · 161 unmodified lines
162162
163163 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_WRDD_WIFI_DATA_SIZE,
164164 &tbl_rev);
165− if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
165+ if (IS_ERR(wifi_pkg)) {
166166 ret = PTR_ERR(wifi_pkg);
167167 goto out_free;
168168 }
169169
170− if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
170+ if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
171+ tbl_rev != 0) {
171172 ret = -EINVAL;
172173 goto out_free;
173174 }
@@ -224,12 +225,13 @@ int iwl_acpi_get_eckv(struct device *dev, u32 *extl_clk) · 50 unmodified lines
224225
225226 wifi_pkg = iwl_acpi_get_wifi_pkg(dev, data, ACPI_ECKV_WIFI_DATA_SIZE,
226227 &tbl_rev);
227− if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
228+ if (IS_ERR(wifi_pkg)) {
228229 ret = PTR_ERR(wifi_pkg);
229230 goto out_free;
230231 }
231232
232− if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
233+ if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
234+ tbl_rev != 0) {
233235 ret = -EINVAL;
234236 goto out_free;
235237 }
drivers/net/wireless/intel/iwlwifi/fw/dbg.c+1−0
@@ -646,6 +646,7 @@ static struct scatterlist *alloc_sgtable(int size) · 645 unmodified lines
646646 if (new_page)
647647 __free_page(new_page);
648648 }
649+ kfree(table);
649650 return NULL;
650651 }
651652 alloc_size = min_t(int, size, PAGE_SIZE);
drivers/net/wireless/intel/iwlwifi/iwl-io.h+6−6
@@ -112,38 +112,38 @@ int iwl_dump_fh(struct iwl_trans *trans, char **buf); · 111 unmodified lines
112112 */
113113 static inline u32 iwl_umac_prph(struct iwl_trans *trans, u32 ofs)
114114 {
115− return ofs + trans->cfg->trans.umac_prph_offset;
115+ return ofs + trans->trans_cfg->umac_prph_offset;
116116 }
117117
118118 static inline u32 iwl_read_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs)
119119 {
120120 return iwl_read_prph_no_grab(trans, ofs +
121− trans->cfg->trans.umac_prph_offset);
121+ trans->trans_cfg->umac_prph_offset);
122122 }
123123
124124 static inline u32 iwl_read_umac_prph(struct iwl_trans *trans, u32 ofs)
125125 {
126− return iwl_read_prph(trans, ofs + trans->cfg->trans.umac_prph_offset);
126+ return iwl_read_prph(trans, ofs + trans->trans_cfg->umac_prph_offset);
127127 }
128128
129129 static inline void iwl_write_umac_prph_no_grab(struct iwl_trans *trans, u32 ofs,
130130 u32 val)
131131 {
132− iwl_write_prph_no_grab(trans, ofs + trans->cfg->trans.umac_prph_offset,
132+ iwl_write_prph_no_grab(trans, ofs + trans->trans_cfg->umac_prph_offset,
133133 val);
134134 }
135135
136136 static inline void iwl_write_umac_prph(struct iwl_trans *trans, u32 ofs,
137137 u32 val)
138138 {
139− iwl_write_prph(trans, ofs + trans->cfg->trans.umac_prph_offset, val);
139+ iwl_write_prph(trans, ofs + trans->trans_cfg->umac_prph_offset, val);
140140 }
141141
142142 static inline int iwl_poll_umac_prph_bit(struct iwl_trans *trans, u32 addr,
143143 u32 bits, u32 mask, int timeout)
144144 {
145145 return iwl_poll_prph_bit(trans, addr +
146− trans->cfg->trans.umac_prph_offset,
146+ trans->trans_cfg->umac_prph_offset,
147147 bits, mask, timeout);
148148 }
149149
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+30−13
@@ -420,6 +420,9 @@ static int iwl_run_unified_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) · 419 unmodified lines
420420 };
421421 int ret;
422422
423+ if (mvm->trans->cfg->tx_with_siso_diversity)
424+ init_cfg.init_flags |= cpu_to_le32(BIT(IWL_INIT_PHY));
425+
423426 lockdep_assert_held(&mvm->mutex);
424427
425428 mvm->rfkill_safe_init_done = false;
@@ -694,12 +697,13 @@ static int iwl_mvm_sar_get_wrds_table(struct iwl_mvm *mvm) · 268 unmodified lines
694697
695698 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
696699 ACPI_WRDS_WIFI_DATA_SIZE, &tbl_rev);
697− if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
700+ if (IS_ERR(wifi_pkg)) {
698701 ret = PTR_ERR(wifi_pkg);
699702 goto out_free;
700703 }
701704
702− if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) {
705+ if (wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER ||
706+ tbl_rev != 0) {
703707 ret = -EINVAL;
704708 goto out_free;
705709 }
@@ -731,13 +735,14 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) · 25 unmodified lines
731735
732736 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
733737 ACPI_EWRD_WIFI_DATA_SIZE, &tbl_rev);
734− if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
738+ if (IS_ERR(wifi_pkg)) {
735739 ret = PTR_ERR(wifi_pkg);
736740 goto out_free;
737741 }
738742
739743 if ((wifi_pkg->package.elements[1].type != ACPI_TYPE_INTEGER) ||
740− (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER)) {
744+ (wifi_pkg->package.elements[2].type != ACPI_TYPE_INTEGER) ||
745+ tbl_rev != 0) {
741746 ret = -EINVAL;
742747 goto out_free;
743748 }
@@ -791,11 +796,16 @@ static int iwl_mvm_sar_get_wgds_table(struct iwl_mvm *mvm) · 47 unmodified lines
791796
792797 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
793798 ACPI_WGDS_WIFI_DATA_SIZE, &tbl_rev);
794− if (IS_ERR(wifi_pkg) || tbl_rev > 1) {
799+ if (IS_ERR(wifi_pkg)) {
795800 ret = PTR_ERR(wifi_pkg);
796801 goto out_free;
797802 }
798803
804+ if (tbl_rev != 0) {
805+ ret = -EINVAL;
806+ goto out_free;
807+ }
808+
799809 mvm->geo_rev = tbl_rev;
800810 for (i = 0; i < ACPI_NUM_GEO_PROFILES; i++) {
801811 for (j = 0; j < ACPI_GEO_TABLE_SIZE; j++) {
@@ -889,15 +899,17 @@ static bool iwl_mvm_sar_geo_support(struct iwl_mvm *mvm) · 87 unmodified lines
889899 * firmware versions. Unfortunately, we don't have a TLV API
890900 * flag to rely on, so rely on the major version which is in
891901 * the first byte of ucode_ver. This was implemented
892− * initially on version 38 and then backported to29 and 17.
893− * The intention was to have it in 36 as well, but not all
894− * 8000 family got this feature enabled. The 8000 family is
895− * the only one using version 36, so skip this version
896− * entirely.
902+ * initially on version 38 and then backported to 17. It was
903+ * also backported to 29, but only for 7265D devices. The
904+ * intention was to have it in 36 as well, but not all 8000
905+ * family got this feature enabled. The 8000 family is the
906+ * only one using version 36, so skip this version entirely.
897907 */
898908 return IWL_UCODE_SERIAL(mvm->fw->ucode_ver) >= 38 ||
899− IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 ||
900− IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17;
909+ IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 17 ||
910+ (IWL_UCODE_SERIAL(mvm->fw->ucode_ver) == 29 &&
911+ ((mvm->trans->hw_rev & CSR_HW_REV_TYPE_MSK) ==
912+ CSR_HW_REV_TYPE_7265D));
901913 }
902914
903915 int iwl_mvm_get_sar_geo_profile(struct iwl_mvm *mvm)
@@ -1020,11 +1032,16 @@ static int iwl_mvm_get_ppag_table(struct iwl_mvm *mvm) · 116 unmodified lines
10201032 wifi_pkg = iwl_acpi_get_wifi_pkg(mvm->dev, data,
10211033 ACPI_PPAG_WIFI_DATA_SIZE, &tbl_rev);
10221034
1023− if (IS_ERR(wifi_pkg) || tbl_rev != 0) {
1035+ if (IS_ERR(wifi_pkg)) {
10241036 ret = PTR_ERR(wifi_pkg);
10251037 goto out_free;
10261038 }
10271039
1040+ if (tbl_rev != 0) {
1041+ ret = -EINVAL;
1042+ goto out_free;
1043+ }
1044+
10281045 enabled = &wifi_pkg->package.elements[1];
10291046 if (enabled->type != ACPI_TYPE_INTEGER ||
10301047 (enabled->integer.value != 0 && enabled->integer.value != 1)) {
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+5−4
@@ -4881,11 +4881,11 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, · 4880 unmodified lines
48814881 if (!iwl_mvm_has_new_rx_api(mvm))
48824882 return;
48834883
4884− notif->cookie = mvm->queue_sync_cookie;
4885−
4886− if (notif->sync)
4884+ if (notif->sync) {
4885+ notif->cookie = mvm->queue_sync_cookie;
48874886 atomic_set(&mvm->queue_sync_counter,
48884887 mvm->trans->num_rx_queues);
4888+ }
48894889
48904890 ret = iwl_mvm_notify_rx_queue(mvm, qmask, (u8 *)notif,
48914891 size, !notif->sync);
@@ -4905,7 +4905,8 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm, · 13 unmodified lines
49054905
49064906 out:
49074907 atomic_set(&mvm->queue_sync_counter, 0);
4908− mvm->queue_sync_cookie++;
4908+ if (notif->sync)
4909+ mvm->queue_sync_cookie++;
49094910 }
49104911
49114912 static void iwl_mvm_sync_rx_queues(struct ieee80211_hw *hw)
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c+25−11
@@ -107,13 +107,9 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 106 unmodified lines
107107
108108 /* allocate ucode sections in dram and set addresses */
109109 ret = iwl_pcie_init_fw_sec(trans, fw, &prph_scratch->dram);
110− if (ret) {
111− dma_free_coherent(trans->dev,
112− sizeof(*prph_scratch),
113− prph_scratch,
114− trans_pcie->prph_scratch_dma_addr);
115− return ret;
116− }
110+ if (ret)
111+ goto err_free_prph_scratch;
112+
117113
118114 /* Allocate prph information
119115 * currently we don't assign to the prph info anything, but it would get
@@ -121,16 +117,20 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 1 unmodified line
121117 prph_info = dma_alloc_coherent(trans->dev, sizeof(*prph_info),
122118 &trans_pcie->prph_info_dma_addr,
123119 GFP_KERNEL);
124− if (!prph_info)
125− return -ENOMEM;
120+ if (!prph_info) {
121+ ret = -ENOMEM;
122+ goto err_free_prph_scratch;
123+ }
126124
127125 /* Allocate context info */
128126 ctxt_info_gen3 = dma_alloc_coherent(trans->dev,
129127 sizeof(*ctxt_info_gen3),
130128 &trans_pcie->ctxt_info_dma_addr,
131129 GFP_KERNEL);
132− if (!ctxt_info_gen3)
133− return -ENOMEM;
130+ if (!ctxt_info_gen3) {
131+ ret = -ENOMEM;
132+ goto err_free_prph_info;
133+ }
134134
135135 ctxt_info_gen3->prph_info_base_addr =
136136 cpu_to_le64(trans_pcie->prph_info_dma_addr);
@@ -186,6 +186,20 @@ int iwl_pcie_ctxt_info_gen3_init(struct iwl_trans *trans, · 49 unmodified lines
186186 iwl_set_bit(trans, CSR_GP_CNTRL, CSR_AUTO_FUNC_INIT);
187187
188188 return 0;
189+
190+err_free_prph_info:
191+ dma_free_coherent(trans->dev,
192+ sizeof(*prph_info),
193+ prph_info,
194+ trans_pcie->prph_info_dma_addr);
195+
196+err_free_prph_scratch:
197+ dma_free_coherent(trans->dev,
198+ sizeof(*prph_scratch),
199+ prph_scratch,
200+ trans_pcie->prph_scratch_dma_addr);
201+ return ret;
202+
189203 }
190204
191205 void iwl_pcie_ctxt_info_gen3_free(struct iwl_trans *trans)
drivers/net/wireless/intel/iwlwifi/pcie/drv.c+137−137
@@ -513,31 +513,33 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 512 unmodified lines
513513 {IWL_PCI_DEVICE(0x24FD, 0x9074, iwl8265_2ac_cfg)},
514514
515515 /* 9000 Series */
516− {IWL_PCI_DEVICE(0x02F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
517− {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
518− {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
519− {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
520− {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)},
521− {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)},
522− {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
523− {IWL_PCI_DEVICE(0x02F0, 0x00A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
524− {IWL_PCI_DEVICE(0x02F0, 0x0230, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
525− {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
526− {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
527− {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
528− {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)},
529− {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_quz_a0_jf_b0_soc)},
530− {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
531− {IWL_PCI_DEVICE(0x02F0, 0x02A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
532− {IWL_PCI_DEVICE(0x02F0, 0x1551, iwl9560_killer_s_2ac_cfg_quz_a0_jf_b0_soc)},
533− {IWL_PCI_DEVICE(0x02F0, 0x1552, iwl9560_killer_i_2ac_cfg_quz_a0_jf_b0_soc)},
534− {IWL_PCI_DEVICE(0x02F0, 0x2030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
535− {IWL_PCI_DEVICE(0x02F0, 0x2034, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
536− {IWL_PCI_DEVICE(0x02F0, 0x4030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
537− {IWL_PCI_DEVICE(0x02F0, 0x4034, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
538− {IWL_PCI_DEVICE(0x02F0, 0x40A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
539− {IWL_PCI_DEVICE(0x02F0, 0x4234, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
540− {IWL_PCI_DEVICE(0x02F0, 0x42A4, iwl9462_2ac_cfg_quz_a0_jf_b0_soc)},
516+ {IWL_PCI_DEVICE(0x02F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
517+ {IWL_PCI_DEVICE(0x02F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
518+ {IWL_PCI_DEVICE(0x02F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
519+ {IWL_PCI_DEVICE(0x02F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
520+ {IWL_PCI_DEVICE(0x02F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
521+ {IWL_PCI_DEVICE(0x02F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
522+ {IWL_PCI_DEVICE(0x02F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
523+ {IWL_PCI_DEVICE(0x02F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
524+ {IWL_PCI_DEVICE(0x02F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
525+ {IWL_PCI_DEVICE(0x02F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
526+ {IWL_PCI_DEVICE(0x02F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
527+ {IWL_PCI_DEVICE(0x02F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
528+ {IWL_PCI_DEVICE(0x02F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
529+ {IWL_PCI_DEVICE(0x02F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
530+ {IWL_PCI_DEVICE(0x02F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
531+ {IWL_PCI_DEVICE(0x02F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
532+ {IWL_PCI_DEVICE(0x02F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
533+ {IWL_PCI_DEVICE(0x02F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
534+ {IWL_PCI_DEVICE(0x02F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
535+ {IWL_PCI_DEVICE(0x02F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
536+ {IWL_PCI_DEVICE(0x02F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
537+ {IWL_PCI_DEVICE(0x02F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
538+ {IWL_PCI_DEVICE(0x02F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
539+ {IWL_PCI_DEVICE(0x02F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
540+ {IWL_PCI_DEVICE(0x02F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
541+ {IWL_PCI_DEVICE(0x02F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
542+
541543 {IWL_PCI_DEVICE(0x06F0, 0x0030, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
542544 {IWL_PCI_DEVICE(0x06F0, 0x0034, iwl9560_2ac_cfg_quz_a0_jf_b0_soc)},
543545 {IWL_PCI_DEVICE(0x06F0, 0x0038, iwl9560_2ac_160_cfg_quz_a0_jf_b0_soc)},
@@ -643,34 +645,34 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 99 unmodified lines
643645 {IWL_PCI_DEVICE(0x2720, 0x40A4, iwl9462_2ac_cfg_soc)},
644646 {IWL_PCI_DEVICE(0x2720, 0x4234, iwl9560_2ac_cfg_soc)},
645647 {IWL_PCI_DEVICE(0x2720, 0x42A4, iwl9462_2ac_cfg_soc)},
646− {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_soc)},
647− {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_soc)},
648− {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_soc)},
649− {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_soc)},
650− {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9460_2ac_cfg_soc)},
651− {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_soc)},
652− {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_soc)},
653− {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_soc)},
654− {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_soc)},
655− {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_soc)},
656− {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_soc)},
657− {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_soc)},
658− {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_soc)},
659− {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_soc)},
660− {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_soc)},
661− {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_soc)},
662− {IWL_PCI_DEVICE(0x30DC, 0x1010, iwl9260_2ac_cfg)},
663− {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_soc)},
664− {IWL_PCI_DEVICE(0x30DC, 0x1210, iwl9260_2ac_cfg)},
665− {IWL_PCI_DEVICE(0x30DC, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
666− {IWL_PCI_DEVICE(0x30DC, 0x1552, iwl9560_killer_2ac_cfg_soc)},
667− {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_soc)},
668− {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_soc)},
669− {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_soc)},
670− {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_soc)},
671− {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_soc)},
672− {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_soc)},
673− {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_soc)},
648+
649+ {IWL_PCI_DEVICE(0x30DC, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
650+ {IWL_PCI_DEVICE(0x30DC, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
651+ {IWL_PCI_DEVICE(0x30DC, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
652+ {IWL_PCI_DEVICE(0x30DC, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
653+ {IWL_PCI_DEVICE(0x30DC, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
654+ {IWL_PCI_DEVICE(0x30DC, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
655+ {IWL_PCI_DEVICE(0x30DC, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
656+ {IWL_PCI_DEVICE(0x30DC, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
657+ {IWL_PCI_DEVICE(0x30DC, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
658+ {IWL_PCI_DEVICE(0x30DC, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
659+ {IWL_PCI_DEVICE(0x30DC, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
660+ {IWL_PCI_DEVICE(0x30DC, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
661+ {IWL_PCI_DEVICE(0x30DC, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
662+ {IWL_PCI_DEVICE(0x30DC, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
663+ {IWL_PCI_DEVICE(0x30DC, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
664+ {IWL_PCI_DEVICE(0x30DC, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
665+ {IWL_PCI_DEVICE(0x30DC, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
666+ {IWL_PCI_DEVICE(0x30DC, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
667+ {IWL_PCI_DEVICE(0x30DC, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
668+ {IWL_PCI_DEVICE(0x30DC, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
669+ {IWL_PCI_DEVICE(0x30DC, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
670+ {IWL_PCI_DEVICE(0x30DC, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
671+ {IWL_PCI_DEVICE(0x30DC, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
672+ {IWL_PCI_DEVICE(0x30DC, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
673+ {IWL_PCI_DEVICE(0x30DC, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
674+ {IWL_PCI_DEVICE(0x30DC, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
675+
674676 {IWL_PCI_DEVICE(0x31DC, 0x0030, iwl9560_2ac_160_cfg_shared_clk)},
675677 {IWL_PCI_DEVICE(0x31DC, 0x0034, iwl9560_2ac_cfg_shared_clk)},
676678 {IWL_PCI_DEVICE(0x31DC, 0x0038, iwl9560_2ac_160_cfg_shared_clk)},
@@ -726,62 +728,60 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 49 unmodified lines
726728 {IWL_PCI_DEVICE(0x34F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
727729 {IWL_PCI_DEVICE(0x34F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
728730
729− {IWL_PCI_DEVICE(0x3DF0, 0x0030, iwl9560_2ac_160_cfg_soc)},
730− {IWL_PCI_DEVICE(0x3DF0, 0x0034, iwl9560_2ac_cfg_soc)},
731− {IWL_PCI_DEVICE(0x3DF0, 0x0038, iwl9560_2ac_160_cfg_soc)},
732− {IWL_PCI_DEVICE(0x3DF0, 0x003C, iwl9560_2ac_160_cfg_soc)},
733− {IWL_PCI_DEVICE(0x3DF0, 0x0060, iwl9461_2ac_cfg_soc)},
734− {IWL_PCI_DEVICE(0x3DF0, 0x0064, iwl9461_2ac_cfg_soc)},
735− {IWL_PCI_DEVICE(0x3DF0, 0x00A0, iwl9462_2ac_cfg_soc)},
736− {IWL_PCI_DEVICE(0x3DF0, 0x00A4, iwl9462_2ac_cfg_soc)},
737− {IWL_PCI_DEVICE(0x3DF0, 0x0230, iwl9560_2ac_cfg_soc)},
738− {IWL_PCI_DEVICE(0x3DF0, 0x0234, iwl9560_2ac_cfg_soc)},
739− {IWL_PCI_DEVICE(0x3DF0, 0x0238, iwl9560_2ac_cfg_soc)},
740− {IWL_PCI_DEVICE(0x3DF0, 0x023C, iwl9560_2ac_cfg_soc)},
741− {IWL_PCI_DEVICE(0x3DF0, 0x0260, iwl9461_2ac_cfg_soc)},
742− {IWL_PCI_DEVICE(0x3DF0, 0x0264, iwl9461_2ac_cfg_soc)},
743− {IWL_PCI_DEVICE(0x3DF0, 0x02A0, iwl9462_2ac_cfg_soc)},
744− {IWL_PCI_DEVICE(0x3DF0, 0x02A4, iwl9462_2ac_cfg_soc)},
745− {IWL_PCI_DEVICE(0x3DF0, 0x1010, iwl9260_2ac_cfg)},
746− {IWL_PCI_DEVICE(0x3DF0, 0x1030, iwl9560_2ac_cfg_soc)},
747− {IWL_PCI_DEVICE(0x3DF0, 0x1210, iwl9260_2ac_cfg)},
748− {IWL_PCI_DEVICE(0x3DF0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
749− {IWL_PCI_DEVICE(0x3DF0, 0x1552, iwl9560_killer_2ac_cfg_soc)},
750− {IWL_PCI_DEVICE(0x3DF0, 0x2030, iwl9560_2ac_160_cfg_soc)},
751− {IWL_PCI_DEVICE(0x3DF0, 0x2034, iwl9560_2ac_160_cfg_soc)},
752− {IWL_PCI_DEVICE(0x3DF0, 0x4030, iwl9560_2ac_160_cfg_soc)},
753− {IWL_PCI_DEVICE(0x3DF0, 0x4034, iwl9560_2ac_160_cfg_soc)},
754− {IWL_PCI_DEVICE(0x3DF0, 0x40A4, iwl9462_2ac_cfg_soc)},
755− {IWL_PCI_DEVICE(0x3DF0, 0x4234, iwl9560_2ac_cfg_soc)},
756− {IWL_PCI_DEVICE(0x3DF0, 0x42A4, iwl9462_2ac_cfg_soc)},
757− {IWL_PCI_DEVICE(0x43F0, 0x0030, iwl9560_2ac_160_cfg_soc)},
758− {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_soc)},
759− {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_soc)},
760− {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_soc)},
761− {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_soc)},
762− {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_soc)},
763− {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_soc)},
764− {IWL_PCI_DEVICE(0x43F0, 0x00A4, iwl9462_2ac_cfg_soc)},
765− {IWL_PCI_DEVICE(0x43F0, 0x0230, iwl9560_2ac_cfg_soc)},
766− {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_soc)},
767− {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_soc)},
768− {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_soc)},
769− {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_soc)},
770− {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_soc)},
771− {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_soc)},
772− {IWL_PCI_DEVICE(0x43F0, 0x02A4, iwl9462_2ac_cfg_soc)},
773− {IWL_PCI_DEVICE(0x43F0, 0x1010, iwl9260_2ac_cfg)},
774− {IWL_PCI_DEVICE(0x43F0, 0x1030, iwl9560_2ac_cfg_soc)},
775− {IWL_PCI_DEVICE(0x43F0, 0x1210, iwl9260_2ac_cfg)},
776− {IWL_PCI_DEVICE(0x43F0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
777− {IWL_PCI_DEVICE(0x43F0, 0x1552, iwl9560_killer_2ac_cfg_soc)},
778− {IWL_PCI_DEVICE(0x43F0, 0x2030, iwl9560_2ac_160_cfg_soc)},
779− {IWL_PCI_DEVICE(0x43F0, 0x2034, iwl9560_2ac_160_cfg_soc)},
780− {IWL_PCI_DEVICE(0x43F0, 0x4030, iwl9560_2ac_160_cfg_soc)},
781− {IWL_PCI_DEVICE(0x43F0, 0x4034, iwl9560_2ac_160_cfg_soc)},
782− {IWL_PCI_DEVICE(0x43F0, 0x40A4, iwl9462_2ac_cfg_soc)},
783− {IWL_PCI_DEVICE(0x43F0, 0x4234, iwl9560_2ac_cfg_soc)},
784− {IWL_PCI_DEVICE(0x43F0, 0x42A4, iwl9462_2ac_cfg_soc)},
731+ {IWL_PCI_DEVICE(0x3DF0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
732+ {IWL_PCI_DEVICE(0x3DF0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
733+ {IWL_PCI_DEVICE(0x3DF0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
734+ {IWL_PCI_DEVICE(0x3DF0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
735+ {IWL_PCI_DEVICE(0x3DF0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
736+ {IWL_PCI_DEVICE(0x3DF0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
737+ {IWL_PCI_DEVICE(0x3DF0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
738+ {IWL_PCI_DEVICE(0x3DF0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
739+ {IWL_PCI_DEVICE(0x3DF0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
740+ {IWL_PCI_DEVICE(0x3DF0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
741+ {IWL_PCI_DEVICE(0x3DF0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
742+ {IWL_PCI_DEVICE(0x3DF0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
743+ {IWL_PCI_DEVICE(0x3DF0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
744+ {IWL_PCI_DEVICE(0x3DF0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
745+ {IWL_PCI_DEVICE(0x3DF0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
746+ {IWL_PCI_DEVICE(0x3DF0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
747+ {IWL_PCI_DEVICE(0x3DF0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
748+ {IWL_PCI_DEVICE(0x3DF0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
749+ {IWL_PCI_DEVICE(0x3DF0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
750+ {IWL_PCI_DEVICE(0x3DF0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
751+ {IWL_PCI_DEVICE(0x3DF0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
752+ {IWL_PCI_DEVICE(0x3DF0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
753+ {IWL_PCI_DEVICE(0x3DF0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
754+ {IWL_PCI_DEVICE(0x3DF0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
755+ {IWL_PCI_DEVICE(0x3DF0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
756+ {IWL_PCI_DEVICE(0x3DF0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
757+
758+ {IWL_PCI_DEVICE(0x43F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
759+ {IWL_PCI_DEVICE(0x43F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
760+ {IWL_PCI_DEVICE(0x43F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
761+ {IWL_PCI_DEVICE(0x43F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
762+ {IWL_PCI_DEVICE(0x43F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
763+ {IWL_PCI_DEVICE(0x43F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
764+ {IWL_PCI_DEVICE(0x43F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
765+ {IWL_PCI_DEVICE(0x43F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
766+ {IWL_PCI_DEVICE(0x43F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
767+ {IWL_PCI_DEVICE(0x43F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
768+ {IWL_PCI_DEVICE(0x43F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
769+ {IWL_PCI_DEVICE(0x43F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
770+ {IWL_PCI_DEVICE(0x43F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
771+ {IWL_PCI_DEVICE(0x43F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
772+ {IWL_PCI_DEVICE(0x43F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
773+ {IWL_PCI_DEVICE(0x43F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
774+ {IWL_PCI_DEVICE(0x43F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
775+ {IWL_PCI_DEVICE(0x43F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
776+ {IWL_PCI_DEVICE(0x43F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
777+ {IWL_PCI_DEVICE(0x43F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
778+ {IWL_PCI_DEVICE(0x43F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
779+ {IWL_PCI_DEVICE(0x43F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
780+ {IWL_PCI_DEVICE(0x43F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
781+ {IWL_PCI_DEVICE(0x43F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
782+ {IWL_PCI_DEVICE(0x43F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
783+ {IWL_PCI_DEVICE(0x43F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
784+
785785 {IWL_PCI_DEVICE(0x9DF0, 0x0000, iwl9460_2ac_cfg_soc)},
786786 {IWL_PCI_DEVICE(0x9DF0, 0x0010, iwl9460_2ac_cfg_soc)},
787787 {IWL_PCI_DEVICE(0x9DF0, 0x0030, iwl9560_2ac_160_cfg_soc)},
@@ -821,34 +821,34 @@ static const struct pci_device_id iwl_hw_card_ids[] = { · 33 unmodified lines
821821 {IWL_PCI_DEVICE(0x9DF0, 0x40A4, iwl9462_2ac_cfg_soc)},
822822 {IWL_PCI_DEVICE(0x9DF0, 0x4234, iwl9560_2ac_cfg_soc)},
823823 {IWL_PCI_DEVICE(0x9DF0, 0x42A4, iwl9462_2ac_cfg_soc)},
824− {IWL_PCI_DEVICE(0xA0F0, 0x0030, iwl9560_2ac_160_cfg_soc)},
825− {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_soc)},
826− {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_soc)},
827− {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_soc)},
828− {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_soc)},
829− {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_soc)},
830− {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_soc)},
831− {IWL_PCI_DEVICE(0xA0F0, 0x00A4, iwl9462_2ac_cfg_soc)},
832− {IWL_PCI_DEVICE(0xA0F0, 0x0230, iwl9560_2ac_cfg_soc)},
833− {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_soc)},
834− {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_soc)},
835− {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_soc)},
836− {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_soc)},
837− {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_soc)},
838− {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_soc)},
839− {IWL_PCI_DEVICE(0xA0F0, 0x02A4, iwl9462_2ac_cfg_soc)},
840− {IWL_PCI_DEVICE(0xA0F0, 0x1010, iwl9260_2ac_cfg)},
841− {IWL_PCI_DEVICE(0xA0F0, 0x1030, iwl9560_2ac_cfg_soc)},
842− {IWL_PCI_DEVICE(0xA0F0, 0x1210, iwl9260_2ac_cfg)},
843− {IWL_PCI_DEVICE(0xA0F0, 0x1551, iwl9560_killer_s_2ac_cfg_soc)},
844− {IWL_PCI_DEVICE(0xA0F0, 0x1552, iwl9560_killer_2ac_cfg_soc)},
845− {IWL_PCI_DEVICE(0xA0F0, 0x2030, iwl9560_2ac_160_cfg_soc)},
846− {IWL_PCI_DEVICE(0xA0F0, 0x2034, iwl9560_2ac_160_cfg_soc)},
847− {IWL_PCI_DEVICE(0xA0F0, 0x4030, iwl9560_2ac_160_cfg_soc)},
848− {IWL_PCI_DEVICE(0xA0F0, 0x4034, iwl9560_2ac_160_cfg_soc)},
849− {IWL_PCI_DEVICE(0xA0F0, 0x40A4, iwl9462_2ac_cfg_soc)},
850− {IWL_PCI_DEVICE(0xA0F0, 0x4234, iwl9560_2ac_cfg_soc)},
851− {IWL_PCI_DEVICE(0xA0F0, 0x42A4, iwl9462_2ac_cfg_soc)},
824+
825+ {IWL_PCI_DEVICE(0xA0F0, 0x0030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
826+ {IWL_PCI_DEVICE(0xA0F0, 0x0034, iwl9560_2ac_cfg_qu_b0_jf_b0)},
827+ {IWL_PCI_DEVICE(0xA0F0, 0x0038, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
828+ {IWL_PCI_DEVICE(0xA0F0, 0x003C, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
829+ {IWL_PCI_DEVICE(0xA0F0, 0x0060, iwl9461_2ac_cfg_qu_b0_jf_b0)},
830+ {IWL_PCI_DEVICE(0xA0F0, 0x0064, iwl9461_2ac_cfg_qu_b0_jf_b0)},
831+ {IWL_PCI_DEVICE(0xA0F0, 0x00A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
832+ {IWL_PCI_DEVICE(0xA0F0, 0x00A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
833+ {IWL_PCI_DEVICE(0xA0F0, 0x0230, iwl9560_2ac_cfg_qu_b0_jf_b0)},
834+ {IWL_PCI_DEVICE(0xA0F0, 0x0234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
835+ {IWL_PCI_DEVICE(0xA0F0, 0x0238, iwl9560_2ac_cfg_qu_b0_jf_b0)},
836+ {IWL_PCI_DEVICE(0xA0F0, 0x023C, iwl9560_2ac_cfg_qu_b0_jf_b0)},
837+ {IWL_PCI_DEVICE(0xA0F0, 0x0260, iwl9461_2ac_cfg_qu_b0_jf_b0)},
838+ {IWL_PCI_DEVICE(0xA0F0, 0x0264, iwl9461_2ac_cfg_qu_b0_jf_b0)},
839+ {IWL_PCI_DEVICE(0xA0F0, 0x02A0, iwl9462_2ac_cfg_qu_b0_jf_b0)},
840+ {IWL_PCI_DEVICE(0xA0F0, 0x02A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
841+ {IWL_PCI_DEVICE(0xA0F0, 0x1030, iwl9560_2ac_cfg_qu_b0_jf_b0)},
842+ {IWL_PCI_DEVICE(0xA0F0, 0x1551, killer1550s_2ac_cfg_qu_b0_jf_b0)},
843+ {IWL_PCI_DEVICE(0xA0F0, 0x1552, killer1550i_2ac_cfg_qu_b0_jf_b0)},
844+ {IWL_PCI_DEVICE(0xA0F0, 0x2030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
845+ {IWL_PCI_DEVICE(0xA0F0, 0x2034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
846+ {IWL_PCI_DEVICE(0xA0F0, 0x4030, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
847+ {IWL_PCI_DEVICE(0xA0F0, 0x4034, iwl9560_2ac_160_cfg_qu_b0_jf_b0)},
848+ {IWL_PCI_DEVICE(0xA0F0, 0x40A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
849+ {IWL_PCI_DEVICE(0xA0F0, 0x4234, iwl9560_2ac_cfg_qu_b0_jf_b0)},
850+ {IWL_PCI_DEVICE(0xA0F0, 0x42A4, iwl9462_2ac_cfg_qu_b0_jf_b0)},
851+
852852 {IWL_PCI_DEVICE(0xA370, 0x0030, iwl9560_2ac_160_cfg_soc)},
853853 {IWL_PCI_DEVICE(0xA370, 0x0034, iwl9560_2ac_cfg_soc)},
854854 {IWL_PCI_DEVICE(0xA370, 0x0038, iwl9560_2ac_160_cfg_soc)},
drivers/net/wireless/intel/iwlwifi/pcie/trans.c+19−6
@@ -3272,11 +3272,17 @@ static struct iwl_trans_dump_data · 3271 unmodified lines
32723272 ptr = cmdq->write_ptr;
32733273 for (i = 0; i < cmdq->n_window; i++) {
32743274 u8 idx = iwl_pcie_get_cmd_index(cmdq, ptr);
3275+ u8 tfdidx;
32753276 u32 caplen, cmdlen;
32763277
3278+ if (trans->trans_cfg->use_tfh)
3279+ tfdidx = idx;
3280+ else
3281+ tfdidx = ptr;
3282+
32773283 cmdlen = iwl_trans_pcie_get_cmdlen(trans,
3278− cmdq->tfds +
3279− tfd_size * ptr);
3284+ (u8 *)cmdq->tfds +
3285+ tfd_size * tfdidx);
32803286 caplen = min_t(u32, TFD_MAX_PAYLOAD_SIZE, cmdlen);
32813287
32823288 if (cmdlen) {
@@ -3450,6 +3456,15 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 167 unmodified lines
34503456 spin_lock_init(&trans_pcie->reg_lock);
34513457 mutex_init(&trans_pcie->mutex);
34523458 init_waitqueue_head(&trans_pcie->ucode_write_waitq);
3459+
3460+ trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
3461+ WQ_HIGHPRI | WQ_UNBOUND, 1);
3462+ if (!trans_pcie->rba.alloc_wq) {
3463+ ret = -ENOMEM;
3464+ goto out_free_trans;
3465+ }
3466+ INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
3467+
34533468 trans_pcie->tso_hdr_page = alloc_percpu(struct iwl_tso_hdr_page);
34543469 if (!trans_pcie->tso_hdr_page) {
34553470 ret = -ENOMEM;
@@ -3584,10 +3599,6 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, · 128 unmodified lines
35843599 trans_pcie->inta_mask = CSR_INI_SET_MASK;
35853600 }
35863601
3587− trans_pcie->rba.alloc_wq = alloc_workqueue("rb_allocator",
3588− WQ_HIGHPRI | WQ_UNBOUND, 1);
3589− INIT_WORK(&trans_pcie->rba.rx_alloc, iwl_pcie_rx_allocator_work);
3590−
35913602 #ifdef CONFIG_IWLWIFI_DEBUGFS
35923603 trans_pcie->fw_mon_data.state = IWL_FW_MON_DBGFS_STATE_CLOSED;
35933604 mutex_init(&trans_pcie->fw_mon_data.mutex);
@@ -3599,6 +3610,8 @@ out_free_ict: · 5 unmodified lines
35993610 iwl_pcie_free_ict(trans);
36003611 out_no_pci:
36013612 free_percpu(trans_pcie->tso_hdr_page);
3613+ destroy_workqueue(trans_pcie->rba.alloc_wq);
3614+out_free_trans:
36023615 iwl_trans_free(trans);
36033616 return ERR_PTR(ret);
36043617 }
drivers/net/wireless/mac80211_hwsim.c+1−1
@@ -4026,7 +4026,7 @@ static int __init init_mac80211_hwsim(void) · 4025 unmodified lines
40264026 err = dev_alloc_name(hwsim_mon, hwsim_mon->name);
40274027 if (err < 0) {
40284028 rtnl_unlock();
4029− goto out_free_radios;
4029+ goto out_free_mon;
40304030 }
40314031
40324032 err = register_netdevice(hwsim_mon);
drivers/net/wireless/ralink/rt2x00/rt2x00.h+0−1
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323 #include <linux/leds.h>
2424 #include <linux/mutex.h>
2525 #include <linux/etherdevice.h>
26−#include <linux/input-polldev.h>
2726 #include <linux/kfifo.h>
2827 #include <linux/hrtimer.h>
2928 #include <linux/average.h>
drivers/net/wireless/ralink/rt2x00/rt2x00debug.c+1−1
@@ -555,7 +555,7 @@ static ssize_t rt2x00debug_write_restart_hw(struct file *file, · 554 unmodified lines
555555 {
556556 struct rt2x00debug_intf *intf = file->private_data;
557557 struct rt2x00_dev *rt2x00dev = intf->rt2x00dev;
558− static unsigned long last_reset;
558+ static unsigned long last_reset = INITIAL_JIFFIES;
559559
560560 if (!rt2x00_has_cap_restart_hw(rt2x00dev))
561561 return -EOPNOTSUPP;
drivers/net/xen-netback/interface.c+0−1
@@ -719,7 +719,6 @@ err_unmap: · 718 unmodified lines
719719 xenvif_unmap_frontend_data_rings(queue);
720720 netif_napi_del(&queue->napi);
721721 err:
722− module_put(THIS_MODULE);
723722 return err;
724723 }
725724
drivers/nfc/pn533/usb.c+8−1
@@ -547,18 +547,25 @@ static int pn533_usb_probe(struct usb_interface *interface, · 546 unmodified lines
547547
548548 rc = pn533_finalize_setup(priv);
549549 if (rc)
550− goto error;
550+ goto err_deregister;
551551
552552 usb_set_intfdata(interface, phy);
553553
554554 return 0;
555555
556+err_deregister:
557+ pn533_unregister_device(phy->priv);
556558 error:
559+ usb_kill_urb(phy->in_urb);
560+ usb_kill_urb(phy->out_urb);
561+ usb_kill_urb(phy->ack_urb);
562+
557563 usb_free_urb(phy->in_urb);
558564 usb_free_urb(phy->out_urb);
559565 usb_free_urb(phy->ack_urb);
560566 usb_put_dev(phy->udev);
561567 kfree(in_buf);
568+ kfree(phy->ack_buffer);
562569
563570 return rc;
564571 }
drivers/nvme/host/core.c+68−26
@@ -116,10 +116,26 @@ static void nvme_queue_scan(struct nvme_ctrl *ctrl) · 115 unmodified lines
116116 /*
117117 * Only new queue scan work when admin and IO queues are both alive
118118 */
119− if (ctrl->state == NVME_CTRL_LIVE)
119+ if (ctrl->state == NVME_CTRL_LIVE && ctrl->tagset)
120120 queue_work(nvme_wq, &ctrl->scan_work);
121121 }
122122
123+/*
124+ * Use this function to proceed with scheduling reset_work for a controller
125+ * that had previously been set to the resetting state. This is intended for
126+ * code paths that can't be interrupted by other reset attempts. A hot removal
127+ * may prevent this from succeeding.
128+ */
129+int nvme_try_sched_reset(struct nvme_ctrl *ctrl)
130+{
131+ if (ctrl->state != NVME_CTRL_RESETTING)
132+ return -EBUSY;
133+ if (!queue_work(nvme_reset_wq, &ctrl->reset_work))
134+ return -EBUSY;
135+ return 0;
136+}
137+EXPORT_SYMBOL_GPL(nvme_try_sched_reset);
138+
123139 int nvme_reset_ctrl(struct nvme_ctrl *ctrl)
124140 {
125141 if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
@@ -137,8 +153,7 @@ int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl) · 11 unmodified lines
137153 ret = nvme_reset_ctrl(ctrl);
138154 if (!ret) {
139155 flush_work(&ctrl->reset_work);
140− if (ctrl->state != NVME_CTRL_LIVE &&
141− ctrl->state != NVME_CTRL_ADMIN_ONLY)
156+ if (ctrl->state != NVME_CTRL_LIVE)
142157 ret = -ENETRESET;
143158 }
144159
@@ -315,15 +330,6 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 170 unmodified lines
315330
316331 old_state = ctrl->state;
317332 switch (new_state) {
318− case NVME_CTRL_ADMIN_ONLY:
319− switch (old_state) {
320− case NVME_CTRL_CONNECTING:
321− changed = true;
322− /* FALLTHRU */
323− default:
324− break;
325− }
326− break;
327333 case NVME_CTRL_LIVE:
328334 switch (old_state) {
329335 case NVME_CTRL_NEW:
@@ -339,7 +345,6 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 9 unmodified lines
339345 switch (old_state) {
340346 case NVME_CTRL_NEW:
341347 case NVME_CTRL_LIVE:
342− case NVME_CTRL_ADMIN_ONLY:
343348 changed = true;
344349 /* FALLTHRU */
345350 default:
@@ -359,7 +364,6 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 13 unmodified lines
359364 case NVME_CTRL_DELETING:
360365 switch (old_state) {
361366 case NVME_CTRL_LIVE:
362− case NVME_CTRL_ADMIN_ONLY:
363367 case NVME_CTRL_RESETTING:
364368 case NVME_CTRL_CONNECTING:
365369 changed = true;
@@ -381,8 +385,10 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 15 unmodified lines
381385 break;
382386 }
383387
384− if (changed)
388+ if (changed) {
385389 ctrl->state = new_state;
390+ wake_up_all(&ctrl->state_wq);
391+ }
386392
387393 spin_unlock_irqrestore(&ctrl->lock, flags);
388394 if (changed && ctrl->state == NVME_CTRL_LIVE)
@@ -391,6 +397,39 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl, · 2 unmodified lines
391397 }
392398 EXPORT_SYMBOL_GPL(nvme_change_ctrl_state);
393399
400+/*
401+ * Returns true for sink states that can't ever transition back to live.
402+ */
403+static bool nvme_state_terminal(struct nvme_ctrl *ctrl)
404+{
405+ switch (ctrl->state) {
406+ case NVME_CTRL_NEW:
407+ case NVME_CTRL_LIVE:
408+ case NVME_CTRL_RESETTING:
409+ case NVME_CTRL_CONNECTING:
410+ return false;
411+ case NVME_CTRL_DELETING:
412+ case NVME_CTRL_DEAD:
413+ return true;
414+ default:
415+ WARN_ONCE(1, "Unhandled ctrl state:%d", ctrl->state);
416+ return true;
417+ }
418+}
419+
420+/*
421+ * Waits for the controller state to be resetting, or returns false if it is
422+ * not possible to ever transition to that state.
423+ */
424+bool nvme_wait_reset(struct nvme_ctrl *ctrl)
425+{
426+ wait_event(ctrl->state_wq,
427+ nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING) ||
428+ nvme_state_terminal(ctrl));
429+ return ctrl->state == NVME_CTRL_RESETTING;
430+}
431+EXPORT_SYMBOL_GPL(nvme_wait_reset);
432+
394433 static void nvme_free_ns_head(struct kref *ref)
395434 {
396435 struct nvme_ns_head *head =
@@ -1306,8 +1345,6 @@ static void nvme_update_formats(struct nvme_ctrl *ctrl) · 909 unmodified lines
13061345 if (ns->disk && nvme_revalidate_disk(ns->disk))
13071346 nvme_set_queue_dying(ns);
13081347 up_read(&ctrl->namespaces_rwsem);
1309−
1310− nvme_remove_invalid_namespaces(ctrl, NVME_NSID_ALL);
13111348 }
13121349
13131350 static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects)
@@ -1323,6 +1360,7 @@ static void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects) · 9 unmodified lines
13231360 nvme_unfreeze(ctrl);
13241361 nvme_mpath_unfreeze(ctrl->subsys);
13251362 mutex_unlock(&ctrl->subsys->lock);
1363+ nvme_remove_invalid_namespaces(ctrl, NVME_NSID_ALL);
13261364 mutex_unlock(&ctrl->scan_lock);
13271365 }
13281366 if (effects & NVME_CMD_EFFECTS_CCC)
@@ -2874,7 +2912,6 @@ static int nvme_dev_open(struct inode *inode, struct file *file) · 1545 unmodified lines
28742912
28752913 switch (ctrl->state) {
28762914 case NVME_CTRL_LIVE:
2877− case NVME_CTRL_ADMIN_ONLY:
28782915 break;
28792916 default:
28802917 return -EWOULDBLOCK;
@@ -3168,7 +3205,6 @@ static ssize_t nvme_sysfs_show_state(struct device *dev, · 287 unmodified lines
31683205 static const char *const state_name[] = {
31693206 [NVME_CTRL_NEW] = "new",
31703207 [NVME_CTRL_LIVE] = "live",
3171− [NVME_CTRL_ADMIN_ONLY] = "only-admin",
31723208 [NVME_CTRL_RESETTING] = "resetting",
31733209 [NVME_CTRL_CONNECTING] = "connecting",
31743210 [NVME_CTRL_DELETING] = "deleting",
@@ -3679,11 +3715,10 @@ static void nvme_scan_work(struct work_struct *work) · 504 unmodified lines
36793715 struct nvme_id_ctrl *id;
36803716 unsigned nn;
36813717
3682− if (ctrl->state != NVME_CTRL_LIVE)
3718+ /* No tagset on a live ctrl means IO queues could not created */
3719+ if (ctrl->state != NVME_CTRL_LIVE || !ctrl->tagset)
36833720 return;
36843721
3685− WARN_ON_ONCE(!ctrl->tagset);
3686−
36873722 if (test_and_clear_bit(NVME_AER_NOTICE_NS_CHANGED, &ctrl->events)) {
36883723 dev_info(ctrl->device, "rescanning namespaces.\n");
36893724 nvme_clear_changed_ns_log(ctrl);
@@ -3844,13 +3879,13 @@ static void nvme_fw_act_work(struct work_struct *work) · 154 unmodified lines
38443879 if (time_after(jiffies, fw_act_timeout)) {
38453880 dev_warn(ctrl->device,
38463881 "Fw activation timeout, reset controller\n");
3847− nvme_reset_ctrl(ctrl);
3848− break;
3882+ nvme_try_sched_reset(ctrl);
3883+ return;
38493884 }
38503885 msleep(100);
38513886 }
38523887
3853− if (ctrl->state != NVME_CTRL_LIVE)
3888+ if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE))
38543889 return;
38553890
38563891 nvme_start_queues(ctrl);
@@ -3870,7 +3905,13 @@ static void nvme_handle_aen_notice(struct nvme_ctrl *ctrl, u32 result) · 13 unmodified lines
38703905 nvme_queue_scan(ctrl);
38713906 break;
38723907 case NVME_AER_NOTICE_FW_ACT_STARTING:
3873− queue_work(nvme_wq, &ctrl->fw_act_work);
3908+ /*
3909+ * We are (ab)using the RESETTING state to prevent subsequent
3910+ * recovery actions from interfering with the controller's
3911+ * firmware activation.
3912+ */
3913+ if (nvme_change_ctrl_state(ctrl, NVME_CTRL_RESETTING))
3914+ queue_work(nvme_wq, &ctrl->fw_act_work);
38743915 break;
38753916 #ifdef CONFIG_NVME_MULTIPATH
38763917 case NVME_AER_NOTICE_ANA:
@@ -3993,6 +4034,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, · 116 unmodified lines
39934034 INIT_WORK(&ctrl->async_event_work, nvme_async_event_work);
39944035 INIT_WORK(&ctrl->fw_act_work, nvme_fw_act_work);
39954036 INIT_WORK(&ctrl->delete_work, nvme_delete_ctrl_work);
4037+ init_waitqueue_head(&ctrl->state_wq);
39964038
39974039 INIT_DELAYED_WORK(&ctrl->ka_work, nvme_keep_alive_work);
39984040 memset(&ctrl->ka_cmd, 0, sizeof(ctrl->ka_cmd));
drivers/nvme/host/fabrics.h+1−2
@@ -182,8 +182,7 @@ bool nvmf_ip_options_match(struct nvme_ctrl *ctrl, · 181 unmodified lines
182182 static inline bool nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
183183 bool queue_live)
184184 {
185− if (likely(ctrl->state == NVME_CTRL_LIVE ||
186− ctrl->state == NVME_CTRL_ADMIN_ONLY))
185+ if (likely(ctrl->state == NVME_CTRL_LIVE))
187186 return true;
188187 return __nvmf_check_ready(ctrl, rq, queue_live);
189188 }
drivers/nvme/host/nvme.h+4−1
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/sed-opal.h>
1616 #include <linux/fault-inject.h>
1717 #include <linux/rcupdate.h>
18+#include <linux/wait.h>
1819
1920 #include <trace/events/block.h>
2021
@@ -161,7 +162,6 @@ static inline u16 nvme_req_qid(struct request *req) · 140 unmodified lines
161162 enum nvme_ctrl_state {
162163 NVME_CTRL_NEW,
163164 NVME_CTRL_LIVE,
164− NVME_CTRL_ADMIN_ONLY, /* Only admin queue live */
165165 NVME_CTRL_RESETTING,
166166 NVME_CTRL_CONNECTING,
167167 NVME_CTRL_DELETING,
@@ -199,6 +199,7 @@ struct nvme_ctrl { · 31 unmodified lines
199199 struct cdev cdev;
200200 struct work_struct reset_work;
201201 struct work_struct delete_work;
202+ wait_queue_head_t state_wq;
202203
203204 struct nvme_subsystem *subsys;
204205 struct list_head subsys_entry;
@@ -449,6 +450,7 @@ void nvme_complete_rq(struct request *req); · 244 unmodified lines
449450 bool nvme_cancel_request(struct request *req, void *data, bool reserved);
450451 bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
451452 enum nvme_ctrl_state new_state);
453+bool nvme_wait_reset(struct nvme_ctrl *ctrl);
452454 int nvme_disable_ctrl(struct nvme_ctrl *ctrl);
453455 int nvme_enable_ctrl(struct nvme_ctrl *ctrl);
454456 int nvme_shutdown_ctrl(struct nvme_ctrl *ctrl);
@@ -499,6 +501,7 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count); · 44 unmodified lines
499501 void nvme_stop_keep_alive(struct nvme_ctrl *ctrl);
500502 int nvme_reset_ctrl(struct nvme_ctrl *ctrl);
501503 int nvme_reset_ctrl_sync(struct nvme_ctrl *ctrl);
504+int nvme_try_sched_reset(struct nvme_ctrl *ctrl);
502505 int nvme_delete_ctrl(struct nvme_ctrl *ctrl);
503506
504507 int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp,
drivers/nvme/host/pci.c+49−34
@@ -773,7 +773,8 @@ static blk_status_t nvme_setup_prp_simple(struct nvme_dev *dev, · 772 unmodified lines
773773 struct bio_vec *bv)
774774 {
775775 struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
776− unsigned int first_prp_len = dev->ctrl.page_size - bv->bv_offset;
776+ unsigned int offset = bv->bv_offset & (dev->ctrl.page_size - 1);
777+ unsigned int first_prp_len = dev->ctrl.page_size - offset;
777778
778779 iod->first_dma = dma_map_bvec(dev->dev, bv, rq_dma_dir(req), 0);
779780 if (dma_mapping_error(dev->dev, iod->first_dma))
@@ -2263,10 +2264,7 @@ static bool __nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode) · 1483 unmodified lines
22632264 return true;
22642265 }
22652266
2266−/*
2267− * return error value only when tagset allocation failed
2268− */
2269−static int nvme_dev_add(struct nvme_dev *dev)
2267+static void nvme_dev_add(struct nvme_dev *dev)
22702268 {
22712269 int ret;
22722270
@@ -2296,7 +2294,7 @@ static int nvme_dev_add(struct nvme_dev *dev) · 23 unmodified lines
22962294 if (ret) {
22972295 dev_warn(dev->ctrl.device,
22982296 "IO queues tagset allocation failed %d\n", ret);
2299− return ret;
2297+ return;
23002298 }
23012299 dev->ctrl.tagset = &dev->tagset;
23022300 } else {
@@ -2307,7 +2305,6 @@ static int nvme_dev_add(struct nvme_dev *dev) · 4 unmodified lines
23072305 }
23082306
23092307 nvme_dbbuf_set(dev);
2310− return 0;
23112308 }
23122309
23132310 static int nvme_pci_enable(struct nvme_dev *dev)
@@ -2467,6 +2464,14 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown) · 153 unmodified lines
24672464 mutex_unlock(&dev->shutdown_lock);
24682465 }
24692466
2467+static int nvme_disable_prepare_reset(struct nvme_dev *dev, bool shutdown)
2468+{
2469+ if (!nvme_wait_reset(&dev->ctrl))
2470+ return -EBUSY;
2471+ nvme_dev_disable(dev, shutdown);
2472+ return 0;
2473+}
2474+
24702475 static int nvme_setup_prp_pools(struct nvme_dev *dev)
24712476 {
24722477 dev->prp_page_pool = dma_pool_create("prp list page", dev->dev,
@@ -2490,14 +2495,20 @@ static void nvme_release_prp_pools(struct nvme_dev *dev) · 17 unmodified lines
24902495 dma_pool_destroy(dev->prp_small_pool);
24912496 }
24922497
2498+static void nvme_free_tagset(struct nvme_dev *dev)
2499+{
2500+ if (dev->tagset.tags)
2501+ blk_mq_free_tag_set(&dev->tagset);
2502+ dev->ctrl.tagset = NULL;
2503+}
2504+
24932505 static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl)
24942506 {
24952507 struct nvme_dev *dev = to_nvme_dev(ctrl);
24962508
24972509 nvme_dbbuf_dma_free(dev);
24982510 put_device(dev->dev);
2499− if (dev->tagset.tags)
2500− blk_mq_free_tag_set(&dev->tagset);
2511+ nvme_free_tagset(dev);
25012512 if (dev->ctrl.admin_q)
25022513 blk_put_queue(dev->ctrl.admin_q);
25032514 kfree(dev->queues);
@@ -2508,6 +2519,11 @@ static void nvme_pci_free_ctrl(struct nvme_ctrl *ctrl) · 4 unmodified lines
25082519
25092520 static void nvme_remove_dead_ctrl(struct nvme_dev *dev)
25102521 {
2522+ /*
2523+ * Set state to deleting now to avoid blocking nvme_wait_reset(), which
2524+ * may be holding this pci_dev's device lock.
2525+ */
2526+ nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_DELETING);
25112527 nvme_get_ctrl(&dev->ctrl);
25122528 nvme_dev_disable(dev, false);
25132529 nvme_kill_queues(&dev->ctrl);
@@ -2521,7 +2537,6 @@ static void nvme_reset_work(struct work_struct *work) · 7 unmodified lines
25212537 container_of(work, struct nvme_dev, ctrl.reset_work);
25222538 bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
25232539 int result;
2524− enum nvme_ctrl_state new_state = NVME_CTRL_LIVE;
25252540
25262541 if (WARN_ON(dev->ctrl.state != NVME_CTRL_RESETTING)) {
25272542 result = -ENODEV;
@@ -2615,13 +2630,11 @@ static void nvme_reset_work(struct work_struct *work) · 87 unmodified lines
26152630 dev_warn(dev->ctrl.device, "IO queues not created\n");
26162631 nvme_kill_queues(&dev->ctrl);
26172632 nvme_remove_namespaces(&dev->ctrl);
2618− new_state = NVME_CTRL_ADMIN_ONLY;
2633+ nvme_free_tagset(dev);
26192634 } else {
26202635 nvme_start_queues(&dev->ctrl);
26212636 nvme_wait_freeze(&dev->ctrl);
2622− /* hit this only when allocate tagset fails */
2623− if (nvme_dev_add(dev))
2624− new_state = NVME_CTRL_ADMIN_ONLY;
2637+ nvme_dev_add(dev);
26252638 nvme_unfreeze(&dev->ctrl);
26262639 }
26272640
@@ -2629,9 +2642,9 @@ static void nvme_reset_work(struct work_struct *work) · 1 unmodified line
26292642 * If only admin queue live, keep it to do further investigation or
26302643 * recovery.
26312644 */
2632− if (!nvme_change_ctrl_state(&dev->ctrl, new_state)) {
2645+ if (!nvme_change_ctrl_state(&dev->ctrl, NVME_CTRL_LIVE)) {
26332646 dev_warn(dev->ctrl.device,
2634− "failed to mark controller state %d\n", new_state);
2647+ "failed to mark controller live state\n");
26352648 result = -ENODEV;
26362649 goto out;
26372650 }
@@ -2672,7 +2685,7 @@ static int nvme_pci_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val) · 34 unmodified lines
26722685
26732686 static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
26742687 {
2675− *val = readq(to_nvme_dev(ctrl)->bar + off);
2688+ *val = lo_hi_readq(to_nvme_dev(ctrl)->bar + off);
26762689 return 0;
26772690 }
26782691
@@ -2836,19 +2849,28 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 157 unmodified lines
28362849 static void nvme_reset_prepare(struct pci_dev *pdev)
28372850 {
28382851 struct nvme_dev *dev = pci_get_drvdata(pdev);
2839− nvme_dev_disable(dev, false);
2852+
2853+ /*
2854+ * We don't need to check the return value from waiting for the reset
2855+ * state as pci_dev device lock is held, making it impossible to race
2856+ * with ->remove().
2857+ */
2858+ nvme_disable_prepare_reset(dev, false);
2859+ nvme_sync_queues(&dev->ctrl);
28402860 }
28412861
28422862 static void nvme_reset_done(struct pci_dev *pdev)
28432863 {
28442864 struct nvme_dev *dev = pci_get_drvdata(pdev);
2845− nvme_reset_ctrl_sync(&dev->ctrl);
2865+
2866+ if (!nvme_try_sched_reset(&dev->ctrl))
2867+ flush_work(&dev->ctrl.reset_work);
28462868 }
28472869
28482870 static void nvme_shutdown(struct pci_dev *pdev)
28492871 {
28502872 struct nvme_dev *dev = pci_get_drvdata(pdev);
2851− nvme_dev_disable(dev, true);
2873+ nvme_disable_prepare_reset(dev, true);
28522874 }
28532875
28542876 /*
@@ -2901,7 +2923,7 @@ static int nvme_resume(struct device *dev) · 46 unmodified lines
29012923
29022924 if (ndev->last_ps == U32_MAX ||
29032925 nvme_set_power_state(ctrl, ndev->last_ps) != 0)
2904− nvme_reset_ctrl(ctrl);
2926+ return nvme_try_sched_reset(&ndev->ctrl);
29052927 return 0;
29062928 }
29072929
@@ -2929,17 +2951,14 @@ static int nvme_suspend(struct device *dev) · 21 unmodified lines
29292951 */
29302952 if (pm_suspend_via_firmware() || !ctrl->npss ||
29312953 !pcie_aspm_enabled(pdev) ||
2932− (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND)) {
2933− nvme_dev_disable(ndev, true);
2934− return 0;
2935− }
2954+ (ndev->ctrl.quirks & NVME_QUIRK_SIMPLE_SUSPEND))
2955+ return nvme_disable_prepare_reset(ndev, true);
29362956
29372957 nvme_start_freeze(ctrl);
29382958 nvme_wait_freeze(ctrl);
29392959 nvme_sync_queues(ctrl);
29402960
2941− if (ctrl->state != NVME_CTRL_LIVE &&
2942− ctrl->state != NVME_CTRL_ADMIN_ONLY)
2961+ if (ctrl->state != NVME_CTRL_LIVE)
29432962 goto unfreeze;
29442963
29452964 ret = nvme_get_power_state(ctrl, &ndev->last_ps);
@@ -2965,9 +2984,8 @@ static int nvme_suspend(struct device *dev) · 19 unmodified lines
29652984 * Clearing npss forces a controller reset on resume. The
29662985 * correct value will be resdicovered then.
29672986 */
2968− nvme_dev_disable(ndev, true);
2987+ ret = nvme_disable_prepare_reset(ndev, true);
29692988 ctrl->npss = 0;
2970− ret = 0;
29712989 }
29722990 unfreeze:
29732991 nvme_unfreeze(ctrl);
@@ -2977,9 +2995,7 @@ unfreeze: · 3 unmodified lines
29772995 static int nvme_simple_suspend(struct device *dev)
29782996 {
29792997 struct nvme_dev *ndev = pci_get_drvdata(to_pci_dev(dev));
2980−
2981− nvme_dev_disable(ndev, true);
2982− return 0;
2998+ return nvme_disable_prepare_reset(ndev, true);
29832999 }
29843000
29853001 static int nvme_simple_resume(struct device *dev)
@@ -2987,8 +3003,7 @@ static int nvme_simple_resume(struct device *dev) · 1 unmodified line
29873003 struct pci_dev *pdev = to_pci_dev(dev);
29883004 struct nvme_dev *ndev = pci_get_drvdata(pdev);
29893005
2990− nvme_reset_ctrl(&ndev->ctrl);
2991− return 0;
3006+ return nvme_try_sched_reset(&ndev->ctrl);
29923007 }
29933008
29943009 static const struct dev_pm_ops nvme_dev_pm_ops = {
drivers/nvme/host/rdma.c+8−0
@@ -1701,6 +1701,14 @@ nvme_rdma_timeout(struct request *rq, bool reserved) · 1700 unmodified lines
17011701 dev_warn(ctrl->ctrl.device, "I/O %d QID %d timeout\n",
17021702 rq->tag, nvme_rdma_queue_idx(queue));
17031703
1704+ /*
1705+ * Restart the timer if a controller reset is already scheduled. Any
1706+ * timed out commands would be handled before entering the connecting
1707+ * state.
1708+ */
1709+ if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
1710+ return BLK_EH_RESET_TIMER;
1711+
17041712 if (ctrl->ctrl.state != NVME_CTRL_LIVE) {
17051713 /*
17061714 * Teardown immediately if controller times out while starting
drivers/nvme/host/tcp.c+11−0
@@ -1386,7 +1386,9 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, · 1385 unmodified lines
13861386 queue->sock->sk->sk_data_ready = nvme_tcp_data_ready;
13871387 queue->sock->sk->sk_state_change = nvme_tcp_state_change;
13881388 queue->sock->sk->sk_write_space = nvme_tcp_write_space;
1389+#ifdef CONFIG_NET_RX_BUSY_POLL
13891390 queue->sock->sk->sk_ll_usec = 1;
1391+#endif
13901392 write_unlock_bh(&queue->sock->sk->sk_callback_lock);
13911393
13921394 return 0;
@@ -2044,6 +2046,14 @@ nvme_tcp_timeout(struct request *rq, bool reserved) · 651 unmodified lines
20442046 struct nvme_tcp_ctrl *ctrl = req->queue->ctrl;
20452047 struct nvme_tcp_cmd_pdu *pdu = req->pdu;
20462048
2049+ /*
2050+ * Restart the timer if a controller reset is already scheduled. Any
2051+ * timed out commands would be handled before entering the connecting
2052+ * state.
2053+ */
2054+ if (ctrl->ctrl.state == NVME_CTRL_RESETTING)
2055+ return BLK_EH_RESET_TIMER;
2056+
20472057 dev_warn(ctrl->ctrl.device,
20482058 "queue %d: timeout request %#x type %d\n",
20492059 nvme_tcp_queue_id(req->queue), rq->tag, pdu->hdr.type);
@@ -2126,6 +2136,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, · 76 unmodified lines
21262136
21272137 ret = nvme_tcp_map_data(queue, rq);
21282138 if (unlikely(ret)) {
2139+ nvme_cleanup_cmd(rq);
21292140 dev_err(queue->ctrl->ctrl.device,
21302141 "Failed to map data (%d)\n", ret);
21312142 return ret;
drivers/nvme/target/loop.c+3−1
@@ -157,8 +157,10 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, · 156 unmodified lines
157157 iod->sg_table.sgl = iod->first_sgl;
158158 if (sg_alloc_table_chained(&iod->sg_table,
159159 blk_rq_nr_phys_segments(req),
160− iod->sg_table.sgl, SG_CHUNK_SIZE))
160+ iod->sg_table.sgl, SG_CHUNK_SIZE)) {
161+ nvme_cleanup_cmd(req);
161162 return BLK_STS_RESOURCE;
163+ }
162164
163165 iod->req.sg = iod->sg_table.sgl;
164166 iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl);
drivers/of/of_reserved_mem.c+3−1
@@ -324,8 +324,10 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, · 323 unmodified lines
324324 if (!target)
325325 return -ENODEV;
326326
327− if (!of_device_is_available(target))
327+ if (!of_device_is_available(target)) {
328+ of_node_put(target);
328329 return 0;
330+ }
329331
330332 rmem = __find_rmem(target);
331333 of_node_put(target);
drivers/of/unittest.c+1−0
@@ -1207,6 +1207,7 @@ static int __init unittest_data_add(void) · 1206 unmodified lines
12071207 of_fdt_unflatten_tree(unittest_data, NULL, &unittest_data_node);
12081208 if (!unittest_data_node) {
12091209 pr_warn("%s: No tree to attach; not running tests\n", __func__);
1210+ kfree(unittest_data);
12101211 return -ENODATA;
12111212 }
12121213
drivers/opp/core.c+3−13
@@ -1626,12 +1626,6 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, · 1625 unmodified lines
16261626 goto free_regulators;
16271627 }
16281628
1629− ret = regulator_enable(reg);
1630− if (ret < 0) {
1631− regulator_put(reg);
1632− goto free_regulators;
1633− }
1634−
16351629 opp_table->regulators[i] = reg;
16361630 }
16371631
@@ -1645,10 +1639,8 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev, · 7 unmodified lines
16451639 return opp_table;
16461640
16471641 free_regulators:
1648− while (i--) {
1649− regulator_disable(opp_table->regulators[i]);
1650− regulator_put(opp_table->regulators[i]);
1651− }
1642+ while (i != 0)
1643+ regulator_put(opp_table->regulators[--i]);
16521644
16531645 kfree(opp_table->regulators);
16541646 opp_table->regulators = NULL;
@@ -1674,10 +1666,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table) · 19 unmodified lines
16741666 /* Make sure there are no concurrent readers while updating opp_table */
16751667 WARN_ON(!list_empty(&opp_table->opp_list));
16761668
1677− for (i = opp_table->regulator_count - 1; i >= 0; i--) {
1678− regulator_disable(opp_table->regulators[i]);
1669+ for (i = opp_table->regulator_count - 1; i >= 0; i--)
16791670 regulator_put(opp_table->regulators[i]);
1680− }
16811671
16821672 _free_set_opp_data(opp_table);
16831673
drivers/opp/of.c+7−2
@@ -77,8 +77,6 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table, · 76 unmodified lines
7777 {
7878 struct dev_pm_opp *opp;
7979
80− lockdep_assert_held(&opp_table_lock);
81−
8280 mutex_lock(&opp_table->lock);
8381
8482 list_for_each_entry(opp, &opp_table->opp_list, node) {
@@ -665,6 +663,13 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table) · 580 unmodified lines
665663 return 0;
666664 }
667665
666+ /*
667+ * Re-initialize list_kref every time we add static OPPs to the OPP
668+ * table as the reference count may be 0 after the last tie static OPPs
669+ * were removed.
670+ */
671+ kref_init(&opp_table->list_kref);
672+
668673 /* We have opp-table node now, iterate over it and add OPPs */
669674 for_each_available_child_of_node(opp_table->np, np) {
670675 opp = _opp_add_static_v2(opp_table, dev, np);
drivers/parisc/sba_iommu.c+0−8
@@ -678,14 +678,6 @@ static int sba_dma_supported( struct device *dev, u64 mask) · 677 unmodified lines
678678 return(0);
679679 }
680680
681− /* Documentation/DMA-API-HOWTO.txt tells drivers to try 64-bit
682− * first, then fall back to 32-bit if that fails.
683− * We are just "encouraging" 32-bit DMA masks here since we can
684− * never allow IOMMU bypass unless we add special support for ZX1.
685− */
686− if (mask > ~0U)
687− return 0;
688−
689681 ioc = GET_IOC(dev);
690682 if (!ioc)
691683 return 0;
drivers/pci/pci.c+11−13
@@ -958,19 +958,6 @@ void pci_refresh_power_state(struct pci_dev *dev) · 957 unmodified lines
958958 pci_update_current_state(dev, dev->current_state);
959959 }
960960
961−/**
962− * pci_power_up - Put the given device into D0 forcibly
963− * @dev: PCI device to power up
964− */
965−void pci_power_up(struct pci_dev *dev)
966−{
967− if (platform_pci_power_manageable(dev))
968− platform_pci_set_power_state(dev, PCI_D0);
969−
970− pci_raw_set_power_state(dev, PCI_D0);
971− pci_update_current_state(dev, PCI_D0);
972−}
973−
974961 /**
975962 * pci_platform_power_transition - Use platform to change device power state
976963 * @dev: PCI device to handle.
@@ -1153,6 +1140,17 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state) · 176 unmodified lines
11531140 }
11541141 EXPORT_SYMBOL(pci_set_power_state);
11551142
1143+/**
1144+ * pci_power_up - Put the given device into D0 forcibly
1145+ * @dev: PCI device to power up
1146+ */
1147+void pci_power_up(struct pci_dev *dev)
1148+{
1149+ __pci_start_power_transition(dev, PCI_D0);
1150+ pci_raw_set_power_state(dev, PCI_D0);
1151+ pci_update_current_state(dev, PCI_D0);
1152+}
1153+
11561154 /**
11571155 * pci_choose_state - Choose the power state of a PCI device
11581156 * @dev: PCI device to be suspended
drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c+54−70
@@ -87,7 +87,7 @@ FUNC_GROUP_DECL(MACLINK3, L23); · 86 unmodified lines
8787
8888 #define K25 7
8989 SIG_EXPR_LIST_DECL_SESG(K25, MACLINK4, MACLINK4, SIG_DESC_SET(SCU410, 7));
90−SIG_EXPR_LIST_DECL_SESG(K25, SDA14, SDA14, SIG_DESC_SET(SCU4B0, 7));
90+SIG_EXPR_LIST_DECL_SESG(K25, SDA14, I2C14, SIG_DESC_SET(SCU4B0, 7));
9191 PIN_DECL_2(K25, GPIOA7, MACLINK4, SDA14);
9292 FUNC_GROUP_DECL(MACLINK4, K25);
9393
@@ -1262,13 +1262,13 @@ GROUP_DECL(SPI1, AB11, AC11, AA11); · 1168 unmodified lines
12621262 #define AD11 206
12631263 SIG_EXPR_LIST_DECL_SEMG(AD11, SPI1DQ2, QSPI1, SPI1, SIG_DESC_SET(SCU438, 14));
12641264 SIG_EXPR_LIST_DECL_SEMG(AD11, TXD13, UART13G1, UART13,
1265− SIG_DESC_SET(SCU438, 14));
1265+ SIG_DESC_CLEAR(SCU4B8, 2), SIG_DESC_SET(SCU4D8, 14));
12661266 PIN_DECL_2(AD11, GPIOZ6, SPI1DQ2, TXD13);
12671267
12681268 #define AF10 207
12691269 SIG_EXPR_LIST_DECL_SEMG(AF10, SPI1DQ3, QSPI1, SPI1, SIG_DESC_SET(SCU438, 15));
12701270 SIG_EXPR_LIST_DECL_SEMG(AF10, RXD13, UART13G1, UART13,
1271− SIG_DESC_SET(SCU438, 15));
1271+ SIG_DESC_CLEAR(SCU4B8, 3), SIG_DESC_SET(SCU4D8, 15));
12721272 PIN_DECL_2(AF10, GPIOZ7, SPI1DQ3, RXD13);
12731273
12741274 GROUP_DECL(QSPI1, AB11, AC11, AA11, AD11, AF10);
@@ -1440,91 +1440,85 @@ FUNC_GROUP_DECL(RGMII2, D4, C2, C1, D3, E4, F5, D2, E3, D1, F4, E2, E1); · 165 unmodified lines
14401440 FUNC_GROUP_DECL(RMII2, D4, C2, C1, D3, D2, D1, F4, E2, E1);
14411441
14421442 #define AB4 232
1443−SIG_EXPR_LIST_DECL_SESG(AB4, SD3CLK, SD3, SIG_DESC_SET(SCU400, 24));
1444−PIN_DECL_1(AB4, GPIO18D0, SD3CLK);
1443+SIG_EXPR_LIST_DECL_SEMG(AB4, EMMCCLK, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 24));
1444+PIN_DECL_1(AB4, GPIO18D0, EMMCCLK);
14451445
14461446 #define AA4 233
1447−SIG_EXPR_LIST_DECL_SESG(AA4, SD3CMD, SD3, SIG_DESC_SET(SCU400, 25));
1448−PIN_DECL_1(AA4, GPIO18D1, SD3CMD);
1447+SIG_EXPR_LIST_DECL_SEMG(AA4, EMMCCMD, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 25));
1448+PIN_DECL_1(AA4, GPIO18D1, EMMCCMD);
14491449
14501450 #define AC4 234
1451−SIG_EXPR_LIST_DECL_SESG(AC4, SD3DAT0, SD3, SIG_DESC_SET(SCU400, 26));
1452−PIN_DECL_1(AC4, GPIO18D2, SD3DAT0);
1451+SIG_EXPR_LIST_DECL_SEMG(AC4, EMMCDAT0, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 26));
1452+PIN_DECL_1(AC4, GPIO18D2, EMMCDAT0);
14531453
14541454 #define AA5 235
1455−SIG_EXPR_LIST_DECL_SESG(AA5, SD3DAT1, SD3, SIG_DESC_SET(SCU400, 27));
1456−PIN_DECL_1(AA5, GPIO18D3, SD3DAT1);
1455+SIG_EXPR_LIST_DECL_SEMG(AA5, EMMCDAT1, EMMCG4, EMMC, SIG_DESC_SET(SCU400, 27));
1456+PIN_DECL_1(AA5, GPIO18D3, EMMCDAT1);
14571457
14581458 #define Y5 236
1459−SIG_EXPR_LIST_DECL_SESG(Y5, SD3DAT2, SD3, SIG_DESC_SET(SCU400, 28));
1460−PIN_DECL_1(Y5, GPIO18D4, SD3DAT2);
1459+SIG_EXPR_LIST_DECL_SEMG(Y5, EMMCDAT2, EMMCG4, EMMC, SIG_DESC_SET(SCU400, 28));
1460+PIN_DECL_1(Y5, GPIO18D4, EMMCDAT2);
14611461
14621462 #define AB5 237
1463−SIG_EXPR_LIST_DECL_SESG(AB5, SD3DAT3, SD3, SIG_DESC_SET(SCU400, 29));
1464−PIN_DECL_1(AB5, GPIO18D5, SD3DAT3);
1463+SIG_EXPR_LIST_DECL_SEMG(AB5, EMMCDAT3, EMMCG4, EMMC, SIG_DESC_SET(SCU400, 29));
1464+PIN_DECL_1(AB5, GPIO18D5, EMMCDAT3);
14651465
14661466 #define AB6 238
1467−SIG_EXPR_LIST_DECL_SESG(AB6, SD3CD, SD3, SIG_DESC_SET(SCU400, 30));
1468−PIN_DECL_1(AB6, GPIO18D6, SD3CD);
1467+SIG_EXPR_LIST_DECL_SEMG(AB6, EMMCCD, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 30));
1468+PIN_DECL_1(AB6, GPIO18D6, EMMCCD);
14691469
14701470 #define AC5 239
1471−SIG_EXPR_LIST_DECL_SESG(AC5, SD3WP, SD3, SIG_DESC_SET(SCU400, 31));
1472−PIN_DECL_1(AC5, GPIO18D7, SD3WP);
1471+SIG_EXPR_LIST_DECL_SEMG(AC5, EMMCWP, EMMCG1, EMMC, SIG_DESC_SET(SCU400, 31));
1472+PIN_DECL_1(AC5, GPIO18D7, EMMCWP);
14731473
1474−FUNC_GROUP_DECL(SD3, AB4, AA4, AC4, AA5, Y5, AB5, AB6, AC5);
1474+GROUP_DECL(EMMCG1, AB4, AA4, AC4, AB6, AC5);
1475+GROUP_DECL(EMMCG4, AB4, AA4, AC4, AA5, Y5, AB5, AB6, AC5);
14751476
14761477 #define Y1 240
14771478 SIG_EXPR_LIST_DECL_SEMG(Y1, FWSPIDCS, FWSPID, FWSPID, SIG_DESC_SET(SCU500, 3));
14781479 SIG_EXPR_LIST_DECL_SESG(Y1, VBCS, VB, SIG_DESC_SET(SCU500, 5));
1479−SIG_EXPR_LIST_DECL_SESG(Y1, SD3DAT4, SD3DAT4, SIG_DESC_SET(SCU404, 0));
1480−PIN_DECL_3(Y1, GPIO18E0, FWSPIDCS, VBCS, SD3DAT4);
1481−FUNC_GROUP_DECL(SD3DAT4, Y1);
1480+SIG_EXPR_LIST_DECL_SEMG(Y1, EMMCDAT4, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 0));
1481+PIN_DECL_3(Y1, GPIO18E0, FWSPIDCS, VBCS, EMMCDAT4);
14821482
14831483 #define Y2 241
14841484 SIG_EXPR_LIST_DECL_SEMG(Y2, FWSPIDCK, FWSPID, FWSPID, SIG_DESC_SET(SCU500, 3));
14851485 SIG_EXPR_LIST_DECL_SESG(Y2, VBCK, VB, SIG_DESC_SET(SCU500, 5));
1486−SIG_EXPR_LIST_DECL_SESG(Y2, SD3DAT5, SD3DAT5, SIG_DESC_SET(SCU404, 1));
1487−PIN_DECL_3(Y2, GPIO18E1, FWSPIDCK, VBCK, SD3DAT5);
1488−FUNC_GROUP_DECL(SD3DAT5, Y2);
1486+SIG_EXPR_LIST_DECL_SEMG(Y2, EMMCDAT5, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 1));
1487+PIN_DECL_3(Y2, GPIO18E1, FWSPIDCK, VBCK, EMMCDAT5);
14891488
14901489 #define Y3 242
14911490 SIG_EXPR_LIST_DECL_SEMG(Y3, FWSPIDMOSI, FWSPID, FWSPID,
14921491 SIG_DESC_SET(SCU500, 3));
14931492 SIG_EXPR_LIST_DECL_SESG(Y3, VBMOSI, VB, SIG_DESC_SET(SCU500, 5));
1494−SIG_EXPR_LIST_DECL_SESG(Y3, SD3DAT6, SD3DAT6, SIG_DESC_SET(SCU404, 2));
1495−PIN_DECL_3(Y3, GPIO18E2, FWSPIDMOSI, VBMOSI, SD3DAT6);
1496−FUNC_GROUP_DECL(SD3DAT6, Y3);
1493+SIG_EXPR_LIST_DECL_SEMG(Y3, EMMCDAT6, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 2));
1494+PIN_DECL_3(Y3, GPIO18E2, FWSPIDMOSI, VBMOSI, EMMCDAT6);
14971495
14981496 #define Y4 243
14991497 SIG_EXPR_LIST_DECL_SEMG(Y4, FWSPIDMISO, FWSPID, FWSPID,
15001498 SIG_DESC_SET(SCU500, 3));
15011499 SIG_EXPR_LIST_DECL_SESG(Y4, VBMISO, VB, SIG_DESC_SET(SCU500, 5));
1502−SIG_EXPR_LIST_DECL_SESG(Y4, SD3DAT7, SD3DAT7, SIG_DESC_SET(SCU404, 3));
1503−PIN_DECL_3(Y4, GPIO18E3, FWSPIDMISO, VBMISO, SD3DAT7);
1504−FUNC_GROUP_DECL(SD3DAT7, Y4);
1500+SIG_EXPR_LIST_DECL_SEMG(Y4, EMMCDAT7, EMMCG8, EMMC, SIG_DESC_SET(SCU404, 3));
1501+PIN_DECL_3(Y4, GPIO18E3, FWSPIDMISO, VBMISO, EMMCDAT7);
15051502
15061503 GROUP_DECL(FWSPID, Y1, Y2, Y3, Y4);
15071504 GROUP_DECL(FWQSPID, Y1, Y2, Y3, Y4, AE12, AF12);
1505+GROUP_DECL(EMMCG8, AB4, AA4, AC4, AA5, Y5, AB5, AB6, AC5, Y1, Y2, Y3, Y4);
15081506 FUNC_DECL_2(FWSPID, FWSPID, FWQSPID);
15091507 FUNC_GROUP_DECL(VB, Y1, Y2, Y3, Y4);
1510−
1508+FUNC_DECL_3(EMMC, EMMCG1, EMMCG4, EMMCG8);
15111509 /*
15121510 * FIXME: Confirm bits and priorities are the right way around for the
15131511 * following 4 pins
15141512 */
15151513 #define AF25 244
1516−SIG_EXPR_LIST_DECL_SEMG(AF25, I3C3SCL, I3C3, I3C3, SIG_DESC_SET(SCU438, 20),
1517− SIG_DESC_SET(SCU4D8, 20));
1518−SIG_EXPR_LIST_DECL_SESG(AF25, FSI1CLK, FSI1, SIG_DESC_CLEAR(SCU438, 20),
1519− SIG_DESC_SET(SCU4D8, 20));
1514+SIG_EXPR_LIST_DECL_SEMG(AF25, I3C3SCL, I3C3, I3C3, SIG_DESC_SET(SCU438, 20));
1515+SIG_EXPR_LIST_DECL_SESG(AF25, FSI1CLK, FSI1, SIG_DESC_SET(SCU4D8, 20));
15201516 PIN_DECL_(AF25, SIG_EXPR_LIST_PTR(AF25, I3C3SCL),
15211517 SIG_EXPR_LIST_PTR(AF25, FSI1CLK));
15221518
15231519 #define AE26 245
1524−SIG_EXPR_LIST_DECL_SEMG(AE26, I3C3SDA, I3C3, I3C3, SIG_DESC_SET(SCU438, 21),
1525− SIG_DESC_SET(SCU4D8, 21));
1526−SIG_EXPR_LIST_DECL_SESG(AE26, FSI1DATA, FSI1, SIG_DESC_CLEAR(SCU438, 21),
1527− SIG_DESC_SET(SCU4D8, 21));
1520+SIG_EXPR_LIST_DECL_SEMG(AE26, I3C3SDA, I3C3, I3C3, SIG_DESC_SET(SCU438, 21));
1521+SIG_EXPR_LIST_DECL_SESG(AE26, FSI1DATA, FSI1, SIG_DESC_SET(SCU4D8, 21));
15281522 PIN_DECL_(AE26, SIG_EXPR_LIST_PTR(AE26, I3C3SDA),
15291523 SIG_EXPR_LIST_PTR(AE26, FSI1DATA));
15301524
@@ -1533,18 +1527,14 @@ FUNC_DECL_2(I3C3, HVI3C3, I3C3); · 2 unmodified lines
15331527 FUNC_GROUP_DECL(FSI1, AF25, AE26);
15341528
15351529 #define AE25 246
1536−SIG_EXPR_LIST_DECL_SEMG(AE25, I3C4SCL, I3C4, I3C4, SIG_DESC_SET(SCU438, 22),
1537− SIG_DESC_SET(SCU4D8, 22));
1538−SIG_EXPR_LIST_DECL_SESG(AE25, FSI2CLK, FSI2, SIG_DESC_CLEAR(SCU438, 22),
1539− SIG_DESC_SET(SCU4D8, 22));
1530+SIG_EXPR_LIST_DECL_SEMG(AE25, I3C4SCL, I3C4, I3C4, SIG_DESC_SET(SCU438, 22));
1531+SIG_EXPR_LIST_DECL_SESG(AE25, FSI2CLK, FSI2, SIG_DESC_SET(SCU4D8, 22));
15401532 PIN_DECL_(AE25, SIG_EXPR_LIST_PTR(AE25, I3C4SCL),
15411533 SIG_EXPR_LIST_PTR(AE25, FSI2CLK));
15421534
15431535 #define AF24 247
1544−SIG_EXPR_LIST_DECL_SEMG(AF24, I3C4SDA, I3C4, I3C4, SIG_DESC_SET(SCU438, 23),
1545− SIG_DESC_SET(SCU4D8, 23));
1546−SIG_EXPR_LIST_DECL_SESG(AF24, FSI2DATA, FSI2, SIG_DESC_CLEAR(SCU438, 23),
1547− SIG_DESC_SET(SCU4D8, 23));
1536+SIG_EXPR_LIST_DECL_SEMG(AF24, I3C4SDA, I3C4, I3C4, SIG_DESC_SET(SCU438, 23));
1537+SIG_EXPR_LIST_DECL_SESG(AF24, FSI2DATA, FSI2, SIG_DESC_SET(SCU4D8, 23));
15481538 PIN_DECL_(AF24, SIG_EXPR_LIST_PTR(AF24, I3C4SDA),
15491539 SIG_EXPR_LIST_PTR(AF24, FSI2DATA));
15501540
@@ -1574,6 +1564,8 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 23 unmodified lines
15741564 ASPEED_PINCTRL_PIN(A3),
15751565 ASPEED_PINCTRL_PIN(AA11),
15761566 ASPEED_PINCTRL_PIN(AA12),
1567+ ASPEED_PINCTRL_PIN(AA16),
1568+ ASPEED_PINCTRL_PIN(AA17),
15771569 ASPEED_PINCTRL_PIN(AA23),
15781570 ASPEED_PINCTRL_PIN(AA24),
15791571 ASPEED_PINCTRL_PIN(AA25),
@@ -1585,6 +1577,8 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 5 unmodified lines
15851577 ASPEED_PINCTRL_PIN(AB11),
15861578 ASPEED_PINCTRL_PIN(AB12),
15871579 ASPEED_PINCTRL_PIN(AB15),
1580+ ASPEED_PINCTRL_PIN(AB16),
1581+ ASPEED_PINCTRL_PIN(AB17),
15881582 ASPEED_PINCTRL_PIN(AB18),
15891583 ASPEED_PINCTRL_PIN(AB19),
15901584 ASPEED_PINCTRL_PIN(AB22),
@@ -1602,6 +1596,7 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 11 unmodified lines
16021596 ASPEED_PINCTRL_PIN(AC11),
16031597 ASPEED_PINCTRL_PIN(AC12),
16041598 ASPEED_PINCTRL_PIN(AC15),
1599+ ASPEED_PINCTRL_PIN(AC16),
16051600 ASPEED_PINCTRL_PIN(AC17),
16061601 ASPEED_PINCTRL_PIN(AC18),
16071602 ASPEED_PINCTRL_PIN(AC19),
@@ -1619,6 +1614,7 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 11 unmodified lines
16191614 ASPEED_PINCTRL_PIN(AD12),
16201615 ASPEED_PINCTRL_PIN(AD14),
16211616 ASPEED_PINCTRL_PIN(AD15),
1617+ ASPEED_PINCTRL_PIN(AD16),
16221618 ASPEED_PINCTRL_PIN(AD19),
16231619 ASPEED_PINCTRL_PIN(AD20),
16241620 ASPEED_PINCTRL_PIN(AD22),
@@ -1634,8 +1630,11 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 9 unmodified lines
16341630 ASPEED_PINCTRL_PIN(AE12),
16351631 ASPEED_PINCTRL_PIN(AE14),
16361632 ASPEED_PINCTRL_PIN(AE15),
1633+ ASPEED_PINCTRL_PIN(AE16),
16371634 ASPEED_PINCTRL_PIN(AE18),
16381635 ASPEED_PINCTRL_PIN(AE19),
1636+ ASPEED_PINCTRL_PIN(AE25),
1637+ ASPEED_PINCTRL_PIN(AE26),
16391638 ASPEED_PINCTRL_PIN(AE7),
16401639 ASPEED_PINCTRL_PIN(AE8),
16411640 ASPEED_PINCTRL_PIN(AF10),
@@ -1643,6 +1642,8 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 1 unmodified line
16431642 ASPEED_PINCTRL_PIN(AF12),
16441643 ASPEED_PINCTRL_PIN(AF14),
16451644 ASPEED_PINCTRL_PIN(AF15),
1645+ ASPEED_PINCTRL_PIN(AF24),
1646+ ASPEED_PINCTRL_PIN(AF25),
16461647 ASPEED_PINCTRL_PIN(AF7),
16471648 ASPEED_PINCTRL_PIN(AF8),
16481649 ASPEED_PINCTRL_PIN(AF9),
@@ -1792,17 +1793,6 @@ static struct pinctrl_pin_desc aspeed_g6_pins[ASPEED_G6_NR_PINS] = { · 143 unmodified lines
17921793 ASPEED_PINCTRL_PIN(Y3),
17931794 ASPEED_PINCTRL_PIN(Y4),
17941795 ASPEED_PINCTRL_PIN(Y5),
1795− ASPEED_PINCTRL_PIN(AB16),
1796− ASPEED_PINCTRL_PIN(AA17),
1797− ASPEED_PINCTRL_PIN(AB17),
1798− ASPEED_PINCTRL_PIN(AE16),
1799− ASPEED_PINCTRL_PIN(AC16),
1800− ASPEED_PINCTRL_PIN(AA16),
1801− ASPEED_PINCTRL_PIN(AD16),
1802− ASPEED_PINCTRL_PIN(AF25),
1803− ASPEED_PINCTRL_PIN(AE26),
1804− ASPEED_PINCTRL_PIN(AE25),
1805− ASPEED_PINCTRL_PIN(AF24),
18061796 };
18071797
18081798 static const struct aspeed_pin_group aspeed_g6_groups[] = {
@@ -1976,11 +1966,9 @@ static const struct aspeed_pin_group aspeed_g6_groups[] = { · 167 unmodified lines
19761966 ASPEED_PINCTRL_GROUP(SALT9G1),
19771967 ASPEED_PINCTRL_GROUP(SD1),
19781968 ASPEED_PINCTRL_GROUP(SD2),
1979− ASPEED_PINCTRL_GROUP(SD3),
1980− ASPEED_PINCTRL_GROUP(SD3DAT4),
1981− ASPEED_PINCTRL_GROUP(SD3DAT5),
1982− ASPEED_PINCTRL_GROUP(SD3DAT6),
1983− ASPEED_PINCTRL_GROUP(SD3DAT7),
1969+ ASPEED_PINCTRL_GROUP(EMMCG1),
1970+ ASPEED_PINCTRL_GROUP(EMMCG4),
1971+ ASPEED_PINCTRL_GROUP(EMMCG8),
19841972 ASPEED_PINCTRL_GROUP(SGPM1),
19851973 ASPEED_PINCTRL_GROUP(SGPS1),
19861974 ASPEED_PINCTRL_GROUP(SIOONCTRL),
@@ -2059,6 +2047,7 @@ static const struct aspeed_pin_function aspeed_g6_functions[] = { · 72 unmodified lines
20592047 ASPEED_PINCTRL_FUNC(ADC8),
20602048 ASPEED_PINCTRL_FUNC(ADC9),
20612049 ASPEED_PINCTRL_FUNC(BMCINT),
2050+ ASPEED_PINCTRL_FUNC(EMMC),
20622051 ASPEED_PINCTRL_FUNC(ESPI),
20632052 ASPEED_PINCTRL_FUNC(ESPIALT),
20642053 ASPEED_PINCTRL_FUNC(FSI1),
@@ -2191,11 +2180,6 @@ static const struct aspeed_pin_function aspeed_g6_functions[] = { · 126 unmodified lines
21912180 ASPEED_PINCTRL_FUNC(SALT9),
21922181 ASPEED_PINCTRL_FUNC(SD1),
21932182 ASPEED_PINCTRL_FUNC(SD2),
2194− ASPEED_PINCTRL_FUNC(SD3),
2195− ASPEED_PINCTRL_FUNC(SD3DAT4),
2196− ASPEED_PINCTRL_FUNC(SD3DAT5),
2197− ASPEED_PINCTRL_FUNC(SD3DAT6),
2198− ASPEED_PINCTRL_FUNC(SD3DAT7),
21992183 ASPEED_PINCTRL_FUNC(SGPM1),
22002184 ASPEED_PINCTRL_FUNC(SGPS1),
22012185 ASPEED_PINCTRL_FUNC(SIOONCTRL),
drivers/pinctrl/aspeed/pinmux-aspeed.h+2−1
@@ -508,7 +508,7 @@ struct aspeed_pin_desc { · 507 unmodified lines
508508 * @idx: The bit index in the register
509509 */
510510 #define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1)
511−#define SIG_DESC_CLEAR(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 0)
511+#define SIG_DESC_CLEAR(reg, idx) { ASPEED_IP_SCU, reg, BIT_MASK(idx), 0, 0 }
512512
513513 #define SIG_DESC_LIST_SYM(sig, group) sig_descs_ ## sig ## _ ## group
514514 #define SIG_DESC_LIST_DECL(sig, group, ...) \
@@ -738,6 +738,7 @@ struct aspeed_pin_desc { · 223 unmodified lines
738738 static const char *FUNC_SYM(func)[] = { __VA_ARGS__ }
739739
740740 #define FUNC_DECL_2(func, one, two) FUNC_DECL_(func, #one, #two)
741+#define FUNC_DECL_3(func, one, two, three) FUNC_DECL_(func, #one, #two, #three)
741742
742743 #define FUNC_GROUP_DECL(func, ...) \
743744 GROUP_DECL(func, __VA_ARGS__); \
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c+2−10
@@ -1,14 +1,6 @@
1+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2014-2017 Broadcom
3− *
4− * This program is free software; you can redistribute it and/or
5− * modify it under the terms of the GNU General Public License as
6− * published by the Free Software Foundation version 2.
7− *
8− * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9− * kind, whether express or implied; without even the implied warranty
10− * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
124 */
135
146 /*
@@ -853,7 +845,7 @@ static int iproc_gpio_probe(struct platform_device *pdev) · 838 unmodified lines
853845
854846 /* optional GPIO interrupt support */
855847 irq = platform_get_irq(pdev, 0);
856− if (irq) {
848+ if (irq > 0) {
857849 struct irq_chip *irqc;
858850 struct gpio_irq_chip *girq;
859851
drivers/pinctrl/bcm/pinctrl-ns2-mux.c+2−2
@@ -640,8 +640,8 @@ static int ns2_pinmux_enable(struct pinctrl_dev *pctrl_dev, · 639 unmodified lines
640640 const struct ns2_pin_function *func;
641641 const struct ns2_pin_group *grp;
642642
643− if (grp_select > pinctrl->num_groups ||
644− func_select > pinctrl->num_functions)
643+ if (grp_select >= pinctrl->num_groups ||
644+ func_select >= pinctrl->num_functions)
645645 return -EINVAL;
646646
647647 func = &pinctrl->functions[func_select];
drivers/pinctrl/berlin/pinctrl-as370.c+1−1
@@ -43,7 +43,7 @@ static const struct berlin_desc_group as370_soc_pinctrl_groups[] = { · 42 unmodified lines
4343 BERLIN_PINCTRL_FUNCTION(0x0, "gpio"), /* GPIO5 */
4444 BERLIN_PINCTRL_FUNCTION(0x1, "i2s1"), /* DO3 */
4545 BERLIN_PINCTRL_FUNCTION(0x2, "pwm"), /* PWM5 */
46− BERLIN_PINCTRL_FUNCTION(0x3, "spififib"), /* SPDIFIB */
46+ BERLIN_PINCTRL_FUNCTION(0x3, "spdifib"), /* SPDIFIB */
4747 BERLIN_PINCTRL_FUNCTION(0x4, "spdifo"), /* SPDIFO */
4848 BERLIN_PINCTRL_FUNCTION(0x5, "phy")), /* DBG5 */
4949 BERLIN_PINCTRL_GROUP("I2S1_MCLK", 0x0, 0x3, 0x12,
drivers/pinctrl/intel/pinctrl-cherryview.c+0−4
@@ -1513,7 +1513,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1512 unmodified lines
15131513 .matches = {
15141514 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
15151515 DMI_MATCH(DMI_PRODUCT_FAMILY, "Intel_Strago"),
1516− DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
15171516 },
15181517 },
15191518 {
@@ -1521,7 +1520,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line
15211520 .matches = {
15221521 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
15231522 DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
1524− DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
15251523 },
15261524 },
15271525 {
@@ -1529,7 +1527,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line
15291527 .matches = {
15301528 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
15311529 DMI_MATCH(DMI_PRODUCT_NAME, "Cyan"),
1532− DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
15331530 },
15341531 },
15351532 {
@@ -1537,7 +1534,6 @@ static const struct dmi_system_id chv_no_valid_mask[] = { · 1 unmodified line
15371534 .matches = {
15381535 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
15391536 DMI_MATCH(DMI_PRODUCT_NAME, "Celes"),
1540− DMI_MATCH(DMI_PRODUCT_VERSION, "1.0"),
15411537 },
15421538 },
15431539 {}
drivers/pinctrl/intel/pinctrl-intel.c+14−13
@@ -96,6 +96,7 @@ struct intel_pinctrl_context { · 95 unmodified lines
9696 * @pctldesc: Pin controller description
9797 * @pctldev: Pointer to the pin controller device
9898 * @chip: GPIO chip in this pin controller
99+ * @irqchip: IRQ chip in this pin controller
99100 * @soc: SoC/PCH specific pin configuration data
100101 * @communities: All communities in this pin controller
101102 * @ncommunities: Number of communities in this pin controller
@@ -108,6 +109,7 @@ struct intel_pinctrl { · 6 unmodified lines
108109 struct pinctrl_desc pctldesc;
109110 struct pinctrl_dev *pctldev;
110111 struct gpio_chip chip;
112+ struct irq_chip irqchip;
111113 const struct intel_pinctrl_soc_data *soc;
112114 struct intel_community *communities;
113115 size_t ncommunities;
@@ -1139,16 +1141,6 @@ static irqreturn_t intel_gpio_irq(int irq, void *data) · 1025 unmodified lines
11391141 return ret;
11401142 }
11411143
1142−static struct irq_chip intel_gpio_irqchip = {
1143− .name = "intel-gpio",
1144− .irq_ack = intel_gpio_irq_ack,
1145− .irq_mask = intel_gpio_irq_mask,
1146− .irq_unmask = intel_gpio_irq_unmask,
1147− .irq_set_type = intel_gpio_irq_type,
1148− .irq_set_wake = intel_gpio_irq_wake,
1149− .flags = IRQCHIP_MASK_ON_SUSPEND,
1150−};
1151−
11521144 static int intel_gpio_add_pin_ranges(struct intel_pinctrl *pctrl,
11531145 const struct intel_community *community)
11541146 {
@@ -1198,12 +1190,22 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 43 unmodified lines
11981190
11991191 pctrl->chip = intel_gpio_chip;
12001192
1193+ /* Setup GPIO chip */
12011194 pctrl->chip.ngpio = intel_gpio_ngpio(pctrl);
12021195 pctrl->chip.label = dev_name(pctrl->dev);
12031196 pctrl->chip.parent = pctrl->dev;
12041197 pctrl->chip.base = -1;
12051198 pctrl->irq = irq;
12061199
1200+ /* Setup IRQ chip */
1201+ pctrl->irqchip.name = dev_name(pctrl->dev);
1202+ pctrl->irqchip.irq_ack = intel_gpio_irq_ack;
1203+ pctrl->irqchip.irq_mask = intel_gpio_irq_mask;
1204+ pctrl->irqchip.irq_unmask = intel_gpio_irq_unmask;
1205+ pctrl->irqchip.irq_set_type = intel_gpio_irq_type;
1206+ pctrl->irqchip.irq_set_wake = intel_gpio_irq_wake;
1207+ pctrl->irqchip.flags = IRQCHIP_MASK_ON_SUSPEND;
1208+
12071209 ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
12081210 if (ret) {
12091211 dev_err(pctrl->dev, "failed to register gpiochip\n");
@@ -1233,15 +1235,14 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) · 23 unmodified lines
12331235 return ret;
12341236 }
12351237
1236− ret = gpiochip_irqchip_add(&pctrl->chip, &intel_gpio_irqchip, 0,
1238+ ret = gpiochip_irqchip_add(&pctrl->chip, &pctrl->irqchip, 0,
12371239 handle_bad_irq, IRQ_TYPE_NONE);
12381240 if (ret) {
12391241 dev_err(pctrl->dev, "failed to add irqchip\n");
12401242 return ret;
12411243 }
12421244
1243− gpiochip_set_chained_irqchip(&pctrl->chip, &intel_gpio_irqchip, irq,
1244− NULL);
1245+ gpiochip_set_chained_irqchip(&pctrl->chip, &pctrl->irqchip, irq, NULL);
12451246 return 0;
12461247 }
12471248
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c+13−13
@@ -183,10 +183,10 @@ static struct armada_37xx_pin_group armada_37xx_nb_groups[] = { · 182 unmodified lines
183183 PIN_GRP_EXTRA("uart2", 9, 2, BIT(1) | BIT(13) | BIT(14) | BIT(19),
184184 BIT(1) | BIT(13) | BIT(14), BIT(1) | BIT(19),
185185 18, 2, "gpio", "uart"),
186− PIN_GRP_GPIO("led0_od", 11, 1, BIT(20), "led"),
187− PIN_GRP_GPIO("led1_od", 12, 1, BIT(21), "led"),
188− PIN_GRP_GPIO("led2_od", 13, 1, BIT(22), "led"),
189− PIN_GRP_GPIO("led3_od", 14, 1, BIT(23), "led"),
186+ PIN_GRP_GPIO_2("led0_od", 11, 1, BIT(20), BIT(20), 0, "led"),
187+ PIN_GRP_GPIO_2("led1_od", 12, 1, BIT(21), BIT(21), 0, "led"),
188+ PIN_GRP_GPIO_2("led2_od", 13, 1, BIT(22), BIT(22), 0, "led"),
189+ PIN_GRP_GPIO_2("led3_od", 14, 1, BIT(23), BIT(23), 0, "led"),
190190
191191 };
192192
@@ -221,11 +221,11 @@ static const struct armada_37xx_pin_data armada_37xx_pin_sb = { · 28 unmodified lines
221221 };
222222
223223 static inline void armada_37xx_update_reg(unsigned int *reg,
224− unsigned int offset)
224+ unsigned int *offset)
225225 {
226226 /* We never have more than 2 registers */
227− if (offset >= GPIO_PER_REG) {
228− offset -= GPIO_PER_REG;
227+ if (*offset >= GPIO_PER_REG) {
228+ *offset -= GPIO_PER_REG;
229229 *reg += sizeof(u32);
230230 }
231231 }
@@ -376,7 +376,7 @@ static inline void armada_37xx_irq_update_reg(unsigned int *reg, · 144 unmodified lines
376376 {
377377 int offset = irqd_to_hwirq(d);
378378
379− armada_37xx_update_reg(reg, offset);
379+ armada_37xx_update_reg(reg, &offset);
380380 }
381381
382382 static int armada_37xx_gpio_direction_input(struct gpio_chip *chip,
@@ -386,7 +386,7 @@ static int armada_37xx_gpio_direction_input(struct gpio_chip *chip, · 3 unmodified lines
386386 unsigned int reg = OUTPUT_EN;
387387 unsigned int mask;
388388
389− armada_37xx_update_reg(&reg, offset);
389+ armada_37xx_update_reg(&reg, &offset);
390390 mask = BIT(offset);
391391
392392 return regmap_update_bits(info->regmap, reg, mask, 0);
@@ -399,7 +399,7 @@ static int armada_37xx_gpio_get_direction(struct gpio_chip *chip, · 6 unmodified lines
399399 unsigned int reg = OUTPUT_EN;
400400 unsigned int val, mask;
401401
402− armada_37xx_update_reg(&reg, offset);
402+ armada_37xx_update_reg(&reg, &offset);
403403 mask = BIT(offset);
404404 regmap_read(info->regmap, reg, &val);
405405
@@ -413,7 +413,7 @@ static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, · 7 unmodified lines
413413 unsigned int reg = OUTPUT_EN;
414414 unsigned int mask, val, ret;
415415
416− armada_37xx_update_reg(&reg, offset);
416+ armada_37xx_update_reg(&reg, &offset);
417417 mask = BIT(offset);
418418
419419 ret = regmap_update_bits(info->regmap, reg, mask, mask);
@@ -434,7 +434,7 @@ static int armada_37xx_gpio_get(struct gpio_chip *chip, unsigned int offset) · 14 unmodified lines
434434 unsigned int reg = INPUT_VAL;
435435 unsigned int val, mask;
436436
437− armada_37xx_update_reg(&reg, offset);
437+ armada_37xx_update_reg(&reg, &offset);
438438 mask = BIT(offset);
439439
440440 regmap_read(info->regmap, reg, &val);
@@ -449,7 +449,7 @@ static void armada_37xx_gpio_set(struct gpio_chip *chip, unsigned int offset, · 8 unmodified lines
449449 unsigned int reg = OUTPUT_VAL;
450450 unsigned int mask, val;
451451
452− armada_37xx_update_reg(&reg, offset);
452+ armada_37xx_update_reg(&reg, &offset);
453453 mask = BIT(offset);
454454 val = value ? mask : 0;
455455
drivers/pinctrl/pinctrl-stmfx.c+1−1
@@ -705,7 +705,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) · 704 unmodified lines
705705
706706 static int stmfx_pinctrl_remove(struct platform_device *pdev)
707707 {
708− struct stmfx *stmfx = dev_get_platdata(&pdev->dev);
708+ struct stmfx *stmfx = dev_get_drvdata(pdev->dev.parent);
709709
710710 return stmfx_function_disable(stmfx,
711711 STMFX_FUNC_GPIO |
drivers/platform/x86/classmate-laptop.c+0−12
@@ -420,12 +420,6 @@ failed_sensitivity: · 419 unmodified lines
420420
421421 static int cmpc_accel_remove_v4(struct acpi_device *acpi)
422422 {
423− struct input_dev *inputdev;
424− struct cmpc_accel *accel;
425−
426− inputdev = dev_get_drvdata(&acpi->dev);
427− accel = dev_get_drvdata(&inputdev->dev);
428−
429423 device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr_v4);
430424 device_remove_file(&acpi->dev, &cmpc_accel_g_select_attr_v4);
431425 return cmpc_remove_acpi_notify_device(acpi);
@@ -656,12 +650,6 @@ failed_file: · 224 unmodified lines
656650
657651 static int cmpc_accel_remove(struct acpi_device *acpi)
658652 {
659− struct input_dev *inputdev;
660− struct cmpc_accel *accel;
661−
662− inputdev = dev_get_drvdata(&acpi->dev);
663− accel = dev_get_drvdata(&inputdev->dev);
664−
665653 device_remove_file(&acpi->dev, &cmpc_accel_sensitivity_attr);
666654 return cmpc_remove_acpi_notify_device(acpi);
667655 }
drivers/platform/x86/i2c-multi-instantiate.c+1−0
@@ -108,6 +108,7 @@ static int i2c_multi_inst_probe(struct platform_device *pdev) · 107 unmodified lines
108108 if (ret < 0) {
109109 dev_dbg(dev, "Error requesting irq at index %d: %d\n",
110110 inst_data[i].irq_idx, ret);
111+ goto error;
111112 }
112113 board_info.irq = ret;
113114 break;
drivers/platform/x86/intel_punit_ipc.c+1−2
@@ -293,9 +293,8 @@ static int intel_punit_ipc_probe(struct platform_device *pdev) · 292 unmodified lines
293293
294294 platform_set_drvdata(pdev, punit_ipcdev);
295295
296− irq = platform_get_irq(pdev, 0);
296+ irq = platform_get_irq_optional(pdev, 0);
297297 if (irq < 0) {
298− punit_ipcdev->irq = 0;
299298 dev_warn(&pdev->dev, "Invalid IRQ, using polling mode\n");
300299 } else {
301300 ret = devm_request_irq(&pdev->dev, irq, intel_punit_ioc,
drivers/ptp/Kconfig+2−2
@@ -97,8 +97,8 @@ config PTP_1588_CLOCK_PCH · 96 unmodified lines
9797 help
9898 This driver adds support for using the PCH EG20T as a PTP
9999 clock. The hardware supports time stamping of PTP packets
100− when using the end-to-end delay (E2E) mechansim. The peer
101− delay mechansim (P2P) is not supported.
100+ when using the end-to-end delay (E2E) mechanism. The peer
101+ delay mechanism (P2P) is not supported.
102102
103103 This clock is only useful if your PTP programs are getting
104104 hardware time stamps on the PTP Ethernet packets using the
drivers/regulator/core.c+13−0
@@ -5053,6 +5053,19 @@ regulator_register(const struct regulator_desc *regulator_desc, · 5052 unmodified lines
50535053
50545054 init_data = regulator_of_get_init_data(dev, regulator_desc, config,
50555055 &rdev->dev.of_node);
5056+
5057+ /*
5058+ * Sometimes not all resources are probed already so we need to take
5059+ * that into account. This happens most the time if the ena_gpiod comes
5060+ * from a gpio extender or something else.
5061+ */
5062+ if (PTR_ERR(init_data) == -EPROBE_DEFER) {
5063+ kfree(config);
5064+ kfree(rdev);
5065+ ret = -EPROBE_DEFER;
5066+ goto rinse;
5067+ }
5068+
50565069 /*
50575070 * We need to keep track of any GPIO descriptor coming from the
50585071 * device tree until we have handled it over to the core. If the
drivers/regulator/da9062-regulator.c+47−71
@@ -136,7 +136,6 @@ static int da9062_buck_set_mode(struct regulator_dev *rdev, unsigned mode) · 135 unmodified lines
136136 static unsigned da9062_buck_get_mode(struct regulator_dev *rdev)
137137 {
138138 struct da9062_regulator *regl = rdev_get_drvdata(rdev);
139− struct regmap_field *field;
140139 unsigned int val, mode = 0;
141140 int ret;
142141
@@ -158,18 +157,7 @@ static unsigned da9062_buck_get_mode(struct regulator_dev *rdev) · 15 unmodified lines
158157 return REGULATOR_MODE_NORMAL;
159158 }
160159
161− /* Detect current regulator state */
162− ret = regmap_field_read(regl->suspend, &val);
163− if (ret < 0)
164− return 0;
165−
166− /* Read regulator mode from proper register, depending on state */
167− if (val)
168− field = regl->suspend_sleep;
169− else
170− field = regl->sleep;
171−
172− ret = regmap_field_read(field, &val);
160+ ret = regmap_field_read(regl->sleep, &val);
173161 if (ret < 0)
174162 return 0;
175163
@@ -208,21 +196,9 @@ static int da9062_ldo_set_mode(struct regulator_dev *rdev, unsigned mode) · 32 unmodified lines
208196 static unsigned da9062_ldo_get_mode(struct regulator_dev *rdev)
209197 {
210198 struct da9062_regulator *regl = rdev_get_drvdata(rdev);
211− struct regmap_field *field;
212199 int ret, val;
213200
214− /* Detect current regulator state */
215− ret = regmap_field_read(regl->suspend, &val);
216− if (ret < 0)
217− return 0;
218−
219− /* Read regulator mode from proper register, depending on state */
220− if (val)
221− field = regl->suspend_sleep;
222− else
223− field = regl->sleep;
224−
225− ret = regmap_field_read(field, &val);
201+ ret = regmap_field_read(regl->sleep, &val);
226202 if (ret < 0)
227203 return 0;
228204
@@ -408,10 +384,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 179 unmodified lines
408384 __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
409385 sizeof(unsigned int) * 8 -
410386 __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
411− .suspend = REG_FIELD(DA9062AA_DVC_1,
412− __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
387+ .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
388+ __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
413389 sizeof(unsigned int) * 8 -
414− __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
390+ __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
415391 },
416392 {
417393 .desc.id = DA9061_ID_BUCK2,
@@ -444,10 +420,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 26 unmodified lines
444420 __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
445421 sizeof(unsigned int) * 8 -
446422 __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
447− .suspend = REG_FIELD(DA9062AA_DVC_1,
448− __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
423+ .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
424+ __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
449425 sizeof(unsigned int) * 8 -
450− __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
426+ __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
451427 },
452428 {
453429 .desc.id = DA9061_ID_BUCK3,
@@ -480,10 +456,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 26 unmodified lines
480456 __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1,
481457 sizeof(unsigned int) * 8 -
482458 __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1),
483− .suspend = REG_FIELD(DA9062AA_DVC_1,
484− __builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1,
459+ .suspend = REG_FIELD(DA9062AA_BUCK4_CONT,
460+ __builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1,
485461 sizeof(unsigned int) * 8 -
486− __builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1),
462+ __builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1),
487463 },
488464 {
489465 .desc.id = DA9061_ID_LDO1,
@@ -509,10 +485,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 19 unmodified lines
509485 sizeof(unsigned int) * 8 -
510486 __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1),
511487 .suspend_vsel_reg = DA9062AA_VLDO1_B,
512− .suspend = REG_FIELD(DA9062AA_DVC_1,
513− __builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1,
488+ .suspend = REG_FIELD(DA9062AA_LDO1_CONT,
489+ __builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1,
514490 sizeof(unsigned int) * 8 -
515− __builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1),
491+ __builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1),
516492 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
517493 __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1,
518494 sizeof(unsigned int) * 8 -
@@ -542,10 +518,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 23 unmodified lines
542518 sizeof(unsigned int) * 8 -
543519 __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1),
544520 .suspend_vsel_reg = DA9062AA_VLDO2_B,
545− .suspend = REG_FIELD(DA9062AA_DVC_1,
546− __builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1,
521+ .suspend = REG_FIELD(DA9062AA_LDO2_CONT,
522+ __builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1,
547523 sizeof(unsigned int) * 8 -
548− __builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1),
524+ __builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1),
549525 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
550526 __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1,
551527 sizeof(unsigned int) * 8 -
@@ -575,10 +551,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 23 unmodified lines
575551 sizeof(unsigned int) * 8 -
576552 __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1),
577553 .suspend_vsel_reg = DA9062AA_VLDO3_B,
578− .suspend = REG_FIELD(DA9062AA_DVC_1,
579− __builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1,
554+ .suspend = REG_FIELD(DA9062AA_LDO3_CONT,
555+ __builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1,
580556 sizeof(unsigned int) * 8 -
581− __builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1),
557+ __builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1),
582558 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
583559 __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1,
584560 sizeof(unsigned int) * 8 -
@@ -608,10 +584,10 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = { · 23 unmodified lines
608584 sizeof(unsigned int) * 8 -
609585 __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1),
610586 .suspend_vsel_reg = DA9062AA_VLDO4_B,
611− .suspend = REG_FIELD(DA9062AA_DVC_1,
612− __builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1,
587+ .suspend = REG_FIELD(DA9062AA_LDO4_CONT,
588+ __builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1,
613589 sizeof(unsigned int) * 8 -
614− __builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1),
590+ __builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1),
615591 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
616592 __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1,
617593 sizeof(unsigned int) * 8 -
@@ -652,10 +628,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 34 unmodified lines
652628 __builtin_ffs((int)DA9062AA_BUCK1_MODE_MASK) - 1,
653629 sizeof(unsigned int) * 8 -
654630 __builtin_clz((DA9062AA_BUCK1_MODE_MASK)) - 1),
655− .suspend = REG_FIELD(DA9062AA_DVC_1,
656− __builtin_ffs((int)DA9062AA_VBUCK1_SEL_MASK) - 1,
631+ .suspend = REG_FIELD(DA9062AA_BUCK1_CONT,
632+ __builtin_ffs((int)DA9062AA_BUCK1_CONF_MASK) - 1,
657633 sizeof(unsigned int) * 8 -
658− __builtin_clz((DA9062AA_VBUCK1_SEL_MASK)) - 1),
634+ __builtin_clz(DA9062AA_BUCK1_CONF_MASK) - 1),
659635 },
660636 {
661637 .desc.id = DA9062_ID_BUCK2,
@@ -688,10 +664,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 26 unmodified lines
688664 __builtin_ffs((int)DA9062AA_BUCK2_MODE_MASK) - 1,
689665 sizeof(unsigned int) * 8 -
690666 __builtin_clz((DA9062AA_BUCK2_MODE_MASK)) - 1),
691− .suspend = REG_FIELD(DA9062AA_DVC_1,
692− __builtin_ffs((int)DA9062AA_VBUCK2_SEL_MASK) - 1,
667+ .suspend = REG_FIELD(DA9062AA_BUCK2_CONT,
668+ __builtin_ffs((int)DA9062AA_BUCK2_CONF_MASK) - 1,
693669 sizeof(unsigned int) * 8 -
694− __builtin_clz((DA9062AA_VBUCK2_SEL_MASK)) - 1),
670+ __builtin_clz(DA9062AA_BUCK2_CONF_MASK) - 1),
695671 },
696672 {
697673 .desc.id = DA9062_ID_BUCK3,
@@ -724,10 +700,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 26 unmodified lines
724700 __builtin_ffs((int)DA9062AA_BUCK3_MODE_MASK) - 1,
725701 sizeof(unsigned int) * 8 -
726702 __builtin_clz((DA9062AA_BUCK3_MODE_MASK)) - 1),
727− .suspend = REG_FIELD(DA9062AA_DVC_1,
728− __builtin_ffs((int)DA9062AA_VBUCK3_SEL_MASK) - 1,
703+ .suspend = REG_FIELD(DA9062AA_BUCK3_CONT,
704+ __builtin_ffs((int)DA9062AA_BUCK3_CONF_MASK) - 1,
729705 sizeof(unsigned int) * 8 -
730− __builtin_clz((DA9062AA_VBUCK3_SEL_MASK)) - 1),
706+ __builtin_clz(DA9062AA_BUCK3_CONF_MASK) - 1),
731707 },
732708 {
733709 .desc.id = DA9062_ID_BUCK4,
@@ -760,10 +736,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 26 unmodified lines
760736 __builtin_ffs((int)DA9062AA_BUCK4_MODE_MASK) - 1,
761737 sizeof(unsigned int) * 8 -
762738 __builtin_clz((DA9062AA_BUCK4_MODE_MASK)) - 1),
763− .suspend = REG_FIELD(DA9062AA_DVC_1,
764− __builtin_ffs((int)DA9062AA_VBUCK4_SEL_MASK) - 1,
739+ .suspend = REG_FIELD(DA9062AA_BUCK4_CONT,
740+ __builtin_ffs((int)DA9062AA_BUCK4_CONF_MASK) - 1,
765741 sizeof(unsigned int) * 8 -
766− __builtin_clz((DA9062AA_VBUCK4_SEL_MASK)) - 1),
742+ __builtin_clz(DA9062AA_BUCK4_CONF_MASK) - 1),
767743 },
768744 {
769745 .desc.id = DA9062_ID_LDO1,
@@ -789,10 +765,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 19 unmodified lines
789765 sizeof(unsigned int) * 8 -
790766 __builtin_clz((DA9062AA_LDO1_SL_B_MASK)) - 1),
791767 .suspend_vsel_reg = DA9062AA_VLDO1_B,
792− .suspend = REG_FIELD(DA9062AA_DVC_1,
793− __builtin_ffs((int)DA9062AA_VLDO1_SEL_MASK) - 1,
768+ .suspend = REG_FIELD(DA9062AA_LDO1_CONT,
769+ __builtin_ffs((int)DA9062AA_LDO1_CONF_MASK) - 1,
794770 sizeof(unsigned int) * 8 -
795− __builtin_clz((DA9062AA_VLDO1_SEL_MASK)) - 1),
771+ __builtin_clz(DA9062AA_LDO1_CONF_MASK) - 1),
796772 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
797773 __builtin_ffs((int)DA9062AA_LDO1_ILIM_MASK) - 1,
798774 sizeof(unsigned int) * 8 -
@@ -822,10 +798,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 23 unmodified lines
822798 sizeof(unsigned int) * 8 -
823799 __builtin_clz((DA9062AA_LDO2_SL_B_MASK)) - 1),
824800 .suspend_vsel_reg = DA9062AA_VLDO2_B,
825− .suspend = REG_FIELD(DA9062AA_DVC_1,
826− __builtin_ffs((int)DA9062AA_VLDO2_SEL_MASK) - 1,
801+ .suspend = REG_FIELD(DA9062AA_LDO2_CONT,
802+ __builtin_ffs((int)DA9062AA_LDO2_CONF_MASK) - 1,
827803 sizeof(unsigned int) * 8 -
828− __builtin_clz((DA9062AA_VLDO2_SEL_MASK)) - 1),
804+ __builtin_clz(DA9062AA_LDO2_CONF_MASK) - 1),
829805 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
830806 __builtin_ffs((int)DA9062AA_LDO2_ILIM_MASK) - 1,
831807 sizeof(unsigned int) * 8 -
@@ -855,10 +831,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 23 unmodified lines
855831 sizeof(unsigned int) * 8 -
856832 __builtin_clz((DA9062AA_LDO3_SL_B_MASK)) - 1),
857833 .suspend_vsel_reg = DA9062AA_VLDO3_B,
858− .suspend = REG_FIELD(DA9062AA_DVC_1,
859− __builtin_ffs((int)DA9062AA_VLDO3_SEL_MASK) - 1,
834+ .suspend = REG_FIELD(DA9062AA_LDO3_CONT,
835+ __builtin_ffs((int)DA9062AA_LDO3_CONF_MASK) - 1,
860836 sizeof(unsigned int) * 8 -
861− __builtin_clz((DA9062AA_VLDO3_SEL_MASK)) - 1),
837+ __builtin_clz(DA9062AA_LDO3_CONF_MASK) - 1),
862838 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
863839 __builtin_ffs((int)DA9062AA_LDO3_ILIM_MASK) - 1,
864840 sizeof(unsigned int) * 8 -
@@ -888,10 +864,10 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = { · 23 unmodified lines
888864 sizeof(unsigned int) * 8 -
889865 __builtin_clz((DA9062AA_LDO4_SL_B_MASK)) - 1),
890866 .suspend_vsel_reg = DA9062AA_VLDO4_B,
891− .suspend = REG_FIELD(DA9062AA_DVC_1,
892− __builtin_ffs((int)DA9062AA_VLDO4_SEL_MASK) - 1,
867+ .suspend = REG_FIELD(DA9062AA_LDO4_CONT,
868+ __builtin_ffs((int)DA9062AA_LDO4_CONF_MASK) - 1,
893869 sizeof(unsigned int) * 8 -
894− __builtin_clz((DA9062AA_VLDO4_SEL_MASK)) - 1),
870+ __builtin_clz(DA9062AA_LDO4_CONF_MASK) - 1),
895871 .oc_event = REG_FIELD(DA9062AA_STATUS_D,
896872 __builtin_ffs((int)DA9062AA_LDO4_ILIM_MASK) - 1,
897873 sizeof(unsigned int) * 8 -
drivers/regulator/fixed.c+2−3
@@ -144,8 +144,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 143 unmodified lines
144144 struct device *dev = &pdev->dev;
145145 struct fixed_voltage_config *config;
146146 struct fixed_voltage_data *drvdata;
147− const struct fixed_dev_type *drvtype =
148− of_match_device(dev->driver->of_match_table, dev)->data;
147+ const struct fixed_dev_type *drvtype = of_device_get_match_data(dev);
149148 struct regulator_config cfg = { };
150149 enum gpiod_flags gflags;
151150 int ret;
@@ -177,7 +176,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) · 25 unmodified lines
177176 drvdata->desc.type = REGULATOR_VOLTAGE;
178177 drvdata->desc.owner = THIS_MODULE;
179178
180− if (drvtype->has_enable_clock) {
179+ if (drvtype && drvtype->has_enable_clock) {
181180 drvdata->desc.ops = &fixed_voltage_clkenabled_ops;
182181
183182 drvdata->enable_clock = devm_clk_get(dev, NULL);
drivers/regulator/lochnagar-regulator.c+1−0
@@ -210,6 +210,7 @@ static const struct regulator_desc lochnagar_regulators[] = { · 209 unmodified lines
210210
211211 .enable_time = 3000,
212212 .ramp_delay = 1000,
213+ .off_on_delay = 15000,
213214
214215 .owner = THIS_MODULE,
215216 },
drivers/regulator/of_regulator.c+18−9
@@ -231,12 +231,12 @@ static int of_get_regulation_constraints(struct device *dev, · 230 unmodified lines
231231 "regulator-off-in-suspend"))
232232 suspend_state->enabled = DISABLE_IN_SUSPEND;
233233
234− if (!of_property_read_u32(np, "regulator-suspend-min-microvolt",
235− &pval))
234+ if (!of_property_read_u32(suspend_np,
235+ "regulator-suspend-min-microvolt", &pval))
236236 suspend_state->min_uV = pval;
237237
238− if (!of_property_read_u32(np, "regulator-suspend-max-microvolt",
239− &pval))
238+ if (!of_property_read_u32(suspend_np,
239+ "regulator-suspend-max-microvolt", &pval))
240240 suspend_state->max_uV = pval;
241241
242242 if (!of_property_read_u32(suspend_np,
@@ -445,11 +445,20 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, · 202 unmodified lines
445445 goto error;
446446 }
447447
448− if (desc->of_parse_cb && desc->of_parse_cb(child, desc, config)) {
449− dev_err(dev,
450− "driver callback failed to parse DT for regulator %pOFn\n",
451− child);
452− goto error;
448+ if (desc->of_parse_cb) {
449+ int ret;
450+
451+ ret = desc->of_parse_cb(child, desc, config);
452+ if (ret) {
453+ if (ret == -EPROBE_DEFER) {
454+ of_node_put(child);
455+ return ERR_PTR(-EPROBE_DEFER);
456+ }
457+ dev_err(dev,
458+ "driver callback failed to parse DT for regulator %pOFn\n",
459+ child);
460+ goto error;
461+ }
453462 }
454463
455464 *node = child;
drivers/regulator/pfuze100-regulator.c+7−1
@@ -788,7 +788,13 @@ static int pfuze100_regulator_probe(struct i2c_client *client, · 787 unmodified lines
788788
789789 /* SW2~SW4 high bit check and modify the voltage value table */
790790 if (i >= sw_check_start && i <= sw_check_end) {
791− regmap_read(pfuze_chip->regmap, desc->vsel_reg, &val);
791+ ret = regmap_read(pfuze_chip->regmap,
792+ desc->vsel_reg, &val);
793+ if (ret) {
794+ dev_err(&client->dev, "Fails to read from the register.\n");
795+ return ret;
796+ }
797+
792798 if (val & sw_hi) {
793799 if (pfuze_chip->chip_id == PFUZE3000 ||
794800 pfuze_chip->chip_id == PFUZE3001) {
drivers/regulator/qcom-rpmh-regulator.c+2−2
@@ -735,8 +735,8 @@ static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { · 734 unmodified lines
735735 static const struct rpmh_vreg_hw_data pmic5_bob = {
736736 .regulator_type = VRM,
737737 .ops = &rpmh_regulator_vrm_bypass_ops,
738− .voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 135, 32000),
739− .n_voltages = 136,
738+ .voltage_range = REGULATOR_LINEAR_RANGE(3000000, 0, 31, 32000),
739+ .n_voltages = 32,
740740 .pmic_mode_map = pmic_mode_map_pmic5_bob,
741741 .of_map_mode = rpmh_regulator_pmic4_bob_of_map_mode,
742742 };
drivers/regulator/ti-abb-regulator.c+8−18
@@ -173,19 +173,14 @@ static int ti_abb_wait_txdone(struct device *dev, struct ti_abb *abb) · 172 unmodified lines
173173 while (timeout++ <= abb->settling_time) {
174174 status = ti_abb_check_txdone(abb);
175175 if (status)
176− break;
176+ return 0;
177177
178178 udelay(1);
179179 }
180180
181− if (timeout > abb->settling_time) {
182− dev_warn_ratelimited(dev,
183− "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
184− __func__, timeout, readl(abb->int_base));
185− return -ETIMEDOUT;
186− }
187−
188− return 0;
181+ dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
182+ __func__, timeout, readl(abb->int_base));
183+ return -ETIMEDOUT;
189184 }
190185
191186 /**
@@ -205,19 +200,14 @@ static int ti_abb_clear_all_txdone(struct device *dev, const struct ti_abb *abb) · 13 unmodified lines
205200
206201 status = ti_abb_check_txdone(abb);
207202 if (!status)
208− break;
203+ return 0;
209204
210205 udelay(1);
211206 }
212207
213− if (timeout > abb->settling_time) {
214− dev_warn_ratelimited(dev,
215− "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
216− __func__, timeout, readl(abb->int_base));
217− return -ETIMEDOUT;
218− }
219−
220− return 0;
208+ dev_warn_ratelimited(dev, "%s:TRANXDONE timeout(%duS) int=0x%08x\n",
209+ __func__, timeout, readl(abb->int_base));
210+ return -ETIMEDOUT;
221211 }
222212
223213 /**
drivers/s390/crypto/zcrypt_api.c+1−2
@@ -522,8 +522,7 @@ static int zcrypt_release(struct inode *inode, struct file *filp) · 521 unmodified lines
522522 if (filp->f_inode->i_cdev == &zcrypt_cdev) {
523523 struct zcdn_device *zcdndev;
524524
525− if (mutex_lock_interruptible(&ap_perms_mutex))
526− return -ERESTARTSYS;
525+ mutex_lock(&ap_perms_mutex);
527526 zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev);
528527 mutex_unlock(&ap_perms_mutex);
529528 if (zcdndev) {
drivers/s390/net/qeth_l2_main.c+15−8
@@ -2021,10 +2021,10 @@ static bool qeth_l2_vnicc_recover_char(struct qeth_card *card, u32 vnicc, · 2020 unmodified lines
20212021 static void qeth_l2_vnicc_init(struct qeth_card *card)
20222022 {
20232023 u32 *timeout = &card->options.vnicc.learning_timeout;
2024+ bool enable, error = false;
20242025 unsigned int chars_len, i;
20252026 unsigned long chars_tmp;
20262027 u32 sup_cmds, vnicc;
2027− bool enable, error;
20282028
20292029 QETH_CARD_TEXT(card, 2, "vniccini");
20302030 /* reset rx_bcast */
@@ -2045,17 +2045,24 @@ static void qeth_l2_vnicc_init(struct qeth_card *card) · 14 unmodified lines
20452045 chars_len = sizeof(card->options.vnicc.sup_chars) * BITS_PER_BYTE;
20462046 for_each_set_bit(i, &chars_tmp, chars_len) {
20472047 vnicc = BIT(i);
2048− qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds);
2049− if (!(sup_cmds & IPA_VNICC_SET_TIMEOUT) ||
2050− !(sup_cmds & IPA_VNICC_GET_TIMEOUT))
2048+ if (qeth_l2_vnicc_query_cmds(card, vnicc, &sup_cmds)) {
2049+ sup_cmds = 0;
2050+ error = true;
2051+ }
2052+ if ((sup_cmds & IPA_VNICC_SET_TIMEOUT) &&
2053+ (sup_cmds & IPA_VNICC_GET_TIMEOUT))
2054+ card->options.vnicc.getset_timeout_sup |= vnicc;
2055+ else
20512056 card->options.vnicc.getset_timeout_sup &= ~vnicc;
2052− if (!(sup_cmds & IPA_VNICC_ENABLE) ||
2053− !(sup_cmds & IPA_VNICC_DISABLE))
2057+ if ((sup_cmds & IPA_VNICC_ENABLE) &&
2058+ (sup_cmds & IPA_VNICC_DISABLE))
2059+ card->options.vnicc.set_char_sup |= vnicc;
2060+ else
20542061 card->options.vnicc.set_char_sup &= ~vnicc;
20552062 }
20562063 /* enforce assumed default values and recover settings, if changed */
2057− error = qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING,
2058− timeout);
2064+ error |= qeth_l2_vnicc_recover_timeout(card, QETH_VNICC_LEARNING,
2065+ timeout);
20592066 chars_tmp = card->options.vnicc.wanted_chars ^ QETH_VNICC_DEFAULT;
20602067 chars_tmp |= QETH_VNICC_BRIDGE_INVISIBLE;
20612068 chars_len = sizeof(card->options.vnicc.wanted_chars) * BITS_PER_BYTE;
drivers/s390/scsi/zfcp_fsf.c+13−3
@@ -27,6 +27,11 @@ · 26 unmodified lines
2727
2828 struct kmem_cache *zfcp_fsf_qtcb_cache;
2929
30+static bool ber_stop = true;
31+module_param(ber_stop, bool, 0600);
32+MODULE_PARM_DESC(ber_stop,
33+ "Shuts down FCP devices for FCP channels that report a bit-error count in excess of its threshold (default on)");
34+
3035 static void zfcp_fsf_request_timeout_handler(struct timer_list *t)
3136 {
3237 struct zfcp_fsf_req *fsf_req = from_timer(fsf_req, t, timer);
@@ -236,10 +241,15 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) · 203 unmodified lines
236241 case FSF_STATUS_READ_SENSE_DATA_AVAIL:
237242 break;
238243 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
239− dev_warn(&adapter->ccw_device->dev,
240− "The error threshold for checksum statistics "
241− "has been exceeded\n");
242244 zfcp_dbf_hba_bit_err("fssrh_3", req);
245+ if (ber_stop) {
246+ dev_warn(&adapter->ccw_device->dev,
247+ "All paths over this FCP device are disused because of excessive bit errors\n");
248+ zfcp_erp_adapter_shutdown(adapter, 0, "fssrh_b");
249+ } else {
250+ dev_warn(&adapter->ccw_device->dev,
251+ "The error threshold for checksum statistics has been exceeded\n");
252+ }
243253 break;
244254 case FSF_STATUS_READ_LINK_DOWN:
245255 zfcp_fsf_status_read_link_down(req);
drivers/scsi/Kconfig+1−1
@@ -898,7 +898,7 @@ config SCSI_SNI_53C710 · 897 unmodified lines
898898
899899 config 53C700_LE_ON_BE
900900 bool
901− depends on SCSI_LASI700
901+ depends on SCSI_LASI700 || SCSI_SNI_53C710
902902 default y
903903
904904 config SCSI_STEX
drivers/scsi/ch.c+0−1
@@ -579,7 +579,6 @@ ch_release(struct inode *inode, struct file *file) · 578 unmodified lines
579579 scsi_changer *ch = file->private_data;
580580
581581 scsi_device_put(ch->device);
582− ch->device = NULL;
583582 file->private_data = NULL;
584583 kref_put(&ch->ref, ch_destroy);
585584 return 0;
drivers/scsi/device_handler/scsi_dh_alua.c+16−5
@@ -512,6 +512,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 511 unmodified lines
512512 unsigned int tpg_desc_tbl_off;
513513 unsigned char orig_transition_tmo;
514514 unsigned long flags;
515+ bool transitioning_sense = false;
515516
516517 if (!pg->expiry) {
517518 unsigned long transition_tmo = ALUA_FAILOVER_TIMEOUT * HZ;
@@ -572,13 +573,19 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 54 unmodified lines
572573 goto retry;
573574 }
574575 /*
575− * Retry on ALUA state transition or if any
576− * UNIT ATTENTION occurred.
576+ * If the array returns with 'ALUA state transition'
577+ * sense code here it cannot return RTPG data during
578+ * transition. So set the state to 'transitioning' directly.
577579 */
578580 if (sense_hdr.sense_key == NOT_READY &&
579− sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
580− err = SCSI_DH_RETRY;
581− else if (sense_hdr.sense_key == UNIT_ATTENTION)
581+ sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a) {
582+ transitioning_sense = true;
583+ goto skip_rtpg;
584+ }
585+ /*
586+ * Retry on any other UNIT ATTENTION occurred.
587+ */
588+ if (sense_hdr.sense_key == UNIT_ATTENTION)
582589 err = SCSI_DH_RETRY;
583590 if (err == SCSI_DH_RETRY &&
584591 pg->expiry != 0 && time_before(jiffies, pg->expiry)) {
@@ -666,7 +673,11 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) · 81 unmodified lines
666673 off = 8 + (desc[7] * 4);
667674 }
668675
676+ skip_rtpg:
669677 spin_lock_irqsave(&pg->lock, flags);
678+ if (transitioning_sense)
679+ pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
680+
670681 sdev_printk(KERN_INFO, sdev,
671682 "%s: port group %02x state %c %s supports %c%c%c%c%c%c%c\n",
672683 ALUA_DH_NAME, pg->group_id, print_alua_state(pg->state),
drivers/scsi/hpsa.c+4−0
@@ -5477,6 +5477,8 @@ static int hpsa_ciss_submit(struct ctlr_info *h, · 5476 unmodified lines
54775477 return SCSI_MLQUEUE_HOST_BUSY;
54785478 }
54795479
5480+ c->device = dev;
5481+
54805482 enqueue_cmd_and_start_io(h, c);
54815483 /* the cmd'll come back via intr handler in complete_scsi_command() */
54825484 return 0;
@@ -5548,6 +5550,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h, · 65 unmodified lines
55485550 hpsa_cmd_init(h, c->cmdindex, c);
55495551 c->cmd_type = CMD_SCSI;
55505552 c->scsi_cmd = cmd;
5553+ c->device = dev;
55515554 rc = hpsa_scsi_ioaccel_raid_map(h, c);
55525555 if (rc < 0) /* scsi_dma_map failed. */
55535556 rc = SCSI_MLQUEUE_HOST_BUSY;
@@ -5555,6 +5558,7 @@ static int hpsa_ioaccel_submit(struct ctlr_info *h, · 1 unmodified line
55555558 hpsa_cmd_init(h, c->cmdindex, c);
55565559 c->cmd_type = CMD_SCSI;
55575560 c->scsi_cmd = cmd;
5561+ c->device = dev;
55585562 rc = hpsa_scsi_ioaccel_direct_map(h, c);
55595563 if (rc < 0) /* scsi_dma_map failed. */
55605564 rc = SCSI_MLQUEUE_HOST_BUSY;
drivers/scsi/lpfc/lpfc_init.c+0−2
@@ -9055,7 +9055,6 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) · 9054 unmodified lines
90559055 }
90569056 }
90579057
9058−#if defined(BUILD_NVME)
90599058 /* Clear NVME stats */
90609059 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) {
90619060 for (idx = 0; idx < phba->cfg_hdw_queue; idx++) {
@@ -9063,7 +9062,6 @@ lpfc_sli4_queue_create(struct lpfc_hba *phba) · 1 unmodified line
90639062 sizeof(phba->sli4_hba.hdwq[idx].nvme_cstat));
90649063 }
90659064 }
9066−#endif
90679065
90689066 /* Clear SCSI stats */
90699067 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP) {
drivers/scsi/lpfc/lpfc_scsi.c+0−2
@@ -528,7 +528,6 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, · 527 unmodified lines
528528 list_del_init(&psb->list);
529529 psb->exch_busy = 0;
530530 psb->status = IOSTAT_SUCCESS;
531−#ifdef BUILD_NVME
532531 if (psb->cur_iocbq.iocb_flag == LPFC_IO_NVME) {
533532 qp->abts_nvme_io_bufs--;
534533 spin_unlock(&qp->abts_io_buf_list_lock);
@@ -536,7 +535,6 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, · 1 unmodified line
536535 lpfc_sli4_nvme_xri_aborted(phba, axri, psb);
537536 return;
538537 }
539−#endif
540538 qp->abts_scsi_io_bufs--;
541539 spin_unlock(&qp->abts_io_buf_list_lock);
542540
drivers/scsi/qla2xxx/qla_isr.c+0−2
@@ -2837,8 +2837,6 @@ qla2x00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt) · 2836 unmodified lines
28372837 if (sense_len == 0) {
28382838 rsp->status_srb = NULL;
28392839 sp->done(sp, cp->result);
2840− } else {
2841− WARN_ON_ONCE(true);
28422840 }
28432841 }
28442842
drivers/scsi/qla2xxx/qla_os.c+4−0
@@ -3224,6 +3224,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) · 3223 unmodified lines
32243224 req->req_q_in, req->req_q_out, rsp->rsp_q_in, rsp->rsp_q_out);
32253225
32263226 ha->wq = alloc_workqueue("qla2xxx_wq", 0, 0);
3227+ if (unlikely(!ha->wq)) {
3228+ ret = -ENOMEM;
3229+ goto probe_failed;
3230+ }
32273231
32283232 if (ha->isp_ops->initialize_adapter(base_vha)) {
32293233 ql_log(ql_log_fatal, base_vha, 0x00d6,
drivers/scsi/scsi_error.c+3−0
@@ -967,6 +967,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, · 966 unmodified lines
967967 ses->data_direction = scmd->sc_data_direction;
968968 ses->sdb = scmd->sdb;
969969 ses->result = scmd->result;
970+ ses->resid_len = scmd->req.resid_len;
970971 ses->underflow = scmd->underflow;
971972 ses->prot_op = scmd->prot_op;
972973 ses->eh_eflags = scmd->eh_eflags;
@@ -977,6 +978,7 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, · 4 unmodified lines
977978 memset(scmd->cmnd, 0, BLK_MAX_CDB);
978979 memset(&scmd->sdb, 0, sizeof(scmd->sdb));
979980 scmd->result = 0;
981+ scmd->req.resid_len = 0;
980982
981983 if (sense_bytes) {
982984 scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE,
@@ -1029,6 +1031,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) · 46 unmodified lines
10291031 scmd->sc_data_direction = ses->data_direction;
10301032 scmd->sdb = ses->sdb;
10311033 scmd->result = ses->result;
1034+ scmd->req.resid_len = ses->resid_len;
10321035 scmd->underflow = ses->underflow;
10331036 scmd->prot_op = ses->prot_op;
10341037 scmd->eh_eflags = ses->eh_eflags;
drivers/scsi/scsi_lib.c+3−1
@@ -1834,6 +1834,7 @@ static const struct blk_mq_ops scsi_mq_ops_no_commit = { · 1833 unmodified lines
18341834 .init_request = scsi_mq_init_request,
18351835 .exit_request = scsi_mq_exit_request,
18361836 .initialize_rq_fn = scsi_initialize_rq,
1837+ .cleanup_rq = scsi_cleanup_rq,
18371838 .busy = scsi_mq_lld_busy,
18381839 .map_queues = scsi_map_queues,
18391840 };
@@ -1921,7 +1922,8 @@ struct scsi_device *scsi_device_from_queue(struct request_queue *q) · 81 unmodified lines
19211922 {
19221923 struct scsi_device *sdev = NULL;
19231924
1924− if (q->mq_ops == &scsi_mq_ops)
1925+ if (q->mq_ops == &scsi_mq_ops_no_commit ||
1926+ q->mq_ops == &scsi_mq_ops)
19251927 sdev = q->queuedata;
19261928 if (!sdev || !get_device(&sdev->sdev_gendev))
19271929 sdev = NULL;
drivers/scsi/scsi_sysfs.c+10−1
@@ -730,6 +730,14 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr, · 729 unmodified lines
730730 const char *buf, size_t count)
731731 {
732732 struct kernfs_node *kn;
733+ struct scsi_device *sdev = to_scsi_device(dev);
734+
735+ /*
736+ * We need to try to get module, avoiding the module been removed
737+ * during delete.
738+ */
739+ if (scsi_device_get(sdev))
740+ return -ENODEV;
733741
734742 kn = sysfs_break_active_protection(&dev->kobj, &attr->attr);
735743 WARN_ON_ONCE(!kn);
@@ -744,9 +752,10 @@ sdev_store_delete(struct device *dev, struct device_attribute *attr, · 8 unmodified lines
744752 * state into SDEV_DEL.
745753 */
746754 device_remove_file(dev, attr);
747− scsi_remove_device(to_scsi_device(dev));
755+ scsi_remove_device(sdev);
748756 if (kn)
749757 sysfs_unbreak_active_protection(kn);
758+ scsi_device_put(sdev);
750759 return count;
751760 };
752761 static DEVICE_ATTR(delete, S_IWUSR, NULL, sdev_store_delete);
drivers/scsi/sd.c+2−1
@@ -1654,7 +1654,8 @@ static int sd_sync_cache(struct scsi_disk *sdkp, struct scsi_sense_hdr *sshdr) · 1653 unmodified lines
16541654 /* we need to evaluate the error return */
16551655 if (scsi_sense_valid(sshdr) &&
16561656 (sshdr->asc == 0x3a || /* medium not present */
1657− sshdr->asc == 0x20)) /* invalid command */
1657+ sshdr->asc == 0x20 || /* invalid command */
1658+ (sshdr->asc == 0x74 && sshdr->ascq == 0x71))) /* drive is password locked */
16581659 /* this is no error here */
16591660 return 0;
16601661
drivers/scsi/sni_53c710.c+1−3
@@ -66,10 +66,8 @@ static int snirm710_probe(struct platform_device *dev) · 65 unmodified lines
6666
6767 base = res->start;
6868 hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
69− if (!hostdata) {
70− dev_printk(KERN_ERR, dev, "Failed to allocate host data\n");
69+ if (!hostdata)
7170 return -ENOMEM;
72− }
7371
7472 hostdata->dev = &dev->dev;
7573 dma_set_mask(&dev->dev, DMA_BIT_MASK(32));
drivers/soc/imx/soc-imx-scu.c+1−1
@@ -46,7 +46,7 @@ static ssize_t soc_uid_show(struct device *dev, · 45 unmodified lines
4646 hdr->func = IMX_SC_MISC_FUNC_UNIQUE_ID;
4747 hdr->size = 1;
4848
49− ret = imx_scu_call_rpc(soc_ipc_handle, &msg, false);
49+ ret = imx_scu_call_rpc(soc_ipc_handle, &msg, true);
5050 if (ret) {
5151 pr_err("%s: get soc uid failed, ret %d\n", __func__, ret);
5252 return ret;
drivers/staging/wlan-ng/cfg80211.c+2−4
@@ -469,10 +469,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev, · 468 unmodified lines
469469 /* Set the encryption - we only support wep */
470470 if (is_wep) {
471471 if (sme->key) {
472− if (sme->key_idx >= NUM_WEPKEYS) {
473− err = -EINVAL;
474− goto exit;
475− }
472+ if (sme->key_idx >= NUM_WEPKEYS)
473+ return -EINVAL;
476474
477475 result = prism2_domibset_uint32(wlandev,
478476 DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
drivers/target/target_core_device.c+0−21
@@ -1074,27 +1074,6 @@ passthrough_parse_cdb(struct se_cmd *cmd, · 1073 unmodified lines
10741074 struct se_device *dev = cmd->se_dev;
10751075 unsigned int size;
10761076
1077− /*
1078− * Clear a lun set in the cdb if the initiator talking to use spoke
1079− * and old standards version, as we can't assume the underlying device
1080− * won't choke up on it.
1081− */
1082− switch (cdb[0]) {
1083− case READ_10: /* SBC - RDProtect */
1084− case READ_12: /* SBC - RDProtect */
1085− case READ_16: /* SBC - RDProtect */
1086− case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */
1087− case VERIFY: /* SBC - VRProtect */
1088− case VERIFY_16: /* SBC - VRProtect */
1089− case WRITE_VERIFY: /* SBC - VRProtect */
1090− case WRITE_VERIFY_12: /* SBC - VRProtect */
1091− case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */
1092− break;
1093− default:
1094− cdb[1] &= 0x1f; /* clear logical unit number */
1095− break;
1096− }
1097−
10981077 /*
10991078 * For REPORT LUNS we always need to emulate the response, for everything
11001079 * else, pass it up.
drivers/thermal/cpu_cooling.c+7−7
@@ -88,7 +88,7 @@ struct cpufreq_cooling_device { · 87 unmodified lines
8888 struct cpufreq_policy *policy;
8989 struct list_head node;
9090 struct time_in_idle *idle_time;
91− struct dev_pm_qos_request qos_req;
91+ struct freq_qos_request qos_req;
9292 };
9393
9494 static DEFINE_IDA(cpufreq_ida);
@@ -331,7 +331,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev, · 236 unmodified lines
331331
332332 cpufreq_cdev->cpufreq_state = state;
333333
334− return dev_pm_qos_update_request(&cpufreq_cdev->qos_req,
334+ return freq_qos_update_request(&cpufreq_cdev->qos_req,
335335 cpufreq_cdev->freq_table[state].frequency);
336336 }
337337
@@ -615,9 +615,9 @@ __cpufreq_cooling_register(struct device_node *np, · 277 unmodified lines
615615 cooling_ops = &cpufreq_cooling_ops;
616616 }
617617
618− ret = dev_pm_qos_add_request(dev, &cpufreq_cdev->qos_req,
619− DEV_PM_QOS_MAX_FREQUENCY,
620− cpufreq_cdev->freq_table[0].frequency);
618+ ret = freq_qos_add_request(&policy->constraints,
619+ &cpufreq_cdev->qos_req, FREQ_QOS_MAX,
620+ cpufreq_cdev->freq_table[0].frequency);
621621 if (ret < 0) {
622622 pr_err("%s: Failed to add freq constraint (%d)\n", __func__,
623623 ret);
@@ -637,7 +637,7 @@ __cpufreq_cooling_register(struct device_node *np, · 13 unmodified lines
637637 return cdev;
638638
639639 remove_qos_req:
640− dev_pm_qos_remove_request(&cpufreq_cdev->qos_req);
640+ freq_qos_remove_request(&cpufreq_cdev->qos_req);
641641 remove_ida:
642642 ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id);
643643 free_table:
@@ -736,7 +736,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) · 92 unmodified lines
736736 mutex_unlock(&cooling_list_lock);
737737
738738 thermal_cooling_device_unregister(cdev);
739− dev_pm_qos_remove_request(&cpufreq_cdev->qos_req);
739+ freq_qos_remove_request(&cpufreq_cdev->qos_req);
740740 ida_simple_remove(&cpufreq_ida, cpufreq_cdev->id);
741741 kfree(cpufreq_cdev->idle_time);
742742 kfree(cpufreq_cdev->freq_table);
drivers/tty/serial/8250/8250_men_mcb.c+4−4
@@ -72,8 +72,8 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, · 71 unmodified lines
7272 {
7373 struct serial_8250_men_mcb_data *data;
7474 struct resource *mem;
75− unsigned int num_ports;
76− unsigned int i;
75+ int num_ports;
76+ int i;
7777 void __iomem *membase;
7878
7979 mem = mcb_get_resource(mdev, IORESOURCE_MEM);
@@ -88,7 +88,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, · 8 unmodified lines
8888 dev_dbg(&mdev->dev, "found a 16z%03u with %u ports\n",
8989 mdev->id, num_ports);
9090
91− if (num_ports == 0 || num_ports > 4) {
91+ if (num_ports <= 0 || num_ports > 4) {
9292 dev_err(&mdev->dev, "unexpected number of ports: %u\n",
9393 num_ports);
9494 return -ENODEV;
@@ -133,7 +133,7 @@ static int serial_8250_men_mcb_probe(struct mcb_device *mdev, · 38 unmodified lines
133133
134134 static void serial_8250_men_mcb_remove(struct mcb_device *mdev)
135135 {
136− unsigned int num_ports, i;
136+ int num_ports, i;
137137 struct serial_8250_men_mcb_data *data = mcb_get_drvdata(mdev);
138138
139139 if (!data)
drivers/usb/cdns3/core.c+3−1
@@ -166,7 +166,6 @@ static int cdns3_core_init_role(struct cdns3 *cdns) · 165 unmodified lines
166166 goto err;
167167
168168 switch (cdns->dr_mode) {
169− case USB_DR_MODE_UNKNOWN:
170169 case USB_DR_MODE_OTG:
171170 ret = cdns3_hw_role_switch(cdns);
172171 if (ret)
@@ -182,6 +181,9 @@ static int cdns3_core_init_role(struct cdns3 *cdns) · 9 unmodified lines
182181 if (ret)
183182 goto err;
184183 break;
184+ default:
185+ ret = -EINVAL;
186+ goto err;
185187 }
186188
187189 return ret;
drivers/usb/cdns3/gadget.c+20−15
@@ -1145,6 +1145,14 @@ static void cdns3_transfer_completed(struct cdns3_device *priv_dev, · 1144 unmodified lines
11451145 request = cdns3_next_request(&priv_ep->pending_req_list);
11461146 priv_req = to_cdns3_request(request);
11471147
1148+ trb = priv_ep->trb_pool + priv_ep->dequeue;
1149+
1150+ /* Request was dequeued and TRB was changed to TRB_LINK. */
1151+ if (TRB_FIELD_TO_TYPE(trb->control) == TRB_LINK) {
1152+ trace_cdns3_complete_trb(priv_ep, trb);
1153+ cdns3_move_deq_to_next_trb(priv_req);
1154+ }
1155+
11481156 /* Re-select endpoint. It could be changed by other CPU during
11491157 * handling usb_gadget_giveback_request.
11501158 */
@@ -2067,6 +2075,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, · 916 unmodified lines
20672075 struct usb_request *req, *req_temp;
20682076 struct cdns3_request *priv_req;
20692077 struct cdns3_trb *link_trb;
2078+ u8 req_on_hw_ring = 0;
20702079 unsigned long flags;
20712080 int ret = 0;
20722081
@@ -2083,8 +2092,10 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, · 10 unmodified lines
20832092
20842093 list_for_each_entry_safe(req, req_temp, &priv_ep->pending_req_list,
20852094 list) {
2086− if (request == req)
2095+ if (request == req) {
2096+ req_on_hw_ring = 1;
20872097 goto found;
2098+ }
20882099 }
20892100
20902101 list_for_each_entry_safe(req, req_temp, &priv_ep->deferred_req_list,
@@ -2096,27 +2107,21 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, · 5 unmodified lines
20962107 goto not_found;
20972108
20982109 found:
2099−
2100− if (priv_ep->wa1_trb == priv_req->trb)
2101− cdns3_wa1_restore_cycle_bit(priv_ep);
2102−
21032110 link_trb = priv_req->trb;
2104− cdns3_move_deq_to_next_trb(priv_req);
2105− cdns3_gadget_giveback(priv_ep, priv_req, -ECONNRESET);
2106−
2107− /* Update ring */
2108− request = cdns3_next_request(&priv_ep->deferred_req_list);
2109− if (request) {
2110− priv_req = to_cdns3_request(request);
21112111
2112+ /* Update ring only if removed request is on pending_req_list list */
2113+ if (req_on_hw_ring) {
21122114 link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma +
21132115 (priv_req->start_trb * TRB_SIZE));
21142116 link_trb->control = (link_trb->control & TRB_CYCLE) |
2115− TRB_TYPE(TRB_LINK) | TRB_CHAIN | TRB_TOGGLE;
2116− } else {
2117− priv_ep->flags |= EP_UPDATE_EP_TRBADDR;
2117+ TRB_TYPE(TRB_LINK) | TRB_CHAIN;
2118+
2119+ if (priv_ep->wa1_trb == priv_req->trb)
2120+ cdns3_wa1_restore_cycle_bit(priv_ep);
21182121 }
21192122
2123+ cdns3_gadget_giveback(priv_ep, priv_req, -ECONNRESET);
2124+
21202125 not_found:
21212126 spin_unlock_irqrestore(&priv_dev->lock, flags);
21222127 return ret;
drivers/usb/class/usblp.c+3−1
@@ -445,6 +445,7 @@ static void usblp_cleanup(struct usblp *usblp) · 444 unmodified lines
445445 kfree(usblp->readbuf);
446446 kfree(usblp->device_id_string);
447447 kfree(usblp->statusbuf);
448+ usb_put_intf(usblp->intf);
448449 kfree(usblp);
449450 }
450451
@@ -1113,7 +1114,7 @@ static int usblp_probe(struct usb_interface *intf, · 662 unmodified lines
11131114 init_waitqueue_head(&usblp->wwait);
11141115 init_usb_anchor(&usblp->urbs);
11151116 usblp->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
1116− usblp->intf = intf;
1117+ usblp->intf = usb_get_intf(intf);
11171118
11181119 /* Malloc device ID string buffer to the largest expected length,
11191120 * since we can re-query it on an ioctl and a dynamic string
@@ -1198,6 +1199,7 @@ abort: · 78 unmodified lines
11981199 kfree(usblp->readbuf);
11991200 kfree(usblp->statusbuf);
12001201 kfree(usblp->device_id_string);
1202+ usb_put_intf(usblp->intf);
12011203 kfree(usblp);
12021204 abort_ret:
12031205 return retval;
drivers/usb/gadget/udc/lpc32xx_udc.c+3−3
@@ -1177,11 +1177,11 @@ static void udc_pop_fifo(struct lpc32xx_udc *udc, u8 *data, u32 bytes) · 1176 unmodified lines
11771177 tmp = readl(USBD_RXDATA(udc->udp_baseaddr));
11781178
11791179 bl = bytes - n;
1180− if (bl > 3)
1181− bl = 3;
1180+ if (bl > 4)
1181+ bl = 4;
11821182
11831183 for (i = 0; i < bl; i++)
1184− data[n + i] = (u8) ((tmp >> (n * 8)) & 0xFF);
1184+ data[n + i] = (u8) ((tmp >> (i * 8)) & 0xFF);
11851185 }
11861186 break;
11871187
drivers/usb/misc/ldusb.c+12−11
@@ -380,10 +380,7 @@ static int ld_usb_release(struct inode *inode, struct file *file) · 379 unmodified lines
380380 goto exit;
381381 }
382382
383− if (mutex_lock_interruptible(&dev->mutex)) {
384− retval = -ERESTARTSYS;
385− goto exit;
386− }
383+ mutex_lock(&dev->mutex);
387384
388385 if (dev->open_count != 1) {
389386 retval = -ENODEV;
@@ -467,7 +464,7 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 77 unmodified lines
467464
468465 /* wait for data */
469466 spin_lock_irq(&dev->rbsl);
470− if (dev->ring_head == dev->ring_tail) {
467+ while (dev->ring_head == dev->ring_tail) {
471468 dev->interrupt_in_done = 0;
472469 spin_unlock_irq(&dev->rbsl);
473470 if (file->f_flags & O_NONBLOCK) {
@@ -477,12 +474,17 @@ static ssize_t ld_usb_read(struct file *file, char __user *buffer, size_t count, · 3 unmodified lines
477474 retval = wait_event_interruptible(dev->read_wait, dev->interrupt_in_done);
478475 if (retval < 0)
479476 goto unlock_exit;
480− } else {
481− spin_unlock_irq(&dev->rbsl);
477+
478+ spin_lock_irq(&dev->rbsl);
482479 }
480+ spin_unlock_irq(&dev->rbsl);
483481
484482 /* actual_buffer contains actual_length + interrupt_in_buffer */
485483 actual_buffer = (size_t *)(dev->ring_buffer + dev->ring_tail * (sizeof(size_t)+dev->interrupt_in_endpoint_size));
484+ if (*actual_buffer > dev->interrupt_in_endpoint_size) {
485+ retval = -EIO;
486+ goto unlock_exit;
487+ }
486488 bytes_to_read = min(count, *actual_buffer);
487489 if (bytes_to_read < *actual_buffer)
488490 dev_warn(&dev->intf->dev, "Read buffer overflow, %zd bytes dropped\n",
@@ -693,10 +695,9 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id * · 204 unmodified lines
693695 dev_warn(&intf->dev, "Interrupt out endpoint not found (using control endpoint instead)\n");
694696
695697 dev->interrupt_in_endpoint_size = usb_endpoint_maxp(dev->interrupt_in_endpoint);
696− dev->ring_buffer =
697− kmalloc_array(ring_buffer_size,
698− sizeof(size_t) + dev->interrupt_in_endpoint_size,
699− GFP_KERNEL);
698+ dev->ring_buffer = kcalloc(ring_buffer_size,
699+ sizeof(size_t) + dev->interrupt_in_endpoint_size,
700+ GFP_KERNEL);
700701 if (!dev->ring_buffer)
701702 goto error;
702703 dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL);
drivers/usb/misc/legousbtower.c+2−5
@@ -419,10 +419,7 @@ static int tower_release (struct inode *inode, struct file *file) · 418 unmodified lines
419419 goto exit;
420420 }
421421
422− if (mutex_lock_interruptible(&dev->lock)) {
423− retval = -ERESTARTSYS;
424− goto exit;
425− }
422+ mutex_lock(&dev->lock);
426423
427424 if (dev->open_count != 1) {
428425 dev_dbg(&dev->udev->dev, "%s: device not opened exactly once\n",
@@ -881,7 +878,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device · 452 unmodified lines
881878 get_version_reply,
882879 sizeof(*get_version_reply),
883880 1000);
884− if (result < sizeof(*get_version_reply)) {
881+ if (result != sizeof(*get_version_reply)) {
885882 if (result >= 0)
886883 result = -EIO;
887884 dev_err(idev, "get version request failed: %d\n", result);
drivers/usb/serial/ti_usb_3410_5052.c+4−8
@@ -776,7 +776,6 @@ static void ti_close(struct usb_serial_port *port) · 775 unmodified lines
776776 struct ti_port *tport;
777777 int port_number;
778778 int status;
779− int do_unlock;
780779 unsigned long flags;
781780
782781 tdev = usb_get_serial_data(port->serial);
@@ -800,16 +799,13 @@ static void ti_close(struct usb_serial_port *port) · 17 unmodified lines
800799 "%s - cannot send close port command, %d\n"
801800 , __func__, status);
802801
803− /* if mutex_lock is interrupted, continue anyway */
804− do_unlock = !mutex_lock_interruptible(&tdev->td_open_close_lock);
805− --tport->tp_tdev->td_open_port_count;
806− if (tport->tp_tdev->td_open_port_count <= 0) {
802+ mutex_lock(&tdev->td_open_close_lock);
803+ --tdev->td_open_port_count;
804+ if (tdev->td_open_port_count == 0) {
807805 /* last port is closed, shut down interrupt urb */
808806 usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
809− tport->tp_tdev->td_open_port_count = 0;
810807 }
811− if (do_unlock)
812− mutex_unlock(&tdev->td_open_close_lock);
808+ mutex_unlock(&tdev->td_open_close_lock);
813809 }
814810
815811
drivers/vfio/vfio_iommu_type1.c+1−1
@@ -1658,7 +1658,7 @@ static int vfio_iommu_type1_attach_group(void *iommu_data, · 1657 unmodified lines
16581658 struct bus_type *bus = NULL;
16591659 int ret;
16601660 bool resv_msi, msi_remap;
1661− phys_addr_t resv_msi_base;
1661+ phys_addr_t resv_msi_base = 0;
16621662 struct iommu_domain_geometry geo;
16631663 LIST_HEAD(iova_copy);
16641664 LIST_HEAD(group_resv_regions);
drivers/vhost/test.c+2−0
@@ -161,6 +161,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) · 160 unmodified lines
161161
162162 vhost_test_stop(n, &private);
163163 vhost_test_flush(n);
164+ vhost_dev_stop(&n->dev);
164165 vhost_dev_cleanup(&n->dev);
165166 /* We do an extra flush before freeing memory,
166167 * since jobs can re-queue themselves. */
@@ -237,6 +238,7 @@ static long vhost_test_reset_owner(struct vhost_test *n) · 70 unmodified lines
237238 }
238239 vhost_test_stop(n, &priv);
239240 vhost_test_flush(n);
241+ vhost_dev_stop(&n->dev);
240242 vhost_dev_reset_owner(&n->dev, umem);
241243 done:
242244 mutex_unlock(&n->dev.mutex);
drivers/xen/pvcalls-back.c+1−1
@@ -775,7 +775,7 @@ static int pvcalls_back_poll(struct xenbus_device *dev, · 774 unmodified lines
775775 mappass->reqcopy = *req;
776776 icsk = inet_csk(mappass->sock->sk);
777777 queue = &icsk->icsk_accept_queue;
778− data = queue->rskq_accept_head != NULL;
778+ data = READ_ONCE(queue->rskq_accept_head) != NULL;
779779 if (data) {
780780 mappass->reqcopy.cmd = 0;
781781 ret = 0;
fs/btrfs/block-group.c+1−0
@@ -1761,6 +1761,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) · 1760 unmodified lines
17611761 btrfs_err(info,
17621762 "bg %llu is a mixed block group but filesystem hasn't enabled mixed block groups",
17631763 cache->key.objectid);
1764+ btrfs_put_block_group(cache);
17641765 ret = -EINVAL;
17651766 goto error;
17661767 }
fs/btrfs/ctree.h+1−4
@@ -734,8 +734,6 @@ struct btrfs_fs_info { · 733 unmodified lines
734734 struct btrfs_workqueue *fixup_workers;
735735 struct btrfs_workqueue *delayed_workers;
736736
737− /* the extent workers do delayed refs on the extent allocation tree */
738− struct btrfs_workqueue *extent_workers;
739737 struct task_struct *transaction_kthread;
740738 struct task_struct *cleaner_kthread;
741739 u32 thread_pool_size;
@@ -2489,8 +2487,7 @@ int btrfs_subvolume_reserve_metadata(struct btrfs_root *root, · 1747 unmodified lines
24892487 int nitems, bool use_global_rsv);
24902488 void btrfs_subvolume_release_metadata(struct btrfs_fs_info *fs_info,
24912489 struct btrfs_block_rsv *rsv);
2492−void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes,
2493− bool qgroup_free);
2490+void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes);
24942491
24952492 int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes);
24962493 u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo);
fs/btrfs/delalloc-space.c+2−5
@@ -381,7 +381,6 @@ int btrfs_delalloc_reserve_metadata(struct btrfs_inode *inode, u64 num_bytes) · 380 unmodified lines
381381 out_qgroup:
382382 btrfs_qgroup_free_meta_prealloc(root, qgroup_reserve);
383383 out_fail:
384− btrfs_inode_rsv_release(inode, true);
385384 if (delalloc_lock)
386385 mutex_unlock(&inode->delalloc_mutex);
387386 return ret;
@@ -418,7 +417,6 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, · 30 unmodified lines
418417 * btrfs_delalloc_release_extents - release our outstanding_extents
419418 * @inode: the inode to balance the reservation for.
420419 * @num_bytes: the number of bytes we originally reserved with
421− * @qgroup_free: do we need to free qgroup meta reservation or convert them.
422420 *
423421 * When we reserve space we increase outstanding_extents for the extents we may
424422 * add. Once we've set the range as delalloc or created our ordered extents we
@@ -426,8 +424,7 @@ void btrfs_delalloc_release_metadata(struct btrfs_inode *inode, u64 num_bytes, · 1 unmodified line
426424 * temporarily tracked outstanding_extents. This _must_ be used in conjunction
427425 * with btrfs_delalloc_reserve_metadata.
428426 */
429−void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes,
430− bool qgroup_free)
427+void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes)
431428 {
432429 struct btrfs_fs_info *fs_info = inode->root->fs_info;
433430 unsigned num_extents;
@@ -441,7 +438,7 @@ void btrfs_delalloc_release_extents(struct btrfs_inode *inode, u64 num_bytes, · 7 unmodified lines
441438 if (btrfs_is_testing(fs_info))
442439 return;
443440
444− btrfs_inode_rsv_release(inode, qgroup_free);
441+ btrfs_inode_rsv_release(inode, true);
445442 }
446443
447444 /**
fs/btrfs/disk-io.c+0−6
@@ -2008,7 +2008,6 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) · 2007 unmodified lines
20082008 btrfs_destroy_workqueue(fs_info->readahead_workers);
20092009 btrfs_destroy_workqueue(fs_info->flush_workers);
20102010 btrfs_destroy_workqueue(fs_info->qgroup_rescan_workers);
2011− btrfs_destroy_workqueue(fs_info->extent_workers);
20122011 /*
20132012 * Now that all other work queues are destroyed, we can safely destroy
20142013 * the queues used for metadata I/O, since tasks from those other work
@@ -2214,10 +2213,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info, · 199 unmodified lines
22142213 max_active, 2);
22152214 fs_info->qgroup_rescan_workers =
22162215 btrfs_alloc_workqueue(fs_info, "qgroup-rescan", flags, 1, 0);
2217− fs_info->extent_workers =
2218− btrfs_alloc_workqueue(fs_info, "extent-refs", flags,
2219− min_t(u64, fs_devices->num_devices,
2220− max_active), 8);
22212216
22222217 if (!(fs_info->workers && fs_info->delalloc_workers &&
22232218 fs_info->submit_workers && fs_info->flush_workers &&
@@ -2228,7 +2223,6 @@ static int btrfs_init_workqueues(struct btrfs_fs_info *fs_info, · 4 unmodified lines
22282223 fs_info->endio_freespace_worker && fs_info->rmw_workers &&
22292224 fs_info->caching_workers && fs_info->readahead_workers &&
22302225 fs_info->fixup_workers && fs_info->delayed_workers &&
2231− fs_info->extent_workers &&
22322226 fs_info->qgroup_rescan_workers)) {
22332227 return -ENOMEM;
22342228 }
fs/btrfs/file.c+20−23
@@ -1692,7 +1692,7 @@ again: · 1691 unmodified lines
16921692 force_page_uptodate);
16931693 if (ret) {
16941694 btrfs_delalloc_release_extents(BTRFS_I(inode),
1695− reserve_bytes, true);
1695+ reserve_bytes);
16961696 break;
16971697 }
16981698
@@ -1704,7 +1704,7 @@ again: · 5 unmodified lines
17041704 if (extents_locked == -EAGAIN)
17051705 goto again;
17061706 btrfs_delalloc_release_extents(BTRFS_I(inode),
1707− reserve_bytes, true);
1707+ reserve_bytes);
17081708 ret = extents_locked;
17091709 break;
17101710 }
@@ -1772,8 +1772,7 @@ again: · 61 unmodified lines
17721772 else
17731773 free_extent_state(cached_state);
17741774
1775− btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes,
1776− true);
1775+ btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes);
17771776 if (ret) {
17781777 btrfs_drop_pages(pages, num_pages);
17791778 break;
@@ -2068,25 +2067,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 288 unmodified lines
20682067 struct btrfs_trans_handle *trans;
20692068 struct btrfs_log_ctx ctx;
20702069 int ret = 0, err;
2071− u64 len;
20722070
2073− /*
2074− * If the inode needs a full sync, make sure we use a full range to
2075− * avoid log tree corruption, due to hole detection racing with ordered
2076− * extent completion for adjacent ranges, and assertion failures during
2077− * hole detection.
2078− */
2079− if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
2080− &BTRFS_I(inode)->runtime_flags)) {
2081− start = 0;
2082− end = LLONG_MAX;
2083− }
2084−
2085− /*
2086− * The range length can be represented by u64, we have to do the typecasts
2087− * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync()
2088− */
2089− len = (u64)end - (u64)start + 1;
20902071 trace_btrfs_sync_file(file, datasync);
20912072
20922073 btrfs_init_log_ctx(&ctx, inode);
@@ -2112,6 +2093,19 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 19 unmodified lines
21122093
21132094 atomic_inc(&root->log_batch);
21142095
2096+ /*
2097+ * If the inode needs a full sync, make sure we use a full range to
2098+ * avoid log tree corruption, due to hole detection racing with ordered
2099+ * extent completion for adjacent ranges, and assertion failures during
2100+ * hole detection. Do this while holding the inode lock, to avoid races
2101+ * with other tasks.
2102+ */
2103+ if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
2104+ &BTRFS_I(inode)->runtime_flags)) {
2105+ start = 0;
2106+ end = LLONG_MAX;
2107+ }
2108+
21152109 /*
21162110 * Before we acquired the inode's lock, someone may have dirtied more
21172111 * pages in the target range. We need to make sure that writeback for
@@ -2139,8 +2133,11 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 21 unmodified lines
21392133 /*
21402134 * We have to do this here to avoid the priority inversion of waiting on
21412135 * IO of a lower priority task while holding a transaction open.
2136+ *
2137+ * Also, the range length can be represented by u64, we have to do the
2138+ * typecasts to avoid signed overflow if it's [0, LLONG_MAX].
21422139 */
2143− ret = btrfs_wait_ordered_range(inode, start, len);
2140+ ret = btrfs_wait_ordered_range(inode, start, (u64)end - (u64)start + 1);
21442141 if (ret) {
21452142 up_write(&BTRFS_I(inode)->dio_sem);
21462143 inode_unlock(inode);
fs/btrfs/inode-map.c+2−2
@@ -501,13 +501,13 @@ again: · 500 unmodified lines
501501 ret = btrfs_prealloc_file_range_trans(inode, trans, 0, 0, prealloc,
502502 prealloc, prealloc, &alloc_hint);
503503 if (ret) {
504− btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc, true);
504+ btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc);
505505 btrfs_delalloc_release_metadata(BTRFS_I(inode), prealloc, true);
506506 goto out_put;
507507 }
508508
509509 ret = btrfs_write_out_ino_cache(root, trans, path, inode);
510− btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc, false);
510+ btrfs_delalloc_release_extents(BTRFS_I(inode), prealloc);
511511 out_put:
512512 iput(inode);
513513 out_release:
fs/btrfs/inode.c+6−6
@@ -2206,7 +2206,7 @@ again: · 2205 unmodified lines
22062206
22072207 ClearPageChecked(page);
22082208 set_page_dirty(page);
2209− btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, false);
2209+ btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
22102210 out:
22112211 unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end,
22122212 &cached_state);
@@ -4951,7 +4951,7 @@ again: · 2738 unmodified lines
49514951 if (!page) {
49524952 btrfs_delalloc_release_space(inode, data_reserved,
49534953 block_start, blocksize, true);
4954− btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize, true);
4954+ btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize);
49554955 ret = -ENOMEM;
49564956 goto out;
49574957 }
@@ -5018,7 +5018,7 @@ out_unlock: · 60 unmodified lines
50185018 if (ret)
50195019 btrfs_delalloc_release_space(inode, data_reserved, block_start,
50205020 blocksize, true);
5021− btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize, (ret != 0));
5021+ btrfs_delalloc_release_extents(BTRFS_I(inode), blocksize);
50225022 unlock_page(page);
50235023 put_page(page);
50245024 out:
@@ -8709,7 +8709,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · 3684 unmodified lines
87098709 } else if (ret >= 0 && (size_t)ret < count)
87108710 btrfs_delalloc_release_space(inode, data_reserved,
87118711 offset, count - (size_t)ret, true);
8712− btrfs_delalloc_release_extents(BTRFS_I(inode), count, false);
8712+ btrfs_delalloc_release_extents(BTRFS_I(inode), count);
87138713 }
87148714 out:
87158715 if (wakeup)
@@ -9059,7 +9059,7 @@ again: · 343 unmodified lines
90599059 unlock_extent_cached(io_tree, page_start, page_end, &cached_state);
90609060
90619061 if (!ret2) {
9062− btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, true);
9062+ btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
90639063 sb_end_pagefault(inode->i_sb);
90649064 extent_changeset_free(data_reserved);
90659065 return VM_FAULT_LOCKED;
@@ -9068,7 +9068,7 @@ again: · 2 unmodified lines
90689068 out_unlock:
90699069 unlock_page(page);
90709070 out:
9071− btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE, (ret != 0));
9071+ btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
90729072 btrfs_delalloc_release_space(inode, data_reserved, page_start,
90739073 reserved_space, (ret != 0));
90749074 out_noreserve:
fs/btrfs/ioctl.c+2−4
@@ -1360,8 +1360,7 @@ again: · 1359 unmodified lines
13601360 unlock_page(pages[i]);
13611361 put_page(pages[i]);
13621362 }
1363− btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT,
1364− false);
1363+ btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT);
13651364 extent_changeset_free(data_reserved);
13661365 return i_done;
13671366 out:
@@ -1372,8 +1371,7 @@ out: · 4 unmodified lines
13721371 btrfs_delalloc_release_space(inode, data_reserved,
13731372 start_index << PAGE_SHIFT,
13741373 page_cnt << PAGE_SHIFT, true);
1375− btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT,
1376− true);
1374+ btrfs_delalloc_release_extents(BTRFS_I(inode), page_cnt << PAGE_SHIFT);
13771375 extent_changeset_free(data_reserved);
13781376 return ret;
13791377
fs/btrfs/qgroup.c+2−2
@@ -3629,7 +3629,7 @@ int __btrfs_qgroup_reserve_meta(struct btrfs_root *root, int num_bytes, · 3628 unmodified lines
36293629 return 0;
36303630
36313631 BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
3632− trace_qgroup_meta_reserve(root, type, (s64)num_bytes);
3632+ trace_qgroup_meta_reserve(root, (s64)num_bytes, type);
36333633 ret = qgroup_reserve(root, num_bytes, enforce, type);
36343634 if (ret < 0)
36353635 return ret;
@@ -3676,7 +3676,7 @@ void __btrfs_qgroup_free_meta(struct btrfs_root *root, int num_bytes, · 40 unmodified lines
36763676 */
36773677 num_bytes = sub_root_meta_rsv(root, num_bytes, type);
36783678 BUG_ON(num_bytes != round_down(num_bytes, fs_info->nodesize));
3679− trace_qgroup_meta_reserve(root, type, -(s64)num_bytes);
3679+ trace_qgroup_meta_reserve(root, -(s64)num_bytes, type);
36803680 btrfs_qgroup_free_refroot(fs_info, root->root_key.objectid,
36813681 num_bytes, type);
36823682 }
fs/btrfs/relocation.c+5−4
@@ -3277,6 +3277,8 @@ static int relocate_file_extent_cluster(struct inode *inode, · 3276 unmodified lines
32773277 if (!page) {
32783278 btrfs_delalloc_release_metadata(BTRFS_I(inode),
32793279 PAGE_SIZE, true);
3280+ btrfs_delalloc_release_extents(BTRFS_I(inode),
3281+ PAGE_SIZE);
32803282 ret = -ENOMEM;
32813283 goto out;
32823284 }
@@ -3297,7 +3299,7 @@ static int relocate_file_extent_cluster(struct inode *inode, · 14 unmodified lines
32973299 btrfs_delalloc_release_metadata(BTRFS_I(inode),
32983300 PAGE_SIZE, true);
32993301 btrfs_delalloc_release_extents(BTRFS_I(inode),
3300− PAGE_SIZE, true);
3302+ PAGE_SIZE);
33013303 ret = -EIO;
33023304 goto out;
33033305 }
@@ -3326,7 +3328,7 @@ static int relocate_file_extent_cluster(struct inode *inode, · 22 unmodified lines
33263328 btrfs_delalloc_release_metadata(BTRFS_I(inode),
33273329 PAGE_SIZE, true);
33283330 btrfs_delalloc_release_extents(BTRFS_I(inode),
3329− PAGE_SIZE, true);
3331+ PAGE_SIZE);
33303332
33313333 clear_extent_bits(&BTRFS_I(inode)->io_tree,
33323334 page_start, page_end,
@@ -3342,8 +3344,7 @@ static int relocate_file_extent_cluster(struct inode *inode, · 9 unmodified lines
33423344 put_page(page);
33433345
33443346 index++;
3345− btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE,
3346− false);
3347+ btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE);
33473348 balance_dirty_pages_ratelimited(inode->i_mapping);
33483349 btrfs_throttle(fs_info);
33493350 }
fs/ceph/mds_client.c+11−10
@@ -384,8 +384,8 @@ static int parse_reply_info_readdir(void **p, void *end, · 383 unmodified lines
384384 }
385385
386386 done:
387− if (*p != end)
388− goto bad;
387+ /* Skip over any unrecognized fields */
388+ *p = end;
389389 return 0;
390390
391391 bad:
@@ -406,12 +406,10 @@ static int parse_reply_info_filelock(void **p, void *end, · 14 unmodified lines
406406 goto bad;
407407
408408 info->filelock_reply = *p;
409− *p += sizeof(*info->filelock_reply);
410409
411− if (unlikely(*p != end))
412− goto bad;
410+ /* Skip over any unrecognized fields */
411+ *p = end;
413412 return 0;
414−
415413 bad:
416414 return -EIO;
417415 }
@@ -425,18 +423,21 @@ static int parse_reply_info_create(void **p, void *end, · 7 unmodified lines
425423 {
426424 if (features == (u64)-1 ||
427425 (features & CEPH_FEATURE_REPLY_CREATE_INODE)) {
426+ /* Malformed reply? */
428427 if (*p == end) {
429428 info->has_create_ino = false;
430429 } else {
431430 info->has_create_ino = true;
432− info->ino = ceph_decode_64(p);
431+ ceph_decode_64_safe(p, end, info->ino, bad);
433432 }
433+ } else {
434+ if (*p != end)
435+ goto bad;
434436 }
435437
436− if (unlikely(*p != end))
437− goto bad;
438+ /* Skip over any unrecognized fields */
439+ *p = end;
438440 return 0;
439−
440441 bad:
441442 return -EIO;
442443 }
fs/cifs/cifsfs.c+7−1
@@ -169,7 +169,13 @@ cifs_read_super(struct super_block *sb) · 168 unmodified lines
169169 else
170170 sb->s_maxbytes = MAX_NON_LFS;
171171
172− /* Some very old servers like DOS and OS/2 used 2 second granularity */
172+ /*
173+ * Some very old servers like DOS and OS/2 used 2 second granularity
174+ * (while all current servers use 100ns granularity - see MS-DTYP)
175+ * but 1 second is the maximum allowed granularity for the VFS
176+ * so for old servers set time granularity to 1 second while for
177+ * everything else (current servers) set it to 100ns.
178+ */
173179 if ((tcon->ses->server->vals->protocol_id == SMB10_PROT_ID) &&
174180 ((tcon->ses->capabilities &
175181 tcon->ses->server->vals->cap_nt_find) == 0) &&
fs/cifs/cifsglob.h+5−0
@@ -1391,6 +1391,11 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file); · 1390 unmodified lines
13911391 struct cifsInodeInfo {
13921392 bool can_cache_brlcks;
13931393 struct list_head llist; /* locks helb by this inode */
1394+ /*
1395+ * NOTE: Some code paths call down_read(lock_sem) twice, so
1396+ * we must always use use cifs_down_write() instead of down_write()
1397+ * for this semaphore to avoid deadlocks.
1398+ */
13941399 struct rw_semaphore lock_sem; /* protect the fields above */
13951400 /* BB add in lists for dirty pages i.e. write caching info for oplock */
13961401 struct list_head openFileList;
fs/cifs/cifsproto.h+1−0
@@ -170,6 +170,7 @@ extern int cifs_unlock_range(struct cifsFileInfo *cfile, · 169 unmodified lines
170170 struct file_lock *flock, const unsigned int xid);
171171 extern int cifs_push_mandatory_locks(struct cifsFileInfo *cfile);
172172
173+extern void cifs_down_write(struct rw_semaphore *sem);
173174 extern struct cifsFileInfo *cifs_new_fileinfo(struct cifs_fid *fid,
174175 struct file *file,
175176 struct tcon_link *tlink,
fs/cifs/connect.c+15−3
@@ -564,9 +564,11 @@ cifs_reconnect(struct TCP_Server_Info *server) · 563 unmodified lines
564564 spin_lock(&GlobalMid_Lock);
565565 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
566566 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
567+ kref_get(&mid_entry->refcount);
567568 if (mid_entry->mid_state == MID_REQUEST_SUBMITTED)
568569 mid_entry->mid_state = MID_RETRY_NEEDED;
569570 list_move(&mid_entry->qhead, &retry_list);
571+ mid_entry->mid_flags |= MID_DELETED;
570572 }
571573 spin_unlock(&GlobalMid_Lock);
572574 mutex_unlock(&server->srv_mutex);
@@ -576,6 +578,7 @@ cifs_reconnect(struct TCP_Server_Info *server) · 3 unmodified lines
576578 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
577579 list_del_init(&mid_entry->qhead);
578580 mid_entry->callback(mid_entry);
581+ cifs_mid_q_entry_release(mid_entry);
579582 }
580583
581584 if (cifs_rdma_enabled(server)) {
@@ -895,8 +898,10 @@ dequeue_mid(struct mid_q_entry *mid, bool malformed) · 313 unmodified lines
895898 if (mid->mid_flags & MID_DELETED)
896899 printk_once(KERN_WARNING
897900 "trying to dequeue a deleted mid\n");
898− else
901+ else {
899902 list_del_init(&mid->qhead);
903+ mid->mid_flags |= MID_DELETED;
904+ }
900905 spin_unlock(&GlobalMid_Lock);
901906 }
902907
@@ -966,8 +971,10 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 63 unmodified lines
966971 list_for_each_safe(tmp, tmp2, &server->pending_mid_q) {
967972 mid_entry = list_entry(tmp, struct mid_q_entry, qhead);
968973 cifs_dbg(FYI, "Clearing mid 0x%llx\n", mid_entry->mid);
974+ kref_get(&mid_entry->refcount);
969975 mid_entry->mid_state = MID_SHUTDOWN;
970976 list_move(&mid_entry->qhead, &dispose_list);
977+ mid_entry->mid_flags |= MID_DELETED;
971978 }
972979 spin_unlock(&GlobalMid_Lock);
973980
@@ -977,6 +984,7 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) · 3 unmodified lines
977984 cifs_dbg(FYI, "Callback mid 0x%llx\n", mid_entry->mid);
978985 list_del_init(&mid_entry->qhead);
979986 mid_entry->callback(mid_entry);
987+ cifs_mid_q_entry_release(mid_entry);
980988 }
981989 /* 1/8th of sec is more than enough time for them to exit */
982990 msleep(125);
@@ -3882,8 +3890,12 @@ generic_ip_connect(struct TCP_Server_Info *server) · 2899 unmodified lines
38823890
38833891 rc = socket->ops->connect(socket, saddr, slen,
38843892 server->noblockcnt ? O_NONBLOCK : 0);
3885−
3886− if (rc == -EINPROGRESS)
3893+ /*
3894+ * When mounting SMB root file systems, we do not want to block in
3895+ * connect. Otherwise bail out and then let cifs_reconnect() perform
3896+ * reconnect failover - if possible.
3897+ */
3898+ if (server->noblockcnt && rc == -EINPROGRESS)
38873899 rc = 0;
38883900 if (rc < 0) {
38893901 cifs_dbg(FYI, "Error %d connecting to server\n", rc);
fs/cifs/file.c+18−11
@@ -281,6 +281,13 @@ cifs_has_mand_locks(struct cifsInodeInfo *cinode) · 280 unmodified lines
281281 return has_locks;
282282 }
283283
284+void
285+cifs_down_write(struct rw_semaphore *sem)
286+{
287+ while (!down_write_trylock(sem))
288+ msleep(10);
289+}
290+
284291 struct cifsFileInfo *
285292 cifs_new_fileinfo(struct cifs_fid *fid, struct file *file,
286293 struct tcon_link *tlink, __u32 oplock)
@@ -306,7 +313,7 @@ cifs_new_fileinfo(struct cifs_fid *fid, struct file *file, · 19 unmodified lines
306313 INIT_LIST_HEAD(&fdlocks->locks);
307314 fdlocks->cfile = cfile;
308315 cfile->llist = fdlocks;
309− down_write(&cinode->lock_sem);
316+ cifs_down_write(&cinode->lock_sem);
310317 list_add(&fdlocks->llist, &cinode->llist);
311318 up_write(&cinode->lock_sem);
312319
@@ -405,10 +412,11 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 92 unmodified lines
405412 bool oplock_break_cancelled;
406413
407414 spin_lock(&tcon->open_file_lock);
408−
415+ spin_lock(&cifsi->open_file_lock);
409416 spin_lock(&cifs_file->file_info_lock);
410417 if (--cifs_file->count > 0) {
411418 spin_unlock(&cifs_file->file_info_lock);
419+ spin_unlock(&cifsi->open_file_lock);
412420 spin_unlock(&tcon->open_file_lock);
413421 return;
414422 }
@@ -421,9 +429,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 6 unmodified lines
421429 cifs_add_pending_open_locked(&fid, cifs_file->tlink, &open);
422430
423431 /* remove it from the lists */
424− spin_lock(&cifsi->open_file_lock);
425432 list_del(&cifs_file->flist);
426− spin_unlock(&cifsi->open_file_lock);
427433 list_del(&cifs_file->tlist);
428434 atomic_dec(&tcon->num_local_opens);
429435
@@ -440,6 +446,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 10 unmodified lines
440446 cifs_set_oplock_level(cifsi, 0);
441447 }
442448
449+ spin_unlock(&cifsi->open_file_lock);
443450 spin_unlock(&tcon->open_file_lock);
444451
445452 oplock_break_cancelled = wait_oplock_handler ?
@@ -464,7 +471,7 @@ void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) · 18 unmodified lines
464471 * Delete any outstanding lock records. We'll lose them when the file
465472 * is closed anyway.
466473 */
467− down_write(&cifsi->lock_sem);
474+ cifs_down_write(&cifsi->lock_sem);
468475 list_for_each_entry_safe(li, tmp, &cifs_file->llist->locks, llist) {
469476 list_del(&li->llist);
470477 cifs_del_lock_waiters(li);
@@ -1027,7 +1034,7 @@ static void · 556 unmodified lines
10271034 cifs_lock_add(struct cifsFileInfo *cfile, struct cifsLockInfo *lock)
10281035 {
10291036 struct cifsInodeInfo *cinode = CIFS_I(d_inode(cfile->dentry));
1030− down_write(&cinode->lock_sem);
1037+ cifs_down_write(&cinode->lock_sem);
10311038 list_add_tail(&lock->llist, &cfile->llist->locks);
10321039 up_write(&cinode->lock_sem);
10331040 }
@@ -1049,7 +1056,7 @@ cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, · 15 unmodified lines
10491056
10501057 try_again:
10511058 exist = false;
1052− down_write(&cinode->lock_sem);
1059+ cifs_down_write(&cinode->lock_sem);
10531060
10541061 exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length,
10551062 lock->type, lock->flags, &conf_lock,
@@ -1072,7 +1079,7 @@ try_again: · 16 unmodified lines
10721079 (lock->blist.next == &lock->blist));
10731080 if (!rc)
10741081 goto try_again;
1075− down_write(&cinode->lock_sem);
1082+ cifs_down_write(&cinode->lock_sem);
10761083 list_del_init(&lock->blist);
10771084 }
10781085
@@ -1125,7 +1132,7 @@ cifs_posix_lock_set(struct file *file, struct file_lock *flock) · 46 unmodified lines
11251132 return rc;
11261133
11271134 try_again:
1128− down_write(&cinode->lock_sem);
1135+ cifs_down_write(&cinode->lock_sem);
11291136 if (!cinode->can_cache_brlcks) {
11301137 up_write(&cinode->lock_sem);
11311138 return rc;
@@ -1331,7 +1338,7 @@ cifs_push_locks(struct cifsFileInfo *cfile) · 199 unmodified lines
13311338 int rc = 0;
13321339
13331340 /* we are going to update can_cache_brlcks here - need a write access */
1334− down_write(&cinode->lock_sem);
1341+ cifs_down_write(&cinode->lock_sem);
13351342 if (!cinode->can_cache_brlcks) {
13361343 up_write(&cinode->lock_sem);
13371344 return rc;
@@ -1522,7 +1529,7 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, · 184 unmodified lines
15221529 if (!buf)
15231530 return -ENOMEM;
15241531
1525− down_write(&cinode->lock_sem);
1532+ cifs_down_write(&cinode->lock_sem);
15261533 for (i = 0; i < 2; i++) {
15271534 cur = buf;
15281535 num = 0;
fs/cifs/inode.c+2−2
@@ -2475,9 +2475,9 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) · 2474 unmodified lines
24752475 rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid);
24762476 cifsFileInfo_put(wfile);
24772477 if (rc)
2478− return rc;
2478+ goto cifs_setattr_exit;
24792479 } else if (rc != -EBADF)
2480− return rc;
2480+ goto cifs_setattr_exit;
24812481 else
24822482 rc = 0;
24832483 }
fs/cifs/smb1ops.c+3−0
@@ -171,6 +171,9 @@ cifs_get_next_mid(struct TCP_Server_Info *server) · 170 unmodified lines
171171 /* we do not want to loop forever */
172172 last_mid = cur_mid;
173173 cur_mid++;
174+ /* avoid 0xFFFF MID */
175+ if (cur_mid == 0xffff)
176+ cur_mid++;
174177
175178 /*
176179 * This nested loop looks more expensive than it is.
fs/cifs/smb2file.c+1−1
@@ -145,7 +145,7 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock, · 144 unmodified lines
145145
146146 cur = buf;
147147
148− down_write(&cinode->lock_sem);
148+ cifs_down_write(&cinode->lock_sem);
149149 list_for_each_entry_safe(li, tmp, &cfile->llist->locks, llist) {
150150 if (flock->fl_start > li->offset ||
151151 (flock->fl_start + length) <
fs/cifs/transport.c+23−19
@@ -86,22 +86,8 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server) · 85 unmodified lines
8686
8787 static void _cifs_mid_q_entry_release(struct kref *refcount)
8888 {
89− struct mid_q_entry *mid = container_of(refcount, struct mid_q_entry,
90− refcount);
91−
92− mempool_free(mid, cifs_mid_poolp);
93−}
94−
95−void cifs_mid_q_entry_release(struct mid_q_entry *midEntry)
96−{
97− spin_lock(&GlobalMid_Lock);
98− kref_put(&midEntry->refcount, _cifs_mid_q_entry_release);
99− spin_unlock(&GlobalMid_Lock);
100−}
101−
102−void
103−DeleteMidQEntry(struct mid_q_entry *midEntry)
104−{
89+ struct mid_q_entry *midEntry =
90+ container_of(refcount, struct mid_q_entry, refcount);
10591 #ifdef CONFIG_CIFS_STATS2
10692 __le16 command = midEntry->server->vals->lock_cmd;
10793 __u16 smb_cmd = le16_to_cpu(midEntry->command);
@@ -166,6 +152,19 @@ DeleteMidQEntry(struct mid_q_entry *midEntry) · 58 unmodified lines
166152 }
167153 }
168154 #endif
155+
156+ mempool_free(midEntry, cifs_mid_poolp);
157+}
158+
159+void cifs_mid_q_entry_release(struct mid_q_entry *midEntry)
160+{
161+ spin_lock(&GlobalMid_Lock);
162+ kref_put(&midEntry->refcount, _cifs_mid_q_entry_release);
163+ spin_unlock(&GlobalMid_Lock);
164+}
165+
166+void DeleteMidQEntry(struct mid_q_entry *midEntry)
167+{
169168 cifs_mid_q_entry_release(midEntry);
170169 }
171170
@@ -173,8 +172,10 @@ void · 1 unmodified line
173172 cifs_delete_mid(struct mid_q_entry *mid)
174173 {
175174 spin_lock(&GlobalMid_Lock);
176− list_del_init(&mid->qhead);
177− mid->mid_flags |= MID_DELETED;
175+ if (!(mid->mid_flags & MID_DELETED)) {
176+ list_del_init(&mid->qhead);
177+ mid->mid_flags |= MID_DELETED;
178+ }
178179 spin_unlock(&GlobalMid_Lock);
179180
180181 DeleteMidQEntry(mid);
@@ -872,7 +873,10 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) · 691 unmodified lines
872873 rc = -EHOSTDOWN;
873874 break;
874875 default:
875− list_del_init(&mid->qhead);
876+ if (!(mid->mid_flags & MID_DELETED)) {
877+ list_del_init(&mid->qhead);
878+ mid->mid_flags |= MID_DELETED;
879+ }
876880 cifs_server_dbg(VFS, "%s: invalid mid state mid=%llu state=%d\n",
877881 __func__, mid->mid, mid->mid_state);
878882 rc = -EIO;
fs/dax.c+3−2
@@ -220,10 +220,11 @@ static void *get_unlocked_entry(struct xa_state *xas, unsigned int order) · 219 unmodified lines
220220
221221 for (;;) {
222222 entry = xas_find_conflict(xas);
223+ if (!entry || WARN_ON_ONCE(!xa_is_value(entry)))
224+ return entry;
223225 if (dax_entry_order(entry) < order)
224226 return XA_RETRY_ENTRY;
225− if (!entry || WARN_ON_ONCE(!xa_is_value(entry)) ||
226− !dax_is_locked(entry))
227+ if (!dax_is_locked(entry))
227228 return entry;
228229
229230 wq = dax_entry_waitqueue(xas, entry, &ewait.key);
fs/direct-io.c+1−2
@@ -241,9 +241,8 @@ void dio_warn_stale_pagecache(struct file *filp) · 240 unmodified lines
241241 }
242242 }
243243
244−/**
244+/*
245245 * dio_complete() - called when all DIO BIO I/O has been completed
246− * @offset: the byte offset in the file of the completed operation
247246 *
248247 * This drops i_dio_count, lets interested parties know that a DIO operation
249248 * has completed, and calculates the resulting return code for the operation.
fs/fs-writeback.c+1−1
@@ -905,7 +905,7 @@ restart: · 904 unmodified lines
905905 * cgroup_writeback_by_id - initiate cgroup writeback from bdi and memcg IDs
906906 * @bdi_id: target bdi id
907907 * @memcg_id: target memcg css id
908− * @nr_pages: number of pages to write, 0 for best-effort dirty flushing
908+ * @nr: number of pages to write, 0 for best-effort dirty flushing
909909 * @reason: reason why some writeback work initiated
910910 * @done: target wb_completion
911911 *
fs/gfs2/ops_fstype.c+1−0
@@ -1600,6 +1600,7 @@ static int gfs2_meta_get_tree(struct fs_context *fc) · 1599 unmodified lines
16001600 }
16011601
16021602 static const struct fs_context_operations gfs2_meta_context_ops = {
1603+ .free = gfs2_fc_free,
16031604 .get_tree = gfs2_meta_get_tree,
16041605 };
16051606
fs/io_uring.c+172−117
@@ -197,6 +197,7 @@ struct io_ring_ctx { · 196 unmodified lines
197197 unsigned sq_entries;
198198 unsigned sq_mask;
199199 unsigned sq_thread_idle;
200+ unsigned cached_sq_dropped;
200201 struct io_uring_sqe *sq_sqes;
201202
202203 struct list_head defer_list;
@@ -212,6 +213,7 @@ struct io_ring_ctx { · 9 unmodified lines
212213
213214 struct {
214215 unsigned cached_cq_tail;
216+ atomic_t cached_cq_overflow;
215217 unsigned cq_entries;
216218 unsigned cq_mask;
217219 struct wait_queue_head cq_wait;
@@ -322,6 +324,8 @@ struct io_kiocb { · 104 unmodified lines
322324 #define REQ_F_FAIL_LINK 256 /* fail rest of links */
323325 #define REQ_F_SHADOW_DRAIN 512 /* link-drain shadow req */
324326 #define REQ_F_TIMEOUT 1024 /* timeout request */
327+#define REQ_F_ISREG 2048 /* regular file */
328+#define REQ_F_MUST_PUNT 4096 /* must be punted even for NONBLOCK */
325329 u64 user_data;
326330 u32 result;
327331 u32 sequence;
@@ -418,7 +422,8 @@ static struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p) · 90 unmodified lines
418422 static inline bool __io_sequence_defer(struct io_ring_ctx *ctx,
419423 struct io_kiocb *req)
420424 {
421− return req->sequence != ctx->cached_cq_tail + ctx->rings->sq_dropped;
425+ return req->sequence != ctx->cached_cq_tail + ctx->cached_sq_dropped
426+ + atomic_read(&ctx->cached_cq_overflow);
422427 }
423428
424429 static inline bool io_sequence_defer(struct io_ring_ctx *ctx,
@@ -565,9 +570,8 @@ static void io_cqring_fill_event(struct io_ring_ctx *ctx, u64 ki_user_data, · 140 unmodified lines
565570 WRITE_ONCE(cqe->res, res);
566571 WRITE_ONCE(cqe->flags, 0);
567572 } else {
568− unsigned overflow = READ_ONCE(ctx->rings->cq_overflow);
569−
570− WRITE_ONCE(ctx->rings->cq_overflow, overflow + 1);
573+ WRITE_ONCE(ctx->rings->cq_overflow,
574+ atomic_inc_return(&ctx->cached_cq_overflow));
571575 }
572576 }
573577
@@ -733,6 +737,14 @@ static unsigned io_cqring_events(struct io_rings *rings) · 159 unmodified lines
733737 return READ_ONCE(rings->cq.tail) - READ_ONCE(rings->cq.head);
734738 }
735739
740+static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx)
741+{
742+ struct io_rings *rings = ctx->rings;
743+
744+ /* make sure SQ entry isn't read before tail */
745+ return smp_load_acquire(&rings->sq.tail) - ctx->cached_sq_head;
746+}
747+
736748 /*
737749 * Find and free completed poll iocbs
738750 */
@@ -862,19 +874,11 @@ static void io_iopoll_reap_events(struct io_ring_ctx *ctx) · 123 unmodified lines
862874 mutex_unlock(&ctx->uring_lock);
863875 }
864876
865−static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events,
866− long min)
877+static int __io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events,
878+ long min)
867879 {
868− int iters, ret = 0;
880+ int iters = 0, ret = 0;
869881
870− /*
871− * We disallow the app entering submit/complete with polling, but we
872− * still need to lock the ring to prevent racing with polled issue
873− * that got punted to a workqueue.
874− */
875− mutex_lock(&ctx->uring_lock);
876−
877− iters = 0;
878882 do {
879883 int tmin = 0;
880884
@@ -910,30 +914,45 @@ static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events, · 29 unmodified lines
910914 ret = 0;
911915 } while (min && !*nr_events && !need_resched());
912916
917+ return ret;
918+}
919+
920+static int io_iopoll_check(struct io_ring_ctx *ctx, unsigned *nr_events,
921+ long min)
922+{
923+ int ret;
924+
925+ /*
926+ * We disallow the app entering submit/complete with polling, but we
927+ * still need to lock the ring to prevent racing with polled issue
928+ * that got punted to a workqueue.
929+ */
930+ mutex_lock(&ctx->uring_lock);
931+ ret = __io_iopoll_check(ctx, nr_events, min);
913932 mutex_unlock(&ctx->uring_lock);
914933 return ret;
915934 }
916935
917−static void kiocb_end_write(struct kiocb *kiocb)
936+static void kiocb_end_write(struct io_kiocb *req)
918937 {
919− if (kiocb->ki_flags & IOCB_WRITE) {
920− struct inode *inode = file_inode(kiocb->ki_filp);
938+ /*
939+ * Tell lockdep we inherited freeze protection from submission
940+ * thread.
941+ */
942+ if (req->flags & REQ_F_ISREG) {
943+ struct inode *inode = file_inode(req->file);
921944
922− /*
923− * Tell lockdep we inherited freeze protection from submission
924− * thread.
925− */
926− if (S_ISREG(inode->i_mode))
927− __sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE);
928− file_end_write(kiocb->ki_filp);
945+ __sb_writers_acquired(inode->i_sb, SB_FREEZE_WRITE);
929946 }
947+ file_end_write(req->file);
930948 }
931949
932950 static void io_complete_rw(struct kiocb *kiocb, long res, long res2)
933951 {
934952 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
935953
936− kiocb_end_write(kiocb);
954+ if (kiocb->ki_flags & IOCB_WRITE)
955+ kiocb_end_write(req);
937956
938957 if ((req->flags & REQ_F_LINK) && res != req->result)
939958 req->flags |= REQ_F_FAIL_LINK;
@@ -945,7 +964,8 @@ static void io_complete_rw_iopoll(struct kiocb *kiocb, long res, long res2) · 5 unmodified lines
945964 {
946965 struct io_kiocb *req = container_of(kiocb, struct io_kiocb, rw);
947966
948− kiocb_end_write(kiocb);
967+ if (kiocb->ki_flags & IOCB_WRITE)
968+ kiocb_end_write(req);
949969
950970 if ((req->flags & REQ_F_LINK) && res != req->result)
951971 req->flags |= REQ_F_FAIL_LINK;
@@ -1059,8 +1079,17 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s, · 107 unmodified lines
10591079 if (!req->file)
10601080 return -EBADF;
10611081
1062− if (force_nonblock && !io_file_supports_async(req->file))
1063− force_nonblock = false;
1082+ if (S_ISREG(file_inode(req->file)->i_mode))
1083+ req->flags |= REQ_F_ISREG;
1084+
1085+ /*
1086+ * If the file doesn't support async, mark it as REQ_F_MUST_PUNT so
1087+ * we know to async punt it even if it was opened O_NONBLOCK
1088+ */
1089+ if (force_nonblock && !io_file_supports_async(req->file)) {
1090+ req->flags |= REQ_F_MUST_PUNT;
1091+ return -EAGAIN;
1092+ }
10641093
10651094 kiocb->ki_pos = READ_ONCE(sqe->off);
10661095 kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
@@ -1081,7 +1110,8 @@ static int io_prep_rw(struct io_kiocb *req, const struct sqe_submit *s, · 14 unmodified lines
10811110 return ret;
10821111
10831112 /* don't allow async punt if RWF_NOWAIT was requested */
1084− if (kiocb->ki_flags & IOCB_NOWAIT)
1113+ if ((kiocb->ki_flags & IOCB_NOWAIT) ||
1114+ (req->file->f_flags & O_NONBLOCK))
10851115 req->flags |= REQ_F_NOWAIT;
10861116
10871117 if (force_nonblock)
@@ -1382,7 +1412,9 @@ static int io_read(struct io_kiocb *req, const struct sqe_submit *s, · 294 unmodified lines
13821412 * need async punt anyway, so it's more efficient to do it
13831413 * here.
13841414 */
1385− if (force_nonblock && ret2 > 0 && ret2 < read_size)
1415+ if (force_nonblock && !(req->flags & REQ_F_NOWAIT) &&
1416+ (req->flags & REQ_F_ISREG) &&
1417+ ret2 > 0 && ret2 < read_size)
13861418 ret2 = -EAGAIN;
13871419 /* Catch -EAGAIN return for forced non-blocking submission */
13881420 if (!force_nonblock || ret2 != -EAGAIN) {
@@ -1447,7 +1479,7 @@ static int io_write(struct io_kiocb *req, const struct sqe_submit *s, · 58 unmodified lines
14471479 * released so that it doesn't complain about the held lock when
14481480 * we return to userspace.
14491481 */
1450− if (S_ISREG(file_inode(file)->i_mode)) {
1482+ if (req->flags & REQ_F_ISREG) {
14511483 __sb_start_write(file_inode(file)->i_sb,
14521484 SB_FREEZE_WRITE, true);
14531485 __sb_writers_release(file_inode(file)->i_sb,
@@ -1862,7 +1894,7 @@ static int io_poll_add(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 408 unmodified lines
18621894 static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer)
18631895 {
18641896 struct io_ring_ctx *ctx;
1865− struct io_kiocb *req;
1897+ struct io_kiocb *req, *prev;
18661898 unsigned long flags;
18671899
18681900 req = container_of(timer, struct io_kiocb, timeout.timer);
@@ -1870,6 +1902,15 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) · 1 unmodified line
18701902 atomic_inc(&ctx->cq_timeouts);
18711903
18721904 spin_lock_irqsave(&ctx->completion_lock, flags);
1905+ /*
1906+ * Adjust the reqs sequence before the current one because it
1907+ * will consume a slot in the cq_ring and the the cq_tail pointer
1908+ * will be increased, otherwise other timeout reqs may return in
1909+ * advance without waiting for enough wait_nr.
1910+ */
1911+ prev = req;
1912+ list_for_each_entry_continue_reverse(prev, &ctx->timeout_list, list)
1913+ prev->sequence++;
18731914 list_del(&req->list);
18741915
18751916 io_cqring_fill_event(ctx, req->user_data, -ETIME);
@@ -1884,10 +1925,11 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) · 8 unmodified lines
18841925
18851926 static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe)
18861927 {
1887− unsigned count, req_dist, tail_index;
1928+ unsigned count;
18881929 struct io_ring_ctx *ctx = req->ctx;
18891930 struct list_head *entry;
18901931 struct timespec64 ts;
1932+ unsigned span = 0;
18911933
18921934 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
18931935 return -EINVAL;
@@ -1907,23 +1949,46 @@ static int io_timeout(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 13 unmodified lines
19071949 count = 1;
19081950
19091951 req->sequence = ctx->cached_sq_head + count - 1;
1952+ /* reuse it to store the count */
1953+ req->submit.sequence = count;
19101954 req->flags |= REQ_F_TIMEOUT;
19111955
19121956 /*
19131957 * Insertion sort, ensuring the first entry in the list is always
19141958 * the one we need first.
19151959 */
1916− tail_index = ctx->cached_cq_tail - ctx->rings->sq_dropped;
1917− req_dist = req->sequence - tail_index;
19181960 spin_lock_irq(&ctx->completion_lock);
19191961 list_for_each_prev(entry, &ctx->timeout_list) {
19201962 struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list);
1921− unsigned dist;
1963+ unsigned nxt_sq_head;
1964+ long long tmp, tmp_nxt;
1965+
1966+ /*
1967+ * Since cached_sq_head + count - 1 can overflow, use type long
1968+ * long to store it.
1969+ */
1970+ tmp = (long long)ctx->cached_sq_head + count - 1;
1971+ nxt_sq_head = nxt->sequence - nxt->submit.sequence + 1;
1972+ tmp_nxt = (long long)nxt_sq_head + nxt->submit.sequence - 1;
19221973
1923− dist = nxt->sequence - tail_index;
1924− if (req_dist >= dist)
1974+ /*
1975+ * cached_sq_head may overflow, and it will never overflow twice
1976+ * once there is some timeout req still be valid.
1977+ */
1978+ if (ctx->cached_sq_head < nxt_sq_head)
1979+ tmp += UINT_MAX;
1980+
1981+ if (tmp > tmp_nxt)
19251982 break;
1983+
1984+ /*
1985+ * Sequence of reqs after the insert one and itself should
1986+ * be adjusted because each timeout req consumes a slot.
1987+ */
1988+ span++;
1989+ nxt->sequence++;
19261990 }
1991+ req->sequence -= span;
19271992 list_add(&req->list, entry);
19281993 spin_unlock_irq(&ctx->completion_lock);
19291994
@@ -2262,12 +2327,18 @@ static int io_req_set_file(struct io_ring_ctx *ctx, const struct sqe_submit *s, · 332 unmodified lines
22622327 }
22632328
22642329 static int __io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
2265− struct sqe_submit *s, bool force_nonblock)
2330+ struct sqe_submit *s)
22662331 {
22672332 int ret;
22682333
2269− ret = __io_submit_sqe(ctx, req, s, force_nonblock);
2270− if (ret == -EAGAIN && !(req->flags & REQ_F_NOWAIT)) {
2334+ ret = __io_submit_sqe(ctx, req, s, true);
2335+
2336+ /*
2337+ * We async punt it if the file wasn't marked NOWAIT, or if the file
2338+ * doesn't support non-blocking read/write attempts
2339+ */
2340+ if (ret == -EAGAIN && (!(req->flags & REQ_F_NOWAIT) ||
2341+ (req->flags & REQ_F_MUST_PUNT))) {
22712342 struct io_uring_sqe *sqe_copy;
22722343
22732344 sqe_copy = kmemdup(s->sqe, sizeof(*sqe_copy), GFP_KERNEL);
@@ -2307,7 +2378,7 @@ static int __io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, · 33 unmodified lines
23072378 }
23082379
23092380 static int io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
2310− struct sqe_submit *s, bool force_nonblock)
2381+ struct sqe_submit *s)
23112382 {
23122383 int ret;
23132384
@@ -2320,18 +2391,17 @@ static int io_queue_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req, · 6 unmodified lines
23202391 return 0;
23212392 }
23222393
2323− return __io_queue_sqe(ctx, req, s, force_nonblock);
2394+ return __io_queue_sqe(ctx, req, s);
23242395 }
23252396
23262397 static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req,
2327− struct sqe_submit *s, struct io_kiocb *shadow,
2328− bool force_nonblock)
2398+ struct sqe_submit *s, struct io_kiocb *shadow)
23292399 {
23302400 int ret;
23312401 int need_submit = false;
23322402
23332403 if (!shadow)
2334− return io_queue_sqe(ctx, req, s, force_nonblock);
2404+ return io_queue_sqe(ctx, req, s);
23352405
23362406 /*
23372407 * Mark the first IO in link list as DRAIN, let all the following
@@ -2360,7 +2430,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, · 22 unmodified lines
23602430 spin_unlock_irq(&ctx->completion_lock);
23612431
23622432 if (need_submit)
2363− return __io_queue_sqe(ctx, req, s, force_nonblock);
2433+ return __io_queue_sqe(ctx, req, s);
23642434
23652435 return 0;
23662436 }
@@ -2368,8 +2438,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req, · 1 unmodified line
23682438 #define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK)
23692439
23702440 static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
2371− struct io_submit_state *state, struct io_kiocb **link,
2372− bool force_nonblock)
2441+ struct io_submit_state *state, struct io_kiocb **link)
23732442 {
23742443 struct io_uring_sqe *sqe_copy;
23752444 struct io_kiocb *req;
@@ -2396,6 +2465,8 @@ err: · 20 unmodified lines
23962465 return;
23972466 }
23982467
2468+ req->user_data = s->sqe->user_data;
2469+
23992470 /*
24002471 * If we already have a head request, queue this one for async
24012472 * submittal once the head completes. If we don't have a head but
@@ -2422,7 +2493,7 @@ err: · 20 unmodified lines
24222493 INIT_LIST_HEAD(&req->link_list);
24232494 *link = req;
24242495 } else {
2425− io_queue_sqe(ctx, req, s, force_nonblock);
2496+ io_queue_sqe(ctx, req, s);
24262497 }
24272498 }
24282499
@@ -2502,12 +2573,13 @@ static bool io_get_sqring(struct io_ring_ctx *ctx, struct sqe_submit *s) · 73 unmodified lines
25022573
25032574 /* drop invalid entries */
25042575 ctx->cached_sq_head++;
2505− rings->sq_dropped++;
2576+ ctx->cached_sq_dropped++;
2577+ WRITE_ONCE(rings->sq_dropped, ctx->cached_sq_dropped);
25062578 return false;
25072579 }
25082580
2509−static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes,
2510− unsigned int nr, bool has_user, bool mm_fault)
2581+static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
2582+ bool has_user, bool mm_fault)
25112583 {
25122584 struct io_submit_state state, *statep = NULL;
25132585 struct io_kiocb *link = NULL;
@@ -2521,19 +2593,23 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes, · 7 unmodified lines
25212593 }
25222594
25232595 for (i = 0; i < nr; i++) {
2596+ struct sqe_submit s;
2597+
2598+ if (!io_get_sqring(ctx, &s))
2599+ break;
2600+
25242601 /*
25252602 * If previous wasn't linked and we have a linked command,
25262603 * that's the end of the chain. Submit the previous link.
25272604 */
25282605 if (!prev_was_link && link) {
2529− io_queue_link_head(ctx, link, &link->submit, shadow_req,
2530− true);
2606+ io_queue_link_head(ctx, link, &link->submit, shadow_req);
25312607 link = NULL;
25322608 shadow_req = NULL;
25332609 }
2534− prev_was_link = (sqes[i].sqe->flags & IOSQE_IO_LINK) != 0;
2610+ prev_was_link = (s.sqe->flags & IOSQE_IO_LINK) != 0;
25352611
2536− if (link && (sqes[i].sqe->flags & IOSQE_IO_DRAIN)) {
2612+ if (link && (s.sqe->flags & IOSQE_IO_DRAIN)) {
25372613 if (!shadow_req) {
25382614 shadow_req = io_get_req(ctx, NULL);
25392615 if (unlikely(!shadow_req))
@@ -2541,24 +2617,24 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, struct sqe_submit *sqes, · 1 unmodified line
25412617 shadow_req->flags |= (REQ_F_IO_DRAIN | REQ_F_SHADOW_DRAIN);
25422618 refcount_dec(&shadow_req->refs);
25432619 }
2544− shadow_req->sequence = sqes[i].sequence;
2620+ shadow_req->sequence = s.sequence;
25452621 }
25462622
25472623 out:
25482624 if (unlikely(mm_fault)) {
2549− io_cqring_add_event(ctx, sqes[i].sqe->user_data,
2625+ io_cqring_add_event(ctx, s.sqe->user_data,
25502626 -EFAULT);
25512627 } else {
2552− sqes[i].has_user = has_user;
2553− sqes[i].needs_lock = true;
2554− sqes[i].needs_fixed_file = true;
2555− io_submit_sqe(ctx, &sqes[i], statep, &link, true);
2628+ s.has_user = has_user;
2629+ s.needs_lock = true;
2630+ s.needs_fixed_file = true;
2631+ io_submit_sqe(ctx, &s, statep, &link);
25562632 submitted++;
25572633 }
25582634 }
25592635
25602636 if (link)
2561− io_queue_link_head(ctx, link, &link->submit, shadow_req, true);
2637+ io_queue_link_head(ctx, link, &link->submit, shadow_req);
25622638 if (statep)
25632639 io_submit_state_end(&state);
25642640
@@ -2567,7 +2643,6 @@ out: · 2 unmodified lines
25672643
25682644 static int io_sq_thread(void *data)
25692645 {
2570− struct sqe_submit sqes[IO_IOPOLL_BATCH];
25712646 struct io_ring_ctx *ctx = data;
25722647 struct mm_struct *cur_mm = NULL;
25732648 mm_segment_t old_fs;
@@ -2582,14 +2657,27 @@ static int io_sq_thread(void *data) · 8 unmodified lines
25822657
25832658 timeout = inflight = 0;
25842659 while (!kthread_should_park()) {
2585− bool all_fixed, mm_fault = false;
2586− int i;
2660+ bool mm_fault = false;
2661+ unsigned int to_submit;
25872662
25882663 if (inflight) {
25892664 unsigned nr_events = 0;
25902665
25912666 if (ctx->flags & IORING_SETUP_IOPOLL) {
2592− io_iopoll_check(ctx, &nr_events, 0);
2667+ /*
2668+ * inflight is the count of the maximum possible
2669+ * entries we submitted, but it can be smaller
2670+ * if we dropped some of them. If we don't have
2671+ * poll entries available, then we know that we
2672+ * have nothing left to poll for. Reset the
2673+ * inflight count to zero in that case.
2674+ */
2675+ mutex_lock(&ctx->uring_lock);
2676+ if (!list_empty(&ctx->poll_list))
2677+ __io_iopoll_check(ctx, &nr_events, 0);
2678+ else
2679+ inflight = 0;
2680+ mutex_unlock(&ctx->uring_lock);
25932681 } else {
25942682 /*
25952683 * Normal IO, just pretend everything completed.
@@ -2603,7 +2691,8 @@ static int io_sq_thread(void *data) · 7 unmodified lines
26032691 timeout = jiffies + ctx->sq_thread_idle;
26042692 }
26052693
2606− if (!io_get_sqring(ctx, &sqes[0])) {
2694+ to_submit = io_sqring_entries(ctx);
2695+ if (!to_submit) {
26072696 /*
26082697 * We're polling. If we're within the defined idle
26092698 * period, then let us spin without work before going
@@ -2634,7 +2723,8 @@ static int io_sq_thread(void *data) · 24 unmodified lines
26342723 /* make sure to read SQ tail after writing flags */
26352724 smp_mb();
26362725
2637− if (!io_get_sqring(ctx, &sqes[0])) {
2726+ to_submit = io_sqring_entries(ctx);
2727+ if (!to_submit) {
26382728 if (kthread_should_park()) {
26392729 finish_wait(&ctx->sqo_wait, &wait);
26402730 break;
@@ -2652,19 +2742,8 @@ static int io_sq_thread(void *data) · 11 unmodified lines
26522742 ctx->rings->sq_flags &= ~IORING_SQ_NEED_WAKEUP;
26532743 }
26542744
2655− i = 0;
2656− all_fixed = true;
2657− do {
2658− if (all_fixed && io_sqe_needs_user(sqes[i].sqe))
2659− all_fixed = false;
2660−
2661− i++;
2662− if (i == ARRAY_SIZE(sqes))
2663− break;
2664− } while (io_get_sqring(ctx, &sqes[i]));
2665−
26662745 /* Unless all new commands are FIXED regions, grab mm */
2667− if (!all_fixed && !cur_mm) {
2746+ if (!cur_mm) {
26682747 mm_fault = !mmget_not_zero(ctx->sqo_mm);
26692748 if (!mm_fault) {
26702749 use_mm(ctx->sqo_mm);
@@ -2672,8 +2751,9 @@ static int io_sq_thread(void *data) · 1 unmodified line
26722751 }
26732752 }
26742753
2675− inflight += io_submit_sqes(ctx, sqes, i, cur_mm != NULL,
2676− mm_fault);
2754+ to_submit = min(to_submit, ctx->sq_entries);
2755+ inflight += io_submit_sqes(ctx, to_submit, cur_mm != NULL,
2756+ mm_fault);
26772757
26782758 /* Commit SQ ring head once we've consumed all SQEs */
26792759 io_commit_sqring(ctx);
@@ -2690,8 +2770,7 @@ static int io_sq_thread(void *data) · 10 unmodified lines
26902770 return 0;
26912771 }
26922772
2693−static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit,
2694− bool block_for_last)
2773+static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit)
26952774 {
26962775 struct io_submit_state state, *statep = NULL;
26972776 struct io_kiocb *link = NULL;
@@ -2705,7 +2784,6 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit, · 7 unmodified lines
27052784 }
27062785
27072786 for (i = 0; i < to_submit; i++) {
2708− bool force_nonblock = true;
27092787 struct sqe_submit s;
27102788
27112789 if (!io_get_sqring(ctx, &s))
@@ -2716,8 +2794,7 @@ static int io_ring_submit(struct io_ring_ctx *ctx, unsigned int to_submit, · 4 unmodified lines
27162794 * that's the end of the chain. Submit the previous link.
27172795 */
27182796 if (!prev_was_link && link) {
2719− io_queue_link_head(ctx, link, &link->submit, shadow_req,
2720− force_nonblock);
2797+ io_queue_link_head(ctx, link, &link->submit, shadow_req);
27212798 link = NULL;
27222799 shadow_req = NULL;
27232800 }
@@ -2739,27 +2816,16 @@ out: · 15 unmodified lines
27392816 s.needs_lock = false;
27402817 s.needs_fixed_file = false;
27412818 submit++;
2742−
2743− /*
2744− * The caller will block for events after submit, submit the
2745− * last IO non-blocking. This is either the only IO it's
2746− * submitting, or it already submitted the previous ones. This
2747− * improves performance by avoiding an async punt that we don't
2748− * need to do.
2749− */
2750− if (block_for_last && submit == to_submit)
2751− force_nonblock = false;
2752−
2753− io_submit_sqe(ctx, &s, statep, &link, force_nonblock);
2819+ io_submit_sqe(ctx, &s, statep, &link);
27542820 }
2755− io_commit_sqring(ctx);
27562821
27572822 if (link)
2758− io_queue_link_head(ctx, link, &link->submit, shadow_req,
2759− !block_for_last);
2823+ io_queue_link_head(ctx, link, &link->submit, shadow_req);
27602824 if (statep)
27612825 io_submit_state_end(statep);
27622826
2827+ io_commit_sqring(ctx);
2828+
27632829 return submit;
27642830 }
27652831
@@ -3600,21 +3666,10 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, · 834 unmodified lines
36003666 wake_up(&ctx->sqo_wait);
36013667 submitted = to_submit;
36023668 } else if (to_submit) {
3603− bool block_for_last = false;
3604−
36053669 to_submit = min(to_submit, ctx->sq_entries);
36063670
3607− /*
3608− * Allow last submission to block in a series, IFF the caller
3609− * asked to wait for events and we don't currently have
3610− * enough. This potentially avoids an async punt.
3611− */
3612− if (to_submit == min_complete &&
3613− io_cqring_events(ctx->rings) < min_complete)
3614− block_for_last = true;
3615−
36163671 mutex_lock(&ctx->uring_lock);
3617− submitted = io_ring_submit(ctx, to_submit, block_for_last);
3672+ submitted = io_ring_submit(ctx, to_submit);
36183673 mutex_unlock(&ctx->uring_lock);
36193674 }
36203675 if (flags & IORING_ENTER_GETEVENTS) {
fs/libfs.c+1−2
@@ -473,8 +473,7 @@ EXPORT_SYMBOL(simple_write_begin); · 472 unmodified lines
473473
474474 /**
475475 * simple_write_end - .write_end helper for non-block-device FSes
476− * @available: See .write_end of address_space_operations
477− * @file: "
476+ * @file: See .write_end of address_space_operations
478477 * @mapping: "
479478 * @pos: "
480479 * @len: "
fs/ocfs2/file.c+2−0
@@ -1230,6 +1230,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) · 1229 unmodified lines
12301230 transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid));
12311231 if (IS_ERR(transfer_to[USRQUOTA])) {
12321232 status = PTR_ERR(transfer_to[USRQUOTA]);
1233+ transfer_to[USRQUOTA] = NULL;
12331234 goto bail_unlock;
12341235 }
12351236 }
@@ -1239,6 +1240,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) · 3 unmodified lines
12391240 transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid));
12401241 if (IS_ERR(transfer_to[GRPQUOTA])) {
12411242 status = PTR_ERR(transfer_to[GRPQUOTA]);
1243+ transfer_to[GRPQUOTA] = NULL;
12421244 goto bail_unlock;
12431245 }
12441246 }
fs/ocfs2/journal.c+2−1
@@ -217,7 +217,8 @@ void ocfs2_recovery_exit(struct ocfs2_super *osb) · 216 unmodified lines
217217 /* At this point, we know that no more recovery threads can be
218218 * launched, so wait for any recovery completion work to
219219 * complete. */
220− flush_workqueue(osb->ocfs2_wq);
220+ if (osb->ocfs2_wq)
221+ flush_workqueue(osb->ocfs2_wq);
221222
222223 /*
223224 * Now that recovery is shut down, and the osb is about to be
fs/ocfs2/localalloc.c+2−1
@@ -377,7 +377,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) · 376 unmodified lines
377377 struct ocfs2_dinode *alloc = NULL;
378378
379379 cancel_delayed_work(&osb->la_enable_wq);
380− flush_workqueue(osb->ocfs2_wq);
380+ if (osb->ocfs2_wq)
381+ flush_workqueue(osb->ocfs2_wq);
381382
382383 if (osb->local_alloc_state == OCFS2_LA_UNUSED)
383384 goto out;
fs/proc/meminfo.c+2−2
@@ -132,9 +132,9 @@ static int meminfo_proc_show(struct seq_file *m, void *v) · 131 unmodified lines
132132 global_node_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR);
133133 show_val_kb(m, "ShmemPmdMapped: ",
134134 global_node_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR);
135− show_val_kb(m, "FileHugePages: ",
135+ show_val_kb(m, "FileHugePages: ",
136136 global_node_page_state(NR_FILE_THPS) * HPAGE_PMD_NR);
137− show_val_kb(m, "FilePmdMapped: ",
137+ show_val_kb(m, "FilePmdMapped: ",
138138 global_node_page_state(NR_FILE_PMDMAPPED) * HPAGE_PMD_NR);
139139 #endif
140140
fs/proc/page.c+16−12
@@ -42,10 +42,12 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, · 41 unmodified lines
4242 return -EINVAL;
4343
4444 while (count > 0) {
45− if (pfn_valid(pfn))
46− ppage = pfn_to_page(pfn);
47− else
48− ppage = NULL;
45+ /*
46+ * TODO: ZONE_DEVICE support requires to identify
47+ * memmaps that were actually initialized.
48+ */
49+ ppage = pfn_to_online_page(pfn);
50+
4951 if (!ppage || PageSlab(ppage) || page_has_type(ppage))
5052 pcount = 0;
5153 else
@@ -216,10 +218,11 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, · 164 unmodified lines
216218 return -EINVAL;
217219
218220 while (count > 0) {
219− if (pfn_valid(pfn))
220− ppage = pfn_to_page(pfn);
221− else
222− ppage = NULL;
221+ /*
222+ * TODO: ZONE_DEVICE support requires to identify
223+ * memmaps that were actually initialized.
224+ */
225+ ppage = pfn_to_online_page(pfn);
223226
224227 if (put_user(stable_page_flags(ppage), out)) {
225228 ret = -EFAULT;
@@ -261,10 +264,11 @@ static ssize_t kpagecgroup_read(struct file *file, char __user *buf, · 35 unmodified lines
261264 return -EINVAL;
262265
263266 while (count > 0) {
264− if (pfn_valid(pfn))
265− ppage = pfn_to_page(pfn);
266− else
267− ppage = NULL;
267+ /*
268+ * TODO: ZONE_DEVICE support requires to identify
269+ * memmaps that were actually initialized.
270+ */
271+ ppage = pfn_to_online_page(pfn);
268272
269273 if (ppage)
270274 ino = page_cgroup_ino(ppage);
fs/readdir.c+2−2
@@ -105,9 +105,9 @@ EXPORT_SYMBOL(iterate_dir); · 104 unmodified lines
105105 */
106106 static int verify_dirent_name(const char *name, int len)
107107 {
108− if (WARN_ON_ONCE(!len))
108+ if (!len)
109109 return -EIO;
110− if (WARN_ON_ONCE(memchr(name, '/', len)))
110+ if (memchr(name, '/', len))
111111 return -EIO;
112112 return 0;
113113 }
fs/xfs/libxfs/xfs_fs.h+4−4
@@ -366,11 +366,11 @@ struct xfs_bulkstat { · 365 unmodified lines
366366 uint64_t bs_blocks; /* number of blocks */
367367 uint64_t bs_xflags; /* extended flags */
368368
369− uint64_t bs_atime; /* access time, seconds */
370− uint64_t bs_mtime; /* modify time, seconds */
369+ int64_t bs_atime; /* access time, seconds */
370+ int64_t bs_mtime; /* modify time, seconds */
371371
372− uint64_t bs_ctime; /* inode change time, seconds */
373− uint64_t bs_btime; /* creation time, seconds */
372+ int64_t bs_ctime; /* inode change time, seconds */
373+ int64_t bs_btime; /* creation time, seconds */
374374
375375 uint32_t bs_gen; /* generation count */
376376 uint32_t bs_uid; /* user id */
include/acpi/processor.h+10−10
@@ -232,8 +232,8 @@ struct acpi_processor { · 231 unmodified lines
232232 struct acpi_processor_limit limit;
233233 struct thermal_cooling_device *cdev;
234234 struct device *dev; /* Processor device. */
235− struct dev_pm_qos_request perflib_req;
236− struct dev_pm_qos_request thermal_req;
235+ struct freq_qos_request perflib_req;
236+ struct freq_qos_request thermal_req;
237237 };
238238
239239 struct acpi_processor_errata {
@@ -302,8 +302,8 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx · 62 unmodified lines
302302 #ifdef CONFIG_CPU_FREQ
303303 extern bool acpi_processor_cpufreq_init;
304304 void acpi_processor_ignore_ppc_init(void);
305−void acpi_processor_ppc_init(int cpu);
306−void acpi_processor_ppc_exit(int cpu);
305+void acpi_processor_ppc_init(struct cpufreq_policy *policy);
306+void acpi_processor_ppc_exit(struct cpufreq_policy *policy);
307307 void acpi_processor_ppc_has_changed(struct acpi_processor *pr, int event_flag);
308308 extern int acpi_processor_get_bios_limit(int cpu, unsigned int *limit);
309309 #else
@@ -311,11 +311,11 @@ static inline void acpi_processor_ignore_ppc_init(void) · 1 unmodified line
311311 {
312312 return;
313313 }
314−static inline void acpi_processor_ppc_init(int cpu)
314+static inline void acpi_processor_ppc_init(struct cpufreq_policy *policy)
315315 {
316316 return;
317317 }
318−static inline void acpi_processor_ppc_exit(int cpu)
318+static inline void acpi_processor_ppc_exit(struct cpufreq_policy *policy)
319319 {
320320 return;
321321 }
@@ -431,14 +431,14 @@ static inline int acpi_processor_hotplug(struct acpi_processor *pr) · 109 unmodified lines
431431 int acpi_processor_get_limit_info(struct acpi_processor *pr);
432432 extern const struct thermal_cooling_device_ops processor_cooling_ops;
433433 #if defined(CONFIG_ACPI_CPU_FREQ_PSS) & defined(CONFIG_CPU_FREQ)
434−void acpi_thermal_cpufreq_init(int cpu);
435−void acpi_thermal_cpufreq_exit(int cpu);
434+void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy);
435+void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy);
436436 #else
437−static inline void acpi_thermal_cpufreq_init(int cpu)
437+static inline void acpi_thermal_cpufreq_init(struct cpufreq_policy *policy)
438438 {
439439 return;
440440 }
441−static inline void acpi_thermal_cpufreq_exit(int cpu)
441+static inline void acpi_thermal_cpufreq_exit(struct cpufreq_policy *policy)
442442 {
443443 return;
444444 }
include/linux/bitmap.h+2−1
@@ -326,10 +326,11 @@ static inline int bitmap_equal(const unsigned long *src1, · 325 unmodified lines
326326 }
327327
328328 /**
329− * bitmap_or_equal - Check whether the or of two bitnaps is equal to a third
329+ * bitmap_or_equal - Check whether the or of two bitmaps is equal to a third
330330 * @src1: Pointer to bitmap 1
331331 * @src2: Pointer to bitmap 2 will be or'ed with bitmap 1
332332 * @src3: Pointer to bitmap 3. Compare to the result of *@src1 | *@src2
333+ * @nbits: number of bits in each of these bitmaps
333334 *
334335 * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise
335336 */
include/linux/cpufreq.h+5−2
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/completion.h>
1414 #include <linux/kobject.h>
1515 #include <linux/notifier.h>
16+#include <linux/pm_qos.h>
1617 #include <linux/spinlock.h>
1718 #include <linux/sysfs.h>
1819
@@ -76,8 +77,10 @@ struct cpufreq_policy { · 57 unmodified lines
7677 struct work_struct update; /* if update_policy() needs to be
7778 * called, but you're in IRQ context */
7879
79− struct dev_pm_qos_request *min_freq_req;
80− struct dev_pm_qos_request *max_freq_req;
80+ struct freq_constraints constraints;
81+ struct freq_qos_request *min_freq_req;
82+ struct freq_qos_request *max_freq_req;
83+
8184 struct cpufreq_frequency_table *freq_table;
8285 enum cpufreq_table_sorting freq_table_sorted;
8386
include/linux/export.h+5−9
@@ -18,8 +18,6 @@ extern struct module __this_module; · 17 unmodified lines
1818 #define THIS_MODULE ((struct module *)0)
1919 #endif
2020
21−#define NS_SEPARATOR "."
22−
2321 #ifdef CONFIG_MODVERSIONS
2422 /* Mark the CRC weak since genksyms apparently decides not to
2523 * generate a checksums for some symbols */
@@ -48,11 +46,11 @@ extern struct module __this_module; · 22 unmodified lines
4846 * absolute relocations that require runtime processing on relocatable
4947 * kernels.
5048 */
51−#define __KSYMTAB_ENTRY_NS(sym, sec, ns) \
49+#define __KSYMTAB_ENTRY_NS(sym, sec) \
5250 __ADDRESSABLE(sym) \
5351 asm(" .section \"___ksymtab" sec "+" #sym "\", \"a\" \n" \
5452 " .balign 4 \n" \
55− "__ksymtab_" #ns NS_SEPARATOR #sym ": \n" \
53+ "__ksymtab_" #sym ": \n" \
5654 " .long " #sym "- . \n" \
5755 " .long __kstrtab_" #sym "- . \n" \
5856 " .long __kstrtabns_" #sym "- . \n" \
@@ -74,16 +72,14 @@ struct kernel_symbol { · 15 unmodified lines
7472 int namespace_offset;
7573 };
7674 #else
77−#define __KSYMTAB_ENTRY_NS(sym, sec, ns) \
78− static const struct kernel_symbol __ksymtab_##sym##__##ns \
79− asm("__ksymtab_" #ns NS_SEPARATOR #sym) \
75+#define __KSYMTAB_ENTRY_NS(sym, sec) \
76+ static const struct kernel_symbol __ksymtab_##sym \
8077 __attribute__((section("___ksymtab" sec "+" #sym), used)) \
8178 __aligned(sizeof(void *)) \
8279 = { (unsigned long)&sym, __kstrtab_##sym, __kstrtabns_##sym }
8380
8481 #define __KSYMTAB_ENTRY(sym, sec) \
8582 static const struct kernel_symbol __ksymtab_##sym \
86− asm("__ksymtab_" #sym) \
8783 __attribute__((section("___ksymtab" sec "+" #sym), used)) \
8884 __aligned(sizeof(void *)) \
8985 = { (unsigned long)&sym, __kstrtab_##sym, NULL }
@@ -115,7 +111,7 @@ struct kernel_symbol { · 25 unmodified lines
115111 static const char __kstrtabns_##sym[] \
116112 __attribute__((section("__ksymtab_strings"), used, aligned(1))) \
117113 = #ns; \
118− __KSYMTAB_ENTRY_NS(sym, sec, ns)
114+ __KSYMTAB_ENTRY_NS(sym, sec)
119115
120116 #define ___EXPORT_SYMBOL(sym, sec) \
121117 ___export_symbol_common(sym, sec); \
include/linux/gpio/driver.h+8−0
@@ -201,6 +201,14 @@ struct gpio_irq_chip { · 200 unmodified lines
201201 */
202202 bool threaded;
203203
204+ /**
205+ * @init_hw: optional routine to initialize hardware before
206+ * an IRQ chip will be added. This is quite useful when
207+ * a particular driver wants to clear IRQ related registers
208+ * in order to avoid undesired events.
209+ */
210+ int (*init_hw)(struct gpio_chip *chip);
211+
204212 /**
205213 * @init_valid_mask: optional routine to initialize @valid_mask, to be
206214 * used if not all GPIO lines are valid interrupts. Sometimes some
include/linux/micrel_phy.h+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 #define PHY_ID_KSZ886X 0x00221430
3232 #define PHY_ID_KSZ8863 0x00221435
3333
34−#define PHY_ID_KSZ8795 0x00221550
34+#define PHY_ID_KSZ87XX 0x00221550
3535
3636 #define PHY_ID_KSZ9477 0x00221631
3737
include/linux/page_ext.h+9−1
@@ -18,7 +18,7 @@ struct page_ext_operations { · 17 unmodified lines
1818
1919 enum page_ext_flags {
2020 PAGE_EXT_OWNER,
21− PAGE_EXT_OWNER_ACTIVE,
21+ PAGE_EXT_OWNER_ALLOCATED,
2222 #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
2323 PAGE_EXT_YOUNG,
2424 PAGE_EXT_IDLE,
@@ -36,6 +36,7 @@ struct page_ext { · 11 unmodified lines
3636 unsigned long flags;
3737 };
3838
39+extern unsigned long page_ext_size;
3940 extern void pgdat_page_ext_init(struct pglist_data *pgdat);
4041
4142 #ifdef CONFIG_SPARSEMEM
@@ -52,6 +53,13 @@ static inline void page_ext_init(void) · 10 unmodified lines
5253
5354 struct page_ext *lookup_page_ext(const struct page *page);
5455
56+static inline struct page_ext *page_ext_next(struct page_ext *curr)
57+{
58+ void *next = curr;
59+ next += page_ext_size;
60+ return next;
61+}
62+
5563 #else /* !CONFIG_PAGE_EXTENSION */
5664 struct page_ext;
5765
include/linux/perf_event.h+1−1
@@ -293,7 +293,7 @@ struct pmu { · 292 unmodified lines
293293 * -EBUSY -- @event is for this PMU but PMU temporarily unavailable
294294 * -EINVAL -- @event is for this PMU but @event is not valid
295295 * -EOPNOTSUPP -- @event is for this PMU, @event is valid, but not supported
296− * -EACCESS -- @event is for this PMU, @event is valid, but no privilidges
296+ * -EACCES -- @event is for this PMU, @event is valid, but no privileges
297297 *
298298 * 0 -- @event is for this PMU and valid
299299 *
include/linux/pm_qos.h+44−12
@@ -34,8 +34,6 @@ enum pm_qos_flags_status { · 33 unmodified lines
3434 #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT PM_QOS_LATENCY_ANY
3535 #define PM_QOS_RESUME_LATENCY_NO_CONSTRAINT_NS PM_QOS_LATENCY_ANY_NS
3636 #define PM_QOS_LATENCY_TOLERANCE_DEFAULT_VALUE 0
37−#define PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE 0
38−#define PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE (-1)
3937 #define PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT (-1)
4038
4139 #define PM_QOS_FLAG_NO_POWER_OFF (1 << 0)
@@ -54,8 +52,6 @@ struct pm_qos_flags_request { · 12 unmodified lines
5452 enum dev_pm_qos_req_type {
5553 DEV_PM_QOS_RESUME_LATENCY = 1,
5654 DEV_PM_QOS_LATENCY_TOLERANCE,
57− DEV_PM_QOS_MIN_FREQUENCY,
58− DEV_PM_QOS_MAX_FREQUENCY,
5955 DEV_PM_QOS_FLAGS,
6056 };
6157
@@ -97,14 +93,10 @@ struct pm_qos_flags { · 35 unmodified lines
9793 struct dev_pm_qos {
9894 struct pm_qos_constraints resume_latency;
9995 struct pm_qos_constraints latency_tolerance;
100− struct pm_qos_constraints min_frequency;
101− struct pm_qos_constraints max_frequency;
10296 struct pm_qos_flags flags;
10397 struct dev_pm_qos_request *resume_latency_req;
10498 struct dev_pm_qos_request *latency_tolerance_req;
10599 struct dev_pm_qos_request *flags_req;
106− struct dev_pm_qos_request *min_frequency_req;
107− struct dev_pm_qos_request *max_frequency_req;
108100 };
109101
110102 /* Action requested to pm_qos_update_target */
@@ -199,10 +191,6 @@ static inline s32 dev_pm_qos_read_value(struct device *dev, · 88 unmodified lines
199191 switch (type) {
200192 case DEV_PM_QOS_RESUME_LATENCY:
201193 return PM_QOS_RESUME_LATENCY_NO_CONSTRAINT;
202− case DEV_PM_QOS_MIN_FREQUENCY:
203− return PM_QOS_MIN_FREQUENCY_DEFAULT_VALUE;
204− case DEV_PM_QOS_MAX_FREQUENCY:
205− return PM_QOS_MAX_FREQUENCY_DEFAULT_VALUE;
206194 default:
207195 WARN_ON(1);
208196 return 0;
@@ -267,4 +255,48 @@ static inline s32 dev_pm_qos_raw_resume_latency(struct device *dev) · 58 unmodified lines
267255 }
268256 #endif
269257
258+#define FREQ_QOS_MIN_DEFAULT_VALUE 0
259+#define FREQ_QOS_MAX_DEFAULT_VALUE (-1)
260+
261+enum freq_qos_req_type {
262+ FREQ_QOS_MIN = 1,
263+ FREQ_QOS_MAX,
264+};
265+
266+struct freq_constraints {
267+ struct pm_qos_constraints min_freq;
268+ struct blocking_notifier_head min_freq_notifiers;
269+ struct pm_qos_constraints max_freq;
270+ struct blocking_notifier_head max_freq_notifiers;
271+};
272+
273+struct freq_qos_request {
274+ enum freq_qos_req_type type;
275+ struct plist_node pnode;
276+ struct freq_constraints *qos;
277+};
278+
279+static inline int freq_qos_request_active(struct freq_qos_request *req)
280+{
281+ return !IS_ERR_OR_NULL(req->qos);
282+}
283+
284+void freq_constraints_init(struct freq_constraints *qos);
285+
286+s32 freq_qos_read_value(struct freq_constraints *qos,
287+ enum freq_qos_req_type type);
288+
289+int freq_qos_add_request(struct freq_constraints *qos,
290+ struct freq_qos_request *req,
291+ enum freq_qos_req_type type, s32 value);
292+int freq_qos_update_request(struct freq_qos_request *req, s32 new_value);
293+int freq_qos_remove_request(struct freq_qos_request *req);
294+
295+int freq_qos_add_notifier(struct freq_constraints *qos,
296+ enum freq_qos_req_type type,
297+ struct notifier_block *notifier);
298+int freq_qos_remove_notifier(struct freq_constraints *qos,
299+ enum freq_qos_req_type type,
300+ struct notifier_block *notifier);
301+
270302 #endif
include/linux/sched.h+1−0
@@ -223,6 +223,7 @@ extern long schedule_timeout_uninterruptible(long timeout); · 222 unmodified lines
223223 extern long schedule_timeout_idle(long timeout);
224224 asmlinkage void schedule(void);
225225 extern void schedule_preempt_disabled(void);
226+asmlinkage void preempt_schedule_irq(void);
226227
227228 extern int __must_check io_schedule_prepare(void);
228229 extern void io_schedule_finish(int token);
include/linux/skbuff.h+3−2
@@ -3510,8 +3510,9 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len); · 3509 unmodified lines
35103510 int __skb_vlan_pop(struct sk_buff *skb, u16 *vlan_tci);
35113511 int skb_vlan_pop(struct sk_buff *skb);
35123512 int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
3513−int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto);
3514−int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto);
3513+int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
3514+ int mac_len);
3515+int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len);
35153516 int skb_mpls_update_lse(struct sk_buff *skb, __be32 mpls_lse);
35163517 int skb_mpls_dec_ttl(struct sk_buff *skb);
35173518 struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,
include/linux/sysfs.h+2−2
@@ -196,9 +196,9 @@ struct bin_attribute { · 195 unmodified lines
196196 .size = _size, \
197197 }
198198
199−#define __BIN_ATTR_WO(_name) { \
199+#define __BIN_ATTR_WO(_name, _size) { \
200200 .attr = { .name = __stringify(_name), .mode = 0200 }, \
201− .store = _name##_store, \
201+ .write = _name##_write, \
202202 .size = _size, \
203203 }
204204
include/linux/tcp.h+3−3
@@ -393,7 +393,7 @@ struct tcp_sock { · 392 unmodified lines
393393 /* fastopen_rsk points to request_sock that resulted in this big
394394 * socket. Used to retransmit SYNACKs etc.
395395 */
396− struct request_sock *fastopen_rsk;
396+ struct request_sock __rcu *fastopen_rsk;
397397 u32 *saved_syn;
398398 };
399399
@@ -447,8 +447,8 @@ static inline struct tcp_timewait_sock *tcp_twsk(const struct sock *sk) · 47 unmodified lines
447447
448448 static inline bool tcp_passive_fastopen(const struct sock *sk)
449449 {
450− return (sk->sk_state == TCP_SYN_RECV &&
451− tcp_sk(sk)->fastopen_rsk != NULL);
450+ return sk->sk_state == TCP_SYN_RECV &&
451+ rcu_access_pointer(tcp_sk(sk)->fastopen_rsk) != NULL;
452452 }
453453
454454 static inline void fastopen_queue_tune(struct sock *sk, int backlog)
include/linux/xarray.h+2−2
@@ -230,8 +230,8 @@ static inline int xa_err(void *entry) · 229 unmodified lines
230230 * This structure is used either directly or via the XA_LIMIT() macro
231231 * to communicate the range of IDs that are valid for allocation.
232232 * Two common ranges are predefined for you:
233− * * xa_limit_32b - [0 - UINT_MAX]
234− * * xa_limit_31b - [0 - INT_MAX]
233+ * * xa_limit_32b - [0 - UINT_MAX]
234+ * * xa_limit_31b - [0 - INT_MAX]
235235 */
236236 struct xa_limit {
237237 u32 max;
include/net/cfg80211.h+8−0
@@ -5549,6 +5549,14 @@ const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, · 5548 unmodified lines
55495549 */
55505550 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
55515551
5552+/**
5553+ * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
5554+ * @wiphy: wiphy for which pre-CAC capability is checked.
5555+ *
5556+ * Pre-CAC is allowed only in some regdomains (notable ETSI).
5557+ */
5558+bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
5559+
55525560 /**
55535561 * DOC: Internal regulatory db functions
55545562 *
include/net/llc_conn.h+1−1
@@ -104,7 +104,7 @@ void llc_sk_reset(struct sock *sk); · 103 unmodified lines
104104
105105 /* Access to a connection */
106106 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
107−int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
107+void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
108108 void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
109109 void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit);
110110 void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
include/net/net_namespace.h+17−8
@@ -52,6 +52,9 @@ struct bpf_prog; · 51 unmodified lines
5252 #define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
5353
5454 struct net {
55+ /* First cache line can be often dirtied.
56+ * Do not place here read-mostly fields.
57+ */
5558 refcount_t passive; /* To decide when the network
5659 * namespace should be freed.
5760 */
@@ -60,7 +63,13 @@ struct net { · 2 unmodified lines
6063 */
6164 spinlock_t rules_mod_lock;
6265
63− u32 hash_mix;
66+ unsigned int dev_unreg_count;
67+
68+ unsigned int dev_base_seq; /* protected by rtnl_mutex */
69+ int ifindex;
70+
71+ spinlock_t nsid_lock;
72+ atomic_t fnhe_genid;
6473
6574 struct list_head list; /* list of network namespaces */
6675 struct list_head exit_list; /* To linked to call pernet exit
@@ -76,11 +85,11 @@ struct net { · 9 unmodified lines
7685 #endif
7786 struct user_namespace *user_ns; /* Owning user namespace */
7887 struct ucounts *ucounts;
79− spinlock_t nsid_lock;
8088 struct idr netns_ids;
8189
8290 struct ns_common ns;
8391
92+ struct list_head dev_base_head;
8493 struct proc_dir_entry *proc_net;
8594 struct proc_dir_entry *proc_net_stat;
8695
@@ -93,17 +102,18 @@ struct net { · 6 unmodified lines
93102
94103 struct uevent_sock *uevent_sock; /* uevent socket */
95104
96− struct list_head dev_base_head;
97105 struct hlist_head *dev_name_head;
98106 struct hlist_head *dev_index_head;
99− unsigned int dev_base_seq; /* protected by rtnl_mutex */
100− int ifindex;
101− unsigned int dev_unreg_count;
107+ /* Note that @hash_mix can be read millions times per second,
108+ * it is critical that it is on a read_mostly cache line.
109+ */
110+ u32 hash_mix;
111+
112+ struct net_device *loopback_dev; /* The loopback */
102113
103114 /* core fib_rules */
104115 struct list_head rules_ops;
105116
106− struct net_device *loopback_dev; /* The loopback */
107117 struct netns_core core;
108118 struct netns_mib mib;
109119 struct netns_packet packet;
@@ -171,7 +181,6 @@ struct net { · 61 unmodified lines
171181 struct sock *crypto_nlsk;
172182 #endif
173183 struct sock *diag_nlsk;
174− atomic_t fnhe_genid;
175184 } __randomize_layout;
176185
177186 #include <linux/seq_file_net.h>
include/net/request_sock.h+2−2
@@ -185,7 +185,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, · 184 unmodified lines
185185
186186 static inline bool reqsk_queue_empty(const struct request_sock_queue *queue)
187187 {
188− return queue->rskq_accept_head == NULL;
188+ return READ_ONCE(queue->rskq_accept_head) == NULL;
189189 }
190190
191191 static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue,
@@ -197,7 +197,7 @@ static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue · 5 unmodified lines
197197 req = queue->rskq_accept_head;
198198 if (req) {
199199 sk_acceptq_removed(parent);
200− queue->rskq_accept_head = req->dl_next;
200+ WRITE_ONCE(queue->rskq_accept_head, req->dl_next);
201201 if (queue->rskq_accept_head == NULL)
202202 queue->rskq_accept_tail = NULL;
203203 }
include/net/sctp/sctp.h+5−0
@@ -610,4 +610,9 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize) · 609 unmodified lines
610610 return sctp_mtu_payload(sp, SCTP_DEFAULT_MINSEGMENT, datasize);
611611 }
612612
613+static inline bool sctp_newsk_ready(const struct sock *sk)
614+{
615+ return sock_flag(sk, SOCK_DEAD) || sk->sk_socket;
616+}
617+
613618 #endif /* __net_sctp_h__ */
include/net/sock.h+22−11
@@ -878,12 +878,17 @@ static inline bool sk_acceptq_is_full(const struct sock *sk) · 877 unmodified lines
878878 */
879879 static inline int sk_stream_min_wspace(const struct sock *sk)
880880 {
881− return sk->sk_wmem_queued >> 1;
881+ return READ_ONCE(sk->sk_wmem_queued) >> 1;
882882 }
883883
884884 static inline int sk_stream_wspace(const struct sock *sk)
885885 {
886− return sk->sk_sndbuf - sk->sk_wmem_queued;
886+ return READ_ONCE(sk->sk_sndbuf) - READ_ONCE(sk->sk_wmem_queued);
887+}
888+
889+static inline void sk_wmem_queued_add(struct sock *sk, int val)
890+{
891+ WRITE_ONCE(sk->sk_wmem_queued, sk->sk_wmem_queued + val);
887892 }
888893
889894 void sk_stream_write_space(struct sock *sk);
@@ -1207,7 +1212,7 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) · 317 unmodified lines
12071212
12081213 static inline bool __sk_stream_memory_free(const struct sock *sk, int wake)
12091214 {
1210− if (sk->sk_wmem_queued >= sk->sk_sndbuf)
1215+ if (READ_ONCE(sk->sk_wmem_queued) >= READ_ONCE(sk->sk_sndbuf))
12111216 return false;
12121217
12131218 return sk->sk_prot->stream_memory_free ?
@@ -1467,7 +1472,7 @@ DECLARE_STATIC_KEY_FALSE(tcp_tx_skb_cache_key); · 253 unmodified lines
14671472 static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb)
14681473 {
14691474 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
1470− sk->sk_wmem_queued -= skb->truesize;
1475+ sk_wmem_queued_add(sk, -skb->truesize);
14711476 sk_mem_uncharge(sk, skb->truesize);
14721477 if (static_branch_unlikely(&tcp_tx_skb_cache_key) &&
14731478 !sk->sk_tx_skb_cache && !skb_cloned(skb)) {
@@ -2014,7 +2019,7 @@ static inline int skb_copy_to_page_nocache(struct sock *sk, struct iov_iter *fro · 540 unmodified lines
20142019 skb->len += copy;
20152020 skb->data_len += copy;
20162021 skb->truesize += copy;
2017− sk->sk_wmem_queued += copy;
2022+ sk_wmem_queued_add(sk, copy);
20182023 sk_mem_charge(sk, copy);
20192024 return 0;
20202025 }
@@ -2220,10 +2225,14 @@ static inline void sk_wake_async(const struct sock *sk, int how, int band) · 199 unmodified lines
22202225
22212226 static inline void sk_stream_moderate_sndbuf(struct sock *sk)
22222227 {
2223− if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) {
2224− sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1);
2225− sk->sk_sndbuf = max_t(u32, sk->sk_sndbuf, SOCK_MIN_SNDBUF);
2226− }
2228+ u32 val;
2229+
2230+ if (sk->sk_userlocks & SOCK_SNDBUF_LOCK)
2231+ return;
2232+
2233+ val = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1);
2234+
2235+ WRITE_ONCE(sk->sk_sndbuf, max_t(u32, val, SOCK_MIN_SNDBUF));
22272236 }
22282237
22292238 struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
@@ -2251,7 +2260,7 @@ bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag); · 21 unmodified lines
22512260 */
22522261 static inline bool sock_writeable(const struct sock *sk)
22532262 {
2254− return refcount_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1);
2263+ return refcount_read(&sk->sk_wmem_alloc) < (READ_ONCE(sk->sk_sndbuf) >> 1);
22552264 }
22562265
22572266 static inline gfp_t gfp_any(void)
@@ -2271,7 +2280,9 @@ static inline long sock_sndtimeo(const struct sock *sk, bool noblock) · 13 unmodified lines
22712280
22722281 static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len)
22732282 {
2274− return (waitall ? len : min_t(int, sk->sk_rcvlowat, len)) ? : 1;
2283+ int v = waitall ? len : min_t(int, READ_ONCE(sk->sk_rcvlowat), len);
2284+
2285+ return v ?: 1;
22752286 }
22762287
22772288 /* Alas, with timeout socket operations are not restartable.
include/net/tcp.h+6−4
@@ -258,7 +258,7 @@ static inline bool tcp_under_memory_pressure(const struct sock *sk) · 257 unmodified lines
258258 mem_cgroup_under_socket_pressure(sk->sk_memcg))
259259 return true;
260260
261− return tcp_memory_pressure;
261+ return READ_ONCE(tcp_memory_pressure);
262262 }
263263 /*
264264 * The next routines deal with comparing 32 bit unsigned ints
@@ -1380,13 +1380,14 @@ static inline int tcp_win_from_space(const struct sock *sk, int space) · 1115 unmodified lines
13801380 /* Note: caller must be prepared to deal with negative returns */
13811381 static inline int tcp_space(const struct sock *sk)
13821382 {
1383− return tcp_win_from_space(sk, sk->sk_rcvbuf - sk->sk_backlog.len -
1383+ return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf) -
1384+ READ_ONCE(sk->sk_backlog.len) -
13841385 atomic_read(&sk->sk_rmem_alloc));
13851386 }
13861387
13871388 static inline int tcp_full_space(const struct sock *sk)
13881389 {
1389− return tcp_win_from_space(sk, sk->sk_rcvbuf);
1390+ return tcp_win_from_space(sk, READ_ONCE(sk->sk_rcvbuf));
13901391 }
13911392
13921393 extern void tcp_openreq_init_rwin(struct request_sock *req,
@@ -1916,7 +1917,8 @@ static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) · 523 unmodified lines
19161917 static inline bool tcp_stream_memory_free(const struct sock *sk, int wake)
19171918 {
19181919 const struct tcp_sock *tp = tcp_sk(sk);
1919− u32 notsent_bytes = tp->write_seq - tp->snd_nxt;
1920+ u32 notsent_bytes = READ_ONCE(tp->write_seq) -
1921+ READ_ONCE(tp->snd_nxt);
19201922
19211923 return (notsent_bytes << wake) < tcp_notsent_lowat(tp);
19221924 }
include/scsi/scsi_eh.h+1−0
@@ -32,6 +32,7 @@ extern int scsi_ioctl_reset(struct scsi_device *, int __user *); · 31 unmodified lines
3232 struct scsi_eh_save {
3333 /* saved state */
3434 int result;
35+ unsigned int resid_len;
3536 int eh_eflags;
3637 enum dma_data_direction data_direction;
3738 unsigned underflow;
include/sound/hda_register.h+3−0
@@ -264,6 +264,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; · 263 unmodified lines
264264 #define AZX_REG_ML_LOUTPAY 0x20
265265 #define AZX_REG_ML_LINPAY 0x30
266266
267+/* bit0 is reserved, with BIT(1) mapping to stream1 */
268+#define ML_LOSIDV_STREAM_MASK 0xFFFE
269+
267270 #define ML_LCTL_SCF_MASK 0xF
268271 #define AZX_MLCTL_SPA (0x1 << 16)
269272 #define AZX_MLCTL_CPA (0x1 << 23)
include/sound/simple_card_utils.h+4−4
@@ -135,9 +135,9 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, · 134 unmodified lines
135135 struct link_info *li);
136136
137137 #ifdef DEBUG
138−inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
139− char *name,
140− struct asoc_simple_dai *dai)
138+static inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv,
139+ char *name,
140+ struct asoc_simple_dai *dai)
141141 {
142142 struct device *dev = simple_priv_to_dev(priv);
143143
@@ -167,7 +167,7 @@ inline void asoc_simple_debug_dai(struct asoc_simple_priv *priv, · 23 unmodified lines
167167 dev_dbg(dev, "%s clk %luHz\n", name, clk_get_rate(dai->clk));
168168 }
169169
170−inline void asoc_simple_debug_info(struct asoc_simple_priv *priv)
170+static inline void asoc_simple_debug_info(struct asoc_simple_priv *priv)
171171 {
172172 struct snd_soc_card *card = simple_priv_to_card(priv);
173173 struct device *dev = simple_priv_to_dev(priv);
include/trace/events/btrfs.h+2−1
@@ -1688,6 +1688,7 @@ TRACE_EVENT(qgroup_update_reserve, · 1687 unmodified lines
16881688 __entry->qgid = qgroup->qgroupid;
16891689 __entry->cur_reserved = qgroup->rsv.values[type];
16901690 __entry->diff = diff;
1691+ __entry->type = type;
16911692 ),
16921693
16931694 TP_printk_btrfs("qgid=%llu type=%s cur_reserved=%llu diff=%lld",
@@ -1710,6 +1711,7 @@ TRACE_EVENT(qgroup_meta_reserve, · 16 unmodified lines
17101711 TP_fast_assign_btrfs(root->fs_info,
17111712 __entry->refroot = root->root_key.objectid;
17121713 __entry->diff = diff;
1714+ __entry->type = type;
17131715 ),
17141716
17151717 TP_printk_btrfs("refroot=%llu(%s) type=%s diff=%lld",
@@ -1726,7 +1728,6 @@ TRACE_EVENT(qgroup_meta_convert, · 10 unmodified lines
17261728 TP_STRUCT__entry_btrfs(
17271729 __field( u64, refroot )
17281730 __field( s64, diff )
1729− __field( int, type )
17301731 ),
17311732
17321733 TP_fast_assign_btrfs(root->fs_info,
include/trace/events/rxrpc.h+9−9
@@ -519,10 +519,10 @@ TRACE_EVENT(rxrpc_local, · 518 unmodified lines
519519 );
520520
521521 TRACE_EVENT(rxrpc_peer,
522− TP_PROTO(struct rxrpc_peer *peer, enum rxrpc_peer_trace op,
522+ TP_PROTO(unsigned int peer_debug_id, enum rxrpc_peer_trace op,
523523 int usage, const void *where),
524524
525− TP_ARGS(peer, op, usage, where),
525+ TP_ARGS(peer_debug_id, op, usage, where),
526526
527527 TP_STRUCT__entry(
528528 __field(unsigned int, peer )
@@ -532,7 +532,7 @@ TRACE_EVENT(rxrpc_peer, · 3 unmodified lines
532532 ),
533533
534534 TP_fast_assign(
535− __entry->peer = peer->debug_id;
535+ __entry->peer = peer_debug_id;
536536 __entry->op = op;
537537 __entry->usage = usage;
538538 __entry->where = where;
@@ -546,10 +546,10 @@ TRACE_EVENT(rxrpc_peer, · 7 unmodified lines
546546 );
547547
548548 TRACE_EVENT(rxrpc_conn,
549− TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op,
549+ TP_PROTO(unsigned int conn_debug_id, enum rxrpc_conn_trace op,
550550 int usage, const void *where),
551551
552− TP_ARGS(conn, op, usage, where),
552+ TP_ARGS(conn_debug_id, op, usage, where),
553553
554554 TP_STRUCT__entry(
555555 __field(unsigned int, conn )
@@ -559,7 +559,7 @@ TRACE_EVENT(rxrpc_conn, · 3 unmodified lines
559559 ),
560560
561561 TP_fast_assign(
562− __entry->conn = conn->debug_id;
562+ __entry->conn = conn_debug_id;
563563 __entry->op = op;
564564 __entry->usage = usage;
565565 __entry->where = where;
@@ -606,10 +606,10 @@ TRACE_EVENT(rxrpc_client, · 40 unmodified lines
606606 );
607607
608608 TRACE_EVENT(rxrpc_call,
609− TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
609+ TP_PROTO(unsigned int call_debug_id, enum rxrpc_call_trace op,
610610 int usage, const void *where, const void *aux),
611611
612− TP_ARGS(call, op, usage, where, aux),
612+ TP_ARGS(call_debug_id, op, usage, where, aux),
613613
614614 TP_STRUCT__entry(
615615 __field(unsigned int, call )
@@ -620,7 +620,7 @@ TRACE_EVENT(rxrpc_call, · 4 unmodified lines
620620 ),
621621
622622 TP_fast_assign(
623− __entry->call = call->debug_id;
623+ __entry->call = call_debug_id;
624624 __entry->op = op;
625625 __entry->usage = usage;
626626 __entry->where = where;
include/trace/events/sock.h+2−2
@@ -82,7 +82,7 @@ TRACE_EVENT(sock_rcvqueue_full, · 81 unmodified lines
8282 TP_fast_assign(
8383 __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);
8484 __entry->truesize = skb->truesize;
85− __entry->sk_rcvbuf = sk->sk_rcvbuf;
85+ __entry->sk_rcvbuf = READ_ONCE(sk->sk_rcvbuf);
8686 ),
8787
8888 TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d",
@@ -115,7 +115,7 @@ TRACE_EVENT(sock_exceed_buf_limit, · 26 unmodified lines
115115 __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);
116116 __entry->sysctl_wmem = sk_get_wmem0(sk, prot);
117117 __entry->wmem_alloc = refcount_read(&sk->sk_wmem_alloc);
118− __entry->wmem_queued = sk->sk_wmem_queued;
118+ __entry->wmem_queued = READ_ONCE(sk->sk_wmem_queued);
119119 __entry->kind = kind;
120120 ),
121121
kernel/events/core.c+2−2
@@ -6965,7 +6965,7 @@ static void __perf_event_output_stop(struct perf_event *event, void *data) · 6964 unmodified lines
69656965 static int __perf_pmu_output_stop(void *info)
69666966 {
69676967 struct perf_event *event = info;
6968− struct pmu *pmu = event->pmu;
6968+ struct pmu *pmu = event->ctx->pmu;
69696969 struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context);
69706970 struct remote_output ro = {
69716971 .rb = event->rb,
@@ -10660,7 +10660,7 @@ static int perf_copy_attr(struct perf_event_attr __user *uattr, · 3688 unmodified lines
1066010660
1066110661 attr->size = size;
1066210662
10663− if (attr->__reserved_1)
10663+ if (attr->__reserved_1 || attr->__reserved_2)
1066410664 return -EINVAL;
1066510665
1066610666 if (attr->sample_type & ~(PERF_SAMPLE_MAX-1))
kernel/events/uprobes.c+11−2
@@ -474,14 +474,17 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm, · 473 unmodified lines
474474 struct vm_area_struct *vma;
475475 int ret, is_register, ref_ctr_updated = 0;
476476 bool orig_page_huge = false;
477+ unsigned int gup_flags = FOLL_FORCE;
477478
478479 is_register = is_swbp_insn(&opcode);
479480 uprobe = container_of(auprobe, struct uprobe, arch);
480481
481482 retry:
483+ if (is_register)
484+ gup_flags |= FOLL_SPLIT_PMD;
482485 /* Read the page with vaddr into memory */
483− ret = get_user_pages_remote(NULL, mm, vaddr, 1,
484− FOLL_FORCE | FOLL_SPLIT_PMD, &old_page, &vma, NULL);
486+ ret = get_user_pages_remote(NULL, mm, vaddr, 1, gup_flags,
487+ &old_page, &vma, NULL);
485488 if (ret <= 0)
486489 return ret;
487490
@@ -489,6 +492,12 @@ retry: · 1 unmodified line
489492 if (ret <= 0)
490493 goto put_old;
491494
495+ if (WARN(!is_register && PageCompound(old_page),
496+ "uprobe unregister should never work on compound page\n")) {
497+ ret = -EINVAL;
498+ goto put_old;
499+ }
500+
492501 /* We are going to replace instruction, update ref_ctr. */
493502 if (!ref_ctr_updated && uprobe->ref_ctr_offset) {
494503 ret = update_ref_ctr(uprobe, mm, is_register ? 1 : -1);
kernel/gen_kheaders.sh+7−4
@@ -71,10 +71,13 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 · 70 unmodified lines
7171 find $cpio_dir -type f -print0 |
7272 xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
7373
74−# Create archive and try to normalize metadata for reproducibility
75−tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
76− --owner=0 --group=0 --sort=name --numeric-owner \
77− -Jcf $tarfile -C $cpio_dir/ . > /dev/null
74+# Create archive and try to normalize metadata for reproducibility.
75+# For compatibility with older versions of tar, files are fed to tar
76+# pre-sorted, as --sort=name might not be available.
77+find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \
78+ tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
79+ --owner=0 --group=0 --numeric-owner --no-recursion \
80+ -Jcf $tarfile -C $cpio_dir/ -T - > /dev/null
7881
7982 echo "$src_files_md5" > kernel/kheaders.md5
8083 echo "$obj_files_md5" >> kernel/kheaders.md5
kernel/kthread.c+3−3
@@ -866,9 +866,9 @@ void kthread_delayed_work_timer_fn(struct timer_list *t) · 865 unmodified lines
866866 }
867867 EXPORT_SYMBOL(kthread_delayed_work_timer_fn);
868868
869−void __kthread_queue_delayed_work(struct kthread_worker *worker,
870− struct kthread_delayed_work *dwork,
871− unsigned long delay)
869+static void __kthread_queue_delayed_work(struct kthread_worker *worker,
870+ struct kthread_delayed_work *dwork,
871+ unsigned long delay)
872872 {
873873 struct timer_list *timer = &dwork->timer;
874874 struct kthread_work *work = &dwork->work;
kernel/power/main.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/seq_file.h>
1616 #include <linux/suspend.h>
1717 #include <linux/syscalls.h>
18+#include <linux/pm_runtime.h>
1819
1920 #include "power.h"
2021
kernel/power/qos.c+240−0
@@ -650,3 +650,243 @@ static int __init pm_qos_power_init(void) · 649 unmodified lines
650650 }
651651
652652 late_initcall(pm_qos_power_init);
653+
654+/* Definitions related to the frequency QoS below. */
655+
656+/**
657+ * freq_constraints_init - Initialize frequency QoS constraints.
658+ * @qos: Frequency QoS constraints to initialize.
659+ */
660+void freq_constraints_init(struct freq_constraints *qos)
661+{
662+ struct pm_qos_constraints *c;
663+
664+ c = &qos->min_freq;
665+ plist_head_init(&c->list);
666+ c->target_value = FREQ_QOS_MIN_DEFAULT_VALUE;
667+ c->default_value = FREQ_QOS_MIN_DEFAULT_VALUE;
668+ c->no_constraint_value = FREQ_QOS_MIN_DEFAULT_VALUE;
669+ c->type = PM_QOS_MAX;
670+ c->notifiers = &qos->min_freq_notifiers;
671+ BLOCKING_INIT_NOTIFIER_HEAD(c->notifiers);
672+
673+ c = &qos->max_freq;
674+ plist_head_init(&c->list);
675+ c->target_value = FREQ_QOS_MAX_DEFAULT_VALUE;
676+ c->default_value = FREQ_QOS_MAX_DEFAULT_VALUE;
677+ c->no_constraint_value = FREQ_QOS_MAX_DEFAULT_VALUE;
678+ c->type = PM_QOS_MIN;
679+ c->notifiers = &qos->max_freq_notifiers;
680+ BLOCKING_INIT_NOTIFIER_HEAD(c->notifiers);
681+}
682+
683+/**
684+ * freq_qos_read_value - Get frequency QoS constraint for a given list.
685+ * @qos: Constraints to evaluate.
686+ * @type: QoS request type.
687+ */
688+s32 freq_qos_read_value(struct freq_constraints *qos,
689+ enum freq_qos_req_type type)
690+{
691+ s32 ret;
692+
693+ switch (type) {
694+ case FREQ_QOS_MIN:
695+ ret = IS_ERR_OR_NULL(qos) ?
696+ FREQ_QOS_MIN_DEFAULT_VALUE :
697+ pm_qos_read_value(&qos->min_freq);
698+ break;
699+ case FREQ_QOS_MAX:
700+ ret = IS_ERR_OR_NULL(qos) ?
701+ FREQ_QOS_MAX_DEFAULT_VALUE :
702+ pm_qos_read_value(&qos->max_freq);
703+ break;
704+ default:
705+ WARN_ON(1);
706+ ret = 0;
707+ }
708+
709+ return ret;
710+}
711+
712+/**
713+ * freq_qos_apply - Add/modify/remove frequency QoS request.
714+ * @req: Constraint request to apply.
715+ * @action: Action to perform (add/update/remove).
716+ * @value: Value to assign to the QoS request.
717+ */
718+static int freq_qos_apply(struct freq_qos_request *req,
719+ enum pm_qos_req_action action, s32 value)
720+{
721+ int ret;
722+
723+ switch(req->type) {
724+ case FREQ_QOS_MIN:
725+ ret = pm_qos_update_target(&req->qos->min_freq, &req->pnode,
726+ action, value);
727+ break;
728+ case FREQ_QOS_MAX:
729+ ret = pm_qos_update_target(&req->qos->max_freq, &req->pnode,
730+ action, value);
731+ break;
732+ default:
733+ ret = -EINVAL;
734+ }
735+
736+ return ret;
737+}
738+
739+/**
740+ * freq_qos_add_request - Insert new frequency QoS request into a given list.
741+ * @qos: Constraints to update.
742+ * @req: Preallocated request object.
743+ * @type: Request type.
744+ * @value: Request value.
745+ *
746+ * Insert a new entry into the @qos list of requests, recompute the effective
747+ * QoS constraint value for that list and initialize the @req object. The
748+ * caller needs to save that object for later use in updates and removal.
749+ *
750+ * Return 1 if the effective constraint value has changed, 0 if the effective
751+ * constraint value has not changed, or a negative error code on failures.
752+ */
753+int freq_qos_add_request(struct freq_constraints *qos,
754+ struct freq_qos_request *req,
755+ enum freq_qos_req_type type, s32 value)
756+{
757+ int ret;
758+
759+ if (IS_ERR_OR_NULL(qos) || !req)
760+ return -EINVAL;
761+
762+ if (WARN(freq_qos_request_active(req),
763+ "%s() called for active request\n", __func__))
764+ return -EINVAL;
765+
766+ req->qos = qos;
767+ req->type = type;
768+ ret = freq_qos_apply(req, PM_QOS_ADD_REQ, value);
769+ if (ret < 0) {
770+ req->qos = NULL;
771+ req->type = 0;
772+ }
773+
774+ return ret;
775+}
776+EXPORT_SYMBOL_GPL(freq_qos_add_request);
777+
778+/**
779+ * freq_qos_update_request - Modify existing frequency QoS request.
780+ * @req: Request to modify.
781+ * @new_value: New request value.
782+ *
783+ * Update an existing frequency QoS request along with the effective constraint
784+ * value for the list of requests it belongs to.
785+ *
786+ * Return 1 if the effective constraint value has changed, 0 if the effective
787+ * constraint value has not changed, or a negative error code on failures.
788+ */
789+int freq_qos_update_request(struct freq_qos_request *req, s32 new_value)
790+{
791+ if (!req)
792+ return -EINVAL;
793+
794+ if (WARN(!freq_qos_request_active(req),
795+ "%s() called for unknown object\n", __func__))
796+ return -EINVAL;
797+
798+ if (req->pnode.prio == new_value)
799+ return 0;
800+
801+ return freq_qos_apply(req, PM_QOS_UPDATE_REQ, new_value);
802+}
803+EXPORT_SYMBOL_GPL(freq_qos_update_request);
804+
805+/**
806+ * freq_qos_remove_request - Remove frequency QoS request from its list.
807+ * @req: Request to remove.
808+ *
809+ * Remove the given frequency QoS request from the list of constraints it
810+ * belongs to and recompute the effective constraint value for that list.
811+ *
812+ * Return 1 if the effective constraint value has changed, 0 if the effective
813+ * constraint value has not changed, or a negative error code on failures.
814+ */
815+int freq_qos_remove_request(struct freq_qos_request *req)
816+{
817+ if (!req)
818+ return -EINVAL;
819+
820+ if (WARN(!freq_qos_request_active(req),
821+ "%s() called for unknown object\n", __func__))
822+ return -EINVAL;
823+
824+ return freq_qos_apply(req, PM_QOS_REMOVE_REQ, PM_QOS_DEFAULT_VALUE);
825+}
826+EXPORT_SYMBOL_GPL(freq_qos_remove_request);
827+
828+/**
829+ * freq_qos_add_notifier - Add frequency QoS change notifier.
830+ * @qos: List of requests to add the notifier to.
831+ * @type: Request type.
832+ * @notifier: Notifier block to add.
833+ */
834+int freq_qos_add_notifier(struct freq_constraints *qos,
835+ enum freq_qos_req_type type,
836+ struct notifier_block *notifier)
837+{
838+ int ret;
839+
840+ if (IS_ERR_OR_NULL(qos) || !notifier)
841+ return -EINVAL;
842+
843+ switch (type) {
844+ case FREQ_QOS_MIN:
845+ ret = blocking_notifier_chain_register(qos->min_freq.notifiers,
846+ notifier);
847+ break;
848+ case FREQ_QOS_MAX:
849+ ret = blocking_notifier_chain_register(qos->max_freq.notifiers,
850+ notifier);
851+ break;
852+ default:
853+ WARN_ON(1);
854+ ret = -EINVAL;
855+ }
856+
857+ return ret;
858+}
859+EXPORT_SYMBOL_GPL(freq_qos_add_notifier);
860+
861+/**
862+ * freq_qos_remove_notifier - Remove frequency QoS change notifier.
863+ * @qos: List of requests to remove the notifier from.
864+ * @type: Request type.
865+ * @notifier: Notifier block to remove.
866+ */
867+int freq_qos_remove_notifier(struct freq_constraints *qos,
868+ enum freq_qos_req_type type,
869+ struct notifier_block *notifier)
870+{
871+ int ret;
872+
873+ if (IS_ERR_OR_NULL(qos) || !notifier)
874+ return -EINVAL;
875+
876+ switch (type) {
877+ case FREQ_QOS_MIN:
878+ ret = blocking_notifier_chain_unregister(qos->min_freq.notifiers,
879+ notifier);
880+ break;
881+ case FREQ_QOS_MAX:
882+ ret = blocking_notifier_chain_unregister(qos->max_freq.notifiers,
883+ notifier);
884+ break;
885+ default:
886+ WARN_ON(1);
887+ ret = -EINVAL;
888+ }
889+
890+ return ret;
891+}
892+EXPORT_SYMBOL_GPL(freq_qos_remove_notifier);
kernel/stop_machine.c+6−4
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 * Copyright (C) 2010 SUSE Linux Products GmbH
88 * Copyright (C) 2010 Tejun Heo <tj@kernel.org>
99 */
10+#include <linux/compiler.h>
1011 #include <linux/completion.h>
1112 #include <linux/cpu.h>
1213 #include <linux/init.h>
@@ -167,7 +168,7 @@ static void set_state(struct multi_stop_data *msdata, · 154 unmodified lines
167168 /* Reset ack counter. */
168169 atomic_set(&msdata->thread_ack, msdata->num_threads);
169170 smp_wmb();
170− msdata->state = newstate;
171+ WRITE_ONCE(msdata->state, newstate);
171172 }
172173
173174 /* Last one to ack a state moves to the next state. */
@@ -186,7 +187,7 @@ void __weak stop_machine_yield(const struct cpumask *cpumask) · 12 unmodified lines
186187 static int multi_cpu_stop(void *data)
187188 {
188189 struct multi_stop_data *msdata = data;
189− enum multi_stop_state curstate = MULTI_STOP_NONE;
190+ enum multi_stop_state newstate, curstate = MULTI_STOP_NONE;
190191 int cpu = smp_processor_id(), err = 0;
191192 const struct cpumask *cpumask;
192193 unsigned long flags;
@@ -210,8 +211,9 @@ static int multi_cpu_stop(void *data) · 17 unmodified lines
210211 do {
211212 /* Chill out and ensure we re-read multi_stop_state. */
212213 stop_machine_yield(cpumask);
213− if (msdata->state != curstate) {
214− curstate = msdata->state;
214+ newstate = READ_ONCE(msdata->state);
215+ if (newstate != curstate) {
216+ curstate = newstate;
215217 switch (curstate) {
216218 case MULTI_STOP_DISABLE_IRQ:
217219 local_irq_disable();
kernel/sysctl.c+2−2
@@ -163,7 +163,7 @@ static unsigned long hung_task_timeout_max = (LONG_MAX/HZ); · 162 unmodified lines
163163 #ifdef CONFIG_SPARC
164164 #endif
165165
166−#ifdef __hppa__
166+#ifdef CONFIG_PARISC
167167 extern int pwrsw_enabled;
168168 #endif
169169
@@ -620,7 +620,7 @@ static struct ctl_table kern_table[] = { · 450 unmodified lines
620620 .proc_handler = proc_dointvec,
621621 },
622622 #endif
623−#ifdef __hppa__
623+#ifdef CONFIG_PARISC
624624 {
625625 .procname = "soft-power",
626626 .data = &pwrsw_enabled,
kernel/time/hrtimer.c+4−4
@@ -164,7 +164,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, · 163 unmodified lines
164164 struct hrtimer_clock_base *base;
165165
166166 for (;;) {
167− base = timer->base;
167+ base = READ_ONCE(timer->base);
168168 if (likely(base != &migration_base)) {
169169 raw_spin_lock_irqsave(&base->cpu_base->lock, *flags);
170170 if (likely(base == timer->base))
@@ -244,7 +244,7 @@ again: · 73 unmodified lines
244244 return base;
245245
246246 /* See the comment in lock_hrtimer_base() */
247− timer->base = &migration_base;
247+ WRITE_ONCE(timer->base, &migration_base);
248248 raw_spin_unlock(&base->cpu_base->lock);
249249 raw_spin_lock(&new_base->cpu_base->lock);
250250
@@ -253,10 +253,10 @@ again: · 2 unmodified lines
253253 raw_spin_unlock(&new_base->cpu_base->lock);
254254 raw_spin_lock(&base->cpu_base->lock);
255255 new_cpu_base = this_cpu_base;
256− timer->base = base;
256+ WRITE_ONCE(timer->base, base);
257257 goto again;
258258 }
259− timer->base = new_base;
259+ WRITE_ONCE(timer->base, new_base);
260260 } else {
261261 if (new_cpu_base != this_cpu_base &&
262262 hrtimer_check_target(timer, new_base)) {
kernel/time/posix-cpu-timers.c+3−3
@@ -266,7 +266,7 @@ static void update_gt_cputime(struct task_cputime_atomic *cputime_atomic, · 265 unmodified lines
266266 /**
267267 * thread_group_sample_cputime - Sample cputime for a given task
268268 * @tsk: Task for which cputime needs to be started
269− * @iimes: Storage for time samples
269+ * @samples: Storage for time samples
270270 *
271271 * Called from sys_getitimer() to calculate the expiry time of an active
272272 * timer. That means group cputime accounting is already active. Called
@@ -1038,12 +1038,12 @@ unlock: · 765 unmodified lines
10381038 * member of @pct->bases[CLK].nextevt. False otherwise
10391039 */
10401040 static inline bool
1041−task_cputimers_expired(const u64 *sample, struct posix_cputimers *pct)
1041+task_cputimers_expired(const u64 *samples, struct posix_cputimers *pct)
10421042 {
10431043 int i;
10441044
10451045 for (i = 0; i < CPUCLOCK_MAX; i++) {
1046− if (sample[i] >= pct->bases[i].nextevt)
1046+ if (samples[i] >= pct->bases[i].nextevt)
10471047 return true;
10481048 }
10491049 return false;
kernel/time/sched_clock.c+2−0
@@ -17,6 +17,8 @@ · 16 unmodified lines
1717 #include <linux/seqlock.h>
1818 #include <linux/bitops.h>
1919
20+#include "timekeeping.h"
21+
2022 /**
2123 * struct clock_read_data - data required to read from sched_clock()
2224 *
kernel/trace/trace_event_perf.c+4−0
@@ -277,9 +277,11 @@ int perf_kprobe_init(struct perf_event *p_event, bool is_retprobe) · 276 unmodified lines
277277 goto out;
278278 }
279279
280+ mutex_lock(&event_mutex);
280281 ret = perf_trace_event_init(tp_event, p_event);
281282 if (ret)
282283 destroy_local_trace_kprobe(tp_event);
284+ mutex_unlock(&event_mutex);
283285 out:
284286 kfree(func);
285287 return ret;
@@ -287,8 +289,10 @@ out: · 1 unmodified line
287289
288290 void perf_kprobe_destroy(struct perf_event *p_event)
289291 {
292+ mutex_lock(&event_mutex);
290293 perf_trace_event_close(p_event);
291294 perf_trace_event_unreg(p_event);
295+ mutex_unlock(&event_mutex);
292296
293297 destroy_local_trace_kprobe(p_event->tp_event);
294298 }
kernel/trace/trace_events_hist.c+2−0
@@ -679,6 +679,8 @@ static bool synth_field_signed(char *type) · 678 unmodified lines
679679 {
680680 if (str_has_prefix(type, "u"))
681681 return false;
682+ if (strcmp(type, "gfp_t") == 0)
683+ return false;
682684
683685 return true;
684686 }
lib/generic-radix-tree.c+26−6
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #include <linux/export.h>
33 #include <linux/generic-radix-tree.h>
44 #include <linux/gfp.h>
5+#include <linux/kmemleak.h>
56
67 #define GENRADIX_ARY (PAGE_SIZE / sizeof(struct genradix_node *))
78 #define GENRADIX_ARY_SHIFT ilog2(GENRADIX_ARY)
@@ -75,6 +76,27 @@ void *__genradix_ptr(struct __genradix *radix, size_t offset) · 67 unmodified lines
7576 }
7677 EXPORT_SYMBOL(__genradix_ptr);
7778
79+static inline struct genradix_node *genradix_alloc_node(gfp_t gfp_mask)
80+{
81+ struct genradix_node *node;
82+
83+ node = (struct genradix_node *)__get_free_page(gfp_mask|__GFP_ZERO);
84+
85+ /*
86+ * We're using pages (not slab allocations) directly for kernel data
87+ * structures, so we need to explicitly inform kmemleak of them in order
88+ * to avoid false positive memory leak reports.
89+ */
90+ kmemleak_alloc(node, PAGE_SIZE, 1, gfp_mask);
91+ return node;
92+}
93+
94+static inline void genradix_free_node(struct genradix_node *node)
95+{
96+ kmemleak_free(node);
97+ free_page((unsigned long)node);
98+}
99+
78100 /*
79101 * Returns pointer to the specified byte @offset within @radix, allocating it if
80102 * necessary - newly allocated slots are always zeroed out:
@@ -97,8 +119,7 @@ void *__genradix_ptr_alloc(struct __genradix *radix, size_t offset, · 16 unmodified lines
97119 break;
98120
99121 if (!new_node) {
100− new_node = (void *)
101− __get_free_page(gfp_mask|__GFP_ZERO);
122+ new_node = genradix_alloc_node(gfp_mask);
102123 if (!new_node)
103124 return NULL;
104125 }
@@ -121,8 +142,7 @@ void *__genradix_ptr_alloc(struct __genradix *radix, size_t offset, · 16 unmodified lines
121142 n = READ_ONCE(*p);
122143 if (!n) {
123144 if (!new_node) {
124− new_node = (void *)
125− __get_free_page(gfp_mask|__GFP_ZERO);
145+ new_node = genradix_alloc_node(gfp_mask);
126146 if (!new_node)
127147 return NULL;
128148 }
@@ -133,7 +153,7 @@ void *__genradix_ptr_alloc(struct __genradix *radix, size_t offset, · 4 unmodified lines
133153 }
134154
135155 if (new_node)
136− free_page((unsigned long) new_node);
156+ genradix_free_node(new_node);
137157
138158 return &n->data[offset];
139159 }
@@ -191,7 +211,7 @@ static void genradix_free_recurse(struct genradix_node *n, unsigned level) · 51 unmodified lines
191211 genradix_free_recurse(n->children[i], level - 1);
192212 }
193213
194− free_page((unsigned long) n);
214+ genradix_free_node(n);
195215 }
196216
197217 int __genradix_prealloc(struct __genradix *radix, size_t size,
lib/test_meminit.c+27−0
@@ -297,6 +297,32 @@ out: · 296 unmodified lines
297297 return 1;
298298 }
299299
300+static int __init do_kmem_cache_size_bulk(int size, int *total_failures)
301+{
302+ struct kmem_cache *c;
303+ int i, iter, maxiter = 1024;
304+ int num, bytes;
305+ bool fail = false;
306+ void *objects[10];
307+
308+ c = kmem_cache_create("test_cache", size, size, 0, NULL);
309+ for (iter = 0; (iter < maxiter) && !fail; iter++) {
310+ num = kmem_cache_alloc_bulk(c, GFP_KERNEL, ARRAY_SIZE(objects),
311+ objects);
312+ for (i = 0; i < num; i++) {
313+ bytes = count_nonzero_bytes(objects[i], size);
314+ if (bytes)
315+ fail = true;
316+ fill_with_garbage(objects[i], size);
317+ }
318+
319+ if (num)
320+ kmem_cache_free_bulk(c, num, objects);
321+ }
322+ *total_failures += fail;
323+ return 1;
324+}
325+
300326 /*
301327 * Test kmem_cache allocation by creating caches of different sizes, with and
302328 * without constructors, with and without SLAB_TYPESAFE_BY_RCU.
@@ -318,6 +344,7 @@ static int __init test_kmemcache(int *total_failures) · 15 unmodified lines
318344 num_tests += do_kmem_cache_size(size, ctor, rcu, zero,
319345 &failures);
320346 }
347+ num_tests += do_kmem_cache_size_bulk(size, &failures);
321348 }
322349 REPORT_FAILURES_IN_FN();
323350 *total_failures += failures;
lib/test_user_copy.c+28−9
@@ -47,18 +47,35 @@ static bool is_zeroed(void *from, size_t size) · 46 unmodified lines
4747 static int test_check_nonzero_user(char *kmem, char __user *umem, size_t size)
4848 {
4949 int ret = 0;
50− size_t start, end, i;
51− size_t zero_start = size / 4;
52− size_t zero_end = size - zero_start;
50+ size_t start, end, i, zero_start, zero_end;
51+
52+ if (test(size < 2 * PAGE_SIZE, "buffer too small"))
53+ return -EINVAL;
54+
55+ /*
56+ * We want to cross a page boundary to exercise the code more
57+ * effectively. We also don't want to make the size we scan too large,
58+ * otherwise the test can take a long time and cause soft lockups. So
59+ * scan a 1024 byte region across the page boundary.
60+ */
61+ size = 1024;
62+ start = PAGE_SIZE - (size / 2);
63+
64+ kmem += start;
65+ umem += start;
66+
67+ zero_start = size / 4;
68+ zero_end = size - zero_start;
5369
5470 /*
55− * We conduct a series of check_nonzero_user() tests on a block of memory
56− * with the following byte-pattern (trying every possible [start,end]
57− * pair):
71+ * We conduct a series of check_nonzero_user() tests on a block of
72+ * memory with the following byte-pattern (trying every possible
73+ * [start,end] pair):
5874 *
5975 * [ 00 ff 00 ff ... 00 00 00 00 ... ff 00 ff 00 ]
6076 *
61− * And we verify that check_nonzero_user() acts identically to memchr_inv().
77+ * And we verify that check_nonzero_user() acts identically to
78+ * memchr_inv().
6279 */
6380
6481 memset(kmem, 0x0, size);
@@ -93,11 +110,13 @@ static int test_copy_struct_from_user(char *kmem, char __user *umem, · 28 unmodified lines
93110 size_t ksize, usize;
94111
95112 umem_src = kmalloc(size, GFP_KERNEL);
96− if ((ret |= test(umem_src == NULL, "kmalloc failed")))
113+ ret = test(umem_src == NULL, "kmalloc failed");
114+ if (ret)
97115 goto out_free;
98116
99117 expected = kmalloc(size, GFP_KERNEL);
100− if ((ret |= test(expected == NULL, "kmalloc failed")))
118+ ret = test(expected == NULL, "kmalloc failed");
119+ if (ret)
101120 goto out_free;
102121
103122 /* Fill umem with a fixed byte pattern. */
lib/vdso/gettimeofday.c+5−4
@@ -214,9 +214,10 @@ int __cvdso_clock_getres_common(clockid_t clock, struct __kernel_timespec *res) · 213 unmodified lines
214214 return -1;
215215 }
216216
217− res->tv_sec = 0;
218− res->tv_nsec = ns;
219−
217+ if (likely(res)) {
218+ res->tv_sec = 0;
219+ res->tv_nsec = ns;
220+ }
220221 return 0;
221222 }
222223
@@ -245,7 +246,7 @@ __cvdso_clock_getres_time32(clockid_t clock, struct old_timespec32 *res) · 22 unmodified lines
245246 ret = clock_getres_fallback(clock, &ts);
246247 #endif
247248
248− if (likely(!ret)) {
249+ if (likely(!ret && res)) {
249250 res->tv_sec = ts.tv_sec;
250251 res->tv_nsec = ts.tv_nsec;
251252 }
mm/compaction.c+4−3
@@ -270,14 +270,15 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 269 unmodified lines
270270
271271 /* Ensure the start of the pageblock or zone is online and valid */
272272 block_pfn = pageblock_start_pfn(pfn);
273− block_page = pfn_to_online_page(max(block_pfn, zone->zone_start_pfn));
273+ block_pfn = max(block_pfn, zone->zone_start_pfn);
274+ block_page = pfn_to_online_page(block_pfn);
274275 if (block_page) {
275276 page = block_page;
276277 pfn = block_pfn;
277278 }
278279
279280 /* Ensure the end of the pageblock or zone is online and valid */
280− block_pfn += pageblock_nr_pages;
281+ block_pfn = pageblock_end_pfn(pfn) - 1;
281282 block_pfn = min(block_pfn, zone_end_pfn(zone) - 1);
282283 end_page = pfn_to_online_page(block_pfn);
283284 if (!end_page)
@@ -303,7 +304,7 @@ __reset_isolation_pfn(struct zone *zone, unsigned long pfn, bool check_source, · 19 unmodified lines
303304
304305 page += (1 << PAGE_ALLOC_COSTLY_ORDER);
305306 pfn += (1 << PAGE_ALLOC_COSTLY_ORDER);
306− } while (page < end_page);
307+ } while (page <= end_page);
307308
308309 return false;
309310 }
mm/filemap.c+1−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #include <linux/rmap.h>
4141 #include <linux/delayacct.h>
4242 #include <linux/psi.h>
43+#include <linux/ramfs.h>
4344 #include "internal.h"
4445
4546 #define CREATE_TRACE_POINTS
mm/gup.c+8−6
@@ -1973,7 +1973,8 @@ static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end, · 1972 unmodified lines
19731973 }
19741974
19751975 static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
1976− unsigned long end, int write, struct page **pages, int *nr)
1976+ unsigned long end, unsigned int flags,
1977+ struct page **pages, int *nr)
19771978 {
19781979 unsigned long pte_end;
19791980 struct page *head, *page;
@@ -1986,7 +1987,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, · 6 unmodified lines
19861987
19871988 pte = READ_ONCE(*ptep);
19881989
1989− if (!pte_access_permitted(pte, write))
1990+ if (!pte_access_permitted(pte, flags & FOLL_WRITE))
19901991 return 0;
19911992
19921993 /* hugepages are never "special" */
@@ -2023,7 +2024,7 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, · 30 unmodified lines
20232024 }
20242025
20252026 static int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
2026− unsigned int pdshift, unsigned long end, int write,
2027+ unsigned int pdshift, unsigned long end, unsigned int flags,
20272028 struct page **pages, int *nr)
20282029 {
20292030 pte_t *ptep;
@@ -2033,7 +2034,7 @@ static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, · 3 unmodified lines
20332034 ptep = hugepte_offset(hugepd, addr, pdshift);
20342035 do {
20352036 next = hugepte_addr_end(addr, end, sz);
2036− if (!gup_hugepte(ptep, sz, addr, end, write, pages, nr))
2037+ if (!gup_hugepte(ptep, sz, addr, end, flags, pages, nr))
20372038 return 0;
20382039 } while (ptep++, addr = next, addr != end);
20392040
@@ -2041,7 +2042,7 @@ static int gup_huge_pd(hugepd_t hugepd, unsigned long addr, · 1 unmodified line
20412042 }
20422043 #else
20432044 static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr,
2044− unsigned pdshift, unsigned long end, int write,
2045+ unsigned int pdshift, unsigned long end, unsigned int flags,
20452046 struct page **pages, int *nr)
20462047 {
20472048 return 0;
@@ -2049,7 +2050,8 @@ static inline int gup_huge_pd(hugepd_t hugepd, unsigned long addr, · 1 unmodified line
20492050 #endif /* CONFIG_ARCH_HAS_HUGEPD */
20502051
20512052 static int gup_huge_pmd(pmd_t orig, pmd_t *pmdp, unsigned long addr,
2052− unsigned long end, unsigned int flags, struct page **pages, int *nr)
2053+ unsigned long end, unsigned int flags,
2054+ struct page **pages, int *nr)
20532055 {
20542056 struct page *head, *page;
20552057 int refs;
mm/huge_memory.c+7−2
@@ -2789,8 +2789,13 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) · 2788 unmodified lines
27892789 ds_queue->split_queue_len--;
27902790 list_del(page_deferred_list(head));
27912791 }
2792− if (mapping)
2793− __dec_node_page_state(page, NR_SHMEM_THPS);
2792+ if (mapping) {
2793+ if (PageSwapBacked(page))
2794+ __dec_node_page_state(page, NR_SHMEM_THPS);
2795+ else
2796+ __dec_node_page_state(page, NR_FILE_THPS);
2797+ }
2798+
27942799 spin_unlock(&ds_queue->split_queue_lock);
27952800 __split_huge_page(page, list, end, flags);
27962801 if (PageSwapCache(head)) {
mm/hugetlb.c+2−3
@@ -1084,11 +1084,10 @@ static bool pfn_range_valid_gigantic(struct zone *z, · 1083 unmodified lines
10841084 struct page *page;
10851085
10861086 for (i = start_pfn; i < end_pfn; i++) {
1087− if (!pfn_valid(i))
1087+ page = pfn_to_online_page(i);
1088+ if (!page)
10881089 return false;
10891090
1090− page = pfn_to_page(i);
1091−
10921091 if (page_zone(page) != z)
10931092 return false;
10941093
mm/init-mm.c+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/spinlock.h>
66 #include <linux/list.h>
77 #include <linux/cpumask.h>
8+#include <linux/mman.h>
89
910 #include <linux/atomic.h>
1011 #include <linux/user_namespace.h>
mm/kmemleak.c+21−9
@@ -526,6 +526,16 @@ static struct kmemleak_object *find_and_get_object(unsigned long ptr, int alias) · 525 unmodified lines
526526 return object;
527527 }
528528
529+/*
530+ * Remove an object from the object_tree_root and object_list. Must be called
531+ * with the kmemleak_lock held _if_ kmemleak is still enabled.
532+ */
533+static void __remove_object(struct kmemleak_object *object)
534+{
535+ rb_erase(&object->rb_node, &object_tree_root);
536+ list_del_rcu(&object->object_list);
537+}
538+
529539 /*
530540 * Look up an object in the object search tree and remove it from both
531541 * object_tree_root and object_list. The returned object's use_count should be
@@ -538,10 +548,8 @@ static struct kmemleak_object *find_and_remove_object(unsigned long ptr, int ali · 6 unmodified lines
538548
539549 write_lock_irqsave(&kmemleak_lock, flags);
540550 object = lookup_object(ptr, alias);
541− if (object) {
542− rb_erase(&object->rb_node, &object_tree_root);
543− list_del_rcu(&object->object_list);
544− }
551+ if (object)
552+ __remove_object(object);
545553 write_unlock_irqrestore(&kmemleak_lock, flags);
546554
547555 return object;
@@ -1834,12 +1842,16 @@ static const struct file_operations kmemleak_fops = { · 1286 unmodified lines
18341842
18351843 static void __kmemleak_do_cleanup(void)
18361844 {
1837− struct kmemleak_object *object;
1845+ struct kmemleak_object *object, *tmp;
18381846
1839− rcu_read_lock();
1840− list_for_each_entry_rcu(object, &object_list, object_list)
1841− delete_object_full(object->pointer);
1842− rcu_read_unlock();
1847+ /*
1848+ * Kmemleak has already been disabled, no need for RCU list traversal
1849+ * or kmemleak_lock held.
1850+ */
1851+ list_for_each_entry_safe(object, tmp, &object_list, object_list) {
1852+ __remove_object(object);
1853+ __delete_object(object);
1854+ }
18431855 }
18441856
18451857 /*
mm/memblock.c+3−3
@@ -1356,9 +1356,6 @@ static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, · 1355 unmodified lines
13561356 align = SMP_CACHE_BYTES;
13571357 }
13581358
1359− if (end > memblock.current_limit)
1360− end = memblock.current_limit;
1361−
13621359 again:
13631360 found = memblock_find_in_range_node(size, align, start, end, nid,
13641361 flags);
@@ -1469,6 +1466,9 @@ static void * __init memblock_alloc_internal( · 104 unmodified lines
14691466 if (WARN_ON_ONCE(slab_is_available()))
14701467 return kzalloc_node(size, GFP_NOWAIT, nid);
14711468
1469+ if (max_addr > memblock.current_limit)
1470+ max_addr = memblock.current_limit;
1471+
14721472 alloc = memblock_alloc_range_nid(size, align, min_addr, max_addr, nid);
14731473
14741474 /* retry allocation without lower limit */
mm/memcontrol.c+12−6
@@ -5420,6 +5420,8 @@ static int mem_cgroup_move_account(struct page *page, · 5419 unmodified lines
54205420 struct mem_cgroup *from,
54215421 struct mem_cgroup *to)
54225422 {
5423+ struct lruvec *from_vec, *to_vec;
5424+ struct pglist_data *pgdat;
54235425 unsigned long flags;
54245426 unsigned int nr_pages = compound ? hpage_nr_pages(page) : 1;
54255427 int ret;
@@ -5443,11 +5445,15 @@ static int mem_cgroup_move_account(struct page *page, · 17 unmodified lines
54435445
54445446 anon = PageAnon(page);
54455447
5448+ pgdat = page_pgdat(page);
5449+ from_vec = mem_cgroup_lruvec(pgdat, from);
5450+ to_vec = mem_cgroup_lruvec(pgdat, to);
5451+
54465452 spin_lock_irqsave(&from->move_lock, flags);
54475453
54485454 if (!anon && page_mapped(page)) {
5449− __mod_memcg_state(from, NR_FILE_MAPPED, -nr_pages);
5450− __mod_memcg_state(to, NR_FILE_MAPPED, nr_pages);
5455+ __mod_lruvec_state(from_vec, NR_FILE_MAPPED, -nr_pages);
5456+ __mod_lruvec_state(to_vec, NR_FILE_MAPPED, nr_pages);
54515457 }
54525458
54535459 /*
@@ -5459,14 +5465,14 @@ static int mem_cgroup_move_account(struct page *page, · 5 unmodified lines
54595465 struct address_space *mapping = page_mapping(page);
54605466
54615467 if (mapping_cap_account_dirty(mapping)) {
5462− __mod_memcg_state(from, NR_FILE_DIRTY, -nr_pages);
5463− __mod_memcg_state(to, NR_FILE_DIRTY, nr_pages);
5468+ __mod_lruvec_state(from_vec, NR_FILE_DIRTY, -nr_pages);
5469+ __mod_lruvec_state(to_vec, NR_FILE_DIRTY, nr_pages);
54645470 }
54655471 }
54665472
54675473 if (PageWriteback(page)) {
5468− __mod_memcg_state(from, NR_WRITEBACK, -nr_pages);
5469− __mod_memcg_state(to, NR_WRITEBACK, nr_pages);
5474+ __mod_lruvec_state(from_vec, NR_WRITEBACK, -nr_pages);
5475+ __mod_lruvec_state(to_vec, NR_WRITEBACK, nr_pages);
54705476 }
54715477
54725478 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
mm/memory-failure.c+21−15
@@ -199,7 +199,6 @@ struct to_kill { · 198 unmodified lines
199199 struct task_struct *tsk;
200200 unsigned long addr;
201201 short size_shift;
202− char addr_valid;
203202 };
204203
205204 /*
@@ -324,22 +323,27 @@ static void add_to_kill(struct task_struct *tsk, struct page *p, · 118 unmodified lines
324323 }
325324 }
326325 tk->addr = page_address_in_vma(p, vma);
327− tk->addr_valid = 1;
328326 if (is_zone_device_page(p))
329327 tk->size_shift = dev_pagemap_mapping_shift(p, vma);
330328 else
331329 tk->size_shift = compound_order(compound_head(p)) + PAGE_SHIFT;
332330
333331 /*
334− * In theory we don't have to kill when the page was
335− * munmaped. But it could be also a mremap. Since that's
336− * likely very rare kill anyways just out of paranoia, but use
337− * a SIGKILL because the error is not contained anymore.
332+ * Send SIGKILL if "tk->addr == -EFAULT". Also, as
333+ * "tk->size_shift" is always non-zero for !is_zone_device_page(),
334+ * so "tk->size_shift == 0" effectively checks no mapping on
335+ * ZONE_DEVICE. Indeed, when a devdax page is mmapped N times
336+ * to a process' address space, it's possible not all N VMAs
337+ * contain mappings for the page, but at least one VMA does.
338+ * Only deliver SIGBUS with payload derived from the VMA that
339+ * has a mapping for the page.
338340 */
339− if (tk->addr == -EFAULT || tk->size_shift == 0) {
341+ if (tk->addr == -EFAULT) {
340342 pr_info("Memory failure: Unable to find user space address %lx in %s\n",
341343 page_to_pfn(p), tsk->comm);
342− tk->addr_valid = 0;
344+ } else if (tk->size_shift == 0) {
345+ kfree(tk);
346+ return;
343347 }
344348 get_task_struct(tsk);
345349 tk->tsk = tsk;
@@ -366,7 +370,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, bool fail, · 20 unmodified lines
366370 * make sure the process doesn't catch the
367371 * signal and then access the memory. Just kill it.
368372 */
369− if (fail || tk->addr_valid == 0) {
373+ if (fail || tk->addr == -EFAULT) {
370374 pr_err("Memory failure: %#lx: forcibly killing %s:%d because of failure to unmap corrupted page\n",
371375 pfn, tk->tsk->comm, tk->tsk->pid);
372376 do_send_sig_info(SIGKILL, SEND_SIG_PRIV,
@@ -1253,17 +1257,19 @@ int memory_failure(unsigned long pfn, int flags) · 880 unmodified lines
12531257 if (!sysctl_memory_failure_recovery)
12541258 panic("Memory failure on page %lx", pfn);
12551259
1256− if (!pfn_valid(pfn)) {
1260+ p = pfn_to_online_page(pfn);
1261+ if (!p) {
1262+ if (pfn_valid(pfn)) {
1263+ pgmap = get_dev_pagemap(pfn, NULL);
1264+ if (pgmap)
1265+ return memory_failure_dev_pagemap(pfn, flags,
1266+ pgmap);
1267+ }
12571268 pr_err("Memory failure: %#lx: memory outside kernel control\n",
12581269 pfn);
12591270 return -ENXIO;
12601271 }
12611272
1262− pgmap = get_dev_pagemap(pfn, NULL);
1263− if (pgmap)
1264− return memory_failure_dev_pagemap(pfn, flags, pgmap);
1265−
1266− p = pfn_to_page(pfn);
12671273 if (PageHuge(p))
12681274 return memory_failure_hugetlb(pfn, flags);
12691275 if (TestSetPageHWPoison(p)) {
mm/memory_hotplug.c+15−57
@@ -436,67 +436,25 @@ static void shrink_zone_span(struct zone *zone, unsigned long start_pfn, · 435 unmodified lines
436436 zone_span_writeunlock(zone);
437437 }
438438
439−static void shrink_pgdat_span(struct pglist_data *pgdat,
440− unsigned long start_pfn, unsigned long end_pfn)
439+static void update_pgdat_span(struct pglist_data *pgdat)
441440 {
442− unsigned long pgdat_start_pfn = pgdat->node_start_pfn;
443− unsigned long p = pgdat_end_pfn(pgdat); /* pgdat_end_pfn namespace clash */
444− unsigned long pgdat_end_pfn = p;
445− unsigned long pfn;
446− int nid = pgdat->node_id;
447−
448− if (pgdat_start_pfn == start_pfn) {
449− /*
450− * If the section is smallest section in the pgdat, it need
451− * shrink pgdat->node_start_pfn and pgdat->node_spanned_pages.
452− * In this case, we find second smallest valid mem_section
453− * for shrinking zone.
454− */
455− pfn = find_smallest_section_pfn(nid, NULL, end_pfn,
456− pgdat_end_pfn);
457− if (pfn) {
458− pgdat->node_start_pfn = pfn;
459− pgdat->node_spanned_pages = pgdat_end_pfn - pfn;
460− }
461− } else if (pgdat_end_pfn == end_pfn) {
462− /*
463− * If the section is biggest section in the pgdat, it need
464− * shrink pgdat->node_spanned_pages.
465− * In this case, we find second biggest valid mem_section for
466− * shrinking zone.
467− */
468− pfn = find_biggest_section_pfn(nid, NULL, pgdat_start_pfn,
469− start_pfn);
470− if (pfn)
471− pgdat->node_spanned_pages = pfn - pgdat_start_pfn + 1;
472− }
473−
474− /*
475− * If the section is not biggest or smallest mem_section in the pgdat,
476− * it only creates a hole in the pgdat. So in this case, we need not
477− * change the pgdat.
478− * But perhaps, the pgdat has only hole data. Thus it check the pgdat
479− * has only hole or not.
480− */
481− pfn = pgdat_start_pfn;
482− for (; pfn < pgdat_end_pfn; pfn += PAGES_PER_SUBSECTION) {
483− if (unlikely(!pfn_valid(pfn)))
484− continue;
485−
486− if (pfn_to_nid(pfn) != nid)
487− continue;
441+ unsigned long node_start_pfn = 0, node_end_pfn = 0;
442+ struct zone *zone;
488443
489− /* Skip range to be removed */
490− if (pfn >= start_pfn && pfn < end_pfn)
491− continue;
444+ for (zone = pgdat->node_zones;
445+ zone < pgdat->node_zones + MAX_NR_ZONES; zone++) {
446+ unsigned long zone_end_pfn = zone->zone_start_pfn +
447+ zone->spanned_pages;
492448
493− /* If we find valid section, we have nothing to do */
494− return;
449+ /* No need to lock the zones, they can't change. */
450+ if (zone_end_pfn > node_end_pfn)
451+ node_end_pfn = zone_end_pfn;
452+ if (zone->zone_start_pfn < node_start_pfn)
453+ node_start_pfn = zone->zone_start_pfn;
495454 }
496455
497− /* The pgdat has no valid section */
498− pgdat->node_start_pfn = 0;
499− pgdat->node_spanned_pages = 0;
456+ pgdat->node_start_pfn = node_start_pfn;
457+ pgdat->node_spanned_pages = node_end_pfn - node_start_pfn;
500458 }
501459
502460 static void __remove_zone(struct zone *zone, unsigned long start_pfn,
@@ -507,7 +465,7 @@ static void __remove_zone(struct zone *zone, unsigned long start_pfn, · 4 unmodified lines
507465
508466 pgdat_resize_lock(zone->zone_pgdat, &flags);
509467 shrink_zone_span(zone, start_pfn, start_pfn + nr_pages);
510− shrink_pgdat_span(pgdat, start_pfn, start_pfn + nr_pages);
468+ update_pgdat_span(pgdat);
511469 pgdat_resize_unlock(zone->zone_pgdat, &flags);
512470 }
513471
mm/memremap.c+7−4
@@ -103,6 +103,7 @@ static void dev_pagemap_cleanup(struct dev_pagemap *pgmap) · 102 unmodified lines
103103 void memunmap_pages(struct dev_pagemap *pgmap)
104104 {
105105 struct resource *res = &pgmap->res;
106+ struct page *first_page;
106107 unsigned long pfn;
107108 int nid;
108109
@@ -111,14 +112,16 @@ void memunmap_pages(struct dev_pagemap *pgmap) · 2 unmodified lines
111112 put_page(pfn_to_page(pfn));
112113 dev_pagemap_cleanup(pgmap);
113114
115+ /* make sure to access a memmap that was actually initialized */
116+ first_page = pfn_to_page(pfn_first(pgmap));
117+
114118 /* pages are dead and unused, undo the arch mapping */
115− nid = page_to_nid(pfn_to_page(PHYS_PFN(res->start)));
119+ nid = page_to_nid(first_page);
116120
117121 mem_hotplug_begin();
118122 if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
119− pfn = PHYS_PFN(res->start);
120− __remove_pages(page_zone(pfn_to_page(pfn)), pfn,
121− PHYS_PFN(resource_size(res)), NULL);
123+ __remove_pages(page_zone(first_page), PHYS_PFN(res->start),
124+ PHYS_PFN(resource_size(res)), NULL);
122125 } else {
123126 arch_remove_memory(nid, res->start, resource_size(res),
124127 pgmap_altmap(pgmap));
mm/page_alloc.c+4−2
@@ -4473,12 +4473,14 @@ retry_cpuset: · 4472 unmodified lines
44734473 if (page)
44744474 goto got_pg;
44754475
4476− if (order >= pageblock_order && (gfp_mask & __GFP_IO)) {
4476+ if (order >= pageblock_order && (gfp_mask & __GFP_IO) &&
4477+ !(gfp_mask & __GFP_RETRY_MAYFAIL)) {
44774478 /*
44784479 * If allocating entire pageblock(s) and compaction
44794480 * failed because all zones are below low watermarks
44804481 * or is prohibited because it recently failed at this
4481− * order, fail immediately.
4482+ * order, fail immediately unless the allocator has
4483+ * requested compaction and reclaim retry.
44824484 *
44834485 * Reclaim is
44844486 * - potentially very expensive because zones are far
mm/page_ext.c+9−14
@@ -67,8 +67,9 @@ static struct page_ext_operations *page_ext_ops[] = { · 66 unmodified lines
6767 #endif
6868 };
6969
70+unsigned long page_ext_size = sizeof(struct page_ext);
71+
7072 static unsigned long total_usage;
71−static unsigned long extra_mem;
7273
7374 static bool __init invoke_need_callbacks(void)
7475 {
@@ -78,9 +79,8 @@ static bool __init invoke_need_callbacks(void) · 3 unmodified lines
7879
7980 for (i = 0; i < entries; i++) {
8081 if (page_ext_ops[i]->need && page_ext_ops[i]->need()) {
81− page_ext_ops[i]->offset = sizeof(struct page_ext) +
82− extra_mem;
83− extra_mem += page_ext_ops[i]->size;
82+ page_ext_ops[i]->offset = page_ext_size;
83+ page_ext_size += page_ext_ops[i]->size;
8484 need = true;
8585 }
8686 }
@@ -99,14 +99,9 @@ static void __init invoke_init_callbacks(void) · 12 unmodified lines
9999 }
100100 }
101101
102−static unsigned long get_entry_size(void)
103−{
104− return sizeof(struct page_ext) + extra_mem;
105−}
106−
107102 static inline struct page_ext *get_entry(void *base, unsigned long index)
108103 {
109− return base + get_entry_size() * index;
104+ return base + page_ext_size * index;
110105 }
111106
112107 #if !defined(CONFIG_SPARSEMEM)
@@ -156,7 +151,7 @@ static int __init alloc_node_page_ext(int nid) · 43 unmodified lines
156151 !IS_ALIGNED(node_end_pfn(nid), MAX_ORDER_NR_PAGES))
157152 nr_pages += MAX_ORDER_NR_PAGES;
158153
159− table_size = get_entry_size() * nr_pages;
154+ table_size = page_ext_size * nr_pages;
160155
161156 base = memblock_alloc_try_nid(
162157 table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS),
@@ -234,7 +229,7 @@ static int __meminit init_section_page_ext(unsigned long pfn, int nid) · 71 unmodified lines
234229 if (section->page_ext)
235230 return 0;
236231
237− table_size = get_entry_size() * PAGES_PER_SECTION;
232+ table_size = page_ext_size * PAGES_PER_SECTION;
238233 base = alloc_page_ext(table_size, nid);
239234
240235 /*
@@ -254,7 +249,7 @@ static int __meminit init_section_page_ext(unsigned long pfn, int nid) · 13 unmodified lines
254249 * we need to apply a mask.
255250 */
256251 pfn &= PAGE_SECTION_MASK;
257− section->page_ext = (void *)base - get_entry_size() * pfn;
252+ section->page_ext = (void *)base - page_ext_size * pfn;
258253 total_usage += table_size;
259254 return 0;
260255 }
@@ -267,7 +262,7 @@ static void free_page_ext(void *addr) · 6 unmodified lines
267262 struct page *page = virt_to_page(addr);
268263 size_t table_size;
269264
270− table_size = get_entry_size() * PAGES_PER_SECTION;
265+ table_size = page_ext_size * PAGES_PER_SECTION;
271266
272267 BUG_ON(PageReserved(page));
273268 kmemleak_free(addr);
mm/page_owner.c+23−37
@@ -24,12 +24,10 @@ struct page_owner { · 23 unmodified lines
2424 short last_migrate_reason;
2525 gfp_t gfp_mask;
2626 depot_stack_handle_t handle;
27−#ifdef CONFIG_DEBUG_PAGEALLOC
2827 depot_stack_handle_t free_handle;
29−#endif
3028 };
3129
32−static bool page_owner_disabled = true;
30+static bool page_owner_enabled = false;
3331 DEFINE_STATIC_KEY_FALSE(page_owner_inited);
3432
3533 static depot_stack_handle_t dummy_handle;
@@ -44,7 +42,7 @@ static int __init early_page_owner_param(char *buf) · 8 unmodified lines
4442 return -EINVAL;
4543
4644 if (strcmp(buf, "on") == 0)
47− page_owner_disabled = false;
45+ page_owner_enabled = true;
4846
4947 return 0;
5048 }
@@ -52,10 +50,7 @@ early_param("page_owner", early_page_owner_param); · 1 unmodified line
5250
5351 static bool need_page_owner(void)
5452 {
55− if (page_owner_disabled)
56− return false;
57−
58− return true;
53+ return page_owner_enabled;
5954 }
6055
6156 static __always_inline depot_stack_handle_t create_dummy_stack(void)
@@ -84,7 +79,7 @@ static noinline void register_early_stack(void) · 22 unmodified lines
8479
8580 static void init_page_owner(void)
8681 {
87− if (page_owner_disabled)
82+ if (!page_owner_enabled)
8883 return;
8984
9085 register_dummy_stack();
@@ -148,25 +143,19 @@ void __reset_page_owner(struct page *page, unsigned int order) · 57 unmodified lines
148143 {
149144 int i;
150145 struct page_ext *page_ext;
151−#ifdef CONFIG_DEBUG_PAGEALLOC
152146 depot_stack_handle_t handle = 0;
153147 struct page_owner *page_owner;
154148
155− if (debug_pagealloc_enabled())
156− handle = save_stack(GFP_NOWAIT | __GFP_NOWARN);
157−#endif
149+ handle = save_stack(GFP_NOWAIT | __GFP_NOWARN);
158150
151+ page_ext = lookup_page_ext(page);
152+ if (unlikely(!page_ext))
153+ return;
159154 for (i = 0; i < (1 << order); i++) {
160− page_ext = lookup_page_ext(page + i);
161− if (unlikely(!page_ext))
162− continue;
163− __clear_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags);
164−#ifdef CONFIG_DEBUG_PAGEALLOC
165− if (debug_pagealloc_enabled()) {
166− page_owner = get_page_owner(page_ext);
167− page_owner->free_handle = handle;
168− }
169−#endif
155+ __clear_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags);
156+ page_owner = get_page_owner(page_ext);
157+ page_owner->free_handle = handle;
158+ page_ext = page_ext_next(page_ext);
170159 }
171160 }
172161
@@ -184,9 +173,9 @@ static inline void __set_page_owner_handle(struct page *page, · 11 unmodified lines
184173 page_owner->gfp_mask = gfp_mask;
185174 page_owner->last_migrate_reason = -1;
186175 __set_bit(PAGE_EXT_OWNER, &page_ext->flags);
187− __set_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags);
176+ __set_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags);
188177
189− page_ext = lookup_page_ext(page + i);
178+ page_ext = page_ext_next(page_ext);
190179 }
191180 }
192181
@@ -224,12 +213,10 @@ void __split_page_owner(struct page *page, unsigned int order) · 31 unmodified lines
224213 if (unlikely(!page_ext))
225214 return;
226215
227− page_owner = get_page_owner(page_ext);
228− page_owner->order = 0;
229− for (i = 1; i < (1 << order); i++) {
230− page_ext = lookup_page_ext(page + i);
216+ for (i = 0; i < (1 << order); i++) {
231217 page_owner = get_page_owner(page_ext);
232218 page_owner->order = 0;
219+ page_ext = page_ext_next(page_ext);
233220 }
234221 }
235222
@@ -260,7 +247,7 @@ void __copy_page_owner(struct page *oldpage, struct page *newpage) · 24 unmodified lines
260247 * the new page, which will be freed.
261248 */
262249 __set_bit(PAGE_EXT_OWNER, &new_ext->flags);
263− __set_bit(PAGE_EXT_OWNER_ACTIVE, &new_ext->flags);
250+ __set_bit(PAGE_EXT_OWNER_ALLOCATED, &new_ext->flags);
264251 }
265252
266253 void pagetypeinfo_showmixedcount_print(struct seq_file *m,
@@ -284,7 +271,8 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, · 17 unmodified lines
284271 * not matter as the mixed block count will still be correct
285272 */
286273 for (; pfn < end_pfn; ) {
287− if (!pfn_valid(pfn)) {
274+ page = pfn_to_online_page(pfn);
275+ if (!page) {
288276 pfn = ALIGN(pfn + 1, MAX_ORDER_NR_PAGES);
289277 continue;
290278 }
@@ -292,13 +280,13 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, · 1 unmodified line
292280 block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages);
293281 block_end_pfn = min(block_end_pfn, end_pfn);
294282
295− page = pfn_to_page(pfn);
296283 pageblock_mt = get_pageblock_migratetype(page);
297284
298285 for (; pfn < block_end_pfn; pfn++) {
299286 if (!pfn_valid_within(pfn))
300287 continue;
301288
289+ /* The pageblock is online, no need to recheck. */
302290 page = pfn_to_page(pfn);
303291
304292 if (page_zone(page) != zone)
@@ -320,7 +308,7 @@ void pagetypeinfo_showmixedcount_print(struct seq_file *m, · 15 unmodified lines
320308 if (unlikely(!page_ext))
321309 continue;
322310
323− if (!test_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags))
311+ if (!test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags))
324312 continue;
325313
326314 page_owner = get_page_owner(page_ext);
@@ -435,7 +423,7 @@ void __dump_page_owner(struct page *page) · 108 unmodified lines
435423 return;
436424 }
437425
438− if (test_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags))
426+ if (test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags))
439427 pr_alert("page_owner tracks the page as allocated\n");
440428 else
441429 pr_alert("page_owner tracks the page as freed\n");
@@ -451,7 +439,6 @@ void __dump_page_owner(struct page *page) · 9 unmodified lines
451439 stack_trace_print(entries, nr_entries, 0);
452440 }
453441
454−#ifdef CONFIG_DEBUG_PAGEALLOC
455442 handle = READ_ONCE(page_owner->free_handle);
456443 if (!handle) {
457444 pr_alert("page_owner free stack trace missing\n");
@@ -460,7 +447,6 @@ void __dump_page_owner(struct page *page) · 2 unmodified lines
460447 pr_alert("page last free stack trace:\n");
461448 stack_trace_print(entries, nr_entries, 0);
462449 }
463−#endif
464450
465451 if (page_owner->last_migrate_reason != -1)
466452 pr_alert("page has been migrated, last migrate reason: %s\n",
@@ -527,7 +513,7 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos) · 60 unmodified lines
527513 * Although we do have the info about past allocation of free
528514 * pages, it's not relevant for current memory usage.
529515 */
530− if (!test_bit(PAGE_EXT_OWNER_ACTIVE, &page_ext->flags))
516+ if (!test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags))
531517 continue;
532518
533519 page_owner = get_page_owner(page_ext);
mm/rmap.c+1−0
@@ -61,6 +61,7 @@ · 60 unmodified lines
6161 #include <linux/mmu_notifier.h>
6262 #include <linux/migrate.h>
6363 #include <linux/hugetlb.h>
64+#include <linux/huge_mm.h>
6465 #include <linux/backing-dev.h>
6566 #include <linux/page_idle.h>
6667 #include <linux/memremap.h>
mm/slab.c+3−0
@@ -4206,9 +4206,12 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page, · 4205 unmodified lines
42064206
42074207 /**
42084208 * __ksize -- Uninstrumented ksize.
4209+ * @objp: pointer to the object
42094210 *
42104211 * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same
42114212 * safety checks as ksize() with KASAN instrumentation enabled.
4213+ *
4214+ * Return: size of the actual memory used by @objp in bytes
42124215 */
42134216 size_t __ksize(const void *objp)
42144217 {
mm/slab_common.c+5−4
@@ -178,10 +178,13 @@ static int init_memcg_params(struct kmem_cache *s, · 177 unmodified lines
178178
179179 static void destroy_memcg_params(struct kmem_cache *s)
180180 {
181− if (is_root_cache(s))
181+ if (is_root_cache(s)) {
182182 kvfree(rcu_access_pointer(s->memcg_params.memcg_caches));
183− else
183+ } else {
184+ mem_cgroup_put(s->memcg_params.memcg);
185+ WRITE_ONCE(s->memcg_params.memcg, NULL);
184186 percpu_ref_exit(&s->memcg_params.refcnt);
187+ }
185188 }
186189
187190 static void free_memcg_params(struct rcu_head *rcu)
@@ -253,8 +256,6 @@ static void memcg_unlink_cache(struct kmem_cache *s) · 65 unmodified lines
253256 } else {
254257 list_del(&s->memcg_params.children_node);
255258 list_del(&s->memcg_params.kmem_caches_node);
256− mem_cgroup_put(s->memcg_params.memcg);
257− WRITE_ONCE(s->memcg_params.memcg, NULL);
258259 }
259260 }
260261 #else
mm/slub.c+27−8
@@ -2671,6 +2671,17 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node, · 2670 unmodified lines
26712671 return p;
26722672 }
26732673
2674+/*
2675+ * If the object has been wiped upon free, make sure it's fully initialized by
2676+ * zeroing out freelist pointer.
2677+ */
2678+static __always_inline void maybe_wipe_obj_freeptr(struct kmem_cache *s,
2679+ void *obj)
2680+{
2681+ if (unlikely(slab_want_init_on_free(s)) && obj)
2682+ memset((void *)((char *)obj + s->offset), 0, sizeof(void *));
2683+}
2684+
26742685 /*
26752686 * Inlined fastpath so that allocation functions (kmalloc, kmem_cache_alloc)
26762687 * have the fastpath folded into their functions. So no function call
@@ -2759,12 +2770,8 @@ redo: · 82 unmodified lines
27592770 prefetch_freepointer(s, next_object);
27602771 stat(s, ALLOC_FASTPATH);
27612772 }
2762− /*
2763− * If the object has been wiped upon free, make sure it's fully
2764− * initialized by zeroing out freelist pointer.
2765− */
2766− if (unlikely(slab_want_init_on_free(s)) && object)
2767− memset(object + s->offset, 0, sizeof(void *));
2773+
2774+ maybe_wipe_obj_freeptr(s, object);
27682775
27692776 if (unlikely(slab_want_init_on_alloc(gfpflags, s)) && object)
27702777 memset(object, 0, s->object_size);
@@ -3178,10 +3185,13 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, · 407 unmodified lines
31783185 goto error;
31793186
31803187 c = this_cpu_ptr(s->cpu_slab);
3188+ maybe_wipe_obj_freeptr(s, p[i]);
3189+
31813190 continue; /* goto for-loop */
31823191 }
31833192 c->freelist = get_freepointer(s, object);
31843193 p[i] = object;
3194+ maybe_wipe_obj_freeptr(s, p[i]);
31853195 }
31863196 c->tid = next_tid(c->tid);
31873197 local_irq_enable();
@@ -4846,7 +4856,17 @@ static ssize_t show_slab_objects(struct kmem_cache *s, · 1658 unmodified lines
48464856 }
48474857 }
48484858
4849− get_online_mems();
4859+ /*
4860+ * It is impossible to take "mem_hotplug_lock" here with "kernfs_mutex"
4861+ * already held which will conflict with an existing lock order:
4862+ *
4863+ * mem_hotplug_lock->slab_mutex->kernfs_mutex
4864+ *
4865+ * We don't really need mem_hotplug_lock (to hold off
4866+ * slab_mem_going_offline_callback) here because slab's memory hot
4867+ * unplug code doesn't destroy the kmem_cache->node[] data.
4868+ */
4869+
48504870 #ifdef CONFIG_SLUB_DEBUG
48514871 if (flags & SO_ALL) {
48524872 struct kmem_cache_node *n;
@@ -4887,7 +4907,6 @@ static ssize_t show_slab_objects(struct kmem_cache *s, · 34 unmodified lines
48874907 x += sprintf(buf + x, " N%d=%lu",
48884908 node, nodes[node]);
48894909 #endif
4890− put_online_mems();
48914910 kfree(nodes);
48924911 return x + sprintf(buf + x, "\n");
48934912 }
mm/truncate.c+12−0
@@ -592,6 +592,16 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, · 591 unmodified lines
592592 unlock_page(page);
593593 continue;
594594 }
595+
596+ /* Take a pin outside pagevec */
597+ get_page(page);
598+
599+ /*
600+ * Drop extra pins before trying to invalidate
601+ * the huge page.
602+ */
603+ pagevec_remove_exceptionals(&pvec);
604+ pagevec_release(&pvec);
595605 }
596606
597607 ret = invalidate_inode_page(page);
@@ -602,6 +612,8 @@ unsigned long invalidate_mapping_pages(struct address_space *mapping, · 4 unmodified lines
602612 */
603613 if (!ret)
604614 deactivate_file_page(page);
615+ if (PageTransHuge(page))
616+ put_page(page);
605617 count += ret;
606618 }
607619 pagevec_remove_exceptionals(&pvec);
mm/vmscan.c+6−8
@@ -351,12 +351,13 @@ unsigned long zone_reclaimable_pages(struct zone *zone) · 350 unmodified lines
351351 */
352352 unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone_idx)
353353 {
354− unsigned long lru_size;
354+ unsigned long lru_size = 0;
355355 int zid;
356356
357− if (!mem_cgroup_disabled())
358− lru_size = lruvec_page_state_local(lruvec, NR_LRU_BASE + lru);
359− else
357+ if (!mem_cgroup_disabled()) {
358+ for (zid = 0; zid < MAX_NR_ZONES; zid++)
359+ lru_size += mem_cgroup_get_zone_lru_size(lruvec, lru, zid);
360+ } else
360361 lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru);
361362
362363 for (zid = zone_idx + 1; zid < MAX_NR_ZONES; zid++) {
@@ -932,10 +933,7 @@ static int __remove_mapping(struct address_space *mapping, struct page *page, · 569 unmodified lines
932933 * Note that if SetPageDirty is always performed via set_page_dirty,
933934 * and thus under the i_pages lock, then this ordering is not required.
934935 */
935− if (unlikely(PageTransHuge(page)) && PageSwapCache(page))
936− refcount = 1 + HPAGE_PMD_NR;
937− else
938− refcount = 2;
936+ refcount = 1 + compound_nr(page);
939937 if (!page_ref_freeze(page, refcount))
940938 goto cannot_free;
941939 /* note: atomic_cmpxchg in page_ref_freeze provides the smp_rmb */
net/bridge/netfilter/nf_conntrack_bridge.c+3−0
@@ -33,6 +33,7 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, · 32 unmodified lines
3333 {
3434 int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size;
3535 unsigned int hlen, ll_rs, mtu;
36+ ktime_t tstamp = skb->tstamp;
3637 struct ip_frag_state state;
3738 struct iphdr *iph;
3839 int err;
@@ -80,6 +81,7 @@ static int nf_br_ip_fragment(struct net *net, struct sock *sk, · 41 unmodified lines
8081 if (iter.frag)
8182 ip_fraglist_prepare(skb, &iter);
8283
84+ skb->tstamp = tstamp;
8385 err = output(net, sk, data, skb);
8486 if (err || !iter.frag)
8587 break;
@@ -104,6 +106,7 @@ slow_path: · 18 unmodified lines
104106 goto blackhole;
105107 }
106108
109+ skb2->tstamp = tstamp;
107110 err = output(net, sk, data, skb2);
108111 if (err)
109112 goto blackhole;
net/core/datagram.c+1−1
@@ -640,7 +640,7 @@ int __zerocopy_sg_from_iter(struct sock *sk, struct sk_buff *skb, · 639 unmodified lines
640640 skb->len += copied;
641641 skb->truesize += truesize;
642642 if (sk && sk->sk_type == SOCK_STREAM) {
643− sk->sk_wmem_queued += truesize;
643+ sk_wmem_queued_add(sk, truesize);
644644 sk_mem_charge(sk, truesize);
645645 } else {
646646 refcount_add(truesize, &skb->sk->sk_wmem_alloc);
net/core/filter.c+5−3
@@ -4252,12 +4252,14 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 4251 unmodified lines
42524252 case SO_RCVBUF:
42534253 val = min_t(u32, val, sysctl_rmem_max);
42544254 sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
4255− sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
4255+ WRITE_ONCE(sk->sk_rcvbuf,
4256+ max_t(int, val * 2, SOCK_MIN_RCVBUF));
42564257 break;
42574258 case SO_SNDBUF:
42584259 val = min_t(u32, val, sysctl_wmem_max);
42594260 sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
4260− sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
4261+ WRITE_ONCE(sk->sk_sndbuf,
4262+ max_t(int, val * 2, SOCK_MIN_SNDBUF));
42614263 break;
42624264 case SO_MAX_PACING_RATE: /* 32bit version */
42634265 if (val != ~0U)
@@ -4274,7 +4276,7 @@ BPF_CALL_5(bpf_setsockopt, struct bpf_sock_ops_kern *, bpf_sock, · 10 unmodified lines
42744276 case SO_RCVLOWAT:
42754277 if (val < 0)
42764278 val = INT_MAX;
4277− sk->sk_rcvlowat = val ? : 1;
4279+ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
42784280 break;
42794281 case SO_MARK:
42804282 if (sk->sk_mark != val) {
net/core/net_namespace.c+11−6
@@ -245,7 +245,8 @@ static int __peernet2id(struct net *net, struct net *peer) · 244 unmodified lines
245245 return __peernet2id_alloc(net, peer, &no);
246246 }
247247
248−static void rtnl_net_notifyid(struct net *net, int cmd, int id);
248+static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid,
249+ struct nlmsghdr *nlh);
249250 /* This function returns the id of a peer netns. If no id is assigned, one will
250251 * be allocated and returned.
251252 */
@@ -268,7 +269,7 @@ int peernet2id_alloc(struct net *net, struct net *peer) · 16 unmodified lines
268269 id = __peernet2id_alloc(net, peer, &alloc);
269270 spin_unlock_bh(&net->nsid_lock);
270271 if (alloc && id >= 0)
271− rtnl_net_notifyid(net, RTM_NEWNSID, id);
272+ rtnl_net_notifyid(net, RTM_NEWNSID, id, 0, NULL);
272273 if (alive)
273274 put_net(peer);
274275 return id;
@@ -532,7 +533,7 @@ static void unhash_nsid(struct net *net, struct net *last) · 257 unmodified lines
532533 idr_remove(&tmp->netns_ids, id);
533534 spin_unlock_bh(&tmp->nsid_lock);
534535 if (id >= 0)
535− rtnl_net_notifyid(tmp, RTM_DELNSID, id);
536+ rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL);
536537 if (tmp == last)
537538 break;
538539 }
@@ -764,7 +765,8 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh, · 225 unmodified lines
764765 err = alloc_netid(net, peer, nsid);
765766 spin_unlock_bh(&net->nsid_lock);
766767 if (err >= 0) {
767− rtnl_net_notifyid(net, RTM_NEWNSID, err);
768+ rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid,
769+ nlh);
768770 err = 0;
769771 } else if (err == -ENOSPC && nsid >= 0) {
770772 err = -EEXIST;
@@ -1051,9 +1053,12 @@ end: · 280 unmodified lines
10511053 return err < 0 ? err : skb->len;
10521054 }
10531055
1054−static void rtnl_net_notifyid(struct net *net, int cmd, int id)
1056+static void rtnl_net_notifyid(struct net *net, int cmd, int id, u32 portid,
1057+ struct nlmsghdr *nlh)
10551058 {
10561059 struct net_fill_args fillargs = {
1060+ .portid = portid,
1061+ .seq = nlh ? nlh->nlmsg_seq : 0,
10571062 .cmd = cmd,
10581063 .nsid = id,
10591064 };
@@ -1068,7 +1073,7 @@ static void rtnl_net_notifyid(struct net *net, int cmd, int id) · 8 unmodified lines
10681073 if (err < 0)
10691074 goto err_out;
10701075
1071− rtnl_notify(msg, net, 0, RTNLGRP_NSID, NULL, 0);
1076+ rtnl_notify(msg, net, portid, RTNLGRP_NSID, nlh, 0);
10721077 return;
10731078
10741079 err_out:
net/core/request_sock.c+1−1
@@ -96,7 +96,7 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, · 95 unmodified lines
9696
9797 fastopenq = &inet_csk(lsk)->icsk_accept_queue.fastopenq;
9898
99− tcp_sk(sk)->fastopen_rsk = NULL;
99+ RCU_INIT_POINTER(tcp_sk(sk)->fastopen_rsk, NULL);
100100 spin_lock_bh(&fastopenq->lock);
101101 fastopenq->qlen--;
102102 tcp_rsk(req)->tfo_listener = false;
net/core/skbuff.c+13−10
@@ -4415,7 +4415,7 @@ static void skb_set_err_queue(struct sk_buff *skb) · 4414 unmodified lines
44154415 int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
44164416 {
44174417 if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
4418− (unsigned int)sk->sk_rcvbuf)
4418+ (unsigned int)READ_ONCE(sk->sk_rcvbuf))
44194419 return -ENOMEM;
44204420
44214421 skb_orphan(skb);
@@ -5477,12 +5477,14 @@ static void skb_mod_eth_type(struct sk_buff *skb, struct ethhdr *hdr, · 1055 unmodified lines
54775477 * @skb: buffer
54785478 * @mpls_lse: MPLS label stack entry to push
54795479 * @mpls_proto: ethertype of the new MPLS header (expects 0x8847 or 0x8848)
5480+ * @mac_len: length of the MAC header
54805481 *
54815482 * Expects skb->data at mac header.
54825483 *
54835484 * Returns 0 on success, -errno otherwise.
54845485 */
5485−int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto)
5486+int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto,
5487+ int mac_len)
54865488 {
54875489 struct mpls_shim_hdr *lse;
54885490 int err;
@@ -5499,15 +5501,15 @@ int skb_mpls_push(struct sk_buff *skb, __be32 mpls_lse, __be16 mpls_proto) · 10 unmodified lines
54995501 return err;
55005502
55015503 if (!skb->inner_protocol) {
5502− skb_set_inner_network_header(skb, skb->mac_len);
5504+ skb_set_inner_network_header(skb, mac_len);
55035505 skb_set_inner_protocol(skb, skb->protocol);
55045506 }
55055507
55065508 skb_push(skb, MPLS_HLEN);
55075509 memmove(skb_mac_header(skb) - MPLS_HLEN, skb_mac_header(skb),
5508− skb->mac_len);
5510+ mac_len);
55095511 skb_reset_mac_header(skb);
5510− skb_set_network_header(skb, skb->mac_len);
5512+ skb_set_network_header(skb, mac_len);
55115513
55125514 lse = mpls_hdr(skb);
55135515 lse->label_stack_entry = mpls_lse;
@@ -5526,29 +5528,30 @@ EXPORT_SYMBOL_GPL(skb_mpls_push); · 12 unmodified lines
55265528 *
55275529 * @skb: buffer
55285530 * @next_proto: ethertype of header after popped MPLS header
5531+ * @mac_len: length of the MAC header
55295532 *
55305533 * Expects skb->data at mac header.
55315534 *
55325535 * Returns 0 on success, -errno otherwise.
55335536 */
5534−int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto)
5537+int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len)
55355538 {
55365539 int err;
55375540
55385541 if (unlikely(!eth_p_mpls(skb->protocol)))
5539− return -EINVAL;
5542+ return 0;
55405543
5541− err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN);
5544+ err = skb_ensure_writable(skb, mac_len + MPLS_HLEN);
55425545 if (unlikely(err))
55435546 return err;
55445547
55455548 skb_postpull_rcsum(skb, mpls_hdr(skb), MPLS_HLEN);
55465549 memmove(skb_mac_header(skb) + MPLS_HLEN, skb_mac_header(skb),
5547− skb->mac_len);
5550+ mac_len);
55485551
55495552 __skb_pull(skb, MPLS_HLEN);
55505553 skb_reset_mac_header(skb);
5551− skb_set_network_header(skb, skb->mac_len);
5554+ skb_set_network_header(skb, mac_len);
55525555
55535556 if (skb->dev && skb->dev->type == ARPHRD_ETHER) {
55545557 struct ethhdr *hdr;
net/core/sock.c+18−14
@@ -522,7 +522,7 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb, · 521 unmodified lines
522522 rc = sk_backlog_rcv(sk, skb);
523523
524524 mutex_release(&sk->sk_lock.dep_map, 1, _RET_IP_);
525− } else if (sk_add_backlog(sk, skb, sk->sk_rcvbuf)) {
525+ } else if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf))) {
526526 bh_unlock_sock(sk);
527527 atomic_inc(&sk->sk_drops);
528528 goto discard_and_relse;
@@ -785,7 +785,8 @@ set_sndbuf: · 256 unmodified lines
785785 */
786786 val = min_t(int, val, INT_MAX / 2);
787787 sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
788− sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
788+ WRITE_ONCE(sk->sk_sndbuf,
789+ max_t(int, val * 2, SOCK_MIN_SNDBUF));
789790 /* Wake up sending tasks if we upped the value. */
790791 sk->sk_write_space(sk);
791792 break;
@@ -831,7 +832,8 @@ set_rcvbuf: · 39 unmodified lines
831832 * returning the value we actually used in getsockopt
832833 * is the most desirable behavior.
833834 */
834− sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
835+ WRITE_ONCE(sk->sk_rcvbuf,
836+ max_t(int, val * 2, SOCK_MIN_RCVBUF));
835837 break;
836838
837839 case SO_RCVBUFFORCE:
@@ -974,7 +976,7 @@ set_rcvbuf: · 136 unmodified lines
974976 if (sock->ops->set_rcvlowat)
975977 ret = sock->ops->set_rcvlowat(sk, val);
976978 else
977− sk->sk_rcvlowat = val ? : 1;
979+ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
978980 break;
979981
980982 case SO_RCVTIMEO_OLD:
@@ -2088,8 +2090,10 @@ EXPORT_SYMBOL(sock_i_ino); · 1107 unmodified lines
20882090 struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
20892091 gfp_t priority)
20902092 {
2091− if (force || refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf) {
2093+ if (force ||
2094+ refcount_read(&sk->sk_wmem_alloc) < READ_ONCE(sk->sk_sndbuf)) {
20922095 struct sk_buff *skb = alloc_skb(size, priority);
2096+
20932097 if (skb) {
20942098 skb_set_owner_w(skb, sk);
20952099 return skb;
@@ -2190,7 +2194,7 @@ static long sock_wait_for_wmem(struct sock *sk, long timeo) · 94 unmodified lines
21902194 break;
21912195 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
21922196 prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
2193− if (refcount_read(&sk->sk_wmem_alloc) < sk->sk_sndbuf)
2197+ if (refcount_read(&sk->sk_wmem_alloc) < READ_ONCE(sk->sk_sndbuf))
21942198 break;
21952199 if (sk->sk_shutdown & SEND_SHUTDOWN)
21962200 break;
@@ -2225,7 +2229,7 @@ struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, · 28 unmodified lines
22252229 if (sk->sk_shutdown & SEND_SHUTDOWN)
22262230 goto failure;
22272231
2228− if (sk_wmem_alloc_get(sk) < sk->sk_sndbuf)
2232+ if (sk_wmem_alloc_get(sk) < READ_ONCE(sk->sk_sndbuf))
22292233 break;
22302234
22312235 sk_set_bit(SOCKWQ_ASYNC_NOSPACE, sk);
@@ -2334,8 +2338,8 @@ static void sk_leave_memory_pressure(struct sock *sk) · 102 unmodified lines
23342338 } else {
23352339 unsigned long *memory_pressure = sk->sk_prot->memory_pressure;
23362340
2337− if (memory_pressure && *memory_pressure)
2338− *memory_pressure = 0;
2341+ if (memory_pressure && READ_ONCE(*memory_pressure))
2342+ WRITE_ONCE(*memory_pressure, 0);
23392343 }
23402344 }
23412345
@@ -2806,7 +2810,7 @@ static void sock_def_write_space(struct sock *sk) · 464 unmodified lines
28062810 /* Do not wake up a writer until he can make "significant"
28072811 * progress. --DaveM
28082812 */
2809− if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) {
2813+ if ((refcount_read(&sk->sk_wmem_alloc) << 1) <= READ_ONCE(sk->sk_sndbuf)) {
28102814 wq = rcu_dereference(sk->sk_wq);
28112815 if (skwq_has_sleeper(wq))
28122816 wake_up_interruptible_sync_poll(&wq->wait, EPOLLOUT |
@@ -3204,13 +3208,13 @@ void sk_get_meminfo(const struct sock *sk, u32 *mem) · 391 unmodified lines
32043208 memset(mem, 0, sizeof(*mem) * SK_MEMINFO_VARS);
32053209
32063210 mem[SK_MEMINFO_RMEM_ALLOC] = sk_rmem_alloc_get(sk);
3207− mem[SK_MEMINFO_RCVBUF] = sk->sk_rcvbuf;
3211+ mem[SK_MEMINFO_RCVBUF] = READ_ONCE(sk->sk_rcvbuf);
32083212 mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk);
3209− mem[SK_MEMINFO_SNDBUF] = sk->sk_sndbuf;
3213+ mem[SK_MEMINFO_SNDBUF] = READ_ONCE(sk->sk_sndbuf);
32103214 mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc;
3211− mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued;
3215+ mem[SK_MEMINFO_WMEM_QUEUED] = READ_ONCE(sk->sk_wmem_queued);
32123216 mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc);
3213− mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len;
3217+ mem[SK_MEMINFO_BACKLOG] = READ_ONCE(sk->sk_backlog.len);
32143218 mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops);
32153219 }
32163220
net/dsa/dsa2.c+1−1
@@ -46,7 +46,7 @@ static struct dsa_switch_tree *dsa_tree_alloc(int index) · 45 unmodified lines
4646 dst->index = index;
4747
4848 INIT_LIST_HEAD(&dst->list);
49− list_add_tail(&dsa_tree_list, &dst->list);
49+ list_add_tail(&dst->list, &dsa_tree_list);
5050
5151 kref_init(&dst->refcount);
5252
net/ipv4/inet_connection_sock.c+3−3
@@ -906,7 +906,7 @@ static void inet_child_forget(struct sock *sk, struct request_sock *req, · 905 unmodified lines
906906 percpu_counter_inc(sk->sk_prot->orphan_count);
907907
908908 if (sk->sk_protocol == IPPROTO_TCP && tcp_rsk(req)->tfo_listener) {
909− BUG_ON(tcp_sk(child)->fastopen_rsk != req);
909+ BUG_ON(rcu_access_pointer(tcp_sk(child)->fastopen_rsk) != req);
910910 BUG_ON(sk != req->rsk_listener);
911911
912912 /* Paranoid, to prevent race condition if
@@ -915,7 +915,7 @@ static void inet_child_forget(struct sock *sk, struct request_sock *req, · 2 unmodified lines
915915 * Also to satisfy an assertion in
916916 * tcp_v4_destroy_sock().
917917 */
918− tcp_sk(child)->fastopen_rsk = NULL;
918+ RCU_INIT_POINTER(tcp_sk(child)->fastopen_rsk, NULL);
919919 }
920920 inet_csk_destroy_sock(child);
921921 }
@@ -934,7 +934,7 @@ struct sock *inet_csk_reqsk_queue_add(struct sock *sk, · 12 unmodified lines
934934 req->sk = child;
935935 req->dl_next = NULL;
936936 if (queue->rskq_accept_head == NULL)
937− queue->rskq_accept_head = req;
937+ WRITE_ONCE(queue->rskq_accept_head, req);
938938 else
939939 queue->rskq_accept_tail->dl_next = req;
940940 queue->rskq_accept_tail = req;
net/ipv4/inet_diag.c+1−1
@@ -193,7 +193,7 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, · 192 unmodified lines
193193 if (ext & (1 << (INET_DIAG_MEMINFO - 1))) {
194194 struct inet_diag_meminfo minfo = {
195195 .idiag_rmem = sk_rmem_alloc_get(sk),
196− .idiag_wmem = sk->sk_wmem_queued,
196+ .idiag_wmem = READ_ONCE(sk->sk_wmem_queued),
197197 .idiag_fmem = sk->sk_forward_alloc,
198198 .idiag_tmem = sk_wmem_alloc_get(sk),
199199 };
net/ipv4/ip_output.c+3−0
@@ -771,6 +771,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 770 unmodified lines
771771 struct rtable *rt = skb_rtable(skb);
772772 unsigned int mtu, hlen, ll_rs;
773773 struct ip_fraglist_iter iter;
774+ ktime_t tstamp = skb->tstamp;
774775 struct ip_frag_state state;
775776 int err = 0;
776777
@@ -846,6 +847,7 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 69 unmodified lines
846847 ip_fraglist_prepare(skb, &iter);
847848 }
848849
850+ skb->tstamp = tstamp;
849851 err = output(net, sk, skb);
850852
851853 if (!err)
@@ -900,6 +902,7 @@ slow_path: · 48 unmodified lines
900902 /*
901903 * Put this fragment into the sending queue.
902904 */
905+ skb2->tstamp = tstamp;
903906 err = output(net, sk, skb2);
904907 if (err)
905908 goto fail;
net/ipv4/route.c+7−4
@@ -1482,7 +1482,7 @@ static bool rt_cache_route(struct fib_nh_common *nhc, struct rtable *rt) · 1481 unmodified lines
14821482 prev = cmpxchg(p, orig, rt);
14831483 if (prev == orig) {
14841484 if (orig) {
1485− dst_dev_put(&orig->dst);
1485+ rt_add_uncached_list(orig);
14861486 dst_release(&orig->dst);
14871487 }
14881488 } else {
@@ -2470,14 +2470,17 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4, · 981 unmodified lines
24702470 int orig_oif = fl4->flowi4_oif;
24712471 unsigned int flags = 0;
24722472 struct rtable *rth;
2473− int err = -ENETUNREACH;
2473+ int err;
24742474
24752475 if (fl4->saddr) {
2476− rth = ERR_PTR(-EINVAL);
24772476 if (ipv4_is_multicast(fl4->saddr) ||
24782477 ipv4_is_lbcast(fl4->saddr) ||
2479− ipv4_is_zeronet(fl4->saddr))
2478+ ipv4_is_zeronet(fl4->saddr)) {
2479+ rth = ERR_PTR(-EINVAL);
24802480 goto out;
2481+ }
2482+
2483+ rth = ERR_PTR(-ENETUNREACH);
24812484
24822485 /* I removed check for oif == dev_out->oif here.
24832486 It was wrong for two reasons:
net/ipv4/tcp.c+45−30
@@ -326,7 +326,7 @@ void tcp_enter_memory_pressure(struct sock *sk) · 325 unmodified lines
326326 {
327327 unsigned long val;
328328
329− if (tcp_memory_pressure)
329+ if (READ_ONCE(tcp_memory_pressure))
330330 return;
331331 val = jiffies;
332332
@@ -341,7 +341,7 @@ void tcp_leave_memory_pressure(struct sock *sk) · 8 unmodified lines
341341 {
342342 unsigned long val;
343343
344− if (!tcp_memory_pressure)
344+ if (!READ_ONCE(tcp_memory_pressure))
345345 return;
346346 val = xchg(&tcp_memory_pressure, 0);
347347 if (val)
@@ -450,8 +450,8 @@ void tcp_init_sock(struct sock *sk) · 102 unmodified lines
450450
451451 icsk->icsk_sync_mss = tcp_sync_mss;
452452
453− sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1];
454− sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1];
453+ WRITE_ONCE(sk->sk_sndbuf, sock_net(sk)->ipv4.sysctl_tcp_wmem[1]);
454+ WRITE_ONCE(sk->sk_rcvbuf, sock_net(sk)->ipv4.sysctl_tcp_rmem[1]);
455455
456456 sk_sockets_allocated_inc(sk);
457457 sk->sk_route_forced_caps = NETIF_F_GSO;
@@ -477,7 +477,7 @@ static void tcp_tx_timestamp(struct sock *sk, u16 tsflags) · 19 unmodified lines
477477 static inline bool tcp_stream_is_readable(const struct tcp_sock *tp,
478478 int target, struct sock *sk)
479479 {
480− return (tp->rcv_nxt - tp->copied_seq >= target) ||
480+ return (READ_ONCE(tp->rcv_nxt) - READ_ONCE(tp->copied_seq) >= target) ||
481481 (sk->sk_prot->stream_memory_read ?
482482 sk->sk_prot->stream_memory_read(sk) : false);
483483 }
@@ -543,10 +543,10 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait) · 59 unmodified lines
543543
544544 /* Connected or passive Fast Open socket? */
545545 if (state != TCP_SYN_SENT &&
546− (state != TCP_SYN_RECV || tp->fastopen_rsk)) {
546+ (state != TCP_SYN_RECV || rcu_access_pointer(tp->fastopen_rsk))) {
547547 int target = sock_rcvlowat(sk, 0, INT_MAX);
548548
549− if (tp->urg_seq == tp->copied_seq &&
549+ if (READ_ONCE(tp->urg_seq) == READ_ONCE(tp->copied_seq) &&
550550 !sock_flag(sk, SOCK_URGINLINE) &&
551551 tp->urg_data)
552552 target++;
@@ -607,7 +607,8 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) · 54 unmodified lines
607607 unlock_sock_fast(sk, slow);
608608 break;
609609 case SIOCATMARK:
610− answ = tp->urg_data && tp->urg_seq == tp->copied_seq;
610+ answ = tp->urg_data &&
611+ READ_ONCE(tp->urg_seq) == READ_ONCE(tp->copied_seq);
611612 break;
612613 case SIOCOUTQ:
613614 if (sk->sk_state == TCP_LISTEN)
@@ -616,7 +617,7 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) · 2 unmodified lines
616617 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
617618 answ = 0;
618619 else
619− answ = tp->write_seq - tp->snd_una;
620+ answ = READ_ONCE(tp->write_seq) - tp->snd_una;
620621 break;
621622 case SIOCOUTQNSD:
622623 if (sk->sk_state == TCP_LISTEN)
@@ -625,7 +626,8 @@ int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg) · 2 unmodified lines
625626 if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV))
626627 answ = 0;
627628 else
628− answ = tp->write_seq - tp->snd_nxt;
629+ answ = READ_ONCE(tp->write_seq) -
630+ READ_ONCE(tp->snd_nxt);
629631 break;
630632 default:
631633 return -ENOIOCTLCMD;
@@ -657,7 +659,7 @@ static void skb_entail(struct sock *sk, struct sk_buff *skb) · 25 unmodified lines
657659 tcb->sacked = 0;
658660 __skb_header_release(skb);
659661 tcp_add_write_queue_tail(sk, skb);
660− sk->sk_wmem_queued += skb->truesize;
662+ sk_wmem_queued_add(sk, skb->truesize);
661663 sk_mem_charge(sk, skb->truesize);
662664 if (tp->nonagle & TCP_NAGLE_PUSH)
663665 tp->nonagle &= ~TCP_NAGLE_PUSH;
@@ -1032,10 +1034,10 @@ new_segment: · 368 unmodified lines
10321034 skb->len += copy;
10331035 skb->data_len += copy;
10341036 skb->truesize += copy;
1035− sk->sk_wmem_queued += copy;
1037+ sk_wmem_queued_add(sk, copy);
10361038 sk_mem_charge(sk, copy);
10371039 skb->ip_summed = CHECKSUM_PARTIAL;
1038− tp->write_seq += copy;
1040+ WRITE_ONCE(tp->write_seq, tp->write_seq + copy);
10391041 TCP_SKB_CB(skb)->end_seq += copy;
10401042 tcp_skb_pcount_set(skb, 0);
10411043
@@ -1362,7 +1364,7 @@ new_segment: · 320 unmodified lines
13621364 if (!copied)
13631365 TCP_SKB_CB(skb)->tcp_flags &= ~TCPHDR_PSH;
13641366
1365− tp->write_seq += copy;
1367+ WRITE_ONCE(tp->write_seq, tp->write_seq + copy);
13661368 TCP_SKB_CB(skb)->end_seq += copy;
13671369 tcp_skb_pcount_set(skb, 0);
13681370
@@ -1668,9 +1670,9 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, · 299 unmodified lines
16681670 sk_eat_skb(sk, skb);
16691671 if (!desc->count)
16701672 break;
1671− tp->copied_seq = seq;
1673+ WRITE_ONCE(tp->copied_seq, seq);
16721674 }
1673− tp->copied_seq = seq;
1675+ WRITE_ONCE(tp->copied_seq, seq);
16741676
16751677 tcp_rcv_space_adjust(sk);
16761678
@@ -1699,7 +1701,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val) · 22 unmodified lines
16991701 else
17001702 cap = sock_net(sk)->ipv4.sysctl_tcp_rmem[2] >> 1;
17011703 val = min(val, cap);
1702− sk->sk_rcvlowat = val ? : 1;
1704+ WRITE_ONCE(sk->sk_rcvlowat, val ? : 1);
17031705
17041706 /* Check if we need to signal EPOLLIN right now */
17051707 tcp_data_ready(sk);
@@ -1709,7 +1711,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val) · 3 unmodified lines
17091711
17101712 val <<= 1;
17111713 if (val > sk->sk_rcvbuf) {
1712− sk->sk_rcvbuf = val;
1714+ WRITE_ONCE(sk->sk_rcvbuf, val);
17131715 tcp_sk(sk)->window_clamp = tcp_win_from_space(sk, val);
17141716 }
17151717 return 0;
@@ -1819,7 +1821,7 @@ static int tcp_zerocopy_receive(struct sock *sk, · 103 unmodified lines
18191821 out:
18201822 up_read(&current->mm->mmap_sem);
18211823 if (length) {
1822− tp->copied_seq = seq;
1824+ WRITE_ONCE(tp->copied_seq, seq);
18231825 tcp_rcv_space_adjust(sk);
18241826
18251827 /* Clean up data we have read: This will do ACK frames. */
@@ -2117,7 +2119,7 @@ found_ok_skb: · 291 unmodified lines
21172119 if (urg_offset < used) {
21182120 if (!urg_offset) {
21192121 if (!sock_flag(sk, SOCK_URGINLINE)) {
2120− ++*seq;
2122+ WRITE_ONCE(*seq, *seq + 1);
21212123 urg_hole++;
21222124 offset++;
21232125 used--;
@@ -2139,7 +2141,7 @@ found_ok_skb: · 15 unmodified lines
21392141 }
21402142 }
21412143
2142− *seq += used;
2144+ WRITE_ONCE(*seq, *seq + used);
21432145 copied += used;
21442146 len -= used;
21452147
@@ -2166,7 +2168,7 @@ skip_copy: · 20 unmodified lines
21662168
21672169 found_fin_ok:
21682170 /* Process the FIN. */
2169− ++*seq;
2171+ WRITE_ONCE(*seq, *seq + 1);
21702172 if (!(flags & MSG_PEEK))
21712173 sk_eat_skb(sk, skb);
21722174 break;
@@ -2487,7 +2489,10 @@ adjudge_to_death: · 314 unmodified lines
24872489 }
24882490
24892491 if (sk->sk_state == TCP_CLOSE) {
2490− struct request_sock *req = tcp_sk(sk)->fastopen_rsk;
2492+ struct request_sock *req;
2493+
2494+ req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk,
2495+ lockdep_sock_is_held(sk));
24912496 /* We could get here with a non-NULL req if the socket is
24922497 * aborted (e.g., closed with unread data) before 3WHS
24932498 * finishes.
@@ -2559,6 +2564,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 65 unmodified lines
25592564 struct inet_connection_sock *icsk = inet_csk(sk);
25602565 struct tcp_sock *tp = tcp_sk(sk);
25612566 int old_state = sk->sk_state;
2567+ u32 seq;
25622568
25632569 if (old_state != TCP_CLOSE)
25642570 tcp_set_state(sk, TCP_CLOSE);
@@ -2585,7 +2591,7 @@ int tcp_disconnect(struct sock *sk, int flags) · 20 unmodified lines
25852591 __kfree_skb(sk->sk_rx_skb_cache);
25862592 sk->sk_rx_skb_cache = NULL;
25872593 }
2588− tp->copied_seq = tp->rcv_nxt;
2594+ WRITE_ONCE(tp->copied_seq, tp->rcv_nxt);
25892595 tp->urg_data = 0;
25902596 tcp_write_queue_purge(sk);
25912597 tcp_fastopen_active_disable_ofo_check(sk);
@@ -2601,9 +2607,12 @@ int tcp_disconnect(struct sock *sk, int flags) · 9 unmodified lines
26012607 tp->srtt_us = 0;
26022608 tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
26032609 tp->rcv_rtt_last_tsecr = 0;
2604− tp->write_seq += tp->max_window + 2;
2605− if (tp->write_seq == 0)
2606− tp->write_seq = 1;
2610+
2611+ seq = tp->write_seq + tp->max_window + 2;
2612+ if (!seq)
2613+ seq = 1;
2614+ WRITE_ONCE(tp->write_seq, seq);
2615+
26072616 icsk->icsk_backoff = 0;
26082617 tp->snd_cwnd = 2;
26092618 icsk->icsk_probes_out = 0;
@@ -2930,9 +2939,9 @@ static int do_tcp_setsockopt(struct sock *sk, int level, · 320 unmodified lines
29302939 if (sk->sk_state != TCP_CLOSE)
29312940 err = -EPERM;
29322941 else if (tp->repair_queue == TCP_SEND_QUEUE)
2933− tp->write_seq = val;
2942+ WRITE_ONCE(tp->write_seq, val);
29342943 else if (tp->repair_queue == TCP_RECV_QUEUE)
2935− tp->rcv_nxt = val;
2944+ WRITE_ONCE(tp->rcv_nxt, val);
29362945 else
29372946 err = -EINVAL;
29382947 break;
@@ -3831,7 +3840,13 @@ EXPORT_SYMBOL(tcp_md5_hash_key); · 892 unmodified lines
38313840
38323841 void tcp_done(struct sock *sk)
38333842 {
3834− struct request_sock *req = tcp_sk(sk)->fastopen_rsk;
3843+ struct request_sock *req;
3844+
3845+ /* We might be called with a new socket, after
3846+ * inet_csk_prepare_forced_close() has been called
3847+ * so we can not use lockdep_sock_is_held(sk)
3848+ */
3849+ req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk, 1);
38353850
38363851 if (sk->sk_state == TCP_SYN_SENT || sk->sk_state == TCP_SYN_RECV)
38373852 TCP_INC_STATS(sock_net(sk), TCP_MIB_ATTEMPTFAILS);
net/ipv4/tcp_diag.c+3−2
@@ -26,8 +26,9 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, · 25 unmodified lines
2626 } else if (sk->sk_type == SOCK_STREAM) {
2727 const struct tcp_sock *tp = tcp_sk(sk);
2828
29− r->idiag_rqueue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
30− r->idiag_wqueue = tp->write_seq - tp->snd_una;
29+ r->idiag_rqueue = max_t(int, READ_ONCE(tp->rcv_nxt) -
30+ READ_ONCE(tp->copied_seq), 0);
31+ r->idiag_wqueue = READ_ONCE(tp->write_seq) - tp->snd_una;
3132 }
3233 if (info)
3334 tcp_get_info(sk, info);
net/ipv4/tcp_fastopen.c+1−1
@@ -253,7 +253,7 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk, · 252 unmodified lines
253253 */
254254 tp = tcp_sk(child);
255255
256− tp->fastopen_rsk = req;
256+ rcu_assign_pointer(tp->fastopen_rsk, req);
257257 tcp_rsk(req)->tfo_listener = true;
258258
259259 /* RFC1323: The window in SYN & SYN/ACK segments is never
net/ipv4/tcp_input.c+22−15
@@ -359,7 +359,8 @@ static void tcp_sndbuf_expand(struct sock *sk) · 358 unmodified lines
359359 sndmem *= nr_segs * per_mss;
360360
361361 if (sk->sk_sndbuf < sndmem)
362− sk->sk_sndbuf = min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2]);
362+ WRITE_ONCE(sk->sk_sndbuf,
363+ min(sndmem, sock_net(sk)->ipv4.sysctl_tcp_wmem[2]));
363364 }
364365
365366 /* 2. Tuning advertised window (window_clamp, rcv_ssthresh)
@@ -483,8 +484,9 @@ static void tcp_clamp_window(struct sock *sk) · 117 unmodified lines
483484 !(sk->sk_userlocks & SOCK_RCVBUF_LOCK) &&
484485 !tcp_under_memory_pressure(sk) &&
485486 sk_memory_allocated(sk) < sk_prot_mem_limits(sk, 0)) {
486− sk->sk_rcvbuf = min(atomic_read(&sk->sk_rmem_alloc),
487− net->ipv4.sysctl_tcp_rmem[2]);
487+ WRITE_ONCE(sk->sk_rcvbuf,
488+ min(atomic_read(&sk->sk_rmem_alloc),
489+ net->ipv4.sysctl_tcp_rmem[2]));
488490 }
489491 if (atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf)
490492 tp->rcv_ssthresh = min(tp->window_clamp, 2U * tp->advmss);
@@ -648,7 +650,7 @@ void tcp_rcv_space_adjust(struct sock *sk) · 157 unmodified lines
648650 rcvbuf = min_t(u64, rcvwin * rcvmem,
649651 sock_net(sk)->ipv4.sysctl_tcp_rmem[2]);
650652 if (rcvbuf > sk->sk_rcvbuf) {
651− sk->sk_rcvbuf = rcvbuf;
653+ WRITE_ONCE(sk->sk_rcvbuf, rcvbuf);
652654
653655 /* Make the window clamp follow along. */
654656 tp->window_clamp = tcp_win_from_space(sk, rcvbuf);
@@ -2666,7 +2668,7 @@ static void tcp_process_loss(struct sock *sk, int flag, int num_dupack, · 2011 unmodified lines
26662668 struct tcp_sock *tp = tcp_sk(sk);
26672669 bool recovered = !before(tp->snd_una, tp->high_seq);
26682670
2669− if ((flag & FLAG_SND_UNA_ADVANCED || tp->fastopen_rsk) &&
2671+ if ((flag & FLAG_SND_UNA_ADVANCED || rcu_access_pointer(tp->fastopen_rsk)) &&
26702672 tcp_try_undo_loss(sk, false))
26712673 return;
26722674
@@ -2990,7 +2992,7 @@ void tcp_rearm_rto(struct sock *sk) · 317 unmodified lines
29902992 /* If the retrans timer is currently being used by Fast Open
29912993 * for SYN-ACK retrans purpose, stay put.
29922994 */
2993− if (tp->fastopen_rsk)
2995+ if (rcu_access_pointer(tp->fastopen_rsk))
29942996 return;
29952997
29962998 if (!tp->packets_out) {
@@ -3362,7 +3364,7 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) · 365 unmodified lines
33623364
33633365 sock_owned_by_me((struct sock *)tp);
33643366 tp->bytes_received += delta;
3365− tp->rcv_nxt = seq;
3367+ WRITE_ONCE(tp->rcv_nxt, seq);
33663368 }
33673369
33683370 /* Update our send window.
@@ -5356,7 +5358,7 @@ static void tcp_check_urg(struct sock *sk, const struct tcphdr *th) · 1987 unmodified lines
53565358 }
53575359
53585360 tp->urg_data = TCP_URG_NOTYET;
5359− tp->urg_seq = ptr;
5361+ WRITE_ONCE(tp->urg_seq, ptr);
53605362
53615363 /* Disable header prediction. */
53625364 tp->pred_flags = 0;
@@ -5932,7 +5934,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 569 unmodified lines
59325934 /* Ok.. it's good. Set up sequence numbers and
59335935 * move to established.
59345936 */
5935− tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
5937+ WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1);
59365938 tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1;
59375939
59385940 /* RFC1323: The window in SYN & SYN/ACK segments is
@@ -5961,7 +5963,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, · 22 unmodified lines
59615963 /* Remember, tcp_poll() does not lock socket!
59625964 * Change state from SYN-SENT only after copied_seq
59635965 * is initialized. */
5964− tp->copied_seq = tp->rcv_nxt;
5966+ WRITE_ONCE(tp->copied_seq, tp->rcv_nxt);
59655967
59665968 smc_check_reset_syn(tp);
59675969
@@ -6035,8 +6037,8 @@ discard: · 67 unmodified lines
60356037 tp->tcp_header_len = sizeof(struct tcphdr);
60366038 }
60376039
6038− tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1;
6039− tp->copied_seq = tp->rcv_nxt;
6040+ WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1);
6041+ WRITE_ONCE(tp->copied_seq, tp->rcv_nxt);
60406042 tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1;
60416043
60426044 /* RFC1323: The window in SYN & SYN/ACK segments is
@@ -6087,6 +6089,8 @@ reset_and_undo: · 44 unmodified lines
60876089
60886090 static void tcp_rcv_synrecv_state_fastopen(struct sock *sk)
60896091 {
6092+ struct request_sock *req;
6093+
60906094 tcp_try_undo_loss(sk, false);
60916095
60926096 /* Reset rtx states to prevent spurious retransmits_timed_out() */
@@ -6096,7 +6100,9 @@ static void tcp_rcv_synrecv_state_fastopen(struct sock *sk) · 3 unmodified lines
60966100 /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1,
60976101 * we no longer need req so release it.
60986102 */
6099− reqsk_fastopen_remove(sk, tcp_sk(sk)->fastopen_rsk, false);
6103+ req = rcu_dereference_protected(tcp_sk(sk)->fastopen_rsk,
6104+ lockdep_sock_is_held(sk));
6105+ reqsk_fastopen_remove(sk, req, false);
61006106
61016107 /* Re-arm the timer because data may have been sent out.
61026108 * This is similar to the regular data transmission case
@@ -6171,7 +6177,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) · 68 unmodified lines
61716177
61726178 tcp_mstamp_refresh(tp);
61736179 tp->rx_opt.saw_tstamp = 0;
6174− req = tp->fastopen_rsk;
6180+ req = rcu_dereference_protected(tp->fastopen_rsk,
6181+ lockdep_sock_is_held(sk));
61756182 if (req) {
61766183 bool req_stolen;
61776184
@@ -6211,7 +6218,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb) · 33 unmodified lines
62116218 tcp_try_undo_spurious_syn(sk);
62126219 tp->retrans_stamp = 0;
62136220 tcp_init_transfer(sk, BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB);
6214− tp->copied_seq = tp->rcv_nxt;
6221+ WRITE_ONCE(tp->copied_seq, tp->rcv_nxt);
62156222 }
62166223 smp_mb();
62176224 tcp_set_state(sk, TCP_ESTABLISHED);
net/ipv4/tcp_ipv4.c+17−13
@@ -164,9 +164,11 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) · 163 unmodified lines
164164 * without appearing to create any others.
165165 */
166166 if (likely(!tp->repair)) {
167− tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2;
168− if (tp->write_seq == 0)
169− tp->write_seq = 1;
167+ u32 seq = tcptw->tw_snd_nxt + 65535 + 2;
168+
169+ if (!seq)
170+ seq = 1;
171+ WRITE_ONCE(tp->write_seq, seq);
170172 tp->rx_opt.ts_recent = tcptw->tw_ts_recent;
171173 tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp;
172174 }
@@ -253,7 +255,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 80 unmodified lines
253255 tp->rx_opt.ts_recent = 0;
254256 tp->rx_opt.ts_recent_stamp = 0;
255257 if (likely(!tp->repair))
256− tp->write_seq = 0;
258+ WRITE_ONCE(tp->write_seq, 0);
257259 }
258260
259261 inet->inet_dport = usin->sin_port;
@@ -291,10 +293,11 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) · 31 unmodified lines
291293
292294 if (likely(!tp->repair)) {
293295 if (!tp->write_seq)
294− tp->write_seq = secure_tcp_seq(inet->inet_saddr,
295− inet->inet_daddr,
296− inet->inet_sport,
297− usin->sin_port);
296+ WRITE_ONCE(tp->write_seq,
297+ secure_tcp_seq(inet->inet_saddr,
298+ inet->inet_daddr,
299+ inet->inet_sport,
300+ usin->sin_port));
298301 tp->tsoffset = secure_tcp_ts_off(sock_net(sk),
299302 inet->inet_saddr,
300303 inet->inet_daddr);
@@ -478,7 +481,7 @@ int tcp_v4_err(struct sk_buff *icmp_skb, u32 info) · 177 unmodified lines
478481 icsk = inet_csk(sk);
479482 tp = tcp_sk(sk);
480483 /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */
481− fastopen = tp->fastopen_rsk;
484+ fastopen = rcu_dereference(tp->fastopen_rsk);
482485 snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una;
483486 if (sk->sk_state != TCP_LISTEN &&
484487 !between(seq, snd_una, tp->snd_nxt)) {
@@ -1644,7 +1647,7 @@ int tcp_v4_early_demux(struct sk_buff *skb) · 1159 unmodified lines
16441647
16451648 bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb)
16461649 {
1647− u32 limit = sk->sk_rcvbuf + sk->sk_sndbuf;
1650+ u32 limit = READ_ONCE(sk->sk_rcvbuf) + READ_ONCE(sk->sk_sndbuf);
16481651 struct skb_shared_info *shinfo;
16491652 const struct tcphdr *th;
16501653 struct tcphdr *thtail;
@@ -2121,7 +2124,7 @@ void tcp_v4_destroy_sock(struct sock *sk) · 470 unmodified lines
21212124 if (inet_csk(sk)->icsk_bind_hash)
21222125 inet_put_port(sk);
21232126
2124− BUG_ON(tp->fastopen_rsk);
2127+ BUG_ON(rcu_access_pointer(tp->fastopen_rsk));
21252128
21262129 /* If socket is aborted during connect operation */
21272130 tcp_free_fastopen_req(tp);
@@ -2455,12 +2458,13 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i) · 327 unmodified lines
24552458 /* Because we don't lock the socket,
24562459 * we might find a transient negative value.
24572460 */
2458− rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
2461+ rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) -
2462+ READ_ONCE(tp->copied_seq), 0);
24592463
24602464 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
24612465 "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d",
24622466 i, src, srcp, dest, destp, state,
2463− tp->write_seq - tp->snd_una,
2467+ READ_ONCE(tp->write_seq) - tp->snd_una,
24642468 rx_queue,
24652469 timer_active,
24662470 jiffies_delta_to_clock_t(timer_expires - jiffies),
net/ipv4/tcp_minisocks.c+11−6
@@ -462,6 +462,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 461 unmodified lines
462462 struct tcp_request_sock *treq = tcp_rsk(req);
463463 struct inet_connection_sock *newicsk;
464464 struct tcp_sock *oldtp, *newtp;
465+ u32 seq;
465466
466467 if (!newsk)
467468 return NULL;
@@ -475,12 +476,16 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 7 unmodified lines
475476 /* Now setup tcp_sock */
476477 newtp->pred_flags = 0;
477478
478− newtp->rcv_wup = newtp->copied_seq =
479− newtp->rcv_nxt = treq->rcv_isn + 1;
479+ seq = treq->rcv_isn + 1;
480+ newtp->rcv_wup = seq;
481+ WRITE_ONCE(newtp->copied_seq, seq);
482+ WRITE_ONCE(newtp->rcv_nxt, seq);
480483 newtp->segs_in = 1;
481484
482− newtp->snd_sml = newtp->snd_una =
483− newtp->snd_nxt = newtp->snd_up = treq->snt_isn + 1;
485+ seq = treq->snt_isn + 1;
486+ newtp->snd_sml = newtp->snd_una = seq;
487+ WRITE_ONCE(newtp->snd_nxt, seq);
488+ newtp->snd_up = seq;
484489
485490 INIT_LIST_HEAD(&newtp->tsq_node);
486491 INIT_LIST_HEAD(&newtp->tsorted_sent_queue);
@@ -495,7 +500,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 8 unmodified lines
495500 newtp->total_retrans = req->num_retrans;
496501
497502 tcp_init_xmit_timers(newsk);
498− newtp->write_seq = newtp->pushed_seq = treq->snt_isn + 1;
503+ WRITE_ONCE(newtp->write_seq, newtp->pushed_seq = treq->snt_isn + 1);
499504
500505 if (sock_flag(newsk, SOCK_KEEPOPEN))
501506 inet_csk_reset_keepalive_timer(newsk,
@@ -541,7 +546,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, · 39 unmodified lines
541546 newtp->rx_opt.mss_clamp = req->mss;
542547 tcp_ecn_openreq_child(newtp, req);
543548 newtp->fastopen_req = NULL;
544− newtp->fastopen_rsk = NULL;
549+ RCU_INIT_POINTER(newtp->fastopen_rsk, NULL);
545550
546551 __TCP_INC_STATS(sock_net(sk), TCP_MIB_PASSIVEOPENS);
547552
net/ipv4/tcp_output.c+16−16
@@ -67,7 +67,7 @@ static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb) · 66 unmodified lines
6767 struct tcp_sock *tp = tcp_sk(sk);
6868 unsigned int prior_packets = tp->packets_out;
6969
70− tp->snd_nxt = TCP_SKB_CB(skb)->end_seq;
70+ WRITE_ONCE(tp->snd_nxt, TCP_SKB_CB(skb)->end_seq);
7171
7272 __skb_unlink(skb, &sk->sk_write_queue);
7373 tcp_rbtree_insert(&sk->tcp_rtx_queue, skb);
@@ -1196,10 +1196,10 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb) · 1122 unmodified lines
11961196 struct tcp_sock *tp = tcp_sk(sk);
11971197
11981198 /* Advance write_seq and place onto the write_queue. */
1199− tp->write_seq = TCP_SKB_CB(skb)->end_seq;
1199+ WRITE_ONCE(tp->write_seq, TCP_SKB_CB(skb)->end_seq);
12001200 __skb_header_release(skb);
12011201 tcp_add_write_queue_tail(sk, skb);
1202− sk->sk_wmem_queued += skb->truesize;
1202+ sk_wmem_queued_add(sk, skb->truesize);
12031203 sk_mem_charge(sk, skb->truesize);
12041204 }
12051205
@@ -1333,7 +1333,7 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue, · 127 unmodified lines
13331333 return -ENOMEM; /* We'll just try again later. */
13341334 skb_copy_decrypted(buff, skb);
13351335
1336− sk->sk_wmem_queued += buff->truesize;
1336+ sk_wmem_queued_add(sk, buff->truesize);
13371337 sk_mem_charge(sk, buff->truesize);
13381338 nlen = skb->len - len - nsize;
13391339 buff->truesize += nlen;
@@ -1443,7 +1443,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len) · 103 unmodified lines
14431443
14441444 if (delta_truesize) {
14451445 skb->truesize -= delta_truesize;
1446− sk->sk_wmem_queued -= delta_truesize;
1446+ sk_wmem_queued_add(sk, -delta_truesize);
14471447 sk_mem_uncharge(sk, delta_truesize);
14481448 sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
14491449 }
@@ -1888,7 +1888,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len, · 438 unmodified lines
18881888 return -ENOMEM;
18891889 skb_copy_decrypted(buff, skb);
18901890
1891− sk->sk_wmem_queued += buff->truesize;
1891+ sk_wmem_queued_add(sk, buff->truesize);
18921892 sk_mem_charge(sk, buff->truesize);
18931893 buff->truesize += nlen;
18941894 skb->truesize -= nlen;
@@ -2152,7 +2152,7 @@ static int tcp_mtu_probe(struct sock *sk) · 257 unmodified lines
21522152 nskb = sk_stream_alloc_skb(sk, probe_size, GFP_ATOMIC, false);
21532153 if (!nskb)
21542154 return -1;
2155− sk->sk_wmem_queued += nskb->truesize;
2155+ sk_wmem_queued_add(sk, nskb->truesize);
21562156 sk_mem_charge(sk, nskb->truesize);
21572157
21582158 skb = tcp_send_head(sk);
@@ -2482,7 +2482,7 @@ bool tcp_schedule_loss_probe(struct sock *sk, bool advancing_rto) · 323 unmodified lines
24822482 /* Don't do any loss probe on a Fast Open connection before 3WHS
24832483 * finishes.
24842484 */
2485− if (tp->fastopen_rsk)
2485+ if (rcu_access_pointer(tp->fastopen_rsk))
24862486 return false;
24872487
24882488 early_retrans = sock_net(sk)->ipv4.sysctl_tcp_early_retrans;
@@ -3142,7 +3142,7 @@ void tcp_send_fin(struct sock *sk) · 653 unmodified lines
31423142 * if FIN had been sent. This is because retransmit path
31433143 * does not change tp->snd_nxt.
31443144 */
3145− tp->snd_nxt++;
3145+ WRITE_ONCE(tp->snd_nxt, tp->snd_nxt + 1);
31463146 return;
31473147 }
31483148 } else {
@@ -3222,7 +3222,7 @@ int tcp_send_synack(struct sock *sk) · 73 unmodified lines
32223222 tcp_rtx_queue_unlink_and_free(skb, sk);
32233223 __skb_header_release(nskb);
32243224 tcp_rbtree_insert(&sk->tcp_rtx_queue, nskb);
3225− sk->sk_wmem_queued += nskb->truesize;
3225+ sk_wmem_queued_add(sk, nskb->truesize);
32263226 sk_mem_charge(sk, nskb->truesize);
32273227 skb = nskb;
32283228 }
@@ -3426,14 +3426,14 @@ static void tcp_connect_init(struct sock *sk) · 197 unmodified lines
34263426 tp->snd_una = tp->write_seq;
34273427 tp->snd_sml = tp->write_seq;
34283428 tp->snd_up = tp->write_seq;
3429− tp->snd_nxt = tp->write_seq;
3429+ WRITE_ONCE(tp->snd_nxt, tp->write_seq);
34303430
34313431 if (likely(!tp->repair))
34323432 tp->rcv_nxt = 0;
34333433 else
34343434 tp->rcv_tstamp = tcp_jiffies32;
34353435 tp->rcv_wup = tp->rcv_nxt;
3436− tp->copied_seq = tp->rcv_nxt;
3436+ WRITE_ONCE(tp->copied_seq, tp->rcv_nxt);
34373437
34383438 inet_csk(sk)->icsk_rto = tcp_timeout_init(sk);
34393439 inet_csk(sk)->icsk_retransmits = 0;
@@ -3447,9 +3447,9 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb) · 7 unmodified lines
34473447
34483448 tcb->end_seq += skb->len;
34493449 __skb_header_release(skb);
3450− sk->sk_wmem_queued += skb->truesize;
3450+ sk_wmem_queued_add(sk, skb->truesize);
34513451 sk_mem_charge(sk, skb->truesize);
3452− tp->write_seq = tcb->end_seq;
3452+ WRITE_ONCE(tp->write_seq, tcb->end_seq);
34533453 tp->packets_out += tcp_skb_pcount(skb);
34543454 }
34553455
@@ -3586,11 +3586,11 @@ int tcp_connect(struct sock *sk) · 130 unmodified lines
35863586 /* We change tp->snd_nxt after the tcp_transmit_skb() call
35873587 * in order to make this packet get counted in tcpOutSegs.
35883588 */
3589− tp->snd_nxt = tp->write_seq;
3589+ WRITE_ONCE(tp->snd_nxt, tp->write_seq);
35903590 tp->pushed_seq = tp->write_seq;
35913591 buff = tcp_send_head(sk);
35923592 if (unlikely(buff)) {
3593− tp->snd_nxt = TCP_SKB_CB(buff)->seq;
3593+ WRITE_ONCE(tp->snd_nxt, TCP_SKB_CB(buff)->seq);
35943594 tp->pushed_seq = TCP_SKB_CB(buff)->seq;
35953595 }
35963596 TCP_INC_STATS(sock_net(sk), TCP_MIB_ACTIVEOPENS);
net/ipv4/tcp_timer.c+6−5
@@ -386,15 +386,13 @@ abort: tcp_write_err(sk); · 385 unmodified lines
386386 * Timer for Fast Open socket to retransmit SYNACK. Note that the
387387 * sk here is the child socket, not the parent (listener) socket.
388388 */
389−static void tcp_fastopen_synack_timer(struct sock *sk)
389+static void tcp_fastopen_synack_timer(struct sock *sk, struct request_sock *req)
390390 {
391391 struct inet_connection_sock *icsk = inet_csk(sk);
392392 int max_retries = icsk->icsk_syn_retries ? :
393393 sock_net(sk)->ipv4.sysctl_tcp_synack_retries + 1; /* add one more retry for fastopen */
394394 struct tcp_sock *tp = tcp_sk(sk);
395− struct request_sock *req;
396395
397− req = tcp_sk(sk)->fastopen_rsk;
398396 req->rsk_ops->syn_ack_timeout(req);
399397
400398 if (req->num_timeout >= max_retries) {
@@ -435,11 +433,14 @@ void tcp_retransmit_timer(struct sock *sk) · 34 unmodified lines
435433 struct tcp_sock *tp = tcp_sk(sk);
436434 struct net *net = sock_net(sk);
437435 struct inet_connection_sock *icsk = inet_csk(sk);
436+ struct request_sock *req;
438437
439− if (tp->fastopen_rsk) {
438+ req = rcu_dereference_protected(tp->fastopen_rsk,
439+ lockdep_sock_is_held(sk));
440+ if (req) {
440441 WARN_ON_ONCE(sk->sk_state != TCP_SYN_RECV &&
441442 sk->sk_state != TCP_FIN_WAIT1);
442− tcp_fastopen_synack_timer(sk);
443+ tcp_fastopen_synack_timer(sk, req);
443444 /* Before we receive ACK to our SYN-ACK don't retransmit
444445 * anything else (e.g., data or FIN segments).
445446 */
net/ipv6/ip6_gre.c+1−0
@@ -2192,6 +2192,7 @@ static void ip6erspan_tap_setup(struct net_device *dev) · 2191 unmodified lines
21922192 {
21932193 ether_setup(dev);
21942194
2195+ dev->max_mtu = 0;
21952196 dev->netdev_ops = &ip6erspan_netdev_ops;
21962197 dev->needs_free_netdev = true;
21972198 dev->priv_destructor = ip6gre_dev_free;
net/ipv6/ip6_output.c+3−0
@@ -768,6 +768,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 767 unmodified lines
768768 inet6_sk(skb->sk) : NULL;
769769 struct ip6_frag_state state;
770770 unsigned int mtu, hlen, nexthdr_offset;
771+ ktime_t tstamp = skb->tstamp;
771772 int hroom, err = 0;
772773 __be32 frag_id;
773774 u8 *prevhdr, nexthdr = 0;
@@ -855,6 +856,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 81 unmodified lines
855856 if (iter.frag)
856857 ip6_fraglist_prepare(skb, &iter);
857858
859+ skb->tstamp = tstamp;
858860 err = output(net, sk, skb);
859861 if (!err)
860862 IP6_INC_STATS(net, ip6_dst_idev(&rt->dst),
@@ -913,6 +915,7 @@ slow_path: · 52 unmodified lines
913915 /*
914916 * Put this fragment into the sending queue.
915917 */
918+ frag->tstamp = tstamp;
916919 err = output(net, sk, frag);
917920 if (err)
918921 goto fail;
net/ipv6/netfilter.c+3−0
@@ -119,6 +119,7 @@ int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 118 unmodified lines
119119 struct sk_buff *))
120120 {
121121 int frag_max_size = BR_INPUT_SKB_CB(skb)->frag_max_size;
122+ ktime_t tstamp = skb->tstamp;
122123 struct ip6_frag_state state;
123124 u8 *prevhdr, nexthdr = 0;
124125 unsigned int mtu, hlen;
@@ -183,6 +184,7 @@ int br_ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, · 58 unmodified lines
183184 if (iter.frag)
184185 ip6_fraglist_prepare(skb, &iter);
185186
187+ skb->tstamp = tstamp;
186188 err = output(net, sk, data, skb);
187189 if (err || !iter.frag)
188190 break;
@@ -215,6 +217,7 @@ slow_path: · 26 unmodified lines
215217 goto blackhole;
216218 }
217219
220+ skb2->tstamp = tstamp;
218221 err = output(net, sk, data, skb2);
219222 if (err)
220223 goto blackhole;
net/ipv6/tcp_ipv6.c+10−8
@@ -215,7 +215,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, · 214 unmodified lines
215215 !ipv6_addr_equal(&sk->sk_v6_daddr, &usin->sin6_addr)) {
216216 tp->rx_opt.ts_recent = 0;
217217 tp->rx_opt.ts_recent_stamp = 0;
218− tp->write_seq = 0;
218+ WRITE_ONCE(tp->write_seq, 0);
219219 }
220220
221221 sk->sk_v6_daddr = usin->sin6_addr;
@@ -311,10 +311,11 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, · 89 unmodified lines
311311
312312 if (likely(!tp->repair)) {
313313 if (!tp->write_seq)
314− tp->write_seq = secure_tcpv6_seq(np->saddr.s6_addr32,
315− sk->sk_v6_daddr.s6_addr32,
316− inet->inet_sport,
317− inet->inet_dport);
314+ WRITE_ONCE(tp->write_seq,
315+ secure_tcpv6_seq(np->saddr.s6_addr32,
316+ sk->sk_v6_daddr.s6_addr32,
317+ inet->inet_sport,
318+ inet->inet_dport));
318319 tp->tsoffset = secure_tcpv6_ts_off(sock_net(sk),
319320 np->saddr.s6_addr32,
320321 sk->sk_v6_daddr.s6_addr32);
@@ -406,7 +407,7 @@ static int tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, · 85 unmodified lines
406407
407408 tp = tcp_sk(sk);
408409 /* XXX (TFO) - tp->snd_una should be ISN (tcp_create_openreq_child() */
409− fastopen = tp->fastopen_rsk;
410+ fastopen = rcu_dereference(tp->fastopen_rsk);
410411 snd_una = fastopen ? tcp_rsk(fastopen)->snt_isn : tp->snd_una;
411412 if (sk->sk_state != TCP_LISTEN &&
412413 !between(seq, snd_una, tp->snd_nxt)) {
@@ -1895,7 +1896,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) · 1482 unmodified lines
18951896 /* Because we don't lock the socket,
18961897 * we might find a transient negative value.
18971898 */
1898− rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
1899+ rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) -
1900+ READ_ONCE(tp->copied_seq), 0);
18991901
19001902 seq_printf(seq,
19011903 "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
@@ -1906,7 +1908,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) · 4 unmodified lines
19061908 dest->s6_addr32[0], dest->s6_addr32[1],
19071909 dest->s6_addr32[2], dest->s6_addr32[3], destp,
19081910 state,
1909− tp->write_seq - tp->snd_una,
1911+ READ_ONCE(tp->write_seq) - tp->snd_una,
19101912 rx_queue,
19111913 timer_active,
19121914 jiffies_delta_to_clock_t(timer_expires - jiffies),
net/llc/af_llc.c+20−14
@@ -113,22 +113,26 @@ static inline u8 llc_ui_header_len(struct sock *sk, struct sockaddr_llc *addr) · 112 unmodified lines
113113 *
114114 * Send data via reliable llc2 connection.
115115 * Returns 0 upon success, non-zero if action did not succeed.
116+ *
117+ * This function always consumes a reference to the skb.
116118 */
117119 static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)
118120 {
119121 struct llc_sock* llc = llc_sk(sk);
120− int rc = 0;
121122
122123 if (unlikely(llc_data_accept_state(llc->state) ||
123124 llc->remote_busy_flag ||
124125 llc->p_flag)) {
125126 long timeout = sock_sndtimeo(sk, noblock);
127+ int rc;
126128
127129 rc = llc_ui_wait_for_busy_core(sk, timeout);
130+ if (rc) {
131+ kfree_skb(skb);
132+ return rc;
133+ }
128134 }
129− if (unlikely(!rc))
130− rc = llc_build_and_send_pkt(sk, skb);
131− return rc;
135+ return llc_build_and_send_pkt(sk, skb);
132136 }
133137
134138 static void llc_ui_sk_init(struct socket *sock, struct sock *sk)
@@ -899,7 +903,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 764 unmodified lines
899903 DECLARE_SOCKADDR(struct sockaddr_llc *, addr, msg->msg_name);
900904 int flags = msg->msg_flags;
901905 int noblock = flags & MSG_DONTWAIT;
902− struct sk_buff *skb;
906+ struct sk_buff *skb = NULL;
903907 size_t size = 0;
904908 int rc = -EINVAL, copied = 0, hdrlen;
905909
@@ -908,10 +912,10 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 2 unmodified lines
908912 lock_sock(sk);
909913 if (addr) {
910914 if (msg->msg_namelen < sizeof(*addr))
911− goto release;
915+ goto out;
912916 } else {
913917 if (llc_ui_addr_null(&llc->addr))
914− goto release;
918+ goto out;
915919 addr = &llc->addr;
916920 }
917921 /* must bind connection to sap if user hasn't done it. */
@@ -919,7 +923,7 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 1 unmodified line
919923 /* bind to sap with null dev, exclusive. */
920924 rc = llc_ui_autobind(sock, addr);
921925 if (rc)
922− goto release;
926+ goto out;
923927 }
924928 hdrlen = llc->dev->hard_header_len + llc_ui_header_len(sk, addr);
925929 size = hdrlen + len;
@@ -928,12 +932,12 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 2 unmodified lines
928932 copied = size - hdrlen;
929933 rc = -EINVAL;
930934 if (copied < 0)
931− goto release;
935+ goto out;
932936 release_sock(sk);
933937 skb = sock_alloc_send_skb(sk, size, noblock, &rc);
934938 lock_sock(sk);
935939 if (!skb)
936− goto release;
940+ goto out;
937941 skb->dev = llc->dev;
938942 skb->protocol = llc_proto_type(addr->sllc_arphrd);
939943 skb_reserve(skb, hdrlen);
@@ -943,29 +947,31 @@ static int llc_ui_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) · 3 unmodified lines
943947 if (sk->sk_type == SOCK_DGRAM || addr->sllc_ua) {
944948 llc_build_and_send_ui_pkt(llc->sap, skb, addr->sllc_mac,
945949 addr->sllc_sap);
950+ skb = NULL;
946951 goto out;
947952 }
948953 if (addr->sllc_test) {
949954 llc_build_and_send_test_pkt(llc->sap, skb, addr->sllc_mac,
950955 addr->sllc_sap);
956+ skb = NULL;
951957 goto out;
952958 }
953959 if (addr->sllc_xid) {
954960 llc_build_and_send_xid_pkt(llc->sap, skb, addr->sllc_mac,
955961 addr->sllc_sap);
962+ skb = NULL;
956963 goto out;
957964 }
958965 rc = -ENOPROTOOPT;
959966 if (!(sk->sk_type == SOCK_STREAM && !addr->sllc_ua))
960967 goto out;
961968 rc = llc_ui_send_data(sk, skb, noblock);
969+ skb = NULL;
962970 out:
963− if (rc) {
964− kfree_skb(skb);
965−release:
971+ kfree_skb(skb);
972+ if (rc)
966973 dprintk("%s: failed sending from %02X to %02X: %d\n",
967974 __func__, llc->laddr.lsap, llc->daddr.lsap, rc);
968− }
969975 release_sock(sk);
970976 return rc ? : copied;
971977 }
net/llc/llc_c_ac.c+6−2
@@ -372,6 +372,7 @@ int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb) · 371 unmodified lines
372372 llc_pdu_init_as_i_cmd(skb, 1, llc->vS, llc->vR);
373373 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
374374 if (likely(!rc)) {
375+ skb_get(skb);
375376 llc_conn_send_pdu(sk, skb);
376377 llc_conn_ac_inc_vs_by_1(sk, skb);
377378 }
@@ -389,7 +390,8 @@ static int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, struct sk_buff *skb) · 11 unmodified lines
389390 llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR);
390391 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
391392 if (likely(!rc)) {
392− rc = llc_conn_send_pdu(sk, skb);
393+ skb_get(skb);
394+ llc_conn_send_pdu(sk, skb);
393395 llc_conn_ac_inc_vs_by_1(sk, skb);
394396 }
395397 return rc;
@@ -406,6 +408,7 @@ int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb) · 10 unmodified lines
406408 llc_pdu_init_as_i_cmd(skb, 0, llc->vS, llc->vR);
407409 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
408410 if (likely(!rc)) {
411+ skb_get(skb);
409412 llc_conn_send_pdu(sk, skb);
410413 llc_conn_ac_inc_vs_by_1(sk, skb);
411414 }
@@ -916,7 +919,8 @@ static int llc_conn_ac_send_i_rsp_f_set_ackpf(struct sock *sk, · 504 unmodified lines
916919 llc_pdu_init_as_i_cmd(skb, llc->ack_pf, llc->vS, llc->vR);
917920 rc = llc_mac_hdr_init(skb, llc->dev->dev_addr, llc->daddr.mac);
918921 if (likely(!rc)) {
919− rc = llc_conn_send_pdu(sk, skb);
922+ skb_get(skb);
923+ llc_conn_send_pdu(sk, skb);
920924 llc_conn_ac_inc_vs_by_1(sk, skb);
921925 }
922926 return rc;
net/llc/llc_conn.c+18−51
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #endif
3131
3232 static int llc_find_offset(int state, int ev_type);
33−static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *skb);
33+static void llc_conn_send_pdus(struct sock *sk);
3434 static int llc_conn_service(struct sock *sk, struct sk_buff *skb);
3535 static int llc_exec_conn_trans_actions(struct sock *sk,
3636 struct llc_conn_state_trans *trans,
@@ -55,6 +55,8 @@ int sysctl_llc2_busy_timeout = LLC2_BUSY_TIME * HZ; · 18 unmodified lines
5555 * (executing it's actions and changing state), upper layer will be
5656 * indicated or confirmed, if needed. Returns 0 for success, 1 for
5757 * failure. The socket lock has to be held before calling this function.
58+ *
59+ * This function always consumes a reference to the skb.
5860 */
5961 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
6062 {
@@ -62,12 +64,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 1 unmodified line
6264 struct llc_sock *llc = llc_sk(skb->sk);
6365 struct llc_conn_state_ev *ev = llc_conn_ev(skb);
6466
65− /*
66− * We have to hold the skb, because llc_conn_service will kfree it in
67− * the sending path and we need to look at the skb->cb, where we encode
68− * llc_conn_state_ev.
69− */
70− skb_get(skb);
7167 ev->ind_prim = ev->cfm_prim = 0;
7268 /*
7369 * Send event to state machine
@@ -75,21 +71,12 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 1 unmodified line
7571 rc = llc_conn_service(skb->sk, skb);
7672 if (unlikely(rc != 0)) {
7773 printk(KERN_ERR "%s: llc_conn_service failed\n", __func__);
78− goto out_kfree_skb;
79− }
80−
81− if (unlikely(!ev->ind_prim && !ev->cfm_prim)) {
82− /* indicate or confirm not required */
83− if (!skb->next)
84− goto out_kfree_skb;
8574 goto out_skb_put;
8675 }
8776
88− if (unlikely(ev->ind_prim && ev->cfm_prim)) /* Paranoia */
89− skb_get(skb);
90−
9177 switch (ev->ind_prim) {
9278 case LLC_DATA_PRIM:
79+ skb_get(skb);
9380 llc_save_primitive(sk, skb, LLC_DATA_PRIM);
9481 if (unlikely(sock_queue_rcv_skb(sk, skb))) {
9582 /*
@@ -106,6 +93,7 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 10 unmodified lines
10693 * skb->sk pointing to the newly created struct sock in
10794 * llc_conn_handler. -acme
10895 */
96+ skb_get(skb);
10997 skb_queue_tail(&sk->sk_receive_queue, skb);
11098 sk->sk_state_change(sk);
11199 break;
@@ -121,7 +109,6 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 9 unmodified lines
121109 sk->sk_state_change(sk);
122110 }
123111 }
124− kfree_skb(skb);
125112 sock_put(sk);
126113 break;
127114 case LLC_RESET_PRIM:
@@ -130,14 +117,11 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 2 unmodified lines
130117 * RESET is not being notified to upper layers for now
131118 */
132119 printk(KERN_INFO "%s: received a reset ind!\n", __func__);
133− kfree_skb(skb);
134120 break;
135121 default:
136− if (ev->ind_prim) {
122+ if (ev->ind_prim)
137123 printk(KERN_INFO "%s: received unknown %d prim!\n",
138124 __func__, ev->ind_prim);
139− kfree_skb(skb);
140− }
141125 /* No indication */
142126 break;
143127 }
@@ -179,25 +163,22 @@ int llc_conn_state_process(struct sock *sk, struct sk_buff *skb) · 35 unmodified lines
179163 printk(KERN_INFO "%s: received a reset conf!\n", __func__);
180164 break;
181165 default:
182− if (ev->cfm_prim) {
166+ if (ev->cfm_prim)
183167 printk(KERN_INFO "%s: received unknown %d prim!\n",
184168 __func__, ev->cfm_prim);
185− break;
186− }
187− goto out_skb_put; /* No confirmation */
169+ /* No confirmation */
170+ break;
188171 }
189−out_kfree_skb:
190− kfree_skb(skb);
191172 out_skb_put:
192173 kfree_skb(skb);
193174 return rc;
194175 }
195176
196−int llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
177+void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb)
197178 {
198179 /* queue PDU to send to MAC layer */
199180 skb_queue_tail(&sk->sk_write_queue, skb);
200− return llc_conn_send_pdus(sk, skb);
181+ llc_conn_send_pdus(sk);
201182 }
202183
203184 /**
@@ -255,7 +236,7 @@ void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit) · 51 unmodified lines
255236 if (howmany_resend > 0)
256237 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO;
257238 /* any PDUs to re-send are queued up; start sending to MAC */
258− llc_conn_send_pdus(sk, NULL);
239+ llc_conn_send_pdus(sk);
259240 out:;
260241 }
261242
@@ -296,7 +277,7 @@ void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit) · 34 unmodified lines
296277 if (howmany_resend > 0)
297278 llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO;
298279 /* any PDUs to re-send are queued up; start sending to MAC */
299− llc_conn_send_pdus(sk, NULL);
280+ llc_conn_send_pdus(sk);
300281 out:;
301282 }
302283
@@ -340,16 +321,12 @@ out: · 37 unmodified lines
340321 /**
341322 * llc_conn_send_pdus - Sends queued PDUs
342323 * @sk: active connection
343− * @hold_skb: the skb held by caller, or NULL if does not care
344324 *
345− * Sends queued pdus to MAC layer for transmission. When @hold_skb is
346− * NULL, always return 0. Otherwise, return 0 if @hold_skb is sent
347− * successfully, or 1 for failure.
325+ * Sends queued pdus to MAC layer for transmission.
348326 */
349−static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb)
327+static void llc_conn_send_pdus(struct sock *sk)
350328 {
351329 struct sk_buff *skb;
352− int ret = 0;
353330
354331 while ((skb = skb_dequeue(&sk->sk_write_queue)) != NULL) {
355332 struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
@@ -361,20 +338,10 @@ static int llc_conn_send_pdus(struct sock *sk, struct sk_buff *hold_skb) · 5 unmodified lines
361338 skb_queue_tail(&llc_sk(sk)->pdu_unack_q, skb);
362339 if (!skb2)
363340 break;
364− dev_queue_xmit(skb2);
365− } else {
366− bool is_target = skb == hold_skb;
367− int rc;
368−
369− if (is_target)
370− skb_get(skb);
371− rc = dev_queue_xmit(skb);
372− if (is_target)
373− ret = rc;
341+ skb = skb2;
374342 }
343+ dev_queue_xmit(skb);
375344 }
376−
377− return ret;
378345 }
379346
380347 /**
@@ -846,7 +813,7 @@ void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb) · 465 unmodified lines
846813 else {
847814 dprintk("%s: adding to backlog...\n", __func__);
848815 llc_set_backlog_type(skb, LLC_PACKET);
849− if (sk_add_backlog(sk, skb, sk->sk_rcvbuf))
816+ if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)))
850817 goto drop_unlock;
851818 }
852819 out:
net/llc/llc_if.c+8−4
@@ -38,6 +38,8 @@ · 37 unmodified lines
3838 * closed and -EBUSY when sending data is not permitted in this state or
3939 * LLC has send an I pdu with p bit set to 1 and is waiting for it's
4040 * response.
41+ *
42+ * This function always consumes a reference to the skb.
4143 */
4244 int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb)
4345 {
@@ -46,20 +48,22 @@ int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb) · 2 unmodified lines
4648 struct llc_sock *llc = llc_sk(sk);
4749
4850 if (unlikely(llc->state == LLC_CONN_STATE_ADM))
49− goto out;
51+ goto out_free;
5052 rc = -EBUSY;
5153 if (unlikely(llc_data_accept_state(llc->state) || /* data_conn_refuse */
5254 llc->p_flag)) {
5355 llc->failed_data_req = 1;
54− goto out;
56+ goto out_free;
5557 }
5658 ev = llc_conn_ev(skb);
5759 ev->type = LLC_CONN_EV_TYPE_PRIM;
5860 ev->prim = LLC_DATA_PRIM;
5961 ev->prim_type = LLC_PRIM_TYPE_REQ;
6062 skb->dev = llc->dev;
61− rc = llc_conn_state_process(sk, skb);
62−out:
63+ return llc_conn_state_process(sk, skb);
64+
65+out_free:
66+ kfree_skb(skb);
6367 return rc;
6468 }
6569
net/llc/llc_s_ac.c+9−3
@@ -58,8 +58,10 @@ int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb) · 57 unmodified lines
5858 ev->daddr.lsap, LLC_PDU_CMD);
5959 llc_pdu_init_as_ui_cmd(skb);
6060 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac);
61− if (likely(!rc))
61+ if (likely(!rc)) {
62+ skb_get(skb);
6263 rc = dev_queue_xmit(skb);
64+ }
6365 return rc;
6466 }
6567
@@ -81,8 +83,10 @@ int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb) · 15 unmodified lines
8183 ev->daddr.lsap, LLC_PDU_CMD);
8284 llc_pdu_init_as_xid_cmd(skb, LLC_XID_NULL_CLASS_2, 0);
8385 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac);
84− if (likely(!rc))
86+ if (likely(!rc)) {
87+ skb_get(skb);
8588 rc = dev_queue_xmit(skb);
89+ }
8690 return rc;
8791 }
8892
@@ -135,8 +139,10 @@ int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb) · 46 unmodified lines
135139 ev->daddr.lsap, LLC_PDU_CMD);
136140 llc_pdu_init_as_test_cmd(skb);
137141 rc = llc_mac_hdr_init(skb, ev->saddr.mac, ev->daddr.mac);
138− if (likely(!rc))
142+ if (likely(!rc)) {
143+ skb_get(skb);
139144 rc = dev_queue_xmit(skb);
145+ }
140146 return rc;
141147 }
142148
net/llc/llc_sap.c+8−15
@@ -197,29 +197,22 @@ out: · 196 unmodified lines
197197 * After executing actions of the event, upper layer will be indicated
198198 * if needed(on receiving an UI frame). sk can be null for the
199199 * datalink_proto case.
200+ *
201+ * This function always consumes a reference to the skb.
200202 */
201203 static void llc_sap_state_process(struct llc_sap *sap, struct sk_buff *skb)
202204 {
203205 struct llc_sap_state_ev *ev = llc_sap_ev(skb);
204206
205− /*
206− * We have to hold the skb, because llc_sap_next_state
207− * will kfree it in the sending path and we need to
208− * look at the skb->cb, where we encode llc_sap_state_ev.
209− */
210− skb_get(skb);
211207 ev->ind_cfm_flag = 0;
212208 llc_sap_next_state(sap, skb);
213− if (ev->ind_cfm_flag == LLC_IND) {
214− if (skb->sk->sk_state == TCP_LISTEN)
215− kfree_skb(skb);
216− else {
217− llc_save_primitive(skb->sk, skb, ev->prim);
218209
219− /* queue skb to the user. */
220− if (sock_queue_rcv_skb(skb->sk, skb))
221− kfree_skb(skb);
222− }
210+ if (ev->ind_cfm_flag == LLC_IND && skb->sk->sk_state != TCP_LISTEN) {
211+ llc_save_primitive(skb->sk, skb, ev->prim);
212+
213+ /* queue skb to the user. */
214+ if (sock_queue_rcv_skb(skb->sk, skb) == 0)
215+ return;
223216 }
224217 kfree_skb(skb);
225218 }
net/mac80211/mlme.c+3−2
@@ -2633,7 +2633,8 @@ struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw, · 2632 unmodified lines
26332633
26342634 rcu_read_lock();
26352635 ssid = ieee80211_bss_get_ie(cbss, WLAN_EID_SSID);
2636− if (WARN_ON_ONCE(ssid == NULL))
2636+ if (WARN_ONCE(!ssid || ssid[1] > IEEE80211_MAX_SSID_LEN,
2637+ "invalid SSID element (len=%d)", ssid ? ssid[1] : -1))
26372638 ssid_len = 0;
26382639 else
26392640 ssid_len = ssid[1];
@@ -5233,7 +5234,7 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, · 2593 unmodified lines
52335234
52345235 rcu_read_lock();
52355236 ssidie = ieee80211_bss_get_ie(req->bss, WLAN_EID_SSID);
5236− if (!ssidie) {
5237+ if (!ssidie || ssidie[1] > sizeof(assoc_data->ssid)) {
52375238 rcu_read_unlock();
52385239 kfree(assoc_data);
52395240 return -EINVAL;
net/mac80211/rx.c+10−1
@@ -3467,9 +3467,18 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx) · 3466 unmodified lines
34673467 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
34683468 /* process for all: mesh, mlme, ibss */
34693469 break;
3470+ case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
3471+ if (is_multicast_ether_addr(mgmt->da) &&
3472+ !is_broadcast_ether_addr(mgmt->da))
3473+ return RX_DROP_MONITOR;
3474+
3475+ /* process only for station/IBSS */
3476+ if (sdata->vif.type != NL80211_IFTYPE_STATION &&
3477+ sdata->vif.type != NL80211_IFTYPE_ADHOC)
3478+ return RX_DROP_MONITOR;
3479+ break;
34703480 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
34713481 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
3472− case cpu_to_le16(IEEE80211_STYPE_DEAUTH):
34733482 case cpu_to_le16(IEEE80211_STYPE_DISASSOC):
34743483 if (is_multicast_ether_addr(mgmt->da) &&
34753484 !is_broadcast_ether_addr(mgmt->da))
net/mac80211/scan.c+28−2
@@ -520,10 +520,33 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local, · 519 unmodified lines
520520 return 0;
521521 }
522522
523+static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata)
524+{
525+ struct ieee80211_local *local = sdata->local;
526+ struct ieee80211_sub_if_data *sdata_iter;
527+
528+ if (!ieee80211_is_radar_required(local))
529+ return true;
530+
531+ if (!regulatory_pre_cac_allowed(local->hw.wiphy))
532+ return false;
533+
534+ mutex_lock(&local->iflist_mtx);
535+ list_for_each_entry(sdata_iter, &local->interfaces, list) {
536+ if (sdata_iter->wdev.cac_started) {
537+ mutex_unlock(&local->iflist_mtx);
538+ return false;
539+ }
540+ }
541+ mutex_unlock(&local->iflist_mtx);
542+
543+ return true;
544+}
545+
523546 static bool ieee80211_can_scan(struct ieee80211_local *local,
524547 struct ieee80211_sub_if_data *sdata)
525548 {
526− if (ieee80211_is_radar_required(local))
549+ if (!__ieee80211_can_leave_ch(sdata))
527550 return false;
528551
529552 if (!list_empty(&local->roc_list))
@@ -630,7 +653,10 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, · 100 unmodified lines
630653
631654 lockdep_assert_held(&local->mtx);
632655
633− if (local->scan_req || ieee80211_is_radar_required(local))
656+ if (local->scan_req)
657+ return -EBUSY;
658+
659+ if (!__ieee80211_can_leave_ch(sdata))
634660 return -EBUSY;
635661
636662 if (!ieee80211_can_scan(local, sdata)) {
net/netfilter/nf_conntrack_core.c+2−2
@@ -1792,8 +1792,8 @@ void __nf_ct_refresh_acct(struct nf_conn *ct, · 1791 unmodified lines
17921792 if (nf_ct_is_confirmed(ct))
17931793 extra_jiffies += nfct_time_stamp;
17941794
1795− if (ct->timeout != extra_jiffies)
1796− ct->timeout = extra_jiffies;
1795+ if (READ_ONCE(ct->timeout) != extra_jiffies)
1796+ WRITE_ONCE(ct->timeout, extra_jiffies);
17971797 acct:
17981798 if (do_acct)
17991799 nf_ct_acct_update(ct, ctinfo, skb->len);
net/openvswitch/actions.c+3−2
@@ -165,7 +165,8 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key, · 164 unmodified lines
165165 {
166166 int err;
167167
168− err = skb_mpls_push(skb, mpls->mpls_lse, mpls->mpls_ethertype);
168+ err = skb_mpls_push(skb, mpls->mpls_lse, mpls->mpls_ethertype,
169+ skb->mac_len);
169170 if (err)
170171 return err;
171172
@@ -178,7 +179,7 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key, · 6 unmodified lines
178179 {
179180 int err;
180181
181− err = skb_mpls_pop(skb, ethertype);
182+ err = skb_mpls_pop(skb, ethertype, skb->mac_len);
182183 if (err)
183184 return err;
184185
net/rxrpc/ar-internal.h+1−0
@@ -556,6 +556,7 @@ struct rxrpc_call { · 555 unmodified lines
556556 struct rxrpc_peer *peer; /* Peer record for remote address */
557557 struct rxrpc_sock __rcu *socket; /* socket responsible */
558558 struct rxrpc_net *rxnet; /* Network namespace to which call belongs */
559+ const struct rxrpc_security *security; /* applied security module */
559560 struct mutex user_mutex; /* User access mutex */
560561 unsigned long ack_at; /* When deferred ACK needs to happen */
561562 unsigned long ack_lost_at; /* When ACK is figured as lost */
net/rxrpc/call_accept.c+3−2
@@ -84,7 +84,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, · 83 unmodified lines
8484 smp_store_release(&b->conn_backlog_head,
8585 (head + 1) & (size - 1));
8686
87− trace_rxrpc_conn(conn, rxrpc_conn_new_service,
87+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service,
8888 atomic_read(&conn->usage), here);
8989 }
9090
@@ -97,7 +97,7 @@ static int rxrpc_service_prealloc_one(struct rxrpc_sock *rx, · 6 unmodified lines
9797 call->flags |= (1 << RXRPC_CALL_IS_SERVICE);
9898 call->state = RXRPC_CALL_SERVER_PREALLOC;
9999
100− trace_rxrpc_call(call, rxrpc_call_new_service,
100+ trace_rxrpc_call(call->debug_id, rxrpc_call_new_service,
101101 atomic_read(&call->usage),
102102 here, (const void *)user_call_ID);
103103
@@ -307,6 +307,7 @@ static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, · 203 unmodified lines
307307
308308 rxrpc_see_call(call);
309309 call->conn = conn;
310+ call->security = conn->security;
310311 call->peer = rxrpc_get_peer(conn->params.peer);
311312 call->cong_cwnd = call->peer->cong_cwnd;
312313 return call;
net/rxrpc/call_object.c+20−14
@@ -240,7 +240,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, · 239 unmodified lines
240240 if (p->intr)
241241 __set_bit(RXRPC_CALL_IS_INTR, &call->flags);
242242 call->tx_total_len = p->tx_total_len;
243− trace_rxrpc_call(call, rxrpc_call_new_client, atomic_read(&call->usage),
243+ trace_rxrpc_call(call->debug_id, rxrpc_call_new_client,
244+ atomic_read(&call->usage),
244245 here, (const void *)p->user_call_ID);
245246
246247 /* We need to protect a partially set up call against the user as we
@@ -290,8 +291,8 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, · 43 unmodified lines
290291 if (ret < 0)
291292 goto error;
292293
293− trace_rxrpc_call(call, rxrpc_call_connected, atomic_read(&call->usage),
294− here, NULL);
294+ trace_rxrpc_call(call->debug_id, rxrpc_call_connected,
295+ atomic_read(&call->usage), here, NULL);
295296
296297 rxrpc_start_call_timer(call);
297298
@@ -313,8 +314,8 @@ error_dup_user_ID: · 15 unmodified lines
313314 error:
314315 __rxrpc_set_call_completion(call, RXRPC_CALL_LOCAL_ERROR,
315316 RX_CALL_DEAD, ret);
316− trace_rxrpc_call(call, rxrpc_call_error, atomic_read(&call->usage),
317− here, ERR_PTR(ret));
317+ trace_rxrpc_call(call->debug_id, rxrpc_call_error,
318+ atomic_read(&call->usage), here, ERR_PTR(ret));
318319 rxrpc_release_call(rx, call);
319320 mutex_unlock(&call->user_mutex);
320321 rxrpc_put_call(call, rxrpc_call_put);
@@ -376,7 +377,8 @@ bool rxrpc_queue_call(struct rxrpc_call *call) · 55 unmodified lines
376377 if (n == 0)
377378 return false;
378379 if (rxrpc_queue_work(&call->processor))
379− trace_rxrpc_call(call, rxrpc_call_queued, n + 1, here, NULL);
380+ trace_rxrpc_call(call->debug_id, rxrpc_call_queued, n + 1,
381+ here, NULL);
380382 else
381383 rxrpc_put_call(call, rxrpc_call_put_noqueue);
382384 return true;
@@ -391,7 +393,8 @@ bool __rxrpc_queue_call(struct rxrpc_call *call) · 8 unmodified lines
391393 int n = atomic_read(&call->usage);
392394 ASSERTCMP(n, >=, 1);
393395 if (rxrpc_queue_work(&call->processor))
394− trace_rxrpc_call(call, rxrpc_call_queued_ref, n, here, NULL);
396+ trace_rxrpc_call(call->debug_id, rxrpc_call_queued_ref, n,
397+ here, NULL);
395398 else
396399 rxrpc_put_call(call, rxrpc_call_put_noqueue);
397400 return true;
@@ -406,7 +409,8 @@ void rxrpc_see_call(struct rxrpc_call *call) · 8 unmodified lines
406409 if (call) {
407410 int n = atomic_read(&call->usage);
408411
409− trace_rxrpc_call(call, rxrpc_call_seen, n, here, NULL);
412+ trace_rxrpc_call(call->debug_id, rxrpc_call_seen, n,
413+ here, NULL);
410414 }
411415 }
412416
@@ -418,7 +422,7 @@ void rxrpc_get_call(struct rxrpc_call *call, enum rxrpc_call_trace op) · 5 unmodified lines
418422 const void *here = __builtin_return_address(0);
419423 int n = atomic_inc_return(&call->usage);
420424
421− trace_rxrpc_call(call, op, n, here, NULL);
425+ trace_rxrpc_call(call->debug_id, op, n, here, NULL);
422426 }
423427
424428 /*
@@ -445,7 +449,8 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) · 20 unmodified lines
445449
446450 _enter("{%d,%d}", call->debug_id, atomic_read(&call->usage));
447451
448− trace_rxrpc_call(call, rxrpc_call_release, atomic_read(&call->usage),
452+ trace_rxrpc_call(call->debug_id, rxrpc_call_release,
453+ atomic_read(&call->usage),
449454 here, (const void *)call->flags);
450455
451456 ASSERTCMP(call->state, ==, RXRPC_CALL_COMPLETE);
@@ -488,10 +493,10 @@ void rxrpc_release_call(struct rxrpc_sock *rx, struct rxrpc_call *call) · 36 unmodified lines
488493
489494 _debug("RELEASE CALL %p (%d CONN %p)", call, call->debug_id, conn);
490495
491− if (conn) {
496+ if (conn)
492497 rxrpc_disconnect_call(call);
493− conn->security->free_call_crypto(call);
494− }
498+ if (call->security)
499+ call->security->free_call_crypto(call);
495500
496501 rxrpc_cleanup_ring(call);
497502 _leave("");
@@ -534,12 +539,13 @@ void rxrpc_put_call(struct rxrpc_call *call, enum rxrpc_call_trace op) · 36 unmodified lines
534539 {
535540 struct rxrpc_net *rxnet = call->rxnet;
536541 const void *here = __builtin_return_address(0);
542+ unsigned int debug_id = call->debug_id;
537543 int n;
538544
539545 ASSERT(call != NULL);
540546
541547 n = atomic_dec_return(&call->usage);
542− trace_rxrpc_call(call, op, n, here, NULL);
548+ trace_rxrpc_call(debug_id, op, n, here, NULL);
543549 ASSERTCMP(n, >=, 0);
544550 if (n == 0) {
545551 _debug("call %d dead", call->debug_id);
net/rxrpc/conn_client.c+7−2
@@ -212,7 +212,8 @@ rxrpc_alloc_client_connection(struct rxrpc_conn_parameters *cp, gfp_t gfp) · 211 unmodified lines
212212 rxrpc_get_local(conn->params.local);
213213 key_get(conn->params.key);
214214
215− trace_rxrpc_conn(conn, rxrpc_conn_new_client, atomic_read(&conn->usage),
215+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_client,
216+ atomic_read(&conn->usage),
216217 __builtin_return_address(0));
217218 trace_rxrpc_client(conn, -1, rxrpc_client_alloc);
218219 _leave(" = %p", conn);
@@ -352,6 +353,7 @@ static int rxrpc_get_client_conn(struct rxrpc_sock *rx, · 133 unmodified lines
352353
353354 if (cp->exclusive) {
354355 call->conn = candidate;
356+ call->security = candidate->security;
355357 call->security_ix = candidate->security_ix;
356358 call->service_id = candidate->service_id;
357359 _leave(" = 0 [exclusive %d]", candidate->debug_id);
@@ -403,6 +405,7 @@ static int rxrpc_get_client_conn(struct rxrpc_sock *rx, · 45 unmodified lines
403405 candidate_published:
404406 set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags);
405407 call->conn = candidate;
408+ call->security = candidate->security;
406409 call->security_ix = candidate->security_ix;
407410 call->service_id = candidate->service_id;
408411 spin_unlock(&local->client_conns_lock);
@@ -425,6 +428,7 @@ found_extant_conn: · 16 unmodified lines
425428
426429 spin_lock(&conn->channel_lock);
427430 call->conn = conn;
431+ call->security = conn->security;
428432 call->security_ix = conn->security_ix;
429433 call->service_id = conn->service_id;
430434 list_add_tail(&call->chan_wait_link, &conn->waiting_calls);
@@ -985,11 +989,12 @@ rxrpc_put_one_client_conn(struct rxrpc_connection *conn) · 554 unmodified lines
985989 void rxrpc_put_client_conn(struct rxrpc_connection *conn)
986990 {
987991 const void *here = __builtin_return_address(0);
992+ unsigned int debug_id = conn->debug_id;
988993 int n;
989994
990995 do {
991996 n = atomic_dec_return(&conn->usage);
992− trace_rxrpc_conn(conn, rxrpc_conn_put_client, n, here);
997+ trace_rxrpc_conn(debug_id, rxrpc_conn_put_client, n, here);
993998 if (n > 0)
994999 return;
9951000 ASSERTCMP(n, >=, 0);
net/rxrpc/conn_object.c+7−6
@@ -269,7 +269,7 @@ bool rxrpc_queue_conn(struct rxrpc_connection *conn) · 268 unmodified lines
269269 if (n == 0)
270270 return false;
271271 if (rxrpc_queue_work(&conn->processor))
272− trace_rxrpc_conn(conn, rxrpc_conn_queued, n + 1, here);
272+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_queued, n + 1, here);
273273 else
274274 rxrpc_put_connection(conn);
275275 return true;
@@ -284,7 +284,7 @@ void rxrpc_see_connection(struct rxrpc_connection *conn) · 8 unmodified lines
284284 if (conn) {
285285 int n = atomic_read(&conn->usage);
286286
287− trace_rxrpc_conn(conn, rxrpc_conn_seen, n, here);
287+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_seen, n, here);
288288 }
289289 }
290290
@@ -296,7 +296,7 @@ void rxrpc_get_connection(struct rxrpc_connection *conn) · 5 unmodified lines
296296 const void *here = __builtin_return_address(0);
297297 int n = atomic_inc_return(&conn->usage);
298298
299− trace_rxrpc_conn(conn, rxrpc_conn_got, n, here);
299+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n, here);
300300 }
301301
302302 /*
@@ -310,7 +310,7 @@ rxrpc_get_connection_maybe(struct rxrpc_connection *conn) · 7 unmodified lines
310310 if (conn) {
311311 int n = atomic_fetch_add_unless(&conn->usage, 1, 0);
312312 if (n > 0)
313− trace_rxrpc_conn(conn, rxrpc_conn_got, n + 1, here);
313+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_got, n + 1, here);
314314 else
315315 conn = NULL;
316316 }
@@ -333,10 +333,11 @@ static void rxrpc_set_service_reap_timer(struct rxrpc_net *rxnet, · 16 unmodified lines
333333 void rxrpc_put_service_conn(struct rxrpc_connection *conn)
334334 {
335335 const void *here = __builtin_return_address(0);
336+ unsigned int debug_id = conn->debug_id;
336337 int n;
337338
338339 n = atomic_dec_return(&conn->usage);
339− trace_rxrpc_conn(conn, rxrpc_conn_put_service, n, here);
340+ trace_rxrpc_conn(debug_id, rxrpc_conn_put_service, n, here);
340341 ASSERTCMP(n, >=, 0);
341342 if (n == 1)
342343 rxrpc_set_service_reap_timer(conn->params.local->rxnet,
@@ -420,7 +421,7 @@ void rxrpc_service_connection_reaper(struct work_struct *work) · 77 unmodified lines
420421 */
421422 if (atomic_cmpxchg(&conn->usage, 1, 0) != 1)
422423 continue;
423− trace_rxrpc_conn(conn, rxrpc_conn_reap_service, 0, NULL);
424+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_reap_service, 0, NULL);
424425
425426 if (rxrpc_conn_is_client(conn))
426427 BUG();
net/rxrpc/conn_service.c+1−1
@@ -134,7 +134,7 @@ struct rxrpc_connection *rxrpc_prealloc_service_connection(struct rxrpc_net *rxn · 133 unmodified lines
134134 list_add_tail(&conn->proc_link, &rxnet->conn_proc_list);
135135 write_unlock(&rxnet->conn_lock);
136136
137− trace_rxrpc_conn(conn, rxrpc_conn_new_service,
137+ trace_rxrpc_conn(conn->debug_id, rxrpc_conn_new_service,
138138 atomic_read(&conn->usage),
139139 __builtin_return_address(0));
140140 }
net/rxrpc/peer_event.c+9−2
@@ -147,10 +147,16 @@ void rxrpc_error_report(struct sock *sk) · 146 unmodified lines
147147 {
148148 struct sock_exterr_skb *serr;
149149 struct sockaddr_rxrpc srx;
150− struct rxrpc_local *local = sk->sk_user_data;
150+ struct rxrpc_local *local;
151151 struct rxrpc_peer *peer;
152152 struct sk_buff *skb;
153153
154+ rcu_read_lock();
155+ local = rcu_dereference_sk_user_data(sk);
156+ if (unlikely(!local)) {
157+ rcu_read_unlock();
158+ return;
159+ }
154160 _enter("%p{%d}", sk, local->debug_id);
155161
156162 /* Clear the outstanding error value on the socket so that it doesn't
@@ -160,6 +166,7 @@ void rxrpc_error_report(struct sock *sk) · 3 unmodified lines
160166
161167 skb = sock_dequeue_err_skb(sk);
162168 if (!skb) {
169+ rcu_read_unlock();
163170 _leave("UDP socket errqueue empty");
164171 return;
165172 }
@@ -167,11 +174,11 @@ void rxrpc_error_report(struct sock *sk) · 1 unmodified line
167174 serr = SKB_EXT_ERR(skb);
168175 if (!skb->len && serr->ee.ee_origin == SO_EE_ORIGIN_TIMESTAMPING) {
169176 _leave("UDP empty message");
177+ rcu_read_unlock();
170178 rxrpc_free_skb(skb, rxrpc_skb_freed);
171179 return;
172180 }
173181
174− rcu_read_lock();
175182 peer = rxrpc_lookup_peer_icmp_rcu(local, skb, &srx);
176183 if (peer && !rxrpc_get_peer_maybe(peer))
177184 peer = NULL;
net/rxrpc/peer_object.c+10−6
@@ -216,7 +216,7 @@ struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *local, gfp_t gfp) · 215 unmodified lines
216216 peer = kzalloc(sizeof(struct rxrpc_peer), gfp);
217217 if (peer) {
218218 atomic_set(&peer->usage, 1);
219− peer->local = local;
219+ peer->local = rxrpc_get_local(local);
220220 INIT_HLIST_HEAD(&peer->error_targets);
221221 peer->service_conns = RB_ROOT;
222222 seqlock_init(&peer->service_conn_lock);
@@ -307,7 +307,6 @@ void rxrpc_new_incoming_peer(struct rxrpc_sock *rx, struct rxrpc_local *local, · 84 unmodified lines
307307 unsigned long hash_key;
308308
309309 hash_key = rxrpc_peer_hash_key(local, &peer->srx);
310− peer->local = local;
311310 rxrpc_init_peer(rx, peer, hash_key);
312311
313312 spin_lock(&rxnet->peer_hash_lock);
@@ -382,7 +381,7 @@ struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *peer) · 68 unmodified lines
382381 int n;
383382
384383 n = atomic_inc_return(&peer->usage);
385− trace_rxrpc_peer(peer, rxrpc_peer_got, n, here);
384+ trace_rxrpc_peer(peer->debug_id, rxrpc_peer_got, n, here);
386385 return peer;
387386 }
388387
@@ -396,7 +395,7 @@ struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *peer) · 7 unmodified lines
396395 if (peer) {
397396 int n = atomic_fetch_add_unless(&peer->usage, 1, 0);
398397 if (n > 0)
399− trace_rxrpc_peer(peer, rxrpc_peer_got, n + 1, here);
398+ trace_rxrpc_peer(peer->debug_id, rxrpc_peer_got, n + 1, here);
400399 else
401400 peer = NULL;
402401 }
@@ -417,6 +416,7 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer) · 14 unmodified lines
417416 list_del_init(&peer->keepalive_link);
418417 spin_unlock_bh(&rxnet->peer_hash_lock);
419418
419+ rxrpc_put_local(peer->local);
420420 kfree_rcu(peer, rcu);
421421 }
422422
@@ -426,11 +426,13 @@ static void __rxrpc_put_peer(struct rxrpc_peer *peer) · 3 unmodified lines
426426 void rxrpc_put_peer(struct rxrpc_peer *peer)
427427 {
428428 const void *here = __builtin_return_address(0);
429+ unsigned int debug_id;
429430 int n;
430431
431432 if (peer) {
433+ debug_id = peer->debug_id;
432434 n = atomic_dec_return(&peer->usage);
433− trace_rxrpc_peer(peer, rxrpc_peer_put, n, here);
435+ trace_rxrpc_peer(debug_id, rxrpc_peer_put, n, here);
434436 if (n == 0)
435437 __rxrpc_put_peer(peer);
436438 }
@@ -443,13 +445,15 @@ void rxrpc_put_peer(struct rxrpc_peer *peer) · 6 unmodified lines
443445 void rxrpc_put_peer_locked(struct rxrpc_peer *peer)
444446 {
445447 const void *here = __builtin_return_address(0);
448+ unsigned int debug_id = peer->debug_id;
446449 int n;
447450
448451 n = atomic_dec_return(&peer->usage);
449− trace_rxrpc_peer(peer, rxrpc_peer_put, n, here);
452+ trace_rxrpc_peer(debug_id, rxrpc_peer_put, n, here);
450453 if (n == 0) {
451454 hash_del_rcu(&peer->hash_link);
452455 list_del_init(&peer->keepalive_link);
456+ rxrpc_put_local(peer->local);
453457 kfree_rcu(peer, rcu);
454458 }
455459 }
net/rxrpc/recvmsg.c+3−3
@@ -251,8 +251,8 @@ static int rxrpc_verify_packet(struct rxrpc_call *call, struct sk_buff *skb, · 250 unmodified lines
251251 seq += subpacket;
252252 }
253253
254− return call->conn->security->verify_packet(call, skb, offset, len,
255− seq, cksum);
254+ return call->security->verify_packet(call, skb, offset, len,
255+ seq, cksum);
256256 }
257257
258258 /*
@@ -291,7 +291,7 @@ static int rxrpc_locate_data(struct rxrpc_call *call, struct sk_buff *skb, · 32 unmodified lines
291291
292292 *_offset = offset;
293293 *_len = len;
294− call->conn->security->locate_data(call, skb, _offset, _len);
294+ call->security->locate_data(call, skb, _offset, _len);
295295 return 0;
296296 }
297297
net/rxrpc/sendmsg.c+2−1
@@ -419,7 +419,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, · 418 unmodified lines
419419 call->tx_winsize)
420420 sp->hdr.flags |= RXRPC_MORE_PACKETS;
421421
422− ret = conn->security->secure_packet(
422+ ret = call->security->secure_packet(
423423 call, skb, skb->mark, skb->head);
424424 if (ret < 0)
425425 goto out;
@@ -661,6 +661,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) · 235 unmodified lines
661661 case RXRPC_CALL_SERVER_PREALLOC:
662662 case RXRPC_CALL_SERVER_SECURING:
663663 case RXRPC_CALL_SERVER_ACCEPTING:
664+ rxrpc_put_call(call, rxrpc_call_put);
664665 ret = -EBUSY;
665666 goto error_release_sock;
666667 default:
net/sched/act_api.c+13−10
@@ -832,8 +832,7 @@ static struct tc_cookie *nla_memdup_cookie(struct nlattr **tb) · 831 unmodified lines
832832 }
833833
834834 static const struct nla_policy tcf_action_policy[TCA_ACT_MAX + 1] = {
835− [TCA_ACT_KIND] = { .type = NLA_NUL_STRING,
836− .len = IFNAMSIZ - 1 },
835+ [TCA_ACT_KIND] = { .type = NLA_STRING },
837836 [TCA_ACT_INDEX] = { .type = NLA_U32 },
838837 [TCA_ACT_COOKIE] = { .type = NLA_BINARY,
839838 .len = TC_COOKIE_MAX_SIZE },
@@ -865,8 +864,10 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp, · 25 unmodified lines
865864 NL_SET_ERR_MSG(extack, "TC action kind must be specified");
866865 goto err_out;
867866 }
868− nla_strlcpy(act_name, kind, IFNAMSIZ);
869−
867+ if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) {
868+ NL_SET_ERR_MSG(extack, "TC action name too long");
869+ goto err_out;
870+ }
870871 if (tb[TCA_ACT_COOKIE]) {
871872 cookie = nla_memdup_cookie(tb);
872873 if (!cookie) {
@@ -1352,11 +1353,16 @@ static int tcf_action_add(struct net *net, struct nlattr *nla, · 479 unmodified lines
13521353 struct netlink_ext_ack *extack)
13531354 {
13541355 size_t attr_size = 0;
1355− int ret = 0;
1356+ int loop, ret;
13561357 struct tc_action *actions[TCA_ACT_MAX_PRIO] = {};
13571358
1358− ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0, actions,
1359− &attr_size, true, extack);
1359+ for (loop = 0; loop < 10; loop++) {
1360+ ret = tcf_action_init(net, NULL, nla, NULL, NULL, ovr, 0,
1361+ actions, &attr_size, true, extack);
1362+ if (ret != -EAGAIN)
1363+ break;
1364+ }
1365+
13601366 if (ret < 0)
13611367 return ret;
13621368 ret = tcf_add_notify(net, n, actions, portid, attr_size, extack);
@@ -1406,11 +1412,8 @@ static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, · 43 unmodified lines
14061412 */
14071413 if (n->nlmsg_flags & NLM_F_REPLACE)
14081414 ovr = 1;
1409−replay:
14101415 ret = tcf_action_add(net, tca[TCA_ACT_TAB], n, portid, ovr,
14111416 extack);
1412− if (ret == -EAGAIN)
1413− goto replay;
14141417 break;
14151418 case RTM_DELACTION:
14161419 ret = tca_action_gd(net, tca[TCA_ACT_TAB], n,
net/sched/act_mirred.c+5−1
@@ -484,7 +484,11 @@ static int __init mirred_init_module(void) · 483 unmodified lines
484484 return err;
485485
486486 pr_info("Mirror/redirect action on\n");
487− return tcf_register_action(&act_mirred_ops, &mirred_net_ops);
487+ err = tcf_register_action(&act_mirred_ops, &mirred_net_ops);
488+ if (err)
489+ unregister_netdevice_notifier(&mirred_device_notifier);
490+
491+ return err;
488492 }
489493
490494 static void __exit mirred_cleanup_module(void)
net/sched/act_mpls.c+8−4
@@ -55,7 +55,7 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, · 54 unmodified lines
5555 struct tcf_mpls *m = to_mpls(a);
5656 struct tcf_mpls_params *p;
5757 __be32 new_lse;
58− int ret;
58+ int ret, mac_len;
5959
6060 tcf_lastuse_update(&m->tcf_tm);
6161 bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb);
@@ -63,8 +63,12 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, · 1 unmodified line
6363 /* Ensure 'data' points at mac_header prior calling mpls manipulating
6464 * functions.
6565 */
66− if (skb_at_tc_ingress(skb))
66+ if (skb_at_tc_ingress(skb)) {
6767 skb_push_rcsum(skb, skb->mac_len);
68+ mac_len = skb->mac_len;
69+ } else {
70+ mac_len = skb_network_header(skb) - skb_mac_header(skb);
71+ }
6872
6973 ret = READ_ONCE(m->tcf_action);
7074
@@ -72,12 +76,12 @@ static int tcf_mpls_act(struct sk_buff *skb, const struct tc_action *a, · 1 unmodified line
7276
7377 switch (p->tcfm_action) {
7478 case TCA_MPLS_ACT_POP:
75− if (skb_mpls_pop(skb, p->tcfm_proto))
79+ if (skb_mpls_pop(skb, p->tcfm_proto, mac_len))
7680 goto drop;
7781 break;
7882 case TCA_MPLS_ACT_PUSH:
7983 new_lse = tcf_mpls_get_lse(NULL, p, !eth_p_mpls(skb->protocol));
80− if (skb_mpls_push(skb, new_lse, p->tcfm_proto))
84+ if (skb_mpls_push(skb, new_lse, p->tcfm_proto, mac_len))
8185 goto drop;
8286 break;
8387 case TCA_MPLS_ACT_MODIFY:
net/sched/cls_api.c+33−3
@@ -162,11 +162,22 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) · 161 unmodified lines
162162 return TC_H_MAJ(first);
163163 }
164164
165+static bool tcf_proto_check_kind(struct nlattr *kind, char *name)
166+{
167+ if (kind)
168+ return nla_strlcpy(name, kind, IFNAMSIZ) >= IFNAMSIZ;
169+ memset(name, 0, IFNAMSIZ);
170+ return false;
171+}
172+
165173 static bool tcf_proto_is_unlocked(const char *kind)
166174 {
167175 const struct tcf_proto_ops *ops;
168176 bool ret;
169177
178+ if (strlen(kind) == 0)
179+ return false;
180+
170181 ops = tcf_proto_lookup_ops(kind, false, NULL);
171182 /* On error return false to take rtnl lock. Proto lookup/create
172183 * functions will perform lookup again and properly handle errors.
@@ -1843,6 +1854,7 @@ static int tc_new_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 1670 unmodified lines
18431854 {
18441855 struct net *net = sock_net(skb->sk);
18451856 struct nlattr *tca[TCA_MAX + 1];
1857+ char name[IFNAMSIZ];
18461858 struct tcmsg *t;
18471859 u32 protocol;
18481860 u32 prio;
@@ -1899,13 +1911,19 @@ replay: · 50 unmodified lines
18991911 if (err)
19001912 return err;
19011913
1914+ if (tcf_proto_check_kind(tca[TCA_KIND], name)) {
1915+ NL_SET_ERR_MSG(extack, "Specified TC filter name too long");
1916+ err = -EINVAL;
1917+ goto errout;
1918+ }
1919+
19021920 /* Take rtnl mutex if rtnl_held was set to true on previous iteration,
19031921 * block is shared (no qdisc found), qdisc is not unlocked, classifier
19041922 * type is not specified, classifier is not unlocked.
19051923 */
19061924 if (rtnl_held ||
19071925 (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) ||
1908− !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) {
1926+ !tcf_proto_is_unlocked(name)) {
19091927 rtnl_held = true;
19101928 rtnl_lock();
19111929 }
@@ -2063,6 +2081,7 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 151 unmodified lines
20632081 {
20642082 struct net *net = sock_net(skb->sk);
20652083 struct nlattr *tca[TCA_MAX + 1];
2084+ char name[IFNAMSIZ];
20662085 struct tcmsg *t;
20672086 u32 protocol;
20682087 u32 prio;
@@ -2102,13 +2121,18 @@ static int tc_del_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 33 unmodified lines
21022121 if (err)
21032122 return err;
21042123
2124+ if (tcf_proto_check_kind(tca[TCA_KIND], name)) {
2125+ NL_SET_ERR_MSG(extack, "Specified TC filter name too long");
2126+ err = -EINVAL;
2127+ goto errout;
2128+ }
21052129 /* Take rtnl mutex if flushing whole chain, block is shared (no qdisc
21062130 * found), qdisc is not unlocked, classifier type is not specified,
21072131 * classifier is not unlocked.
21082132 */
21092133 if (!prio ||
21102134 (q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) ||
2111− !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) {
2135+ !tcf_proto_is_unlocked(name)) {
21122136 rtnl_held = true;
21132137 rtnl_lock();
21142138 }
@@ -2216,6 +2240,7 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 101 unmodified lines
22162240 {
22172241 struct net *net = sock_net(skb->sk);
22182242 struct nlattr *tca[TCA_MAX + 1];
2243+ char name[IFNAMSIZ];
22192244 struct tcmsg *t;
22202245 u32 protocol;
22212246 u32 prio;
@@ -2252,12 +2277,17 @@ static int tc_get_tfilter(struct sk_buff *skb, struct nlmsghdr *n, · 30 unmodified lines
22522277 if (err)
22532278 return err;
22542279
2280+ if (tcf_proto_check_kind(tca[TCA_KIND], name)) {
2281+ NL_SET_ERR_MSG(extack, "Specified TC filter name too long");
2282+ err = -EINVAL;
2283+ goto errout;
2284+ }
22552285 /* Take rtnl mutex if block is shared (no qdisc found), qdisc is not
22562286 * unlocked, classifier type is not specified, classifier is not
22572287 * unlocked.
22582288 */
22592289 if ((q && !(q->ops->cl_ops->flags & QDISC_CLASS_OPS_DOIT_UNLOCKED)) ||
2260− !tca[TCA_KIND] || !tcf_proto_is_unlocked(nla_data(tca[TCA_KIND]))) {
2290+ !tcf_proto_is_unlocked(name)) {
22612291 rtnl_held = true;
22622292 rtnl_lock();
22632293 }
net/sched/em_meta.c+2−2
@@ -446,7 +446,7 @@ META_COLLECTOR(int_sk_wmem_queued) · 445 unmodified lines
446446 *err = -1;
447447 return;
448448 }
449− dst->value = sk->sk_wmem_queued;
449+ dst->value = READ_ONCE(sk->sk_wmem_queued);
450450 }
451451
452452 META_COLLECTOR(int_sk_fwd_alloc)
@@ -554,7 +554,7 @@ META_COLLECTOR(int_sk_rcvlowat) · 101 unmodified lines
554554 *err = -1;
555555 return;
556556 }
557− dst->value = sk->sk_rcvlowat;
557+ dst->value = READ_ONCE(sk->sk_rcvlowat);
558558 }
559559
560560 META_COLLECTOR(int_sk_rcvtimeo)
net/sched/sch_api.c+1−2
@@ -1390,8 +1390,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) · 1389 unmodified lines
13901390 }
13911391
13921392 const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = {
1393− [TCA_KIND] = { .type = NLA_NUL_STRING,
1394− .len = IFNAMSIZ - 1 },
1393+ [TCA_KIND] = { .type = NLA_STRING },
13951394 [TCA_RATE] = { .type = NLA_BINARY,
13961395 .len = sizeof(struct tc_estimator) },
13971396 [TCA_STAB] = { .type = NLA_NESTED },
net/sched/sch_etf.c+1−1
@@ -177,7 +177,7 @@ static int etf_enqueue_timesortedlist(struct sk_buff *nskb, struct Qdisc *sch, · 176 unmodified lines
177177
178178 parent = *p;
179179 skb = rb_to_skb(parent);
180− if (ktime_after(txtime, skb->tstamp)) {
180+ if (ktime_compare(txtime, skb->tstamp) >= 0) {
181181 p = &parent->rb_right;
182182 leftmost = false;
183183 } else {
net/sched/sch_netem.c+8−3
@@ -509,6 +509,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 508 unmodified lines
509509 if (skb->ip_summed == CHECKSUM_PARTIAL &&
510510 skb_checksum_help(skb)) {
511511 qdisc_drop(skb, sch, to_free);
512+ skb = NULL;
512513 goto finish_segs;
513514 }
514515
@@ -593,9 +594,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 78 unmodified lines
593594 finish_segs:
594595 if (segs) {
595596 unsigned int len, last_len;
596− int nb = 0;
597+ int nb;
597598
598− len = skb->len;
599+ len = skb ? skb->len : 0;
600+ nb = skb ? 1 : 0;
599601
600602 while (segs) {
601603 skb2 = segs->next;
@@ -612,7 +614,10 @@ finish_segs: · 10 unmodified lines
612614 }
613615 segs = skb2;
614616 }
615− qdisc_tree_reduce_backlog(sch, -nb, prev_len - len);
617+ /* Parent qdiscs accounted for 1 skb of size @prev_len */
618+ qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len));
619+ } else if (!skb) {
620+ return NET_XMIT_DROP;
616621 }
617622 return NET_XMIT_SUCCESS;
618623 }
net/sched/sch_taprio.c+4−0
@@ -1341,6 +1341,10 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, · 1340 unmodified lines
13411341 NL_SET_ERR_MSG(extack, "Specifying a 'clockid' is mandatory");
13421342 goto out;
13431343 }
1344+
1345+ /* Everything went ok, return success. */
1346+ err = 0;
1347+
13441348 out:
13451349 return err;
13461350 }
net/sctp/diag.c+1−1
@@ -175,7 +175,7 @@ static int inet_sctp_diag_fill(struct sock *sk, struct sctp_association *asoc, · 174 unmodified lines
175175 mem[SK_MEMINFO_FWD_ALLOC] = sk->sk_forward_alloc;
176176 mem[SK_MEMINFO_WMEM_QUEUED] = sk->sk_wmem_queued;
177177 mem[SK_MEMINFO_OPTMEM] = atomic_read(&sk->sk_omem_alloc);
178− mem[SK_MEMINFO_BACKLOG] = sk->sk_backlog.len;
178+ mem[SK_MEMINFO_BACKLOG] = READ_ONCE(sk->sk_backlog.len);
179179 mem[SK_MEMINFO_DROPS] = atomic_read(&sk->sk_drops);
180180
181181 if (nla_put(skb, INET_DIAG_SKMEMINFO, sizeof(mem), &mem) < 0)
net/sctp/input.c+11−5
@@ -243,7 +243,7 @@ int sctp_rcv(struct sk_buff *skb) · 242 unmodified lines
243243 bh_lock_sock(sk);
244244 }
245245
246− if (sock_owned_by_user(sk)) {
246+ if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) {
247247 if (sctp_add_backlog(sk, skb)) {
248248 bh_unlock_sock(sk);
249249 sctp_chunk_free(chunk);
@@ -321,8 +321,8 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) · 71 unmodified lines
321321 local_bh_disable();
322322 bh_lock_sock(sk);
323323
324− if (sock_owned_by_user(sk)) {
325− if (sk_add_backlog(sk, skb, sk->sk_rcvbuf))
324+ if (sock_owned_by_user(sk) || !sctp_newsk_ready(sk)) {
325+ if (sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)))
326326 sctp_chunk_free(chunk);
327327 else
328328 backloged = 1;
@@ -336,7 +336,13 @@ int sctp_backlog_rcv(struct sock *sk, struct sk_buff *skb) · 7 unmodified lines
336336 if (backloged)
337337 return 0;
338338 } else {
339− sctp_inq_push(inqueue, chunk);
339+ if (!sctp_newsk_ready(sk)) {
340+ if (!sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf)))
341+ return 0;
342+ sctp_chunk_free(chunk);
343+ } else {
344+ sctp_inq_push(inqueue, chunk);
345+ }
340346 }
341347
342348 done:
@@ -358,7 +364,7 @@ static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb) · 15 unmodified lines
358364 struct sctp_ep_common *rcvr = chunk->rcvr;
359365 int ret;
360366
361− ret = sk_add_backlog(sk, skb, sk->sk_rcvbuf);
367+ ret = sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf));
362368 if (!ret) {
363369 /* Hold the assoc/ep while hanging on the backlog queue.
364370 * This way, we know structures we need will not disappear
net/sctp/socket.c+2−2
@@ -9500,7 +9500,7 @@ struct proto sctp_prot = { · 9499 unmodified lines
95009500 .backlog_rcv = sctp_backlog_rcv,
95019501 .hash = sctp_hash,
95029502 .unhash = sctp_unhash,
9503− .get_port = sctp_get_port,
9503+ .no_autobind = true,
95049504 .obj_size = sizeof(struct sctp_sock),
95059505 .useroffset = offsetof(struct sctp_sock, subscribe),
95069506 .usersize = offsetof(struct sctp_sock, initmsg) -
@@ -9542,7 +9542,7 @@ struct proto sctpv6_prot = { · 35 unmodified lines
95429542 .backlog_rcv = sctp_backlog_rcv,
95439543 .hash = sctp_hash,
95449544 .unhash = sctp_unhash,
9545− .get_port = sctp_get_port,
9545+ .no_autobind = true,
95469546 .obj_size = sizeof(struct sctp6_sock),
95479547 .useroffset = offsetof(struct sctp6_sock, sctp.subscribe),
95489548 .usersize = offsetof(struct sctp6_sock, sctp.initmsg) -
net/smc/smc_core.c+4−1
@@ -213,7 +213,7 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini) · 212 unmodified lines
213213 lgr = kzalloc(sizeof(*lgr), GFP_KERNEL);
214214 if (!lgr) {
215215 rc = SMC_CLC_DECL_MEM;
216− goto out;
216+ goto ism_put_vlan;
217217 }
218218 lgr->is_smcd = ini->is_smcd;
219219 lgr->sync_err = 0;
@@ -289,6 +289,9 @@ clear_llc_lnk: · 69 unmodified lines
289289 smc_llc_link_clear(lnk);
290290 free_lgr:
291291 kfree(lgr);
292+ism_put_vlan:
293+ if (ini->is_smcd && ini->vlan_id)
294+ smc_ism_put_vlan(ini->ism_dev, ini->vlan_id);
292295 out:
293296 if (rc < 0) {
294297 if (rc == -ENOMEM)
net/smc/smc_rx.c+21−8
@@ -211,8 +211,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, · 210 unmodified lines
211211 rc = sk_wait_event(sk, timeo,
212212 sk->sk_err ||
213213 sk->sk_shutdown & RCV_SHUTDOWN ||
214− fcrit(conn) ||
215− smc_cdc_rxed_any_close_or_senddone(conn),
214+ fcrit(conn),
216215 &wait);
217216 remove_wait_queue(sk_sleep(sk), &wait);
218217 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
@@ -262,6 +261,18 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len, · 43 unmodified lines
262261 return -EAGAIN;
263262 }
264263
264+static bool smc_rx_recvmsg_data_available(struct smc_sock *smc)
265+{
266+ struct smc_connection *conn = &smc->conn;
267+
268+ if (smc_rx_data_available(conn))
269+ return true;
270+ else if (conn->urg_state == SMC_URG_VALID)
271+ /* we received a single urgent Byte - skip */
272+ smc_rx_update_cons(smc, 0);
273+ return false;
274+}
275+
265276 /* smc_rx_recvmsg - receive data from RMBE
266277 * @msg: copy data to receive buffer
267278 * @pipe: copy data to pipe if set - indicates splice() call
@@ -303,16 +314,18 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, · 35 unmodified lines
303314 if (read_done >= target || (pipe && read_done))
304315 break;
305316
306− if (atomic_read(&conn->bytes_to_rcv))
317+ if (smc_rx_recvmsg_data_available(smc))
307318 goto copy;
308− else if (conn->urg_state == SMC_URG_VALID)
309− /* we received a single urgent Byte - skip */
310− smc_rx_update_cons(smc, 0);
311319
312320 if (sk->sk_shutdown & RCV_SHUTDOWN ||
313− smc_cdc_rxed_any_close_or_senddone(conn) ||
314− conn->local_tx_ctrl.conn_state_flags.peer_conn_abort)
321+ conn->local_tx_ctrl.conn_state_flags.peer_conn_abort) {
322+ /* smc_cdc_msg_recv_action() could have run after
323+ * above smc_rx_recvmsg_data_available()
324+ */
325+ if (smc_rx_recvmsg_data_available(smc))
326+ goto copy;
315327 break;
328+ }
316329
317330 if (read_done) {
318331 if (sk->sk_err ||
net/tipc/socket.c+4−4
@@ -2119,13 +2119,13 @@ static unsigned int rcvbuf_limit(struct sock *sk, struct sk_buff *skb) · 2118 unmodified lines
21192119 struct tipc_msg *hdr = buf_msg(skb);
21202120
21212121 if (unlikely(msg_in_group(hdr)))
2122− return sk->sk_rcvbuf;
2122+ return READ_ONCE(sk->sk_rcvbuf);
21232123
21242124 if (unlikely(!msg_connected(hdr)))
2125− return sk->sk_rcvbuf << msg_importance(hdr);
2125+ return READ_ONCE(sk->sk_rcvbuf) << msg_importance(hdr);
21262126
21272127 if (likely(tsk->peer_caps & TIPC_BLOCK_FLOWCTL))
2128− return sk->sk_rcvbuf;
2128+ return READ_ONCE(sk->sk_rcvbuf);
21292129
21302130 return FLOWCTL_MSG_LIM;
21312131 }
@@ -3790,7 +3790,7 @@ int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf) · 1658 unmodified lines
37903790 i += scnprintf(buf + i, sz - i, " %d", sk->sk_sndbuf);
37913791 i += scnprintf(buf + i, sz - i, " | %d", sk_rmem_alloc_get(sk));
37923792 i += scnprintf(buf + i, sz - i, " %d", sk->sk_rcvbuf);
3793− i += scnprintf(buf + i, sz - i, " | %d\n", sk->sk_backlog.len);
3793+ i += scnprintf(buf + i, sz - i, " | %d\n", READ_ONCE(sk->sk_backlog.len));
37943794
37953795 if (dqueues & TIPC_DUMP_SK_SNDQ) {
37963796 i += scnprintf(buf + i, sz - i, "sk_write_queue: ");
net/vmw_vsock/virtio_transport_common.c+14−3
@@ -204,10 +204,14 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, · 203 unmodified lines
204204 return virtio_transport_get_ops()->send_pkt(pkt);
205205 }
206206
207−static void virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
207+static bool virtio_transport_inc_rx_pkt(struct virtio_vsock_sock *vvs,
208208 struct virtio_vsock_pkt *pkt)
209209 {
210+ if (vvs->rx_bytes + pkt->len > vvs->buf_alloc)
211+ return false;
212+
210213 vvs->rx_bytes += pkt->len;
214+ return true;
211215 }
212216
213217 static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs,
@@ -458,6 +462,9 @@ void virtio_transport_set_buffer_size(struct vsock_sock *vsk, u64 val) · 244 unmodified lines
458462 vvs->buf_size_max = val;
459463 vvs->buf_size = val;
460464 vvs->buf_alloc = val;
465+
466+ virtio_transport_send_credit_update(vsk, VIRTIO_VSOCK_TYPE_STREAM,
467+ NULL);
461468 }
462469 EXPORT_SYMBOL_GPL(virtio_transport_set_buffer_size);
463470
@@ -876,14 +883,18 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, · 412 unmodified lines
876883 struct virtio_vsock_pkt *pkt)
877884 {
878885 struct virtio_vsock_sock *vvs = vsk->trans;
879− bool free_pkt = false;
886+ bool can_enqueue, free_pkt = false;
880887
881888 pkt->len = le32_to_cpu(pkt->hdr.len);
882889 pkt->off = 0;
883890
884891 spin_lock_bh(&vvs->rx_lock);
885892
886− virtio_transport_inc_rx_pkt(vvs, pkt);
893+ can_enqueue = virtio_transport_inc_rx_pkt(vvs, pkt);
894+ if (!can_enqueue) {
895+ free_pkt = true;
896+ goto out;
897+ }
887898
888899 /* Try to copy small packets into the buffer of last packet queued,
889900 * to avoid wasting memory queueing the entire buffer with a small
net/wireless/nl80211.c+1−1
@@ -13682,7 +13682,7 @@ static int nl80211_get_ftm_responder_stats(struct sk_buff *skb, · 13681 unmodified lines
1368213682 hdr = nl80211hdr_put(msg, info->snd_portid, info->snd_seq, 0,
1368313683 NL80211_CMD_GET_FTM_RESPONDER_STATS);
1368413684 if (!hdr)
13685− return -ENOBUFS;
13685+ goto nla_put_failure;
1368613686
1368713687 if (nla_put_u32(msg, NL80211_ATTR_IFINDEX, dev->ifindex))
1368813688 goto nla_put_failure;
net/wireless/reg.c+1−0
@@ -3883,6 +3883,7 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy) · 3882 unmodified lines
38833883
38843884 return pre_cac_allowed;
38853885 }
3886+EXPORT_SYMBOL(regulatory_pre_cac_allowed);
38863887
38873888 void regulatory_propagate_dfs_state(struct wiphy *wiphy,
38883889 struct cfg80211_chan_def *chandef,
net/wireless/reg.h+0−8
@@ -155,14 +155,6 @@ bool regulatory_indoor_allowed(void); · 154 unmodified lines
155155 */
156156 #define REG_PRE_CAC_EXPIRY_GRACE_MS 2000
157157
158−/**
159− * regulatory_pre_cac_allowed - if pre-CAC allowed in the current dfs domain
160− * @wiphy: wiphy for which pre-CAC capability is checked.
161−
162− * Pre-CAC is allowed only in ETSI domain.
163− */
164−bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
165−
166158 /**
167159 * regulatory_propagate_dfs_state - Propagate DFS channel state to other wiphys
168160 * @wiphy - wiphy on which radar is detected and the event will be propagated
net/wireless/scan.c+13−10
@@ -1703,8 +1703,7 @@ cfg80211_parse_mbssid_frame_data(struct wiphy *wiphy, · 1702 unmodified lines
17031703 static void
17041704 cfg80211_update_notlisted_nontrans(struct wiphy *wiphy,
17051705 struct cfg80211_bss *nontrans_bss,
1706− struct ieee80211_mgmt *mgmt, size_t len,
1707− gfp_t gfp)
1706+ struct ieee80211_mgmt *mgmt, size_t len)
17081707 {
17091708 u8 *ie, *new_ie, *pos;
17101709 const u8 *nontrans_ssid, *trans_ssid, *mbssid;
@@ -1715,6 +1714,8 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, · 4 unmodified lines
17151714 const struct cfg80211_bss_ies *old;
17161715 u8 cpy_len;
17171716
1717+ lockdep_assert_held(&wiphy_to_rdev(wiphy)->bss_lock);
1718+
17181719 ie = mgmt->u.probe_resp.variable;
17191720
17201721 new_ie_len = ielen;
@@ -1731,23 +1732,22 @@ cfg80211_update_notlisted_nontrans(struct wiphy *wiphy, · 10 unmodified lines
17311732 if (!mbssid || mbssid < trans_ssid)
17321733 return;
17331734 new_ie_len -= mbssid[1];
1734− rcu_read_lock();
1735+
17351736 nontrans_ssid = ieee80211_bss_get_ie(nontrans_bss, WLAN_EID_SSID);
1736− if (!nontrans_ssid) {
1737− rcu_read_unlock();
1737+ if (!nontrans_ssid)
17381738 return;
1739− }
1739+
17401740 new_ie_len += nontrans_ssid[1];
1741− rcu_read_unlock();
17421741
17431742 /* generate new ie for nontrans BSS
17441743 * 1. replace SSID with nontrans BSS' SSID
17451744 * 2. skip MBSSID IE
17461745 */
1747− new_ie = kzalloc(new_ie_len, gfp);
1746+ new_ie = kzalloc(new_ie_len, GFP_ATOMIC);
17481747 if (!new_ie)
17491748 return;
1750− new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, gfp);
1749+
1750+ new_ies = kzalloc(sizeof(*new_ies) + new_ie_len, GFP_ATOMIC);
17511751 if (!new_ies)
17521752 goto out_free;
17531753
@@ -1901,6 +1901,8 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 147 unmodified lines
19011901 cfg80211_parse_mbssid_frame_data(wiphy, data, mgmt, len,
19021902 &non_tx_data, gfp);
19031903
1904+ spin_lock_bh(&wiphy_to_rdev(wiphy)->bss_lock);
1905+
19041906 /* check if the res has other nontransmitting bss which is not
19051907 * in MBSSID IE
19061908 */
@@ -1915,8 +1917,9 @@ cfg80211_inform_bss_frame_data(struct wiphy *wiphy, · 8 unmodified lines
19151917 ies2 = rcu_access_pointer(tmp_bss->ies);
19161918 if (ies2->tsf < ies1->tsf)
19171919 cfg80211_update_notlisted_nontrans(wiphy, tmp_bss,
1918− mgmt, len, gfp);
1920+ mgmt, len);
19191921 }
1922+ spin_unlock_bh(&wiphy_to_rdev(wiphy)->bss_lock);
19201923
19211924 return res;
19221925 }
net/wireless/wext-sme.c+6−2
@@ -202,6 +202,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, · 201 unmodified lines
202202 struct iw_point *data, char *ssid)
203203 {
204204 struct wireless_dev *wdev = dev->ieee80211_ptr;
205+ int ret = 0;
205206
206207 /* call only for station! */
207208 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
@@ -219,7 +220,10 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, · 11 unmodified lines
219220 if (ie) {
220221 data->flags = 1;
221222 data->length = ie[1];
222− memcpy(ssid, ie + 2, data->length);
223+ if (data->length > IW_ESSID_MAX_SIZE)
224+ ret = -EINVAL;
225+ else
226+ memcpy(ssid, ie + 2, data->length);
223227 }
224228 rcu_read_unlock();
225229 } else if (wdev->wext.connect.ssid && wdev->wext.connect.ssid_len) {
@@ -229,7 +233,7 @@ int cfg80211_mgd_wext_giwessid(struct net_device *dev, · 3 unmodified lines
229233 }
230234 wdev_unlock(wdev);
231235
232− return 0;
236+ return ret;
233237 }
234238
235239 int cfg80211_mgd_wext_siwap(struct net_device *dev,
net/x25/x25_dev.c+1−1
@@ -55,7 +55,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) · 54 unmodified lines
5555 if (!sock_owned_by_user(sk)) {
5656 queued = x25_process_rx_frame(sk, skb);
5757 } else {
58− queued = !sk_add_backlog(sk, skb, sk->sk_rcvbuf);
58+ queued = !sk_add_backlog(sk, skb, READ_ONCE(sk->sk_rcvbuf));
5959 }
6060 bh_unlock_sock(sk);
6161 sock_put(sk);
net/xdp/xsk.c+27−15
@@ -305,9 +305,8 @@ out: · 304 unmodified lines
305305 }
306306 EXPORT_SYMBOL(xsk_umem_consume_tx);
307307
308−static int xsk_zc_xmit(struct sock *sk)
308+static int xsk_zc_xmit(struct xdp_sock *xs)
309309 {
310− struct xdp_sock *xs = xdp_sk(sk);
311310 struct net_device *dev = xs->dev;
312311
313312 return dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,
@@ -327,11 +326,10 @@ static void xsk_destruct_skb(struct sk_buff *skb) · 13 unmodified lines
327326 sock_wfree(skb);
328327 }
329328
330−static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
331− size_t total_len)
329+static int xsk_generic_xmit(struct sock *sk)
332330 {
333− u32 max_batch = TX_BATCH_SIZE;
334331 struct xdp_sock *xs = xdp_sk(sk);
332+ u32 max_batch = TX_BATCH_SIZE;
335333 bool sent_frame = false;
336334 struct xdp_desc desc;
337335 struct sk_buff *skb;
@@ -394,6 +392,18 @@ out: · 56 unmodified lines
394392 return err;
395393 }
396394
395+static int __xsk_sendmsg(struct sock *sk)
396+{
397+ struct xdp_sock *xs = xdp_sk(sk);
398+
399+ if (unlikely(!(xs->dev->flags & IFF_UP)))
400+ return -ENETDOWN;
401+ if (unlikely(!xs->tx))
402+ return -ENOBUFS;
403+
404+ return xs->zc ? xsk_zc_xmit(xs) : xsk_generic_xmit(sk);
405+}
406+
397407 static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
398408 {
399409 bool need_wait = !(m->msg_flags & MSG_DONTWAIT);
@@ -402,21 +412,18 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) · 2 unmodified lines
402412
403413 if (unlikely(!xsk_is_bound(xs)))
404414 return -ENXIO;
405− if (unlikely(!(xs->dev->flags & IFF_UP)))
406− return -ENETDOWN;
407− if (unlikely(!xs->tx))
408− return -ENOBUFS;
409− if (need_wait)
415+ if (unlikely(need_wait))
410416 return -EOPNOTSUPP;
411417
412− return (xs->zc) ? xsk_zc_xmit(sk) : xsk_generic_xmit(sk, m, total_len);
418+ return __xsk_sendmsg(sk);
413419 }
414420
415421 static unsigned int xsk_poll(struct file *file, struct socket *sock,
416422 struct poll_table_struct *wait)
417423 {
418424 unsigned int mask = datagram_poll(file, sock, wait);
419− struct xdp_sock *xs = xdp_sk(sock->sk);
425+ struct sock *sk = sock->sk;
426+ struct xdp_sock *xs = xdp_sk(sk);
420427 struct net_device *dev;
421428 struct xdp_umem *umem;
422429
@@ -426,9 +433,14 @@ static unsigned int xsk_poll(struct file *file, struct socket *sock, · 3 unmodified lines
426433 dev = xs->dev;
427434 umem = xs->umem;
428435
429− if (umem->need_wakeup)
430− dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,
431− umem->need_wakeup);
436+ if (umem->need_wakeup) {
437+ if (dev->netdev_ops->ndo_xsk_wakeup)
438+ dev->netdev_ops->ndo_xsk_wakeup(dev, xs->queue_id,
439+ umem->need_wakeup);
440+ else
441+ /* Poll needs to drive Tx also in copy mode */
442+ __xsk_sendmsg(sk);
443+ }
432444
433445 if (xs->rx && !xskq_empty_desc(xs->rx))
434446 mask |= POLLIN | POLLRDNORM;
samples/bpf/asm_goto_workaround.h+12−1
@@ -3,7 +3,8 @@ · 2 unmodified lines
33 #ifndef __ASM_GOTO_WORKAROUND_H
44 #define __ASM_GOTO_WORKAROUND_H
55
6−/* this will bring in asm_volatile_goto macro definition
6+/*
7+ * This will bring in asm_volatile_goto and asm_inline macro definitions
78 * if enabled by compiler and config options.
89 */
910 #include <linux/types.h>
@@ -13,5 +14,15 @@ · 3 unmodified lines
1314 #define asm_volatile_goto(x...) asm volatile("invalid use of asm_volatile_goto")
1415 #endif
1516
17+/*
18+ * asm_inline is defined as asm __inline in "include/linux/compiler_types.h"
19+ * if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not
20+ * supported by CLANG.
21+ */
22+#ifdef asm_inline
23+#undef asm_inline
24+#define asm_inline asm
25+#endif
26+
1627 #define volatile(x...) volatile("")
1728 #endif
samples/bpf/task_fd_query_user.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <sys/resource.h>
1414 #include <sys/types.h>
1515 #include <sys/stat.h>
16+#include <linux/perf_event.h>
1617
1718 #include "libbpf.h"
1819 #include "bpf_load.h"
scripts/coccinelle/api/devm_platform_ioremap_resource.cocci+0−60
@@ -1,60 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0
2−/// Use devm_platform_ioremap_resource helper which wraps
3−/// platform_get_resource() and devm_ioremap_resource() together.
4−///
5−// Confidence: High
6−// Copyright: (C) 2019 Himanshu Jha GPLv2.
7−// Copyright: (C) 2019 Julia Lawall, Inria/LIP6. GPLv2.
8−// Keywords: platform_get_resource, devm_ioremap_resource,
9−// Keywords: devm_platform_ioremap_resource
10−
11−virtual patch
12−virtual report
13−
14−@r depends on patch && !report@
15−expression e1, e2, arg1, arg2, arg3;
16−identifier id;
17−@@
18−
19−(
20−- id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
21−|
22−- struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
23−)
24− ... when != id
25−- e1 = devm_ioremap_resource(arg3, id);
26−+ e1 = devm_platform_ioremap_resource(arg1, arg2);
27− ... when != id
28−? id = e2
29−
30−@r1 depends on patch && !report@
31−identifier r.id;
32−type T;
33−@@
34−
35−- T *id;
36− ...when != id
37−
38−@r2 depends on report && !patch@
39−identifier id;
40−expression e1, e2, arg1, arg2, arg3;
41−position j0;
42−@@
43−
44−(
45− id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
46−|
47− struct resource *id = platform_get_resource(arg1, IORESOURCE_MEM, arg2);
48−)
49− ... when != id
50− e1@j0 = devm_ioremap_resource(arg3, id);
51− ... when != id
52−? id = e2
53−
54−@script:python depends on report && !patch@
55−e1 << r2.e1;
56−j0 << r2.j0;
57−@@
58−
59−msg = "WARNING: Use devm_platform_ioremap_resource for %s" % (e1)
60−coccilib.report.print_report(j0[0], msg)
scripts/gdb/linux/dmesg.py+12−4
@@ -16,6 +16,8 @@ import sys · 15 unmodified lines
1616
1717 from linux import utils
1818
19+printk_log_type = utils.CachedType("struct printk_log")
20+
1921
2022 class LxDmesg(gdb.Command):
2123 """Print Linux kernel log buffer."""
@@ -42,9 +44,14 @@ class LxDmesg(gdb.Command): · 20 unmodified lines
4244 b = utils.read_memoryview(inf, log_buf_addr, log_next_idx)
4345 log_buf = a.tobytes() + b.tobytes()
4446
47+ length_offset = printk_log_type.get_type()['len'].bitpos // 8
48+ text_len_offset = printk_log_type.get_type()['text_len'].bitpos // 8
49+ time_stamp_offset = printk_log_type.get_type()['ts_nsec'].bitpos // 8
50+ text_offset = printk_log_type.get_type().sizeof
51+
4552 pos = 0
4653 while pos < log_buf.__len__():
47− length = utils.read_u16(log_buf[pos + 8:pos + 10])
54+ length = utils.read_u16(log_buf, pos + length_offset)
4855 if length == 0:
4956 if log_buf_2nd_half == -1:
5057 gdb.write("Corrupted log buffer!\n")
@@ -52,10 +59,11 @@ class LxDmesg(gdb.Command): · 1 unmodified line
5259 pos = log_buf_2nd_half
5360 continue
5461
55− text_len = utils.read_u16(log_buf[pos + 10:pos + 12])
56− text = log_buf[pos + 16:pos + 16 + text_len].decode(
62+ text_len = utils.read_u16(log_buf, pos + text_len_offset)
63+ text_start = pos + text_offset
64+ text = log_buf[text_start:text_start + text_len].decode(
5765 encoding='utf8', errors='replace')
58− time_stamp = utils.read_u64(log_buf[pos:pos + 8])
66+ time_stamp = utils.read_u64(log_buf, pos + time_stamp_offset)
5967
6068 for line in text.splitlines():
6169 msg = u"[{time:12.6f}] {line}\n".format(
scripts/gdb/linux/symbols.py+7−1
@@ -15,7 +15,7 @@ import gdb · 14 unmodified lines
1515 import os
1616 import re
1717
18−from linux import modules
18+from linux import modules, utils
1919
2020
2121 if hasattr(gdb, 'Breakpoint'):
@@ -116,6 +116,12 @@ lx-symbols command.""" · 94 unmodified lines
116116 module_file = self._get_module_file(module_name)
117117
118118 if module_file:
119+ if utils.is_target_arch('s390'):
120+ # Module text is preceded by PLT stubs on s390.
121+ module_arch = module['arch']
122+ plt_offset = int(module_arch['plt_offset'])
123+ plt_size = int(module_arch['plt_size'])
124+ module_addr = hex(int(module_addr, 0) + plt_offset + plt_size)
119125 gdb.write("loading @{addr}: {filename}\n".format(
120126 addr=module_addr, filename=module_file))
121127 cmdline = "add-symbol-file {filename} {addr}{sections}".format(
scripts/gdb/linux/utils.py+13−12
@@ -92,15 +92,16 @@ def read_memoryview(inf, start, length): · 91 unmodified lines
9292 return memoryview(inf.read_memory(start, length))
9393
9494
95−def read_u16(buffer):
95+def read_u16(buffer, offset):
96+ buffer_val = buffer[offset:offset + 2]
9697 value = [0, 0]
9798
98− if type(buffer[0]) is str:
99− value[0] = ord(buffer[0])
100− value[1] = ord(buffer[1])
99+ if type(buffer_val[0]) is str:
100+ value[0] = ord(buffer_val[0])
101+ value[1] = ord(buffer_val[1])
101102 else:
102− value[0] = buffer[0]
103− value[1] = buffer[1]
103+ value[0] = buffer_val[0]
104+ value[1] = buffer_val[1]
104105
105106 if get_target_endianness() == LITTLE_ENDIAN:
106107 return value[0] + (value[1] << 8)
@@ -108,18 +109,18 @@ def read_u16(buffer): · 1 unmodified line
108109 return value[1] + (value[0] << 8)
109110
110111
111−def read_u32(buffer):
112+def read_u32(buffer, offset):
112113 if get_target_endianness() == LITTLE_ENDIAN:
113− return read_u16(buffer[0:2]) + (read_u16(buffer[2:4]) << 16)
114+ return read_u16(buffer, offset) + (read_u16(buffer, offset + 2) << 16)
114115 else:
115− return read_u16(buffer[2:4]) + (read_u16(buffer[0:2]) << 16)
116+ return read_u16(buffer, offset + 2) + (read_u16(buffer, offset) << 16)
116117
117118
118−def read_u64(buffer):
119+def read_u64(buffer, offset):
119120 if get_target_endianness() == LITTLE_ENDIAN:
120− return read_u32(buffer[0:4]) + (read_u32(buffer[4:8]) << 32)
121+ return read_u32(buffer, offset) + (read_u32(buffer, offset + 4) << 32)
121122 else:
122− return read_u32(buffer[4:8]) + (read_u32(buffer[0:4]) << 32)
123+ return read_u32(buffer, offset + 4) + (read_u32(buffer, offset) << 32)
123124
124125
125126 target_arch = None
scripts/mod/modpost.c+40−19
@@ -348,26 +348,38 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec) · 347 unmodified lines
348348 return export_unknown;
349349 }
350350
351−static char *sym_extract_namespace(const char **symname)
351+static const char *namespace_from_kstrtabns(struct elf_info *info,
352+ Elf_Sym *kstrtabns)
352353 {
353− char *namespace = NULL;
354− char *ns_separator;
354+ char *value = info->ksymtab_strings + kstrtabns->st_value;
355+ return value[0] ? value : NULL;
356+}
357+
358+static void sym_update_namespace(const char *symname, const char *namespace)
359+{
360+ struct symbol *s = find_symbol(symname);
355361
356− ns_separator = strchr(*symname, '.');
357− if (ns_separator) {
358− namespace = NOFAIL(strndup(*symname, ns_separator - *symname));
359− *symname = ns_separator + 1;
362+ /*
363+ * That symbol should have been created earlier and thus this is
364+ * actually an assertion.
365+ */
366+ if (!s) {
367+ merror("Could not update namespace(%s) for symbol %s\n",
368+ namespace, symname);
369+ return;
360370 }
361371
362− return namespace;
372+ free(s->namespace);
373+ s->namespace =
374+ namespace && namespace[0] ? NOFAIL(strdup(namespace)) : NULL;
363375 }
364376
365377 /**
366378 * Add an exported symbol - it may have already been added without a
367379 * CRC, in this case just update the CRC
368380 **/
369−static struct symbol *sym_add_exported(const char *name, const char *namespace,
370− struct module *mod, enum export export)
381+static struct symbol *sym_add_exported(const char *name, struct module *mod,
382+ enum export export)
371383 {
372384 struct symbol *s = find_symbol(name);
373385
@@ -383,8 +395,6 @@ static struct symbol *sym_add_exported(const char *name, const char *namespace, · 9 unmodified lines
383395 s->module = mod;
384396 }
385397 }
386− free(s->namespace);
387− s->namespace = namespace ? strdup(namespace) : NULL;
388398 s->preloaded = 0;
389399 s->vmlinux = is_vmlinux(mod->name);
390400 s->kernel = 0;
@@ -583,6 +593,10 @@ static int parse_elf(struct elf_info *info, const char *filename) · 192 unmodified lines
583593 info->export_unused_gpl_sec = i;
584594 else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
585595 info->export_gpl_future_sec = i;
596+ else if (strcmp(secname, "__ksymtab_strings") == 0)
597+ info->ksymtab_strings = (void *)hdr +
598+ sechdrs[i].sh_offset -
599+ sechdrs[i].sh_addr;
586600
587601 if (sechdrs[i].sh_type == SHT_SYMTAB) {
588602 unsigned int sh_link_idx;
@@ -672,7 +686,6 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 83 unmodified lines
672686 enum export export;
673687 bool is_crc = false;
674688 const char *name;
675− char *namespace;
676689
677690 if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
678691 strstarts(symname, "__ksymtab"))
@@ -745,9 +758,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 66 unmodified lines
745758 /* All exported symbols */
746759 if (strstarts(symname, "__ksymtab_")) {
747760 name = symname + strlen("__ksymtab_");
748− namespace = sym_extract_namespace(&name);
749− sym_add_exported(name, namespace, mod, export);
750− free(namespace);
761+ sym_add_exported(name, mod, export);
751762 }
752763 if (strcmp(symname, "init_module") == 0)
753764 mod->has_init = 1;
@@ -2043,6 +2054,16 @@ static void read_symbols(const char *modname) · 1289 unmodified lines
20432054 handle_moddevtable(mod, &info, sym, symname);
20442055 }
20452056
2057+ /* Apply symbol namespaces from __kstrtabns_<symbol> entries. */
2058+ for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
2059+ symname = remove_dot(info.strtab + sym->st_name);
2060+
2061+ if (strstarts(symname, "__kstrtabns_"))
2062+ sym_update_namespace(symname + strlen("__kstrtabns_"),
2063+ namespace_from_kstrtabns(&info,
2064+ sym));
2065+ }
2066+
20462067 // check for static EXPORT_SYMBOL_* functions && global vars
20472068 for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
20482069 unsigned char bind = ELF_ST_BIND(sym->st_info);
@@ -2196,7 +2217,7 @@ static int check_exports(struct module *mod) · 147 unmodified lines
21962217 else
21972218 basename = mod->name;
21982219
2199− if (exp->namespace && exp->namespace[0]) {
2220+ if (exp->namespace) {
22002221 add_namespace(&mod->required_namespaces,
22012222 exp->namespace);
22022223
@@ -2454,12 +2475,12 @@ static void read_dump(const char *fname, unsigned int kernel) · 251 unmodified lines
24542475 mod = new_module(modname);
24552476 mod->skip = 1;
24562477 }
2457− s = sym_add_exported(symname, namespace, mod,
2458− export_no(export));
2478+ s = sym_add_exported(symname, mod, export_no(export));
24592479 s->kernel = kernel;
24602480 s->preloaded = 1;
24612481 s->is_static = 0;
24622482 sym_update_crc(symname, mod, crc, export_no(export));
2483+ sym_update_namespace(symname, namespace);
24632484 }
24642485 release_file(file, size);
24652486 return;
scripts/mod/modpost.h+1−0
@@ -143,6 +143,7 @@ struct elf_info { · 142 unmodified lines
143143 Elf_Section export_gpl_sec;
144144 Elf_Section export_unused_gpl_sec;
145145 Elf_Section export_gpl_future_sec;
146+ char *ksymtab_strings;
146147 char *strtab;
147148 char *modinfo;
148149 unsigned int modinfo_len;
scripts/nsdeps+1−1
@@ -33,7 +33,7 @@ generate_deps() { · 32 unmodified lines
3333 if [ ! -f "$ns_deps_file" ]; then return; fi
3434 local mod_source_files=`cat $mod_file | sed -n 1p \
3535 | sed -e 's/\.o/\.c/g' \
36− | sed "s/[^ ]* */${srctree}\/&/g"`
36+ | sed "s|[^ ]* *|${srctree}/&|g"`
3737 for ns in `cat $ns_deps_file`; do
3838 echo "Adding namespace $ns to module $mod_name (if needed)."
3939 generate_deps_for_ns $ns $mod_source_files
scripts/setlocalversion+1−1
@@ -93,7 +93,7 @@ scm_version() · 92 unmodified lines
9393 # Check for mercurial and a mercurial repo.
9494 if test -d .hg && hgid=`hg id 2>/dev/null`; then
9595 # Do we have an tagged version? If so, latesttagdistance == 1
96− if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
96+ if [ "`hg log -r . --template '{latesttagdistance}'`" = "1" ]; then
9797 id=`hg log -r . --template '{latesttag}'`
9898 printf '%s%s' -hg "$id"
9999 else
sound/hda/ext/hdac_ext_controller.c+5−0
@@ -270,6 +270,11 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus, · 269 unmodified lines
270270
271271 ret = snd_hdac_ext_bus_link_power_up(link);
272272
273+ /*
274+ * clear the register to invalidate all the output streams
275+ */
276+ snd_hdac_updatew(link->ml_addr, AZX_REG_ML_LOSIDV,
277+ ML_LOSIDV_STREAM_MASK, 0);
273278 /*
274279 * wait for 521usec for codec to report status
275280 * HDA spec section 4.3 - Codec Discovery
sound/pci/hda/hda_intel.c+6−0
@@ -2399,6 +2399,12 @@ static const struct pci_device_id azx_ids[] = { · 2398 unmodified lines
23992399 /* Icelake */
24002400 { PCI_DEVICE(0x8086, 0x34c8),
24012401 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2402+ /* Jasperlake */
2403+ { PCI_DEVICE(0x8086, 0x38c8),
2404+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2405+ /* Tigerlake */
2406+ { PCI_DEVICE(0x8086, 0xa0c8),
2407+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
24022408 /* Elkhart Lake */
24032409 { PCI_DEVICE(0x8086, 0x4b55),
24042410 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
sound/pci/hda/patch_hdmi.c+2−0
@@ -3474,6 +3474,8 @@ static int patch_nvhdmi(struct hda_codec *codec) · 3473 unmodified lines
34743474 nvhdmi_chmap_cea_alloc_validate_get_type;
34753475 spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
34763476
3477+ codec->link_down_at_suspend = 1;
3478+
34773479 generic_acomp_init(codec, &nvhdmi_audio_ops, nvhdmi_port2pin);
34783480
34793481 return 0;
sound/pci/hda/patch_realtek.c+35−3
@@ -393,6 +393,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) · 392 unmodified lines
393393 case 0x10ec0700:
394394 case 0x10ec0701:
395395 case 0x10ec0703:
396+ case 0x10ec0711:
396397 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
397398 break;
398399 case 0x10ec0662:
@@ -5358,6 +5359,17 @@ static void alc271_hp_gate_mic_jack(struct hda_codec *codec, · 4959 unmodified lines
53585359 }
53595360 }
53605361
5362+static void alc256_fixup_dell_xps_13_headphone_noise2(struct hda_codec *codec,
5363+ const struct hda_fixup *fix,
5364+ int action)
5365+{
5366+ if (action != HDA_FIXUP_ACT_PRE_PROBE)
5367+ return;
5368+
5369+ snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 0, HDA_AMP_VOLMASK, 1);
5370+ snd_hda_override_wcaps(codec, 0x1a, get_wcaps(codec, 0x1a) & ~AC_WCAP_IN_AMP);
5371+}
5372+
53615373 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
53625374 const struct hda_fixup *fix,
53635375 int action)
@@ -5822,6 +5834,7 @@ enum { · 458 unmodified lines
58225834 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
58235835 ALC275_FIXUP_DELL_XPS,
58245836 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
5837+ ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2,
58255838 ALC293_FIXUP_LENOVO_SPK_NOISE,
58265839 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
58275840 ALC255_FIXUP_DELL_SPK_NOISE,
@@ -5869,6 +5882,7 @@ enum { · 41 unmodified lines
58695882 ALC225_FIXUP_WYSE_AUTO_MUTE,
58705883 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
58715884 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
5885+ ALC256_FIXUP_ASUS_HEADSET_MIC,
58725886 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
58735887 ALC299_FIXUP_PREDATOR_SPK,
58745888 ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC,
@@ -6558,6 +6572,12 @@ static const struct hda_fixup alc269_fixups[] = { · 683 unmodified lines
65586572 .chained = true,
65596573 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
65606574 },
6575+ [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2] = {
6576+ .type = HDA_FIXUP_FUNC,
6577+ .v.func = alc256_fixup_dell_xps_13_headphone_noise2,
6578+ .chained = true,
6579+ .chain_id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE
6580+ },
65616581 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
65626582 .type = HDA_FIXUP_FUNC,
65636583 .v.func = alc_fixup_disable_aamix,
@@ -6912,6 +6932,15 @@ static const struct hda_fixup alc269_fixups[] = { · 348 unmodified lines
69126932 .chained = true,
69136933 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
69146934 },
6935+ [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
6936+ .type = HDA_FIXUP_PINS,
6937+ .v.pins = (const struct hda_pintbl[]) {
6938+ { 0x19, 0x03a11020 }, /* headset mic with jack detect */
6939+ { }
6940+ },
6941+ .chained = true,
6942+ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6943+ },
69156944 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
69166945 .type = HDA_FIXUP_PINS,
69176946 .v.pins = (const struct hda_pintbl[]) {
@@ -7001,17 +7030,17 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 83 unmodified lines
70017030 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
70027031 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
70037032 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
7004− SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
7033+ SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2),
70057034 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
70067035 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
70077036 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
7008− SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
7037+ SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2),
70097038 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
70107039 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
70117040 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
70127041 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
70137042 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
7014− SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
7043+ SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE2),
70157044 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
70167045 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
70177046 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
@@ -7108,6 +7137,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 90 unmodified lines
71087137 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
71097138 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
71107139 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC),
7140+ SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
71117141 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
71127142 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
71137143 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
@@ -7990,6 +8020,7 @@ static int patch_alc269(struct hda_codec *codec) · 876 unmodified lines
79908020 case 0x10ec0700:
79918021 case 0x10ec0701:
79928022 case 0x10ec0703:
8023+ case 0x10ec0711:
79938024 spec->codec_variant = ALC269_TYPE_ALC700;
79948025 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
79958026 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
@@ -9204,6 +9235,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { · 1208 unmodified lines
92049235 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
92059236 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
92069237 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
9238+ HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
92079239 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
92089240 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
92099241 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
sound/soc/codecs/max98373.c+12−8
@@ -901,16 +901,20 @@ static void max98373_slot_config(struct i2c_client *i2c, · 900 unmodified lines
901901 max98373->i_slot = value & 0xF;
902902 else
903903 max98373->i_slot = 1;
904−
905− max98373->reset_gpio = of_get_named_gpio(dev->of_node,
904+ if (dev->of_node) {
905+ max98373->reset_gpio = of_get_named_gpio(dev->of_node,
906906 "maxim,reset-gpio", 0);
907− if (!gpio_is_valid(max98373->reset_gpio)) {
908− dev_err(dev, "Looking up %s property in node %s failed %d\n",
909− "maxim,reset-gpio", dev->of_node->full_name,
910− max98373->reset_gpio);
907+ if (!gpio_is_valid(max98373->reset_gpio)) {
908+ dev_err(dev, "Looking up %s property in node %s failed %d\n",
909+ "maxim,reset-gpio", dev->of_node->full_name,
910+ max98373->reset_gpio);
911+ } else {
912+ dev_dbg(dev, "maxim,reset-gpio=%d",
913+ max98373->reset_gpio);
914+ }
911915 } else {
912− dev_dbg(dev, "maxim,reset-gpio=%d",
913− max98373->reset_gpio);
916+ /* this makes reset_gpio as invalid */
917+ max98373->reset_gpio = -1;
914918 }
915919
916920 if (!device_property_read_u32(dev, "maxim,spkfb-slot-no", &value))
sound/soc/codecs/msm8916-wcd-digital.c+22−0
@@ -243,6 +243,10 @@ static const char *const rx_mix1_text[] = { · 242 unmodified lines
243243 "ZERO", "IIR1", "IIR2", "RX1", "RX2", "RX3"
244244 };
245245
246+static const char * const rx_mix2_text[] = {
247+ "ZERO", "IIR1", "IIR2"
248+};
249+
246250 static const char *const dec_mux_text[] = {
247251 "ZERO", "ADC1", "ADC2", "ADC3", "DMIC1", "DMIC2"
248252 };
@@ -270,6 +274,16 @@ static const struct soc_enum rx3_mix1_inp_enum[] = { · 21 unmodified lines
270274 SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX3_B2_CTL, 0, 6, rx_mix1_text),
271275 };
272276
277+/* RX1 MIX2 */
278+static const struct soc_enum rx_mix2_inp1_chain_enum =
279+ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX1_B3_CTL,
280+ 0, 3, rx_mix2_text);
281+
282+/* RX2 MIX2 */
283+static const struct soc_enum rx2_mix2_inp1_chain_enum =
284+ SOC_ENUM_SINGLE(LPASS_CDC_CONN_RX2_B3_CTL,
285+ 0, 3, rx_mix2_text);
286+
273287 /* DEC */
274288 static const struct soc_enum dec1_mux_enum = SOC_ENUM_SINGLE(
275289 LPASS_CDC_CONN_TX_B1_CTL, 0, 6, dec_mux_text);
@@ -309,6 +323,10 @@ static const struct snd_kcontrol_new rx3_mix1_inp2_mux = SOC_DAPM_ENUM( · 33 unmodified lines
309323 "RX3 MIX1 INP2 Mux", rx3_mix1_inp_enum[1]);
310324 static const struct snd_kcontrol_new rx3_mix1_inp3_mux = SOC_DAPM_ENUM(
311325 "RX3 MIX1 INP3 Mux", rx3_mix1_inp_enum[2]);
326+static const struct snd_kcontrol_new rx1_mix2_inp1_mux = SOC_DAPM_ENUM(
327+ "RX1 MIX2 INP1 Mux", rx_mix2_inp1_chain_enum);
328+static const struct snd_kcontrol_new rx2_mix2_inp1_mux = SOC_DAPM_ENUM(
329+ "RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum);
312330
313331 /* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */
314332 static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0);
@@ -740,6 +758,10 @@ static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = { · 425 unmodified lines
740758 &rx3_mix1_inp2_mux),
741759 SND_SOC_DAPM_MUX("RX3 MIX1 INP3", SND_SOC_NOPM, 0, 0,
742760 &rx3_mix1_inp3_mux),
761+ SND_SOC_DAPM_MUX("RX1 MIX2 INP1", SND_SOC_NOPM, 0, 0,
762+ &rx1_mix2_inp1_mux),
763+ SND_SOC_DAPM_MUX("RX2 MIX2 INP1", SND_SOC_NOPM, 0, 0,
764+ &rx2_mix2_inp1_mux),
743765
744766 SND_SOC_DAPM_MUX("CIC1 MUX", SND_SOC_NOPM, 0, 0, &cic1_mux),
745767 SND_SOC_DAPM_MUX("CIC2 MUX", SND_SOC_NOPM, 0, 0, &cic2_mux),
sound/soc/codecs/rt5651.c+3−0
@@ -1770,6 +1770,9 @@ static int rt5651_detect_headset(struct snd_soc_component *component) · 1769 unmodified lines
17701770
17711771 static bool rt5651_support_button_press(struct rt5651_priv *rt5651)
17721772 {
1773+ if (!rt5651->hp_jack)
1774+ return false;
1775+
17731776 /* Button press support only works with internal jack-detection */
17741777 return (rt5651->hp_jack->status & SND_JACK_MICROPHONE) &&
17751778 rt5651->gpiod_hp_det == NULL;
sound/soc/codecs/rt5682.c+10−2
@@ -995,6 +995,16 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component, · 994 unmodified lines
995995 {
996996 struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component);
997997
998+ rt5682->hs_jack = hs_jack;
999+
1000+ if (!hs_jack) {
1001+ regmap_update_bits(rt5682->regmap, RT5682_IRQ_CTRL_2,
1002+ RT5682_JD1_EN_MASK, RT5682_JD1_DIS);
1003+ regmap_update_bits(rt5682->regmap, RT5682_RC_CLK_CTRL,
1004+ RT5682_POW_JDH | RT5682_POW_JDL, 0);
1005+ return 0;
1006+ }
1007+
9981008 switch (rt5682->pdata.jd_src) {
9991009 case RT5682_JD1:
10001010 snd_soc_component_update_bits(component, RT5682_CBJ_CTRL_2,
@@ -1032,8 +1042,6 @@ static int rt5682_set_jack_detect(struct snd_soc_component *component, · 31 unmodified lines
10321042 break;
10331043 }
10341044
1035− rt5682->hs_jack = hs_jack;
1036−
10371045 return 0;
10381046 }
10391047
sound/soc/codecs/wm8994.c+26−17
@@ -533,13 +533,10 @@ static SOC_ENUM_SINGLE_DECL(dac_osr, · 532 unmodified lines
533533 static SOC_ENUM_SINGLE_DECL(adc_osr,
534534 WM8994_OVERSAMPLING, 1, osr_text);
535535
536−static const struct snd_kcontrol_new wm8994_snd_controls[] = {
536+static const struct snd_kcontrol_new wm8994_common_snd_controls[] = {
537537 SOC_DOUBLE_R_TLV("AIF1ADC1 Volume", WM8994_AIF1_ADC1_LEFT_VOLUME,
538538 WM8994_AIF1_ADC1_RIGHT_VOLUME,
539539 1, 119, 0, digital_tlv),
540−SOC_DOUBLE_R_TLV("AIF1ADC2 Volume", WM8994_AIF1_ADC2_LEFT_VOLUME,
541− WM8994_AIF1_ADC2_RIGHT_VOLUME,
542− 1, 119, 0, digital_tlv),
543540 SOC_DOUBLE_R_TLV("AIF2ADC Volume", WM8994_AIF2_ADC_LEFT_VOLUME,
544541 WM8994_AIF2_ADC_RIGHT_VOLUME,
545542 1, 119, 0, digital_tlv),
@@ -556,8 +553,6 @@ SOC_ENUM("AIF2DACR Source", aif2dacr_src), · 10 unmodified lines
556553
557554 SOC_DOUBLE_R_TLV("AIF1DAC1 Volume", WM8994_AIF1_DAC1_LEFT_VOLUME,
558555 WM8994_AIF1_DAC1_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
559−SOC_DOUBLE_R_TLV("AIF1DAC2 Volume", WM8994_AIF1_DAC2_LEFT_VOLUME,
560− WM8994_AIF1_DAC2_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
561556 SOC_DOUBLE_R_TLV("AIF2DAC Volume", WM8994_AIF2_DAC_LEFT_VOLUME,
562557 WM8994_AIF2_DAC_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
563558
@@ -565,17 +560,12 @@ SOC_SINGLE_TLV("AIF1 Boost Volume", WM8994_AIF1_CONTROL_2, 10, 3, 0, aif_tlv), · 1 unmodified line
565560 SOC_SINGLE_TLV("AIF2 Boost Volume", WM8994_AIF2_CONTROL_2, 10, 3, 0, aif_tlv),
566561
567562 SOC_SINGLE("AIF1DAC1 EQ Switch", WM8994_AIF1_DAC1_EQ_GAINS_1, 0, 1, 0),
568−SOC_SINGLE("AIF1DAC2 EQ Switch", WM8994_AIF1_DAC2_EQ_GAINS_1, 0, 1, 0),
569563 SOC_SINGLE("AIF2 EQ Switch", WM8994_AIF2_EQ_GAINS_1, 0, 1, 0),
570564
571565 WM8994_DRC_SWITCH("AIF1DAC1 DRC Switch", WM8994_AIF1_DRC1_1, 2),
572566 WM8994_DRC_SWITCH("AIF1ADC1L DRC Switch", WM8994_AIF1_DRC1_1, 1),
573567 WM8994_DRC_SWITCH("AIF1ADC1R DRC Switch", WM8994_AIF1_DRC1_1, 0),
574568
575−WM8994_DRC_SWITCH("AIF1DAC2 DRC Switch", WM8994_AIF1_DRC2_1, 2),
576−WM8994_DRC_SWITCH("AIF1ADC2L DRC Switch", WM8994_AIF1_DRC2_1, 1),
577−WM8994_DRC_SWITCH("AIF1ADC2R DRC Switch", WM8994_AIF1_DRC2_1, 0),
578−
579569 WM8994_DRC_SWITCH("AIF2DAC DRC Switch", WM8994_AIF2_DRC_1, 2),
580570 WM8994_DRC_SWITCH("AIF2ADCL DRC Switch", WM8994_AIF2_DRC_1, 1),
581571 WM8994_DRC_SWITCH("AIF2ADCR DRC Switch", WM8994_AIF2_DRC_1, 0),
@@ -594,9 +584,6 @@ SOC_SINGLE("Sidetone HPF Switch", WM8994_SIDETONE, 6, 1, 0), · 12 unmodified lines
594584 SOC_ENUM("AIF1ADC1 HPF Mode", aif1adc1_hpf),
595585 SOC_DOUBLE("AIF1ADC1 HPF Switch", WM8994_AIF1_ADC1_FILTERS, 12, 11, 1, 0),
596586
597−SOC_ENUM("AIF1ADC2 HPF Mode", aif1adc2_hpf),
598−SOC_DOUBLE("AIF1ADC2 HPF Switch", WM8994_AIF1_ADC2_FILTERS, 12, 11, 1, 0),
599−
600587 SOC_ENUM("AIF2ADC HPF Mode", aif2adc_hpf),
601588 SOC_DOUBLE("AIF2ADC HPF Switch", WM8994_AIF2_ADC_FILTERS, 12, 11, 1, 0),
602589
@@ -637,6 +624,24 @@ SOC_SINGLE("AIF2DAC 3D Stereo Switch", WM8994_AIF2_DAC_FILTERS_2, · 34 unmodified lines
637624 8, 1, 0),
638625 };
639626
627+/* Controls not available on WM1811 */
628+static const struct snd_kcontrol_new wm8994_snd_controls[] = {
629+SOC_DOUBLE_R_TLV("AIF1ADC2 Volume", WM8994_AIF1_ADC2_LEFT_VOLUME,
630+ WM8994_AIF1_ADC2_RIGHT_VOLUME,
631+ 1, 119, 0, digital_tlv),
632+SOC_DOUBLE_R_TLV("AIF1DAC2 Volume", WM8994_AIF1_DAC2_LEFT_VOLUME,
633+ WM8994_AIF1_DAC2_RIGHT_VOLUME, 1, 96, 0, digital_tlv),
634+
635+SOC_SINGLE("AIF1DAC2 EQ Switch", WM8994_AIF1_DAC2_EQ_GAINS_1, 0, 1, 0),
636+
637+WM8994_DRC_SWITCH("AIF1DAC2 DRC Switch", WM8994_AIF1_DRC2_1, 2),
638+WM8994_DRC_SWITCH("AIF1ADC2L DRC Switch", WM8994_AIF1_DRC2_1, 1),
639+WM8994_DRC_SWITCH("AIF1ADC2R DRC Switch", WM8994_AIF1_DRC2_1, 0),
640+
641+SOC_ENUM("AIF1ADC2 HPF Mode", aif1adc2_hpf),
642+SOC_DOUBLE("AIF1ADC2 HPF Switch", WM8994_AIF1_ADC2_FILTERS, 12, 11, 1, 0),
643+};
644+
640645 static const struct snd_kcontrol_new wm8994_eq_controls[] = {
641646 SOC_SINGLE_TLV("AIF1DAC1 EQ1 Volume", WM8994_AIF1_DAC1_EQ_GAINS_1, 11, 31, 0,
642647 eq_tlv),
@@ -4258,13 +4263,15 @@ static int wm8994_component_probe(struct snd_soc_component *component) · 3615 unmodified lines
42584263 wm8994_handle_pdata(wm8994);
42594264
42604265 wm_hubs_add_analogue_controls(component);
4261− snd_soc_add_component_controls(component, wm8994_snd_controls,
4262− ARRAY_SIZE(wm8994_snd_controls));
4266+ snd_soc_add_component_controls(component, wm8994_common_snd_controls,
4267+ ARRAY_SIZE(wm8994_common_snd_controls));
42634268 snd_soc_dapm_new_controls(dapm, wm8994_dapm_widgets,
42644269 ARRAY_SIZE(wm8994_dapm_widgets));
42654270
42664271 switch (control->type) {
42674272 case WM8994:
4273+ snd_soc_add_component_controls(component, wm8994_snd_controls,
4274+ ARRAY_SIZE(wm8994_snd_controls));
42684275 snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets,
42694276 ARRAY_SIZE(wm8994_specific_dapm_widgets));
42704277 if (control->revision < 4) {
@@ -4284,8 +4291,10 @@ static int wm8994_component_probe(struct snd_soc_component *component) · 13 unmodified lines
42844291 }
42854292 break;
42864293 case WM8958:
4294+ snd_soc_add_component_controls(component, wm8994_snd_controls,
4295+ ARRAY_SIZE(wm8994_snd_controls));
42874296 snd_soc_add_component_controls(component, wm8958_snd_controls,
4288− ARRAY_SIZE(wm8958_snd_controls));
4297+ ARRAY_SIZE(wm8958_snd_controls));
42894298 snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets,
42904299 ARRAY_SIZE(wm8958_dapm_widgets));
42914300 if (control->revision < 1) {
sound/soc/codecs/wm_adsp.c+7−3
@@ -1259,8 +1259,7 @@ static unsigned int wmfw_convert_flags(unsigned int in, unsigned int len) · 1258 unmodified lines
12591259 }
12601260
12611261 if (in) {
1262− if (in & WMFW_CTL_FLAG_READABLE)
1263− out |= rd;
1262+ out |= rd;
12641263 if (in & WMFW_CTL_FLAG_WRITEABLE)
12651264 out |= wr;
12661265 if (in & WMFW_CTL_FLAG_VOLATILE)
@@ -3697,11 +3696,16 @@ static int wm_adsp_buffer_parse_legacy(struct wm_adsp *dsp) · 2430 unmodified lines
36973696 u32 xmalg, addr, magic;
36983697 int i, ret;
36993698
3699+ alg_region = wm_adsp_find_alg_region(dsp, WMFW_ADSP2_XM, dsp->fw_id);
3700+ if (!alg_region) {
3701+ adsp_err(dsp, "No algorithm region found\n");
3702+ return -EINVAL;
3703+ }
3704+
37003705 buf = wm_adsp_buffer_alloc(dsp);
37013706 if (!buf)
37023707 return -ENOMEM;
37033708
3704− alg_region = wm_adsp_find_alg_region(dsp, WMFW_ADSP2_XM, dsp->fw_id);
37053709 xmalg = dsp->ops->sys_config_size / sizeof(__be32);
37063710
37073711 addr = alg_region->base + xmalg + ALG_XM_FIELD(magic);
sound/soc/intel/boards/sof_rt5682.c+56−4
@@ -308,6 +308,9 @@ static const struct snd_soc_dapm_widget sof_widgets[] = { · 307 unmodified lines
308308 SND_SOC_DAPM_HP("Headphone Jack", NULL),
309309 SND_SOC_DAPM_MIC("Headset Mic", NULL),
310310 SND_SOC_DAPM_SPK("Spk", NULL),
311+};
312+
313+static const struct snd_soc_dapm_widget dmic_widgets[] = {
311314 SND_SOC_DAPM_MIC("SoC DMIC", NULL),
312315 };
313316
@@ -318,10 +321,6 @@ static const struct snd_soc_dapm_route sof_map[] = { · 4 unmodified lines
318321
319322 /* other jacks */
320323 { "IN1P", NULL, "Headset Mic" },
321−
322− /* digital mics */
323− {"DMic", NULL, "SoC DMIC"},
324−
325324 };
326325
327326 static const struct snd_soc_dapm_route speaker_map[] = {
@@ -329,6 +328,11 @@ static const struct snd_soc_dapm_route speaker_map[] = { · 1 unmodified line
329328 { "Spk", NULL, "Speaker" },
330329 };
331330
331+static const struct snd_soc_dapm_route dmic_map[] = {
332+ /* digital mics */
333+ {"DMic", NULL, "SoC DMIC"},
334+};
335+
332336 static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd)
333337 {
334338 struct snd_soc_card *card = rtd->card;
@@ -342,6 +346,28 @@ static int speaker_codec_init(struct snd_soc_pcm_runtime *rtd) · 7 unmodified lines
342346 return ret;
343347 }
344348
349+static int dmic_init(struct snd_soc_pcm_runtime *rtd)
350+{
351+ struct snd_soc_card *card = rtd->card;
352+ int ret;
353+
354+ ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
355+ ARRAY_SIZE(dmic_widgets));
356+ if (ret) {
357+ dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
358+ /* Don't need to add routes if widget addition failed */
359+ return ret;
360+ }
361+
362+ ret = snd_soc_dapm_add_routes(&card->dapm, dmic_map,
363+ ARRAY_SIZE(dmic_map));
364+
365+ if (ret)
366+ dev_err(card->dev, "DMic map addition failed: %d\n", ret);
367+
368+ return ret;
369+}
370+
345371 /* sof audio machine driver for rt5682 codec */
346372 static struct snd_soc_card sof_audio_card_rt5682 = {
347373 .name = "sof_rt5682",
@@ -445,6 +471,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev, · 97 unmodified lines
445471 links[id].name = "dmic01";
446472 links[id].cpus = &cpus[id];
447473 links[id].cpus->dai_name = "DMIC01 Pin";
474+ links[id].init = dmic_init;
448475 if (dmic_be_num > 1) {
449476 /* set up 2 BE links at most */
450477 links[id + 1].name = "dmic16k";
@@ -576,6 +603,15 @@ static int sof_audio_probe(struct platform_device *pdev) · 125 unmodified lines
576603 /* need to get main clock from pmc */
577604 if (sof_rt5682_quirk & SOF_RT5682_MCLK_BYTCHT_EN) {
578605 ctx->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
606+ if (IS_ERR(ctx->mclk)) {
607+ ret = PTR_ERR(ctx->mclk);
608+
609+ dev_err(&pdev->dev,
610+ "Failed to get MCLK from pmc_plt_clk_3: %d\n",
611+ ret);
612+ return ret;
613+ }
614+
579615 ret = clk_prepare_enable(ctx->mclk);
580616 if (ret < 0) {
581617 dev_err(&pdev->dev,
@@ -621,8 +657,24 @@ static int sof_audio_probe(struct platform_device *pdev) · 39 unmodified lines
621657 &sof_audio_card_rt5682);
622658 }
623659
660+static int sof_rt5682_remove(struct platform_device *pdev)
661+{
662+ struct snd_soc_card *card = platform_get_drvdata(pdev);
663+ struct snd_soc_component *component = NULL;
664+
665+ for_each_card_components(card, component) {
666+ if (!strcmp(component->name, rt5682_component[0].name)) {
667+ snd_soc_component_set_jack(component, NULL, NULL);
668+ break;
669+ }
670+ }
671+
672+ return 0;
673+}
674+
624675 static struct platform_driver sof_audio = {
625676 .probe = sof_audio_probe,
677+ .remove = sof_rt5682_remove,
626678 .driver = {
627679 .name = "sof_rt5682",
628680 .pm = &snd_soc_pm_ops,
sound/soc/rockchip/rockchip_i2s.c+1−1
@@ -677,7 +677,7 @@ static int rockchip_i2s_probe(struct platform_device *pdev) · 676 unmodified lines
677677 ret = rockchip_pcm_platform_register(&pdev->dev);
678678 if (ret) {
679679 dev_err(&pdev->dev, "Could not register PCM\n");
680− return ret;
680+ goto err_suspend;
681681 }
682682
683683 return 0;
sound/soc/samsung/arndale_rt5631.c+30−4
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 // Author: Claude <claude@insginal.co.kr>
66
77 #include <linux/module.h>
8+#include <linux/of_device.h>
89 #include <linux/platform_device.h>
910 #include <linux/clk.h>
1011
@@ -74,6 +75,17 @@ static struct snd_soc_card arndale_rt5631 = { · 63 unmodified lines
7475 .num_links = ARRAY_SIZE(arndale_rt5631_dai),
7576 };
7677
78+static void arndale_put_of_nodes(struct snd_soc_card *card)
79+{
80+ struct snd_soc_dai_link *dai_link;
81+ int i;
82+
83+ for_each_card_prelinks(card, i, dai_link) {
84+ of_node_put(dai_link->cpus->of_node);
85+ of_node_put(dai_link->codecs->of_node);
86+ }
87+}
88+
7789 static int arndale_audio_probe(struct platform_device *pdev)
7890 {
7991 int n, ret;
@@ -103,18 +115,31 @@ static int arndale_audio_probe(struct platform_device *pdev) · 23 unmodified lines
103115 if (!arndale_rt5631_dai[0].codecs->of_node) {
104116 dev_err(&pdev->dev,
105117 "Property 'samsung,audio-codec' missing or invalid\n");
106− return -EINVAL;
118+ ret = -EINVAL;
119+ goto err_put_of_nodes;
107120 }
108121 }
109122
110123 ret = devm_snd_soc_register_card(card->dev, card);
124+ if (ret) {
125+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret);
126+ goto err_put_of_nodes;
127+ }
128+ return 0;
111129
112− if (ret)
113− dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret);
114−
130+err_put_of_nodes:
131+ arndale_put_of_nodes(card);
115132 return ret;
116133 }
117134
135+static int arndale_audio_remove(struct platform_device *pdev)
136+{
137+ struct snd_soc_card *card = platform_get_drvdata(pdev);
138+
139+ arndale_put_of_nodes(card);
140+ return 0;
141+}
142+
118143 static const struct of_device_id samsung_arndale_rt5631_of_match[] __maybe_unused = {
119144 { .compatible = "samsung,arndale-rt5631", },
120145 { .compatible = "samsung,arndale-alc5631", },
@@ -129,6 +154,7 @@ static struct platform_driver arndale_audio_driver = { · 8 unmodified lines
129154 .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match),
130155 },
131156 .probe = arndale_audio_probe,
157+ .remove = arndale_audio_remove,
132158 };
133159
134160 module_platform_driver(arndale_audio_driver);
sound/soc/sh/rcar/core.c+1−0
@@ -761,6 +761,7 @@ static int rsnd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) · 760 unmodified lines
761761 }
762762
763763 /* set format */
764+ rdai->bit_clk_inv = 0;
764765 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
765766 case SND_SOC_DAIFMT_I2S:
766767 rdai->sys_delay = 0;
sound/soc/soc-pcm.c+12−5
@@ -1070,7 +1070,7 @@ static int soc_pcm_trigger(struct snd_pcm_substream *substream, int cmd) · 1069 unmodified lines
10701070 return ret;
10711071 }
10721072
1073− snd_soc_dai_trigger(cpu_dai, substream, cmd);
1073+ ret = snd_soc_dai_trigger(cpu_dai, substream, cmd);
10741074 if (ret < 0)
10751075 return ret;
10761076
@@ -1097,7 +1097,7 @@ static int soc_pcm_bespoke_trigger(struct snd_pcm_substream *substream, · 20 unmodified lines
10971097 return ret;
10981098 }
10991099
1100− snd_soc_dai_bespoke_trigger(cpu_dai, substream, cmd);
1100+ ret = snd_soc_dai_bespoke_trigger(cpu_dai, substream, cmd);
11011101 if (ret < 0)
11021102 return ret;
11031103
@@ -1146,6 +1146,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 42 unmodified lines
11461146 {
11471147 struct snd_soc_dpcm *dpcm;
11481148 unsigned long flags;
1149+ char *name;
11491150
11501151 /* only add new dpcms */
11511152 for_each_dpcm_be(fe, stream, dpcm) {
@@ -1171,9 +1172,15 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe, · 19 unmodified lines
11711172 stream ? "<-" : "->", be->dai_link->name);
11721173
11731174 #ifdef CONFIG_DEBUG_FS
1174− dpcm->debugfs_state = debugfs_create_dir(be->dai_link->name,
1175− fe->debugfs_dpcm_root);
1176− debugfs_create_u32("state", 0644, dpcm->debugfs_state, &dpcm->state);
1175+ name = kasprintf(GFP_KERNEL, "%s:%s", be->dai_link->name,
1176+ stream ? "capture" : "playback");
1177+ if (name) {
1178+ dpcm->debugfs_state = debugfs_create_dir(name,
1179+ fe->debugfs_dpcm_root);
1180+ debugfs_create_u32("state", 0644, dpcm->debugfs_state,
1181+ &dpcm->state);
1182+ kfree(name);
1183+ }
11771184 #endif
11781185 return 1;
11791186 }
sound/soc/soc-topology.c+1−1
@@ -1582,7 +1582,7 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, · 1581 unmodified lines
15821582
15831583 /* map user to kernel widget ID */
15841584 template.id = get_widget_id(le32_to_cpu(w->id));
1585− if (template.id < 0)
1585+ if ((int)template.id < 0)
15861586 return template.id;
15871587
15881588 /* strings are allocated here, but used and freed by the widget */
sound/soc/sof/control.c+18−8
@@ -60,13 +60,16 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol, · 59 unmodified lines
6060 struct snd_sof_dev *sdev = scontrol->sdev;
6161 struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
6262 unsigned int i, channels = scontrol->num_channels;
63+ bool change = false;
64+ u32 value;
6365
6466 /* update each channel */
6567 for (i = 0; i < channels; i++) {
66− cdata->chanv[i].value =
67− mixer_to_ipc(ucontrol->value.integer.value[i],
68+ value = mixer_to_ipc(ucontrol->value.integer.value[i],
6869 scontrol->volume_table, sm->max + 1);
70+ change = change || (value != cdata->chanv[i].value);
6971 cdata->chanv[i].channel = i;
72+ cdata->chanv[i].value = value;
7073 }
7174
7275 /* notify DSP of mixer updates */
@@ -76,8 +79,7 @@ int snd_sof_volume_put(struct snd_kcontrol *kcontrol, · 3 unmodified lines
7679 SOF_CTRL_TYPE_VALUE_CHAN_GET,
7780 SOF_CTRL_CMD_VOLUME,
7881 true);
79−
80− return 0;
82+ return change;
8183 }
8284
8385 int snd_sof_switch_get(struct snd_kcontrol *kcontrol,
@@ -105,11 +107,15 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, · 21 unmodified lines
105107 struct snd_sof_dev *sdev = scontrol->sdev;
106108 struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
107109 unsigned int i, channels = scontrol->num_channels;
110+ bool change = false;
111+ u32 value;
108112
109113 /* update each channel */
110114 for (i = 0; i < channels; i++) {
111− cdata->chanv[i].value = ucontrol->value.integer.value[i];
115+ value = ucontrol->value.integer.value[i];
116+ change = change || (value != cdata->chanv[i].value);
112117 cdata->chanv[i].channel = i;
118+ cdata->chanv[i].value = value;
113119 }
114120
115121 /* notify DSP of mixer updates */
@@ -120,7 +126,7 @@ int snd_sof_switch_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines
120126 SOF_CTRL_CMD_SWITCH,
121127 true);
122128
123− return 0;
129+ return change;
124130 }
125131
126132 int snd_sof_enum_get(struct snd_kcontrol *kcontrol,
@@ -148,11 +154,15 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, · 21 unmodified lines
148154 struct snd_sof_dev *sdev = scontrol->sdev;
149155 struct sof_ipc_ctrl_data *cdata = scontrol->control_data;
150156 unsigned int i, channels = scontrol->num_channels;
157+ bool change = false;
158+ u32 value;
151159
152160 /* update each channel */
153161 for (i = 0; i < channels; i++) {
154− cdata->chanv[i].value = ucontrol->value.enumerated.item[i];
162+ value = ucontrol->value.enumerated.item[i];
163+ change = change || (value != cdata->chanv[i].value);
155164 cdata->chanv[i].channel = i;
165+ cdata->chanv[i].value = value;
156166 }
157167
158168 /* notify DSP of enum updates */
@@ -163,7 +173,7 @@ int snd_sof_enum_put(struct snd_kcontrol *kcontrol, · 4 unmodified lines
163173 SOF_CTRL_CMD_ENUM,
164174 true);
165175
166− return 0;
176+ return change;
167177 }
168178
169179 int snd_sof_bytes_get(struct snd_kcontrol *kcontrol,
sound/soc/sof/intel/Kconfig+10−0
@@ -273,6 +273,16 @@ config SND_SOC_SOF_HDA_AUDIO_CODEC · 272 unmodified lines
273273 Say Y if you want to enable HDAudio codecs with SOF.
274274 If unsure select "N".
275275
276+config SND_SOC_SOF_HDA_ALWAYS_ENABLE_DMI_L1
277+ bool "SOF enable DMI Link L1"
278+ help
279+ This option enables DMI L1 for both playback and capture
280+ and disables known workarounds for specific HDaudio platforms.
281+ Only use to look into power optimizations on platforms not
282+ affected by DMI L1 issues. This option is not recommended.
283+ Say Y if you want to enable DMI Link L1
284+ If unsure, select "N".
285+
276286 endif ## SND_SOC_SOF_HDA_COMMON
277287
278288 config SND_SOC_SOF_HDA_LINK_BASELINE
sound/soc/sof/intel/bdw.c+7−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #define MBOX_SIZE 0x1000
3838 #define MBOX_DUMP_SIZE 0x30
3939 #define EXCEPT_OFFSET 0x800
40+#define EXCEPT_MAX_HDR_SIZE 0x400
4041
4142 /* DSP peripherals */
4243 #define DMAC0_OFFSET 0xFE000
@@ -228,6 +229,11 @@ static void bdw_get_registers(struct snd_sof_dev *sdev, · 185 unmodified lines
228229 /* note: variable AR register array is not read */
229230
230231 /* then get panic info */
232+ if (xoops->arch_hdr.totalsize > EXCEPT_MAX_HDR_SIZE) {
233+ dev_err(sdev->dev, "invalid header size 0x%x. FW oops is bogus\n",
234+ xoops->arch_hdr.totalsize);
235+ return;
236+ }
231237 offset += xoops->arch_hdr.totalsize;
232238 sof_mailbox_read(sdev, offset, panic_info, sizeof(*panic_info));
233239
@@ -451,6 +457,7 @@ static int bdw_probe(struct snd_sof_dev *sdev) · 217 unmodified lines
451457 /* TODO: add offsets */
452458 sdev->mmio_bar = BDW_DSP_BAR;
453459 sdev->mailbox_bar = BDW_DSP_BAR;
460+ sdev->dsp_oops_offset = MBOX_OFFSET;
454461
455462 /* PCI base */
456463 mmio = platform_get_resource(pdev, IORESOURCE_MEM,
sound/soc/sof/intel/byt.c+6−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #define MBOX_OFFSET 0x144000

18 more lines aren’t shown here.

sound/soc/sof/intel/hda-ctrl.c+4−8

This diff is large: its 25 lines aren’t shown here.

sound/soc/sof/intel/hda-loader.c+1−0

This diff is large: its 8 lines aren’t shown here.

sound/soc/sof/intel/hda-stream.c+38−7

This diff is large: its 69 lines aren’t shown here.

sound/soc/sof/intel/hda.c+7−0

This diff is large: its 21 lines aren’t shown here.

sound/soc/sof/intel/hda.h+4−1

This diff is large: its 19 lines aren’t shown here.

sound/soc/sof/loader.c+2−2

This diff is large: its 13 lines aren’t shown here.

sound/soc/sof/pcm.c+24−11

This diff is large: its 93 lines aren’t shown here.

sound/soc/sof/topology.c+3−1

This diff is large: its 11 lines aren’t shown here.

sound/soc/stm/stm32_sai_sub.c+11−10

This diff is large: its 38 lines aren’t shown here.

sound/usb/pcm.c+3−0

This diff is large: its 10 lines aren’t shown here.

sound/usb/validate.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/bpf/Makefile+5−1

This diff is large: its 13 lines aren’t shown here.

tools/lib/bpf/Makefile+23−10

This diff is large: its 97 lines aren’t shown here.

tools/lib/bpf/libbpf_internal.h+16−0

This diff is large: its 23 lines aren’t shown here.

tools/lib/bpf/xsk.c+2−2

This diff is large: its 11 lines aren’t shown here.

tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/bpf/prog_tests/tcp_rtt.c+2−1

This diff is large: its 16 lines aren’t shown here.

tools/testing/selftests/bpf/test_flow_dissector.sh+3−0

This diff is large: its 10 lines aren’t shown here.

tools/testing/selftests/bpf/test_lwt_ip_encap.sh+3−3

This diff is large: its 19 lines aren’t shown here.

tools/testing/selftests/kvm/.gitignore+2−0

This diff is large: its 14 lines aren’t shown here.

tools/testing/selftests/kvm/include/x86_64/vmx.h+2−0

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/kvm/lib/x86_64/vmx.c+10−0

This diff is large: its 17 lines aren’t shown here.

tools/testing/selftests/kvm/x86_64/sync_regs_test.c+11−10

This diff is large: its 30 lines aren’t shown here.

tools/testing/selftests/kvm/x86_64/vmx_close_while_nested_test.c+1−5

This diff is large: its 14 lines aren’t shown here.

tools/testing/selftests/kvm/x86_64/vmx_dirty_log_test.c+2−0

This diff is large: its 9 lines aren’t shown here.

tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c+2−11

This diff is large: its 34 lines aren’t shown here.

tools/testing/selftests/kvm/x86_64/vmx_tsc_adjust_test.c+1−5

This diff is large: its 14 lines aren’t shown here.

tools/testing/selftests/vm/gup_benchmark.c+1−1

This diff is large: its 9 lines aren’t shown here.

tools/virtio/crypto/hash.h+0−0

Empty file added.

tools/virtio/linux/dma-mapping.h+2−0

This diff is large: its 7 lines aren’t shown here.

tools/virtio/xen/xen.h+6−0

This diff is large: its 7 lines aren’t shown here.

virt/kvm/arm/pmu.c+35−13

This diff is large: its 105 lines aren’t shown here.

virt/kvm/kvm_main.c+16−13

This diff is large: its 37 lines aren’t shown here.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t