History

Merge 6.6-rc6 into tty-next

We need the tty/serial fixes in here as well for testing, and this resolves merge conflicts in: drivers/tty/serial/serial_core.c as reported in linux-next

Greg Kroah-Hartman committed 3 years ago

Commit fe2017b2 parents dd976a9 5872080556 files · +6221 −2864Browse files

Unified · Split

556 files
  1. .mailmap +1 −0
  2. Documentation/ABI/testing/sysfs-class-firmware +7 −7
  3. Documentation/arch/arm64/silicon-errata.rst +2 −0
  4. Documentation/core-api/workqueue.rst +2 −2
  5. Documentation/devicetree/bindings/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml +0 −3
  6. Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml +1 −1
  7. Documentation/devicetree/bindings/display/imx/fsl,imx6-hdmi.yaml +1 −1
  8. Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml +3 −0
  9. Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml +1 −1
  10. Documentation/devicetree/bindings/iio/light/rohm,bu27010.yaml +1 −0
  11. Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml +12 −0
  12. Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.yaml +1 −0
  13. Documentation/devicetree/bindings/interrupt-controller/renesas,rzg2l-irqc.yaml +173 −57
  14. Documentation/devicetree/bindings/iommu/arm,smmu.yaml +1 −1
  15. Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml +1 −0
  16. Documentation/devicetree/bindings/media/i2c/toshiba,tc358746.yaml +2 −0
  17. Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml +0 −1
  18. Documentation/devicetree/bindings/media/renesas,vin.yaml +2 −2
  19. Documentation/devicetree/bindings/media/samsung,fimc.yaml +1 −0
  20. Documentation/devicetree/bindings/mfd/maxim,max77693.yaml +0 −4
  21. Documentation/devicetree/bindings/pci/brcm,iproc-pcie.yaml +76 −87
  22. Documentation/devicetree/bindings/riscv/cpus.yaml +1 −0
  23. Documentation/devicetree/bindings/sound/fsl,micfil.yaml +3 −0
  24. Documentation/devicetree/bindings/sound/rockchip-spdif.yaml +1 −0
  25. Documentation/devicetree/bindings/trivial-devices.yaml +1 −1
  26. Documentation/filesystems/erofs.rst +37 −3
  27. Documentation/filesystems/overlayfs.rst +12 −0
  28. Documentation/process/embargoed-hardware-issues.rst +12 −7
  29. Documentation/tools/rtla/rtla-timerlat-hist.rst +2 −2
  30. Documentation/translations/zh_CN/core-api/workqueue.rst +1 −1
  31. MAINTAINERS +27 −33
  32. Makefile +1 −1
  33. arch/arm64/Kconfig +13 −0
  34. arch/arm64/boot/dts/freescale/imx93.dtsi +3 −1
  35. arch/arm64/boot/dts/mediatek/mt7622.dtsi +1 −1
  36. arch/arm64/boot/dts/mediatek/mt7986a.dtsi +1 −1
  37. arch/arm64/boot/dts/mediatek/mt8195-demo.dts +31 −8
  38. arch/arm64/boot/dts/mediatek/mt8195.dtsi +1 −0
  39. arch/arm64/boot/dts/qcom/sm8150.dtsi +1 −1
  40. arch/arm64/include/asm/acpi.h +19 −0
  41. arch/arm64/include/asm/cputype.h +2 −0
  42. arch/arm64/kernel/cpu_errata.c +8 −0
  43. arch/arm64/kernel/entry.S +4 −0
  44. arch/arm64/tools/cpucaps +1 −0
  45. arch/ia64/include/asm/cpu.h +0 −5
  46. arch/ia64/kernel/topology.c +1 −1
  47. arch/parisc/include/asm/ldcw.h +20 −17
  48. arch/parisc/include/asm/spinlock_types.h +0 −5
  49. arch/parisc/kernel/smp.c +3 −1
  50. arch/powerpc/include/asm/nohash/32/pte-8xx.h +7 −0
  51. arch/powerpc/include/asm/nohash/64/pgtable.h +1 −1
  52. arch/powerpc/include/asm/nohash/pgtable.h +2 −0
  53. arch/powerpc/kernel/entry_32.S +5 −3
  54. arch/powerpc/kernel/head_85xx.S +1 −1
  55. arch/powerpc/platforms/pseries/hvCall.S +1 −7
  56. arch/riscv/Makefile +0 −1
  57. arch/riscv/errata/andes/Makefile +4 −0
  58. arch/riscv/include/asm/ftrace.h +21 −0
  59. arch/riscv/include/asm/kprobes.h +10 −1
  60. arch/riscv/include/asm/uprobes.h +12 −1
  61. arch/riscv/kernel/irq.c +2 −2
  62. arch/riscv/kernel/setup.c +0 −13
  63. arch/riscv/kernel/signal.c +0 −7
  64. arch/riscv/kernel/traps.c +18 −10
  65. arch/riscv/net/bpf_jit_comp64.c +12 −6
  66. arch/s390/net/bpf_jit_comp.c +21 −6
  67. arch/x86/events/utils.c +3 −2
  68. arch/x86/hyperv/hv_init.c +14 −6
  69. arch/x86/hyperv/hv_vtl.c +1 −2
  70. arch/x86/include/asm/cpu.h +0 −2
  71. arch/x86/include/asm/mshyperv.h +2 −0
  72. arch/x86/include/asm/msr-index.h +7 −2
  73. arch/x86/include/asm/smp.h +0 −1
  74. arch/x86/kernel/alternative.c +13 −0
  75. arch/x86/kernel/cpu/amd.c +8 −0
  76. arch/x86/kernel/cpu/resctrl/monitor.c +5 −5
  77. arch/x86/kernel/sev-shared.c +55 −14
  78. arch/x86/kernel/sev.c +1 −2
  79. arch/x86/kernel/smp.c +7 −32
  80. arch/x86/kernel/smpboot.c +0 −27
  81. arch/x86/kernel/topology.c +1 −1
  82. block/fops.c +16 −5
  83. drivers/acpi/acpi_processor.c +1 −0
  84. drivers/acpi/ec.c +11 −0
  85. drivers/acpi/nfit/core.c +1 −1
  86. drivers/acpi/processor_idle.c +1 −2
  87. drivers/acpi/resource.c +20 −6
  88. drivers/android/binder.c +2 −0
  89. drivers/ata/pata_parport/fit3.c +2 −12
  90. drivers/ata/pata_parport/pata_parport.c +76 −2
  91. drivers/base/regmap/regcache-rbtree.c +2 −1
  92. drivers/block/nbd.c +2 −1
  93. drivers/bluetooth/btusb.c +1 −0
  94. drivers/counter/counter-chrdev.c +2 −2
  95. drivers/counter/microchip-tcb-capture.c +1 −1
  96. drivers/dma-buf/dma-fence-unwrap.c +4 −9
  97. drivers/dma-buf/sync_file.c +3 −6
  98. drivers/dma/fsl-edma-common.c +22 −3
  99. drivers/dma/fsl-edma-common.h +13 −1
  100. drivers/dma/fsl-edma-main.c +5 −3
  101. drivers/dma/idxd/device.c +3 −2
  102. drivers/dma/mediatek/mtk-uart-apdma.c +1 −2
  103. drivers/dma/ste_dma40.c +1 −0
  104. drivers/dma/stm32-dma.c +7 −4
  105. drivers/dma/stm32-mdma.c +24 −9
  106. drivers/dma/ti/k3-udma-glue.c +3 −0
  107. drivers/gpio/gpio-aspeed.c +1 −1
  108. drivers/gpio/gpio-pxa.c +1 −0
  109. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 −1
  110. drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c +4 −0
  111. drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +1 −0
  112. drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 −1
  113. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c +2 −2
  114. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +2 −2
  115. drivers/gpu/drm/amd/display/dc/core/dc.c +3 −0
  116. drivers/gpu/drm/amd/pm/amdgpu_pm.c +1 −0
  117. drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +23 −18
  118. drivers/gpu/drm/drm_atomic_helper.c +13 −4
  119. drivers/gpu/drm/drm_gem.c +4 −2
  120. drivers/gpu/drm/drm_panel_orientation_quirks.c +16 −0
  121. drivers/gpu/drm/i915/gem/i915_gem_pages.c +1 −1
  122. drivers/gpu/drm/i915/gt/gen8_engine_cs.c +10 −1
  123. drivers/gpu/drm/i915/i915_gem.c +7 −2
  124. drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +18 −9
  125. drivers/gpu/drm/msm/dp/dp_ctrl.c +6 −7
  126. drivers/gpu/drm/msm/dp/dp_link.c +2 −2
  127. drivers/gpu/drm/msm/dsi/dsi_host.c +15 −4
  128. drivers/gpu/drm/msm/msm_mdss.c +1 −1
  129. drivers/gpu/drm/nouveau/nouveau_abi16.c +21 −0
  130. drivers/gpu/drm/nouveau/nouveau_chan.c +7 −8
  131. drivers/gpu/drm/nouveau/nouveau_dma.h +3 −0
  132. drivers/gpu/drm/nouveau/nouveau_exec.c +4 −3
  133. drivers/gpu/drm/nouveau/nouveau_exec.h +10 −0
  134. drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c +1 −3
  135. drivers/gpu/drm/scheduler/sched_main.c +1 −1
  136. drivers/gpu/drm/tests/drm_kunit_helpers.c +1 −1
  137. drivers/gpu/drm/tiny/simpledrm.c +1 −1
  138. drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +4 −3
  139. drivers/gpu/drm/vmwgfx/vmwgfx_bo.h +12 −5
  140. drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +3 −3
  141. drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +4 −0
  142. drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +7 −5
  143. drivers/gpu/drm/vmwgfx/vmwgfx_gem.c +15 −3
  144. drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +3 −3
  145. drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c +1 −1
  146. drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +6 −6
  147. drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +2 −2
  148. drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +12 −19
  149. drivers/hid/Kconfig +2 −0
  150. drivers/hid/hid-holtek-kbd.c +4 −0
  151. drivers/hid/hid-ids.h +1 −0
  152. drivers/hid/hid-input.c +2 −0
  153. drivers/hid/hid-logitech-hidpp.c +4 −1
  154. drivers/hid/hid-multitouch.c +4 −0
  155. drivers/hid/hid-nintendo.c +103 −72
  156. drivers/hid/hid-nvidia-shield.c +6 −3
  157. drivers/hid/hid-sony.c +2 −0
  158. drivers/hid/hid-steelseries.c +1 −1
  159. drivers/hid/i2c-hid/i2c-hid-core.c +81 −63
  160. drivers/hid/intel-ish-hid/ipc/pci-ish.c +8 −0
  161. drivers/hwtracing/coresight/coresight-tmc-etr.c +15 −12
  162. drivers/iio/adc/ad7192.c +25 −4
  163. drivers/iio/adc/imx8qxp-adc.c +2 −2
  164. drivers/iio/addac/Kconfig +2 −0
  165. drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +5 −1
  166. drivers/iio/dac/ad3552r.c +2 −2
  167. drivers/iio/frequency/admv1013.c +2 −2
  168. drivers/iio/imu/bno055/Kconfig +2 −0
  169. drivers/iio/light/vcnl4000.c +0 −1
  170. drivers/iio/pressure/bmp280-core.c +1 −1
  171. drivers/iio/pressure/dps310.c +4 −4
  172. drivers/iio/pressure/ms5611_core.c +1 −1
  173. drivers/iio/proximity/irsd200.c +3 −3
  174. drivers/infiniband/core/cma.c +1 −1
  175. drivers/infiniband/core/cma_configfs.c +1 −1
  176. drivers/infiniband/core/nldev.c +1 −0
  177. drivers/infiniband/core/uverbs_main.c +1 −1
  178. drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 −0
  179. drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +9 −2
  180. drivers/infiniband/hw/cxgb4/cm.c +3 −0
  181. drivers/infiniband/hw/erdma/erdma_verbs.c +3 −4
  182. drivers/infiniband/hw/mlx4/sysfs.c +1 −1
  183. drivers/infiniband/hw/mlx5/fs.c +1 −1
  184. drivers/infiniband/hw/mlx5/main.c +1 −1
  185. drivers/infiniband/hw/mlx5/mr.c +11 −3
  186. drivers/infiniband/sw/siw/siw_cm.c +12 −4
  187. drivers/infiniband/ulp/srp/ib_srp.c +5 −11
  188. drivers/input/joystick/xpad.c +4 −0
  189. drivers/input/misc/powermate.c +1 −0
  190. drivers/input/mouse/elantech.c +1 −0
  191. drivers/input/mouse/psmouse-smbus.c +7 −12
  192. drivers/input/mouse/synaptics.c +2 −0
  193. drivers/input/rmi4/rmi_smbus.c +28 −22
  194. drivers/input/serio/i8042-acpipnpio.h +8 −0
  195. drivers/input/touchscreen/goodix.c +19 −0
  196. drivers/iommu/apple-dart.c +1 −2
  197. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c +16 −2
  198. drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +10 −5
  199. drivers/iommu/intel/iommu.c +0 −16
  200. drivers/iommu/intel/iommu.h +1 −1
  201. drivers/iommu/mtk_iommu.c +4 −5
  202. drivers/irqchip/irq-gic-common.h +4 −0
  203. drivers/irqchip/irq-gic-v3-its.c +106 −64
  204. drivers/irqchip/irq-gic-v3.c +13 −0
  205. drivers/irqchip/irq-renesas-rzg2l.c +2 −2
  206. drivers/irqchip/irq-riscv-intc.c +9 −1
  207. drivers/irqchip/irq-stm32-exti.c +1 −0
  208. drivers/irqchip/qcom-pdc.c +51 −18
  209. drivers/leds/led-core.c +0 −4
  210. drivers/mcb/mcb-core.c +3 −7
  211. drivers/mcb/mcb-parse.c +0 −2
  212. drivers/md/dm-crypt.c +2 −1
  213. drivers/md/dm-zoned-target.c +7 −8
  214. drivers/md/raid5.c +7 −0
  215. drivers/media/i2c/ov8858.c +2 −8
  216. drivers/media/pci/intel/Kconfig +14 −6
  217. drivers/media/pci/intel/ipu-bridge.c +3 −1
  218. drivers/media/pci/intel/ipu3/Kconfig +1 −20
  219. drivers/media/pci/intel/ivsc/Kconfig +1 −1
  220. drivers/media/platform/intel/pxa_camera.c +1 −1
  221. drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c +2 −1
  222. drivers/media/platform/xilinx/xilinx-vipp.c +12 −5
  223. drivers/media/v4l2-core/v4l2-subdev.c +7 −0
  224. drivers/mfd/Kconfig +1 −0
  225. drivers/mtd/ubi/build.c +7 −0
  226. drivers/net/can/Kconfig +1 −1
  227. drivers/net/can/flexcan/flexcan-core.c +13 −33
  228. drivers/net/can/flexcan/flexcan.h +0 −2
  229. drivers/net/can/m_can/tcan4x5x-core.c +1 −1
  230. drivers/net/can/sja1000/sja1000.c +7 −1
  231. drivers/net/dsa/mv88e6xxx/chip.c +4 −2
  232. drivers/net/dsa/mv88e6xxx/global1.c +0 −31
  233. drivers/net/dsa/mv88e6xxx/global1.h +0 −1
  234. drivers/net/dsa/mv88e6xxx/global2.c +1 −1
  235. drivers/net/dsa/mv88e6xxx/global2.h +1 −0
  236. drivers/net/dsa/qca/qca8k-8xxx.c +13 −2
  237. drivers/net/ethernet/ibm/ibmveth.c +12 −13
  238. drivers/net/ethernet/intel/ice/ice_lag.c +32 −0
  239. drivers/net/ethernet/intel/ice/ice_lag.h +1 −0
  240. drivers/net/ethernet/intel/ice/ice_lib.c +6 −0
  241. drivers/net/ethernet/intel/ice/ice_virtchnl.c +7 −5
  242. drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +3 −2
  243. drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +9 −4
  244. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +1 −0
  245. drivers/net/ethernet/marvell/sky2.h +1 −1
  246. drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 −2
  247. drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c +2 −2
  248. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 −1
  249. drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c +2 −2
  250. drivers/net/ethernet/microchip/Kconfig +1 −0
  251. drivers/net/ethernet/microsoft/mana/mana_en.c +146 −65
  252. drivers/net/ethernet/netronome/nfp/flower/cmsg.c +6 −4
  253. drivers/net/ethernet/netronome/nfp/flower/conntrack.c +13 −6
  254. drivers/net/ethernet/netronome/nfp/flower/main.h +2 −0
  255. drivers/net/ethernet/netronome/nfp/flower/metadata.c +2 −0
  256. drivers/net/ethernet/netronome/nfp/flower/offload.c +18 −6
  257. drivers/net/ethernet/netronome/nfp/flower/qos_conf.c +13 −7
  258. drivers/net/ethernet/qlogic/qed/qed_ll2.h +1 −1
  259. drivers/net/ethernet/renesas/ravb_main.c +4 −2
  260. drivers/net/ethernet/renesas/rswitch.c +19 −6
  261. drivers/net/ethernet/renesas/rswitch.h +2 −0
  262. drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +5 −2
  263. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0 −30
  264. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +1 −1
  265. drivers/net/ethernet/ti/am65-cpsw-nuss.c +2 −1
  266. drivers/net/ethernet/ti/icssg/icssg_prueth.c +3 −3
  267. drivers/net/ieee802154/ca8210.c +3 −14
  268. drivers/net/macsec.c +2 −0
  269. drivers/net/phy/mscc/mscc_macsec.c +6 −0
  270. drivers/net/usb/dm9601.c +6 −1
  271. drivers/net/usb/smsc75xx.c +3 −1
  272. drivers/net/virtio_net.c +7 −7
  273. drivers/net/wan/fsl_ucc_hdlc.c +10 −2
  274. drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +7 −2
  275. drivers/net/wireless/intel/iwlwifi/fw/error-dump.h +3 −3
  276. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +1 −1
  277. drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +63 −58
  278. drivers/net/wireless/intel/iwlwifi/mvm/scan.c +1 −1
  279. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 −0
  280. drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c +19 −3
  281. drivers/net/wireless/marvell/mwifiex/fw.h +1 −1
  282. drivers/net/wireless/marvell/mwifiex/sta_rx.c +9 −7
  283. drivers/net/wireless/mediatek/mt76/dma.c +4 −4
  284. drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c +0 −7
  285. drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c +11 −2
  286. drivers/net/wireless/realtek/rtw88/rtw8723d.h +1 −0
  287. drivers/net/xen-netback/interface.c +0 −4
  288. drivers/of/dynamic.c +3 −3
  289. drivers/of/overlay.c +1 −1
  290. drivers/pci/controller/dwc/pcie-qcom.c +1 −3
  291. drivers/pci/of.c +11 −8
  292. drivers/pci/of_property.c +18 −7
  293. drivers/pci/pci-driver.c +13 −1
  294. drivers/perf/arm-cmn.c +1 −1
  295. drivers/perf/riscv_pmu.c +2 −1
  296. drivers/perf/riscv_pmu_sbi.c +10 −6
  297. drivers/phy/freescale/phy-fsl-lynx-28g.c +24 −3
  298. drivers/pinctrl/core.c +9 −7
  299. drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +3 −3
  300. drivers/pinctrl/pinctrl-lantiq.h +0 −1
  301. drivers/pinctrl/renesas/Kconfig +1 −0
  302. drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c +4 −0
  303. drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c +4 −0
  304. drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +40 −2
  305. drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h +4 −0
  306. drivers/pinctrl/tegra/pinctrl-tegra.c +2 −17
  307. drivers/pinctrl/tegra/pinctrl-tegra.h +0 −2
  308. drivers/platform/mellanox/mlxbf-tmfifo.c +8 −6
  309. drivers/platform/x86/hp/hp-bioscfg/bioscfg.c +10 −4
  310. drivers/platform/x86/hp/hp-wmi.c +7 −1
  311. drivers/platform/x86/intel/ifs/runtest.c +4 −3
  312. drivers/platform/x86/think-lmi.c +20 −4
  313. drivers/platform/x86/touchscreen_dmi.c +45 −0
  314. drivers/pmdomain/imx/scu-pd.c +2 −1
  315. drivers/power/supply/qcom_battmgr.c +4 −4
  316. drivers/ptp/ptp_ocp.c +0 −1
  317. drivers/regulator/core.c +3 −7
  318. drivers/regulator/mt6358-regulator.c +15 −3
  319. drivers/s390/net/Kconfig +1 −1
  320. drivers/s390/scsi/zfcp_aux.c +5 −4
  321. drivers/scsi/fnic/fnic.h +3 −1
  322. drivers/scsi/fnic/fnic_io.h +2 −0
  323. drivers/scsi/fnic/fnic_main.c +2 −0
  324. drivers/scsi/fnic/fnic_scsi.c +47 −17
  325. drivers/scsi/scsi_scan.c +6 −5
  326. drivers/soc/renesas/Kconfig +1 −0
  327. drivers/soundwire/Makefile +4 −0
  328. drivers/soundwire/bus.c +5 −26
  329. drivers/soundwire/bus_type.c +4 −7
  330. drivers/soundwire/irq.c +59 −0
  331. drivers/soundwire/irq.h +43 −0
  332. drivers/staging/media/atomisp/Kconfig +1 −1
  333. drivers/staging/media/tegra-video/vi.c +10 −6
  334. drivers/target/target_core_device.c +4 −7
  335. drivers/tee/amdtee/core.c +6 −4
  336. drivers/thunderbolt/icm.c +20 −20
  337. drivers/thunderbolt/switch.c +7 −0
  338. drivers/thunderbolt/tmu.c +1 −1
  339. drivers/thunderbolt/xdomain.c +41 −17
  340. drivers/tty/serial/8250/8250_omap.c +10 −15
  341. drivers/tty/serial/serial_core.c +10 −5
  342. drivers/ufs/core/ufshcd.c +1 −1
  343. drivers/usb/cdns3/cdnsp-gadget.c +3 −0
  344. drivers/usb/cdns3/core.h +1 −2
  345. drivers/usb/core/hub.c +22 −3
  346. drivers/usb/core/hub.h +1 −1
  347. drivers/usb/dwc3/core.c +38 −1
  348. drivers/usb/gadget/function/f_ncm.c +19 −7
  349. drivers/usb/gadget/udc/udc-xilinx.c +12 −8
  350. drivers/usb/host/xhci-hub.c +10 −9
  351. drivers/usb/host/xhci-mem.c +2 −2
  352. drivers/usb/host/xhci-ring.c +9 −7
  353. drivers/usb/host/xhci.h +1 −1
  354. drivers/usb/misc/onboard_usb_hub.c +1 −0
  355. drivers/usb/misc/onboard_usb_hub.h +1 −0
  356. drivers/usb/musb/musb_debugfs.c +1 −1
  357. drivers/usb/musb/musb_host.c +8 −1
  358. drivers/usb/typec/altmodes/displayport.c +5 −0
  359. drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c +6 −6
  360. drivers/usb/typec/ucsi/psy.c +9 −0
  361. drivers/usb/typec/ucsi/ucsi.c +2 −0
  362. drivers/vhost/vringh.c +11 −1
  363. drivers/xen/events/events_base.c +46 −41
  364. fs/btrfs/ctree.c +39 −13
  365. fs/btrfs/delayed-inode.c +1 −1
  366. fs/btrfs/delayed-inode.h +1 −1
  367. fs/btrfs/ioctl.c +2 −2
  368. fs/btrfs/transaction.h +2 −2
  369. fs/ceph/crypto.c +1 −1
  370. fs/ceph/file.c +1 −1
  371. fs/ceph/inode.c +1 −3
  372. fs/erofs/decompressor_lzma.c +4 −1
  373. fs/erofs/super.c +1 −1
  374. fs/fs_context.c +29 −5
  375. fs/nfs/nfs4proc.c +3 −1
  376. fs/nfs/nfs4state.c +33 −12
  377. fs/nfs/write.c +1 −1
  378. fs/overlayfs/export.c +1 −1
  379. fs/overlayfs/file.c +0 −2
  380. fs/overlayfs/ovl_entry.h +1 −9
  381. fs/overlayfs/params.c +59 −67
  382. fs/overlayfs/super.c +17 −10
  383. fs/quota/dquot.c +39 −27
  384. fs/smb/client/cached_dir.c +68 −73
  385. fs/smb/client/cached_dir.h +1 −1
  386. fs/smb/client/connect.c +13 −13
  387. fs/smb/server/connection.c +2 −0
  388. fs/smb/server/connection.h +1 −0
  389. fs/smb/server/mgmt/tree_connect.c +39 −3
  390. fs/smb/server/mgmt/tree_connect.h +9 −2
  391. fs/smb/server/mgmt/user_session.c +8 −3
  392. fs/smb/server/mgmt/user_session.h +1 −0
  393. fs/smb/server/server.c +2 −0
  394. fs/smb/server/smb2pdu.c +66 −39
  395. fs/smb/server/vfs_cache.c +25 −5
  396. fs/smb/server/vfs_cache.h +9 −0
  397. fs/xfs/libxfs/xfs_ag.c +6 −0
  398. fs/xfs/scrub/xfile.c +0 −1
  399. fs/xfs/xfs_discard.c +242 −24
  400. fs/xfs/xfs_discard.h +4 −2
  401. fs/xfs/xfs_extent_busy.c +29 −6
  402. fs/xfs/xfs_extent_busy.h +21 −3
  403. fs/xfs/xfs_iops.c +5 −0
  404. fs/xfs/xfs_log_cil.c +13 −80
  405. fs/xfs/xfs_log_priv.h +3 −2
  406. fs/xfs/xfs_notify_failure.c +3 −3
  407. include/acpi/processor.h +0 −5
  408. include/asm-generic/mshyperv.h +1 −1
  409. include/linux/acpi.h +9 −0
  410. include/linux/bpf.h +1 −1
  411. include/linux/cgroup-defs.h +1 −1
  412. include/linux/cpu.h +2 −0
  413. include/linux/dma-fence.h +19 −0
  414. include/linux/fs_context.h +2 −0
  415. include/linux/mcb.h +0 −1
  416. include/linux/netfilter/nf_conntrack_sctp.h +1 −0
  417. include/linux/quota.h +3 −1
  418. include/linux/quotaops.h +1 −1
  419. include/linux/skbuff.h +2 −2
  420. include/net/bluetooth/hci_core.h +1 −1
  421. include/net/cfg80211.h +4 −2
  422. include/net/ip_fib.h +1 −0
  423. include/net/macsec.h +1 −0
  424. include/net/mana/mana.h +3 −2
  425. include/net/neighbour.h +1 −1
  426. include/net/page_pool/helpers.h +3 −3
  427. include/net/tcp.h +4 −2
  428. include/sound/soc.h +2 −0
  429. include/uapi/drm/nouveau_drm.h +10 −0
  430. include/uapi/linux/if_packet.h +1 −5
  431. io_uring/io-wq.c +4 −6
  432. io_uring/io_uring.c +15 −1
  433. io_uring/io_uring.h +27 −14
  434. io_uring/kbuf.c +19 −8
  435. kernel/bpf/memalloc.c +19 −25
  436. kernel/bpf/mprog.c +9 −4
  437. kernel/bpf/syscall.c +15 −6
  438. kernel/bpf/tcx.c +1 −7
  439. kernel/bpf/verifier.c +6 −8
  440. kernel/cgroup/cgroup-v1.c +2 −3
  441. kernel/power/snapshot.c +2 −2
  442. kernel/printk/printk.c +7 −1
  443. kernel/sched/cpufreq_schedutil.c +2 −1
  444. kernel/sched/fair.c +72 −17
  445. kernel/workqueue.c +19 −5
  446. net/bluetooth/hci_conn.c +35 −28
  447. net/bluetooth/hci_core.c +11 −3
  448. net/bluetooth/hci_event.c +1 −0
  449. net/bluetooth/hci_request.h +0 −2
  450. net/bluetooth/hci_sync.c +5 −9
  451. net/bluetooth/iso.c +6 −3
  452. net/bridge/br_netfilter_hooks.c +1 −1
  453. net/can/isotp.c +8 −11
  454. net/ceph/messenger.c +2 −2
  455. net/core/dev.c +6 −2
  456. net/core/neighbour.c +8 −6
  457. net/core/sock_map.c +4 −0
  458. net/devlink/health.c +16 −14
  459. net/ethtool/bitset.c +26 −6
  460. net/ethtool/plca.c +29 −16
  461. net/ipv4/fib_semantics.c +1 −0
  462. net/ipv4/fib_trie.c +4 −0
  463. net/ipv4/route.c +2 −0
  464. net/ipv4/tcp.c +2 −8
  465. net/ipv4/tcp_bpf.c +3 −1
  466. net/ipv4/tcp_input.c +13 −0
  467. net/ipv4/tcp_output.c +4 −4
  468. net/ipv6/tcp_ipv6.c +7 −3
  469. net/l2tp/l2tp_ip6.c +1 −1
  470. net/mac80211/cfg.c +5 −1
  471. net/mac80211/ibss.c +1 −1
  472. net/mac80211/ieee80211_i.h +2 −1
  473. net/mac80211/key.c +16 −6
  474. net/mac80211/mesh.c +4 −4
  475. net/mac80211/mesh_plink.c +1 −1
  476. net/mac80211/mlme.c +35 −10
  477. net/mac80211/tx.c +2 −1
  478. net/mac80211/vht.c +14 −2
  479. net/mctp/route.c +16 −6
  480. net/mptcp/pm_userspace.c +0 −6
  481. net/mptcp/protocol.c +14 −14
  482. net/mptcp/protocol.h +12 −23
  483. net/mptcp/subflow.c +8 −2
  484. net/netfilter/ipvs/ip_vs_sync.c +4 −4
  485. net/netfilter/nf_conntrack_proto_sctp.c +33 −10
  486. net/netfilter/nf_tables_api.c +28 −16
  487. net/netfilter/nft_payload.c +12 −1
  488. net/netfilter/nft_set_rbtree.c +29 −17
  489. net/netlink/af_netlink.c +4 −4
  490. net/nfc/llcp_core.c +14 −18
  491. net/nfc/nci/core.c +5 −0
  492. net/packet/af_packet.c +6 −1
  493. net/rds/tcp_connect.c +2 −2
  494. net/rds/tcp_listen.c +1 −1
  495. net/rfkill/core.c +26 −6
  496. net/sched/cls_u32.c +1 −1
  497. net/sctp/associola.c +1 −2
  498. net/sctp/socket.c +1 −0
  499. net/smc/Kconfig +1 −0
  500. net/smc/smc_stats.h +9 −5
  501. net/socket.c +29 −7
  502. net/sunrpc/auth.c +8 −3
  503. net/sunrpc/auth_tls.c +2 −2
  504. net/sunrpc/clnt.c +10 −3
  505. net/sunrpc/xprtsock.c +6 −0
  506. net/tipc/crypto.c +2 −2
  507. net/wireless/core.c +7 −7
  508. net/wireless/core.h +5 −2
  509. net/wireless/mlme.c +2 −1
  510. net/wireless/nl80211.c +81 −33
  511. net/wireless/scan.c +4 −0
  512. net/xdp/xsk_queue.c +10 −0
  513. security/integrity/ima/Kconfig +8 −14
  514. security/keys/trusted-keys/trusted_core.c +5 −8
  515. sound/pci/hda/cs35l41_hda.c +79 −36
  516. sound/pci/hda/patch_realtek.c +17 −10
  517. sound/soc/amd/yc/acp6x-mach.c +7 −0
  518. sound/soc/codecs/hdmi-codec.c +4 −1
  519. sound/soc/codecs/rt5682-i2c.c +5 −5
  520. sound/soc/codecs/tlv320adc3xxx.c +2 −2
  521. sound/soc/fsl/fsl-asoc-card.c +8 −4
  522. sound/soc/fsl/fsl_sai.c +7 −2
  523. sound/soc/generic/simple-card-utils.c +2 −1
  524. sound/soc/generic/simple-card.c +4 −2
  525. sound/soc/intel/boards/sof_es8336.c +10 −0
  526. sound/soc/intel/boards/sof_sdw.c +10 −0
  527. sound/soc/intel/common/soc-acpi-intel-adl-match.c +6 −6
  528. sound/soc/intel/common/soc-acpi-intel-mtl-match.c +25 −0
  529. sound/soc/soc-core.c +17 −7
  530. sound/soc/soc-generic-dmaengine-pcm.c +2 −2
  531. sound/soc/sof/amd/pci-rmb.c +0 −1
  532. sound/soc/ti/ams-delta.c +2 −2
  533. sound/usb/mixer.c +7 −0
  534. sound/usb/quirks.c +7 −1
  535. tools/hv/hv_kvp_daemon.c +202 −31
  536. tools/hv/hv_set_ifconfig.sh +33 −6
  537. tools/testing/selftests/Makefile +1 −1
  538. tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c +2 −0
  539. tools/testing/selftests/bpf/prog_tests/sockmap_basic.c +51 −0
  540. tools/testing/selftests/bpf/prog_tests/tc_helpers.h +9 −7
  541. tools/testing/selftests/bpf/prog_tests/tc_links.c +23 −41
  542. tools/testing/selftests/bpf/prog_tests/tc_opts.c +332 −23
  543. tools/testing/selftests/bpf/prog_tests/timer.c +4 −2
  544. tools/testing/selftests/bpf/progs/bpf_cubic.c +3 −0
  545. tools/testing/selftests/bpf/progs/timer_failure.c +47 −0
  546. tools/testing/selftests/netfilter/Makefile +3 −2
  547. tools/testing/selftests/netfilter/conntrack_sctp_collision.sh +89 −0
  548. tools/testing/selftests/netfilter/nft_audit.sh +101 −16
  549. tools/testing/selftests/netfilter/sctp_collision.c +99 −0
  550. tools/testing/selftests/riscv/mm/Makefile +3 −3
  551. tools/testing/selftests/riscv/mm/mmap_bottomup.c +1 −1
  552. tools/testing/selftests/riscv/mm/mmap_default.c +1 −1
  553. tools/testing/selftests/riscv/mm/mmap_test.h +0 −0
  554. tools/testing/selftests/riscv/mm/run_mmap.sh +0 −0
  555. tools/tracing/rtla/src/timerlat_aa.c +26 −6
  556. tools/tracing/rtla/src/timerlat_u.c +4 −2
.mailmap+1−0
@@ -377,6 +377,7 @@ Matthew Wilcox <willy@infradead.org> <willy@debian.org> · 376 unmodified lines
377377 Matthew Wilcox <willy@infradead.org> <willy@linux.intel.com>
378378 Matthew Wilcox <willy@infradead.org> <willy@parisc-linux.org>
379379 Matthias Fuchs <socketcan@esd.eu> <matthias.fuchs@esd.eu>
380+Matthieu Baerts <matttbe@kernel.org> <matthieu.baerts@tessares.net>
380381 Matthieu CASTET <castet.matthieu@free.fr>
381382 Matti Vaittinen <mazziesaccount@gmail.com> <matti.vaittinen@fi.rohmeurope.com>
382383 Matt Ranostay <matt.ranostay@konsulko.com> <matt@ranostay.consulting>
Documentation/ABI/testing/sysfs-class-firmware+7−7
@@ -1,7 +1,7 @@
11 What: /sys/class/firmware/.../data
22 Date: July 2022
33 KernelVersion: 5.19
4−Contact: Russ Weight <russell.h.weight@intel.com>
4+Contact: Russ Weight <russ.weight@linux.dev>
55 Description: The data sysfs file is used for firmware-fallback and for
66 firmware uploads. Cat a firmware image to this sysfs file
77 after you echo 1 to the loading sysfs file. When the firmware
@@ -13,7 +13,7 @@ Description: The data sysfs file is used for firmware-fallback and for · 5 unmodified lines
1313 What: /sys/class/firmware/.../cancel
1414 Date: July 2022
1515 KernelVersion: 5.19
16−Contact: Russ Weight <russell.h.weight@intel.com>
16+Contact: Russ Weight <russ.weight@linux.dev>
1717 Description: Write-only. For firmware uploads, write a "1" to this file to
1818 request that the transfer of firmware data to the lower-level
1919 device be canceled. This request will be rejected (EBUSY) if
@@ -23,7 +23,7 @@ Description: Write-only. For firmware uploads, write a "1" to this file to · 3 unmodified lines
2323 What: /sys/class/firmware/.../error
2424 Date: July 2022
2525 KernelVersion: 5.19
26−Contact: Russ Weight <russell.h.weight@intel.com>
26+Contact: Russ Weight <russ.weight@linux.dev>
2727 Description: Read-only. Returns a string describing a failed firmware
2828 upload. This string will be in the form of <STATUS>:<ERROR>,
2929 where <STATUS> will be one of the status strings described
@@ -37,7 +37,7 @@ Description: Read-only. Returns a string describing a failed firmware · 7 unmodified lines
3737 What: /sys/class/firmware/.../loading
3838 Date: July 2022
3939 KernelVersion: 5.19
40−Contact: Russ Weight <russell.h.weight@intel.com>
40+Contact: Russ Weight <russ.weight@linux.dev>
4141 Description: The loading sysfs file is used for both firmware-fallback and
4242 for firmware uploads. Echo 1 onto the loading file to indicate
4343 you are writing a firmware file to the data sysfs node. Echo
@@ -49,7 +49,7 @@ Description: The loading sysfs file is used for both firmware-fallback and · 5 unmodified lines
4949 What: /sys/class/firmware/.../remaining_size
5050 Date: July 2022
5151 KernelVersion: 5.19
52−Contact: Russ Weight <russell.h.weight@intel.com>
52+Contact: Russ Weight <russ.weight@linux.dev>
5353 Description: Read-only. For firmware upload, this file contains the size
5454 of the firmware data that remains to be transferred to the
5555 lower-level device driver. The size value is initialized to
@@ -62,7 +62,7 @@ Description: Read-only. For firmware upload, this file contains the size · 6 unmodified lines
6262 What: /sys/class/firmware/.../status
6363 Date: July 2022
6464 KernelVersion: 5.19
65−Contact: Russ Weight <russell.h.weight@intel.com>
65+Contact: Russ Weight <russ.weight@linux.dev>
6666 Description: Read-only. Returns a string describing the current status of
6767 a firmware upload. The string will be one of the following:
6868 idle, "receiving", "preparing", "transferring", "programming".
@@ -70,7 +70,7 @@ Description: Read-only. Returns a string describing the current status of · 1 unmodified line
7070 What: /sys/class/firmware/.../timeout
7171 Date: July 2022
7272 KernelVersion: 5.19
73−Contact: Russ Weight <russell.h.weight@intel.com>
73+Contact: Russ Weight <russ.weight@linux.dev>
7474 Description: This file supports the timeout mechanism for firmware
7575 fallback. This file has no affect on firmware uploads. For
7676 more information on timeouts please see the documentation
Documentation/arch/arm64/silicon-errata.rst+2−0
@@ -71,6 +71,8 @@ stable kernels. · 70 unmodified lines
7171 +----------------+-----------------+-----------------+-----------------------------+
7272 | ARM | Cortex-A510 | #2658417 | ARM64_ERRATUM_2658417 |
7373 +----------------+-----------------+-----------------+-----------------------------+
74+| ARM | Cortex-A520 | #2966298 | ARM64_ERRATUM_2966298 |
75++----------------+-----------------+-----------------+-----------------------------+
7476 | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_826319 |
7577 +----------------+-----------------+-----------------+-----------------------------+
7678 | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_827319 |
Documentation/core-api/workqueue.rst+2−2
@@ -244,7 +244,7 @@ unbound worker-pools and only one work item could be active at any given · 243 unmodified lines
244244 time thus achieving the same ordering property as ST wq.
245245
246246 In the current implementation the above configuration only guarantees
247−ST behavior within a given NUMA node. Instead ``alloc_ordered_queue()`` should
247+ST behavior within a given NUMA node. Instead ``alloc_ordered_workqueue()`` should
248248 be used to achieve system-wide ST behavior.
249249
250250
@@ -390,7 +390,7 @@ The default affinity scope can be changed with the module parameter · 139 unmodified lines
390390 scope can be changed using ``apply_workqueue_attrs()``.
391391
392392 If ``WQ_SYSFS`` is set, the workqueue will have the following affinity scope
393−related interface files under its ``/sys/devices/virtual/WQ_NAME/``
393+related interface files under its ``/sys/devices/virtual/workqueue/WQ_NAME/``
394394 directory.
395395
396396 ``affinity_scope``
Documentation/devicetree/bindings/bus/fsl,imx8qxp-pixel-link-msi-bus.yaml+0−3
@@ -73,9 +73,6 @@ patternProperties: · 72 unmodified lines
7373 "^.*@[0-9a-f]+$":
7474 description: Devices attached to the bus
7575 type: object
76− properties:
77− reg:
78− maxItems: 1
7976
8077 required:
8178 - reg
Documentation/devicetree/bindings/cache/andestech,ax45mp-cache.yaml+1−1
@@ -69,7 +69,7 @@ examples: · 68 unmodified lines
6969 - |
7070 #include <dt-bindings/interrupt-controller/irq.h>
7171
72− cache-controller@2010000 {
72+ cache-controller@13400000 {
7373 compatible = "andestech,ax45mp-cache", "cache";
7474 reg = <0x13400000 0x100000>;
7575 interrupts = <508 IRQ_TYPE_LEVEL_HIGH>;
Documentation/devicetree/bindings/display/imx/fsl,imx6-hdmi.yaml+1−1
@@ -87,7 +87,7 @@ required: · 86 unmodified lines
8787 - interrupts
8888 - ports
8989
90−additionalProperties: false
90+unevaluatedProperties: false
9191
9292 examples:
9393 - |
Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dma-1.0.yaml+3−0
@@ -13,6 +13,8 @@ description: | · 12 unmodified lines
1313
1414 maintainers:
1515 - Michael Tretter <m.tretter@pengutronix.de>
16+ - Harini Katakam <harini.katakam@amd.com>
17+ - Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
1618
1719 allOf:
1820 - $ref: ../dma-controller.yaml#
@@ -65,6 +67,7 @@ required: · 46 unmodified lines
6567 - interrupts
6668 - clocks
6769 - clock-names
70+ - xlnx,bus-width
6871
6972 additionalProperties: false
7073
Documentation/devicetree/bindings/iio/adc/adi,ad7292.yaml+1−1
@@ -61,7 +61,7 @@ patternProperties: · 60 unmodified lines
6161 required:
6262 - reg
6363
64− additionalProperties: true
64+ additionalProperties: false
6565
6666 allOf:
6767 - $ref: /schemas/spi/spi-peripheral-props.yaml#
Documentation/devicetree/bindings/iio/light/rohm,bu27010.yaml+1−0
@@ -45,5 +45,6 @@ examples: · 44 unmodified lines
4545 light-sensor@38 {
4646 compatible = "rohm,bu27010";
4747 reg = <0x38>;
48+ vdd-supply = <&vdd>;
4849 };
4950 };
Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml+12−0
@@ -106,6 +106,12 @@ properties: · 105 unmodified lines
106106 $ref: /schemas/types.yaml#/definitions/uint32
107107 maximum: 4096
108108
109+ dma-noncoherent:
110+ description:
111+ Present if the GIC redistributors permit programming shareability
112+ and cacheability attributes but are connected to a non-coherent
113+ downstream interconnect.
114+
109115 msi-controller:
110116 description:
111117 Only present if the Message Based Interrupt functionality is
@@ -193,6 +199,12 @@ patternProperties: · 81 unmodified lines
193199 compatible:
194200 const: arm,gic-v3-its
195201
202+ dma-noncoherent:
203+ description:
204+ Present if the GIC ITS permits programming shareability and
205+ cacheability attributes but is connected to a non-coherent
206+ downstream interconnect.
207+
196208 msi-controller: true
197209
198210 "#msi-cells":
Documentation/devicetree/bindings/interrupt-controller/renesas,irqc.yaml+1−0
@@ -37,6 +37,7 @@ properties: · 36 unmodified lines
3737 - renesas,intc-ex-r8a77990 # R-Car E3
3838 - renesas,intc-ex-r8a77995 # R-Car D3
3939 - renesas,intc-ex-r8a779a0 # R-Car V3U
40+ - renesas,intc-ex-r8a779f0 # R-Car S4-8
4041 - renesas,intc-ex-r8a779g0 # R-Car V4H
4142 - const: renesas,irqc
4243
Documentation/devicetree/bindings/interrupt-controller/renesas,rzg2l-irqc.yaml+173−57
@@ -19,20 +19,19 @@ description: | · 18 unmodified lines
1919 - NMI edge select (NMI is not treated as NMI exception and supports fall edge and
2020 stand-up edge detection interrupts)
2121
22−allOf:
23− - $ref: /schemas/interrupt-controller.yaml#
24−
2522 properties:
2623 compatible:
2724 items:
2825 - enum:
26+ - renesas,r9a07g043u-irqc # RZ/G2UL
2927 - renesas,r9a07g044-irqc # RZ/G2{L,LC}
3028 - renesas,r9a07g054-irqc # RZ/V2L
3129 - const: renesas,rzg2l-irqc
3230
3331 '#interrupt-cells':
34− description: The first cell should contain external interrupt number (IRQ0-7) and the
35− second cell is used to specify the flag.
32+ description: The first cell should contain a macro RZG2L_{NMI,IRQX} included in the
33+ include/dt-bindings/interrupt-controller/irqc-rzg2l.h and the second
34+ cell is used to specify the flag.
3635 const: 2
3736
3837 '#address-cells':
@@ -44,7 +43,96 @@ properties: · 5 unmodified lines
4443 maxItems: 1
4544
4645 interrupts:
47− maxItems: 41
46+ minItems: 41
47+ items:
48+ - description: NMI interrupt
49+ - description: IRQ0 interrupt
50+ - description: IRQ1 interrupt
51+ - description: IRQ2 interrupt
52+ - description: IRQ3 interrupt
53+ - description: IRQ4 interrupt
54+ - description: IRQ5 interrupt
55+ - description: IRQ6 interrupt
56+ - description: IRQ7 interrupt
57+ - description: GPIO interrupt, TINT0
58+ - description: GPIO interrupt, TINT1
59+ - description: GPIO interrupt, TINT2
60+ - description: GPIO interrupt, TINT3
61+ - description: GPIO interrupt, TINT4
62+ - description: GPIO interrupt, TINT5
63+ - description: GPIO interrupt, TINT6
64+ - description: GPIO interrupt, TINT7
65+ - description: GPIO interrupt, TINT8
66+ - description: GPIO interrupt, TINT9
67+ - description: GPIO interrupt, TINT10
68+ - description: GPIO interrupt, TINT11
69+ - description: GPIO interrupt, TINT12
70+ - description: GPIO interrupt, TINT13
71+ - description: GPIO interrupt, TINT14
72+ - description: GPIO interrupt, TINT15
73+ - description: GPIO interrupt, TINT16
74+ - description: GPIO interrupt, TINT17
75+ - description: GPIO interrupt, TINT18
76+ - description: GPIO interrupt, TINT19
77+ - description: GPIO interrupt, TINT20
78+ - description: GPIO interrupt, TINT21
79+ - description: GPIO interrupt, TINT22
80+ - description: GPIO interrupt, TINT23
81+ - description: GPIO interrupt, TINT24
82+ - description: GPIO interrupt, TINT25
83+ - description: GPIO interrupt, TINT26
84+ - description: GPIO interrupt, TINT27
85+ - description: GPIO interrupt, TINT28
86+ - description: GPIO interrupt, TINT29
87+ - description: GPIO interrupt, TINT30
88+ - description: GPIO interrupt, TINT31
89+ - description: Bus error interrupt
90+
91+ interrupt-names:
92+ minItems: 41
93+ items:
94+ - const: nmi
95+ - const: irq0
96+ - const: irq1
97+ - const: irq2
98+ - const: irq3
99+ - const: irq4
100+ - const: irq5
101+ - const: irq6
102+ - const: irq7
103+ - const: tint0
104+ - const: tint1
105+ - const: tint2
106+ - const: tint3
107+ - const: tint4
108+ - const: tint5
109+ - const: tint6
110+ - const: tint7
111+ - const: tint8
112+ - const: tint9
113+ - const: tint10
114+ - const: tint11
115+ - const: tint12
116+ - const: tint13
117+ - const: tint14
118+ - const: tint15
119+ - const: tint16
120+ - const: tint17
121+ - const: tint18
122+ - const: tint19
123+ - const: tint20
124+ - const: tint21
125+ - const: tint22
126+ - const: tint23
127+ - const: tint24
128+ - const: tint25
129+ - const: tint26
130+ - const: tint27
131+ - const: tint28
132+ - const: tint29
133+ - const: tint30
134+ - const: tint31
135+ - const: bus-err
48136
49137 clocks:
50138 maxItems: 2
@@ -72,6 +160,23 @@ required: · 21 unmodified lines
72160 - power-domains
73161 - resets
74162
163+allOf:
164+ - $ref: /schemas/interrupt-controller.yaml#
165+
166+ - if:
167+ properties:
168+ compatible:
169+ contains:
170+ const: renesas,r9a07g043u-irqc
171+ then:
172+ properties:
173+ interrupts:
174+ minItems: 42
175+ interrupt-names:
176+ minItems: 42
177+ required:
178+ - interrupt-names
179+
75180 unevaluatedProperties: false
76181
77182 examples:
@@ -80,55 +185,66 @@ examples: · 2 unmodified lines
80185 #include <dt-bindings/clock/r9a07g044-cpg.h>
81186
82187 irqc: interrupt-controller@110a0000 {
83− compatible = "renesas,r9a07g044-irqc", "renesas,rzg2l-irqc";
84− reg = <0x110a0000 0x10000>;
85− #interrupt-cells = <2>;
86− #address-cells = <0>;
87− interrupt-controller;
88− interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
89− <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
90− <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
91− <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
92− <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
93− <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
94− <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
95− <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
96− <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
97− <GIC_SPI 444 IRQ_TYPE_LEVEL_HIGH>,
98− <GIC_SPI 445 IRQ_TYPE_LEVEL_HIGH>,
99− <GIC_SPI 446 IRQ_TYPE_LEVEL_HIGH>,
100− <GIC_SPI 447 IRQ_TYPE_LEVEL_HIGH>,
101− <GIC_SPI 448 IRQ_TYPE_LEVEL_HIGH>,
102− <GIC_SPI 449 IRQ_TYPE_LEVEL_HIGH>,
103− <GIC_SPI 450 IRQ_TYPE_LEVEL_HIGH>,
104− <GIC_SPI 451 IRQ_TYPE_LEVEL_HIGH>,
105− <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>,
106− <GIC_SPI 453 IRQ_TYPE_LEVEL_HIGH>,
107− <GIC_SPI 454 IRQ_TYPE_LEVEL_HIGH>,
108− <GIC_SPI 455 IRQ_TYPE_LEVEL_HIGH>,
109− <GIC_SPI 456 IRQ_TYPE_LEVEL_HIGH>,
110− <GIC_SPI 457 IRQ_TYPE_LEVEL_HIGH>,
111− <GIC_SPI 458 IRQ_TYPE_LEVEL_HIGH>,
112− <GIC_SPI 459 IRQ_TYPE_LEVEL_HIGH>,
113− <GIC_SPI 460 IRQ_TYPE_LEVEL_HIGH>,
114− <GIC_SPI 461 IRQ_TYPE_LEVEL_HIGH>,
115− <GIC_SPI 462 IRQ_TYPE_LEVEL_HIGH>,
116− <GIC_SPI 463 IRQ_TYPE_LEVEL_HIGH>,
117− <GIC_SPI 464 IRQ_TYPE_LEVEL_HIGH>,
118− <GIC_SPI 465 IRQ_TYPE_LEVEL_HIGH>,
119− <GIC_SPI 466 IRQ_TYPE_LEVEL_HIGH>,
120− <GIC_SPI 467 IRQ_TYPE_LEVEL_HIGH>,
121− <GIC_SPI 468 IRQ_TYPE_LEVEL_HIGH>,
122− <GIC_SPI 469 IRQ_TYPE_LEVEL_HIGH>,
123− <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>,
124− <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>,
125− <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>,
126− <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>,
127− <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>,
128− <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>;
129− clocks = <&cpg CPG_MOD R9A07G044_IA55_CLK>,
130− <&cpg CPG_MOD R9A07G044_IA55_PCLK>;
131− clock-names = "clk", "pclk";
132− power-domains = <&cpg>;
133− resets = <&cpg R9A07G044_IA55_RESETN>;
188+ compatible = "renesas,r9a07g044-irqc", "renesas,rzg2l-irqc";
189+ reg = <0x110a0000 0x10000>;
190+ #interrupt-cells = <2>;
191+ #address-cells = <0>;
192+ interrupt-controller;
193+ interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
194+ <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
195+ <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
196+ <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
197+ <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
198+ <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
199+ <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
200+ <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>,
201+ <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
202+ <GIC_SPI 444 IRQ_TYPE_LEVEL_HIGH>,
203+ <GIC_SPI 445 IRQ_TYPE_LEVEL_HIGH>,
204+ <GIC_SPI 446 IRQ_TYPE_LEVEL_HIGH>,
205+ <GIC_SPI 447 IRQ_TYPE_LEVEL_HIGH>,
206+ <GIC_SPI 448 IRQ_TYPE_LEVEL_HIGH>,
207+ <GIC_SPI 449 IRQ_TYPE_LEVEL_HIGH>,
208+ <GIC_SPI 450 IRQ_TYPE_LEVEL_HIGH>,
209+ <GIC_SPI 451 IRQ_TYPE_LEVEL_HIGH>,
210+ <GIC_SPI 452 IRQ_TYPE_LEVEL_HIGH>,
211+ <GIC_SPI 453 IRQ_TYPE_LEVEL_HIGH>,
212+ <GIC_SPI 454 IRQ_TYPE_LEVEL_HIGH>,
213+ <GIC_SPI 455 IRQ_TYPE_LEVEL_HIGH>,
214+ <GIC_SPI 456 IRQ_TYPE_LEVEL_HIGH>,
215+ <GIC_SPI 457 IRQ_TYPE_LEVEL_HIGH>,
216+ <GIC_SPI 458 IRQ_TYPE_LEVEL_HIGH>,
217+ <GIC_SPI 459 IRQ_TYPE_LEVEL_HIGH>,
218+ <GIC_SPI 460 IRQ_TYPE_LEVEL_HIGH>,
219+ <GIC_SPI 461 IRQ_TYPE_LEVEL_HIGH>,
220+ <GIC_SPI 462 IRQ_TYPE_LEVEL_HIGH>,
221+ <GIC_SPI 463 IRQ_TYPE_LEVEL_HIGH>,
222+ <GIC_SPI 464 IRQ_TYPE_LEVEL_HIGH>,
223+ <GIC_SPI 465 IRQ_TYPE_LEVEL_HIGH>,
224+ <GIC_SPI 466 IRQ_TYPE_LEVEL_HIGH>,
225+ <GIC_SPI 467 IRQ_TYPE_LEVEL_HIGH>,
226+ <GIC_SPI 468 IRQ_TYPE_LEVEL_HIGH>,
227+ <GIC_SPI 469 IRQ_TYPE_LEVEL_HIGH>,
228+ <GIC_SPI 470 IRQ_TYPE_LEVEL_HIGH>,
229+ <GIC_SPI 471 IRQ_TYPE_LEVEL_HIGH>,
230+ <GIC_SPI 472 IRQ_TYPE_LEVEL_HIGH>,
231+ <GIC_SPI 473 IRQ_TYPE_LEVEL_HIGH>,
232+ <GIC_SPI 474 IRQ_TYPE_LEVEL_HIGH>,
233+ <GIC_SPI 475 IRQ_TYPE_LEVEL_HIGH>;
234+ interrupt-names = "nmi",
235+ "irq0", "irq1", "irq2", "irq3",
236+ "irq4", "irq5", "irq6", "irq7",
237+ "tint0", "tint1", "tint2", "tint3",
238+ "tint4", "tint5", "tint6", "tint7",
239+ "tint8", "tint9", "tint10", "tint11",
240+ "tint12", "tint13", "tint14", "tint15",
241+ "tint16", "tint17", "tint18", "tint19",
242+ "tint20", "tint21", "tint22", "tint23",
243+ "tint24", "tint25", "tint26", "tint27",
244+ "tint28", "tint29", "tint30", "tint31";
245+ clocks = <&cpg CPG_MOD R9A07G044_IA55_CLK>,
246+ <&cpg CPG_MOD R9A07G044_IA55_PCLK>;
247+ clock-names = "clk", "pclk";
248+ power-domains = <&cpg>;
249+ resets = <&cpg R9A07G044_IA55_RESETN>;
134250 };
Documentation/devicetree/bindings/iommu/arm,smmu.yaml+1−1
@@ -270,6 +270,7 @@ allOf: · 269 unmodified lines
270270 contains:
271271 enum:
272272 - qcom,msm8998-smmu-v2
273+ - qcom,sdm630-smmu-v2
273274 then:
274275 anyOf:
275276 - properties:
@@ -311,7 +312,6 @@ allOf: · 35 unmodified lines
311312 compatible:
312313 contains:
313314 enum:
314− - qcom,sdm630-smmu-v2
315315 - qcom,sm6375-smmu-v2
316316 then:
317317 anyOf:
Documentation/devicetree/bindings/media/i2c/sony,imx415.yaml+1−0
@@ -54,6 +54,7 @@ properties: · 53 unmodified lines
5454
5555 port:
5656 $ref: /schemas/graph.yaml#/$defs/port-base
57+ unevaluatedProperties: false
5758
5859 properties:
5960 endpoint:
Documentation/devicetree/bindings/media/i2c/toshiba,tc358746.yaml+2−0
@@ -69,6 +69,7 @@ properties: · 68 unmodified lines
6969 properties:
7070 port@0:
7171 $ref: /schemas/graph.yaml#/$defs/port-base
72+ unevaluatedProperties: false
7273 description: Input port
7374
7475 properties:
@@ -89,6 +90,7 @@ properties: · 14 unmodified lines
8990
9091 port@1:
9192 $ref: /schemas/graph.yaml#/$defs/port-base
93+ unevaluatedProperties: false
9294 description: Output port
9395
9496 properties:
Documentation/devicetree/bindings/media/nxp,imx7-csi.yaml+0−1
@@ -59,7 +59,6 @@ allOf: · 58 unmodified lines
5959 compatible:
6060 contains:
6161 enum:
62− - fsl,imx8mq-csi
6362 - fsl,imx8mm-csi
6463 then:
6564 required:
Documentation/devicetree/bindings/media/renesas,vin.yaml+2−2
@@ -95,7 +95,7 @@ properties: · 94 unmodified lines
9595 synchronization is selected.
9696 default: 1
9797
98− field-active-even: true
98+ field-even-active: true
9999
100100 bus-width: true
101101
@@ -144,7 +144,7 @@ properties: · 42 unmodified lines
144144 synchronization is selected.
145145 default: 1
146146
147− field-active-even: true
147+ field-even-active: true
148148
149149 bus-width: true
150150
Documentation/devicetree/bindings/media/samsung,fimc.yaml+1−0
@@ -57,6 +57,7 @@ properties: · 56 unmodified lines
5757 patternProperties:
5858 "^port@[01]$":
5959 $ref: /schemas/graph.yaml#/$defs/port-base
60+ unevaluatedProperties: false
6061 description:
6162 Camera A and camera B inputs.
6263
Documentation/devicetree/bindings/mfd/maxim,max77693.yaml+0−4
@@ -31,10 +31,6 @@ properties: · 30 unmodified lines
3131 charger:
3232 $ref: /schemas/power/supply/maxim,max77693.yaml
3333
34− connector:
35− $ref: /schemas/connector/usb-connector.yaml#
36− unevaluatedProperties: false
37−
3834 led:
3935 $ref: /schemas/leds/maxim,max77693.yaml
4036
Documentation/devicetree/bindings/pci/brcm,iproc-pcie.yaml+76−87
@@ -12,7 +12,6 @@ maintainers: · 11 unmodified lines
1212
1313 allOf:
1414 - $ref: /schemas/pci/pci-bus.yaml#
15− - $ref: /schemas/interrupt-controller/msi-controller.yaml#
1615
1716 properties:
1817 compatible:
@@ -34,13 +33,6 @@ properties: · 15 unmodified lines
3433 description: >
3534 Base address and length of the PCIe controller I/O register space
3635
37− interrupt-map: true
38−
39− interrupt-map-mask: true
40−
41− "#interrupt-cells":
42− const: 1
43−
4436 ranges:
4537 minItems: 1
4638 maxItems: 2
@@ -54,16 +46,8 @@ properties: · 7 unmodified lines
5446 items:
5547 - const: pcie-phy
5648
57− bus-range: true
58−
5949 dma-coherent: true
6050
61− "#address-cells": true
62−
63− "#size-cells": true
64−
65− device_type: true
66−
6751 brcm,pcie-ob:
6852 type: boolean
6953 description: >
@@ -78,20 +62,24 @@ properties: · 8 unmodified lines
7862
7963 msi:
8064 type: object
65+ $ref: /schemas/interrupt-controller/msi-controller.yaml#
66+ unevaluatedProperties: false
67+
8168 properties:
8269 compatible:
8370 items:
8471 - const: brcm,iproc-msi
8572
86− msi-parent: true
73+ interrupts:
74+ maxItems: 4
8775
88− msi-controller: true
76+ brcm,pcie-msi-inten:
77+ type: boolean
78+ description:
79+ Needs to be present for some older iProc platforms that require the
80+ interrupt enable registers to be set explicitly to enable MSI
8981
90− brcm,pcie-msi-inten:
91− type: boolean
92− description: >
93− Needs to be present for some older iProc platforms that require the
94− interrupt enable registers to be set explicitly to enable MSI
82+ msi-parent: true
9583
9684 dependencies:
9785 brcm,pcie-ob-axi-offset: ["brcm,pcie-ob"]
@@ -117,68 +105,69 @@ unevaluatedProperties: false · 19 unmodified lines
117105
118106 examples:
119107 - |
120− #include <dt-bindings/interrupt-controller/arm-gic.h>
121−
122− bus {
123− #address-cells = <1>;
124− #size-cells = <1>;
125− pcie0: pcie@18012000 {
126− compatible = "brcm,iproc-pcie";
127− reg = <0x18012000 0x1000>;
128−
129− #interrupt-cells = <1>;
130− interrupt-map-mask = <0 0 0 0>;
131− interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_NONE>;
132−
133− linux,pci-domain = <0>;
134−
135− bus-range = <0x00 0xff>;
136−
137− #address-cells = <3>;
138− #size-cells = <2>;
139− device_type = "pci";
140− ranges = <0x81000000 0 0 0x28000000 0 0x00010000>,
141− <0x82000000 0 0x20000000 0x20000000 0 0x04000000>;
142−
143− phys = <&phy 0 5>;
144− phy-names = "pcie-phy";
145−
146− brcm,pcie-ob;
147− brcm,pcie-ob-axi-offset = <0x00000000>;
148−
149− msi-parent = <&msi0>;
150−
151− /* iProc event queue based MSI */
152− msi0: msi {
153− compatible = "brcm,iproc-msi";
154− msi-controller;
155− interrupt-parent = <&gic>;
156− interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>,
157− <GIC_SPI 97 IRQ_TYPE_NONE>,
158− <GIC_SPI 98 IRQ_TYPE_NONE>,
159− <GIC_SPI 99 IRQ_TYPE_NONE>;
160− };
161− };
162−
163− pcie1: pcie@18013000 {
164− compatible = "brcm,iproc-pcie";
165− reg = <0x18013000 0x1000>;
166−
167− #interrupt-cells = <1>;
168− interrupt-map-mask = <0 0 0 0>;
169− interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_NONE>;
170−
171− linux,pci-domain = <1>;
172−
173− bus-range = <0x00 0xff>;
174−
175− #address-cells = <3>;
176− #size-cells = <2>;
177− device_type = "pci";
178− ranges = <0x81000000 0 0 0x48000000 0 0x00010000>,
179− <0x82000000 0 0x40000000 0x40000000 0 0x04000000>;
180−
181− phys = <&phy 1 6>;
182− phy-names = "pcie-phy";
183− };
108+ #include <dt-bindings/interrupt-controller/arm-gic.h>
109+
110+ gic: interrupt-controller {
111+ interrupt-controller;
112+ #interrupt-cells = <3>;
113+ };
114+
115+ pcie@18012000 {
116+ compatible = "brcm,iproc-pcie";
117+ reg = <0x18012000 0x1000>;
118+
119+ #interrupt-cells = <1>;
120+ interrupt-map-mask = <0 0 0 0>;
121+ interrupt-map = <0 0 0 0 &gic GIC_SPI 100 IRQ_TYPE_NONE>;
122+
123+ linux,pci-domain = <0>;
124+
125+ bus-range = <0x00 0xff>;
126+
127+ #address-cells = <3>;
128+ #size-cells = <2>;
129+ device_type = "pci";
130+ ranges = <0x81000000 0 0 0x28000000 0 0x00010000>,
131+ <0x82000000 0 0x20000000 0x20000000 0 0x04000000>;
132+
133+ phys = <&phy 0 5>;
134+ phy-names = "pcie-phy";
135+
136+ brcm,pcie-ob;
137+ brcm,pcie-ob-axi-offset = <0x00000000>;
138+
139+ msi-parent = <&msi0>;
140+
141+ /* iProc event queue based MSI */
142+ msi0: msi {
143+ compatible = "brcm,iproc-msi";
144+ msi-controller;
145+ interrupt-parent = <&gic>;
146+ interrupts = <GIC_SPI 96 IRQ_TYPE_NONE>,
147+ <GIC_SPI 97 IRQ_TYPE_NONE>,
148+ <GIC_SPI 98 IRQ_TYPE_NONE>,
149+ <GIC_SPI 99 IRQ_TYPE_NONE>;
150+ };
151+ };
152+ - |
153+ pcie@18013000 {
154+ compatible = "brcm,iproc-pcie";
155+ reg = <0x18013000 0x1000>;
156+
157+ #interrupt-cells = <1>;
158+ interrupt-map-mask = <0 0 0 0>;
159+ interrupt-map = <0 0 0 0 &gic GIC_SPI 106 IRQ_TYPE_NONE>;
160+
161+ linux,pci-domain = <1>;
162+
163+ bus-range = <0x00 0xff>;
164+
165+ #address-cells = <3>;
166+ #size-cells = <2>;
167+ device_type = "pci";
168+ ranges = <0x81000000 0 0 0x48000000 0 0x00010000>,
169+ <0x82000000 0 0x40000000 0x40000000 0 0x04000000>;
170+
171+ phys = <&phy 1 6>;
172+ phy-names = "pcie-phy";
184173 };
Documentation/devicetree/bindings/riscv/cpus.yaml+1−0
@@ -91,6 +91,7 @@ properties: · 90 unmodified lines
9191
9292 interrupt-controller:
9393 type: object
94+ additionalProperties: false
9495 description: Describes the CPU's local interrupt controller
9596
9697 properties:
Documentation/devicetree/bindings/sound/fsl,micfil.yaml+3−0
@@ -56,6 +56,9 @@ properties: · 55 unmodified lines
5656 - const: clkext3
5757 minItems: 2
5858
59+ "#sound-dai-cells":
60+ const: 0
61+
5962 required:
6063 - compatible
6164 - reg
Documentation/devicetree/bindings/sound/rockchip-spdif.yaml+1−0
@@ -26,6 +26,7 @@ properties: · 25 unmodified lines
2626 - const: rockchip,rk3568-spdif
2727 - items:
2828 - enum:
29+ - rockchip,rk3128-spdif
2930 - rockchip,rk3188-spdif
3031 - rockchip,rk3288-spdif
3132 - rockchip,rk3308-spdif
Documentation/devicetree/bindings/trivial-devices.yaml+1−1
@@ -232,7 +232,7 @@ properties: · 231 unmodified lines
232232 # MEMSIC magnetometer
233233 - memsic,mmc35240
234234 # MEMSIC 3-axis accelerometer
235− - memsic,mx4005
235+ - memsic,mxc4005
236236 # MEMSIC 2-axis 8-bit digital accelerometer
237237 - memsic,mxc6225
238238 # MEMSIC 2-axis 8-bit digital accelerometer
Documentation/filesystems/erofs.rst+37−3
@@ -58,12 +58,14 @@ Here are the main features of EROFS: · 57 unmodified lines
5858
5959 - Support extended attributes as an option;
6060
61+ - Support a bloom filter that speeds up negative extended attribute lookups;
62+
6163 - Support POSIX.1e ACLs by using extended attributes;
6264
6365 - Support transparent data compression as an option:
64− LZ4 and MicroLZMA algorithms can be used on a per-file basis; In addition,
65− inplace decompression is also supported to avoid bounce compressed buffers
66− and page cache thrashing.
66+ LZ4, MicroLZMA and DEFLATE algorithms can be used on a per-file basis; In
67+ addition, inplace decompression is also supported to avoid bounce compressed
68+ buffers and unnecessary page cache thrashing.
6769
6870 - Support chunk-based data deduplication and rolling-hash compressed data
6971 deduplication;
@@ -268,6 +270,38 @@ details.) · 198 unmodified lines
268270
269271 By the way, chunk-based files are all uncompressed for now.
270272
273+Long extended attribute name prefixes
274+-------------------------------------
275+There are use cases where extended attributes with different values can have
276+only a few common prefixes (such as overlayfs xattrs). The predefined prefixes
277+work inefficiently in both image size and runtime performance in such cases.
278+
279+The long xattr name prefixes feature is introduced to address this issue. The
280+overall idea is that, apart from the existing predefined prefixes, the xattr
281+entry could also refer to user-specified long xattr name prefixes, e.g.
282+"trusted.overlay.".
283+
284+When referring to a long xattr name prefix, the highest bit (bit 7) of
285+erofs_xattr_entry.e_name_index is set, while the lower bits (bit 0-6) as a whole
286+represent the index of the referred long name prefix among all long name
287+prefixes. Therefore, only the trailing part of the name apart from the long
288+xattr name prefix is stored in erofs_xattr_entry.e_name, which could be empty if
289+the full xattr name matches exactly as its long xattr name prefix.
290+
291+All long xattr prefixes are stored one by one in the packed inode as long as
292+the packed inode is valid, or in the meta inode otherwise. The
293+xattr_prefix_count (of the on-disk superblock) indicates the total number of
294+long xattr name prefixes, while (xattr_prefix_start * 4) indicates the start
295+offset of long name prefixes in the packed/meta inode. Note that, long extended
296+attribute name prefixes are disabled if xattr_prefix_count is 0.
297+
298+Each long name prefix is stored in the format: ALIGN({__le16 len, data}, 4),
299+where len represents the total size of the data part. The data part is actually
300+represented by 'struct erofs_xattr_long_prefix', where base_index represents the
301+index of the predefined xattr name prefix, e.g. EROFS_XATTR_INDEX_TRUSTED for
302+"trusted.overlay." long name prefix, while the infix string keeps the string
303+after stripping the short prefix, e.g. "overlay." for the example above.
304+
271305 Data compression
272306 ----------------
273307 EROFS implements fixed-sized output compression which generates fixed-sized
Documentation/filesystems/overlayfs.rst+12−0
@@ -339,6 +339,18 @@ The specified lower directories will be stacked beginning from the · 338 unmodified lines
339339 rightmost one and going left. In the above example lower1 will be the
340340 top, lower2 the middle and lower3 the bottom layer.
341341
342+Note: directory names containing colons can be provided as lower layer by
343+escaping the colons with a single backslash. For example:
344+
345+ mount -t overlay overlay -olowerdir=/a\:lower\:\:dir /merged
346+
347+Since kernel version v6.5, directory names containing colons can also
348+be provided as lower layer using the fsconfig syscall from new mount api:
349+
350+ fsconfig(fs_fd, FSCONFIG_SET_STRING, "lowerdir", "/a:lower::dir", 0);
351+
352+In the latter case, colons in lower layer directory names will be escaped
353+as an octal characters (\072) when displayed in /proc/self/mountinfo.
342354
343355 Metadata only copy up
344356 ---------------------
Documentation/process/embargoed-hardware-issues.rst+12−7
@@ -25,15 +25,15 @@ Contact · 24 unmodified lines
2525 The Linux kernel hardware security team is separate from the regular Linux
2626 kernel security team.
2727
28−The team only handles the coordination of embargoed hardware security
29−issues. Reports of pure software security bugs in the Linux kernel are not
28+The team only handles developing fixes for embargoed hardware security
29+issues. Reports of pure software security bugs in the Linux kernel are not
3030 handled by this team and the reporter will be guided to contact the regular
3131 Linux kernel security team (:ref:`Documentation/admin-guide/
3232 <securitybugs>`) instead.
3333
3434 The team can be contacted by email at <hardware-security@kernel.org>. This
35−is a private list of security officers who will help you to coordinate an
36−issue according to our documented process.
35+is a private list of security officers who will help you to coordinate a
36+fix according to our documented process.
3737
3838 The list is encrypted and email to the list can be sent by either PGP or
3939 S/MIME encrypted and must be signed with the reporter's PGP key or S/MIME
@@ -132,11 +132,11 @@ other hardware could be affected. · 92 unmodified lines
132132
133133 The hardware security team will provide an incident-specific encrypted
134134 mailing-list which will be used for initial discussion with the reporter,
135−further disclosure and coordination.
135+further disclosure, and coordination of fixes.
136136
137137 The hardware security team will provide the disclosing party a list of
138138 developers (domain experts) who should be informed initially about the
139−issue after confirming with the developers that they will adhere to this
139+issue after confirming with the developers that they will adhere to this
140140 Memorandum of Understanding and the documented process. These developers
141141 form the initial response team and will be responsible for handling the
142142 issue after initial contact. The hardware security team is supporting the
@@ -209,13 +209,18 @@ five work days this is taken as silent acknowledgement. · 66 unmodified lines
209209 After acknowledgement or resolution of an objection the expert is disclosed
210210 by the incident team and brought into the development process.
211211
212+List participants may not communicate about the issue outside of the
213+private mailing list. List participants may not use any shared resources
214+(e.g. employer build farms, CI systems, etc) when working on patches.
215+
212216
213217 Coordinated release
214218 """""""""""""""""""
215219
216220 The involved parties will negotiate the date and time where the embargo
217221 ends. At that point the prepared mitigations are integrated into the
218−relevant kernel trees and published.
222+relevant kernel trees and published. There is no pre-notification process:
223+fixes are published in public and available to everyone at the same time.
219224
220225 While we understand that hardware security issues need coordinated embargo
221226 time, the embargo time should be constrained to the minimum time which is
Documentation/tools/rtla/rtla-timerlat-hist.rst+2−2
@@ -36,11 +36,11 @@ EXAMPLE · 35 unmodified lines
3636 In the example below, **rtla timerlat hist** is set to run for *10* minutes,
3737 in the cpus *0-4*, *skipping zero* only lines. Moreover, **rtla timerlat
3838 hist** will change the priority of the *timerlat* threads to run under
39−*SCHED_DEADLINE* priority, with a *10us* runtime every *1ms* period. The
39+*SCHED_DEADLINE* priority, with a *100us* runtime every *1ms* period. The
4040 *1ms* period is also passed to the *timerlat* tracer. Auto-analysis is disabled
4141 to reduce overhead ::
4242
43− [root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1ms --no-aa
43+ [root@alien ~]# timerlat hist -d 10m -c 0-4 -P d:100us:1ms -p 1000 --no-aa
4444 # RTLA timerlat histogram
4545 # Time unit is microseconds (us)
4646 # Duration: 0 00:10:00
Documentation/translations/zh_CN/core-api/workqueue.rst+1−1
@@ -202,7 +202,7 @@ workqueue将自动创建与属性相匹配的后备工作者池。调节并发 · 201 unmodified lines
202202 同的排序属性。
203203
204204 在目前的实现中,上述配置只保证了特定NUMA节点内的ST行为。相反,
205−``alloc_ordered_queue()`` 应该被用来实现全系统的ST行为。
205+``alloc_ordered_workqueue()`` 应该被用来实现全系统的ST行为。
206206
207207
208208 执行场景示例
MAINTAINERS+27−33
@@ -470,7 +470,6 @@ F: drivers/hwmon/adm1029.c · 469 unmodified lines
470470 ADM8211 WIRELESS DRIVER
471471 L: linux-wireless@vger.kernel.org
472472 S: Orphan
473−W: https://wireless.wiki.kernel.org/
474473 F: drivers/net/wireless/admtek/adm8211.*
475474
476475 ADP1653 FLASH CONTROLLER DRIVER
@@ -1585,6 +1584,17 @@ F: arch/arm/include/asm/arch_timer.h · 1108 unmodified lines
15851584 F: arch/arm64/include/asm/arch_timer.h
15861585 F: drivers/clocksource/arm_arch_timer.c
15871586
1587+ARM GENERIC INTERRUPT CONTROLLER DRIVERS
1588+M: Marc Zyngier <maz@kernel.org>
1589+L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1590+S: Maintained
1591+F: Documentation/devicetree/bindings/interrupt-controller/arm,gic*
1592+F: arch/arm/include/asm/arch_gicv3.h
1593+F: arch/arm64/include/asm/arch_gicv3.h
1594+F: drivers/irqchip/irq-gic*.[ch]
1595+F: include/linux/irqchip/arm-gic*.h
1596+F: include/linux/irqchip/arm-vgic-info.h
1597+
15881598 ARM HDLCD DRM DRIVER
15891599 M: Liviu Dudau <liviu.dudau@arm.com>
15901600 S: Supported
@@ -2211,21 +2221,28 @@ F: arch/arm/boot/dts/ti/omap/omap3-igep* · 620 unmodified lines
22112221 ARM/INTEL IXP4XX ARM ARCHITECTURE
22122222 M: Linus Walleij <linusw@kernel.org>
22132223 M: Imre Kaloz <kaloz@openwrt.org>
2214−M: Krzysztof Halasa <khalasa@piap.pl>
22152224 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
22162225 S: Maintained
22172226 F: Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
22182227 F: Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt
22192228 F: Documentation/devicetree/bindings/interrupt-controller/intel,ixp4xx-interrupt.yaml
22202229 F: Documentation/devicetree/bindings/memory-controllers/intel,ixp4xx-expansion*
2230+F: Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml
22212231 F: Documentation/devicetree/bindings/timer/intel,ixp4xx-timer.yaml
22222232 F: arch/arm/boot/dts/intel/ixp/
22232233 F: arch/arm/mach-ixp4xx/
22242234 F: drivers/bus/intel-ixp4xx-eb.c
2235+F: drivers/char/hw_random/ixp4xx-rng.c
22252236 F: drivers/clocksource/timer-ixp4xx.c
22262237 F: drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
22272238 F: drivers/gpio/gpio-ixp4xx.c
22282239 F: drivers/irqchip/irq-ixp4xx.c
2240+F: drivers/net/ethernet/xscale/ixp4xx_eth.c
2241+F: drivers/net/wan/ixp4xx_hss.c
2242+F: drivers/soc/ixp4xx/ixp4xx-npe.c
2243+F: drivers/soc/ixp4xx/ixp4xx-qmgr.c
2244+F: include/linux/soc/ixp4xx/npe.h
2245+F: include/linux/soc/ixp4xx/qmgr.h
22292246
22302247 ARM/INTEL KEEMBAY ARCHITECTURE
22312248 M: Paul J. Murphy <paul.j.murphy@intel.com>
@@ -2327,7 +2344,7 @@ F: drivers/rtc/rtc-mt7622.c · 95 unmodified lines
23272344
23282345 ARM/Mediatek SoC support
23292346 M: Matthias Brugger <matthias.bgg@gmail.com>
2330−R: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
2347+M: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
23312348 L: linux-kernel@vger.kernel.org
23322349 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
23332350 L: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
@@ -5985,8 +6002,8 @@ F: include/linux/devm-helpers.h · 3651 unmodified lines
59856002 DEVICE-MAPPER (LVM)
59866003 M: Alasdair Kergon <agk@redhat.com>
59876004 M: Mike Snitzer <snitzer@kernel.org>
5988−M: dm-devel@redhat.com
5989−L: dm-devel@redhat.com
6005+M: dm-devel@lists.linux.dev
6006+L: dm-devel@lists.linux.dev
59906007 S: Maintained
59916008 W: http://sources.redhat.com/dm
59926009 Q: http://patchwork.kernel.org/project/dm-devel/list/
@@ -8093,7 +8110,7 @@ F: include/linux/arm_ffa.h · 2100 unmodified lines
80938110
80948111 FIRMWARE LOADER (request_firmware)
80958112 M: Luis Chamberlain <mcgrof@kernel.org>
8096−M: Russ Weight <russell.h.weight@intel.com>
8113+M: Russ Weight <russ.weight@linux.dev>
80978114 L: linux-kernel@vger.kernel.org
80988115 S: Maintained
80998116 F: Documentation/firmware_class/
@@ -9531,10 +9548,8 @@ F: Documentation/devicetree/bindings/iio/pressure/honeywell,mprls0025pa.yaml · 1431 unmodified lines
95319548 F: drivers/iio/pressure/mprls0025pa.c
95329549
95339550 HOST AP DRIVER
9534−M: Jouni Malinen <j@w1.fi>
95359551 L: linux-wireless@vger.kernel.org
95369552 S: Obsolete
9537−W: http://w1.fi/hostap-driver.html
95389553 F: drivers/net/wireless/intersil/hostap/
95399554
95409555 HP BIOSCFG DRIVER
@@ -10622,22 +10637,6 @@ L: linux-crypto@vger.kernel.org · 1081 unmodified lines
1062210637 S: Maintained
1062310638 F: drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
1062410639
10625−INTEL IXP4XX QMGR, NPE, ETHERNET and HSS SUPPORT
10626−M: Krzysztof Halasa <khalasa@piap.pl>
10627−S: Maintained
10628−F: drivers/net/ethernet/xscale/ixp4xx_eth.c
10629−F: drivers/net/wan/ixp4xx_hss.c
10630−F: drivers/soc/ixp4xx/ixp4xx-npe.c
10631−F: drivers/soc/ixp4xx/ixp4xx-qmgr.c
10632−F: include/linux/soc/ixp4xx/npe.h
10633−F: include/linux/soc/ixp4xx/qmgr.h
10634−
10635−INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT
10636−M: Deepak Saxena <dsaxena@plexity.net>
10637−S: Maintained
10638−F: Documentation/devicetree/bindings/rng/intel,ixp46x-rng.yaml
10639−F: drivers/char/hw_random/ixp4xx-rng.c
10640−
1064110640 INTEL KEEM BAY DRM DRIVER
1064210641 M: Anitha Chrisanthus <anitha.chrisanthus@intel.com>
1064310642 M: Edmund Dea <edmund.j.dea@intel.com>
@@ -11063,7 +11062,7 @@ F: Documentation/devicetree/bindings/sound/irondevice,* · 419 unmodified lines
1106311062 F: sound/soc/codecs/sma*
1106411063
1106511064 IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
11066−M: Marc Zyngier <maz@kernel.org>
11065+M: Thomas Gleixner <tglx@linutronix.de>
1106711066 S: Maintained
1106811067 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
1106911068 F: Documentation/core-api/irq/irq-domain.rst
@@ -11082,7 +11081,6 @@ F: lib/group_cpus.c · 12 unmodified lines
1108211081
1108311082 IRQCHIP DRIVERS
1108411083 M: Thomas Gleixner <tglx@linutronix.de>
11085−M: Marc Zyngier <maz@kernel.org>
1108611084 L: linux-kernel@vger.kernel.org
1108711085 S: Maintained
1108811086 T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
@@ -14947,7 +14945,7 @@ K: macsec · 3858 unmodified lines
1494714945 K: \bmdo_
1494814946
1494914947 NETWORKING [MPTCP]
14950−M: Matthieu Baerts <matthieu.baerts@tessares.net>
14948+M: Matthieu Baerts <matttbe@kernel.org>
1495114949 M: Mat Martineau <martineau@kernel.org>
1495214950 L: netdev@vger.kernel.org
1495314951 L: mptcp@lists.linux.dev
@@ -17602,6 +17600,7 @@ M: Kalle Valo <kvalo@kernel.org> · 2648 unmodified lines
1760217600 M: Jeff Johnson <quic_jjohnson@quicinc.com>
1760317601 L: ath12k@lists.infradead.org
1760417602 S: Supported
17603+W: https://wireless.wiki.kernel.org/en/users/Drivers/ath12k
1760517604 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
1760617605 F: drivers/net/wireless/ath/ath12k/
1760717606
@@ -18132,8 +18131,6 @@ REALTEK WIRELESS DRIVER (rtlwifi family) · 524 unmodified lines
1813218131 M: Ping-Ke Shih <pkshih@realtek.com>
1813318132 L: linux-wireless@vger.kernel.org
1813418133 S: Maintained
18135−W: https://wireless.wiki.kernel.org/
18136−T: git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-testing.git
1813718134 F: drivers/net/wireless/realtek/rtlwifi/
1813818135
1813918136 REALTEK WIRELESS DRIVER (rtw88)
@@ -18661,7 +18658,6 @@ F: drivers/media/dvb-frontends/rtl2832_sdr* · 521 unmodified lines
1866118658 RTL8180 WIRELESS DRIVER
1866218659 L: linux-wireless@vger.kernel.org
1866318660 S: Orphan
18664−W: https://wireless.wiki.kernel.org/
1866518661 F: drivers/net/wireless/realtek/rtl818x/rtl8180/
1866618662
1866718663 RTL8187 WIRELESS DRIVER
@@ -18669,14 +18665,12 @@ M: Hin-Tak Leung <hintak.leung@gmail.com> · 1 unmodified line
1866918665 M: Larry Finger <Larry.Finger@lwfinger.net>
1867018666 L: linux-wireless@vger.kernel.org
1867118667 S: Maintained
18672−W: https://wireless.wiki.kernel.org/
1867318668 F: drivers/net/wireless/realtek/rtl818x/rtl8187/
1867418669
1867518670 RTL8XXXU WIRELESS DRIVER (rtl8xxxu)
1867618671 M: Jes Sorensen <Jes.Sorensen@gmail.com>
1867718672 L: linux-wireless@vger.kernel.org
1867818673 S: Maintained
18679−T: git git://git.kernel.org/pub/scm/linux/kernel/git/jes/linux.git rtl8xxxu-devel
1868018674 F: drivers/net/wireless/realtek/rtl8xxxu/
1868118675
1868218676 RTRS TRANSPORT DRIVERS
@@ -20490,6 +20484,7 @@ F: include/dt-bindings/clock/starfive?jh71*.h · 1807 unmodified lines
2049020484 STARFIVE JH71X0 PINCTRL DRIVERS
2049120485 M: Emil Renner Berthing <kernel@esmil.dk>
2049220486 M: Jianlong Huang <jianlong.huang@starfivetech.com>
20487+M: Hal Feng <hal.feng@starfivetech.com>
2049320488 L: linux-gpio@vger.kernel.org
2049420489 S: Maintained
2049520490 F: Documentation/devicetree/bindings/pinctrl/starfive,jh71*.yaml
@@ -21658,7 +21653,6 @@ L: linux-wireless@vger.kernel.org · 1162 unmodified lines
2165821653 S: Orphan
2165921654 W: https://wireless.wiki.kernel.org/en/users/Drivers/wl12xx
2166021655 W: https://wireless.wiki.kernel.org/en/users/Drivers/wl1251
21661−T: git git://git.kernel.org/pub/scm/linux/kernel/git/luca/wl12xx.git
2166221656 F: drivers/net/wireless/ti/
2166321657
2166421658 TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 6
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc4
5+EXTRAVERSION = -rc6
66 NAME = Hurr durr I'ma ninja sloth
77
88 # *DOCUMENTATION*
arch/arm64/Kconfig+13−0
@@ -1037,6 +1037,19 @@ config ARM64_ERRATUM_2645198 · 1036 unmodified lines
10371037
10381038 If unsure, say Y.
10391039
1040+config ARM64_ERRATUM_2966298
1041+ bool "Cortex-A520: 2966298: workaround for speculatively executed unprivileged load"
1042+ default y
1043+ help
1044+ This option adds the workaround for ARM Cortex-A520 erratum 2966298.
1045+
1046+ On an affected Cortex-A520 core, a speculatively executed unprivileged
1047+ load might leak data from a privileged level via a cache side channel.
1048+
1049+ Work around this problem by executing a TLBI before returning to EL0.
1050+
1051+ If unsure, say Y.
1052+
10401053 config CAVIUM_ERRATUM_22375
10411054 bool "Cavium erratum 22375, 24313"
10421055 default y
arch/arm64/boot/dts/freescale/imx93.dtsi+3−1
@@ -185,7 +185,7 @@ · 184 unmodified lines
185185 #size-cells = <1>;
186186 ranges;
187187
188− anomix_ns_gpr: syscon@44210000 {
188+ aonmix_ns_gpr: syscon@44210000 {
189189 compatible = "fsl,imx93-aonmix-ns-syscfg", "syscon";
190190 reg = <0x44210000 0x1000>;
191191 };
@@ -319,6 +319,7 @@ · 127 unmodified lines
319319 assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>;
320320 assigned-clock-rates = <40000000>;
321321 fsl,clk-source = /bits/ 8 <0>;
322+ fsl,stop-mode = <&aonmix_ns_gpr 0x14 0>;
322323 status = "disabled";
323324 };
324325
@@ -591,6 +592,7 @@ · 266 unmodified lines
591592 assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>;
592593 assigned-clock-rates = <40000000>;
593594 fsl,clk-source = /bits/ 8 <0>;
595+ fsl,stop-mode = <&wakeupmix_gpr 0x0c 2>;
594596 status = "disabled";
595597 };
596598
arch/arm64/boot/dts/mediatek/mt7622.dtsi+1−1
@@ -905,7 +905,7 @@ · 904 unmodified lines
905905 status = "disabled";
906906 };
907907
908− sata_phy: t-phy@1a243000 {
908+ sata_phy: t-phy {
909909 compatible = "mediatek,mt7622-tphy",
910910 "mediatek,generic-tphy-v1";
911911 #address-cells = <2>;
arch/arm64/boot/dts/mediatek/mt7986a.dtsi+1−1
@@ -434,7 +434,7 @@ · 433 unmodified lines
434434 };
435435 };
436436
437− pcie_phy: t-phy@11c00000 {
437+ pcie_phy: t-phy {
438438 compatible = "mediatek,mt7986-tphy",
439439 "mediatek,generic-tphy-v2";
440440 #address-cells = <2>;
arch/arm64/boot/dts/mediatek/mt8195-demo.dts+31−8
@@ -48,7 +48,7 @@ · 47 unmodified lines
4848
4949 memory@40000000 {
5050 device_type = "memory";
51− reg = <0 0x40000000 0 0x80000000>;
51+ reg = <0 0x40000000 0x2 0x00000000>;
5252 };
5353
5454 reserved-memory {
@@ -56,13 +56,8 @@ · 1 unmodified line
5656 #size-cells = <2>;
5757 ranges;
5858
59− /* 2 MiB reserved for ARM Trusted Firmware (BL31) */
60− bl31_secmon_reserved: secmon@54600000 {
61− no-map;
62− reg = <0 0x54600000 0x0 0x200000>;
63− };
64−
65− /* 12 MiB reserved for OP-TEE (BL32)
59+ /*
60+ * 12 MiB reserved for OP-TEE (BL32)
6661 * +-----------------------+ 0x43e0_0000
6762 * | SHMEM 2MiB |
6863 * +-----------------------+ 0x43c0_0000
@@ -75,6 +70,34 @@ · 6 unmodified lines
7570 no-map;
7671 reg = <0 0x43200000 0 0x00c00000>;
7772 };
73+
74+ scp_mem: memory@50000000 {
75+ compatible = "shared-dma-pool";
76+ reg = <0 0x50000000 0 0x2900000>;
77+ no-map;
78+ };
79+
80+ vpu_mem: memory@53000000 {
81+ compatible = "shared-dma-pool";
82+ reg = <0 0x53000000 0 0x1400000>; /* 20 MB */
83+ };
84+
85+ /* 2 MiB reserved for ARM Trusted Firmware (BL31) */
86+ bl31_secmon_mem: memory@54600000 {
87+ no-map;
88+ reg = <0 0x54600000 0x0 0x200000>;
89+ };
90+
91+ snd_dma_mem: memory@60000000 {
92+ compatible = "shared-dma-pool";
93+ reg = <0 0x60000000 0 0x1100000>;
94+ no-map;
95+ };
96+
97+ apu_mem: memory@62000000 {
98+ compatible = "shared-dma-pool";
99+ reg = <0 0x62000000 0 0x1400000>; /* 20 MB */
100+ };
78101 };
79102 };
80103
arch/arm64/boot/dts/mediatek/mt8195.dtsi+1−0
@@ -313,6 +313,7 @@ · 312 unmodified lines
313313 interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH 0>;
314314 cpus = <&cpu0>, <&cpu1>, <&cpu2>, <&cpu3>,
315315 <&cpu4>, <&cpu5>, <&cpu6>, <&cpu7>;
316+ status = "fail";
316317 };
317318
318319 dmic_codec: dmic-codec {
arch/arm64/boot/dts/qcom/sm8150.dtsi+1−1
@@ -3958,7 +3958,7 @@ · 3957 unmodified lines
39583958
39593959 pdc: interrupt-controller@b220000 {
39603960 compatible = "qcom,sm8150-pdc", "qcom,pdc";
3961− reg = <0 0x0b220000 0 0x400>;
3961+ reg = <0 0x0b220000 0 0x30000>;
39623962 qcom,pdc-ranges = <0 480 94>, <94 609 31>,
39633963 <125 63 1>;
39643964 #interrupt-cells = <2>;
arch/arm64/include/asm/acpi.h+19−0
@@ -9,6 +9,7 @@ · 8 unmodified lines
99 #ifndef _ASM_ACPI_H
1010 #define _ASM_ACPI_H
1111
12+#include <linux/cpuidle.h>
1213 #include <linux/efi.h>
1314 #include <linux/memblock.h>
1415 #include <linux/psci.h>
@@ -44,6 +45,24 @@ · 29 unmodified lines
4445
4546 #define ACPI_MADT_GICC_TRBE (offsetof(struct acpi_madt_generic_interrupt, \
4647 trbe_interrupt) + sizeof(u16))
48+/*
49+ * Arm® Functional Fixed Hardware Specification Version 1.2.
50+ * Table 2: Arm Architecture context loss flags
51+ */
52+#define CPUIDLE_CORE_CTXT BIT(0) /* Core context Lost */
53+
54+static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
55+{
56+ if (arch_flags & CPUIDLE_CORE_CTXT)
57+ return CPUIDLE_FLAG_TIMER_STOP;
58+
59+ return 0;
60+}
61+#define arch_get_idle_state_flags arch_get_idle_state_flags
62+
63+#define CPUIDLE_TRACE_CTXT BIT(1) /* Trace context loss */
64+#define CPUIDLE_GICR_CTXT BIT(2) /* GICR */
65+#define CPUIDLE_GICD_CTXT BIT(3) /* GICD */
4766
4867 /* Basic configuration for ACPI */
4968 #ifdef CONFIG_ACPI
arch/arm64/include/asm/cputype.h+2−0
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 #define ARM_CPU_PART_CORTEX_A78AE 0xD42
8080 #define ARM_CPU_PART_CORTEX_X1 0xD44
8181 #define ARM_CPU_PART_CORTEX_A510 0xD46
82+#define ARM_CPU_PART_CORTEX_A520 0xD80
8283 #define ARM_CPU_PART_CORTEX_A710 0xD47
8384 #define ARM_CPU_PART_CORTEX_A715 0xD4D
8485 #define ARM_CPU_PART_CORTEX_X2 0xD48
@@ -148,6 +149,7 @@ · 63 unmodified lines
148149 #define MIDR_CORTEX_A78AE MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A78AE)
149150 #define MIDR_CORTEX_X1 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X1)
150151 #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A510)
152+#define MIDR_CORTEX_A520 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A520)
151153 #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A710)
152154 #define MIDR_CORTEX_A715 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A715)
153155 #define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_X2)
arch/arm64/kernel/cpu_errata.c+8−0
@@ -730,6 +730,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { · 729 unmodified lines
730730 .cpu_enable = cpu_clear_bf16_from_user_emulation,
731731 },
732732 #endif
733+#ifdef CONFIG_ARM64_ERRATUM_2966298
734+ {
735+ .desc = "ARM erratum 2966298",
736+ .capability = ARM64_WORKAROUND_2966298,
737+ /* Cortex-A520 r0p0 - r0p1 */
738+ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A520, 0, 0, 1),
739+ },
740+#endif
733741 #ifdef CONFIG_AMPERE_ERRATUM_AC03_CPU_38
734742 {
735743 .desc = "AmpereOne erratum AC03_CPU_38",
arch/arm64/kernel/entry.S+4−0
@@ -428,6 +428,10 @@ alternative_else_nop_endif · 427 unmodified lines
428428 ldp x28, x29, [sp, #16 * 14]
429429
430430 .if \el == 0
431+alternative_if ARM64_WORKAROUND_2966298
432+ tlbi vale1, xzr
433+ dsb nsh
434+alternative_else_nop_endif
431435 alternative_if_not ARM64_UNMAP_KERNEL_AT_EL0
432436 ldr lr, [sp, #S_LR]
433437 add sp, sp, #PT_REGS_SIZE // restore sp
arch/arm64/tools/cpucaps+1−0
@@ -84,6 +84,7 @@ WORKAROUND_2077057 · 83 unmodified lines
8484 WORKAROUND_2457168
8585 WORKAROUND_2645198
8686 WORKAROUND_2658417
87+WORKAROUND_2966298
8788 WORKAROUND_AMPERE_AC03_CPU_38
8889 WORKAROUND_TRBE_OVERWRITE_FILL_MODE
8990 WORKAROUND_TSB_FLUSH_FAILURE
arch/ia64/include/asm/cpu.h+0−5
@@ -15,9 +15,4 @@ DECLARE_PER_CPU(struct ia64_cpu, cpu_devices); · 14 unmodified lines
1515
1616 DECLARE_PER_CPU(int, cpu_state);
1717
18−#ifdef CONFIG_HOTPLUG_CPU
19−extern int arch_register_cpu(int num);
20−extern void arch_unregister_cpu(int);
21−#endif
22−
2318 #endif /* _ASM_IA64_CPU_H_ */
arch/ia64/kernel/topology.c+1−1
@@ -59,7 +59,7 @@ void __ref arch_unregister_cpu(int num) · 58 unmodified lines
5959 }
6060 EXPORT_SYMBOL(arch_unregister_cpu);
6161 #else
62−static int __init arch_register_cpu(int num)
62+int __init arch_register_cpu(int num)
6363 {
6464 return register_cpu(&sysfs_cpus[num].cpu, num);
6565 }
arch/parisc/include/asm/ldcw.h+20−17
@@ -2,39 +2,42 @@ · 1 unmodified line
22 #ifndef __PARISC_LDCW_H
33 #define __PARISC_LDCW_H
44
5−#ifndef CONFIG_PA20
65 /* Because kmalloc only guarantees 8-byte alignment for kmalloc'd data,
76 and GCC only guarantees 8-byte alignment for stack locals, we can't
87 be assured of 16-byte alignment for atomic lock data even if we
98 specify "__attribute ((aligned(16)))" in the type declaration. So,
109 we use a struct containing an array of four ints for the atomic lock
1110 type and dynamically select the 16-byte aligned int from the array
12− for the semaphore. */
11+ for the semaphore. */
12+
13+/* From: "Jim Hull" <jim.hull of hp.com>
14+ I've attached a summary of the change, but basically, for PA 2.0, as
15+ long as the ",CO" (coherent operation) completer is implemented, then the
16+ 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead
17+ they only require "natural" alignment (4-byte for ldcw, 8-byte for
18+ ldcd).
19+
20+ Although the cache control hint is accepted by all PA 2.0 processors,
21+ it is only implemented on PA8800/PA8900 CPUs. Prior PA8X00 CPUs still
22+ require 16-byte alignment. If the address is unaligned, the operation
23+ of the instruction is undefined. The ldcw instruction does not generate
24+ unaligned data reference traps so misaligned accesses are not detected.
25+ This hid the problem for years. So, restore the 16-byte alignment dropped
26+ by Kyle McMartin in "Remove __ldcw_align for PA-RISC 2.0 processors". */
1327
1428 #define __PA_LDCW_ALIGNMENT 16
15−#define __PA_LDCW_ALIGN_ORDER 4
1629 #define __ldcw_align(a) ({ \
1730 unsigned long __ret = (unsigned long) &(a)->lock[0]; \
1831 __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) \
1932 & ~(__PA_LDCW_ALIGNMENT - 1); \
2033 (volatile unsigned int *) __ret; \
2134 })
22−#define __LDCW "ldcw"
2335
24−#else /*CONFIG_PA20*/
25−/* From: "Jim Hull" <jim.hull of hp.com>
26− I've attached a summary of the change, but basically, for PA 2.0, as
27− long as the ",CO" (coherent operation) completer is specified, then the
28− 16-byte alignment requirement for ldcw and ldcd is relaxed, and instead
29− they only require "natural" alignment (4-byte for ldcw, 8-byte for
30− ldcd). */
31−
32−#define __PA_LDCW_ALIGNMENT 4
33−#define __PA_LDCW_ALIGN_ORDER 2
34−#define __ldcw_align(a) (&(a)->slock)
36+#ifdef CONFIG_PA20
3537 #define __LDCW "ldcw,co"
36−
37−#endif /*!CONFIG_PA20*/
38+#else
39+#define __LDCW "ldcw"
40+#endif
3841
3942 /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*.
4043 We don't explicitly expose that "*a" may be written as reload
arch/parisc/include/asm/spinlock_types.h+0−5
@@ -9,15 +9,10 @@ · 8 unmodified lines
99 #ifndef __ASSEMBLY__
1010
1111 typedef struct {
12−#ifdef CONFIG_PA20
13− volatile unsigned int slock;
14−# define __ARCH_SPIN_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED_VAL }
15−#else
1612 volatile unsigned int lock[4];
1713 # define __ARCH_SPIN_LOCK_UNLOCKED \
1814 { { __ARCH_SPIN_LOCK_UNLOCKED_VAL, __ARCH_SPIN_LOCK_UNLOCKED_VAL, \
1915 __ARCH_SPIN_LOCK_UNLOCKED_VAL, __ARCH_SPIN_LOCK_UNLOCKED_VAL } }
20−#endif
2116 } arch_spinlock_t;
2217
2318
arch/parisc/kernel/smp.c+3−1
@@ -440,7 +440,9 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) · 439 unmodified lines
440440 if (cpu_online(cpu))
441441 return 0;
442442
443− if (num_online_cpus() < setup_max_cpus && smp_boot_one_cpu(cpu, tidle))
443+ if (num_online_cpus() < nr_cpu_ids &&
444+ num_online_cpus() < setup_max_cpus &&
445+ smp_boot_one_cpu(cpu, tidle))
444446 return -EIO;
445447
446448 return cpu_online(cpu) ? 0 : -EIO;
arch/powerpc/include/asm/nohash/32/pte-8xx.h+7−0
@@ -94,6 +94,13 @@ static inline pte_t pte_wrprotect(pte_t pte) · 93 unmodified lines
9494
9595 #define pte_wrprotect pte_wrprotect
9696
97+static inline int pte_read(pte_t pte)
98+{
99+ return (pte_val(pte) & _PAGE_RO) != _PAGE_NA;
100+}
101+
102+#define pte_read pte_read
103+
97104 static inline int pte_write(pte_t pte)
98105 {
99106 return !(pte_val(pte) & _PAGE_RO);
arch/powerpc/include/asm/nohash/64/pgtable.h+1−1
@@ -197,7 +197,7 @@ static inline int __ptep_test_and_clear_young(struct mm_struct *mm, · 196 unmodified lines
197197 {
198198 unsigned long old;
199199
200− if (pte_young(*ptep))
200+ if (!pte_young(*ptep))
201201 return 0;
202202 old = pte_update(mm, addr, ptep, _PAGE_ACCESSED, 0, 0);
203203 return (old & _PAGE_ACCESSED) != 0;
arch/powerpc/include/asm/nohash/pgtable.h+2−0
@@ -25,7 +25,9 @@ static inline int pte_write(pte_t pte) · 24 unmodified lines
2525 return pte_val(pte) & _PAGE_RW;
2626 }
2727 #endif
28+#ifndef pte_read
2829 static inline int pte_read(pte_t pte) { return 1; }
30+#endif
2931 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
3032 static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; }
3133 static inline int pte_none(pte_t pte) { return (pte_val(pte) & ~_PTE_NONE_MASK) == 0; }
arch/powerpc/kernel/entry_32.S+5−3
@@ -137,8 +137,9 @@ ret_from_syscall: · 136 unmodified lines
137137 lis r4,icache_44x_need_flush@ha
138138 lwz r5,icache_44x_need_flush@l(r4)
139139 cmplwi cr0,r5,0
140− bne- 2f
140+ bne- .L44x_icache_flush
141141 #endif /* CONFIG_PPC_47x */
142+.L44x_icache_flush_return:
142143 kuep_unlock
143144 lwz r4,_LINK(r1)
144145 lwz r5,_CCR(r1)
@@ -172,10 +173,11 @@ syscall_exit_finish: · 27 unmodified lines
172173 b 1b
173174
174175 #ifdef CONFIG_44x
175−2: li r7,0
176+.L44x_icache_flush:
177+ li r7,0
176178 iccci r0,r0
177179 stw r7,icache_44x_need_flush@l(r4)
178− b 1b
180+ b .L44x_icache_flush_return
179181 #endif /* CONFIG_44x */
180182
181183 .globl ret_from_fork
arch/powerpc/kernel/head_85xx.S+1−1
@@ -395,7 +395,7 @@ interrupt_base: · 394 unmodified lines
395395 #ifdef CONFIG_PPC_FPU
396396 FP_UNAVAILABLE_EXCEPTION
397397 #else
398− EXCEPTION(0x0800, FP_UNAVAIL, FloatingPointUnavailable, unknown_exception)
398+ EXCEPTION(0x0800, FP_UNAVAIL, FloatingPointUnavailable, emulation_assist_interrupt)
399399 #endif
400400
401401 /* System Call Interrupt */
arch/powerpc/platforms/pseries/hvCall.S+1−7
@@ -184,9 +184,6 @@ _GLOBAL_TOC(plpar_hcall) · 183 unmodified lines
184184 plpar_hcall_trace:
185185 HCALL_INST_PRECALL(R5)
186186
187− std r4,STK_PARAM(R4)(r1)
188− mr r0,r4
189−
190187 mr r4,r5
191188 mr r5,r6
192189 mr r6,r7
@@ -196,7 +193,7 @@ plpar_hcall_trace: · 3 unmodified lines
196193
197194 HVSC
198195
199− ld r12,STK_PARAM(R4)(r1)
196+ ld r12,STACK_FRAME_MIN_SIZE+STK_PARAM(R4)(r1)
200197 std r4,0(r12)
201198 std r5,8(r12)
202199 std r6,16(r12)
@@ -296,9 +293,6 @@ _GLOBAL_TOC(plpar_hcall9) · 93 unmodified lines
296293 plpar_hcall9_trace:
297294 HCALL_INST_PRECALL(R5)
298295
299− std r4,STK_PARAM(R4)(r1)
300− mr r0,r4
301−
302296 mr r4,r5
303297 mr r5,r6
304298 mr r6,r7
arch/riscv/Makefile+0−1
@@ -6,7 +6,6 @@ · 5 unmodified lines
66 # for more details.
77 #
88
9−OBJCOPYFLAGS := -O binary
109 LDFLAGS_vmlinux := -z norelro
1110 ifeq ($(CONFIG_RELOCATABLE),y)
1211 LDFLAGS_vmlinux += -shared -Bsymbolic -z notext --emit-relocs
arch/riscv/errata/andes/Makefile+4−0
@@ -1 +1,5 @@
1+ifdef CONFIG_RISCV_ALTERNATIVE_EARLY
2+CFLAGS_errata.o := -mcmodel=medany
3+endif
4+
15 obj-y += errata.o
arch/riscv/include/asm/ftrace.h+21−0
@@ -31,6 +31,27 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) · 30 unmodified lines
3131 return addr;
3232 }
3333
34+/*
35+ * Let's do like x86/arm64 and ignore the compat syscalls.
36+ */
37+#define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
38+static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs)
39+{
40+ return is_compat_task();
41+}
42+
43+#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME
44+static inline bool arch_syscall_match_sym_name(const char *sym,
45+ const char *name)
46+{
47+ /*
48+ * Since all syscall functions have __riscv_ prefix, we must skip it.
49+ * However, as we described above, we decided to ignore compat
50+ * syscalls, so we don't care about __riscv_compat_ prefix here.
51+ */
52+ return !strcmp(sym + 8, name);
53+}
54+
3455 struct dyn_arch_ftrace {
3556 };
3657 #endif
arch/riscv/include/asm/kprobes.h+10−1
@@ -40,6 +40,15 @@ void arch_remove_kprobe(struct kprobe *p); · 39 unmodified lines
4040 int kprobe_fault_handler(struct pt_regs *regs, unsigned int trapnr);
4141 bool kprobe_breakpoint_handler(struct pt_regs *regs);
4242 bool kprobe_single_step_handler(struct pt_regs *regs);
43−
43+#else
44+static inline bool kprobe_breakpoint_handler(struct pt_regs *regs)
45+{
46+ return false;
47+}
48+
49+static inline bool kprobe_single_step_handler(struct pt_regs *regs)
50+{
51+ return false;
52+}
4453 #endif /* CONFIG_KPROBES */
4554 #endif /* _ASM_RISCV_KPROBES_H */
arch/riscv/include/asm/uprobes.h+12−1
@@ -34,7 +34,18 @@ struct arch_uprobe { · 33 unmodified lines
3434 bool simulate;
3535 };
3636
37+#ifdef CONFIG_UPROBES
3738 bool uprobe_breakpoint_handler(struct pt_regs *regs);
3839 bool uprobe_single_step_handler(struct pt_regs *regs);
39−
40+#else
41+static inline bool uprobe_breakpoint_handler(struct pt_regs *regs)
42+{
43+ return false;
44+}
45+
46+static inline bool uprobe_single_step_handler(struct pt_regs *regs)
47+{
48+ return false;
49+}
50+#endif /* CONFIG_UPROBES */
4051 #endif /* _ASM_RISCV_UPROBES_H */
arch/riscv/kernel/irq.c+2−2
@@ -60,7 +60,7 @@ static void init_irq_stacks(void) · 59 unmodified lines
6060 }
6161 #endif /* CONFIG_VMAP_STACK */
6262
63−#ifdef CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK
63+#ifdef CONFIG_SOFTIRQ_ON_OWN_STACK
6464 void do_softirq_own_stack(void)
6565 {
6666 #ifdef CONFIG_IRQ_STACKS
@@ -92,7 +92,7 @@ void do_softirq_own_stack(void) · 25 unmodified lines
9292 #endif
9393 __do_softirq();
9494 }
95−#endif /* CONFIG_HAVE_SOFTIRQ_ON_OWN_STACK */
95+#endif /* CONFIG_SOFTIRQ_ON_OWN_STACK */
9696
9797 #else
9898 static void init_irq_stacks(void) {}
arch/riscv/kernel/setup.c+0−13
@@ -173,19 +173,6 @@ static void __init init_resources(void) · 172 unmodified lines
173173 if (ret < 0)
174174 goto error;
175175
176−#ifdef CONFIG_KEXEC_CORE
177− if (crashk_res.start != crashk_res.end) {
178− ret = add_resource(&iomem_resource, &crashk_res);
179− if (ret < 0)
180− goto error;
181− }
182− if (crashk_low_res.start != crashk_low_res.end) {
183− ret = add_resource(&iomem_resource, &crashk_low_res);
184− if (ret < 0)
185− goto error;
186− }
187−#endif
188−
189176 #ifdef CONFIG_CRASH_DUMP
190177 if (elfcorehdr_size > 0) {
191178 elfcorehdr_res.start = elfcorehdr_addr;
arch/riscv/kernel/signal.c+0−7
@@ -311,13 +311,6 @@ static inline void __user *get_sigframe(struct ksignal *ksig, · 310 unmodified lines
311311 /* Align the stack frame. */
312312 sp &= ~0xfUL;
313313
314− /*
315− * Fail if the size of the altstack is not large enough for the
316− * sigframe construction.
317− */
318− if (current->sas_ss_size && sp < current->sas_ss_sp)
319− return (void __user __force *)-1UL;
320−
321314 return (void __user *)sp;
322315 }
323316
arch/riscv/kernel/traps.c+18−10
@@ -13,6 +13,8 @@ · 12 unmodified lines
1313 #include <linux/kdebug.h>
1414 #include <linux/uaccess.h>
1515 #include <linux/kprobes.h>
16+#include <linux/uprobes.h>
17+#include <asm/uprobes.h>
1618 #include <linux/mm.h>
1719 #include <linux/module.h>
1820 #include <linux/irq.h>
@@ -247,22 +249,28 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 228 unmodified lines
247249 return GET_INSN_LENGTH(insn);
248250 }
249251
252+static bool probe_single_step_handler(struct pt_regs *regs)
253+{
254+ bool user = user_mode(regs);
255+
256+ return user ? uprobe_single_step_handler(regs) : kprobe_single_step_handler(regs);
257+}
258+
259+static bool probe_breakpoint_handler(struct pt_regs *regs)
260+{
261+ bool user = user_mode(regs);
262+
263+ return user ? uprobe_breakpoint_handler(regs) : kprobe_breakpoint_handler(regs);
264+}
265+
250266 void handle_break(struct pt_regs *regs)
251267 {
252−#ifdef CONFIG_KPROBES
253− if (kprobe_single_step_handler(regs))
268+ if (probe_single_step_handler(regs))
254269 return;
255270
256− if (kprobe_breakpoint_handler(regs))
257− return;
258−#endif
259−#ifdef CONFIG_UPROBES
260− if (uprobe_single_step_handler(regs))
271+ if (probe_breakpoint_handler(regs))
261272 return;
262273
263− if (uprobe_breakpoint_handler(regs))
264− return;
265−#endif
266274 current->thread.bad_cause = regs->cause;
267275
268276 if (user_mode(regs))
arch/riscv/net/bpf_jit_comp64.c+12−6
@@ -245,7 +245,7 @@ static void __build_epilogue(bool is_tail_call, struct rv_jit_context *ctx) · 244 unmodified lines
245245 emit_addi(RV_REG_SP, RV_REG_SP, stack_adjust, ctx);
246246 /* Set return value. */
247247 if (!is_tail_call)
248− emit_mv(RV_REG_A0, RV_REG_A5, ctx);
248+ emit_addiw(RV_REG_A0, RV_REG_A5, 0, ctx);
249249 emit_jalr(RV_REG_ZERO, is_tail_call ? RV_REG_T3 : RV_REG_RA,
250250 is_tail_call ? (RV_FENTRY_NINSNS + 1) * 4 : 0, /* skip reserved nops and TCC init */
251251 ctx);
@@ -759,8 +759,10 @@ static int invoke_bpf_prog(struct bpf_tramp_link *l, int args_off, int retval_of · 507 unmodified lines
759759 if (ret)
760760 return ret;
761761
762− if (save_ret)
763− emit_sd(RV_REG_FP, -retval_off, regmap[BPF_REG_0], ctx);
762+ if (save_ret) {
763+ emit_sd(RV_REG_FP, -retval_off, RV_REG_A0, ctx);
764+ emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx);
765+ }
764766
765767 /* update branch with beqz */
766768 if (ctx->insns) {
@@ -853,7 +855,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, · 86 unmodified lines
853855
854856 save_ret = flags & (BPF_TRAMP_F_CALL_ORIG | BPF_TRAMP_F_RET_FENTRY_RET);
855857 if (save_ret) {
856− stack_size += 8;
858+ stack_size += 16; /* Save both A5 (BPF R0) and A0 */
857859 retval_off = stack_size;
858860 }
859861
@@ -957,6 +959,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, · 97 unmodified lines
957959 if (ret)
958960 goto out;
959961 emit_sd(RV_REG_FP, -retval_off, RV_REG_A0, ctx);
962+ emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx);
960963 im->ip_after_call = ctx->insns + ctx->ninsns;
961964 /* 2 nops reserved for auipc+jalr pair */
962965 emit(rv_nop(), ctx);
@@ -988,8 +991,10 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, · 25 unmodified lines
988991 if (flags & BPF_TRAMP_F_RESTORE_REGS)
989992 restore_args(nregs, args_off, ctx);
990993
991− if (save_ret)
994+ if (save_ret) {
992995 emit_ld(RV_REG_A0, -retval_off, RV_REG_FP, ctx);
996+ emit_ld(regmap[BPF_REG_0], -(retval_off - 8), RV_REG_FP, ctx);
997+ }
993998
994999 emit_ld(RV_REG_S1, -sreg_off, RV_REG_FP, ctx);
9951000
@@ -1515,7 +1520,8 @@ out_be: · 519 unmodified lines
15151520 if (ret)
15161521 return ret;
15171522
1518− emit_mv(bpf_to_rv_reg(BPF_REG_0, ctx), RV_REG_A0, ctx);
1523+ if (insn->src_reg != BPF_PSEUDO_CALL)
1524+ emit_mv(bpf_to_rv_reg(BPF_REG_0, ctx), RV_REG_A0, ctx);
15191525 break;
15201526 }
15211527 /* tail call */
arch/s390/net/bpf_jit_comp.c+21−6
@@ -2066,6 +2066,7 @@ struct bpf_tramp_jit { · 2065 unmodified lines
20662066 * func_addr's original caller
20672067 */
20682068 int stack_size; /* Trampoline stack size */
2069+ int backchain_off; /* Offset of backchain */
20692070 int stack_args_off; /* Offset of stack arguments for calling
20702071 * func_addr, has to be at the top
20712072 */
@@ -2086,9 +2087,10 @@ struct bpf_tramp_jit { · 14 unmodified lines
20862087 * for __bpf_prog_enter() return value and
20872088 * func_addr respectively
20882089 */
2089− int r14_off; /* Offset of saved %r14 */
20902090 int run_ctx_off; /* Offset of struct bpf_tramp_run_ctx */
20912091 int tccnt_off; /* Offset of saved tailcall counter */
2092+ int r14_off; /* Offset of saved %r14, has to be at the
2093+ * bottom */
20922094 int do_fexit; /* do_fexit: label */
20932095 };
20942096
@@ -2247,8 +2249,12 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, · 152 unmodified lines
22472249 * Calculate the stack layout.
22482250 */
22492251
2250− /* Reserve STACK_FRAME_OVERHEAD bytes for the callees. */
2252+ /*
2253+ * Allocate STACK_FRAME_OVERHEAD bytes for the callees. As the s390x
2254+ * ABI requires, put our backchain at the end of the allocated memory.
2255+ */
22512256 tjit->stack_size = STACK_FRAME_OVERHEAD;
2257+ tjit->backchain_off = tjit->stack_size - sizeof(u64);
22522258 tjit->stack_args_off = alloc_stack(tjit, nr_stack_args * sizeof(u64));
22532259 tjit->reg_args_off = alloc_stack(tjit, nr_reg_args * sizeof(u64));
22542260 tjit->ip_off = alloc_stack(tjit, sizeof(u64));
@@ -2256,16 +2262,25 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, · 1 unmodified line
22562262 tjit->bpf_args_off = alloc_stack(tjit, nr_bpf_args * sizeof(u64));
22572263 tjit->retval_off = alloc_stack(tjit, sizeof(u64));
22582264 tjit->r7_r8_off = alloc_stack(tjit, 2 * sizeof(u64));
2259− tjit->r14_off = alloc_stack(tjit, sizeof(u64));
22602265 tjit->run_ctx_off = alloc_stack(tjit,
22612266 sizeof(struct bpf_tramp_run_ctx));
22622267 tjit->tccnt_off = alloc_stack(tjit, sizeof(u64));
2263− /* The caller has already reserved STACK_FRAME_OVERHEAD bytes. */
2264− tjit->stack_size -= STACK_FRAME_OVERHEAD;
2268+ tjit->r14_off = alloc_stack(tjit, sizeof(u64) * 2);
2269+ /*
2270+ * In accordance with the s390x ABI, the caller has allocated
2271+ * STACK_FRAME_OVERHEAD bytes for us. 8 of them contain the caller's
2272+ * backchain, and the rest we can use.
2273+ */
2274+ tjit->stack_size -= STACK_FRAME_OVERHEAD - sizeof(u64);
22652275 tjit->orig_stack_args_off = tjit->stack_size + STACK_FRAME_OVERHEAD;
22662276
2277+ /* lgr %r1,%r15 */
2278+ EMIT4(0xb9040000, REG_1, REG_15);
22672279 /* aghi %r15,-stack_size */
22682280 EMIT4_IMM(0xa70b0000, REG_15, -tjit->stack_size);
2281+ /* stg %r1,backchain_off(%r15) */
2282+ EMIT6_DISP_LH(0xe3000000, 0x0024, REG_1, REG_0, REG_15,
2283+ tjit->backchain_off);
22692284 /* mvc tccnt_off(4,%r15),stack_size+STK_OFF_TCCNT(%r15) */
22702285 _EMIT6(0xd203f000 | tjit->tccnt_off,
22712286 0xf000 | (tjit->stack_size + STK_OFF_TCCNT));
@@ -2513,7 +2528,7 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, · 241 unmodified lines
25132528 return -E2BIG;
25142529 }
25152530
2516− return ret;
2531+ return tjit.common.prg;
25172532 }
25182533
25192534 bool bpf_jit_supports_subprog_tailcalls(void)
arch/x86/events/utils.c+3−2
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <asm/insn.h>
3+#include <linux/mm.h>
34
45 #include "perf_event.h"
56
@@ -132,9 +133,9 @@ static int get_branch_type(unsigned long from, unsigned long to, int abort, · 126 unmodified lines
132133 * The LBR logs any address in the IP, even if the IP just
133134 * faulted. This means userspace can control the from address.
134135 * Ensure we don't blindly read any address by validating it is
135− * a known text address.
136+ * a known text address and not a vsyscall address.
136137 */
137− if (kernel_text_address(from)) {
138+ if (kernel_text_address(from) && !in_gate_area_no_mm(from)) {
138139 addr = (void *)from;
139140 /*
140141 * Assume we can get the maximum possible size
arch/x86/hyperv/hv_init.c+14−6
@@ -7,6 +7,8 @@ · 6 unmodified lines
77 * Author : K. Y. Srinivasan <kys@microsoft.com>
88 */
99
10+#define pr_fmt(fmt) "Hyper-V: " fmt
11+
1012 #include <linux/efi.h>
1113 #include <linux/types.h>
1214 #include <linux/bitfield.h>
@@ -191,7 +193,7 @@ void set_hv_tscchange_cb(void (*cb)(void)) · 178 unmodified lines
191193 struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
192194
193195 if (!hv_reenlightenment_available()) {
194− pr_warn("Hyper-V: reenlightenment support is unavailable\n");
196+ pr_warn("reenlightenment support is unavailable\n");
195197 return;
196198 }
197199
@@ -394,6 +396,7 @@ static void __init hv_get_partition_id(void) · 196 unmodified lines
394396 local_irq_restore(flags);
395397 }
396398
399+#if IS_ENABLED(CONFIG_HYPERV_VTL_MODE)
397400 static u8 __init get_vtl(void)
398401 {
399402 u64 control = HV_HYPERCALL_REP_COMP_1 | HVCALL_GET_VP_REGISTERS;
@@ -416,13 +419,16 @@ static u8 __init get_vtl(void) · 16 unmodified lines
416419 if (hv_result_success(ret)) {
417420 ret = output->as64.low & HV_X64_VTL_MASK;
418421 } else {
419− pr_err("Failed to get VTL(%lld) and set VTL to zero by default.\n", ret);
420− ret = 0;
422+ pr_err("Failed to get VTL(error: %lld) exiting...\n", ret);
423+ BUG();
421424 }
422425
423426 local_irq_restore(flags);
424427 return ret;
425428 }
429+#else
430+static inline u8 get_vtl(void) { return 0; }
431+#endif
426432
427433 /*
428434 * This function is to be invoked early in the boot sequence after the
@@ -564,7 +570,7 @@ skip_hypercall_pg_init: · 135 unmodified lines
564570 if (cpu_feature_enabled(X86_FEATURE_IBT) &&
565571 *(u32 *)hv_hypercall_pg != gen_endbr()) {
566572 setup_clear_cpu_cap(X86_FEATURE_IBT);
567− pr_warn("Hyper-V: Disabling IBT because of Hyper-V bug\n");
573+ pr_warn("Disabling IBT because of Hyper-V bug\n");
568574 }
569575 #endif
570576
@@ -604,8 +610,10 @@ skip_hypercall_pg_init: · 33 unmodified lines
604610 hv_query_ext_cap(0);
605611
606612 /* Find the VTL */
607− if (!ms_hyperv.paravisor_present && hv_isolation_type_snp())
608− ms_hyperv.vtl = get_vtl();
613+ ms_hyperv.vtl = get_vtl();
614+
615+ if (ms_hyperv.vtl > 0) /* non default VTL */
616+ hv_vtl_early_init();
609617
610618 return;
611619
arch/x86/hyperv/hv_vtl.c+1−2
@@ -215,7 +215,7 @@ static int hv_vtl_wakeup_secondary_cpu(int apicid, unsigned long start_eip) · 214 unmodified lines
215215 return hv_vtl_bringup_vcpu(vp_id, start_eip);
216216 }
217217
218−static int __init hv_vtl_early_init(void)
218+int __init hv_vtl_early_init(void)
219219 {
220220 /*
221221 * `boot_cpu_has` returns the runtime feature support,
@@ -230,4 +230,3 @@ static int __init hv_vtl_early_init(void) · 8 unmodified lines
230230
231231 return 0;
232232 }
233−early_initcall(hv_vtl_early_init);
arch/x86/include/asm/cpu.h+0−2
@@ -28,8 +28,6 @@ struct x86_cpu { · 27 unmodified lines
2828 };
2929
3030 #ifdef CONFIG_HOTPLUG_CPU
31−extern int arch_register_cpu(int num);
32−extern void arch_unregister_cpu(int);
3331 extern void soft_restart_cpu(void);
3432 #endif
3533
arch/x86/include/asm/mshyperv.h+2−0
@@ -340,8 +340,10 @@ static inline u64 hv_get_non_nested_register(unsigned int reg) { return 0; } · 339 unmodified lines
340340
341341 #ifdef CONFIG_HYPERV_VTL_MODE
342342 void __init hv_vtl_init_platform(void);
343+int __init hv_vtl_early_init(void);
343344 #else
344345 static inline void __init hv_vtl_init_platform(void) {}
346+static inline int __init hv_vtl_early_init(void) { return 0; }
345347 #endif
346348
347349 #include <asm-generic/mshyperv.h>
arch/x86/include/asm/msr-index.h+7−2
@@ -637,12 +637,17 @@ · 636 unmodified lines
637637 /* AMD Last Branch Record MSRs */
638638 #define MSR_AMD64_LBR_SELECT 0xc000010e
639639
640−/* Fam 17h MSRs */
641−#define MSR_F17H_IRPERF 0xc00000e9
640+/* Zen4 */
641+#define MSR_ZEN4_BP_CFG 0xc001102e
642+#define MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT 5
642643
644+/* Zen 2 */
643645 #define MSR_ZEN2_SPECTRAL_CHICKEN 0xc00110e3
644646 #define MSR_ZEN2_SPECTRAL_CHICKEN_BIT BIT_ULL(1)
645647
648+/* Fam 17h MSRs */
649+#define MSR_F17H_IRPERF 0xc00000e9
650+
646651 /* Fam 16h MSRs */
647652 #define MSR_F16H_L2I_PERF_CTL 0xc0010230
648653 #define MSR_F16H_L2I_PERF_CTR 0xc0010231
arch/x86/include/asm/smp.h+0−1
@@ -129,7 +129,6 @@ void native_smp_send_reschedule(int cpu); · 128 unmodified lines
129129 void native_send_call_func_ipi(const struct cpumask *mask);
130130 void native_send_call_func_single_ipi(int cpu);
131131
132−bool smp_park_other_cpus_in_init(void);
133132 void smp_store_cpu_info(int id);
134133
135134 asmlinkage __visible void smp_reboot_interrupt(void);
arch/x86/kernel/alternative.c+13−0
@@ -403,6 +403,17 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start, · 402 unmodified lines
403403 u8 insn_buff[MAX_PATCH_LEN];
404404
405405 DPRINTK(ALT, "alt table %px, -> %px", start, end);
406+
407+ /*
408+ * In the case CONFIG_X86_5LEVEL=y, KASAN_SHADOW_START is defined using
409+ * cpu_feature_enabled(X86_FEATURE_LA57) and is therefore patched here.
410+ * During the process, KASAN becomes confused seeing partial LA57
411+ * conversion and triggers a false-positive out-of-bound report.
412+ *
413+ * Disable KASAN until the patching is complete.
414+ */
415+ kasan_disable_current();
416+
406417 /*
407418 * The scan order should be from start to end. A later scanned
408419 * alternative code can overwrite previously scanned alternative code.
@@ -452,6 +463,8 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start, · 43 unmodified lines
452463
453464 text_poke_early(instr, insn_buff, insn_buff_sz);
454465 }
466+
467+ kasan_enable_current();
455468 }
456469
457470 static inline bool is_jcc32(struct insn *insn)
arch/x86/kernel/cpu/amd.c+8−0
@@ -80,6 +80,10 @@ static const int amd_div0[] = · 79 unmodified lines
8080 AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x17, 0x00, 0x0, 0x2f, 0xf),
8181 AMD_MODEL_RANGE(0x17, 0x50, 0x0, 0x5f, 0xf));
8282
83+static const int amd_erratum_1485[] =
84+ AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x19, 0x10, 0x0, 0x1f, 0xf),
85+ AMD_MODEL_RANGE(0x19, 0x60, 0x0, 0xaf, 0xf));
86+
8387 static bool cpu_has_amd_erratum(struct cpuinfo_x86 *cpu, const int *erratum)
8488 {
8589 int osvw_id = *erratum++;
@@ -1149,6 +1153,10 @@ static void init_amd(struct cpuinfo_x86 *c) · 1063 unmodified lines
11491153 pr_notice_once("AMD Zen1 DIV0 bug detected. Disable SMT for full protection.\n");
11501154 setup_force_cpu_bug(X86_BUG_DIV0);
11511155 }
1156+
1157+ if (!cpu_has(c, X86_FEATURE_HYPERVISOR) &&
1158+ cpu_has_amd_erratum(c, amd_erratum_1485))
1159+ msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);
11521160 }
11531161
11541162 #ifdef CONFIG_X86_32
arch/x86/kernel/cpu/resctrl/monitor.c+5−5
@@ -30,15 +30,15 @@ struct rmid_entry { · 29 unmodified lines
3030 struct list_head list;
3131 };
3232
33−/**
34− * @rmid_free_lru A least recently used list of free RMIDs
33+/*
34+ * @rmid_free_lru - A least recently used list of free RMIDs
3535 * These RMIDs are guaranteed to have an occupancy less than the
3636 * threshold occupancy
3737 */
3838 static LIST_HEAD(rmid_free_lru);
3939
40−/**
41− * @rmid_limbo_count count of currently unused but (potentially)
40+/*
41+ * @rmid_limbo_count - count of currently unused but (potentially)
4242 * dirty RMIDs.
4343 * This counts RMIDs that no one is currently using but that
4444 * may have a occupancy value > resctrl_rmid_realloc_threshold. User can
@@ -46,7 +46,7 @@ static LIST_HEAD(rmid_free_lru); · 1 unmodified line
4646 */
4747 static unsigned int rmid_limbo_count;
4848
49−/**
49+/*
5050 * @rmid_entry - The entry in the limbo and free lists.
5151 */
5252 static struct rmid_entry *rmid_ptrs;
arch/x86/kernel/sev-shared.c+55−14
@@ -256,7 +256,7 @@ static int __sev_cpuid_hv(u32 fn, int reg_idx, u32 *reg) · 255 unmodified lines
256256 return 0;
257257 }
258258
259−static int sev_cpuid_hv(struct cpuid_leaf *leaf)
259+static int __sev_cpuid_hv_msr(struct cpuid_leaf *leaf)
260260 {
261261 int ret;
262262
@@ -279,6 +279,45 @@ static int sev_cpuid_hv(struct cpuid_leaf *leaf) · 16 unmodified lines
279279 return ret;
280280 }
281281
282+static int __sev_cpuid_hv_ghcb(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
283+{
284+ u32 cr4 = native_read_cr4();
285+ int ret;
286+
287+ ghcb_set_rax(ghcb, leaf->fn);
288+ ghcb_set_rcx(ghcb, leaf->subfn);
289+
290+ if (cr4 & X86_CR4_OSXSAVE)
291+ /* Safe to read xcr0 */
292+ ghcb_set_xcr0(ghcb, xgetbv(XCR_XFEATURE_ENABLED_MASK));
293+ else
294+ /* xgetbv will cause #UD - use reset value for xcr0 */
295+ ghcb_set_xcr0(ghcb, 1);
296+
297+ ret = sev_es_ghcb_hv_call(ghcb, ctxt, SVM_EXIT_CPUID, 0, 0);
298+ if (ret != ES_OK)
299+ return ret;
300+
301+ if (!(ghcb_rax_is_valid(ghcb) &&
302+ ghcb_rbx_is_valid(ghcb) &&
303+ ghcb_rcx_is_valid(ghcb) &&
304+ ghcb_rdx_is_valid(ghcb)))
305+ return ES_VMM_ERROR;
306+
307+ leaf->eax = ghcb->save.rax;
308+ leaf->ebx = ghcb->save.rbx;
309+ leaf->ecx = ghcb->save.rcx;
310+ leaf->edx = ghcb->save.rdx;
311+
312+ return ES_OK;
313+}
314+
315+static int sev_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
316+{
317+ return ghcb ? __sev_cpuid_hv_ghcb(ghcb, ctxt, leaf)
318+ : __sev_cpuid_hv_msr(leaf);
319+}
320+
282321 /*
283322 * This may be called early while still running on the initial identity
284323 * mapping. Use RIP-relative addressing to obtain the correct address
@@ -388,19 +427,20 @@ snp_cpuid_get_validated_func(struct cpuid_leaf *leaf) · 103 unmodified lines
388427 return false;
389428 }
390429
391−static void snp_cpuid_hv(struct cpuid_leaf *leaf)
430+static void snp_cpuid_hv(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
392431 {
393− if (sev_cpuid_hv(leaf))
432+ if (sev_cpuid_hv(ghcb, ctxt, leaf))
394433 sev_es_terminate(SEV_TERM_SET_LINUX, GHCB_TERM_CPUID_HV);
395434 }
396435
397−static int snp_cpuid_postprocess(struct cpuid_leaf *leaf)
436+static int snp_cpuid_postprocess(struct ghcb *ghcb, struct es_em_ctxt *ctxt,
437+ struct cpuid_leaf *leaf)
398438 {
399439 struct cpuid_leaf leaf_hv = *leaf;
400440
401441 switch (leaf->fn) {
402442 case 0x1:
403− snp_cpuid_hv(&leaf_hv);
443+ snp_cpuid_hv(ghcb, ctxt, &leaf_hv);
404444
405445 /* initial APIC ID */
406446 leaf->ebx = (leaf_hv.ebx & GENMASK(31, 24)) | (leaf->ebx & GENMASK(23, 0));
@@ -419,7 +459,7 @@ static int snp_cpuid_postprocess(struct cpuid_leaf *leaf) · 12 unmodified lines
419459 break;
420460 case 0xB:
421461 leaf_hv.subfn = 0;
422− snp_cpuid_hv(&leaf_hv);
462+ snp_cpuid_hv(ghcb, ctxt, &leaf_hv);
423463
424464 /* extended APIC ID */
425465 leaf->edx = leaf_hv.edx;
@@ -467,7 +507,7 @@ static int snp_cpuid_postprocess(struct cpuid_leaf *leaf) · 41 unmodified lines
467507 }
468508 break;
469509 case 0x8000001E:
470− snp_cpuid_hv(&leaf_hv);
510+ snp_cpuid_hv(ghcb, ctxt, &leaf_hv);
471511
472512 /* extended APIC ID */
473513 leaf->eax = leaf_hv.eax;
@@ -488,7 +528,7 @@ static int snp_cpuid_postprocess(struct cpuid_leaf *leaf) · 14 unmodified lines
488528 * Returns -EOPNOTSUPP if feature not enabled. Any other non-zero return value
489529 * should be treated as fatal by caller.
490530 */
491−static int snp_cpuid(struct cpuid_leaf *leaf)
531+static int snp_cpuid(struct ghcb *ghcb, struct es_em_ctxt *ctxt, struct cpuid_leaf *leaf)
492532 {
493533 const struct snp_cpuid_table *cpuid_table = snp_cpuid_get_table();
494534
@@ -522,7 +562,7 @@ static int snp_cpuid(struct cpuid_leaf *leaf) · 27 unmodified lines
522562 return 0;
523563 }
524564
525− return snp_cpuid_postprocess(leaf);
565+ return snp_cpuid_postprocess(ghcb, ctxt, leaf);
526566 }
527567
528568 /*
@@ -544,14 +584,14 @@ void __init do_vc_no_ghcb(struct pt_regs *regs, unsigned long exit_code) · 15 unmodified lines
544584 leaf.fn = fn;
545585 leaf.subfn = subfn;
546586
547− ret = snp_cpuid(&leaf);
587+ ret = snp_cpuid(NULL, NULL, &leaf);
548588 if (!ret)
549589 goto cpuid_done;
550590
551591 if (ret != -EOPNOTSUPP)
552592 goto fail;
553593
554− if (sev_cpuid_hv(&leaf))
594+ if (__sev_cpuid_hv_msr(&leaf))
555595 goto fail;
556596
557597 cpuid_done:
@@ -848,14 +888,15 @@ static enum es_result vc_handle_ioio(struct ghcb *ghcb, struct es_em_ctxt *ctxt) · 290 unmodified lines
848888 return ret;
849889 }
850890
851−static int vc_handle_cpuid_snp(struct pt_regs *regs)
891+static int vc_handle_cpuid_snp(struct ghcb *ghcb, struct es_em_ctxt *ctxt)
852892 {
893+ struct pt_regs *regs = ctxt->regs;
853894 struct cpuid_leaf leaf;
854895 int ret;
855896
856897 leaf.fn = regs->ax;
857898 leaf.subfn = regs->cx;
858− ret = snp_cpuid(&leaf);
899+ ret = snp_cpuid(ghcb, ctxt, &leaf);
859900 if (!ret) {
860901 regs->ax = leaf.eax;
861902 regs->bx = leaf.ebx;
@@ -874,7 +915,7 @@ static enum es_result vc_handle_cpuid(struct ghcb *ghcb, · 12 unmodified lines
874915 enum es_result ret;
875916 int snp_cpuid_ret;
876917
877− snp_cpuid_ret = vc_handle_cpuid_snp(regs);
918+ snp_cpuid_ret = vc_handle_cpuid_snp(ghcb, ctxt);
878919 if (!snp_cpuid_ret)
879920 return ES_OK;
880921 if (snp_cpuid_ret != -EOPNOTSUPP)
arch/x86/kernel/sev.c+1−2
@@ -868,8 +868,7 @@ void snp_set_memory_private(unsigned long vaddr, unsigned long npages) · 867 unmodified lines
868868
869869 void snp_accept_memory(phys_addr_t start, phys_addr_t end)
870870 {
871− unsigned long vaddr;
872− unsigned int npages;
871+ unsigned long vaddr, npages;
873872
874873 if (!cc_platform_has(CC_ATTR_GUEST_SEV_SNP))
875874 return;
arch/x86/kernel/smp.c+7−32
@@ -131,7 +131,7 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs) · 130 unmodified lines
131131 }
132132
133133 /*
134− * Disable virtualization, APIC etc. and park the CPU in a HLT loop
134+ * this function calls the 'stop' function on all other CPUs in the system.
135135 */
136136 DEFINE_IDTENTRY_SYSVEC(sysvec_reboot)
137137 {
@@ -172,17 +172,13 @@ static void native_stop_other_cpus(int wait) · 34 unmodified lines
172172 * 2) Wait for all other CPUs to report that they reached the
173173 * HLT loop in stop_this_cpu()
174174 *
175− * 3) If the system uses INIT/STARTUP for CPU bringup, then
176− * send all present CPUs an INIT vector, which brings them
177− * completely out of the way.
175+ * 3) If #2 timed out send an NMI to the CPUs which did not
176+ * yet report
178177 *
179− * 4) If #3 is not possible and #2 timed out send an NMI to the
180− * CPUs which did not yet report
181− *
182− * 5) Wait for all other CPUs to report that they reached the
178+ * 4) Wait for all other CPUs to report that they reached the
183179 * HLT loop in stop_this_cpu()
184180 *
185− * #4 can obviously race against a CPU reaching the HLT loop late.
181+ * #3 can obviously race against a CPU reaching the HLT loop late.
186182 * That CPU will have reported already and the "have all CPUs
187183 * reached HLT" condition will be true despite the fact that the
188184 * other CPU is still handling the NMI. Again, there is no
@@ -198,7 +194,7 @@ static void native_stop_other_cpus(int wait) · 9 unmodified lines
198194 /*
199195 * Don't wait longer than a second for IPI completion. The
200196 * wait request is not checked here because that would
201− * prevent an NMI/INIT shutdown in case that not all
197+ * prevent an NMI shutdown attempt in case that not all
202198 * CPUs reach shutdown state.
203199 */
204200 timeout = USEC_PER_SEC;
@@ -206,27 +202,7 @@ static void native_stop_other_cpus(int wait) · 1 unmodified line
206202 udelay(1);
207203 }
208204
209− /*
210− * Park all other CPUs in INIT including "offline" CPUs, if
211− * possible. That's a safe place where they can't resume execution
212− * of HLT and then execute the HLT loop from overwritten text or
213− * page tables.
214− *
215− * The only downside is a broadcast MCE, but up to the point where
216− * the kexec() kernel brought all APs online again an MCE will just
217− * make HLT resume and handle the MCE. The machine crashes and burns
218− * due to overwritten text, page tables and data. So there is a
219− * choice between fire and frying pan. The result is pretty much
220− * the same. Chose frying pan until x86 provides a sane mechanism
221− * to park a CPU.
222− */
223− if (smp_park_other_cpus_in_init())
224− goto done;
225−
226− /*
227− * If park with INIT was not possible and the REBOOT_VECTOR didn't
228− * take all secondary CPUs offline, try with the NMI.
229− */
205+ /* if the REBOOT_VECTOR didn't work, try with the NMI */
230206 if (!cpumask_empty(&cpus_stop_mask)) {
231207 /*
232208 * If NMI IPI is enabled, try to register the stop handler
@@ -249,7 +225,6 @@ static void native_stop_other_cpus(int wait) · 16 unmodified lines
249225 udelay(1);
250226 }
251227
252−done:
253228 local_irq_save(flags);
254229 disable_local_APIC();
255230 mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
arch/x86/kernel/smpboot.c+0−27
@@ -1240,33 +1240,6 @@ void arch_thaw_secondary_cpus_end(void) · 1239 unmodified lines
12401240 cache_aps_init();
12411241 }
12421242
1243−bool smp_park_other_cpus_in_init(void)
1244−{
1245− unsigned int cpu, this_cpu = smp_processor_id();
1246− unsigned int apicid;
1247−
1248− if (apic->wakeup_secondary_cpu_64 || apic->wakeup_secondary_cpu)
1249− return false;
1250−
1251− /*
1252− * If this is a crash stop which does not execute on the boot CPU,
1253− * then this cannot use the INIT mechanism because INIT to the boot
1254− * CPU will reset the machine.
1255− */
1256− if (this_cpu)
1257− return false;
1258−
1259− for_each_cpu_and(cpu, &cpus_booted_once_mask, cpu_present_mask) {
1260− if (cpu == this_cpu)
1261− continue;
1262− apicid = apic->cpu_present_to_apicid(cpu);
1263− if (apicid == BAD_APICID)
1264− continue;
1265− send_init_sequence(apicid);
1266− }
1267− return true;
1268−}
1269−
12701243 /*
12711244 * Early setup to make printk work.
12721245 */
arch/x86/kernel/topology.c+1−1
@@ -54,7 +54,7 @@ void arch_unregister_cpu(int num) · 53 unmodified lines
5454 EXPORT_SYMBOL(arch_unregister_cpu);
5555 #else /* CONFIG_HOTPLUG_CPU */
5656
57−static int __init arch_register_cpu(int num)
57+int __init arch_register_cpu(int num)
5858 {
5959 return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
6060 }
block/fops.c+16−5
@@ -772,24 +772,35 @@ static long blkdev_fallocate(struct file *file, int mode, loff_t start, · 771 unmodified lines
772772
773773 filemap_invalidate_lock(inode->i_mapping);
774774
775− /* Invalidate the page cache, including dirty pages. */
776− error = truncate_bdev_range(bdev, file_to_blk_mode(file), start, end);
777− if (error)
778− goto fail;
779−
775+ /*
776+ * Invalidate the page cache, including dirty pages, for valid
777+ * de-allocate mode calls to fallocate().
778+ */
780779 switch (mode) {
781780 case FALLOC_FL_ZERO_RANGE:
782781 case FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE:
782+ error = truncate_bdev_range(bdev, file_to_blk_mode(file), start, end);
783+ if (error)
784+ goto fail;
785+
783786 error = blkdev_issue_zeroout(bdev, start >> SECTOR_SHIFT,
784787 len >> SECTOR_SHIFT, GFP_KERNEL,
785788 BLKDEV_ZERO_NOUNMAP);
786789 break;
787790 case FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE:
791+ error = truncate_bdev_range(bdev, file_to_blk_mode(file), start, end);
792+ if (error)
793+ goto fail;
794+
788795 error = blkdev_issue_zeroout(bdev, start >> SECTOR_SHIFT,
789796 len >> SECTOR_SHIFT, GFP_KERNEL,
790797 BLKDEV_ZERO_NOFALLBACK);
791798 break;
792799 case FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE | FALLOC_FL_NO_HIDE_STALE:
800+ error = truncate_bdev_range(bdev, file_to_blk_mode(file), start, end);
801+ if (error)
802+ goto fail;
803+
793804 error = blkdev_issue_discard(bdev, start >> SECTOR_SHIFT,
794805 len >> SECTOR_SHIFT, GFP_KERNEL);
795806 break;
drivers/acpi/acpi_processor.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #define pr_fmt(fmt) "ACPI: " fmt
1313
1414 #include <linux/acpi.h>
15+#include <linux/cpu.h>
1516 #include <linux/device.h>
1617 #include <linux/dmi.h>
1718 #include <linux/kernel.h>
drivers/acpi/ec.c+11−0
@@ -1913,6 +1913,17 @@ static const struct dmi_system_id ec_dmi_table[] __initconst = { · 1912 unmodified lines
19131913 DMI_MATCH(DMI_PRODUCT_NAME, "HP 15-cx0041ur"),
19141914 },
19151915 },
1916+ {
1917+ /*
1918+ * HP Pavilion Gaming Laptop 15-dk1xxx
1919+ * https://github.com/systemd/systemd/issues/28942
1920+ */
1921+ .callback = ec_honor_dsdt_gpe,
1922+ .matches = {
1923+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),
1924+ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Gaming Laptop 15-dk1xxx"),
1925+ },
1926+ },
19161927 {
19171928 /*
19181929 * Samsung hardware
drivers/acpi/nfit/core.c+1−1
@@ -855,7 +855,7 @@ static size_t sizeof_idt(struct acpi_nfit_interleave *idt) · 854 unmodified lines
855855 {
856856 if (idt->header.length < sizeof(*idt))
857857 return 0;
858− return sizeof(*idt) + sizeof(u32) * (idt->line_count - 1);
858+ return sizeof(*idt) + sizeof(u32) * idt->line_count;
859859 }
860860
861861 static bool add_idt(struct acpi_nfit_desc *acpi_desc,
drivers/acpi/processor_idle.c+1−2
@@ -1217,8 +1217,7 @@ static int acpi_processor_setup_lpi_states(struct acpi_processor *pr) · 1216 unmodified lines
12171217 strscpy(state->desc, lpi->desc, CPUIDLE_DESC_LEN);
12181218 state->exit_latency = lpi->wake_latency;
12191219 state->target_residency = lpi->min_residency;
1220− if (lpi->arch_flags)
1221− state->flags |= CPUIDLE_FLAG_TIMER_STOP;
1220+ state->flags |= arch_get_idle_state_flags(lpi->arch_flags);
12221221 if (i != 0 && lpi->entry_method == ACPI_CSTATE_FFH)
12231222 state->flags |= CPUIDLE_FLAG_RCU_IDLE;
12241223 state->enter = acpi_idle_lpi_enter;
drivers/acpi/resource.c+20−6
@@ -439,6 +439,13 @@ static const struct dmi_system_id asus_laptop[] = { · 438 unmodified lines
439439 DMI_MATCH(DMI_BOARD_NAME, "S5602ZA"),
440440 },
441441 },
442+ {
443+ .ident = "Asus ExpertBook B1402CBA",
444+ .matches = {
445+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
446+ DMI_MATCH(DMI_BOARD_NAME, "B1402CBA"),
447+ },
448+ },
442449 {
443450 .ident = "Asus ExpertBook B1502CBA",
444451 .matches = {
@@ -500,16 +507,23 @@ static const struct dmi_system_id maingear_laptop[] = { · 55 unmodified lines
500507
501508 static const struct dmi_system_id pcspecialist_laptop[] = {
502509 {
503− .ident = "PCSpecialist Elimina Pro 16 M",
504− /*
505− * Some models have product-name "Elimina Pro 16 M",
506− * others "GM6BGEQ". Match on board-name to match both.
507− */
510+ /* TongFang GM6BGEQ / PCSpecialist Elimina Pro 16 M, RTX 3050 */
508511 .matches = {
509− DMI_MATCH(DMI_SYS_VENDOR, "PCSpecialist"),
510512 DMI_MATCH(DMI_BOARD_NAME, "GM6BGEQ"),
511513 },
512514 },
515+ {
516+ /* TongFang GM6BG5Q, RTX 4050 */
517+ .matches = {
518+ DMI_MATCH(DMI_BOARD_NAME, "GM6BG5Q"),
519+ },
520+ },
521+ {
522+ /* TongFang GM6BG0Q / PCSpecialist Elimina Pro 16 M, RTX 4060 */
523+ .matches = {
524+ DMI_MATCH(DMI_BOARD_NAME, "GM6BG0Q"),
525+ },
526+ },
513527 { }
514528 };
515529
drivers/android/binder.c+2−0
@@ -4812,6 +4812,8 @@ static void binder_release_work(struct binder_proc *proc, · 4811 unmodified lines
48124812 "undelivered TRANSACTION_ERROR: %u\n",
48134813 e->cmd);
48144814 } break;
4815+ case BINDER_WORK_TRANSACTION_PENDING:
4816+ case BINDER_WORK_TRANSACTION_ONEWAY_SPAM_SUSPECT:
48154817 case BINDER_WORK_TRANSACTION_COMPLETE: {
48164818 binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
48174819 "undelivered TRANSACTION_COMPLETE\n");
drivers/ata/pata_parport/fit3.c+2−12
@@ -9,11 +9,6 @@ · 8 unmodified lines
99 *
1010 * The TD-2000 and certain older devices use a different protocol.
1111 * Try the fit2 protocol module with them.
12− *
13− * NB: The FIT adapters do not appear to support the control
14− * registers. So, we map ALT_STATUS to STATUS and NO-OP writes
15− * to the device control register - this means that IDE reset
16− * will not work on these devices.
1712 */
1813
1914 #include <linux/module.h>
@@ -37,8 +32,7 @@ · 17 unmodified lines
3732
3833 static void fit3_write_regr(struct pi_adapter *pi, int cont, int regr, int val)
3934 {
40− if (cont == 1)
41− return;
35+ regr += cont << 3;
4236
4337 switch (pi->mode) {
4438 case 0:
@@ -59,11 +53,7 @@ static int fit3_read_regr(struct pi_adapter *pi, int cont, int regr) · 14 unmodified lines
5953 {
6054 int a, b;
6155
62− if (cont) {
63− if (regr != 6)
64− return 0xff;
65− regr = 7;
66− }
56+ regr += cont << 3;
6757
6858 switch (pi->mode) {
6959 case 0:
drivers/ata/pata_parport/pata_parport.c+76−2
@@ -51,6 +51,13 @@ static void pata_parport_dev_select(struct ata_port *ap, unsigned int device) · 50 unmodified lines
5151 ata_sff_pause(ap);
5252 }
5353
54+static void pata_parport_set_devctl(struct ata_port *ap, u8 ctl)
55+{
56+ struct pi_adapter *pi = ap->host->private_data;
57+
58+ pi->proto->write_regr(pi, 1, 6, ctl);
59+}
60+
5461 static bool pata_parport_devchk(struct ata_port *ap, unsigned int device)
5562 {
5663 struct pi_adapter *pi = ap->host->private_data;
@@ -64,7 +71,7 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device) · 7 unmodified lines
6471 pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0xaa);
6572 pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0x55);
6673
67− pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 055);
74+ pi->proto->write_regr(pi, 0, ATA_REG_NSECT, 0x55);
6875 pi->proto->write_regr(pi, 0, ATA_REG_LBAL, 0xaa);
6976
7077 nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT);
@@ -73,6 +80,72 @@ static bool pata_parport_devchk(struct ata_port *ap, unsigned int device) · 2 unmodified lines
7380 return (nsect == 0x55) && (lbal == 0xaa);
7481 }
7582
83+static int pata_parport_wait_after_reset(struct ata_link *link,
84+ unsigned int devmask,
85+ unsigned long deadline)
86+{
87+ struct ata_port *ap = link->ap;
88+ struct pi_adapter *pi = ap->host->private_data;
89+ unsigned int dev0 = devmask & (1 << 0);
90+ unsigned int dev1 = devmask & (1 << 1);
91+ int rc, ret = 0;
92+
93+ ata_msleep(ap, ATA_WAIT_AFTER_RESET);
94+
95+ /* always check readiness of the master device */
96+ rc = ata_sff_wait_ready(link, deadline);
97+ if (rc) {
98+ /*
99+ * some adapters return bogus values if master device is not
100+ * present, so don't abort now if a slave device is present
101+ */
102+ if (!dev1)
103+ return rc;
104+ ret = -ENODEV;
105+ }
106+
107+ /*
108+ * if device 1 was found in ata_devchk, wait for register
109+ * access briefly, then wait for BSY to clear.
110+ */
111+ if (dev1) {
112+ int i;
113+
114+ pata_parport_dev_select(ap, 1);
115+
116+ /*
117+ * Wait for register access. Some ATAPI devices fail
118+ * to set nsect/lbal after reset, so don't waste too
119+ * much time on it. We're gonna wait for !BSY anyway.
120+ */
121+ for (i = 0; i < 2; i++) {
122+ u8 nsect, lbal;
123+
124+ nsect = pi->proto->read_regr(pi, 0, ATA_REG_NSECT);
125+ lbal = pi->proto->read_regr(pi, 0, ATA_REG_LBAL);
126+ if (nsect == 1 && lbal == 1)
127+ break;
128+ /* give drive a breather */
129+ ata_msleep(ap, 50);
130+ }
131+
132+ rc = ata_sff_wait_ready(link, deadline);
133+ if (rc) {
134+ if (rc != -ENODEV)
135+ return rc;
136+ ret = rc;
137+ }
138+ }
139+
140+ pata_parport_dev_select(ap, 0);
141+ if (dev1)
142+ pata_parport_dev_select(ap, 1);
143+ if (dev0)
144+ pata_parport_dev_select(ap, 0);
145+
146+ return ret;
147+}
148+
76149 static int pata_parport_bus_softreset(struct ata_port *ap, unsigned int devmask,
77150 unsigned long deadline)
78151 {
@@ -87,7 +160,7 @@ static int pata_parport_bus_softreset(struct ata_port *ap, unsigned int devmask, · 8 unmodified lines
87160 ap->last_ctl = ap->ctl;
88161
89162 /* wait the port to become ready */
90− return ata_sff_wait_after_reset(&ap->link, devmask, deadline);
163+ return pata_parport_wait_after_reset(&ap->link, devmask, deadline);
91164 }
92165
93166 static int pata_parport_softreset(struct ata_link *link, unsigned int *classes,
@@ -252,6 +325,7 @@ static struct ata_port_operations pata_parport_port_ops = { · 158 unmodified lines
252325 .hardreset = NULL,
253326
254327 .sff_dev_select = pata_parport_dev_select,
328+ .sff_set_devctl = pata_parport_set_devctl,
255329 .sff_check_status = pata_parport_check_status,
256330 .sff_check_altstatus = pata_parport_check_altstatus,
257331 .sff_tf_load = pata_parport_tf_load,
drivers/base/regmap/regcache-rbtree.c+2−1
@@ -453,7 +453,8 @@ static int regcache_rbtree_write(struct regmap *map, unsigned int reg, · 452 unmodified lines
453453 if (!rbnode)
454454 return -ENOMEM;
455455 regcache_rbtree_set_register(map, rbnode,
456− reg - rbnode->base_reg, value);
456+ (reg - rbnode->base_reg) / map->reg_stride,
457+ value);
457458 regcache_rbtree_insert(map, &rbtree_ctx->root, rbnode);
458459 rbtree_ctx->cached_rbnode = rbnode;
459460 }
drivers/block/nbd.c+2−1
@@ -1436,8 +1436,9 @@ static int nbd_start_device_ioctl(struct nbd_device *nbd) · 1435 unmodified lines
14361436
14371437 static void nbd_clear_sock_ioctl(struct nbd_device *nbd)
14381438 {
1439− blk_mark_disk_dead(nbd->disk);
14401439 nbd_clear_sock(nbd);
1440+ disk_force_media_change(nbd->disk);
1441+ nbd_bdev_reset(nbd);
14411442 if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF,
14421443 &nbd->config->runtime_flags))
14431444 nbd_config_put(nbd);
drivers/bluetooth/btusb.c+1−0
@@ -4419,6 +4419,7 @@ static int btusb_probe(struct usb_interface *intf, · 4418 unmodified lines
44194419
44204420 if (id->driver_info & BTUSB_QCA_ROME) {
44214421 data->setup_on_usb = btusb_setup_qca;
4422+ hdev->shutdown = btusb_shutdown_qca;
44224423 hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
44234424 hdev->cmd_timeout = btusb_qca_cmd_timeout;
44244425 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);
drivers/counter/counter-chrdev.c+2−2
@@ -247,8 +247,8 @@ static int counter_get_ext(const struct counter_comp *const ext, · 246 unmodified lines
247247 if (*id == component_id)
248248 return 0;
249249
250− if (ext->type == COUNTER_COMP_ARRAY) {
251− element = ext->priv;
250+ if (ext[*ext_idx].type == COUNTER_COMP_ARRAY) {
251+ element = ext[*ext_idx].priv;
252252
253253 if (component_id - *id < element->length)
254254 return 0;
drivers/counter/microchip-tcb-capture.c+1−1
@@ -97,7 +97,7 @@ static int mchp_tc_count_function_write(struct counter_device *counter, · 96 unmodified lines
9797 priv->qdec_mode = 0;
9898 /* Set highest rate based on whether soc has gclk or not */
9999 bmr &= ~(ATMEL_TC_QDEN | ATMEL_TC_POSEN);
100− if (priv->tc_cfg->has_gclk)
100+ if (!priv->tc_cfg->has_gclk)
101101 cmr |= ATMEL_TC_TIMER_CLOCK2;
102102 else
103103 cmr |= ATMEL_TC_TIMER_CLOCK1;
drivers/dma-buf/dma-fence-unwrap.c+4−9
@@ -76,16 +76,11 @@ struct dma_fence *__dma_fence_unwrap_merge(unsigned int num_fences, · 75 unmodified lines
7676 dma_fence_unwrap_for_each(tmp, &iter[i], fences[i]) {
7777 if (!dma_fence_is_signaled(tmp)) {
7878 ++count;
79− } else if (test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT,
80− &tmp->flags)) {
81− if (ktime_after(tmp->timestamp, timestamp))
82− timestamp = tmp->timestamp;
8379 } else {
84− /*
85− * Use the current time if the fence is
86− * currently signaling.
87− */
88− timestamp = ktime_get();
80+ ktime_t t = dma_fence_timestamp(tmp);
81+
82+ if (ktime_after(t, timestamp))
83+ timestamp = t;
8984 }
9085 }
9186 }
drivers/dma-buf/sync_file.c+3−6
@@ -268,13 +268,10 @@ static int sync_fill_fence_info(struct dma_fence *fence, · 267 unmodified lines
268268 sizeof(info->driver_name));
269269
270270 info->status = dma_fence_get_status(fence);
271− while (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags) &&
272− !test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
273− cpu_relax();
274271 info->timestamp_ns =
275− test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags) ?
276− ktime_to_ns(fence->timestamp) :
277− ktime_set(0, 0);
272+ dma_fence_is_signaled(fence) ?
273+ ktime_to_ns(dma_fence_timestamp(fence)) :
274+ ktime_set(0, 0);
278275
279276 return info->status;
280277 }
drivers/dma/fsl-edma-common.c+22−3
@@ -92,8 +92,14 @@ static void fsl_edma3_enable_request(struct fsl_edma_chan *fsl_chan) · 91 unmodified lines
9292
9393 edma_writel_chreg(fsl_chan, val, ch_sbr);
9494
95− if (flags & FSL_EDMA_DRV_HAS_CHMUX)
96− edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux);
95+ if (flags & FSL_EDMA_DRV_HAS_CHMUX) {
96+ /*
97+ * ch_mux: With the exception of 0, attempts to write a value
98+ * already in use will be forced to 0.
99+ */
100+ if (!edma_readl_chreg(fsl_chan, ch_mux))
101+ edma_writel_chreg(fsl_chan, fsl_chan->srcid, ch_mux);
102+ }
97103
98104 val = edma_readl_chreg(fsl_chan, ch_csr);
99105 val |= EDMA_V3_CH_CSR_ERQ;
@@ -448,12 +454,25 @@ static void fsl_edma_set_tcd_regs(struct fsl_edma_chan *fsl_chan, · 348 unmodified lines
448454
449455 edma_write_tcdreg(fsl_chan, tcd->dlast_sga, dlast_sga);
450456
457+ csr = le16_to_cpu(tcd->csr);
458+
451459 if (fsl_chan->is_sw) {
452− csr = le16_to_cpu(tcd->csr);
453460 csr |= EDMA_TCD_CSR_START;
454461 tcd->csr = cpu_to_le16(csr);
455462 }
456463
464+ /*
465+ * Must clear CHn_CSR[DONE] bit before enable TCDn_CSR[ESG] at EDMAv3
466+ * eDMAv4 have not such requirement.
467+ * Change MLINK need clear CHn_CSR[DONE] for both eDMAv3 and eDMAv4.
468+ */
469+ if (((fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_CLEAR_DONE_E_SG) &&
470+ (csr & EDMA_TCD_CSR_E_SG)) ||
471+ ((fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_CLEAR_DONE_E_LINK) &&
472+ (csr & EDMA_TCD_CSR_E_LINK)))
473+ edma_writel_chreg(fsl_chan, edma_readl_chreg(fsl_chan, ch_csr), ch_csr);
474+
475+
457476 edma_write_tcdreg(fsl_chan, tcd->csr, csr);
458477 }
459478
drivers/dma/fsl-edma-common.h+13−1
@@ -183,11 +183,23 @@ struct fsl_edma_desc { · 182 unmodified lines
183183 #define FSL_EDMA_DRV_BUS_8BYTE BIT(10)
184184 #define FSL_EDMA_DRV_DEV_TO_DEV BIT(11)
185185 #define FSL_EDMA_DRV_ALIGN_64BYTE BIT(12)
186+/* Need clean CHn_CSR DONE before enable TCD's ESG */
187+#define FSL_EDMA_DRV_CLEAR_DONE_E_SG BIT(13)
188+/* Need clean CHn_CSR DONE before enable TCD's MAJORELINK */
189+#define FSL_EDMA_DRV_CLEAR_DONE_E_LINK BIT(14)
186190
187191 #define FSL_EDMA_DRV_EDMA3 (FSL_EDMA_DRV_SPLIT_REG | \
188192 FSL_EDMA_DRV_BUS_8BYTE | \
189193 FSL_EDMA_DRV_DEV_TO_DEV | \
190− FSL_EDMA_DRV_ALIGN_64BYTE)
194+ FSL_EDMA_DRV_ALIGN_64BYTE | \
195+ FSL_EDMA_DRV_CLEAR_DONE_E_SG | \
196+ FSL_EDMA_DRV_CLEAR_DONE_E_LINK)
197+
198+#define FSL_EDMA_DRV_EDMA4 (FSL_EDMA_DRV_SPLIT_REG | \
199+ FSL_EDMA_DRV_BUS_8BYTE | \
200+ FSL_EDMA_DRV_DEV_TO_DEV | \
201+ FSL_EDMA_DRV_ALIGN_64BYTE | \
202+ FSL_EDMA_DRV_CLEAR_DONE_E_LINK)
191203
192204 struct fsl_edma_drvdata {
193205 u32 dmamuxs; /* only used before v3 */
drivers/dma/fsl-edma-main.c+5−3
@@ -154,18 +154,20 @@ static struct dma_chan *fsl_edma3_xlate(struct of_phandle_args *dma_spec, · 153 unmodified lines
154154 fsl_chan = to_fsl_edma_chan(chan);
155155 i = fsl_chan - fsl_edma->chans;
156156
157− chan = dma_get_slave_channel(chan);
158− chan->device->privatecnt++;
159157 fsl_chan->priority = dma_spec->args[1];
160158 fsl_chan->is_rxchan = dma_spec->args[2] & ARGS_RX;
161159 fsl_chan->is_remote = dma_spec->args[2] & ARGS_REMOTE;
162160 fsl_chan->is_multi_fifo = dma_spec->args[2] & ARGS_MULTI_FIFO;
163161
164162 if (!b_chmux && i == dma_spec->args[0]) {
163+ chan = dma_get_slave_channel(chan);
164+ chan->device->privatecnt++;
165165 mutex_unlock(&fsl_edma->fsl_edma_mutex);
166166 return chan;
167167 } else if (b_chmux && !fsl_chan->srcid) {
168168 /* if controller support channel mux, choose a free channel */
169+ chan = dma_get_slave_channel(chan);
170+ chan->device->privatecnt++;
169171 fsl_chan->srcid = dma_spec->args[0];
170172 mutex_unlock(&fsl_edma->fsl_edma_mutex);
171173 return chan;
@@ -355,7 +357,7 @@ static struct fsl_edma_drvdata imx93_data3 = { · 183 unmodified lines
355357 };
356358
357359 static struct fsl_edma_drvdata imx93_data4 = {
358− .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA3,
360+ .flags = FSL_EDMA_DRV_HAS_CHMUX | FSL_EDMA_DRV_HAS_DMACLK | FSL_EDMA_DRV_EDMA4,
359361 .chreg_space_sz = 0x8000,
360362 .chreg_off = 0x10000,
361363 .setup_irq = fsl_edma3_irq_init,
drivers/dma/idxd/device.c+3−2
@@ -477,6 +477,7 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand, · 476 unmodified lines
477477 union idxd_command_reg cmd;
478478 DECLARE_COMPLETION_ONSTACK(done);
479479 u32 stat;
480+ unsigned long flags;
480481
481482 if (idxd_device_is_halted(idxd)) {
482483 dev_warn(&idxd->pdev->dev, "Device is HALTED!\n");
@@ -490,7 +491,7 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand, · 7 unmodified lines
490491 cmd.operand = operand;
491492 cmd.int_req = 1;
492493
493− spin_lock(&idxd->cmd_lock);
494+ spin_lock_irqsave(&idxd->cmd_lock, flags);
494495 wait_event_lock_irq(idxd->cmd_waitq,
495496 !test_bit(IDXD_FLAG_CMD_RUNNING, &idxd->flags),
496497 idxd->cmd_lock);
@@ -507,7 +508,7 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand, · 10 unmodified lines
507508 * After command submitted, release lock and go to sleep until
508509 * the command completes via interrupt.
509510 */
510− spin_unlock(&idxd->cmd_lock);
511+ spin_unlock_irqrestore(&idxd->cmd_lock, flags);
511512 wait_for_completion(&done);
512513 stat = ioread32(idxd->reg_base + IDXD_CMDSTS_OFFSET);
513514 spin_lock(&idxd->cmd_lock);
drivers/dma/mediatek/mtk-uart-apdma.c+1−2
@@ -450,9 +450,8 @@ static int mtk_uart_apdma_device_pause(struct dma_chan *chan) · 449 unmodified lines
450450 mtk_uart_apdma_write(c, VFF_EN, VFF_EN_CLR_B);
451451 mtk_uart_apdma_write(c, VFF_INT_EN, VFF_INT_EN_CLR_B);
452452
453− synchronize_irq(c->irq);
454−
455453 spin_unlock_irqrestore(&c->vc.lock, flags);
454+ synchronize_irq(c->irq);
456455
457456 return 0;
458457 }
drivers/dma/ste_dma40.c+1−0
@@ -3668,6 +3668,7 @@ static int __init d40_probe(struct platform_device *pdev) · 3667 unmodified lines
36683668 regulator_disable(base->lcpa_regulator);
36693669 regulator_put(base->lcpa_regulator);
36703670 }
3671+ pm_runtime_disable(base->dev);
36713672
36723673 report_failure:
36733674 d40_err(dev, "probe failed\n");
drivers/dma/stm32-dma.c+7−4
@@ -1113,8 +1113,10 @@ static struct dma_async_tx_descriptor *stm32_dma_prep_slave_sg( · 1112 unmodified lines
11131113 chan->chan_reg.dma_scr &= ~STM32_DMA_SCR_PFCTRL;
11141114
11151115 /* Activate Double Buffer Mode if DMA triggers STM32 MDMA and more than 1 sg */
1116− if (chan->trig_mdma && sg_len > 1)
1116+ if (chan->trig_mdma && sg_len > 1) {
11171117 chan->chan_reg.dma_scr |= STM32_DMA_SCR_DBM;
1118+ chan->chan_reg.dma_scr &= ~STM32_DMA_SCR_CT;
1119+ }
11181120
11191121 for_each_sg(sgl, sg, sg_len, i) {
11201122 ret = stm32_dma_set_xfer_param(chan, direction, &buswidth,
@@ -1387,11 +1389,12 @@ static size_t stm32_dma_desc_residue(struct stm32_dma_chan *chan, · 266 unmodified lines
13871389
13881390 residue = stm32_dma_get_remaining_bytes(chan);
13891391
1390− if (chan->desc->cyclic && !stm32_dma_is_current_sg(chan)) {
1392+ if ((chan->desc->cyclic || chan->trig_mdma) && !stm32_dma_is_current_sg(chan)) {
13911393 n_sg++;
13921394 if (n_sg == chan->desc->num_sgs)
13931395 n_sg = 0;
1394− residue = sg_req->len;
1396+ if (!chan->trig_mdma)
1397+ residue = sg_req->len;
13951398 }
13961399
13971400 /*
@@ -1401,7 +1404,7 @@ static size_t stm32_dma_desc_residue(struct stm32_dma_chan *chan, · 3 unmodified lines
14011404 * residue = remaining bytes from NDTR + remaining
14021405 * periods/sg to be transferred
14031406 */
1404− if (!chan->desc->cyclic || n_sg != 0)
1407+ if ((!chan->desc->cyclic && !chan->trig_mdma) || n_sg != 0)
14051408 for (i = n_sg; i < desc->num_sgs; i++)
14061409 residue += desc->sg_req[i].len;
14071410
drivers/dma/stm32-mdma.c+24−9
@@ -777,8 +777,6 @@ static int stm32_mdma_setup_xfer(struct stm32_mdma_chan *chan, · 776 unmodified lines
777777 /* Enable interrupts */
778778 ccr &= ~STM32_MDMA_CCR_IRQ_MASK;
779779 ccr |= STM32_MDMA_CCR_TEIE | STM32_MDMA_CCR_CTCIE;
780− if (sg_len > 1)
781− ccr |= STM32_MDMA_CCR_BTIE;
782780 desc->ccr = ccr;
783781
784782 return 0;
@@ -1236,6 +1234,10 @@ static int stm32_mdma_resume(struct dma_chan *c) · 451 unmodified lines
12361234 unsigned long flags;
12371235 u32 status, reg;
12381236
1237+ /* Transfer can be terminated */
1238+ if (!chan->desc || (stm32_mdma_read(dmadev, STM32_MDMA_CCR(chan->id)) & STM32_MDMA_CCR_EN))
1239+ return -EPERM;
1240+
12391241 hwdesc = chan->desc->node[chan->curr_hwdesc].hwdesc;
12401242
12411243 spin_lock_irqsave(&chan->vchan.lock, flags);
@@ -1316,21 +1318,35 @@ static int stm32_mdma_slave_config(struct dma_chan *c, · 74 unmodified lines
13161318
13171319 static size_t stm32_mdma_desc_residue(struct stm32_mdma_chan *chan,
13181320 struct stm32_mdma_desc *desc,
1319− u32 curr_hwdesc)
1321+ u32 curr_hwdesc,
1322+ struct dma_tx_state *state)
13201323 {
13211324 struct stm32_mdma_device *dmadev = stm32_mdma_get_dev(chan);
13221325 struct stm32_mdma_hwdesc *hwdesc;
1323− u32 cbndtr, residue, modulo, burst_size;
1326+ u32 cisr, clar, cbndtr, residue, modulo, burst_size;
13241327 int i;
13251328
1329+ cisr = stm32_mdma_read(dmadev, STM32_MDMA_CISR(chan->id));
1330+
13261331 residue = 0;
1327− for (i = curr_hwdesc + 1; i < desc->count; i++) {
1332+ /* Get the next hw descriptor to process from current transfer */
1333+ clar = stm32_mdma_read(dmadev, STM32_MDMA_CLAR(chan->id));
1334+ for (i = desc->count - 1; i >= 0; i--) {
13281335 hwdesc = desc->node[i].hwdesc;
1336+
1337+ if (hwdesc->clar == clar)
1338+ break;/* Current transfer found, stop cumulating */
1339+
1340+ /* Cumulate residue of unprocessed hw descriptors */
13291341 residue += STM32_MDMA_CBNDTR_BNDT(hwdesc->cbndtr);
13301342 }
13311343 cbndtr = stm32_mdma_read(dmadev, STM32_MDMA_CBNDTR(chan->id));
13321344 residue += cbndtr & STM32_MDMA_CBNDTR_BNDT_MASK;
13331345
1346+ state->in_flight_bytes = 0;
1347+ if (chan->chan_config.m2m_hw && (cisr & STM32_MDMA_CISR_CRQA))
1348+ state->in_flight_bytes = cbndtr & STM32_MDMA_CBNDTR_BNDT_MASK;
1349+
13341350 if (!chan->mem_burst)
13351351 return residue;
13361352
@@ -1360,11 +1376,10 @@ static enum dma_status stm32_mdma_tx_status(struct dma_chan *c, · 23 unmodified lines
13601376
13611377 vdesc = vchan_find_desc(&chan->vchan, cookie);
13621378 if (chan->desc && cookie == chan->desc->vdesc.tx.cookie)
1363− residue = stm32_mdma_desc_residue(chan, chan->desc,
1364− chan->curr_hwdesc);
1379+ residue = stm32_mdma_desc_residue(chan, chan->desc, chan->curr_hwdesc, state);
13651380 else if (vdesc)
1366− residue = stm32_mdma_desc_residue(chan,
1367− to_stm32_mdma_desc(vdesc), 0);
1381+ residue = stm32_mdma_desc_residue(chan, to_stm32_mdma_desc(vdesc), 0, state);
1382+
13681383 dma_set_residue(state, residue);
13691384
13701385 spin_unlock_irqrestore(&chan->vchan.lock, flags);
drivers/dma/ti/k3-udma-glue.c+3−0
@@ -558,6 +558,9 @@ int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel *tx_chn) · 557 unmodified lines
558558 tx_chn->virq = k3_ringacc_get_ring_irq_num(tx_chn->ringtxcq);
559559 }
560560
561+ if (!tx_chn->virq)
562+ return -ENXIO;
563+
561564 return tx_chn->virq;
562565 }
563566 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq);
drivers/gpio/gpio-aspeed.c+1−1
@@ -973,7 +973,7 @@ static int aspeed_gpio_set_config(struct gpio_chip *chip, unsigned int offset, · 972 unmodified lines
973973 else if (param == PIN_CONFIG_BIAS_DISABLE ||
974974 param == PIN_CONFIG_BIAS_PULL_DOWN ||
975975 param == PIN_CONFIG_DRIVE_STRENGTH)
976− return pinctrl_gpio_set_config(offset, config);
976+ return pinctrl_gpio_set_config(chip->base + offset, config);
977977 else if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN ||
978978 param == PIN_CONFIG_DRIVE_OPEN_SOURCE)
979979 /* Return -ENOTSUPP to trigger emulation, as per datasheet */
drivers/gpio/gpio-pxa.c+1−0
@@ -237,6 +237,7 @@ static bool pxa_gpio_has_pinctrl(void) · 236 unmodified lines
237237 switch (gpio_type) {
238238 case PXA3XX_GPIO:
239239 case MMP2_GPIO:
240+ case MMP_GPIO:
240241 return false;
241242
242243 default:
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+1−1
@@ -2093,7 +2093,7 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) · 2092 unmodified lines
20932093 adev->flags |= AMD_IS_PX;
20942094
20952095 if (!(adev->flags & AMD_IS_APU)) {
2096− parent = pci_upstream_bridge(adev->pdev);
2096+ parent = pcie_find_root_port(adev->pdev);
20972097 adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
20982098 }
20992099
drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell_mgr.c+4−0
@@ -142,6 +142,10 @@ int amdgpu_doorbell_create_kernel_doorbells(struct amdgpu_device *adev) · 141 unmodified lines
142142 int r;
143143 int size;
144144
145+ /* SI HW does not have doorbells, skip allocation */
146+ if (adev->doorbell.num_kernel_doorbells == 0)
147+ return 0;
148+
145149 /* Reserve first num_kernel_doorbells (page-aligned) for kernel ops */
146150 size = ALIGN(adev->doorbell.num_kernel_doorbells * sizeof(u32), PAGE_SIZE);
147151
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c+1−0
@@ -170,6 +170,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 169 unmodified lines
170170 csum += pia[size - 1];
171171 if (csum) {
172172 DRM_ERROR("Bad Product Info Area checksum: 0x%02x", csum);
173+ kfree(pia);
173174 return -EIO;
174175 }
175176
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h+1−1
@@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo) · 251 unmodified lines
252252 struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
253253 struct amdgpu_res_cursor cursor;
254254
255− if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
255+ if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
256256 return false;
257257
258258 amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn20/dcn20_clk_mgr.c+2−2
@@ -157,7 +157,7 @@ void dcn20_update_clocks_update_dentist(struct clk_mgr_internal *clk_mgr, struct · 156 unmodified lines
157157 int32_t N;
158158 int32_t j;
159159
160− if (!pipe_ctx->stream)
160+ if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER))
161161 continue;
162162 /* Virtual encoders don't have this function */
163163 if (!stream_enc->funcs->get_fifo_cal_average_level)
@@ -188,7 +188,7 @@ void dcn20_update_clocks_update_dentist(struct clk_mgr_internal *clk_mgr, struct · 24 unmodified lines
188188 int32_t N;
189189 int32_t j;
190190
191− if (!pipe_ctx->stream)
191+ if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER))
192192 continue;
193193 /* Virtual encoders don't have this function */
194194 if (!stream_enc->funcs->get_fifo_cal_average_level)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c+2−2
@@ -355,7 +355,7 @@ static void dcn32_update_clocks_update_dentist( · 354 unmodified lines
355355 int32_t N;
356356 int32_t j;
357357
358− if (!pipe_ctx->stream)
358+ if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER))
359359 continue;
360360 /* Virtual encoders don't have this function */
361361 if (!stream_enc->funcs->get_fifo_cal_average_level)
@@ -401,7 +401,7 @@ static void dcn32_update_clocks_update_dentist( · 39 unmodified lines
401401 int32_t N;
402402 int32_t j;
403403
404− if (!pipe_ctx->stream)
404+ if (!resource_is_pipe_type(pipe_ctx, OTG_MASTER))
405405 continue;
406406 /* Virtual encoders don't have this function */
407407 if (!stream_enc->funcs->get_fifo_cal_average_level)
drivers/gpu/drm/amd/display/dc/core/dc.c+3−0
@@ -1262,6 +1262,9 @@ static void disable_vbios_mode_if_required( · 1261 unmodified lines
12621262 if (stream == NULL)
12631263 continue;
12641264
1265+ if (stream->apply_seamless_boot_optimization)
1266+ continue;
1267+
12651268 // only looking for first odm pipe
12661269 if (pipe->prev_odm_pipe)
12671270 continue;
drivers/gpu/drm/amd/pm/amdgpu_pm.c+1−0
@@ -2040,6 +2040,7 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ · 2039 unmodified lines
20402040 case IP_VERSION(11, 0, 0):
20412041 case IP_VERSION(11, 0, 1):
20422042 case IP_VERSION(11, 0, 2):
2043+ case IP_VERSION(11, 0, 3):
20432044 *states = ATTR_STATE_SUPPORTED;
20442045 break;
20452046 default:
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c+23−18
@@ -2082,36 +2082,41 @@ static int sienna_cichlid_display_disable_memory_clock_switch(struct smu_context · 2081 unmodified lines
20822082 return ret;
20832083 }
20842084
2085+#define MAX(a, b) ((a) > (b) ? (a) : (b))
2086+
20852087 static int sienna_cichlid_update_pcie_parameters(struct smu_context *smu,
20862088 uint32_t pcie_gen_cap,
20872089 uint32_t pcie_width_cap)
20882090 {
20892091 struct smu_11_0_dpm_context *dpm_context = smu->smu_dpm.dpm_context;
20902092 struct smu_11_0_pcie_table *pcie_table = &dpm_context->dpm_tables.pcie_table;
2091− u32 smu_pcie_arg;
2093+ uint8_t *table_member1, *table_member2;
2094+ uint32_t min_gen_speed, max_gen_speed;
2095+ uint32_t min_lane_width, max_lane_width;
2096+ uint32_t smu_pcie_arg;
20922097 int ret, i;
20932098
2094− /* PCIE gen speed and lane width override */
2095− if (!amdgpu_device_pcie_dynamic_switching_supported()) {
2096− if (pcie_table->pcie_gen[NUM_LINK_LEVELS - 1] < pcie_gen_cap)
2097− pcie_gen_cap = pcie_table->pcie_gen[NUM_LINK_LEVELS - 1];
2099+ GET_PPTABLE_MEMBER(PcieGenSpeed, &table_member1);
2100+ GET_PPTABLE_MEMBER(PcieLaneCount, &table_member2);
20982101
2099− if (pcie_table->pcie_lane[NUM_LINK_LEVELS - 1] < pcie_width_cap)
2100− pcie_width_cap = pcie_table->pcie_lane[NUM_LINK_LEVELS - 1];
2102+ min_gen_speed = MAX(0, table_member1[0]);
2103+ max_gen_speed = MIN(pcie_gen_cap, table_member1[1]);
2104+ min_gen_speed = min_gen_speed > max_gen_speed ?
2105+ max_gen_speed : min_gen_speed;
2106+ min_lane_width = MAX(1, table_member2[0]);
2107+ max_lane_width = MIN(pcie_width_cap, table_member2[1]);
2108+ min_lane_width = min_lane_width > max_lane_width ?
2109+ max_lane_width : min_lane_width;
21012110
2102− /* Force all levels to use the same settings */
2103− for (i = 0; i < NUM_LINK_LEVELS; i++) {
2104− pcie_table->pcie_gen[i] = pcie_gen_cap;
2105− pcie_table->pcie_lane[i] = pcie_width_cap;
2106− }
2111+ if (!amdgpu_device_pcie_dynamic_switching_supported()) {
2112+ pcie_table->pcie_gen[0] = max_gen_speed;
2113+ pcie_table->pcie_lane[0] = max_lane_width;
21072114 } else {
2108− for (i = 0; i < NUM_LINK_LEVELS; i++) {
2109− if (pcie_table->pcie_gen[i] > pcie_gen_cap)
2110− pcie_table->pcie_gen[i] = pcie_gen_cap;
2111− if (pcie_table->pcie_lane[i] > pcie_width_cap)
2112− pcie_table->pcie_lane[i] = pcie_width_cap;
2113− }
2115+ pcie_table->pcie_gen[0] = min_gen_speed;
2116+ pcie_table->pcie_lane[0] = min_lane_width;
21142117 }
2118+ pcie_table->pcie_gen[1] = max_gen_speed;
2119+ pcie_table->pcie_lane[1] = max_lane_width;
21152120
21162121 for (i = 0; i < NUM_LINK_LEVELS; i++) {
21172122 smu_pcie_arg = (i << 16 |
drivers/gpu/drm/drm_atomic_helper.c+13−4
@@ -290,7 +290,8 @@ static int · 289 unmodified lines
290290 update_connector_routing(struct drm_atomic_state *state,
291291 struct drm_connector *connector,
292292 struct drm_connector_state *old_connector_state,
293− struct drm_connector_state *new_connector_state)
293+ struct drm_connector_state *new_connector_state,
294+ bool added_by_user)
294295 {
295296 const struct drm_connector_helper_funcs *funcs;
296297 struct drm_encoder *new_encoder;
@@ -339,9 +340,13 @@ update_connector_routing(struct drm_atomic_state *state, · 42 unmodified lines
339340 * there's a chance the connector may have been destroyed during the
340341 * process, but it's better to ignore that then cause
341342 * drm_atomic_helper_resume() to fail.
343+ *
344+ * Last, we want to ignore connector registration when the connector
345+ * was not pulled in the atomic state by user-space (ie, was pulled
346+ * in by the driver, e.g. when updating a DP-MST stream).
342347 */
343348 if (!state->duplicated && drm_connector_is_unregistered(connector) &&
344− crtc_state->active) {
349+ added_by_user && crtc_state->active) {
345350 drm_dbg_atomic(connector->dev,
346351 "[CONNECTOR:%d:%s] is not registered\n",
347352 connector->base.id, connector->name);
@@ -620,7 +625,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, · 272 unmodified lines
620625 struct drm_connector *connector;
621626 struct drm_connector_state *old_connector_state, *new_connector_state;
622627 int i, ret;
623− unsigned int connectors_mask = 0;
628+ unsigned int connectors_mask = 0, user_connectors_mask = 0;
629+
630+ for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i)
631+ user_connectors_mask |= BIT(i);
624632
625633 for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
626634 bool has_connectors =
@@ -685,7 +693,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, · 58 unmodified lines
685693 */
686694 ret = update_connector_routing(state, connector,
687695 old_connector_state,
688− new_connector_state);
696+ new_connector_state,
697+ BIT(i) & user_connectors_mask);
689698 if (ret)
690699 return ret;
691700 if (old_connector_state->crtc) {
drivers/gpu/drm/drm_gem.c+4−2
@@ -540,7 +540,7 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj) · 539 unmodified lines
540540 struct page **pages;
541541 struct folio *folio;
542542 struct folio_batch fbatch;
543− int i, j, npages;
543+ long i, j, npages;
544544
545545 if (WARN_ON(!obj->filp))
546546 return ERR_PTR(-EINVAL);
@@ -564,11 +564,13 @@ struct page **drm_gem_get_pages(struct drm_gem_object *obj) · 17 unmodified lines
564564
565565 i = 0;
566566 while (i < npages) {
567+ long nr;
567568 folio = shmem_read_folio_gfp(mapping, i,
568569 mapping_gfp_mask(mapping));
569570 if (IS_ERR(folio))
570571 goto fail;
571− for (j = 0; j < folio_nr_pages(folio); j++, i++)
572+ nr = min(npages - i, folio_nr_pages(folio));
573+ for (j = 0; j < nr; j++, i++)
572574 pages[i] = folio_file_page(folio, i);
573575
574576 /* Make sure shmem keeps __GFP_DMA32 allocated pages in the
drivers/gpu/drm/drm_panel_orientation_quirks.c+16−0
@@ -38,6 +38,14 @@ static const struct drm_dmi_panel_orientation_data gpd_micropc = { · 37 unmodified lines
3838 .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
3939 };
4040
41+static const struct drm_dmi_panel_orientation_data gpd_onemix2s = {
42+ .width = 1200,
43+ .height = 1920,
44+ .bios_dates = (const char * const []){ "05/21/2018", "10/26/2018",
45+ "03/04/2019", NULL },
46+ .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
47+};
48+
4149 static const struct drm_dmi_panel_orientation_data gpd_pocket = {
4250 .width = 1200,
4351 .height = 1920,
@@ -401,6 +409,14 @@ static const struct dmi_system_id orientation_data[] = { · 357 unmodified lines
401409 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"),
402410 },
403411 .driver_data = (void *)&lcd800x1280_rightside_up,
412+ }, { /* One Mix 2S (generic strings, also match on bios date) */
413+ .matches = {
414+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
415+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
416+ DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
417+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
418+ },
419+ .driver_data = (void *)&gpd_onemix2s,
404420 },
405421 {}
406422 };
drivers/gpu/drm/i915/gem/i915_gem_pages.c+1−1
@@ -198,7 +198,7 @@ static void flush_tlb_invalidate(struct drm_i915_gem_object *obj) · 197 unmodified lines
198198
199199 for_each_gt(gt, i915, id) {
200200 if (!obj->mm.tlb[id])
201− return;
201+ continue;
202202
203203 intel_gt_invalidate_tlb_full(gt, obj->mm.tlb[id]);
204204 obj->mm.tlb[id] = 0;
drivers/gpu/drm/i915/gt/gen8_engine_cs.c+10−1
@@ -271,8 +271,17 @@ int gen12_emit_flush_rcs(struct i915_request *rq, u32 mode) · 270 unmodified lines
271271 if (GRAPHICS_VER_FULL(rq->i915) >= IP_VER(12, 70))
272272 bit_group_0 |= PIPE_CONTROL_CCS_FLUSH;
273273
274+ /*
275+ * L3 fabric flush is needed for AUX CCS invalidation
276+ * which happens as part of pipe-control so we can
277+ * ignore PIPE_CONTROL_FLUSH_L3. Also PIPE_CONTROL_FLUSH_L3
278+ * deals with Protected Memory which is not needed for
279+ * AUX CCS invalidation and lead to unwanted side effects.
280+ */
281+ if (mode & EMIT_FLUSH)
282+ bit_group_1 |= PIPE_CONTROL_FLUSH_L3;
283+
274284 bit_group_1 |= PIPE_CONTROL_TILE_CACHE_FLUSH;
275− bit_group_1 |= PIPE_CONTROL_FLUSH_L3;
276285 bit_group_1 |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;
277286 bit_group_1 |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;
278287 /* Wa_1409600907:tgl,adl-p */
drivers/gpu/drm/i915/i915_gem.c+7−2
@@ -1199,6 +1199,13 @@ int i915_gem_init(struct drm_i915_private *dev_priv) · 1198 unmodified lines
11991199 goto err_unlock;
12001200 }
12011201
1202+ /*
1203+ * Register engines early to ensure the engine list is in its final
1204+ * rb-tree form, lowering the amount of code that has to deal with
1205+ * the intermediate llist state.
1206+ */
1207+ intel_engines_driver_register(dev_priv);
1208+
12021209 return 0;
12031210
12041211 /*
@@ -1246,8 +1253,6 @@ err_unlock: · 41 unmodified lines
12461253 void i915_gem_driver_register(struct drm_i915_private *i915)
12471254 {
12481255 i915_gem_driver_register__shrinker(i915);
1249−
1250− intel_engines_driver_register(i915);
12511256 }
12521257
12531258 void i915_gem_driver_unregister(struct drm_i915_private *i915)
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c+18−9
@@ -119,6 +119,7 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog, · 118 unmodified lines
119119 struct dpu_sw_pipe_cfg *pipe_cfg)
120120 {
121121 int src_width, src_height, dst_height, fps;
122+ u64 plane_pixel_rate, plane_bit_rate;
122123 u64 plane_prefill_bw;
123124 u64 plane_bw;
124125 u32 hw_latency_lines;
@@ -136,13 +137,12 @@ static u64 _dpu_plane_calc_bw(const struct dpu_mdss_cfg *catalog, · 11 unmodified lines
136137 scale_factor = src_height > dst_height ?
137138 mult_frac(src_height, 1, dst_height) : 1;
138139
139− plane_bw =
140− src_width * mode->vtotal * fps * fmt->bpp *
141− scale_factor;
140+ plane_pixel_rate = src_width * mode->vtotal * fps;
141+ plane_bit_rate = plane_pixel_rate * fmt->bpp;
142142
143− plane_prefill_bw =
144− src_width * hw_latency_lines * fps * fmt->bpp *
145− scale_factor * mode->vtotal;
143+ plane_bw = plane_bit_rate * scale_factor;
144+
145+ plane_prefill_bw = plane_bw * hw_latency_lines;
146146
147147 if ((vbp+vpw) > hw_latency_lines)
148148 do_div(plane_prefill_bw, (vbp+vpw));
@@ -733,9 +733,11 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu, · 584 unmodified lines
733733 static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
734734 struct dpu_sw_pipe *pipe,
735735 struct dpu_sw_pipe_cfg *pipe_cfg,
736− const struct dpu_format *fmt)
736+ const struct dpu_format *fmt,
737+ const struct drm_display_mode *mode)
737738 {
738739 uint32_t min_src_size;
740+ struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base);
739741
740742 min_src_size = DPU_FORMAT_IS_YUV(fmt) ? 2 : 1;
741743
@@ -774,6 +776,12 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu, · 32 unmodified lines
774776 return -EINVAL;
775777 }
776778
779+ /* max clk check */
780+ if (_dpu_plane_calc_clk(mode, pipe_cfg) > kms->perf.max_core_clk_rate) {
781+ DPU_DEBUG_PLANE(pdpu, "plane exceeds max mdp core clk limits\n");
782+ return -E2BIG;
783+ }
784+
777785 return 0;
778786 }
779787
@@ -899,12 +907,13 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, · 119 unmodified lines
899907 r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
900908 }
901909
902− ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt);
910+ ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, &crtc_state->adjusted_mode);
903911 if (ret)
904912 return ret;
905913
906914 if (r_pipe->sspp) {
907− ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt);
915+ ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt,
916+ &crtc_state->adjusted_mode);
908917 if (ret)
909918 return ret;
910919 }
drivers/gpu/drm/msm/dp/dp_ctrl.c+6−7
@@ -1774,13 +1774,6 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) · 1773 unmodified lines
17741774 return rc;
17751775
17761776 while (--link_train_max_retries) {
1777− rc = dp_ctrl_reinitialize_mainlink(ctrl);
1778− if (rc) {
1779− DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n",
1780− rc);
1781− break;
1782− }
1783−
17841777 training_step = DP_TRAINING_NONE;
17851778 rc = dp_ctrl_setup_main_link(ctrl, &training_step);
17861779 if (rc == 0) {
@@ -1832,6 +1825,12 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl) · 45 unmodified lines
18321825 /* stop link training before start re training */
18331826 dp_ctrl_clear_training_pattern(ctrl);
18341827 }
1828+
1829+ rc = dp_ctrl_reinitialize_mainlink(ctrl);
1830+ if (rc) {
1831+ DRM_ERROR("Failed to reinitialize mainlink. rc=%d\n", rc);
1832+ break;
1833+ }
18351834 }
18361835
18371836 if (ctrl->link->sink_request & DP_TEST_LINK_PHY_TEST_PATTERN)
drivers/gpu/drm/msm/dp/dp_link.c+2−2
@@ -1090,7 +1090,7 @@ int dp_link_process_request(struct dp_link *dp_link) · 1089 unmodified lines
10901090 } else if (dp_link_read_psr_error_status(link)) {
10911091 DRM_ERROR("PSR IRQ_HPD received\n");
10921092 } else if (dp_link_psr_capability_changed(link)) {
1093− drm_dbg_dp(link->drm_dev, "PSR Capability changed");
1093+ drm_dbg_dp(link->drm_dev, "PSR Capability changed\n");
10941094 } else {
10951095 ret = dp_link_process_link_status_update(link);
10961096 if (!ret) {
@@ -1107,7 +1107,7 @@ int dp_link_process_request(struct dp_link *dp_link) · 10 unmodified lines
11071107 }
11081108 }
11091109
1110− drm_dbg_dp(link->drm_dev, "sink request=%#x",
1110+ drm_dbg_dp(link->drm_dev, "sink request=%#x\n",
11111111 dp_link->sink_request);
11121112 return ret;
11131113 }
drivers/gpu/drm/msm/dsi/dsi_host.c+15−4
@@ -1082,9 +1082,21 @@ static void dsi_wait4video_done(struct msm_dsi_host *msm_host) · 1081 unmodified lines
10821082
10831083 static void dsi_wait4video_eng_busy(struct msm_dsi_host *msm_host)
10841084 {
1085+ u32 data;
1086+
10851087 if (!(msm_host->mode_flags & MIPI_DSI_MODE_VIDEO))
10861088 return;
10871089
1090+ data = dsi_read(msm_host, REG_DSI_STATUS0);
1091+
1092+ /* if video mode engine is not busy, its because
1093+ * either timing engine was not turned on or the
1094+ * DSI controller has finished transmitting the video
1095+ * data already, so no need to wait in those cases
1096+ */
1097+ if (!(data & DSI_STATUS0_VIDEO_MODE_ENGINE_BUSY))
1098+ return;
1099+
10881100 if (msm_host->power_on && msm_host->enabled) {
10891101 dsi_wait4video_done(msm_host);
10901102 /* delay 4 ms to skip BLLP */
@@ -1894,10 +1906,9 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi) · 803 unmodified lines
18941906 }
18951907
18961908 msm_host->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
1897− if (msm_host->irq < 0) {
1898− ret = msm_host->irq;
1899− dev_err(&pdev->dev, "failed to get irq: %d\n", ret);
1900− return ret;
1909+ if (!msm_host->irq) {
1910+ dev_err(&pdev->dev, "failed to get irq\n");
1911+ return -EINVAL;
19011912 }
19021913
19031914 /* do not autoenable, will be enabled later */
drivers/gpu/drm/msm/msm_mdss.c+1−1
@@ -511,7 +511,7 @@ static int mdss_remove(struct platform_device *pdev) · 510 unmodified lines
511511 static const struct msm_mdss_data msm8998_data = {
512512 .ubwc_enc_version = UBWC_1_0,
513513 .ubwc_dec_version = UBWC_1_0,
514− .highest_bank_bit = 1,
514+ .highest_bank_bit = 2,
515515 };
516516
517517 static const struct msm_mdss_data qcm2290_data = {
drivers/gpu/drm/nouveau/nouveau_abi16.c+21−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131
3232 #include "nouveau_drv.h"
3333 #include "nouveau_dma.h"
34+#include "nouveau_exec.h"
3435 #include "nouveau_gem.h"
3536 #include "nouveau_chan.h"
3637 #include "nouveau_abi16.h"
@@ -183,6 +184,20 @@ nouveau_abi16_fini(struct nouveau_abi16 *abi16) · 146 unmodified lines
183184 cli->abi16 = NULL;
184185 }
185186
187+static inline int
188+getparam_dma_ib_max(struct nvif_device *device)
189+{
190+ const struct nvif_mclass dmas[] = {
191+ { NV03_CHANNEL_DMA, 0 },
192+ { NV10_CHANNEL_DMA, 0 },
193+ { NV17_CHANNEL_DMA, 0 },
194+ { NV40_CHANNEL_DMA, 0 },
195+ {}
196+ };
197+
198+ return nvif_mclass(&device->object, dmas) < 0 ? NV50_DMA_IB_MAX : 0;
199+}
200+
186201 int
187202 nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
188203 {
@@ -247,6 +262,12 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS) · 58 unmodified lines
247262 case NOUVEAU_GETPARAM_GRAPH_UNITS:
248263 getparam->value = nvkm_gr_units(gr);
249264 break;
265+ case NOUVEAU_GETPARAM_EXEC_PUSH_MAX: {
266+ int ib_max = getparam_dma_ib_max(device);
267+
268+ getparam->value = nouveau_exec_push_max_from_ib_max(ib_max);
269+ break;
270+ }
250271 default:
251272 NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
252273 return -EINVAL;
drivers/gpu/drm/nouveau/nouveau_chan.c+7−8
@@ -257,10 +257,7 @@ static int · 256 unmodified lines
257257 nouveau_channel_ctor(struct nouveau_drm *drm, struct nvif_device *device, bool priv, u64 runm,
258258 struct nouveau_channel **pchan)
259259 {
260− static const struct {
261− s32 oclass;
262− int version;
263− } hosts[] = {
260+ const struct nvif_mclass hosts[] = {
264261 { AMPERE_CHANNEL_GPFIFO_B, 0 },
265262 { AMPERE_CHANNEL_GPFIFO_A, 0 },
266263 { TURING_CHANNEL_GPFIFO_A, 0 },
@@ -443,9 +440,11 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) · 176 unmodified lines
443440 }
444441
445442 /* initialise dma tracking parameters */
446− switch (chan->user.oclass & 0x00ff) {
447− case 0x006b:
448− case 0x006e:
443+ switch (chan->user.oclass) {
444+ case NV03_CHANNEL_DMA:
445+ case NV10_CHANNEL_DMA:
446+ case NV17_CHANNEL_DMA:
447+ case NV40_CHANNEL_DMA:
449448 chan->user_put = 0x40;
450449 chan->user_get = 0x44;
451450 chan->dma.max = (0x10000 / 4) - 2;
@@ -455,7 +454,7 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 vram, u32 gart) · 3 unmodified lines
455454 chan->user_get = 0x44;
456455 chan->user_get_hi = 0x60;
457456 chan->dma.ib_base = 0x10000 / 4;
458− chan->dma.ib_max = (0x02000 / 8) - 1;
457+ chan->dma.ib_max = NV50_DMA_IB_MAX;
459458 chan->dma.ib_put = 0;
460459 chan->dma.ib_free = chan->dma.ib_max - chan->dma.ib_put;
461460 chan->dma.max = chan->dma.ib_base;
drivers/gpu/drm/nouveau/nouveau_dma.h+3−0
@@ -49,6 +49,9 @@ void nv50_dma_push(struct nouveau_channel *, u64 addr, u32 length, · 48 unmodified lines
4949 /* Maximum push buffer size. */
5050 #define NV50_DMA_PUSH_MAX_LENGTH 0x7fffff
5151
52+/* Maximum IBs per ring. */
53+#define NV50_DMA_IB_MAX ((0x02000 / 8) - 1)
54+
5255 /* Object handles - for stuff that's doesn't use handle == oclass. */
5356 enum {
5457 NvDmaFB = 0x80000002,
drivers/gpu/drm/nouveau/nouveau_exec.c+4−3
@@ -379,7 +379,7 @@ nouveau_exec_ioctl_exec(struct drm_device *dev, · 378 unmodified lines
379379 struct nouveau_channel *chan = NULL;
380380 struct nouveau_exec_job_args args = {};
381381 struct drm_nouveau_exec *req = data;
382− int ret = 0;
382+ int push_max, ret = 0;
383383
384384 if (unlikely(!abi16))
385385 return -ENOMEM;
@@ -404,9 +404,10 @@ nouveau_exec_ioctl_exec(struct drm_device *dev, · 18 unmodified lines
404404 if (!chan->dma.ib_max)
405405 return nouveau_abi16_put(abi16, -ENOSYS);
406406
407− if (unlikely(req->push_count > NOUVEAU_GEM_MAX_PUSH)) {
407+ push_max = nouveau_exec_push_max_from_ib_max(chan->dma.ib_max);
408+ if (unlikely(req->push_count > push_max)) {
408409 NV_PRINTK(err, cli, "pushbuf push count exceeds limit: %d max %d\n",
409− req->push_count, NOUVEAU_GEM_MAX_PUSH);
410+ req->push_count, push_max);
410411 return nouveau_abi16_put(abi16, -EINVAL);
411412 }
412413
drivers/gpu/drm/nouveau/nouveau_exec.h+10−0
@@ -51,4 +51,14 @@ int nouveau_exec_job_init(struct nouveau_exec_job **job, · 50 unmodified lines
5151 int nouveau_exec_ioctl_exec(struct drm_device *dev, void *data,
5252 struct drm_file *file_priv);
5353
54+static inline unsigned int
55+nouveau_exec_push_max_from_ib_max(int ib_max)
56+{
57+ /* Limit the number of IBs per job to half the size of the ring in order
58+ * to avoid the ring running dry between submissions and preserve one
59+ * more slot for the job's HW fence.
60+ */
61+ return ib_max > 1 ? ib_max / 2 - 1 : 0;
62+}
63+
5464 #endif
drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c+1−3
@@ -1342,9 +1342,7 @@ static const struct panel_init_cmd starry_himax83102_j02_init_cmd[] = { · 1341 unmodified lines
13421342 _INIT_DCS_CMD(0xB1, 0x01, 0xBF, 0x11),
13431343 _INIT_DCS_CMD(0xCB, 0x86),
13441344 _INIT_DCS_CMD(0xD2, 0x3C, 0xFA),
1345− _INIT_DCS_CMD(0xE9, 0xC5),
1346− _INIT_DCS_CMD(0xD3, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01),
1347− _INIT_DCS_CMD(0xE9, 0x3F),
1345+ _INIT_DCS_CMD(0xD3, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0C, 0x01),
13481346 _INIT_DCS_CMD(0xE7, 0x02, 0x00, 0x28, 0x01, 0x7E, 0x0F, 0x7E, 0x10, 0xA0, 0x00, 0x00, 0x20, 0x40, 0x50, 0x40),
13491347 _INIT_DCS_CMD(0xBD, 0x02),
13501348 _INIT_DCS_CMD(0xD8, 0xFF, 0xFF, 0xBF, 0xFE, 0xAA, 0xA0, 0xFF, 0xFF, 0xBF, 0xFE, 0xAA, 0xA0),
drivers/gpu/drm/scheduler/sched_main.c+1−1
@@ -929,7 +929,7 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched) · 928 unmodified lines
929929
930930 if (next) {
931931 next->s_fence->scheduled.timestamp =
932− job->s_fence->finished.timestamp;
932+ dma_fence_timestamp(&job->s_fence->finished);
933933 /* start TO timer for next job */
934934 drm_sched_start_timeout(sched);
935935 }
drivers/gpu/drm/tests/drm_kunit_helpers.c+1−1
@@ -118,7 +118,7 @@ void drm_kunit_helper_free_device(struct kunit *test, struct device *dev) · 117 unmodified lines
118118
119119 kunit_release_action(test,
120120 kunit_action_platform_driver_unregister,
121− pdev);
121+ &fake_platform_driver);
122122 }
123123 EXPORT_SYMBOL_GPL(drm_kunit_helper_free_device);
124124
drivers/gpu/drm/tiny/simpledrm.c+1−1
@@ -745,7 +745,7 @@ static struct simpledrm_device *simpledrm_device_create(struct drm_driver *drv, · 744 unmodified lines
745745
746746 ret = devm_aperture_acquire_from_firmware(dev, res->start, resource_size(res));
747747 if (ret) {
748− drm_err(dev, "could not acquire memory range %pr: %d\n", &res, ret);
748+ drm_err(dev, "could not acquire memory range %pr: %d\n", res, ret);
749749 return ERR_PTR(ret);
750750 }
751751
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c+4−3
@@ -34,6 +34,8 @@ · 33 unmodified lines
3434
3535 static void vmw_bo_release(struct vmw_bo *vbo)
3636 {
37+ WARN_ON(vbo->tbo.base.funcs &&
38+ kref_read(&vbo->tbo.base.refcount) != 0);
3739 vmw_bo_unmap(vbo);
3840 drm_gem_object_release(&vbo->tbo.base);
3941 }
@@ -497,7 +499,7 @@ static int vmw_user_bo_synccpu_release(struct drm_file *filp, · 457 unmodified lines
497499 if (!(flags & drm_vmw_synccpu_allow_cs)) {
498500 atomic_dec(&vmw_bo->cpu_writers);
499501 }
500− vmw_user_bo_unref(vmw_bo);
502+ vmw_user_bo_unref(&vmw_bo);
501503 }
502504
503505 return ret;
@@ -539,7 +541,7 @@ int vmw_user_bo_synccpu_ioctl(struct drm_device *dev, void *data, · 35 unmodified lines
539541 return ret;
540542
541543 ret = vmw_user_bo_synccpu_grab(vbo, arg->flags);
542− vmw_user_bo_unref(vbo);
544+ vmw_user_bo_unref(&vbo);
543545 if (unlikely(ret != 0)) {
544546 if (ret == -ERESTARTSYS || ret == -EBUSY)
545547 return -EBUSY;
@@ -612,7 +614,6 @@ int vmw_user_bo_lookup(struct drm_file *filp, · 66 unmodified lines
612614 }
613615
614616 *out = to_vmw_bo(gobj);
615− ttm_bo_get(&(*out)->tbo);
616617
617618 return 0;
618619 }
drivers/gpu/drm/vmwgfx/vmwgfx_bo.h+12−5
@@ -195,12 +195,19 @@ static inline struct vmw_bo *vmw_bo_reference(struct vmw_bo *buf) · 194 unmodified lines
195195 return buf;
196196 }
197197
198−static inline void vmw_user_bo_unref(struct vmw_bo *vbo)
198+static inline struct vmw_bo *vmw_user_bo_ref(struct vmw_bo *vbo)
199199 {
200− if (vbo) {
201− ttm_bo_put(&vbo->tbo);
202− drm_gem_object_put(&vbo->tbo.base);
203− }
200+ drm_gem_object_get(&vbo->tbo.base);
201+ return vbo;
202+}
203+
204+static inline void vmw_user_bo_unref(struct vmw_bo **buf)
205+{
206+ struct vmw_bo *tmp_buf = *buf;
207+
208+ *buf = NULL;
209+ if (tmp_buf)
210+ drm_gem_object_put(&tmp_buf->tbo.base);
204211 }
205212
206213 static inline struct vmw_bo *to_vmw_bo(struct drm_gem_object *gobj)
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c+3−3
@@ -432,7 +432,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) · 431 unmodified lines
432432 * for the new COTable. Initially pin the buffer object to make sure
433433 * we can use tryreserve without failure.
434434 */
435− ret = vmw_bo_create(dev_priv, &bo_params, &buf);
435+ ret = vmw_gem_object_create(dev_priv, &bo_params, &buf);
436436 if (ret) {
437437 DRM_ERROR("Failed initializing new cotable MOB.\n");
438438 goto out_done;
@@ -502,7 +502,7 @@ static int vmw_cotable_resize(struct vmw_resource *res, size_t new_size) · 63 unmodified lines
502502
503503 vmw_resource_mob_attach(res);
504504 /* Let go of the old mob. */
505− vmw_bo_unreference(&old_buf);
505+ vmw_user_bo_unref(&old_buf);
506506 res->id = vcotbl->type;
507507
508508 ret = dma_resv_reserve_fences(bo->base.resv, 1);
@@ -521,7 +521,7 @@ out_map_new: · 12 unmodified lines
521521 out_wait:
522522 ttm_bo_unpin(bo);
523523 ttm_bo_unreserve(bo);
524− vmw_bo_unreference(&buf);
524+ vmw_user_bo_unref(&buf);
525525
526526 out_done:
527527 MKS_STAT_TIME_POP(MKSSTAT_KERN_COTABLE_RESIZE);
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h+4−0
@@ -853,6 +853,10 @@ static inline bool vmw_resource_mob_attached(const struct vmw_resource *res) · 852 unmodified lines
853853 /**
854854 * GEM related functionality - vmwgfx_gem.c
855855 */
856+struct vmw_bo_params;
857+int vmw_gem_object_create(struct vmw_private *vmw,
858+ struct vmw_bo_params *params,
859+ struct vmw_bo **p_vbo);
856860 extern int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv,
857861 struct drm_file *filp,
858862 uint32_t size,
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c+7−5
@@ -1151,7 +1151,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv, · 1150 unmodified lines
11511151 SVGAMobId *id,
11521152 struct vmw_bo **vmw_bo_p)
11531153 {
1154− struct vmw_bo *vmw_bo;
1154+ struct vmw_bo *vmw_bo, *tmp_bo;
11551155 uint32_t handle = *id;
11561156 struct vmw_relocation *reloc;
11571157 int ret;
@@ -1164,7 +1164,8 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv, · 6 unmodified lines
11641164 }
11651165 vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_MOB, VMW_BO_DOMAIN_MOB);
11661166 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo);
1167− vmw_user_bo_unref(vmw_bo);
1167+ tmp_bo = vmw_bo;
1168+ vmw_user_bo_unref(&tmp_bo);
11681169 if (unlikely(ret != 0))
11691170 return ret;
11701171
@@ -1206,7 +1207,7 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv, · 35 unmodified lines
12061207 SVGAGuestPtr *ptr,
12071208 struct vmw_bo **vmw_bo_p)
12081209 {
1209− struct vmw_bo *vmw_bo;
1210+ struct vmw_bo *vmw_bo, *tmp_bo;
12101211 uint32_t handle = ptr->gmrId;
12111212 struct vmw_relocation *reloc;
12121213 int ret;
@@ -1220,7 +1221,8 @@ static int vmw_translate_guest_ptr(struct vmw_private *dev_priv, · 7 unmodified lines
12201221 vmw_bo_placement_set(vmw_bo, VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM,
12211222 VMW_BO_DOMAIN_GMR | VMW_BO_DOMAIN_VRAM);
12221223 ret = vmw_validation_add_bo(sw_context->ctx, vmw_bo);
1223− vmw_user_bo_unref(vmw_bo);
1224+ tmp_bo = vmw_bo;
1225+ vmw_user_bo_unref(&tmp_bo);
12241226 if (unlikely(ret != 0))
12251227 return ret;
12261228
@@ -1619,7 +1621,7 @@ static int vmw_cmd_tex_state(struct vmw_private *dev_priv, · 392 unmodified lines
16191621 {
16201622 VMW_DECLARE_CMD_VAR(*cmd, SVGA3dCmdSetTextureState);
16211623 SVGA3dTextureState *last_state = (SVGA3dTextureState *)
1622− ((unsigned long) header + header->size + sizeof(header));
1624+ ((unsigned long) header + header->size + sizeof(*header));
16231625 SVGA3dTextureState *cur_state = (SVGA3dTextureState *)
16241626 ((unsigned long) header + sizeof(*cmd));
16251627 struct vmw_resource *ctx;
drivers/gpu/drm/vmwgfx/vmwgfx_gem.c+15−3
@@ -111,6 +111,20 @@ static const struct drm_gem_object_funcs vmw_gem_object_funcs = { · 110 unmodified lines
111111 .vm_ops = &vmw_vm_ops,
112112 };
113113
114+int vmw_gem_object_create(struct vmw_private *vmw,
115+ struct vmw_bo_params *params,
116+ struct vmw_bo **p_vbo)
117+{
118+ int ret = vmw_bo_create(vmw, params, p_vbo);
119+
120+ if (ret != 0)
121+ goto out_no_bo;
122+
123+ (*p_vbo)->tbo.base.funcs = &vmw_gem_object_funcs;
124+out_no_bo:
125+ return ret;
126+}
127+
114128 int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv,
115129 struct drm_file *filp,
116130 uint32_t size,
@@ -126,12 +140,10 @@ int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv, · 9 unmodified lines
126140 .pin = false
127141 };
128142
129− ret = vmw_bo_create(dev_priv, &params, p_vbo);
143+ ret = vmw_gem_object_create(dev_priv, &params, p_vbo);
130144 if (ret != 0)
131145 goto out_no_bo;
132146
133− (*p_vbo)->tbo.base.funcs = &vmw_gem_object_funcs;
134−
135147 ret = drm_gem_handle_create(filp, &(*p_vbo)->tbo.base, handle);
136148 out_no_bo:
137149 return ret;
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c+3−3
@@ -1471,8 +1471,8 @@ static int vmw_create_bo_proxy(struct drm_device *dev, · 1470 unmodified lines
14711471 /* Reserve and switch the backing mob. */
14721472 mutex_lock(&res->dev_priv->cmdbuf_mutex);
14731473 (void) vmw_resource_reserve(res, false, true);
1474− vmw_bo_unreference(&res->guest_memory_bo);
1475− res->guest_memory_bo = vmw_bo_reference(bo_mob);
1474+ vmw_user_bo_unref(&res->guest_memory_bo);
1475+ res->guest_memory_bo = vmw_user_bo_ref(bo_mob);
14761476 res->guest_memory_offset = 0;
14771477 vmw_resource_unreserve(res, false, false, false, NULL, 0);
14781478 mutex_unlock(&res->dev_priv->cmdbuf_mutex);
@@ -1666,7 +1666,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev, · 187 unmodified lines
16661666 err_out:
16671667 /* vmw_user_lookup_handle takes one ref so does new_fb */
16681668 if (bo)
1669− vmw_user_bo_unref(bo);
1669+ vmw_user_bo_unref(&bo);
16701670 if (surface)
16711671 vmw_surface_unreference(&surface);
16721672
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c+1−1
@@ -451,7 +451,7 @@ int vmw_overlay_ioctl(struct drm_device *dev, void *data, · 450 unmodified lines
451451
452452 ret = vmw_overlay_update_stream(dev_priv, buf, arg, true);
453453
454− vmw_user_bo_unref(buf);
454+ vmw_user_bo_unref(&buf);
455455
456456 out_unlock:
457457 mutex_unlock(&overlay->mutex);
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c+6−6
@@ -141,7 +141,7 @@ static void vmw_resource_release(struct kref *kref) · 140 unmodified lines
141141 if (res->coherent)
142142 vmw_bo_dirty_release(res->guest_memory_bo);
143143 ttm_bo_unreserve(bo);
144− vmw_bo_unreference(&res->guest_memory_bo);
144+ vmw_user_bo_unref(&res->guest_memory_bo);
145145 }
146146
147147 if (likely(res->hw_destroy != NULL)) {
@@ -338,7 +338,7 @@ static int vmw_resource_buf_alloc(struct vmw_resource *res, · 190 unmodified lines
338338 return 0;
339339 }
340340
341− ret = vmw_bo_create(res->dev_priv, &bo_params, &gbo);
341+ ret = vmw_gem_object_create(res->dev_priv, &bo_params, &gbo);
342342 if (unlikely(ret != 0))
343343 goto out_no_bo;
344344
@@ -457,11 +457,11 @@ void vmw_resource_unreserve(struct vmw_resource *res, · 112 unmodified lines
457457 vmw_resource_mob_detach(res);
458458 if (res->coherent)
459459 vmw_bo_dirty_release(res->guest_memory_bo);
460− vmw_bo_unreference(&res->guest_memory_bo);
460+ vmw_user_bo_unref(&res->guest_memory_bo);
461461 }
462462
463463 if (new_guest_memory_bo) {
464− res->guest_memory_bo = vmw_bo_reference(new_guest_memory_bo);
464+ res->guest_memory_bo = vmw_user_bo_ref(new_guest_memory_bo);
465465
466466 /*
467467 * The validation code should already have added a
@@ -551,7 +551,7 @@ out_no_reserve: · 83 unmodified lines
551551 ttm_bo_put(val_buf->bo);
552552 val_buf->bo = NULL;
553553 if (guest_memory_dirty)
554− vmw_bo_unreference(&res->guest_memory_bo);
554+ vmw_user_bo_unref(&res->guest_memory_bo);
555555
556556 return ret;
557557 }
@@ -727,7 +727,7 @@ int vmw_resource_validate(struct vmw_resource *res, bool intr, · 169 unmodified lines
727727 goto out_no_validate;
728728 else if (!res->func->needs_guest_memory && res->guest_memory_bo) {
729729 WARN_ON_ONCE(vmw_resource_mob_attached(res));
730− vmw_bo_unreference(&res->guest_memory_bo);
730+ vmw_user_bo_unref(&res->guest_memory_bo);
731731 }
732732
733733 return 0;
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c+2−2
@@ -180,7 +180,7 @@ static int vmw_gb_shader_init(struct vmw_private *dev_priv, · 179 unmodified lines
180180
181181 res->guest_memory_size = size;
182182 if (byte_code) {
183− res->guest_memory_bo = vmw_bo_reference(byte_code);
183+ res->guest_memory_bo = vmw_user_bo_ref(byte_code);
184184 res->guest_memory_offset = offset;
185185 }
186186 shader->size = size;
@@ -809,7 +809,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv, · 622 unmodified lines
809809 shader_type, num_input_sig,
810810 num_output_sig, tfile, shader_handle);
811811 out_bad_arg:
812− vmw_user_bo_unref(buffer);
812+ vmw_user_bo_unref(&buffer);
813813 return ret;
814814 }
815815
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c+12−19
@@ -686,9 +686,6 @@ static void vmw_user_surface_base_release(struct ttm_base_object **p_base) · 685 unmodified lines
686686 container_of(base, struct vmw_user_surface, prime.base);
687687 struct vmw_resource *res = &user_srf->srf.res;
688688
689− if (res->guest_memory_bo)
690− drm_gem_object_put(&res->guest_memory_bo->tbo.base);
691−
692689 *p_base = NULL;
693690 vmw_resource_unreference(&res);
694691 }
@@ -855,23 +852,21 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data, · 160 unmodified lines
855852 * expect a backup buffer to be present.
856853 */
857854 if (dev_priv->has_mob && req->shareable) {
858− uint32_t backup_handle;
859−
860− ret = vmw_gem_object_create_with_handle(dev_priv,
861− file_priv,
862− res->guest_memory_size,
863− &backup_handle,
864− &res->guest_memory_bo);
855+ struct vmw_bo_params params = {
856+ .domain = VMW_BO_DOMAIN_SYS,
857+ .busy_domain = VMW_BO_DOMAIN_SYS,
858+ .bo_type = ttm_bo_type_device,
859+ .size = res->guest_memory_size,
860+ .pin = false
861+ };
862+
863+ ret = vmw_gem_object_create(dev_priv,
864+ &params,
865+ &res->guest_memory_bo);
865866 if (unlikely(ret != 0)) {
866867 vmw_resource_unreference(&res);
867868 goto out_unlock;
868869 }
869− vmw_bo_reference(res->guest_memory_bo);
870− /*
871− * We don't expose the handle to the userspace and surface
872− * already holds a gem reference
873− */
874− drm_gem_handle_delete(file_priv, backup_handle);
875870 }
876871
877872 tmp = vmw_resource_reference(&srf->res);
@@ -1512,7 +1507,7 @@ vmw_gb_surface_define_internal(struct drm_device *dev, · 634 unmodified lines
15121507 if (ret == 0) {
15131508 if (res->guest_memory_bo->tbo.base.size < res->guest_memory_size) {
15141509 VMW_DEBUG_USER("Surface backup buffer too small.\n");
1515− vmw_bo_unreference(&res->guest_memory_bo);
1510+ vmw_user_bo_unref(&res->guest_memory_bo);
15161511 ret = -EINVAL;
15171512 goto out_unlock;
15181513 } else {
@@ -1526,8 +1521,6 @@ vmw_gb_surface_define_internal(struct drm_device *dev, · 7 unmodified lines
15261521 res->guest_memory_size,
15271522 &backup_handle,
15281523 &res->guest_memory_bo);
1529− if (ret == 0)
1530− vmw_bo_reference(res->guest_memory_bo);
15311524 }
15321525
15331526 if (unlikely(ret != 0)) {
drivers/hid/Kconfig+2−0
@@ -799,6 +799,8 @@ config HID_NVIDIA_SHIELD · 798 unmodified lines
799799 tristate "NVIDIA SHIELD devices"
800800 depends on USB_HID
801801 depends on BT_HIDP
802+ depends on LEDS_CLASS
803+ select POWER_SUPPLY
802804 help
803805 Support for NVIDIA SHIELD accessories.
804806
drivers/hid/hid-holtek-kbd.c+4−0
@@ -130,6 +130,10 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type, · 129 unmodified lines
130130 return -ENODEV;
131131
132132 boot_hid = usb_get_intfdata(boot_interface);
133+ if (list_empty(&boot_hid->inputs)) {
134+ hid_err(hid, "no inputs found\n");
135+ return -ENODEV;
136+ }
133137 boot_hid_input = list_first_entry(&boot_hid->inputs,
134138 struct hid_input, list);
135139
drivers/hid/hid-ids.h+1−0
@@ -425,6 +425,7 @@ · 424 unmodified lines
425425 #define I2C_DEVICE_ID_HP_SPECTRE_X360_13T_AW100 0x29F5
426426 #define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V1 0x2BED
427427 #define I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2 0x2BEE
428+#define I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG 0x2D02
428429
429430 #define USB_VENDOR_ID_ELECOM 0x056e
430431 #define USB_DEVICE_ID_ELECOM_BM084 0x0061
drivers/hid/hid-input.c+2−0
@@ -409,6 +409,8 @@ static const struct hid_device_id hid_battery_quirks[] = { · 408 unmodified lines
409409 HID_BATTERY_QUIRK_IGNORE },
410410 { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_14T_EA100_V2),
411411 HID_BATTERY_QUIRK_IGNORE },
412+ { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15_EU0556NG),
413+ HID_BATTERY_QUIRK_IGNORE },
412414 {}
413415 };
414416
drivers/hid/hid-logitech-hidpp.c+4−1
@@ -4515,7 +4515,8 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) · 4514 unmodified lines
45154515 goto hid_hw_init_fail;
45164516 }
45174517
4518− hidpp_connect_event(hidpp);
4518+ schedule_work(&hidpp->work);
4519+ flush_work(&hidpp->work);
45194520
45204521 if (will_restart) {
45214522 /* Reset the HID node state */
@@ -4677,6 +4678,8 @@ static const struct hid_device_id hidpp_devices[] = { · 155 unmodified lines
46774678 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb008) },
46784679 { /* MX Master mouse over Bluetooth */
46794680 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb012) },
4681+ { /* M720 Triathlon mouse over Bluetooth */
4682+ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb015) },
46804683 { /* MX Ergo trackball over Bluetooth */
46814684 HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01d) },
46824685 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, 0xb01e) },
drivers/hid/hid-multitouch.c+4−0
@@ -2144,6 +2144,10 @@ static const struct hid_device_id mt_devices[] = { · 2143 unmodified lines
21442144 USB_DEVICE_ID_MTP_STM)},
21452145
21462146 /* Synaptics devices */
2147+ { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
2148+ HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
2149+ USB_VENDOR_ID_SYNAPTICS, 0xcd7e) },
2150+
21472151 { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
21482152 HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
21492153 USB_VENDOR_ID_SYNAPTICS, 0xce08) },
drivers/hid/hid-nintendo.c+103−72
@@ -2088,7 +2088,9 @@ static int joycon_read_info(struct joycon_ctlr *ctlr) · 2087 unmodified lines
20882088 struct joycon_input_report *report;
20892089
20902090 req.subcmd_id = JC_SUBCMD_REQ_DEV_INFO;
2091+ mutex_lock(&ctlr->output_mutex);
20912092 ret = joycon_send_subcmd(ctlr, &req, 0, HZ);
2093+ mutex_unlock(&ctlr->output_mutex);
20922094 if (ret) {
20932095 hid_err(ctlr->hdev, "Failed to get joycon info; ret=%d\n", ret);
20942096 return ret;
@@ -2117,6 +2119,85 @@ static int joycon_read_info(struct joycon_ctlr *ctlr) · 22 unmodified lines
21172119 return 0;
21182120 }
21192121
2122+static int joycon_init(struct hid_device *hdev)
2123+{
2124+ struct joycon_ctlr *ctlr = hid_get_drvdata(hdev);
2125+ int ret = 0;
2126+
2127+ mutex_lock(&ctlr->output_mutex);
2128+ /* if handshake command fails, assume ble pro controller */
2129+ if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) &&
2130+ !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) {
2131+ hid_dbg(hdev, "detected USB controller\n");
2132+ /* set baudrate for improved latency */
2133+ ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
2134+ if (ret) {
2135+ hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
2136+ goto out_unlock;
2137+ }
2138+ /* handshake */
2139+ ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
2140+ if (ret) {
2141+ hid_err(hdev, "Failed handshake; ret=%d\n", ret);
2142+ goto out_unlock;
2143+ }
2144+ /*
2145+ * Set no timeout (to keep controller in USB mode).
2146+ * This doesn't send a response, so ignore the timeout.
2147+ */
2148+ joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10);
2149+ } else if (jc_type_is_chrggrip(ctlr)) {
2150+ hid_err(hdev, "Failed charging grip handshake\n");
2151+ ret = -ETIMEDOUT;
2152+ goto out_unlock;
2153+ }
2154+
2155+ /* get controller calibration data, and parse it */
2156+ ret = joycon_request_calibration(ctlr);
2157+ if (ret) {
2158+ /*
2159+ * We can function with default calibration, but it may be
2160+ * inaccurate. Provide a warning, and continue on.
2161+ */
2162+ hid_warn(hdev, "Analog stick positions may be inaccurate\n");
2163+ }
2164+
2165+ /* get IMU calibration data, and parse it */
2166+ ret = joycon_request_imu_calibration(ctlr);
2167+ if (ret) {
2168+ /*
2169+ * We can function with default calibration, but it may be
2170+ * inaccurate. Provide a warning, and continue on.
2171+ */
2172+ hid_warn(hdev, "Unable to read IMU calibration data\n");
2173+ }
2174+
2175+ /* Set the reporting mode to 0x30, which is the full report mode */
2176+ ret = joycon_set_report_mode(ctlr);
2177+ if (ret) {
2178+ hid_err(hdev, "Failed to set report mode; ret=%d\n", ret);
2179+ goto out_unlock;
2180+ }
2181+
2182+ /* Enable rumble */
2183+ ret = joycon_enable_rumble(ctlr);
2184+ if (ret) {
2185+ hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret);
2186+ goto out_unlock;
2187+ }
2188+
2189+ /* Enable the IMU */
2190+ ret = joycon_enable_imu(ctlr);
2191+ if (ret) {
2192+ hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret);
2193+ goto out_unlock;
2194+ }
2195+
2196+out_unlock:
2197+ mutex_unlock(&ctlr->output_mutex);
2198+ return ret;
2199+}
2200+
21202201 /* Common handler for parsing inputs */
21212202 static int joycon_ctlr_read_handler(struct joycon_ctlr *ctlr, u8 *data,
21222203 int size)
@@ -2248,85 +2329,19 @@ static int nintendo_hid_probe(struct hid_device *hdev, · 125 unmodified lines
22482329
22492330 hid_device_io_start(hdev);
22502331
2251− /* Initialize the controller */
2252− mutex_lock(&ctlr->output_mutex);
2253− /* if handshake command fails, assume ble pro controller */
2254− if ((jc_type_is_procon(ctlr) || jc_type_is_chrggrip(ctlr)) &&
2255− !joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ)) {
2256− hid_dbg(hdev, "detected USB controller\n");
2257− /* set baudrate for improved latency */
2258− ret = joycon_send_usb(ctlr, JC_USB_CMD_BAUDRATE_3M, HZ);
2259− if (ret) {
2260− hid_err(hdev, "Failed to set baudrate; ret=%d\n", ret);
2261− goto err_mutex;
2262− }
2263− /* handshake */
2264− ret = joycon_send_usb(ctlr, JC_USB_CMD_HANDSHAKE, HZ);
2265− if (ret) {
2266− hid_err(hdev, "Failed handshake; ret=%d\n", ret);
2267− goto err_mutex;
2268− }
2269− /*
2270− * Set no timeout (to keep controller in USB mode).
2271− * This doesn't send a response, so ignore the timeout.
2272− */
2273− joycon_send_usb(ctlr, JC_USB_CMD_NO_TIMEOUT, HZ/10);
2274− } else if (jc_type_is_chrggrip(ctlr)) {
2275− hid_err(hdev, "Failed charging grip handshake\n");
2276− ret = -ETIMEDOUT;
2277− goto err_mutex;
2278− }
2279−
2280− /* get controller calibration data, and parse it */
2281− ret = joycon_request_calibration(ctlr);
2332+ ret = joycon_init(hdev);
22822333 if (ret) {
2283− /*
2284− * We can function with default calibration, but it may be
2285− * inaccurate. Provide a warning, and continue on.
2286− */
2287− hid_warn(hdev, "Analog stick positions may be inaccurate\n");
2288− }
2289−
2290− /* get IMU calibration data, and parse it */
2291− ret = joycon_request_imu_calibration(ctlr);
2292− if (ret) {
2293− /*
2294− * We can function with default calibration, but it may be
2295− * inaccurate. Provide a warning, and continue on.
2296− */
2297− hid_warn(hdev, "Unable to read IMU calibration data\n");
2298− }
2299−
2300− /* Set the reporting mode to 0x30, which is the full report mode */
2301− ret = joycon_set_report_mode(ctlr);
2302− if (ret) {
2303− hid_err(hdev, "Failed to set report mode; ret=%d\n", ret);
2304− goto err_mutex;
2305− }
2306−
2307− /* Enable rumble */
2308− ret = joycon_enable_rumble(ctlr);
2309− if (ret) {
2310− hid_err(hdev, "Failed to enable rumble; ret=%d\n", ret);
2311− goto err_mutex;
2312− }
2313−
2314− /* Enable the IMU */
2315− ret = joycon_enable_imu(ctlr);
2316− if (ret) {
2317− hid_err(hdev, "Failed to enable the IMU; ret=%d\n", ret);
2318− goto err_mutex;
2334+ hid_err(hdev, "Failed to initialize controller; ret=%d\n", ret);
2335+ goto err_close;
23192336 }
23202337
23212338 ret = joycon_read_info(ctlr);
23222339 if (ret) {
23232340 hid_err(hdev, "Failed to retrieve controller info; ret=%d\n",
23242341 ret);
2325− goto err_mutex;
2342+ goto err_close;
23262343 }
23272344
2328− mutex_unlock(&ctlr->output_mutex);
2329−
23302345 /* Initialize the leds */
23312346 ret = joycon_leds_create(ctlr);
23322347 if (ret) {
@@ -2352,8 +2367,6 @@ static int nintendo_hid_probe(struct hid_device *hdev, · 19 unmodified lines
23522367 hid_dbg(hdev, "probe - success\n");
23532368 return 0;
23542369
2355−err_mutex:
2356− mutex_unlock(&ctlr->output_mutex);
23572370 err_close:
23582371 hid_hw_close(hdev);
23592372 err_stop:
@@ -2383,6 +2396,20 @@ static void nintendo_hid_remove(struct hid_device *hdev) · 23 unmodified lines
23832396 hid_hw_stop(hdev);
23842397 }
23852398
2399+#ifdef CONFIG_PM
2400+
2401+static int nintendo_hid_resume(struct hid_device *hdev)
2402+{
2403+ int ret = joycon_init(hdev);
2404+
2405+ if (ret)
2406+ hid_err(hdev, "Failed to restore controller after resume");
2407+
2408+ return ret;
2409+}
2410+
2411+#endif
2412+
23862413 static const struct hid_device_id nintendo_hid_devices[] = {
23872414 { HID_USB_DEVICE(USB_VENDOR_ID_NINTENDO,
23882415 USB_DEVICE_ID_NINTENDO_PROCON) },
@@ -2404,6 +2431,10 @@ static struct hid_driver nintendo_hid_driver = { · 15 unmodified lines
24042431 .probe = nintendo_hid_probe,
24052432 .remove = nintendo_hid_remove,
24062433 .raw_event = nintendo_hid_event,
2434+
2435+#ifdef CONFIG_PM
2436+ .resume = nintendo_hid_resume,
2437+#endif
24072438 };
24082439 module_hid_driver(nintendo_hid_driver);
24092440
drivers/hid/hid-nvidia-shield.c+6−3
@@ -801,7 +801,7 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts) · 800 unmodified lines
801801 led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
802802 "thunderstrike%d:blue:led", ts->id);
803803 led->max_brightness = 1;
804− led->flags = LED_CORE_SUSPENDRESUME;
804+ led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN;
805805 led->brightness_get = &thunderstrike_led_get_brightness;
806806 led->brightness_set = &thunderstrike_led_set_brightness;
807807
@@ -1058,7 +1058,7 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) · 250 unmodified lines
10581058 ret = hid_hw_start(hdev, HID_CONNECT_HIDINPUT);
10591059 if (ret) {
10601060 hid_err(hdev, "Failed to start HID device\n");
1061− goto err_haptics;
1061+ goto err_ts_create;
10621062 }
10631063
10641064 ret = hid_hw_open(hdev);
@@ -1073,9 +1073,12 @@ static int shield_probe(struct hid_device *hdev, const struct hid_device_id *id) · 8 unmodified lines
10731073
10741074 err_stop:
10751075 hid_hw_stop(hdev);
1076−err_haptics:
1076+err_ts_create:
1077+ power_supply_unregister(ts->base.battery_dev.psy);
10771078 if (ts->haptics_dev)
10781079 input_unregister_device(ts->haptics_dev);
1080+ led_classdev_unregister(&ts->led_dev);
1081+ ida_free(&thunderstrike_ida, ts->id);
10791082 return ret;
10801083 }
10811084
drivers/hid/hid-sony.c+2−0
@@ -2155,6 +2155,8 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) · 2154 unmodified lines
21552155 return ret;
21562156
21572157 err:
2158+ usb_free_urb(sc->ghl_urb);
2159+
21582160 hid_hw_stop(hdev);
21592161 return ret;
21602162 }
drivers/hid/hid-steelseries.c+1−1
@@ -390,7 +390,7 @@ static int steelseries_headset_arctis_1_fetch_battery(struct hid_device *hdev) · 389 unmodified lines
390390 ret = hid_hw_raw_request(hdev, arctis_1_battery_request[0],
391391 write_buf, sizeof(arctis_1_battery_request),
392392 HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
393− if (ret < sizeof(arctis_1_battery_request)) {
393+ if (ret < (int)sizeof(arctis_1_battery_request)) {
394394 hid_err(hdev, "hid_hw_raw_request() failed with %d\n", ret);
395395 ret = -ENODATA;
396396 }
drivers/hid/i2c-hid/i2c-hid-core.c+81−63
@@ -998,45 +998,29 @@ static int i2c_hid_core_resume(struct i2c_hid *ihid) · 997 unmodified lines
998998 return hid_driver_reset_resume(hid);
999999 }
10001000
1001−/**
1002− * __do_i2c_hid_core_initial_power_up() - First time power up of the i2c-hid device.
1003− * @ihid: The ihid object created during probe.
1004− *
1005− * This function is called at probe time.
1006− *
1007− * The initial power on is where we do some basic validation that the device
1008− * exists, where we fetch the HID descriptor, and where we create the actual
1009− * HID devices.
1010− *
1011− * Return: 0 or error code.
1001+/*
1002+ * Check that the device exists and parse the HID descriptor.
10121003 */
1013−static int __do_i2c_hid_core_initial_power_up(struct i2c_hid *ihid)
1004+static int __i2c_hid_core_probe(struct i2c_hid *ihid)
10141005 {
10151006 struct i2c_client *client = ihid->client;
10161007 struct hid_device *hid = ihid->hid;
10171008 int ret;
10181009
1019− ret = i2c_hid_core_power_up(ihid);
1020− if (ret)
1021− return ret;
1022−
10231010 /* Make sure there is something at this address */
10241011 ret = i2c_smbus_read_byte(client);
10251012 if (ret < 0) {
10261013 i2c_hid_dbg(ihid, "nothing at this address: %d\n", ret);
1027− ret = -ENXIO;
1028− goto err;
1014+ return -ENXIO;
10291015 }
10301016
10311017 ret = i2c_hid_fetch_hid_descriptor(ihid);
10321018 if (ret < 0) {
10331019 dev_err(&client->dev,
10341020 "Failed to fetch the HID Descriptor\n");
1035− goto err;
1021+ return ret;
10361022 }
10371023
1038− enable_irq(client->irq);
1039−
10401024 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
10411025 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
10421026 hid->product = le16_to_cpu(ihid->hdesc.wProductID);
@@ -1050,17 +1034,49 @@ static int __do_i2c_hid_core_initial_power_up(struct i2c_hid *ihid) · 7 unmodified lines
10501034
10511035 ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
10521036
1037+ return 0;
1038+}
1039+
1040+static int i2c_hid_core_register_hid(struct i2c_hid *ihid)
1041+{
1042+ struct i2c_client *client = ihid->client;
1043+ struct hid_device *hid = ihid->hid;
1044+ int ret;
1045+
1046+ enable_irq(client->irq);
1047+
10531048 ret = hid_add_device(hid);
10541049 if (ret) {
10551050 if (ret != -ENODEV)
10561051 hid_err(client, "can't add hid device: %d\n", ret);
1057− goto err;
1052+ disable_irq(client->irq);
1053+ return ret;
10581054 }
10591055
10601056 return 0;
1057+}
1058+
1059+static int i2c_hid_core_probe_panel_follower(struct i2c_hid *ihid)
1060+{
1061+ int ret;
1062+
1063+ ret = i2c_hid_core_power_up(ihid);
1064+ if (ret)
1065+ return ret;
10611066
1062−err:
1067+ ret = __i2c_hid_core_probe(ihid);
1068+ if (ret)
1069+ goto err_power_down;
1070+
1071+ ret = i2c_hid_core_register_hid(ihid);
1072+ if (ret)
1073+ goto err_power_down;
1074+
1075+ return 0;
1076+
1077+err_power_down:
10631078 i2c_hid_core_power_down(ihid);
1079+
10641080 return ret;
10651081 }
10661082
@@ -1077,7 +1093,7 @@ static void ihid_core_panel_prepare_work(struct work_struct *work) · 10 unmodified lines
10771093 * steps.
10781094 */
10791095 if (!hid->version)
1080− ret = __do_i2c_hid_core_initial_power_up(ihid);
1096+ ret = i2c_hid_core_probe_panel_follower(ihid);
10811097 else
10821098 ret = i2c_hid_core_resume(ihid);
10831099
@@ -1136,7 +1152,6 @@ static int i2c_hid_core_register_panel_follower(struct i2c_hid *ihid) · 52 unmodified lines
11361152 struct device *dev = &ihid->client->dev;
11371153 int ret;
11381154
1139− ihid->is_panel_follower = true;
11401155 ihid->panel_follower.funcs = &i2c_hid_core_panel_follower_funcs;
11411156
11421157 /*
@@ -1156,30 +1171,6 @@ static int i2c_hid_core_register_panel_follower(struct i2c_hid *ihid) · 13 unmodified lines
11561171 return 0;
11571172 }
11581173
1159−static int i2c_hid_core_initial_power_up(struct i2c_hid *ihid)
1160−{
1161− /*
1162− * If we're a panel follower, we'll register and do our initial power
1163− * up when the panel turns on; otherwise we do it right away.
1164− */
1165− if (drm_is_panel_follower(&ihid->client->dev))
1166− return i2c_hid_core_register_panel_follower(ihid);
1167− else
1168− return __do_i2c_hid_core_initial_power_up(ihid);
1169−}
1170−
1171−static void i2c_hid_core_final_power_down(struct i2c_hid *ihid)
1172−{
1173− /*
1174− * If we're a follower, the act of unfollowing will cause us to be
1175− * powered down. Otherwise we need to manually do it.
1176− */
1177− if (ihid->is_panel_follower)
1178− drm_panel_remove_follower(&ihid->panel_follower);
1179− else
1180− i2c_hid_core_suspend(ihid, true);
1181−}
1182−
11831174 int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
11841175 u16 hid_descriptor_address, u32 quirks)
11851176 {
@@ -1211,6 +1202,7 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, · 25 unmodified lines
12111202 ihid->ops = ops;
12121203 ihid->client = client;
12131204 ihid->wHIDDescRegister = cpu_to_le16(hid_descriptor_address);
1205+ ihid->is_panel_follower = drm_is_panel_follower(&client->dev);
12141206
12151207 init_waitqueue_head(&ihid->wait);
12161208 mutex_init(&ihid->reset_lock);
@@ -1224,14 +1216,10 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, · 7 unmodified lines
12241216 return ret;
12251217 device_enable_async_suspend(&client->dev);
12261218
1227− ret = i2c_hid_init_irq(client);
1228− if (ret < 0)
1229− goto err_buffers_allocated;
1230−
12311219 hid = hid_allocate_device();
12321220 if (IS_ERR(hid)) {
12331221 ret = PTR_ERR(hid);
1234− goto err_irq;
1222+ goto err_free_buffers;
12351223 }
12361224
12371225 ihid->hid = hid;
@@ -1242,19 +1230,42 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, · 4 unmodified lines
12421230 hid->bus = BUS_I2C;
12431231 hid->initial_quirks = quirks;
12441232
1245− ret = i2c_hid_core_initial_power_up(ihid);
1233+ /* Power on and probe unless device is a panel follower. */
1234+ if (!ihid->is_panel_follower) {
1235+ ret = i2c_hid_core_power_up(ihid);
1236+ if (ret < 0)
1237+ goto err_destroy_device;
1238+
1239+ ret = __i2c_hid_core_probe(ihid);
1240+ if (ret < 0)
1241+ goto err_power_down;
1242+ }
1243+
1244+ ret = i2c_hid_init_irq(client);
1245+ if (ret < 0)
1246+ goto err_power_down;
1247+
1248+ /*
1249+ * If we're a panel follower, we'll register when the panel turns on;
1250+ * otherwise we do it right away.
1251+ */
1252+ if (ihid->is_panel_follower)
1253+ ret = i2c_hid_core_register_panel_follower(ihid);
1254+ else
1255+ ret = i2c_hid_core_register_hid(ihid);
12461256 if (ret)
1247− goto err_mem_free;
1257+ goto err_free_irq;
12481258
12491259 return 0;
12501260
1251−err_mem_free:
1252− hid_destroy_device(hid);
1253−
1254−err_irq:
1261+err_free_irq:
12551262 free_irq(client->irq, ihid);
1256−
1257−err_buffers_allocated:
1263+err_power_down:
1264+ if (!ihid->is_panel_follower)
1265+ i2c_hid_core_power_down(ihid);
1266+err_destroy_device:
1267+ hid_destroy_device(hid);
1268+err_free_buffers:
12581269 i2c_hid_free_buffers(ihid);
12591270
12601271 return ret;
@@ -1266,7 +1277,14 @@ void i2c_hid_core_remove(struct i2c_client *client) · 5 unmodified lines
12661277 struct i2c_hid *ihid = i2c_get_clientdata(client);
12671278 struct hid_device *hid;
12681279
1269− i2c_hid_core_final_power_down(ihid);
1280+ /*
1281+ * If we're a follower, the act of unfollowing will cause us to be
1282+ * powered down. Otherwise we need to manually do it.
1283+ */
1284+ if (ihid->is_panel_follower)
1285+ drm_panel_remove_follower(&ihid->panel_follower);
1286+ else
1287+ i2c_hid_core_suspend(ihid, true);
12701288
12711289 hid = ihid->hid;
12721290 hid_destroy_device(hid);
drivers/hid/intel-ish-hid/ipc/pci-ish.c+8−0
@@ -133,6 +133,14 @@ static int enable_gpe(struct device *dev) · 132 unmodified lines
133133 }
134134 wakeup = &adev->wakeup;
135135
136+ /*
137+ * Call acpi_disable_gpe(), so that reference count
138+ * gpe_event_info->runtime_count doesn't overflow.
139+ * When gpe_event_info->runtime_count = 0, the call
140+ * to acpi_disable_gpe() simply return.
141+ */
142+ acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number);
143+
136144 acpi_sts = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number);
137145 if (ACPI_FAILURE(acpi_sts)) {
138146 dev_err(dev, "enable ose_gpe failed\n");
drivers/hwtracing/coresight/coresight-tmc-etr.c+15−12
@@ -610,7 +610,8 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata, · 609 unmodified lines
610610
611611 flat_buf->vaddr = dma_alloc_noncoherent(real_dev, etr_buf->size,
612612 &flat_buf->daddr,
613− DMA_FROM_DEVICE, GFP_KERNEL);
613+ DMA_FROM_DEVICE,
614+ GFP_KERNEL | __GFP_NOWARN);
614615 if (!flat_buf->vaddr) {
615616 kfree(flat_buf);
616617 return -ENOMEM;
@@ -1173,16 +1174,6 @@ static struct etr_buf *tmc_etr_get_sysfs_buffer(struct coresight_device *csdev) · 556 unmodified lines
11731174 goto out;
11741175 }
11751176
1176− /*
1177− * In sysFS mode we can have multiple writers per sink. Since this
1178− * sink is already enabled no memory is needed and the HW need not be
1179− * touched, even if the buffer size has changed.
1180− */
1181− if (drvdata->mode == CS_MODE_SYSFS) {
1182− atomic_inc(&csdev->refcnt);
1183− goto out;
1184− }
1185−
11861177 /*
11871178 * If we don't have a buffer or it doesn't match the requested size,
11881179 * use the buffer allocated above. Otherwise reuse the existing buffer.
@@ -1204,7 +1195,7 @@ out: · 15 unmodified lines
12041195
12051196 static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
12061197 {
1207− int ret;
1198+ int ret = 0;
12081199 unsigned long flags;
12091200 struct tmc_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
12101201 struct etr_buf *sysfs_buf = tmc_etr_get_sysfs_buffer(csdev);
@@ -1213,12 +1204,24 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev) · 2 unmodified lines
12131204 return PTR_ERR(sysfs_buf);
12141205
12151206 spin_lock_irqsave(&drvdata->spinlock, flags);
1207+
1208+ /*
1209+ * In sysFS mode we can have multiple writers per sink. Since this
1210+ * sink is already enabled no memory is needed and the HW need not be
1211+ * touched, even if the buffer size has changed.
1212+ */
1213+ if (drvdata->mode == CS_MODE_SYSFS) {
1214+ atomic_inc(&csdev->refcnt);
1215+ goto out;
1216+ }
1217+
12161218 ret = tmc_etr_enable_hw(drvdata, sysfs_buf);
12171219 if (!ret) {
12181220 drvdata->mode = CS_MODE_SYSFS;
12191221 atomic_inc(&csdev->refcnt);
12201222 }
12211223
1224+out:
12221225 spin_unlock_irqrestore(&drvdata->spinlock, flags);
12231226
12241227 if (!ret)
drivers/iio/adc/ad7192.c+25−4
@@ -177,6 +177,7 @@ struct ad7192_chip_info { · 176 unmodified lines
177177 struct ad7192_state {
178178 const struct ad7192_chip_info *chip_info;
179179 struct regulator *avdd;
180+ struct regulator *vref;
180181 struct clk *mclk;
181182 u16 int_vref_mv;
182183 u32 fclk;
@@ -1008,10 +1009,30 @@ static int ad7192_probe(struct spi_device *spi) · 825 unmodified lines
10081009 if (ret)
10091010 return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd supply\n");
10101011
1011− ret = regulator_get_voltage(st->avdd);
1012− if (ret < 0) {
1013− dev_err(&spi->dev, "Device tree error, reference voltage undefined\n");
1014− return ret;
1012+ st->vref = devm_regulator_get_optional(&spi->dev, "vref");
1013+ if (IS_ERR(st->vref)) {
1014+ if (PTR_ERR(st->vref) != -ENODEV)
1015+ return PTR_ERR(st->vref);
1016+
1017+ ret = regulator_get_voltage(st->avdd);
1018+ if (ret < 0)
1019+ return dev_err_probe(&spi->dev, ret,
1020+ "Device tree error, AVdd voltage undefined\n");
1021+ } else {
1022+ ret = regulator_enable(st->vref);
1023+ if (ret) {
1024+ dev_err(&spi->dev, "Failed to enable specified Vref supply\n");
1025+ return ret;
1026+ }
1027+
1028+ ret = devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->vref);
1029+ if (ret)
1030+ return ret;
1031+
1032+ ret = regulator_get_voltage(st->vref);
1033+ if (ret < 0)
1034+ return dev_err_probe(&spi->dev, ret,
1035+ "Device tree error, Vref voltage undefined\n");
10151036 }
10161037 st->int_vref_mv = ret / 1000;
10171038
drivers/iio/adc/imx8qxp-adc.c+2−2
@@ -38,8 +38,8 @@ · 37 unmodified lines
3838 #define IMX8QXP_ADR_ADC_FCTRL 0x30
3939 #define IMX8QXP_ADR_ADC_SWTRIG 0x34
4040 #define IMX8QXP_ADR_ADC_TCTRL(tid) (0xc0 + (tid) * 4)
41−#define IMX8QXP_ADR_ADC_CMDH(cid) (0x100 + (cid) * 8)
42−#define IMX8QXP_ADR_ADC_CMDL(cid) (0x104 + (cid) * 8)
41+#define IMX8QXP_ADR_ADC_CMDL(cid) (0x100 + (cid) * 8)
42+#define IMX8QXP_ADR_ADC_CMDH(cid) (0x104 + (cid) * 8)
4343 #define IMX8QXP_ADR_ADC_RESFIFO 0x300
4444 #define IMX8QXP_ADR_ADC_TST 0xffc
4545
drivers/iio/addac/Kconfig+2−0
@@ -24,6 +24,8 @@ config AD74413R · 23 unmodified lines
2424 depends on GPIOLIB && SPI
2525 select REGMAP_SPI
2626 select CRC8
27+ select IIO_BUFFER
28+ select IIO_TRIGGERED_BUFFER
2729 help
2830 Say yes here to build support for Analog Devices AD74412R/AD74413R
2931 quad-channel software configurable input/output solution.
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c+5−1
@@ -190,8 +190,11 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev, · 189 unmodified lines
190190 /*
191191 * Ignore samples if the buffer is not set: it is needed if the ODR is
192192 * set but the buffer is not enabled yet.
193+ *
194+ * Note: iio_device_claim_buffer_mode() returns -EBUSY if the buffer
195+ * is not enabled.
193196 */
194− if (!iio_buffer_enabled(indio_dev))
197+ if (iio_device_claim_buffer_mode(indio_dev) < 0)
195198 return 0;
196199
197200 out = (s16 *)st->samples;
@@ -210,6 +213,7 @@ int cros_ec_sensors_push_data(struct iio_dev *indio_dev, · 12 unmodified lines
210213 iio_push_to_buffers_with_timestamp(indio_dev, st->samples,
211214 timestamp + delta);
212215
216+ iio_device_release_buffer_mode(indio_dev);
213217 return 0;
214218 }
215219 EXPORT_SYMBOL_GPL(cros_ec_sensors_push_data);
drivers/iio/dac/ad3552r.c+2−2
@@ -140,8 +140,8 @@ enum ad3552r_ch_vref_select { · 139 unmodified lines
140140 };
141141
142142 enum ad3542r_id {
143− AD3542R_ID = 0x4008,
144− AD3552R_ID = 0x4009,
143+ AD3542R_ID = 0x4009,
144+ AD3552R_ID = 0x4008,
145145 };
146146
147147 enum ad3552r_ch_output_range {
drivers/iio/frequency/admv1013.c+2−2
@@ -351,9 +351,9 @@ static int admv1013_update_mixer_vgate(struct admv1013_state *st) · 350 unmodified lines
351351 if (vcm < 0)
352352 return vcm;
353353
354− if (vcm < 1800000)
354+ if (vcm <= 1800000)
355355 mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;
356− else if (vcm > 1800000 && vcm < 2600000)
356+ else if (vcm > 1800000 && vcm <= 2600000)
357357 mixer_vgate = (2375 * vcm / 1000000 + 125) / 100;
358358 else
359359 return -EINVAL;
drivers/iio/imu/bno055/Kconfig+2−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22
33 config BOSCH_BNO055
44 tristate
5+ select IIO_BUFFER
6+ select IIO_TRIGGERED_BUFFER
57
68 config BOSCH_BNO055_SERIAL
79 tristate "Bosch BNO055 attached via UART"
drivers/iio/light/vcnl4000.c+0−1
@@ -1513,7 +1513,6 @@ static int vcnl4040_write_event_config(struct iio_dev *indio_dev, · 1512 unmodified lines
15131513
15141514 out:
15151515 mutex_unlock(&data->vcnl4000_lock);
1516− data->chip_spec->set_power_state(data, data->ps_int || data->als_int);
15171516
15181517 return ret;
15191518 }
drivers/iio/pressure/bmp280-core.c+1−1
@@ -2179,7 +2179,7 @@ int bmp280_common_probe(struct device *dev, · 2178 unmodified lines
21792179 * however as it happens, the BMP085 shares the chip ID of BMP180
21802180 * so we look for an IRQ if we have that.
21812181 */
2182− if (irq > 0 || (chip_id == BMP180_CHIP_ID)) {
2182+ if (irq > 0 && (chip_id == BMP180_CHIP_ID)) {
21832183 ret = bmp085_fetch_eoc_irq(dev, name, irq, data);
21842184 if (ret)
21852185 return ret;
drivers/iio/pressure/dps310.c+4−4
@@ -57,8 +57,8 @@ · 56 unmodified lines
5757 #define DPS310_RESET_MAGIC 0x09
5858 #define DPS310_COEF_BASE 0x10
5959
60−/* Make sure sleep time is <= 20ms for usleep_range */
61−#define DPS310_POLL_SLEEP_US(t) min(20000, (t) / 8)
60+/* Make sure sleep time is <= 30ms for usleep_range */
61+#define DPS310_POLL_SLEEP_US(t) min(30000, (t) / 8)
6262 /* Silently handle error in rate value here */
6363 #define DPS310_POLL_TIMEOUT_US(rc) ((rc) <= 0 ? 1000000 : 1000000 / (rc))
6464
@@ -402,8 +402,8 @@ static int dps310_reset_wait(struct dps310_data *data) · 337 unmodified lines
402402 if (rc)
403403 return rc;
404404
405− /* Wait for device chip access: 2.5ms in specification */
406− usleep_range(2500, 12000);
405+ /* Wait for device chip access: 15ms in specification */
406+ usleep_range(15000, 55000);
407407 return 0;
408408 }
409409
drivers/iio/pressure/ms5611_core.c+1−1
@@ -76,7 +76,7 @@ static bool ms5611_prom_is_valid(u16 *prom, size_t len) · 75 unmodified lines
7676
7777 crc = (crc >> 12) & 0x000F;
7878
79− return crc_orig != 0x0000 && crc == crc_orig;
79+ return crc == crc_orig;
8080 }
8181
8282 static int ms5611_read_prom(struct iio_dev *indio_dev)
drivers/iio/proximity/irsd200.c+3−3
@@ -759,14 +759,14 @@ static irqreturn_t irsd200_trigger_handler(int irq, void *pollf) · 758 unmodified lines
759759 {
760760 struct iio_dev *indio_dev = ((struct iio_poll_func *)pollf)->indio_dev;
761761 struct irsd200_data *data = iio_priv(indio_dev);
762− s16 buf = 0;
762+ s64 buf[2] = {};
763763 int ret;
764764
765− ret = irsd200_read_data(data, &buf);
765+ ret = irsd200_read_data(data, (s16 *)buf);
766766 if (ret)
767767 goto end;
768768
769− iio_push_to_buffers_with_timestamp(indio_dev, &buf,
769+ iio_push_to_buffers_with_timestamp(indio_dev, buf,
770770 iio_get_time_ns(indio_dev));
771771
772772 end:
drivers/infiniband/core/cma.c+1−1
@@ -4968,7 +4968,7 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv, · 4967 unmodified lines
49684968 int err = 0;
49694969 struct sockaddr *addr = (struct sockaddr *)&mc->addr;
49704970 struct net_device *ndev = NULL;
4971− struct ib_sa_multicast ib;
4971+ struct ib_sa_multicast ib = {};
49724972 enum ib_gid_type gid_type;
49734973 bool send_only;
49744974
drivers/infiniband/core/cma_configfs.c+1−1
@@ -217,7 +217,7 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group, · 216 unmodified lines
217217 return -ENOMEM;
218218
219219 for (i = 0; i < ports_num; i++) {
220− char port_str[10];
220+ char port_str[11];
221221
222222 ports[i].port_num = i + 1;
223223 snprintf(port_str, sizeof(port_str), "%u", i + 1);
drivers/infiniband/core/nldev.c+1−0
@@ -2529,6 +2529,7 @@ static const struct rdma_nl_cbs nldev_cb_table[RDMA_NLDEV_NUM_OPS] = { · 2528 unmodified lines
25292529 },
25302530 [RDMA_NLDEV_CMD_SYS_SET] = {
25312531 .doit = nldev_set_sys_set_doit,
2532+ .flags = RDMA_NL_ADMIN_PERM,
25322533 },
25332534 [RDMA_NLDEV_CMD_STAT_SET] = {
25342535 .doit = nldev_stat_set_doit,
drivers/infiniband/core/uverbs_main.c+1−1
@@ -546,7 +546,7 @@ static ssize_t verify_hdr(struct ib_uverbs_cmd_hdr *hdr, · 545 unmodified lines
546546 if (hdr->in_words * 4 != count)
547547 return -EINVAL;
548548
549− if (count < method_elm->req_size + sizeof(hdr)) {
549+ if (count < method_elm->req_size + sizeof(*hdr)) {
550550 /*
551551 * rdma-core v18 and v19 have a bug where they send DESTROY_CQ
552552 * with a 16 byte write instead of 24. Old kernels didn't
drivers/infiniband/hw/bnxt_re/ib_verbs.c+4−0
@@ -910,6 +910,10 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp, struct ib_udata *udata) · 909 unmodified lines
910910 list_del(&qp->list);
911911 mutex_unlock(&rdev->qp_lock);
912912 atomic_dec(&rdev->stats.res.qp_count);
913+ if (qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_RC)
914+ atomic_dec(&rdev->stats.res.rc_qp_count);
915+ else if (qp->qplib_qp.type == CMDQ_CREATE_QP_TYPE_UD)
916+ atomic_dec(&rdev->stats.res.ud_qp_count);
913917
914918 ib_umem_release(qp->rumem);
915919 ib_umem_release(qp->sumem);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c+9−2
@@ -665,7 +665,6 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 664 unmodified lines
665665 blocked = cookie & RCFW_CMD_IS_BLOCKING;
666666 cookie &= RCFW_MAX_COOKIE_VALUE;
667667 crsqe = &rcfw->crsqe_tbl[cookie];
668− crsqe->is_in_used = false;
669668
670669 if (WARN_ONCE(test_bit(FIRMWARE_STALL_DETECTED,
671670 &rcfw->cmdq.flags),
@@ -681,8 +680,14 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 9 unmodified lines
681680 atomic_dec(&rcfw->timeout_send);
682681
683682 if (crsqe->is_waiter_alive) {
684− if (crsqe->resp)
683+ if (crsqe->resp) {
685684 memcpy(crsqe->resp, qp_event, sizeof(*qp_event));
685+ /* Insert write memory barrier to ensure that
686+ * response data is copied before clearing the
687+ * flags
688+ */
689+ smp_wmb();
690+ }
686691 if (!blocked)
687692 wait_cmds++;
688693 }
@@ -694,6 +699,8 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, · 5 unmodified lines
694699 if (!is_waiter_alive)
695700 crsqe->resp = NULL;
696701
702+ crsqe->is_in_used = false;
703+
697704 hwq->cons += req_size;
698705
699706 /* This is a case to handle below scenario -
drivers/infiniband/hw/cxgb4/cm.c+3−0
@@ -1965,6 +1965,9 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid) · 1964 unmodified lines
19651965 int win;
19661966
19671967 skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
1968+ if (!skb)
1969+ return -ENOMEM;
1970+
19681971 req = __skb_put_zero(skb, sizeof(*req));
19691972 req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
19701973 req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
drivers/infiniband/hw/erdma/erdma_verbs.c+3−4
@@ -133,8 +133,8 @@ static int create_qp_cmd(struct erdma_ucontext *uctx, struct erdma_qp *qp) · 132 unmodified lines
133133 static int regmr_cmd(struct erdma_dev *dev, struct erdma_mr *mr)
134134 {
135135 struct erdma_pd *pd = to_epd(mr->ibmr.pd);
136+ u32 mtt_level = ERDMA_MR_MTT_0LEVEL;
136137 struct erdma_cmdq_reg_mr_req req;
137− u32 mtt_level;
138138
139139 erdma_cmdq_build_reqhdr(&req.hdr, CMDQ_SUBMOD_RDMA, CMDQ_OPCODE_REG_MR);
140140
@@ -147,10 +147,9 @@ static int regmr_cmd(struct erdma_dev *dev, struct erdma_mr *mr) · 6 unmodified lines
147147 req.phy_addr[0] = sg_dma_address(mr->mem.mtt->sglist);
148148 mtt_level = mr->mem.mtt->level;
149149 }
150− } else {
150+ } else if (mr->type != ERDMA_MR_TYPE_DMA) {
151151 memcpy(req.phy_addr, mr->mem.mtt->buf,
152152 MTT_SIZE(mr->mem.page_cnt));
153− mtt_level = ERDMA_MR_MTT_0LEVEL;
154153 }
155154
156155 req.cfg0 = FIELD_PREP(ERDMA_CMD_MR_VALID_MASK, mr->valid) |
@@ -655,7 +654,7 @@ static struct erdma_mtt *erdma_create_scatter_mtt(struct erdma_dev *dev, · 498 unmodified lines
655654
656655 mtt = kzalloc(sizeof(*mtt), GFP_KERNEL);
657656 if (!mtt)
658− return NULL;
657+ return ERR_PTR(-ENOMEM);
659658
660659 mtt->size = ALIGN(size, PAGE_SIZE);
661660 mtt->buf = vzalloc(mtt->size);
drivers/infiniband/hw/mlx4/sysfs.c+1−1
@@ -223,7 +223,7 @@ void del_sysfs_port_mcg_attr(struct mlx4_ib_dev *device, int port_num, · 222 unmodified lines
223223 static int add_port_entries(struct mlx4_ib_dev *device, int port_num)
224224 {
225225 int i;
226− char buff[11];
226+ char buff[12];
227227 struct mlx4_ib_iov_port *port = NULL;
228228 int ret = 0 ;
229229 struct ib_port_attr attr;
drivers/infiniband/hw/mlx5/fs.c+1−1
@@ -2470,8 +2470,8 @@ destroy_res: · 2469 unmodified lines
24702470 mlx5_steering_anchor_destroy_res(ft_prio);
24712471 put_flow_table:
24722472 put_flow_table(dev, ft_prio, true);
2473− mutex_unlock(&dev->flow_db->lock);
24742473 free_obj:
2474+ mutex_unlock(&dev->flow_db->lock);
24752475 kfree(obj);
24762476
24772477 return err;
drivers/infiniband/hw/mlx5/main.c+1−1
@@ -2084,7 +2084,7 @@ static inline char *mmap_cmd2str(enum mlx5_ib_mmap_cmd cmd) · 2083 unmodified lines
20842084 case MLX5_IB_MMAP_DEVICE_MEM:
20852085 return "Device Memory";
20862086 default:
2087− return NULL;
2087+ return "Unknown";
20882088 }
20892089 }
20902090
drivers/infiniband/hw/mlx5/mr.c+11−3
@@ -301,7 +301,8 @@ static int get_mkc_octo_size(unsigned int access_mode, unsigned int ndescs) · 300 unmodified lines
301301
302302 static void set_cache_mkc(struct mlx5_cache_ent *ent, void *mkc)
303303 {
304− set_mkc_access_pd_addr_fields(mkc, 0, 0, ent->dev->umrc.pd);
304+ set_mkc_access_pd_addr_fields(mkc, ent->rb_key.access_flags, 0,
305+ ent->dev->umrc.pd);
305306 MLX5_SET(mkc, mkc, free, 1);
306307 MLX5_SET(mkc, mkc, umr_en, 1);
307308 MLX5_SET(mkc, mkc, access_mode_1_0, ent->rb_key.access_mode & 0x3);
@@ -1024,19 +1025,26 @@ void mlx5_mkey_cache_cleanup(struct mlx5_ib_dev *dev) · 716 unmodified lines
10241025 if (!dev->cache.wq)
10251026 return;
10261027
1027− cancel_delayed_work_sync(&dev->cache.remove_ent_dwork);
10281028 mutex_lock(&dev->cache.rb_lock);
10291029 for (node = rb_first(root); node; node = rb_next(node)) {
10301030 ent = rb_entry(node, struct mlx5_cache_ent, node);
10311031 xa_lock_irq(&ent->mkeys);
10321032 ent->disabled = true;
10331033 xa_unlock_irq(&ent->mkeys);
1034− cancel_delayed_work_sync(&ent->dwork);
10351034 }
1035+ mutex_unlock(&dev->cache.rb_lock);
1036+
1037+ /*
1038+ * After all entries are disabled and will not reschedule on WQ,
1039+ * flush it and all async commands.
1040+ */
1041+ flush_workqueue(dev->cache.wq);
10361042
10371043 mlx5_mkey_cache_debugfs_cleanup(dev);
10381044 mlx5_cmd_cleanup_async_ctx(&dev->async_ctx);
10391045
1046+ /* At this point all entries are disabled and have no concurrent work. */
1047+ mutex_lock(&dev->cache.rb_lock);
10401048 node = rb_first(root);
10411049 while (node) {
10421050 ent = rb_entry(node, struct mlx5_cache_ent, node);
drivers/infiniband/sw/siw/siw_cm.c+12−4
@@ -976,6 +976,7 @@ static void siw_accept_newconn(struct siw_cep *cep) · 975 unmodified lines
976976 siw_cep_put(cep);
977977 new_cep->listen_cep = NULL;
978978 if (rv) {
979+ siw_cancel_mpatimer(new_cep);
979980 siw_cep_set_free(new_cep);
980981 goto error;
981982 }
@@ -1100,9 +1101,12 @@ static void siw_cm_work_handler(struct work_struct *w) · 118 unmodified lines
11001101 /*
11011102 * Socket close before MPA request received.
11021103 */
1103− siw_dbg_cep(cep, "no mpareq: drop listener\n");
1104− siw_cep_put(cep->listen_cep);
1105− cep->listen_cep = NULL;
1104+ if (cep->listen_cep) {
1105+ siw_dbg_cep(cep,
1106+ "no mpareq: drop listener\n");
1107+ siw_cep_put(cep->listen_cep);
1108+ cep->listen_cep = NULL;
1109+ }
11061110 }
11071111 }
11081112 release_cep = 1;
@@ -1227,7 +1231,11 @@ static void siw_cm_llp_data_ready(struct sock *sk) · 118 unmodified lines
12271231 if (!cep)
12281232 goto out;
12291233
1230− siw_dbg_cep(cep, "state: %d\n", cep->state);
1234+ siw_dbg_cep(cep, "cep state: %d, socket state %d\n",
1235+ cep->state, sk->sk_state);
1236+
1237+ if (sk->sk_state != TCP_ESTABLISHED)
1238+ goto out;
12311239
12321240 switch (cep->state) {
12331241 case SIW_EPSTATE_RDMA_MODE:
drivers/infiniband/ulp/srp/ib_srp.c+5−11
@@ -2784,7 +2784,6 @@ static int srp_abort(struct scsi_cmnd *scmnd) · 2783 unmodified lines
27842784 u32 tag;
27852785 u16 ch_idx;
27862786 struct srp_rdma_ch *ch;
2787− int ret;
27882787
27892788 shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
27902789
@@ -2798,19 +2797,14 @@ static int srp_abort(struct scsi_cmnd *scmnd) · 7 unmodified lines
27982797 shost_printk(KERN_ERR, target->scsi_host,
27992798 "Sending SRP abort for tag %#x\n", tag);
28002799 if (srp_send_tsk_mgmt(ch, tag, scmnd->device->lun,
2801− SRP_TSK_ABORT_TASK, NULL) == 0)
2802− ret = SUCCESS;
2803− else if (target->rport->state == SRP_RPORT_LOST)
2804− ret = FAST_IO_FAIL;
2805− else
2806− ret = FAILED;
2807− if (ret == SUCCESS) {
2800+ SRP_TSK_ABORT_TASK, NULL) == 0) {
28082801 srp_free_req(ch, req, scmnd, 0);
2809− scmnd->result = DID_ABORT << 16;
2810− scsi_done(scmnd);
2802+ return SUCCESS;
28112803 }
2804+ if (target->rport->state == SRP_RPORT_LOST)
2805+ return FAST_IO_FAIL;
28122806
2813− return ret;
2807+ return FAILED;
28142808 }
28152809
28162810 static int srp_reset_device(struct scsi_cmnd *scmnd)
drivers/input/joystick/xpad.c+4−0
@@ -130,6 +130,7 @@ static const struct xpad_device { · 129 unmodified lines
130130 { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
131131 { 0x03eb, 0xff01, "Wooting One (Legacy)", 0, XTYPE_XBOX360 },
132132 { 0x03eb, 0xff02, "Wooting Two (Legacy)", 0, XTYPE_XBOX360 },
133+ { 0x03f0, 0x0495, "HyperX Clutch Gladiate", 0, XTYPE_XBOXONE },
133134 { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX },
134135 { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX },
135136 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
@@ -272,6 +273,7 @@ static const struct xpad_device { · 136 unmodified lines
272273 { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 },
273274 { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 },
274275 { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 },
276+ { 0x11ff, 0x0511, "PXN V900", 0, XTYPE_XBOX360 },
275277 { 0x1209, 0x2882, "Ardwiino Controller", 0, XTYPE_XBOX360 },
276278 { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
277279 { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 },
@@ -459,6 +461,7 @@ static const struct usb_device_id xpad_table[] = { · 181 unmodified lines
459461 { USB_INTERFACE_INFO('X', 'B', 0) }, /* Xbox USB-IF not-approved class */
460462 XPAD_XBOX360_VENDOR(0x0079), /* GPD Win 2 controller */
461463 XPAD_XBOX360_VENDOR(0x03eb), /* Wooting Keyboards (Legacy) */
464+ XPAD_XBOXONE_VENDOR(0x03f0), /* HP HyperX Xbox One controllers */
462465 XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster Xbox 360 controllers */
463466 XPAD_XBOX360_VENDOR(0x045e), /* Microsoft Xbox 360 controllers */
464467 XPAD_XBOXONE_VENDOR(0x045e), /* Microsoft Xbox One controllers */
@@ -477,6 +480,7 @@ static const struct usb_device_id xpad_table[] = { · 12 unmodified lines
477480 XPAD_XBOX360_VENDOR(0x1038), /* SteelSeries controllers */
478481 XPAD_XBOXONE_VENDOR(0x10f5), /* Turtle Beach Controllers */
479482 XPAD_XBOX360_VENDOR(0x11c9), /* Nacon GC100XF */
483+ XPAD_XBOX360_VENDOR(0x11ff), /* PXN V900 */
480484 XPAD_XBOX360_VENDOR(0x1209), /* Ardwiino Controllers */
481485 XPAD_XBOX360_VENDOR(0x12ab), /* Xbox 360 dance pads */
482486 XPAD_XBOX360_VENDOR(0x1430), /* RedOctane Xbox 360 controllers */
drivers/input/misc/powermate.c+1−0
@@ -425,6 +425,7 @@ static void powermate_disconnect(struct usb_interface *intf) · 424 unmodified lines
425425 pm->requires_update = 0;
426426 usb_kill_urb(pm->irq);
427427 input_unregister_device(pm->input);
428+ usb_kill_urb(pm->config);
428429 usb_free_urb(pm->irq);
429430 usb_free_urb(pm->config);
430431 powermate_free_buffers(interface_to_usbdev(intf), pm);
drivers/input/mouse/elantech.c+1−0
@@ -2114,6 +2114,7 @@ static int elantech_setup_ps2(struct psmouse *psmouse, · 2113 unmodified lines
21142114 psmouse->protocol_handler = elantech_process_byte;
21152115 psmouse->disconnect = elantech_disconnect;
21162116 psmouse->reconnect = elantech_reconnect;
2117+ psmouse->fast_reconnect = NULL;
21172118 psmouse->pktsize = info->hw_version > 1 ? 6 : 4;
21182119
21192120 return 0;
drivers/input/mouse/psmouse-smbus.c+7−12
@@ -5,7 +5,6 @@ · 4 unmodified lines
55
66 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
77
8−#include <linux/delay.h>
98 #include <linux/kernel.h>
109 #include <linux/module.h>
1110 #include <linux/libps2.h>
@@ -119,18 +118,13 @@ static psmouse_ret_t psmouse_smbus_process_byte(struct psmouse *psmouse) · 107 unmodified lines
119118 return PSMOUSE_FULL_PACKET;
120119 }
121120
122−static void psmouse_activate_smbus_mode(struct psmouse_smbus_dev *smbdev)
123−{
124− if (smbdev->need_deactivate) {
125− psmouse_deactivate(smbdev->psmouse);
126− /* Give the device time to switch into SMBus mode */
127− msleep(30);
128− }
129−}
130−
131121 static int psmouse_smbus_reconnect(struct psmouse *psmouse)
132122 {
133− psmouse_activate_smbus_mode(psmouse->private);
123+ struct psmouse_smbus_dev *smbdev = psmouse->private;
124+
125+ if (smbdev->need_deactivate)
126+ psmouse_deactivate(psmouse);
127+
134128 return 0;
135129 }
136130
@@ -263,7 +257,8 @@ int psmouse_smbus_init(struct psmouse *psmouse, · 126 unmodified lines
263257 }
264258 }
265259
266− psmouse_activate_smbus_mode(smbdev);
260+ if (need_deactivate)
261+ psmouse_deactivate(psmouse);
267262
268263 psmouse->private = smbdev;
269264 psmouse->protocol_handler = psmouse_smbus_process_byte;
drivers/input/mouse/synaptics.c+2−0
@@ -1623,6 +1623,7 @@ static int synaptics_init_ps2(struct psmouse *psmouse, · 1622 unmodified lines
16231623 psmouse->set_rate = synaptics_set_rate;
16241624 psmouse->disconnect = synaptics_disconnect;
16251625 psmouse->reconnect = synaptics_reconnect;
1626+ psmouse->fast_reconnect = NULL;
16261627 psmouse->cleanup = synaptics_reset;
16271628 /* Synaptics can usually stay in sync without extra help */
16281629 psmouse->resync_time = 0;
@@ -1752,6 +1753,7 @@ static int synaptics_create_intertouch(struct psmouse *psmouse, · 123 unmodified lines
17521753 psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) &&
17531754 !SYN_CAP_EXT_BUTTONS_STICK(info->ext_cap_10);
17541755 const struct rmi_device_platform_data pdata = {
1756+ .reset_delay_ms = 30,
17551757 .sensor_pdata = {
17561758 .sensor_type = rmi_sensor_touchpad,
17571759 .axis_align.flip_y = true,
drivers/input/rmi4/rmi_smbus.c+28−22
@@ -235,12 +235,29 @@ static void rmi_smb_clear_state(struct rmi_smb_xport *rmi_smb) · 234 unmodified lines
235235
236236 static int rmi_smb_enable_smbus_mode(struct rmi_smb_xport *rmi_smb)
237237 {
238− int retval;
238+ struct i2c_client *client = rmi_smb->client;
239+ int smbus_version;
240+
241+ /*
242+ * psmouse driver resets the controller, we only need to wait
243+ * to give the firmware chance to fully reinitialize.
244+ */
245+ if (rmi_smb->xport.pdata.reset_delay_ms)
246+ msleep(rmi_smb->xport.pdata.reset_delay_ms);
239247
240248 /* we need to get the smbus version to activate the touchpad */
241− retval = rmi_smb_get_version(rmi_smb);
242− if (retval < 0)
243− return retval;
249+ smbus_version = rmi_smb_get_version(rmi_smb);
250+ if (smbus_version < 0)
251+ return smbus_version;
252+
253+ rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Smbus version is %d",
254+ smbus_version);
255+
256+ if (smbus_version != 2 && smbus_version != 3) {
257+ dev_err(&client->dev, "Unrecognized SMB version %d\n",
258+ smbus_version);
259+ return -ENODEV;
260+ }
244261
245262 return 0;
246263 }
@@ -253,11 +270,10 @@ static int rmi_smb_reset(struct rmi_transport_dev *xport, u16 reset_addr) · 6 unmodified lines
253270 rmi_smb_clear_state(rmi_smb);
254271
255272 /*
256− * we do not call the actual reset command, it has to be handled in
257− * PS/2 or there will be races between PS/2 and SMBus.
258− * PS/2 should ensure that a psmouse_reset is called before
259− * intializing the device and after it has been removed to be in a known
260− * state.
273+ * We do not call the actual reset command, it has to be handled in
274+ * PS/2 or there will be races between PS/2 and SMBus. PS/2 should
275+ * ensure that a psmouse_reset is called before initializing the
276+ * device and after it has been removed to be in a known state.
261277 */
262278 return rmi_smb_enable_smbus_mode(rmi_smb);
263279 }
@@ -272,7 +288,6 @@ static int rmi_smb_probe(struct i2c_client *client) · 8 unmodified lines
272288 {
273289 struct rmi_device_platform_data *pdata = dev_get_platdata(&client->dev);
274290 struct rmi_smb_xport *rmi_smb;
275− int smbus_version;
276291 int error;
277292
278293 if (!pdata) {
@@ -311,18 +326,9 @@ static int rmi_smb_probe(struct i2c_client *client) · 32 unmodified lines
311326 rmi_smb->xport.proto_name = "smb";
312327 rmi_smb->xport.ops = &rmi_smb_ops;
313328
314− smbus_version = rmi_smb_get_version(rmi_smb);
315− if (smbus_version < 0)
316− return smbus_version;
317−
318− rmi_dbg(RMI_DEBUG_XPORT, &client->dev, "Smbus version is %d",
319− smbus_version);
320−
321− if (smbus_version != 2 && smbus_version != 3) {
322− dev_err(&client->dev, "Unrecognized SMB version %d\n",
323− smbus_version);
324− return -ENODEV;
325− }
329+ error = rmi_smb_enable_smbus_mode(rmi_smb);
330+ if (error)
331+ return error;
326332
327333 i2c_set_clientdata(client, rmi_smb);
328334
drivers/input/serio/i8042-acpipnpio.h+8−0
@@ -618,6 +618,14 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { · 617 unmodified lines
618618 },
619619 .driver_data = (void *)(SERIO_QUIRK_NOMUX)
620620 },
621+ {
622+ /* Fujitsu Lifebook E5411 */
623+ .matches = {
624+ DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU CLIENT COMPUTING LIMITED"),
625+ DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E5411"),
626+ },
627+ .driver_data = (void *)(SERIO_QUIRK_NOAUX)
628+ },
621629 {
622630 /* Gigabyte M912 */
623631 .matches = {
drivers/input/touchscreen/goodix.c+19−0
@@ -900,6 +900,25 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) · 899 unmodified lines
900900 dev_info(dev, "No ACPI GpioInt resource, assuming that the GPIO order is reset, int\n");
901901 ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
902902 gpio_mapping = acpi_goodix_int_last_gpios;
903+ } else if (ts->gpio_count == 1 && ts->gpio_int_idx == 0) {
904+ /*
905+ * On newer devices there is only 1 GpioInt resource and _PS0
906+ * does the whole reset sequence for us.
907+ */
908+ acpi_device_fix_up_power(ACPI_COMPANION(dev));
909+
910+ /*
911+ * Before the _PS0 call the int GPIO may have been in output
912+ * mode and the call should have put the int GPIO in input mode,
913+ * but the GPIO subsys cached state may still think it is
914+ * in output mode, causing gpiochip_lock_as_irq() failure.
915+ *
916+ * Add a mapping for the int GPIO to make the
917+ * gpiod_int = gpiod_get(..., GPIOD_IN) call succeed,
918+ * which will explicitly set the direction to input.
919+ */
920+ ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE;
921+ gpio_mapping = acpi_goodix_int_first_gpios;
903922 } else {
904923 dev_warn(dev, "Unexpected ACPI resources: gpio_count %d, gpio_int_idx %d\n",
905924 ts->gpio_count, ts->gpio_int_idx);
drivers/iommu/apple-dart.c+1−2
@@ -671,8 +671,7 @@ static int apple_dart_attach_dev(struct iommu_domain *domain, · 670 unmodified lines
671671 return ret;
672672
673673 switch (domain->type) {
674− case IOMMU_DOMAIN_DMA:
675− case IOMMU_DOMAIN_UNMANAGED:
674+ default:
676675 ret = apple_dart_domain_add_streams(dart_domain, cfg);
677676 if (ret)
678677 return ret;
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-sva.c+16−2
@@ -186,6 +186,15 @@ static void arm_smmu_free_shared_cd(struct arm_smmu_ctx_desc *cd) · 185 unmodified lines
186186 }
187187 }
188188
189+/*
190+ * Cloned from the MAX_TLBI_OPS in arch/arm64/include/asm/tlbflush.h, this
191+ * is used as a threshold to replace per-page TLBI commands to issue in the
192+ * command queue with an address-space TLBI command, when SMMU w/o a range
193+ * invalidation feature handles too many per-page TLBI commands, which will
194+ * otherwise result in a soft lockup.
195+ */
196+#define CMDQ_MAX_TLBI_OPS (1 << (PAGE_SHIFT - 3))
197+
189198 static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn,
190199 struct mm_struct *mm,
191200 unsigned long start,
@@ -201,8 +210,13 @@ static void arm_smmu_mm_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn, · 9 unmodified lines
201210 * range. So do a simple translation here by calculating size correctly.
202211 */
203212 size = end - start;
204− if (size == ULONG_MAX)
205− size = 0;
213+ if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_RANGE_INV)) {
214+ if (size >= CMDQ_MAX_TLBI_OPS * PAGE_SIZE)
215+ size = 0;
216+ } else {
217+ if (size == ULONG_MAX)
218+ size = 0;
219+ }
206220
207221 if (!(smmu_domain->smmu->features & ARM_SMMU_FEAT_BTM)) {
208222 if (!size)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c+10−5
@@ -1895,18 +1895,23 @@ static void __arm_smmu_tlb_inv_range(struct arm_smmu_cmdq_ent *cmd, · 1894 unmodified lines
18951895 /* Get the leaf page size */
18961896 tg = __ffs(smmu_domain->domain.pgsize_bitmap);
18971897
1898+ num_pages = size >> tg;
1899+
18981900 /* Convert page size of 12,14,16 (log2) to 1,2,3 */
18991901 cmd->tlbi.tg = (tg - 10) / 2;
19001902
19011903 /*
1902− * Determine what level the granule is at. For non-leaf, io-pgtable
1903− * assumes .tlb_flush_walk can invalidate multiple levels at once,
1904− * so ignore the nominal last-level granule and leave TTL=0.
1904+ * Determine what level the granule is at. For non-leaf, both
1905+ * io-pgtable and SVA pass a nominal last-level granule because
1906+ * they don't know what level(s) actually apply, so ignore that
1907+ * and leave TTL=0. However for various errata reasons we still
1908+ * want to use a range command, so avoid the SVA corner case
1909+ * where both scale and num could be 0 as well.
19051910 */
19061911 if (cmd->tlbi.leaf)
19071912 cmd->tlbi.ttl = 4 - ((ilog2(granule) - 3) / (tg - 3));
1908−
1909− num_pages = size >> tg;
1913+ else if ((num_pages & CMDQ_TLBI_RANGE_NUM_MAX) == 1)
1914+ num_pages++;
19101915 }
19111916
19121917 cmds.num = 0;
drivers/iommu/intel/iommu.c+0−16
@@ -2998,13 +2998,6 @@ static int iommu_suspend(void) · 2997 unmodified lines
29982998 struct intel_iommu *iommu = NULL;
29992999 unsigned long flag;
30003000
3001− for_each_active_iommu(iommu, drhd) {
3002− iommu->iommu_state = kcalloc(MAX_SR_DMAR_REGS, sizeof(u32),
3003− GFP_KERNEL);
3004− if (!iommu->iommu_state)
3005− goto nomem;
3006− }
3007−
30083001 iommu_flush_all();
30093002
30103003 for_each_active_iommu(iommu, drhd) {
@@ -3024,12 +3017,6 @@ static int iommu_suspend(void) · 13 unmodified lines
30243017 raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
30253018 }
30263019 return 0;
3027−
3028−nomem:
3029− for_each_active_iommu(iommu, drhd)
3030− kfree(iommu->iommu_state);
3031−
3032− return -ENOMEM;
30333020 }
30343021
30353022 static void iommu_resume(void)
@@ -3061,9 +3048,6 @@ static void iommu_resume(void) · 25 unmodified lines
30613048
30623049 raw_spin_unlock_irqrestore(&iommu->register_lock, flag);
30633050 }
3064−
3065− for_each_active_iommu(iommu, drhd)
3066− kfree(iommu->iommu_state);
30673051 }
30683052
30693053 static struct syscore_ops iommu_syscore_ops = {
drivers/iommu/intel/iommu.h+1−1
@@ -681,7 +681,7 @@ struct intel_iommu { · 680 unmodified lines
681681 struct iopf_queue *iopf_queue;
682682 unsigned char iopfq_name[16];
683683 struct q_inval *qi; /* Queued invalidation info */
684− u32 *iommu_state; /* Store iommu states between suspend and resume.*/
684+ u32 iommu_state[MAX_SR_DMAR_REGS]; /* Store iommu states between suspend and resume.*/
685685
686686 #ifdef CONFIG_IRQ_REMAP
687687 struct ir_table *ir_table; /* Interrupt remapping info */
drivers/iommu/mtk_iommu.c+4−5
@@ -262,7 +262,7 @@ struct mtk_iommu_data { · 261 unmodified lines
262262 struct device *smicomm_dev;
263263
264264 struct mtk_iommu_bank_data *bank;
265− struct mtk_iommu_domain *share_dom; /* For 2 HWs share pgtable */
265+ struct mtk_iommu_domain *share_dom;
266266
267267 struct regmap *pericfg;
268268 struct mutex mutex; /* Protect m4u_group/m4u_dom above */
@@ -643,8 +643,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom, · 374 unmodified lines
643643 struct mtk_iommu_domain *share_dom = data->share_dom;
644644 const struct mtk_iommu_iova_region *region;
645645
646− /* Always use share domain in sharing pgtable case */
647− if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE) && share_dom) {
646+ /* Share pgtable when 2 MM IOMMU share the pgtable or one IOMMU use multiple iova ranges */
647+ if (share_dom) {
648648 dom->iop = share_dom->iop;
649649 dom->cfg = share_dom->cfg;
650650 dom->domain.pgsize_bitmap = share_dom->cfg.pgsize_bitmap;
@@ -677,8 +677,7 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom, · 26 unmodified lines
677677 /* Update our support page sizes bitmap */
678678 dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap;
679679
680− if (MTK_IOMMU_HAS_FLAG(data->plat_data, SHARE_PGTABLE))
681− data->share_dom = dom;
680+ data->share_dom = dom;
682681
683682 update_iova_region:
684683 /* Update the iova region for this domain */
drivers/irqchip/irq-gic-common.h+4−0
@@ -29,4 +29,8 @@ void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks, · 28 unmodified lines
2929 void gic_enable_of_quirks(const struct device_node *np,
3030 const struct gic_quirk *quirks, void *data);
3131
32+#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
33+#define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1)
34+#define RDIST_FLAGS_FORCE_NON_SHAREABLE (1 << 2)
35+
3236 #endif /* _IRQ_GIC_COMMON_H */
drivers/irqchip/irq-gic-v3-its.c+106−64
@@ -44,10 +44,6 @@ · 43 unmodified lines
4444 #define ITS_FLAGS_WORKAROUND_CAVIUM_23144 (1ULL << 2)
4545 #define ITS_FLAGS_FORCE_NON_SHAREABLE (1ULL << 3)
4646
47−#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
48−#define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1)
49−#define RDIST_FLAGS_FORCE_NON_SHAREABLE (1 << 2)
50−
5147 #define RD_LOCAL_LPI_ENABLED BIT(0)
5248 #define RD_LOCAL_PENDTABLE_PREALLOCATED BIT(1)
5349 #define RD_LOCAL_MEMRESERVE_DONE BIT(2)
@@ -4754,6 +4750,14 @@ static bool __maybe_unused its_enable_rk3588001(void *data) · 4700 unmodified lines
47544750 return true;
47554751 }
47564752
4753+static bool its_set_non_coherent(void *data)
4754+{
4755+ struct its_node *its = data;
4756+
4757+ its->flags |= ITS_FLAGS_FORCE_NON_SHAREABLE;
4758+ return true;
4759+}
4760+
47574761 static const struct gic_quirk its_quirks[] = {
47584762 #ifdef CONFIG_CAVIUM_ERRATUM_22375
47594763 {
@@ -4808,6 +4812,11 @@ static const struct gic_quirk its_quirks[] = { · 48 unmodified lines
48084812 .init = its_enable_rk3588001,
48094813 },
48104814 #endif
4815+ {
4816+ .desc = "ITS: non-coherent attribute",
4817+ .property = "dma-noncoherent",
4818+ .init = its_set_non_coherent,
4819+ },
48114820 {
48124821 }
48134822 };
@@ -4817,6 +4826,10 @@ static void its_enable_quirks(struct its_node *its) · 3 unmodified lines
48174826 u32 iidr = readl_relaxed(its->base + GITS_IIDR);
48184827
48194828 gic_enable_quirks(iidr, its_quirks, its);
4829+
4830+ if (is_of_node(its->fwnode_handle))
4831+ gic_enable_of_quirks(to_of_node(its->fwnode_handle),
4832+ its_quirks, its);
48204833 }
48214834
48224835 static int its_save_disable(void)
@@ -4952,7 +4965,7 @@ out_unmap: · 129 unmodified lines
49524965 return NULL;
49534966 }
49544967
4955−static int its_init_domain(struct fwnode_handle *handle, struct its_node *its)
4968+static int its_init_domain(struct its_node *its)
49564969 {
49574970 struct irq_domain *inner_domain;
49584971 struct msi_domain_info *info;
@@ -4966,7 +4979,7 @@ static int its_init_domain(struct fwnode_handle *handle, struct its_node *its) · 7 unmodified lines
49664979
49674980 inner_domain = irq_domain_create_hierarchy(its_parent,
49684981 its->msi_domain_flags, 0,
4969− handle, &its_domain_ops,
4982+ its->fwnode_handle, &its_domain_ops,
49704983 info);
49714984 if (!inner_domain) {
49724985 kfree(info);
@@ -5017,8 +5030,7 @@ static int its_init_vpe_domain(void) · 44 unmodified lines
50175030 return 0;
50185031 }
50195032
5020−static int __init its_compute_its_list_map(struct resource *res,
5021− void __iomem *its_base)
5033+static int __init its_compute_its_list_map(struct its_node *its)
50225034 {
50235035 int its_number;
50245036 u32 ctlr;
@@ -5032,15 +5044,15 @@ static int __init its_compute_its_list_map(struct resource *res, · 7 unmodified lines
50325044 its_number = find_first_zero_bit(&its_list_map, GICv4_ITS_LIST_MAX);
50335045 if (its_number >= GICv4_ITS_LIST_MAX) {
50345046 pr_err("ITS@%pa: No ITSList entry available!\n",
5035− &res->start);
5047+ &its->phys_base);
50365048 return -EINVAL;
50375049 }
50385050
5039− ctlr = readl_relaxed(its_base + GITS_CTLR);
5051+ ctlr = readl_relaxed(its->base + GITS_CTLR);
50405052 ctlr &= ~GITS_CTLR_ITS_NUMBER;
50415053 ctlr |= its_number << GITS_CTLR_ITS_NUMBER_SHIFT;
5042− writel_relaxed(ctlr, its_base + GITS_CTLR);
5043− ctlr = readl_relaxed(its_base + GITS_CTLR);
5054+ writel_relaxed(ctlr, its->base + GITS_CTLR);
5055+ ctlr = readl_relaxed(its->base + GITS_CTLR);
50445056 if ((ctlr & GITS_CTLR_ITS_NUMBER) != (its_number << GITS_CTLR_ITS_NUMBER_SHIFT)) {
50455057 its_number = ctlr & GITS_CTLR_ITS_NUMBER;
50465058 its_number >>= GITS_CTLR_ITS_NUMBER_SHIFT;
@@ -5048,75 +5060,50 @@ static int __init its_compute_its_list_map(struct resource *res, · 1 unmodified line
50485060
50495061 if (test_and_set_bit(its_number, &its_list_map)) {
50505062 pr_err("ITS@%pa: Duplicate ITSList entry %d\n",
5051− &res->start, its_number);
5063+ &its->phys_base, its_number);
50525064 return -EINVAL;
50535065 }
50545066
50555067 return its_number;
50565068 }
50575069
5058−static int __init its_probe_one(struct resource *res,
5059− struct fwnode_handle *handle, int numa_node)
5070+static int __init its_probe_one(struct its_node *its)
50605071 {
5061− struct its_node *its;
5062− void __iomem *its_base;
5063− u64 baser, tmp, typer;
5072+ u64 baser, tmp;
50645073 struct page *page;
50655074 u32 ctlr;
50665075 int err;
50675076
5068− its_base = its_map_one(res, &err);
5069− if (!its_base)
5070− return err;
5071−
5072− pr_info("ITS %pR\n", res);
5073−
5074− its = kzalloc(sizeof(*its), GFP_KERNEL);
5075− if (!its) {
5076− err = -ENOMEM;
5077− goto out_unmap;
5078− }
5079−
5080− raw_spin_lock_init(&its->lock);
5081− mutex_init(&its->dev_alloc_lock);
5082− INIT_LIST_HEAD(&its->entry);
5083− INIT_LIST_HEAD(&its->its_device_list);
5084− typer = gic_read_typer(its_base + GITS_TYPER);
5085− its->typer = typer;
5086− its->base = its_base;
5087− its->phys_base = res->start;
50885077 if (is_v4(its)) {
5089− if (!(typer & GITS_TYPER_VMOVP)) {
5090− err = its_compute_its_list_map(res, its_base);
5078+ if (!(its->typer & GITS_TYPER_VMOVP)) {
5079+ err = its_compute_its_list_map(its);
50915080 if (err < 0)
5092− goto out_free_its;
5081+ goto out;
50935082
50945083 its->list_nr = err;
50955084
50965085 pr_info("ITS@%pa: Using ITS number %d\n",
5097− &res->start, err);
5086+ &its->phys_base, err);
50985087 } else {
5099− pr_info("ITS@%pa: Single VMOVP capable\n", &res->start);
5088+ pr_info("ITS@%pa: Single VMOVP capable\n", &its->phys_base);
51005089 }
51015090
51025091 if (is_v4_1(its)) {
5103− u32 svpet = FIELD_GET(GITS_TYPER_SVPET, typer);
5092+ u32 svpet = FIELD_GET(GITS_TYPER_SVPET, its->typer);
51045093
5105− its->sgir_base = ioremap(res->start + SZ_128K, SZ_64K);
5094+ its->sgir_base = ioremap(its->phys_base + SZ_128K, SZ_64K);
51065095 if (!its->sgir_base) {
51075096 err = -ENOMEM;
5108− goto out_free_its;
5097+ goto out;
51095098 }
51105099
5111− its->mpidr = readl_relaxed(its_base + GITS_MPIDR);
5100+ its->mpidr = readl_relaxed(its->base + GITS_MPIDR);
51125101
51135102 pr_info("ITS@%pa: Using GICv4.1 mode %08x %08x\n",
5114− &res->start, its->mpidr, svpet);
5103+ &its->phys_base, its->mpidr, svpet);
51155104 }
51165105 }
51175106
5118− its->numa_node = numa_node;
5119−
51205107 page = alloc_pages_node(its->numa_node, GFP_KERNEL | __GFP_ZERO,
51215108 get_order(ITS_CMD_QUEUE_SZ));
51225109 if (!page) {
@@ -5125,12 +5112,9 @@ static int __init its_probe_one(struct resource *res, · 2 unmodified lines
51255112 }
51265113 its->cmd_base = (void *)page_address(page);
51275114 its->cmd_write = its->cmd_base;
5128− its->fwnode_handle = handle;
51295115 its->get_msi_base = its_irq_get_msi_base;
51305116 its->msi_domain_flags = IRQ_DOMAIN_FLAG_ISOLATED_MSI;
51315117
5132− its_enable_quirks(its);
5133−
51345118 err = its_alloc_tables(its);
51355119 if (err)
51365120 goto out_free_cmd;
@@ -5174,7 +5158,7 @@ static int __init its_probe_one(struct resource *res, · 37 unmodified lines
51745158 ctlr |= GITS_CTLR_ImDe;
51755159 writel_relaxed(ctlr, its->base + GITS_CTLR);
51765160
5177− err = its_init_domain(handle, its);
5161+ err = its_init_domain(its);
51785162 if (err)
51795163 goto out_free_tables;
51805164
@@ -5191,11 +5175,8 @@ out_free_cmd: · 10 unmodified lines
51915175 out_unmap_sgir:
51925176 if (its->sgir_base)
51935177 iounmap(its->sgir_base);
5194−out_free_its:
5195− kfree(its);
5196−out_unmap:
5197− iounmap(its_base);
5198− pr_err("ITS@%pa: failed probing (%d)\n", &res->start, err);
5178+out:
5179+ pr_err("ITS@%pa: failed probing (%d)\n", &its->phys_base, err);
51995180 return err;
52005181 }
52015182
@@ -5356,10 +5337,53 @@ static const struct of_device_id its_device_id[] = { · 154 unmodified lines
53565337 {},
53575338 };
53585339
5340+static struct its_node __init *its_node_init(struct resource *res,
5341+ struct fwnode_handle *handle, int numa_node)
5342+{
5343+ void __iomem *its_base;
5344+ struct its_node *its;
5345+ int err;
5346+
5347+ its_base = its_map_one(res, &err);
5348+ if (!its_base)
5349+ return NULL;
5350+
5351+ pr_info("ITS %pR\n", res);
5352+
5353+ its = kzalloc(sizeof(*its), GFP_KERNEL);
5354+ if (!its)
5355+ goto out_unmap;
5356+
5357+ raw_spin_lock_init(&its->lock);
5358+ mutex_init(&its->dev_alloc_lock);
5359+ INIT_LIST_HEAD(&its->entry);
5360+ INIT_LIST_HEAD(&its->its_device_list);
5361+
5362+ its->typer = gic_read_typer(its_base + GITS_TYPER);
5363+ its->base = its_base;
5364+ its->phys_base = res->start;
5365+
5366+ its->numa_node = numa_node;
5367+ its->fwnode_handle = handle;
5368+
5369+ return its;
5370+
5371+out_unmap:
5372+ iounmap(its_base);
5373+ return NULL;
5374+}
5375+
5376+static void its_node_destroy(struct its_node *its)
5377+{
5378+ iounmap(its->base);
5379+ kfree(its);
5380+}
5381+
53595382 static int __init its_of_probe(struct device_node *node)
53605383 {
53615384 struct device_node *np;
53625385 struct resource res;
5386+ int err;
53635387
53645388 /*
53655389 * Make sure *all* the ITS are reset before we probe any, as
@@ -5369,8 +5393,6 @@ static int __init its_of_probe(struct device_node *node) · 3 unmodified lines
53695393 */
53705394 for (np = of_find_matching_node(node, its_device_id); np;
53715395 np = of_find_matching_node(np, its_device_id)) {
5372− int err;
5373−
53745396 if (!of_device_is_available(np) ||
53755397 !of_property_read_bool(np, "msi-controller") ||
53765398 of_address_to_resource(np, 0, &res))
@@ -5383,6 +5405,8 @@ static int __init its_of_probe(struct device_node *node) · 6 unmodified lines
53835405
53845406 for (np = of_find_matching_node(node, its_device_id); np;
53855407 np = of_find_matching_node(np, its_device_id)) {
5408+ struct its_node *its;
5409+
53865410 if (!of_device_is_available(np))
53875411 continue;
53885412 if (!of_property_read_bool(np, "msi-controller")) {
@@ -5396,7 +5420,17 @@ static int __init its_of_probe(struct device_node *node) · 7 unmodified lines
53965420 continue;
53975421 }
53985422
5399− its_probe_one(&res, &np->fwnode, of_node_to_nid(np));
5423+
5424+ its = its_node_init(&res, &np->fwnode, of_node_to_nid(np));
5425+ if (!its)
5426+ return -ENOMEM;
5427+
5428+ its_enable_quirks(its);
5429+ err = its_probe_one(its);
5430+ if (err) {
5431+ its_node_destroy(its);
5432+ return err;
5433+ }
54005434 }
54015435 return 0;
54025436 }
@@ -5508,6 +5542,7 @@ static int __init gic_acpi_parse_madt_its(union acpi_subtable_headers *header, · 105 unmodified lines
55085542 {
55095543 struct acpi_madt_generic_translator *its_entry;
55105544 struct fwnode_handle *dom_handle;
5545+ struct its_node *its;
55115546 struct resource res;
55125547 int err;
55135548
@@ -5532,11 +5567,18 @@ static int __init gic_acpi_parse_madt_its(union acpi_subtable_headers *header, · 18 unmodified lines
55325567 goto dom_err;
55335568 }
55345569
5535− err = its_probe_one(&res, dom_handle,
5536− acpi_get_its_numa_node(its_entry->translation_id));
5570+ its = its_node_init(&res, dom_handle,
5571+ acpi_get_its_numa_node(its_entry->translation_id));
5572+ if (!its) {
5573+ err = -ENOMEM;
5574+ goto node_err;
5575+ }
5576+
5577+ err = its_probe_one(its);
55375578 if (!err)
55385579 return 0;
55395580
5581+node_err:
55405582 iort_deregister_domain_token(its_entry->translation_id);
55415583 dom_err:
55425584 irq_domain_free_fwnode(dom_handle);
drivers/irqchip/irq-gic-v3.c+13−0
@@ -1857,6 +1857,14 @@ static bool gic_enable_quirk_arm64_2941627(void *data) · 1856 unmodified lines
18571857 return true;
18581858 }
18591859
1860+static bool rd_set_non_coherent(void *data)
1861+{
1862+ struct gic_chip_data *d = data;
1863+
1864+ d->rdists.flags |= RDIST_FLAGS_FORCE_NON_SHAREABLE;
1865+ return true;
1866+}
1867+
18601868 static const struct gic_quirk gic_quirks[] = {
18611869 {
18621870 .desc = "GICv3: Qualcomm MSM8996 broken firmware",
@@ -1923,6 +1931,11 @@ static const struct gic_quirk gic_quirks[] = { · 60 unmodified lines
19231931 .mask = 0xff0f0fff,
19241932 .init = gic_enable_quirk_arm64_2941627,
19251933 },
1934+ {
1935+ .desc = "GICv3: non-coherent attribute",
1936+ .property = "dma-noncoherent",
1937+ .init = rd_set_non_coherent,
1938+ },
19261939 {
19271940 }
19281941 };
drivers/irqchip/irq-renesas-rzg2l.c+2−2
@@ -118,7 +118,7 @@ static void rzg2l_irqc_irq_disable(struct irq_data *d) · 117 unmodified lines
118118
119119 raw_spin_lock(&priv->lock);
120120 reg = readl_relaxed(priv->base + TSSR(tssr_index));
121− reg &= ~(TSSEL_MASK << tssr_offset);
121+ reg &= ~(TSSEL_MASK << TSSEL_SHIFT(tssr_offset));
122122 writel_relaxed(reg, priv->base + TSSR(tssr_index));
123123 raw_spin_unlock(&priv->lock);
124124 }
@@ -130,8 +130,8 @@ static void rzg2l_irqc_irq_enable(struct irq_data *d) · 5 unmodified lines
130130 unsigned int hw_irq = irqd_to_hwirq(d);
131131
132132 if (hw_irq >= IRQC_TINT_START && hw_irq < IRQC_NUM_IRQ) {
133+ unsigned long tint = (uintptr_t)irq_data_get_irq_chip_data(d);
133134 struct rzg2l_irqc_priv *priv = irq_data_to_priv(d);
134− unsigned long tint = (uintptr_t)d->chip_data;
135135 u32 offset = hw_irq - IRQC_TINT_START;
136136 u32 tssr_offset = TSSR_OFFSET(offset);
137137 u8 tssr_index = TSSR_INDEX(offset);
drivers/irqchip/irq-riscv-intc.c+9−1
@@ -155,8 +155,16 @@ static int __init riscv_intc_init(struct device_node *node, · 154 unmodified lines
155155 * for each INTC DT node. We only need to do INTC initialization
156156 * for the INTC DT node belonging to boot CPU (or boot HART).
157157 */
158− if (riscv_hartid_to_cpuid(hartid) != smp_processor_id())
158+ if (riscv_hartid_to_cpuid(hartid) != smp_processor_id()) {
159+ /*
160+ * The INTC nodes of each CPU are suppliers for downstream
161+ * interrupt controllers (such as PLIC, IMSIC and APLIC
162+ * direct-mode) so we should mark an INTC node as initialized
163+ * if we are not creating IRQ domain for it.
164+ */
165+ fwnode_dev_initialized(of_fwnode_handle(node), true);
159166 return 0;
167+ }
160168
161169 return riscv_intc_init_common(of_node_to_fwnode(node));
162170 }
drivers/irqchip/irq-stm32-exti.c+1−0
@@ -460,6 +460,7 @@ static const struct irq_domain_ops irq_exti_domain_ops = { · 459 unmodified lines
460460 .map = irq_map_generic_chip,
461461 .alloc = stm32_exti_alloc,
462462 .free = stm32_exti_free,
463+ .xlate = irq_domain_xlate_twocell,
463464 };
464465
465466 static void stm32_irq_ack(struct irq_data *d)
drivers/irqchip/qcom-pdc.c+51−18
@@ -22,9 +22,20 @@ · 21 unmodified lines
2222
2323 #define PDC_MAX_GPIO_IRQS 256
2424
25+/* Valid only on HW version < 3.2 */
2526 #define IRQ_ENABLE_BANK 0x10
2627 #define IRQ_i_CFG 0x110
2728
29+/* Valid only on HW version >= 3.2 */
30+#define IRQ_i_CFG_IRQ_ENABLE 3
31+
32+#define IRQ_i_CFG_TYPE_MASK GENMASK(2, 0)
33+
34+#define PDC_VERSION_REG 0x1000
35+
36+/* Notable PDC versions */
37+#define PDC_VERSION_3_2 0x30200
38+
2839 struct pdc_pin_region {
2940 u32 pin_base;
3041 u32 parent_base;
@@ -37,6 +48,7 @@ static DEFINE_RAW_SPINLOCK(pdc_lock); · 6 unmodified lines
3748 static void __iomem *pdc_base;
3849 static struct pdc_pin_region *pdc_region;
3950 static int pdc_region_cnt;
51+static unsigned int pdc_version;
4052
4153 static void pdc_reg_write(int reg, u32 i, u32 val)
4254 {
@@ -48,20 +60,32 @@ static u32 pdc_reg_read(int reg, u32 i) · 5 unmodified lines
4860 return readl_relaxed(pdc_base + reg + i * sizeof(u32));
4961 }
5062
51−static void pdc_enable_intr(struct irq_data *d, bool on)
63+static void __pdc_enable_intr(int pin_out, bool on)
5264 {
53− int pin_out = d->hwirq;
5465 unsigned long enable;
55− unsigned long flags;
56− u32 index, mask;
5766
58− index = pin_out / 32;
59− mask = pin_out % 32;
67+ if (pdc_version < PDC_VERSION_3_2) {
68+ u32 index, mask;
69+
70+ index = pin_out / 32;
71+ mask = pin_out % 32;
72+
73+ enable = pdc_reg_read(IRQ_ENABLE_BANK, index);
74+ __assign_bit(mask, &enable, on);
75+ pdc_reg_write(IRQ_ENABLE_BANK, index, enable);
76+ } else {
77+ enable = pdc_reg_read(IRQ_i_CFG, pin_out);
78+ __assign_bit(IRQ_i_CFG_IRQ_ENABLE, &enable, on);
79+ pdc_reg_write(IRQ_i_CFG, pin_out, enable);
80+ }
81+}
82+
83+static void pdc_enable_intr(struct irq_data *d, bool on)
84+{
85+ unsigned long flags;
6086
6187 raw_spin_lock_irqsave(&pdc_lock, flags);
62− enable = pdc_reg_read(IRQ_ENABLE_BANK, index);
63− __assign_bit(mask, &enable, on);
64− pdc_reg_write(IRQ_ENABLE_BANK, index, enable);
88+ __pdc_enable_intr(d->hwirq, on);
6589 raw_spin_unlock_irqrestore(&pdc_lock, flags);
6690 }
6791
@@ -142,6 +166,7 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) · 74 unmodified lines
142166 }
143167
144168 old_pdc_type = pdc_reg_read(IRQ_i_CFG, d->hwirq);
169+ pdc_type |= (old_pdc_type & ~IRQ_i_CFG_TYPE_MASK);
145170 pdc_reg_write(IRQ_i_CFG, d->hwirq, pdc_type);
146171
147172 ret = irq_chip_set_type_parent(d, type);
@@ -246,7 +271,6 @@ static const struct irq_domain_ops qcom_pdc_ops = { · 98 unmodified lines
246271 static int pdc_setup_pin_mapping(struct device_node *np)
247272 {
248273 int ret, n, i;
249− u32 irq_index, reg_index, val;
250274
251275 n = of_property_count_elems_of_size(np, "qcom,pdc-ranges", sizeof(u32));
252276 if (n <= 0 || n % 3)
@@ -276,29 +300,38 @@ static int pdc_setup_pin_mapping(struct device_node *np) · 23 unmodified lines
276300 if (ret)
277301 return ret;
278302
279− for (i = 0; i < pdc_region[n].cnt; i++) {
280− reg_index = (i + pdc_region[n].pin_base) >> 5;
281− irq_index = (i + pdc_region[n].pin_base) & 0x1f;
282− val = pdc_reg_read(IRQ_ENABLE_BANK, reg_index);
283− val &= ~BIT(irq_index);
284− pdc_reg_write(IRQ_ENABLE_BANK, reg_index, val);
285− }
303+ for (i = 0; i < pdc_region[n].cnt; i++)
304+ __pdc_enable_intr(i + pdc_region[n].pin_base, 0);
286305 }
287306
288307 return 0;
289308 }
290309
310+#define QCOM_PDC_SIZE 0x30000
311+
291312 static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
292313 {
293314 struct irq_domain *parent_domain, *pdc_domain;
315+ resource_size_t res_size;
316+ struct resource res;
294317 int ret;
295318
296− pdc_base = of_iomap(node, 0);
319+ /* compat with old sm8150 DT which had very small region for PDC */
320+ if (of_address_to_resource(node, 0, &res))
321+ return -EINVAL;
322+
323+ res_size = max_t(resource_size_t, resource_size(&res), QCOM_PDC_SIZE);
324+ if (res_size > resource_size(&res))
325+ pr_warn("%pOF: invalid reg size, please fix DT\n", node);
326+
327+ pdc_base = ioremap(res.start, res_size);
297328 if (!pdc_base) {
298329 pr_err("%pOF: unable to map PDC registers\n", node);
299330 return -ENXIO;
300331 }
301332
333+ pdc_version = pdc_reg_read(PDC_VERSION_REG, 0);
334+
302335 parent_domain = irq_find_host(parent);
303336 if (!parent_domain) {
304337 pr_err("%pOF: unable to find PDC's parent domain\n", node);
drivers/leds/led-core.c+0−4
@@ -479,10 +479,6 @@ int led_compose_name(struct device *dev, struct led_init_data *init_data, · 478 unmodified lines
479479
480480 led_parse_fwnode_props(dev, fwnode, &props);
481481
482− /* We want to label LEDs that can produce full range of colors
483− * as RGB, not multicolor */
484− BUG_ON(props.color == LED_COLOR_ID_MULTI);
485−
486482 if (props.label) {
487483 /*
488484 * If init_data.devicename is NULL, then it indicates that
drivers/mcb/mcb-core.c+3−7
@@ -387,17 +387,13 @@ EXPORT_SYMBOL_NS_GPL(mcb_free_dev, MCB); · 386 unmodified lines
387387
388388 static int __mcb_bus_add_devices(struct device *dev, void *data)
389389 {
390− struct mcb_device *mdev = to_mcb_device(dev);
391390 int retval;
392391
393− if (mdev->is_added)
394− return 0;
395−
396392 retval = device_attach(dev);
397− if (retval < 0)
393+ if (retval < 0) {
398394 dev_err(dev, "Error adding device (%d)\n", retval);
399−
400− mdev->is_added = true;
395+ return retval;
396+ }
401397
402398 return 0;
403399 }
drivers/mcb/mcb-parse.c+0−2
@@ -99,8 +99,6 @@ static int chameleon_parse_gdd(struct mcb_bus *bus, · 98 unmodified lines
9999 mdev->mem.end = mdev->mem.start + size - 1;
100100 mdev->mem.flags = IORESOURCE_MEM;
101101
102− mdev->is_added = false;
103−
104102 ret = mcb_device_register(bus, mdev);
105103 if (ret < 0)
106104 goto err;
drivers/md/dm-crypt.c+2−1
@@ -753,7 +753,8 @@ static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv, · 752 unmodified lines
753753 int err;
754754 u8 *buf;
755755
756− reqsize = ALIGN(crypto_skcipher_reqsize(tfm), __alignof__(__le64));
756+ reqsize = sizeof(*req) + crypto_skcipher_reqsize(tfm);
757+ reqsize = ALIGN(reqsize, __alignof__(__le64));
757758
758759 req = kmalloc(reqsize + cc->iv_size, GFP_NOIO);
759760 if (!req)
drivers/md/dm-zoned-target.c+7−8
@@ -748,17 +748,16 @@ err: · 747 unmodified lines
748748 /*
749749 * Cleanup zoned device information.
750750 */
751−static void dmz_put_zoned_device(struct dm_target *ti)
751+static void dmz_put_zoned_devices(struct dm_target *ti)
752752 {
753753 struct dmz_target *dmz = ti->private;
754754 int i;
755755
756− for (i = 0; i < dmz->nr_ddevs; i++) {
757− if (dmz->ddev[i]) {
756+ for (i = 0; i < dmz->nr_ddevs; i++)
757+ if (dmz->ddev[i])
758758 dm_put_device(ti, dmz->ddev[i]);
759− dmz->ddev[i] = NULL;
760− }
761− }
759+
760+ kfree(dmz->ddev);
762761 }
763762
764763 static int dmz_fixup_devices(struct dm_target *ti)
@@ -948,7 +947,7 @@ err_bio: · 183 unmodified lines
948947 err_meta:
949948 dmz_dtr_metadata(dmz->metadata);
950949 err_dev:
951− dmz_put_zoned_device(ti);
950+ dmz_put_zoned_devices(ti);
952951 err:
953952 kfree(dmz->dev);
954953 kfree(dmz);
@@ -978,7 +977,7 @@ static void dmz_dtr(struct dm_target *ti) · 23 unmodified lines
978977
979978 bioset_exit(&dmz->bio_set);
980979
981− dmz_put_zoned_device(ti);
980+ dmz_put_zoned_devices(ti);
982981
983982 mutex_destroy(&dmz->chunk_lock);
984983
drivers/md/raid5.c+7−0
@@ -854,6 +854,13 @@ struct stripe_head *raid5_get_active_stripe(struct r5conf *conf, · 853 unmodified lines
854854
855855 set_bit(R5_INACTIVE_BLOCKED, &conf->cache_state);
856856 r5l_wake_reclaim(conf->log, 0);
857+
858+ /* release batch_last before wait to avoid risk of deadlock */
859+ if (ctx && ctx->batch_last) {
860+ raid5_release_stripe(ctx->batch_last);
861+ ctx->batch_last = NULL;
862+ }
863+
857864 wait_event_lock_irq(conf->wait_for_stripe,
858865 is_inactive_blocked(conf, hash),
859866 *(conf->hash_locks + hash));
drivers/media/i2c/ov8858.c+2−8
@@ -1850,9 +1850,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858) · 1849 unmodified lines
18501850 }
18511851
18521852 ret = v4l2_fwnode_endpoint_parse(endpoint, &vep);
1853+ fwnode_handle_put(endpoint);
18531854 if (ret) {
18541855 dev_err(dev, "Failed to parse endpoint: %d\n", ret);
1855− fwnode_handle_put(endpoint);
18561856 return ret;
18571857 }
18581858
@@ -1864,12 +1864,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858) · 5 unmodified lines
18641864 default:
18651865 dev_err(dev, "Unsupported number of data lanes %u\n",
18661866 ov8858->num_lanes);
1867− fwnode_handle_put(endpoint);
18681867 return -EINVAL;
18691868 }
18701869
1871− ov8858->subdev.fwnode = endpoint;
1872−
18731870 return 0;
18741871 }
18751872
@@ -1913,7 +1910,7 @@ static int ov8858_probe(struct i2c_client *client) · 37 unmodified lines
19131910
19141911 ret = ov8858_init_ctrls(ov8858);
19151912 if (ret)
1916− goto err_put_fwnode;
1913+ return ret;
19171914
19181915 sd = &ov8858->subdev;
19191916 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
@@ -1964,8 +1961,6 @@ err_clean_entity: · 44 unmodified lines
19641961 media_entity_cleanup(&sd->entity);
19651962 err_free_handler:
19661963 v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
1967−err_put_fwnode:
1968− fwnode_handle_put(ov8858->subdev.fwnode);
19691964
19701965 return ret;
19711966 }
@@ -1978,7 +1973,6 @@ static void ov8858_remove(struct i2c_client *client) · 6 unmodified lines
19781973 v4l2_async_unregister_subdev(sd);
19791974 media_entity_cleanup(&sd->entity);
19801975 v4l2_ctrl_handler_free(&ov8858->ctrl_handler);
1981− fwnode_handle_put(ov8858->subdev.fwnode);
19821976
19831977 pm_runtime_disable(&client->dev);
19841978 if (!pm_runtime_status_suspended(&client->dev))
drivers/media/pci/intel/Kconfig+14−6
@@ -1,11 +1,19 @@
11 # SPDX-License-Identifier: GPL-2.0-only
2+
3+source "drivers/media/pci/intel/ipu3/Kconfig"
4+source "drivers/media/pci/intel/ivsc/Kconfig"
5+
26 config IPU_BRIDGE
3− tristate
7+ tristate "Intel IPU Bridge"
48 depends on I2C && ACPI
59 help
6− This is a helper module for the IPU bridge, which can be
7− used by ipu3 and other drivers. In order to handle module
8− dependencies, this is selected by each driver that needs it.
10+ The IPU bridge is a helper library for Intel IPU drivers to
11+ function on systems shipped with Windows.
912
10−source "drivers/media/pci/intel/ipu3/Kconfig"
11−source "drivers/media/pci/intel/ivsc/Kconfig"
13+ Currently used by the ipu3-cio2 and atomisp drivers.
14+
15+ Supported systems include:
16+
17+ - Microsoft Surface models (except Surface Pro 3)
18+ - The Lenovo Miix line (for example the 510, 520, 710 and 720)
19+ - Dell 7285
drivers/media/pci/intel/ipu-bridge.c+3−1
@@ -107,8 +107,10 @@ static struct acpi_device *ipu_bridge_get_ivsc_acpi_dev(struct acpi_device *adev · 106 unmodified lines
107107 for_each_acpi_dev_match(ivsc_adev, acpi_id->id, NULL, -1)
108108 /* camera sensor depends on IVSC in DSDT if exist */
109109 for_each_acpi_consumer_dev(ivsc_adev, consumer)
110− if (consumer->handle == handle)
110+ if (consumer->handle == handle) {
111+ acpi_dev_put(consumer);
111112 return ivsc_adev;
113+ }
112114 }
113115
114116 return NULL;
drivers/media/pci/intel/ipu3/Kconfig+1−20
@@ -2,13 +2,13 @@ · 1 unmodified line
22 config VIDEO_IPU3_CIO2
33 tristate "Intel ipu3-cio2 driver"
44 depends on VIDEO_DEV && PCI
5+ depends on IPU_BRIDGE || !IPU_BRIDGE
56 depends on ACPI || COMPILE_TEST
67 depends on X86
78 select MEDIA_CONTROLLER
89 select VIDEO_V4L2_SUBDEV_API
910 select V4L2_FWNODE
1011 select VIDEOBUF2_DMA_SG
11− select IPU_BRIDGE if CIO2_BRIDGE
1212
1313 help
1414 This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel
@@ -18,22 +18,3 @@ config VIDEO_IPU3_CIO2 · 3 unmodified lines
1818 Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2
1919 connected camera.
2020 The module will be called ipu3-cio2.
21−
22−config CIO2_BRIDGE
23− bool "IPU3 CIO2 Sensors Bridge"
24− depends on VIDEO_IPU3_CIO2 && ACPI
25− depends on I2C
26− help
27− This extension provides an API for the ipu3-cio2 driver to create
28− connections to cameras that are hidden in the SSDB buffer in ACPI.
29− It can be used to enable support for cameras in detachable / hybrid
30− devices that ship with Windows.
31−
32− Say Y here if your device is a detachable / hybrid laptop that comes
33− with Windows installed by the OEM, for example:
34−
35− - Microsoft Surface models (except Surface Pro 3)
36− - The Lenovo Miix line (for example the 510, 520, 710 and 720)
37− - Dell 7285
38−
39− If in doubt, say N here.
drivers/media/pci/intel/ivsc/Kconfig+1−1
@@ -6,7 +6,7 @@ config INTEL_VSC · 5 unmodified lines
66 depends on INTEL_MEI && ACPI && VIDEO_DEV
77 select MEDIA_CONTROLLER
88 select VIDEO_V4L2_SUBDEV_API
9− select V4L2_ASYNC
9+ select V4L2_FWNODE
1010 help
1111 This adds support for Intel Visual Sensing Controller (IVSC).
1212
drivers/media/platform/intel/pxa_camera.c+1−1
@@ -2398,7 +2398,7 @@ static int pxa_camera_probe(struct platform_device *pdev) · 2397 unmodified lines
23982398 PXA_CAM_DRV_NAME, pcdev);
23992399 if (err) {
24002400 dev_err(&pdev->dev, "Camera interrupt register failed\n");
2401− goto exit_v4l2_device_unregister;
2401+ goto exit_deactivate;
24022402 }
24032403
24042404 pcdev->notifier.ops = &pxa_camera_sensor_ops;
drivers/media/platform/mediatek/vcodec/encoder/venc_vpu_if.c+2−1
@@ -138,7 +138,8 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) · 137 unmodified lines
138138 vpu->ctx->vpu_inst = vpu;
139139
140140 status = mtk_vcodec_fw_ipi_register(vpu->ctx->dev->fw_handler, vpu->id,
141− vpu_enc_ipi_handler, "venc", NULL);
141+ vpu_enc_ipi_handler, "venc",
142+ vpu->ctx->dev);
142143
143144 if (status) {
144145 mtk_venc_err(vpu->ctx, "vpu_ipi_register fail %d", status);
drivers/media/platform/xilinx/xilinx-vipp.c+12−5
@@ -55,11 +55,18 @@ xvip_graph_find_entity(struct xvip_composite_device *xdev, · 54 unmodified lines
5555 {
5656 struct xvip_graph_entity *entity;
5757 struct v4l2_async_connection *asd;
58−
59− list_for_each_entry(asd, &xdev->notifier.done_list, asc_entry) {
60− entity = to_xvip_entity(asd);
61− if (entity->asd.match.fwnode == fwnode)
62− return entity;
58+ struct list_head *lists[] = {
59+ &xdev->notifier.done_list,
60+ &xdev->notifier.waiting_list
61+ };
62+ unsigned int i;
63+
64+ for (i = 0; i < ARRAY_SIZE(lists); i++) {
65+ list_for_each_entry(asd, lists[i], asc_entry) {
66+ entity = to_xvip_entity(asd);
67+ if (entity->asd.match.fwnode == fwnode)
68+ return entity;
69+ }
6370 }
6471
6572 return NULL;
drivers/media/v4l2-core/v4l2-subdev.c+7−0
@@ -502,6 +502,13 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg, · 501 unmodified lines
502502 V4L2_SUBDEV_CLIENT_CAP_STREAMS;
503503 int rval;
504504
505+ /*
506+ * If the streams API is not enabled, remove V4L2_SUBDEV_CAP_STREAMS.
507+ * Remove this when the API is no longer experimental.
508+ */
509+ if (!v4l2_subdev_enable_streams_api)
510+ streams_subdev = false;
511+
505512 switch (cmd) {
506513 case VIDIOC_SUBDEV_QUERYCAP: {
507514 struct v4l2_subdev_capability *cap = arg;
drivers/mfd/Kconfig+1−0
@@ -241,6 +241,7 @@ config MFD_CS42L43 · 240 unmodified lines
241241 tristate
242242 select MFD_CORE
243243 select REGMAP
244+ select REGMAP_IRQ
244245
245246 config MFD_CS42L43_I2C
246247 tristate "Cirrus Logic CS42L43 (I2C)"
drivers/mtd/ubi/build.c+7−0
@@ -894,6 +894,13 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, · 893 unmodified lines
894894 return -EINVAL;
895895 }
896896
897+ /* UBI cannot work on flashes with zero erasesize. */
898+ if (!mtd->erasesize) {
899+ pr_err("ubi: refuse attaching mtd%d - zero erasesize flash is not supported\n",
900+ mtd->index);
901+ return -EINVAL;
902+ }
903+
897904 if (ubi_num == UBI_DEV_NUM_AUTO) {
898905 /* Search for an empty slot in the @ubi_devices array */
899906 for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
drivers/net/can/Kconfig+1−1
@@ -190,7 +190,7 @@ config CAN_SLCAN · 189 unmodified lines
190190
191191 config CAN_SUN4I
192192 tristate "Allwinner A10 CAN controller"
193− depends on MACH_SUN4I || MACH_SUN7I || RISCV || COMPILE_TEST
193+ depends on MACH_SUN4I || MACH_SUN7I || (RISCV && ARCH_SUNXI) || COMPILE_TEST
194194 help
195195 Say Y here if you want to use CAN controller found on Allwinner
196196 A10/A20/D1 SoCs.
drivers/net/can/flexcan/flexcan-core.c+13−33
@@ -348,7 +348,7 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { · 347 unmodified lines
348348 static struct flexcan_devtype_data fsl_imx93_devtype_data = {
349349 .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
350350 FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX |
351− FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_AUTO_STOP_MODE |
351+ FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR |
352352 FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC |
353353 FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX |
354354 FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR,
@@ -544,11 +544,6 @@ static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) · 189 unmodified lines
544544 } else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) {
545545 regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
546546 1 << priv->stm.req_bit, 1 << priv->stm.req_bit);
547− } else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) {
548− /* For the auto stop mode, software do nothing, hardware will cover
549− * all the operation automatically after system go into low power mode.
550− */
551− return 0;
552547 }
553548
554549 return flexcan_low_power_enter_ack(priv);
@@ -574,12 +569,6 @@ static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) · 19 unmodified lines
574569 reg_mcr &= ~FLEXCAN_MCR_SLF_WAK;
575570 priv->write(reg_mcr, &regs->mcr);
576571
577− /* For the auto stop mode, hardware will exist stop mode
578− * automatically after system go out of low power mode.
579− */
580− if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
581− return 0;
582−
583572 return flexcan_low_power_exit_ack(priv);
584573 }
585574
@@ -1994,13 +1983,18 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) · 1408 unmodified lines
19941983 ret = flexcan_setup_stop_mode_scfw(pdev);
19951984 else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR)
19961985 ret = flexcan_setup_stop_mode_gpr(pdev);
1997− else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
1998− ret = 0;
19991986 else
20001987 /* return 0 directly if doesn't support stop mode feature */
20011988 return 0;
20021989
2003− if (ret)
1990+ /* If ret is -EINVAL, this means SoC claim to support stop mode, but
1991+ * dts file lack the stop mode property definition. For this case,
1992+ * directly return 0, this will skip the wakeup capable setting and
1993+ * will not block the driver probe.
1994+ */
1995+ if (ret == -EINVAL)
1996+ return 0;
1997+ else if (ret)
20041998 return ret;
20051999
20062000 device_set_wakeup_capable(&pdev->dev, true);
@@ -2320,16 +2314,8 @@ static int __maybe_unused flexcan_noirq_suspend(struct device *device) · 313 unmodified lines
23202314 if (netif_running(dev)) {
23212315 int err;
23222316
2323− if (device_may_wakeup(device)) {
2317+ if (device_may_wakeup(device))
23242318 flexcan_enable_wakeup_irq(priv, true);
2325− /* For auto stop mode, need to keep the clock on before
2326− * system go into low power mode. After system go into
2327− * low power mode, hardware will config the flexcan into
2328− * stop mode, and gate off the clock automatically.
2329− */
2330− if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
2331− return 0;
2332− }
23332319
23342320 err = pm_runtime_force_suspend(device);
23352321 if (err)
@@ -2347,15 +2333,9 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device) · 11 unmodified lines
23472333 if (netif_running(dev)) {
23482334 int err;
23492335
2350− /* For the wakeup in auto stop mode, no need to gate on the
2351− * clock here, hardware will do this automatically.
2352− */
2353− if (!(device_may_wakeup(device) &&
2354− priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) {
2355− err = pm_runtime_force_resume(device);
2356− if (err)
2357− return err;
2358− }
2336+ err = pm_runtime_force_resume(device);
2337+ if (err)
2338+ return err;
23592339
23602340 if (device_may_wakeup(device))
23612341 flexcan_enable_wakeup_irq(priv, false);
drivers/net/can/flexcan/flexcan.h+0−2
@@ -68,8 +68,6 @@ · 67 unmodified lines
6868 #define FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR BIT(15)
6969 /* Device supports RX via FIFO */
7070 #define FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16)
71−/* auto enter stop mode to support wakeup */
72−#define FLEXCAN_QUIRK_AUTO_STOP_MODE BIT(17)
7371
7472 struct flexcan_devtype_data {
7573 u32 quirks; /* quirks needed for different IP cores */
drivers/net/can/m_can/tcan4x5x-core.c+1−1
@@ -125,7 +125,7 @@ static const struct tcan4x5x_version_info tcan4x5x_versions[] = { · 124 unmodified lines
125125 },
126126 [TCAN4553] = {
127127 .name = "4553",
128− .id2_register = 0x32353534,
128+ .id2_register = 0x33353534,
129129 },
130130 /* generic version with no id2_register at the end */
131131 [TCAN4X5X] = {
drivers/net/can/sja1000/sja1000.c+7−1
@@ -392,7 +392,13 @@ static irqreturn_t sja1000_reset_interrupt(int irq, void *dev_id) · 391 unmodified lines
392392 struct net_device *dev = (struct net_device *)dev_id;
393393
394394 netdev_dbg(dev, "performing a soft reset upon overrun\n");
395− sja1000_start(dev);
395+
396+ netif_tx_lock(dev);
397+
398+ can_free_echo_skb(dev, 0, NULL);
399+ sja1000_set_mode(dev, CAN_MODE_START);
400+
401+ netif_tx_unlock(dev);
396402
397403 return IRQ_HANDLED;
398404 }
drivers/net/dsa/mv88e6xxx/chip.c+4−2
@@ -2958,14 +2958,16 @@ static void mv88e6xxx_hardware_reset(struct mv88e6xxx_chip *chip) · 2957 unmodified lines
29582958 * from the wrong location resulting in the switch booting
29592959 * to wrong mode and inoperable.
29602960 */
2961− mv88e6xxx_g1_wait_eeprom_done(chip);
2961+ if (chip->info->ops->get_eeprom)
2962+ mv88e6xxx_g2_eeprom_wait(chip);
29622963
29632964 gpiod_set_value_cansleep(gpiod, 1);
29642965 usleep_range(10000, 20000);
29652966 gpiod_set_value_cansleep(gpiod, 0);
29662967 usleep_range(10000, 20000);
29672968
2968− mv88e6xxx_g1_wait_eeprom_done(chip);
2969+ if (chip->info->ops->get_eeprom)
2970+ mv88e6xxx_g2_eeprom_wait(chip);
29692971 }
29702972 }
29712973
drivers/net/dsa/mv88e6xxx/global1.c+0−31
@@ -75,37 +75,6 @@ static int mv88e6xxx_g1_wait_init_ready(struct mv88e6xxx_chip *chip) · 74 unmodified lines
7575 return mv88e6xxx_g1_wait_bit(chip, MV88E6XXX_G1_STS, bit, 1);
7676 }
7777
78−void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip)
79−{
80− const unsigned long timeout = jiffies + 1 * HZ;
81− u16 val;
82− int err;
83−
84− /* Wait up to 1 second for the switch to finish reading the
85− * EEPROM.
86− */
87− while (time_before(jiffies, timeout)) {
88− err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_STS, &val);
89− if (err) {
90− dev_err(chip->dev, "Error reading status");
91− return;
92− }
93−
94− /* If the switch is still resetting, it may not
95− * respond on the bus, and so MDIO read returns
96− * 0xffff. Differentiate between that, and waiting for
97− * the EEPROM to be done by bit 0 being set.
98− */
99− if (val != 0xffff &&
100− val & BIT(MV88E6XXX_G1_STS_IRQ_EEPROM_DONE))
101− return;
102−
103− usleep_range(1000, 2000);
104− }
105−
106− dev_err(chip->dev, "Timeout waiting for EEPROM done");
107−}
108−
10978 /* Offset 0x01: Switch MAC Address Register Bytes 0 & 1
11079 * Offset 0x02: Switch MAC Address Register Bytes 2 & 3
11180 * Offset 0x03: Switch MAC Address Register Bytes 4 & 5
drivers/net/dsa/mv88e6xxx/global1.h+0−1
@@ -282,7 +282,6 @@ int mv88e6xxx_g1_set_switch_mac(struct mv88e6xxx_chip *chip, u8 *addr); · 281 unmodified lines
282282 int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip);
283283 int mv88e6352_g1_reset(struct mv88e6xxx_chip *chip);
284284 int mv88e6250_g1_reset(struct mv88e6xxx_chip *chip);
285−void mv88e6xxx_g1_wait_eeprom_done(struct mv88e6xxx_chip *chip);
286285
287286 int mv88e6185_g1_ppu_enable(struct mv88e6xxx_chip *chip);
288287 int mv88e6185_g1_ppu_disable(struct mv88e6xxx_chip *chip);
drivers/net/dsa/mv88e6xxx/global2.c+1−1
@@ -340,7 +340,7 @@ int mv88e6xxx_g2_pot_clear(struct mv88e6xxx_chip *chip) · 339 unmodified lines
340340 * Offset 0x15: EEPROM Addr (for 8-bit data access)
341341 */
342342
343−static int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip)
343+int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip)
344344 {
345345 int bit = __bf_shf(MV88E6XXX_G2_EEPROM_CMD_BUSY);
346346 int err;
drivers/net/dsa/mv88e6xxx/global2.h+1−0
@@ -365,6 +365,7 @@ int mv88e6xxx_g2_trunk_clear(struct mv88e6xxx_chip *chip); · 364 unmodified lines
365365
366366 int mv88e6xxx_g2_device_mapping_write(struct mv88e6xxx_chip *chip, int target,
367367 int port);
368+int mv88e6xxx_g2_eeprom_wait(struct mv88e6xxx_chip *chip);
368369
369370 extern const struct mv88e6xxx_irq_ops mv88e6097_watchdog_ops;
370371 extern const struct mv88e6xxx_irq_ops mv88e6250_watchdog_ops;
drivers/net/dsa/qca/qca8k-8xxx.c+13−2
@@ -505,8 +505,8 @@ qca8k_bulk_read(void *ctx, const void *reg_buf, size_t reg_len, · 504 unmodified lines
505505 void *val_buf, size_t val_len)
506506 {
507507 int i, count = val_len / sizeof(u32), ret;
508− u32 reg = *(u32 *)reg_buf & U16_MAX;
509508 struct qca8k_priv *priv = ctx;
509+ u32 reg = *(u16 *)reg_buf;
510510
511511 if (priv->mgmt_master &&
512512 !qca8k_read_eth(priv, reg, val_buf, val_len))
@@ -527,8 +527,8 @@ qca8k_bulk_gather_write(void *ctx, const void *reg_buf, size_t reg_len, · 14 unmodified lines
527527 const void *val_buf, size_t val_len)
528528 {
529529 int i, count = val_len / sizeof(u32), ret;
530− u32 reg = *(u32 *)reg_buf & U16_MAX;
531530 struct qca8k_priv *priv = ctx;
531+ u32 reg = *(u16 *)reg_buf;
532532 u32 *val = (u32 *)val_buf;
533533
534534 if (priv->mgmt_master &&
@@ -666,6 +666,15 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy, · 131 unmodified lines
666666 goto err_read_skb;
667667 }
668668
669+ /* It seems that accessing the switch's internal PHYs via management
670+ * packets still uses the MDIO bus within the switch internally, and
671+ * these accesses can conflict with external MDIO accesses to other
672+ * devices on the MDIO bus.
673+ * We therefore need to lock the MDIO bus onto which the switch is
674+ * connected.
675+ */
676+ mutex_lock(&priv->bus->mdio_lock);
677+
669678 /* Actually start the request:
670679 * 1. Send mdio master packet
671680 * 2. Busy Wait for mdio master command
@@ -678,6 +687,7 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy, · 6 unmodified lines
678687 mgmt_master = priv->mgmt_master;
679688 if (!mgmt_master) {
680689 mutex_unlock(&mgmt_eth_data->mutex);
690+ mutex_unlock(&priv->bus->mdio_lock);
681691 ret = -EINVAL;
682692 goto err_mgmt_master;
683693 }
@@ -765,6 +775,7 @@ exit: · 81 unmodified lines
765775 QCA8K_ETHERNET_TIMEOUT);
766776
767777 mutex_unlock(&mgmt_eth_data->mutex);
778+ mutex_unlock(&priv->bus->mdio_lock);
768779
769780 return ret;
770781
drivers/net/ethernet/ibm/ibmveth.c+12−13
@@ -1303,24 +1303,23 @@ static void ibmveth_rx_csum_helper(struct sk_buff *skb, · 1302 unmodified lines
13031303 * the user space for finding a flow. During this process, OVS computes
13041304 * checksum on the first packet when CHECKSUM_PARTIAL flag is set.
13051305 *
1306− * So, re-compute TCP pseudo header checksum when configured for
1307− * trunk mode.
1306+ * So, re-compute TCP pseudo header checksum.
13081307 */
1308+
13091309 if (iph_proto == IPPROTO_TCP) {
13101310 struct tcphdr *tcph = (struct tcphdr *)(skb->data + iphlen);
1311+
13111312 if (tcph->check == 0x0000) {
13121313 /* Recompute TCP pseudo header checksum */
1313− if (adapter->is_active_trunk) {
1314− tcphdrlen = skb->len - iphlen;
1315− if (skb_proto == ETH_P_IP)
1316− tcph->check =
1317− ~csum_tcpudp_magic(iph->saddr,
1318− iph->daddr, tcphdrlen, iph_proto, 0);
1319− else if (skb_proto == ETH_P_IPV6)
1320− tcph->check =
1321− ~csum_ipv6_magic(&iph6->saddr,
1322− &iph6->daddr, tcphdrlen, iph_proto, 0);
1323− }
1314+ tcphdrlen = skb->len - iphlen;
1315+ if (skb_proto == ETH_P_IP)
1316+ tcph->check =
1317+ ~csum_tcpudp_magic(iph->saddr,
1318+ iph->daddr, tcphdrlen, iph_proto, 0);
1319+ else if (skb_proto == ETH_P_IPV6)
1320+ tcph->check =
1321+ ~csum_ipv6_magic(&iph6->saddr,
1322+ &iph6->daddr, tcphdrlen, iph_proto, 0);
13241323 /* Setup SKB fields for checksum offload */
13251324 skb_partial_csum_set(skb, iphlen,
13261325 offsetof(struct tcphdr, check));
drivers/net/ethernet/intel/ice/ice_lag.c+32−0
@@ -2093,3 +2093,35 @@ lag_rebuild_out: · 2092 unmodified lines
20932093 }
20942094 mutex_unlock(&pf->lag_mutex);
20952095 }
2096+
2097+/**
2098+ * ice_lag_is_switchdev_running
2099+ * @pf: pointer to PF structure
2100+ *
2101+ * Check if switchdev is running on any of the interfaces connected to lag.
2102+ */
2103+bool ice_lag_is_switchdev_running(struct ice_pf *pf)
2104+{
2105+ struct ice_lag *lag = pf->lag;
2106+ struct net_device *tmp_nd;
2107+
2108+ if (!ice_is_feature_supported(pf, ICE_F_SRIOV_LAG) || !lag)
2109+ return false;
2110+
2111+ rcu_read_lock();
2112+ for_each_netdev_in_bond_rcu(lag->upper_netdev, tmp_nd) {
2113+ struct ice_netdev_priv *priv = netdev_priv(tmp_nd);
2114+
2115+ if (!netif_is_ice(tmp_nd) || !priv || !priv->vsi ||
2116+ !priv->vsi->back)
2117+ continue;
2118+
2119+ if (ice_is_switchdev_running(priv->vsi->back)) {
2120+ rcu_read_unlock();
2121+ return true;
2122+ }
2123+ }
2124+ rcu_read_unlock();
2125+
2126+ return false;
2127+}
drivers/net/ethernet/intel/ice/ice_lag.h+1−0
@@ -62,4 +62,5 @@ void ice_lag_move_new_vf_nodes(struct ice_vf *vf); · 61 unmodified lines
6262 int ice_init_lag(struct ice_pf *pf);
6363 void ice_deinit_lag(struct ice_pf *pf);
6464 void ice_lag_rebuild(struct ice_pf *pf);
65+bool ice_lag_is_switchdev_running(struct ice_pf *pf);
6566 #endif /* _ICE_LAG_H_ */
drivers/net/ethernet/intel/ice/ice_lib.c+6−0
@@ -3575,6 +3575,12 @@ int ice_set_dflt_vsi(struct ice_vsi *vsi) · 3574 unmodified lines
35753575
35763576 dev = ice_pf_to_dev(vsi->back);
35773577
3578+ if (ice_lag_is_switchdev_running(vsi->back)) {
3579+ dev_dbg(dev, "VSI %d passed is a part of LAG containing interfaces in switchdev mode, nothing to do\n",
3580+ vsi->vsi_num);
3581+ return 0;
3582+ }
3583+
35783584 /* the VSI passed in is already the default VSI */
35793585 if (ice_is_vsi_dflt_vsi(vsi)) {
35803586 dev_dbg(dev, "VSI %d passed in is already the default forwarding VSI, nothing to do\n",
drivers/net/ethernet/intel/ice/ice_virtchnl.c+7−5
@@ -2617,12 +2617,14 @@ static int ice_vc_query_rxdid(struct ice_vf *vf) · 2616 unmodified lines
26172617 goto err;
26182618 }
26192619
2620− /* Read flexiflag registers to determine whether the
2621− * corresponding RXDID is configured and supported or not.
2622− * Since Legacy 16byte descriptor format is not supported,
2623− * start from Legacy 32byte descriptor.
2620+ /* RXDIDs supported by DDP package can be read from the register
2621+ * to get the supported RXDID bitmap. But the legacy 32byte RXDID
2622+ * is not listed in DDP package, add it in the bitmap manually.
2623+ * Legacy 16byte descriptor is not supported.
26242624 */
2625− for (i = ICE_RXDID_LEGACY_1; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
2625+ rxdid->supported_rxdids |= BIT(ICE_RXDID_LEGACY_1);
2626+
2627+ for (i = ICE_RXDID_FLEX_NIC; i < ICE_FLEX_DESC_RXDID_MAX_NUM; i++) {
26262628 regval = rd32(hw, GLFLXP_RXDID_FLAGS(i, 0));
26272629 if ((regval >> GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_S)
26282630 & GLFLXP_RXDID_FLAGS_FLEXIFLAG_4N_M)
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c+3−2
@@ -28,6 +28,9 @@ static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter, · 27 unmodified lines
2828 struct vf_macvlans *mv_list;
2929 int num_vf_macvlans, i;
3030
31+ /* Initialize list of VF macvlans */
32+ INIT_LIST_HEAD(&adapter->vf_mvs.l);
33+
3134 num_vf_macvlans = hw->mac.num_rar_entries -
3235 (IXGBE_MAX_PF_MACVLANS + 1 + num_vfs);
3336 if (!num_vf_macvlans)
@@ -36,8 +39,6 @@ static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter, · 2 unmodified lines
3639 mv_list = kcalloc(num_vf_macvlans, sizeof(struct vf_macvlans),
3740 GFP_KERNEL);
3841 if (mv_list) {
39− /* Initialize list of VF macvlans */
40− INIT_LIST_HEAD(&adapter->vf_mvs.l);
4142 for (i = 0; i < num_vf_macvlans; i++) {
4243 mv_list[i].vf = -1;
4344 mv_list[i].free = true;
drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c+9−4
@@ -1357,10 +1357,12 @@ static int cn10k_mdo_upd_txsa(struct macsec_context *ctx) · 1356 unmodified lines
13571357
13581358 if (netif_running(secy->netdev)) {
13591359 /* Keys cannot be changed after creation */
1360− err = cn10k_write_tx_sa_pn(pfvf, txsc, sa_num,
1361− sw_tx_sa->next_pn);
1362− if (err)
1363− return err;
1360+ if (ctx->sa.update_pn) {
1361+ err = cn10k_write_tx_sa_pn(pfvf, txsc, sa_num,
1362+ sw_tx_sa->next_pn);
1363+ if (err)
1364+ return err;
1365+ }
13641366
13651367 err = cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc,
13661368 sa_num, sw_tx_sa->active);
@@ -1529,6 +1531,9 @@ static int cn10k_mdo_upd_rxsa(struct macsec_context *ctx) · 162 unmodified lines
15291531 if (err)
15301532 return err;
15311533
1534+ if (!ctx->sa.update_pn)
1535+ return 0;
1536+
15321537 err = cn10k_mcs_write_rx_sa_pn(pfvf, rxsc, sa_num,
15331538 rx_sa->next_pn);
15341539 if (err)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c+1−0
@@ -1403,6 +1403,7 @@ int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id, · 1402 unmodified lines
14031403 return 0;
14041404 }
14051405
1406+ pp_params.order = get_order(buf_size);
14061407 pp_params.flags = PP_FLAG_PAGE_FRAG | PP_FLAG_DMA_MAP;
14071408 pp_params.pool_size = min(OTX2_PAGE_POOL_SZ, numptrs);
14081409 pp_params.nid = NUMA_NO_NODE;
drivers/net/ethernet/marvell/sky2.h+1−1
@@ -2195,7 +2195,7 @@ struct rx_ring_info { · 2194 unmodified lines
21952195 struct sk_buff *skb;
21962196 dma_addr_t data_addr;
21972197 DEFINE_DMA_UNMAP_LEN(data_size);
2198− dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT];
2198+ dma_addr_t frag_addr[ETH_JUMBO_MTU >> PAGE_SHIFT ?: 1];
21992199 };
22002200
22012201 enum flow_control {
drivers/net/ethernet/mediatek/mtk_eth_soc.c+2−2
@@ -3171,8 +3171,8 @@ static irqreturn_t mtk_handle_irq_rx(int irq, void *_eth) · 3170 unmodified lines
31713171
31723172 eth->rx_events++;
31733173 if (likely(napi_schedule_prep(&eth->rx_napi))) {
3174− __napi_schedule(&eth->rx_napi);
31753174 mtk_rx_irq_disable(eth, eth->soc->txrx.rx_irq_done_mask);
3175+ __napi_schedule(&eth->rx_napi);
31763176 }
31773177
31783178 return IRQ_HANDLED;
@@ -3184,8 +3184,8 @@ static irqreturn_t mtk_handle_irq_tx(int irq, void *_eth) · 5 unmodified lines
31843184
31853185 eth->tx_events++;
31863186 if (likely(napi_schedule_prep(&eth->tx_napi))) {
3187− __napi_schedule(&eth->tx_napi);
31883187 mtk_tx_irq_disable(eth, MTK_TX_DONE_INT);
3188+ __napi_schedule(&eth->tx_napi);
31893189 }
31903190
31913191 return IRQ_HANDLED;
drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c+2−2
@@ -580,7 +580,7 @@ static int mlx5e_macsec_upd_txsa(struct macsec_context *ctx) · 579 unmodified lines
580580 goto out;
581581 }
582582
583− if (tx_sa->next_pn != ctx_tx_sa->next_pn_halves.lower) {
583+ if (ctx->sa.update_pn) {
584584 netdev_err(netdev, "MACsec offload: update TX sa %d PN isn't supported\n",
585585 assoc_num);
586586 err = -EINVAL;
@@ -973,7 +973,7 @@ static int mlx5e_macsec_upd_rxsa(struct macsec_context *ctx) · 386 unmodified lines
973973 goto out;
974974 }
975975
976− if (rx_sa->next_pn != ctx_rx_sa->next_pn_halves.lower) {
976+ if (ctx->sa.update_pn) {
977977 netdev_err(ctx->netdev,
978978 "MACsec offload update RX sa %d PN isn't supported\n",
979979 assoc_num);
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+2−1
@@ -3952,13 +3952,14 @@ static int set_feature_rx_fcs(struct net_device *netdev, bool enable) · 3951 unmodified lines
39523952 struct mlx5e_channels *chs = &priv->channels;
39533953 struct mlx5e_params new_params;
39543954 int err;
3955+ bool rx_ts_over_crc = !enable;
39553956
39563957 mutex_lock(&priv->state_lock);
39573958
39583959 new_params = chs->params;
39593960 new_params.scatter_fcs_en = enable;
39603961 err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_set_rx_port_ts_wrap,
3961− &new_params.scatter_fcs_en, true);
3962+ &rx_ts_over_crc, true);
39623963 mutex_unlock(&priv->state_lock);
39633964 return err;
39643965 }
drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c+2−2
@@ -310,8 +310,8 @@ const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops = { · 309 unmodified lines
310310 .fdb_clear_offload = mlxsw_sp_nve_vxlan_clear_offload,
311311 };
312312
313−static bool mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
314− bool learning_en)
313+static int mlxsw_sp2_nve_vxlan_learning_set(struct mlxsw_sp *mlxsw_sp,
314+ bool learning_en)
315315 {
316316 char tnpc_pl[MLXSW_REG_TNPC_LEN];
317317
drivers/net/ethernet/microchip/Kconfig+1−0
@@ -46,6 +46,7 @@ config LAN743X · 45 unmodified lines
4646 tristate "LAN743x support"
4747 depends on PCI
4848 depends on PTP_1588_CLOCK_OPTIONAL
49+ select PHYLIB
4950 select FIXED_PHY
5051 select CRC16
5152 select CRC32
drivers/net/ethernet/microsoft/mana/mana_en.c+146−65
@@ -91,63 +91,137 @@ static unsigned int mana_checksum_info(struct sk_buff *skb) · 90 unmodified lines
9191 return 0;
9292 }
9393
94+static void mana_add_sge(struct mana_tx_package *tp, struct mana_skb_head *ash,
95+ int sg_i, dma_addr_t da, int sge_len, u32 gpa_mkey)
96+{
97+ ash->dma_handle[sg_i] = da;
98+ ash->size[sg_i] = sge_len;
99+
100+ tp->wqe_req.sgl[sg_i].address = da;
101+ tp->wqe_req.sgl[sg_i].mem_key = gpa_mkey;
102+ tp->wqe_req.sgl[sg_i].size = sge_len;
103+}
104+
94105 static int mana_map_skb(struct sk_buff *skb, struct mana_port_context *apc,
95− struct mana_tx_package *tp)
106+ struct mana_tx_package *tp, int gso_hs)
96107 {
97108 struct mana_skb_head *ash = (struct mana_skb_head *)skb->head;
109+ int hsg = 1; /* num of SGEs of linear part */
98110 struct gdma_dev *gd = apc->ac->gdma_dev;
111+ int skb_hlen = skb_headlen(skb);
112+ int sge0_len, sge1_len = 0;
99113 struct gdma_context *gc;
100114 struct device *dev;
101115 skb_frag_t *frag;
102116 dma_addr_t da;
117+ int sg_i;
103118 int i;
104119
105120 gc = gd->gdma_context;
106121 dev = gc->dev;
107− da = dma_map_single(dev, skb->data, skb_headlen(skb), DMA_TO_DEVICE);
108122
123+ if (gso_hs && gso_hs < skb_hlen) {
124+ sge0_len = gso_hs;
125+ sge1_len = skb_hlen - gso_hs;
126+ } else {
127+ sge0_len = skb_hlen;
128+ }
129+
130+ da = dma_map_single(dev, skb->data, sge0_len, DMA_TO_DEVICE);
109131 if (dma_mapping_error(dev, da))
110132 return -ENOMEM;
111133
112− ash->dma_handle[0] = da;
113− ash->size[0] = skb_headlen(skb);
134+ mana_add_sge(tp, ash, 0, da, sge0_len, gd->gpa_mkey);
114135
115− tp->wqe_req.sgl[0].address = ash->dma_handle[0];
116− tp->wqe_req.sgl[0].mem_key = gd->gpa_mkey;
117− tp->wqe_req.sgl[0].size = ash->size[0];
136+ if (sge1_len) {
137+ sg_i = 1;
138+ da = dma_map_single(dev, skb->data + sge0_len, sge1_len,
139+ DMA_TO_DEVICE);
140+ if (dma_mapping_error(dev, da))
141+ goto frag_err;
142+
143+ mana_add_sge(tp, ash, sg_i, da, sge1_len, gd->gpa_mkey);
144+ hsg = 2;
145+ }
118146
119147 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
148+ sg_i = hsg + i;
149+
120150 frag = &skb_shinfo(skb)->frags[i];
121151 da = skb_frag_dma_map(dev, frag, 0, skb_frag_size(frag),
122152 DMA_TO_DEVICE);
123−
124153 if (dma_mapping_error(dev, da))
125154 goto frag_err;
126155
127− ash->dma_handle[i + 1] = da;
128− ash->size[i + 1] = skb_frag_size(frag);
129−
130− tp->wqe_req.sgl[i + 1].address = ash->dma_handle[i + 1];
131− tp->wqe_req.sgl[i + 1].mem_key = gd->gpa_mkey;
132− tp->wqe_req.sgl[i + 1].size = ash->size[i + 1];
156+ mana_add_sge(tp, ash, sg_i, da, skb_frag_size(frag),
157+ gd->gpa_mkey);
133158 }
134159
135160 return 0;
136161
137162 frag_err:
138− for (i = i - 1; i >= 0; i--)
139− dma_unmap_page(dev, ash->dma_handle[i + 1], ash->size[i + 1],
163+ for (i = sg_i - 1; i >= hsg; i--)
164+ dma_unmap_page(dev, ash->dma_handle[i], ash->size[i],
140165 DMA_TO_DEVICE);
141166
142− dma_unmap_single(dev, ash->dma_handle[0], ash->size[0], DMA_TO_DEVICE);
167+ for (i = hsg - 1; i >= 0; i--)
168+ dma_unmap_single(dev, ash->dma_handle[i], ash->size[i],
169+ DMA_TO_DEVICE);
143170
144171 return -ENOMEM;
145172 }
146173
174+/* Handle the case when GSO SKB linear length is too large.
175+ * MANA NIC requires GSO packets to put only the packet header to SGE0.
176+ * So, we need 2 SGEs for the skb linear part which contains more than the
177+ * header.
178+ * Return a positive value for the number of SGEs, or a negative value
179+ * for an error.
180+ */
181+static int mana_fix_skb_head(struct net_device *ndev, struct sk_buff *skb,
182+ int gso_hs)
183+{
184+ int num_sge = 1 + skb_shinfo(skb)->nr_frags;
185+ int skb_hlen = skb_headlen(skb);
186+
187+ if (gso_hs < skb_hlen) {
188+ num_sge++;
189+ } else if (gso_hs > skb_hlen) {
190+ if (net_ratelimit())
191+ netdev_err(ndev,
192+ "TX nonlinear head: hs:%d, skb_hlen:%d\n",
193+ gso_hs, skb_hlen);
194+
195+ return -EINVAL;
196+ }
197+
198+ return num_sge;
199+}
200+
201+/* Get the GSO packet's header size */
202+static int mana_get_gso_hs(struct sk_buff *skb)
203+{
204+ int gso_hs;
205+
206+ if (skb->encapsulation) {
207+ gso_hs = skb_inner_tcp_all_headers(skb);
208+ } else {
209+ if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
210+ gso_hs = skb_transport_offset(skb) +
211+ sizeof(struct udphdr);
212+ } else {
213+ gso_hs = skb_tcp_all_headers(skb);
214+ }
215+ }
216+
217+ return gso_hs;
218+}
219+
147220 netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
148221 {
149222 enum mana_tx_pkt_format pkt_fmt = MANA_SHORT_PKT_FMT;
150223 struct mana_port_context *apc = netdev_priv(ndev);
224+ int gso_hs = 0; /* zero for non-GSO pkts */
151225 u16 txq_idx = skb_get_queue_mapping(skb);
152226 struct gdma_dev *gd = apc->ac->gdma_dev;
153227 bool ipv4 = false, ipv6 = false;
@@ -159,7 +233,6 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 5 unmodified lines
159233 struct mana_txq *txq;
160234 struct mana_cq *cq;
161235 int err, len;
162− u16 ihs;
163236
164237 if (unlikely(!apc->port_is_up))
165238 goto tx_drop;
@@ -209,19 +282,6 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 43 unmodified lines
209282 pkg.wqe_req.client_data_unit = 0;
210283
211284 pkg.wqe_req.num_sge = 1 + skb_shinfo(skb)->nr_frags;
212− WARN_ON_ONCE(pkg.wqe_req.num_sge > MAX_TX_WQE_SGL_ENTRIES);
213−
214− if (pkg.wqe_req.num_sge <= ARRAY_SIZE(pkg.sgl_array)) {
215− pkg.wqe_req.sgl = pkg.sgl_array;
216− } else {
217− pkg.sgl_ptr = kmalloc_array(pkg.wqe_req.num_sge,
218− sizeof(struct gdma_sge),
219− GFP_ATOMIC);
220− if (!pkg.sgl_ptr)
221− goto tx_drop_count;
222−
223− pkg.wqe_req.sgl = pkg.sgl_ptr;
224− }
225285
226286 if (skb->protocol == htons(ETH_P_IP))
227287 ipv4 = true;
@@ -229,6 +289,26 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 1 unmodified line
229289 ipv6 = true;
230290
231291 if (skb_is_gso(skb)) {
292+ int num_sge;
293+
294+ gso_hs = mana_get_gso_hs(skb);
295+
296+ num_sge = mana_fix_skb_head(ndev, skb, gso_hs);
297+ if (num_sge > 0)
298+ pkg.wqe_req.num_sge = num_sge;
299+ else
300+ goto tx_drop_count;
301+
302+ u64_stats_update_begin(&tx_stats->syncp);
303+ if (skb->encapsulation) {
304+ tx_stats->tso_inner_packets++;
305+ tx_stats->tso_inner_bytes += skb->len - gso_hs;
306+ } else {
307+ tx_stats->tso_packets++;
308+ tx_stats->tso_bytes += skb->len - gso_hs;
309+ }
310+ u64_stats_update_end(&tx_stats->syncp);
311+
232312 pkg.tx_oob.s_oob.is_outer_ipv4 = ipv4;
233313 pkg.tx_oob.s_oob.is_outer_ipv6 = ipv6;
234314
@@ -252,28 +332,6 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 17 unmodified lines
252332 &ipv6_hdr(skb)->daddr, 0,
253333 IPPROTO_TCP, 0);
254334 }
255−
256− if (skb->encapsulation) {
257− ihs = skb_inner_tcp_all_headers(skb);
258− u64_stats_update_begin(&tx_stats->syncp);
259− tx_stats->tso_inner_packets++;
260− tx_stats->tso_inner_bytes += skb->len - ihs;
261− u64_stats_update_end(&tx_stats->syncp);
262− } else {
263− if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
264− ihs = skb_transport_offset(skb) + sizeof(struct udphdr);
265− } else {
266− ihs = skb_tcp_all_headers(skb);
267− if (ipv6_has_hopopt_jumbo(skb))
268− ihs -= sizeof(struct hop_jumbo_hdr);
269− }
270−
271− u64_stats_update_begin(&tx_stats->syncp);
272− tx_stats->tso_packets++;
273− tx_stats->tso_bytes += skb->len - ihs;
274− u64_stats_update_end(&tx_stats->syncp);
275− }
276−
277335 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
278336 csum_type = mana_checksum_info(skb);
279337
@@ -296,11 +354,25 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 16 unmodified lines
296354 } else {
297355 /* Can't do offload of this type of checksum */
298356 if (skb_checksum_help(skb))
299− goto free_sgl_ptr;
357+ goto tx_drop_count;
300358 }
301359 }
302360
303− if (mana_map_skb(skb, apc, &pkg)) {
361+ WARN_ON_ONCE(pkg.wqe_req.num_sge > MAX_TX_WQE_SGL_ENTRIES);
362+
363+ if (pkg.wqe_req.num_sge <= ARRAY_SIZE(pkg.sgl_array)) {
364+ pkg.wqe_req.sgl = pkg.sgl_array;
365+ } else {
366+ pkg.sgl_ptr = kmalloc_array(pkg.wqe_req.num_sge,
367+ sizeof(struct gdma_sge),
368+ GFP_ATOMIC);
369+ if (!pkg.sgl_ptr)
370+ goto tx_drop_count;
371+
372+ pkg.wqe_req.sgl = pkg.sgl_ptr;
373+ }
374+
375+ if (mana_map_skb(skb, apc, &pkg, gso_hs)) {
304376 u64_stats_update_begin(&tx_stats->syncp);
305377 tx_stats->mana_map_err++;
306378 u64_stats_update_end(&tx_stats->syncp);
@@ -1258,11 +1330,16 @@ static void mana_unmap_skb(struct sk_buff *skb, struct mana_port_context *apc) · 951 unmodified lines
12581330 struct mana_skb_head *ash = (struct mana_skb_head *)skb->head;
12591331 struct gdma_context *gc = apc->ac->gdma_dev->gdma_context;
12601332 struct device *dev = gc->dev;
1261− int i;
1333+ int hsg, i;
12621334
1263− dma_unmap_single(dev, ash->dma_handle[0], ash->size[0], DMA_TO_DEVICE);
1335+ /* Number of SGEs of linear part */
1336+ hsg = (skb_is_gso(skb) && skb_headlen(skb) > ash->size[0]) ? 2 : 1;
12641337
1265− for (i = 1; i < skb_shinfo(skb)->nr_frags + 1; i++)
1338+ for (i = 0; i < hsg; i++)
1339+ dma_unmap_single(dev, ash->dma_handle[i], ash->size[i],
1340+ DMA_TO_DEVICE);
1341+
1342+ for (i = hsg; i < skb_shinfo(skb)->nr_frags + hsg; i++)
12661343 dma_unmap_page(dev, ash->dma_handle[i], ash->size[i],
12671344 DMA_TO_DEVICE);
12681345 }
@@ -1317,19 +1394,23 @@ static void mana_poll_tx_cq(struct mana_cq *cq) · 48 unmodified lines
13171394 case CQE_TX_VPORT_IDX_OUT_OF_RANGE:
13181395 case CQE_TX_VPORT_DISABLED:
13191396 case CQE_TX_VLAN_TAGGING_VIOLATION:
1320− WARN_ONCE(1, "TX: CQE error %d: ignored.\n",
1321− cqe_oob->cqe_hdr.cqe_type);
1397+ if (net_ratelimit())
1398+ netdev_err(ndev, "TX: CQE error %d\n",
1399+ cqe_oob->cqe_hdr.cqe_type);
1400+
13221401 apc->eth_stats.tx_cqe_err++;
13231402 break;
13241403
13251404 default:
1326− /* If the CQE type is unexpected, log an error, assert,
1327− * and go through the error path.
1405+ /* If the CQE type is unknown, log an error,
1406+ * and still free the SKB, update tail, etc.
13281407 */
1329− WARN_ONCE(1, "TX: Unexpected CQE type %d: HW BUG?\n",
1330− cqe_oob->cqe_hdr.cqe_type);
1408+ if (net_ratelimit())
1409+ netdev_err(ndev, "TX: unknown CQE type %d\n",
1410+ cqe_oob->cqe_hdr.cqe_type);
1411+
13311412 apc->eth_stats.tx_cqe_unknown_type++;
1332− return;
1413+ break;
13331414 }
13341415
13351416 if (WARN_ON_ONCE(txq->gdma_txq_id != completions[i].wq_num))
drivers/net/ethernet/netronome/nfp/flower/cmsg.c+6−4
@@ -210,6 +210,7 @@ nfp_flower_cmsg_merge_hint_rx(struct nfp_app *app, struct sk_buff *skb) · 209 unmodified lines
210210 unsigned int msg_len = nfp_flower_cmsg_get_data_len(skb);
211211 struct nfp_flower_cmsg_merge_hint *msg;
212212 struct nfp_fl_payload *sub_flows[2];
213+ struct nfp_flower_priv *priv;
213214 int err, i, flow_cnt;
214215
215216 msg = nfp_flower_cmsg_get_data(skb);
@@ -228,14 +229,15 @@ nfp_flower_cmsg_merge_hint_rx(struct nfp_app *app, struct sk_buff *skb) · 12 unmodified lines
228229 return;
229230 }
230231
231− rtnl_lock();
232+ priv = app->priv;
233+ mutex_lock(&priv->nfp_fl_lock);
232234 for (i = 0; i < flow_cnt; i++) {
233235 u32 ctx = be32_to_cpu(msg->flow[i].host_ctx);
234236
235237 sub_flows[i] = nfp_flower_get_fl_payload_from_ctx(app, ctx);
236238 if (!sub_flows[i]) {
237239 nfp_flower_cmsg_warn(app, "Invalid flow in merge hint\n");
238− goto err_rtnl_unlock;
240+ goto err_mutex_unlock;
239241 }
240242 }
241243
@@ -244,8 +246,8 @@ nfp_flower_cmsg_merge_hint_rx(struct nfp_app *app, struct sk_buff *skb) · 2 unmodified lines
244246 if (err == -ENOMEM)
245247 nfp_flower_cmsg_warn(app, "Flow merge memory fail.\n");
246248
247−err_rtnl_unlock:
248− rtnl_unlock();
249+err_mutex_unlock:
250+ mutex_unlock(&priv->nfp_fl_lock);
249251 }
250252
251253 static void
drivers/net/ethernet/netronome/nfp/flower/conntrack.c+13−6
@@ -2131,8 +2131,6 @@ nfp_fl_ct_offload_nft_flow(struct nfp_fl_ct_zone_entry *zt, struct flow_cls_offl · 2130 unmodified lines
21312131 struct nfp_fl_ct_flow_entry *ct_entry;
21322132 struct netlink_ext_ack *extack = NULL;
21332133
2134− ASSERT_RTNL();
2135−
21362134 extack = flow->common.extack;
21372135 switch (flow->command) {
21382136 case FLOW_CLS_REPLACE:
@@ -2178,9 +2176,13 @@ int nfp_fl_ct_handle_nft_flow(enum tc_setup_type type, void *type_data, void *cb · 39 unmodified lines
21782176
21792177 switch (type) {
21802178 case TC_SETUP_CLSFLOWER:
2181− rtnl_lock();
2179+ while (!mutex_trylock(&zt->priv->nfp_fl_lock)) {
2180+ if (!zt->nft) /* avoid deadlock */
2181+ return err;
2182+ msleep(20);
2183+ }
21822184 err = nfp_fl_ct_offload_nft_flow(zt, flow);
2183− rtnl_unlock();
2185+ mutex_unlock(&zt->priv->nfp_fl_lock);
21842186 break;
21852187 default:
21862188 return -EOPNOTSUPP;
@@ -2208,6 +2210,7 @@ int nfp_fl_ct_del_flow(struct nfp_fl_ct_map_entry *ct_map_ent) · 21 unmodified lines
22082210 struct nfp_fl_ct_flow_entry *ct_entry;
22092211 struct nfp_fl_ct_zone_entry *zt;
22102212 struct rhashtable *m_table;
2213+ struct nf_flowtable *nft;
22112214
22122215 if (!ct_map_ent)
22132216 return -ENOENT;
@@ -2226,8 +2229,12 @@ int nfp_fl_ct_del_flow(struct nfp_fl_ct_map_entry *ct_map_ent) · 12 unmodified lines
22262229 if (ct_map_ent->cookie > 0)
22272230 kfree(ct_map_ent);
22282231
2229− if (!zt->pre_ct_count) {
2230− zt->nft = NULL;
2232+ if (!zt->pre_ct_count && zt->nft) {
2233+ nft = zt->nft;
2234+ zt->nft = NULL; /* avoid deadlock */
2235+ nf_flow_table_offload_del_cb(nft,
2236+ nfp_fl_ct_handle_nft_flow,
2237+ zt);
22312238 nfp_fl_ct_clean_nft_entries(zt);
22322239 }
22332240 break;
drivers/net/ethernet/netronome/nfp/flower/main.h+2−0
@@ -297,6 +297,7 @@ struct nfp_fl_internal_ports { · 296 unmodified lines
297297 * @predt_list: List to keep track of decap pretun flows
298298 * @neigh_table: Table to keep track of neighbor entries
299299 * @predt_lock: Lock to serialise predt/neigh table updates
300+ * @nfp_fl_lock: Lock to protect the flow offload operation
300301 */
301302 struct nfp_flower_priv {
302303 struct nfp_app *app;
@@ -339,6 +340,7 @@ struct nfp_flower_priv { · 36 unmodified lines
339340 struct list_head predt_list;
340341 struct rhashtable neigh_table;
341342 spinlock_t predt_lock; /* Lock to serialise predt/neigh table updates */
343+ struct mutex nfp_fl_lock; /* Protect the flow operation */
342344 };
343345
344346 /**
drivers/net/ethernet/netronome/nfp/flower/metadata.c+2−0
@@ -528,6 +528,8 @@ int nfp_flower_metadata_init(struct nfp_app *app, u64 host_ctx_count, · 527 unmodified lines
528528 if (err)
529529 goto err_free_stats_ctx_table;
530530
531+ mutex_init(&priv->nfp_fl_lock);
532+
531533 err = rhashtable_init(&priv->ct_zone_table, &nfp_zone_table_params);
532534 if (err)
533535 goto err_free_merge_table;
drivers/net/ethernet/netronome/nfp/flower/offload.c+18−6
@@ -1009,8 +1009,6 @@ int nfp_flower_merge_offloaded_flows(struct nfp_app *app, · 1008 unmodified lines
10091009 u64 parent_ctx = 0;
10101010 int err;
10111011
1012− ASSERT_RTNL();
1013−
10141012 if (sub_flow1 == sub_flow2 ||
10151013 nfp_flower_is_merge_flow(sub_flow1) ||
10161014 nfp_flower_is_merge_flow(sub_flow2))
@@ -1727,19 +1725,30 @@ static int · 710 unmodified lines
17271725 nfp_flower_repr_offload(struct nfp_app *app, struct net_device *netdev,
17281726 struct flow_cls_offload *flower)
17291727 {
1728+ struct nfp_flower_priv *priv = app->priv;
1729+ int ret;
1730+
17301731 if (!eth_proto_is_802_3(flower->common.protocol))
17311732 return -EOPNOTSUPP;
17321733
1734+ mutex_lock(&priv->nfp_fl_lock);
17331735 switch (flower->command) {
17341736 case FLOW_CLS_REPLACE:
1735− return nfp_flower_add_offload(app, netdev, flower);
1737+ ret = nfp_flower_add_offload(app, netdev, flower);
1738+ break;
17361739 case FLOW_CLS_DESTROY:
1737− return nfp_flower_del_offload(app, netdev, flower);
1740+ ret = nfp_flower_del_offload(app, netdev, flower);
1741+ break;
17381742 case FLOW_CLS_STATS:
1739− return nfp_flower_get_stats(app, netdev, flower);
1743+ ret = nfp_flower_get_stats(app, netdev, flower);
1744+ break;
17401745 default:
1741− return -EOPNOTSUPP;
1746+ ret = -EOPNOTSUPP;
1747+ break;
17421748 }
1749+ mutex_unlock(&priv->nfp_fl_lock);
1750+
1751+ return ret;
17431752 }
17441753
17451754 static int nfp_flower_setup_tc_block_cb(enum tc_setup_type type,
@@ -1778,6 +1787,7 @@ static int nfp_flower_setup_tc_block(struct net_device *netdev, · 32 unmodified lines
17781787 repr_priv = repr->app_priv;
17791788 repr_priv->block_shared = f->block_shared;
17801789 f->driver_block_list = &nfp_block_cb_list;
1790+ f->unlocked_driver_cb = true;
17811791
17821792 switch (f->command) {
17831793 case FLOW_BLOCK_BIND:
@@ -1876,6 +1886,8 @@ nfp_flower_setup_indr_tc_block(struct net_device *netdev, struct Qdisc *sch, str · 92 unmodified lines
18761886 nfp_flower_internal_port_can_offload(app, netdev)))
18771887 return -EOPNOTSUPP;
18781888
1889+ f->unlocked_driver_cb = true;
1890+
18791891 switch (f->command) {
18801892 case FLOW_BLOCK_BIND:
18811893 cb_priv = nfp_flower_indr_block_cb_priv_lookup(app, netdev);
drivers/net/ethernet/netronome/nfp/flower/qos_conf.c+13−7
@@ -523,25 +523,31 @@ int nfp_flower_setup_qos_offload(struct nfp_app *app, struct net_device *netdev, · 522 unmodified lines
523523 {
524524 struct netlink_ext_ack *extack = flow->common.extack;
525525 struct nfp_flower_priv *fl_priv = app->priv;
526+ int ret;
526527
527528 if (!(fl_priv->flower_ext_feats & NFP_FL_FEATS_VF_RLIM)) {
528529 NL_SET_ERR_MSG_MOD(extack, "unsupported offload: loaded firmware does not support qos rate limit offload");
529530 return -EOPNOTSUPP;
530531 }
531532
533+ mutex_lock(&fl_priv->nfp_fl_lock);
532534 switch (flow->command) {
533535 case TC_CLSMATCHALL_REPLACE:
534− return nfp_flower_install_rate_limiter(app, netdev, flow,
535− extack);
536+ ret = nfp_flower_install_rate_limiter(app, netdev, flow, extack);
537+ break;
536538 case TC_CLSMATCHALL_DESTROY:
537− return nfp_flower_remove_rate_limiter(app, netdev, flow,
538− extack);
539+ ret = nfp_flower_remove_rate_limiter(app, netdev, flow, extack);
540+ break;
539541 case TC_CLSMATCHALL_STATS:
540− return nfp_flower_stats_rate_limiter(app, netdev, flow,
541− extack);
542+ ret = nfp_flower_stats_rate_limiter(app, netdev, flow, extack);
543+ break;
542544 default:
543− return -EOPNOTSUPP;
545+ ret = -EOPNOTSUPP;
546+ break;
544547 }
548+ mutex_unlock(&fl_priv->nfp_fl_lock);
549+
550+ return ret;
545551 }
546552
547553 /* Offload tc action, currently only for tc police */
drivers/net/ethernet/qlogic/qed/qed_ll2.h+1−1
@@ -110,9 +110,9 @@ struct qed_ll2_info { · 109 unmodified lines
110110 enum core_tx_dest tx_dest;
111111 u8 tx_stats_en;
112112 bool main_func_queue;
113+ struct qed_ll2_cbs cbs;
113114 struct qed_ll2_rx_queue rx_queue;
114115 struct qed_ll2_tx_queue tx_queue;
115− struct qed_ll2_cbs cbs;
116116 };
117117
118118 extern const struct qed_ll2_ops qed_ll2_ops_pass;
drivers/net/ethernet/renesas/ravb_main.c+4−2
@@ -2167,6 +2167,8 @@ static int ravb_close(struct net_device *ndev) · 2166 unmodified lines
21672167 of_phy_deregister_fixed_link(np);
21682168 }
21692169
2170+ cancel_work_sync(&priv->work);
2171+
21702172 if (info->multi_irqs) {
21712173 free_irq(priv->tx_irqs[RAVB_NC], ndev);
21722174 free_irq(priv->rx_irqs[RAVB_NC], ndev);
@@ -2891,8 +2893,6 @@ static int ravb_remove(struct platform_device *pdev) · 718 unmodified lines
28912893 clk_disable_unprepare(priv->gptp_clk);
28922894 clk_disable_unprepare(priv->refclk);
28932895
2894− dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
2895− priv->desc_bat_dma);
28962896 /* Set reset mode */
28972897 ravb_write(ndev, CCC_OPC_RESET, CCC);
28982898 unregister_netdev(ndev);
@@ -2900,6 +2900,8 @@ static int ravb_remove(struct platform_device *pdev) · 1 unmodified line
29002900 netif_napi_del(&priv->napi[RAVB_NC]);
29012901 netif_napi_del(&priv->napi[RAVB_BE]);
29022902 ravb_mdio_release(priv);
2903+ dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
2904+ priv->desc_bat_dma);
29032905 pm_runtime_put_sync(&pdev->dev);
29042906 pm_runtime_disable(&pdev->dev);
29052907 reset_control_assert(priv->rstc);
drivers/net/ethernet/renesas/rswitch.c+19−6
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 * Copyright (C) 2022 Renesas Electronics Corporation
55 */
66
7+#include <linux/clk.h>
78 #include <linux/dma-mapping.h>
89 #include <linux/err.h>
910 #include <linux/etherdevice.h>
@@ -1049,7 +1050,7 @@ static void rswitch_rmac_setting(struct rswitch_etha *etha, const u8 *mac) · 1039 unmodified lines
10491050 static void rswitch_etha_enable_mii(struct rswitch_etha *etha)
10501051 {
10511052 rswitch_modify(etha->addr, MPIC, MPIC_PSMCS_MASK | MPIC_PSMHT_MASK,
1052− MPIC_PSMCS(0x05) | MPIC_PSMHT(0x06));
1053+ MPIC_PSMCS(etha->psmcs) | MPIC_PSMHT(0x06));
10531054 rswitch_modify(etha->addr, MPSM, 0, MPSM_MFF_C45);
10541055 }
10551056
@@ -1253,7 +1254,7 @@ static void rswitch_adjust_link(struct net_device *ndev) · 197 unmodified lines
12531254 phy_print_status(phydev);
12541255 if (phydev->link)
12551256 phy_power_on(rdev->serdes);
1256− else
1257+ else if (rdev->serdes->power_count)
12571258 phy_power_off(rdev->serdes);
12581259
12591260 rdev->etha->link = phydev->link;
@@ -1693,6 +1694,12 @@ static void rswitch_etha_init(struct rswitch_private *priv, int index) · 433 unmodified lines
16931694 etha->index = index;
16941695 etha->addr = priv->addr + RSWITCH_ETHA_OFFSET + index * RSWITCH_ETHA_SIZE;
16951696 etha->coma_addr = priv->addr;
1697+
1698+ /* MPIC.PSMCS = (clk [MHz] / (MDC frequency [MHz] * 2) - 1.
1699+ * Calculating PSMCS value as MDC frequency = 2.5MHz. So, multiply
1700+ * both the numerator and the denominator by 10.
1701+ */
1702+ etha->psmcs = clk_get_rate(priv->clk) / 100000 / (25 * 2) - 1;
16961703 }
16971704
16981705 static int rswitch_device_alloc(struct rswitch_private *priv, int index)
@@ -1900,6 +1907,10 @@ static int renesas_eth_sw_probe(struct platform_device *pdev) · 201 unmodified lines
19001907 return -ENOMEM;
19011908 spin_lock_init(&priv->lock);
19021909
1910+ priv->clk = devm_clk_get(&pdev->dev, NULL);
1911+ if (IS_ERR(priv->clk))
1912+ return PTR_ERR(priv->clk);
1913+
19031914 attr = soc_device_match(rswitch_soc_no_speed_change);
19041915 if (attr)
19051916 priv->etha_no_runtime_change = true;
@@ -1953,15 +1964,17 @@ static void rswitch_deinit(struct rswitch_private *priv) · 47 unmodified lines
19531964 rswitch_gwca_hw_deinit(priv);
19541965 rcar_gen4_ptp_unregister(priv->ptp_priv);
19551966
1956− for (i = 0; i < RSWITCH_NUM_PORTS; i++) {
1967+ rswitch_for_each_enabled_port(priv, i) {
19571968 struct rswitch_device *rdev = priv->rdev[i];
19581969
1959− phy_exit(priv->rdev[i]->serdes);
1960− rswitch_ether_port_deinit_one(rdev);
19611970 unregister_netdev(rdev->ndev);
1962− rswitch_device_free(priv, i);
1971+ rswitch_ether_port_deinit_one(rdev);
1972+ phy_exit(priv->rdev[i]->serdes);
19631973 }
19641974
1975+ for (i = 0; i < RSWITCH_NUM_PORTS; i++)
1976+ rswitch_device_free(priv, i);
1977+
19651978 rswitch_gwca_ts_queue_free(priv);
19661979 rswitch_gwca_linkfix_free(priv);
19671980
drivers/net/ethernet/renesas/rswitch.h+2−0
@@ -915,6 +915,7 @@ struct rswitch_etha { · 914 unmodified lines
915915 bool external_phy;
916916 struct mii_bus *mii;
917917 phy_interface_t phy_interface;
918+ u32 psmcs;
918919 u8 mac_addr[MAX_ADDR_LEN];
919920 int link;
920921 int speed;
@@ -1012,6 +1013,7 @@ struct rswitch_private { · 91 unmodified lines
10121013 struct rswitch_mfwd mfwd;
10131014
10141015 spinlock_t lock; /* lock interrupt registers' control */
1016+ struct clk *clk;
10151017
10161018 bool etha_no_runtime_change;
10171019 bool gwca_halt;
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c+5−2
@@ -104,6 +104,7 @@ struct stm32_ops { · 103 unmodified lines
104104 int (*parse_data)(struct stm32_dwmac *dwmac,
105105 struct device *dev);
106106 u32 syscfg_eth_mask;
107+ bool clk_rx_enable_in_suspend;
107108 };
108109
109110 static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat)
@@ -121,7 +122,8 @@ static int stm32_dwmac_init(struct plat_stmmacenet_data *plat_dat) · 11 unmodified lines
121122 if (ret)
122123 return ret;
123124
124− if (!dwmac->dev->power.is_suspended) {
125+ if (!dwmac->ops->clk_rx_enable_in_suspend ||
126+ !dwmac->dev->power.is_suspended) {
125127 ret = clk_prepare_enable(dwmac->clk_rx);
126128 if (ret) {
127129 clk_disable_unprepare(dwmac->clk_tx);
@@ -513,7 +515,8 @@ static struct stm32_ops stm32mp1_dwmac_data = { · 385 unmodified lines
513515 .suspend = stm32mp1_suspend,
514516 .resume = stm32mp1_resume,
515517 .parse_data = stm32mp1_parse_data,
516− .syscfg_eth_mask = SYSCFG_MP1_ETH_MASK
518+ .syscfg_eth_mask = SYSCFG_MP1_ETH_MASK,
519+ .clk_rx_enable_in_suspend = true
517520 };
518521
519522 static const struct of_device_id stm32_dwmac_match[] = {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+0−30
@@ -6002,33 +6002,6 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) · 6001 unmodified lines
60026002 return IRQ_HANDLED;
60036003 }
60046004
6005−#ifdef CONFIG_NET_POLL_CONTROLLER
6006−/* Polling receive - used by NETCONSOLE and other diagnostic tools
6007− * to allow network I/O with interrupts disabled.
6008− */
6009−static void stmmac_poll_controller(struct net_device *dev)
6010−{
6011− struct stmmac_priv *priv = netdev_priv(dev);
6012− int i;
6013−
6014− /* If adapter is down, do nothing */
6015− if (test_bit(STMMAC_DOWN, &priv->state))
6016− return;
6017−
6018− if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN) {
6019− for (i = 0; i < priv->plat->rx_queues_to_use; i++)
6020− stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]);
6021−
6022− for (i = 0; i < priv->plat->tx_queues_to_use; i++)
6023− stmmac_msi_intr_tx(0, &priv->dma_conf.tx_queue[i]);
6024− } else {
6025− disable_irq(dev->irq);
6026− stmmac_interrupt(dev->irq, dev);
6027− enable_irq(dev->irq);
6028− }
6029−}
6030−#endif
6031−
60326005 /**
60336006 * stmmac_ioctl - Entry point for the Ioctl
60346007 * @dev: Device pointer.
@@ -6989,9 +6962,6 @@ static const struct net_device_ops stmmac_netdev_ops = { · 954 unmodified lines
69896962 .ndo_get_stats64 = stmmac_get_stats64,
69906963 .ndo_setup_tc = stmmac_setup_tc,
69916964 .ndo_select_queue = stmmac_select_queue,
6992−#ifdef CONFIG_NET_POLL_CONTROLLER
6993− .ndo_poll_controller = stmmac_poll_controller,
6994−#endif
69956965 .ndo_set_mac_address = stmmac_set_mac_address,
69966966 .ndo_vlan_rx_add_vid = stmmac_vlan_rx_add_vid,
69976967 .ndo_vlan_rx_kill_vid = stmmac_vlan_rx_kill_vid,
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+1−1
@@ -901,7 +901,7 @@ static int __maybe_unused stmmac_pltfr_resume(struct device *dev) · 900 unmodified lines
901901 struct platform_device *pdev = to_platform_device(dev);
902902 int ret;
903903
904− ret = stmmac_pltfr_init(pdev, priv->plat->bsp_priv);
904+ ret = stmmac_pltfr_init(pdev, priv->plat);
905905 if (ret)
906906 return ret;
907907
drivers/net/ethernet/ti/am65-cpsw-nuss.c+2−1
@@ -1747,9 +1747,10 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common) · 1746 unmodified lines
17471747 }
17481748
17491749 tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
1750− if (tx_chn->irq <= 0) {
1750+ if (tx_chn->irq < 0) {
17511751 dev_err(dev, "Failed to get tx dma irq %d\n",
17521752 tx_chn->irq);
1753+ ret = tx_chn->irq;
17531754 goto err;
17541755 }
17551756
drivers/net/ethernet/ti/icssg/icssg_prueth.c+3−3
@@ -316,12 +316,12 @@ static int prueth_init_tx_chns(struct prueth_emac *emac) · 315 unmodified lines
316316 goto fail;
317317 }
318318
319− tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
320− if (tx_chn->irq <= 0) {
321− ret = -EINVAL;
319+ ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
320+ if (ret < 0) {
322321 netdev_err(ndev, "failed to get tx irq\n");
323322 goto fail;
324323 }
324+ tx_chn->irq = ret;
325325
326326 snprintf(tx_chn->name, sizeof(tx_chn->name), "%s-tx%d",
327327 dev_name(dev), tx_chn->id);
drivers/net/ieee802154/ca8210.c+3−14
@@ -2740,7 +2740,6 @@ static int ca8210_register_ext_clock(struct spi_device *spi) · 2739 unmodified lines
27402740 struct device_node *np = spi->dev.of_node;
27412741 struct ca8210_priv *priv = spi_get_drvdata(spi);
27422742 struct ca8210_platform_data *pdata = spi->dev.platform_data;
2743− int ret = 0;
27442743
27452744 if (!np)
27462745 return -EFAULT;
@@ -2757,18 +2756,8 @@ static int ca8210_register_ext_clock(struct spi_device *spi) · 10 unmodified lines
27572756 dev_crit(&spi->dev, "Failed to register external clk\n");
27582757 return PTR_ERR(priv->clk);
27592758 }
2760− ret = of_clk_add_provider(np, of_clk_src_simple_get, priv->clk);
2761− if (ret) {
2762− clk_unregister(priv->clk);
2763− dev_crit(
2764− &spi->dev,
2765− "Failed to register external clock as clock provider\n"
2766− );
2767− } else {
2768− dev_info(&spi->dev, "External clock set as clock provider\n");
2769− }
27702759
2771− return ret;
2760+ return of_clk_add_provider(np, of_clk_src_simple_get, priv->clk);
27722761 }
27732762
27742763 /**
@@ -2780,8 +2769,8 @@ static void ca8210_unregister_ext_clock(struct spi_device *spi) · 5 unmodified lines
27802769 {
27812770 struct ca8210_priv *priv = spi_get_drvdata(spi);
27822771
2783− if (!priv->clk)
2784− return
2772+ if (IS_ERR_OR_NULL(priv->clk))
2773+ return;
27852774
27862775 of_clk_del_provider(spi->dev.of_node);
27872776 clk_unregister(priv->clk);
drivers/net/macsec.c+2−0
@@ -2383,6 +2383,7 @@ static int macsec_upd_txsa(struct sk_buff *skb, struct genl_info *info) · 2382 unmodified lines
23832383
23842384 ctx.sa.assoc_num = assoc_num;
23852385 ctx.sa.tx_sa = tx_sa;
2386+ ctx.sa.update_pn = !!prev_pn.full64;
23862387 ctx.secy = secy;
23872388
23882389 ret = macsec_offload(ops->mdo_upd_txsa, &ctx);
@@ -2476,6 +2477,7 @@ static int macsec_upd_rxsa(struct sk_buff *skb, struct genl_info *info) · 87 unmodified lines
24762477
24772478 ctx.sa.assoc_num = assoc_num;
24782479 ctx.sa.rx_sa = rx_sa;
2480+ ctx.sa.update_pn = !!prev_pn.full64;
24792481 ctx.secy = secy;
24802482
24812483 ret = macsec_offload(ops->mdo_upd_rxsa, &ctx);
drivers/net/phy/mscc/mscc_macsec.c+6−0
@@ -849,6 +849,9 @@ static int vsc8584_macsec_upd_rxsa(struct macsec_context *ctx) · 848 unmodified lines
849849 struct macsec_flow *flow;
850850 int ret;
851851
852+ if (ctx->sa.update_pn)
853+ return -EINVAL;
854+
852855 flow = vsc8584_macsec_find_flow(ctx, MACSEC_INGR);
853856 if (IS_ERR(flow))
854857 return PTR_ERR(flow);
@@ -900,6 +903,9 @@ static int vsc8584_macsec_upd_txsa(struct macsec_context *ctx) · 45 unmodified lines
900903 struct macsec_flow *flow;
901904 int ret;
902905
906+ if (ctx->sa.update_pn)
907+ return -EINVAL;
908+
903909 flow = vsc8584_macsec_find_flow(ctx, MACSEC_EGR);
904910 if (IS_ERR(flow))
905911 return PTR_ERR(flow);
drivers/net/usb/dm9601.c+6−1
@@ -222,13 +222,18 @@ static int dm9601_mdio_read(struct net_device *netdev, int phy_id, int loc) · 221 unmodified lines
222222 struct usbnet *dev = netdev_priv(netdev);
223223
224224 __le16 res;
225+ int err;
225226
226227 if (phy_id) {
227228 netdev_dbg(dev->net, "Only internal phy supported\n");
228229 return 0;
229230 }
230231
231− dm_read_shared_word(dev, 1, loc, &res);
232+ err = dm_read_shared_word(dev, 1, loc, &res);
233+ if (err < 0) {
234+ netdev_err(dev->net, "MDIO read error: %d\n", err);
235+ return err;
236+ }
232237
233238 netdev_dbg(dev->net,
234239 "dm9601_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x\n",
drivers/net/usb/smsc75xx.c+3−1
@@ -90,7 +90,9 @@ static int __must_check __smsc75xx_read_reg(struct usbnet *dev, u32 index, · 89 unmodified lines
9090 ret = fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN
9191 | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
9292 0, index, &buf, 4);
93− if (unlikely(ret < 0)) {
93+ if (unlikely(ret < 4)) {
94+ ret = ret < 0 ? ret : -ENODATA;
95+
9496 netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n",
9597 index, ret);
9698 return ret;
drivers/net/virtio_net.c+7−7
@@ -607,16 +607,16 @@ static void virtnet_rq_unmap(struct receive_queue *rq, void *buf, u32 len) · 606 unmodified lines
607607
608608 --dma->ref;
609609
610− if (dma->ref) {
611− if (dma->need_sync && len) {
612− offset = buf - (head + sizeof(*dma));
610+ if (dma->need_sync && len) {
611+ offset = buf - (head + sizeof(*dma));
613612
614− virtqueue_dma_sync_single_range_for_cpu(rq->vq, dma->addr, offset,
615− len, DMA_FROM_DEVICE);
616− }
613+ virtqueue_dma_sync_single_range_for_cpu(rq->vq, dma->addr,
614+ offset, len,
615+ DMA_FROM_DEVICE);
616+ }
617617
618+ if (dma->ref)
618619 return;
619− }
620620
621621 virtqueue_dma_unmap_single_attrs(rq->vq, dma->addr, dma->len,
622622 DMA_FROM_DEVICE, DMA_ATTR_SKIP_CPU_SYNC);
drivers/net/wan/fsl_ucc_hdlc.c+10−2
@@ -34,6 +34,8 @@ · 33 unmodified lines
3434 #define TDM_PPPOHT_SLIC_MAXIN
3535 #define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S)
3636
37+static int uhdlc_close(struct net_device *dev);
38+
3739 static struct ucc_tdm_info utdm_primary_info = {
3840 .uf_info = {
3941 .tsa = 0,
@@ -708,6 +710,7 @@ static int uhdlc_open(struct net_device *dev) · 668 unmodified lines
708710 hdlc_device *hdlc = dev_to_hdlc(dev);
709711 struct ucc_hdlc_private *priv = hdlc->priv;
710712 struct ucc_tdm *utdm = priv->utdm;
713+ int rc = 0;
711714
712715 if (priv->hdlc_busy != 1) {
713716 if (request_irq(priv->ut_info->uf_info.irq,
@@ -731,10 +734,13 @@ static int uhdlc_open(struct net_device *dev) · 17 unmodified lines
731734 napi_enable(&priv->napi);
732735 netdev_reset_queue(dev);
733736 netif_start_queue(dev);
734− hdlc_open(dev);
737+
738+ rc = hdlc_open(dev);
739+ if (rc)
740+ uhdlc_close(dev);
735741 }
736742
737− return 0;
743+ return rc;
738744 }
739745
740746 static void uhdlc_memclean(struct ucc_hdlc_private *priv)
@@ -824,6 +830,8 @@ static int uhdlc_close(struct net_device *dev) · 83 unmodified lines
824830 netdev_reset_queue(dev);
825831 priv->hdlc_busy = 0;
826832
833+ hdlc_close(dev);
834+
827835 return 0;
828836 }
829837
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h+7−2
@@ -442,7 +442,12 @@ struct brcmf_scan_params_v2_le { · 441 unmodified lines
442442 * fixed parameter portion is assumed, otherwise
443443 * ssid in the fixed portion is ignored
444444 */
445− __le16 channel_list[1]; /* list of chanspecs */
445+ union {
446+ __le16 padding; /* Reserve space for at least 1 entry for abort
447+ * which uses an on stack brcmf_scan_params_v2_le
448+ */
449+ DECLARE_FLEX_ARRAY(__le16, channel_list); /* chanspecs */
450+ };
446451 };
447452
448453 struct brcmf_scan_results {
@@ -702,7 +707,7 @@ struct brcmf_sta_info_le { · 253 unmodified lines
702707
703708 struct brcmf_chanspec_list {
704709 __le32 count; /* # of entries */
705− __le32 element[1]; /* variable length uint32 list */
710+ __le32 element[]; /* variable length uint32 list */
706711 };
707712
708713 /*
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h+3−3
@@ -310,9 +310,9 @@ struct iwl_fw_ini_fifo_hdr { · 309 unmodified lines
310310 struct iwl_fw_ini_error_dump_range {
311311 __le32 range_data_size;
312312 union {
313− __le32 internal_base_addr;
314− __le64 dram_base_addr;
315− __le32 page_num;
313+ __le32 internal_base_addr __packed;
314+ __le64 dram_base_addr __packed;
315+ __le32 page_num __packed;
316316 struct iwl_fw_ini_fifo_hdr fifo_hdr;
317317 struct iwl_cmd_header fw_pkt_hdr;
318318 };
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+1−1
@@ -802,7 +802,7 @@ out: · 801 unmodified lines
802802 mvm->nvm_data->bands[0].n_channels = 1;
803803 mvm->nvm_data->bands[0].n_bitrates = 1;
804804 mvm->nvm_data->bands[0].bitrates =
805− (void *)((u8 *)mvm->nvm_data->channels + 1);
805+ (void *)(mvm->nvm_data->channels + 1);
806806 mvm->nvm_data->bands[0].bitrates->hw_value = 10;
807807 }
808808
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c+63−58
@@ -731,73 +731,78 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm, · 730 unmodified lines
731731
732732 mvmvif->associated = vif->cfg.assoc;
733733
734− if (!(changes & BSS_CHANGED_ASSOC))
735− return;
736−
737− if (vif->cfg.assoc) {
738− /* clear statistics to get clean beacon counter */
739− iwl_mvm_request_statistics(mvm, true);
740− iwl_mvm_sf_update(mvm, vif, false);
741− iwl_mvm_power_vif_assoc(mvm, vif);
742−
743− for_each_mvm_vif_valid_link(mvmvif, i) {
744− memset(&mvmvif->link[i]->beacon_stats, 0,
745− sizeof(mvmvif->link[i]->beacon_stats));
734+ if (changes & BSS_CHANGED_ASSOC) {
735+ if (vif->cfg.assoc) {
736+ /* clear statistics to get clean beacon counter */
737+ iwl_mvm_request_statistics(mvm, true);
738+ iwl_mvm_sf_update(mvm, vif, false);
739+ iwl_mvm_power_vif_assoc(mvm, vif);
740+
741+ for_each_mvm_vif_valid_link(mvmvif, i) {
742+ memset(&mvmvif->link[i]->beacon_stats, 0,
743+ sizeof(mvmvif->link[i]->beacon_stats));
744+
745+ if (vif->p2p) {
746+ iwl_mvm_update_smps(mvm, vif,
747+ IWL_MVM_SMPS_REQ_PROT,
748+ IEEE80211_SMPS_DYNAMIC, i);
749+ }
750+
751+ rcu_read_lock();
752+ link_conf = rcu_dereference(vif->link_conf[i]);
753+ if (link_conf && !link_conf->dtim_period)
754+ protect = true;
755+ rcu_read_unlock();
756+ }
746757
747− if (vif->p2p) {
748− iwl_mvm_update_smps(mvm, vif,
749− IWL_MVM_SMPS_REQ_PROT,
750− IEEE80211_SMPS_DYNAMIC, i);
758+ if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
759+ protect) {
760+ /* If we're not restarting and still haven't
761+ * heard a beacon (dtim period unknown) then
762+ * make sure we still have enough minimum time
763+ * remaining in the time event, since the auth
764+ * might actually have taken quite a while
765+ * (especially for SAE) and so the remaining
766+ * time could be small without us having heard
767+ * a beacon yet.
768+ */
769+ iwl_mvm_protect_assoc(mvm, vif, 0);
751770 }
752771
753− rcu_read_lock();
754− link_conf = rcu_dereference(vif->link_conf[i]);
755− if (link_conf && !link_conf->dtim_period)
756− protect = true;
757− rcu_read_unlock();
758− }
772+ iwl_mvm_sf_update(mvm, vif, false);
773+
774+ /* FIXME: need to decide about misbehaving AP handling */
775+ iwl_mvm_power_vif_assoc(mvm, vif);
776+ } else if (iwl_mvm_mld_vif_have_valid_ap_sta(mvmvif)) {
777+ iwl_mvm_mei_host_disassociated(mvm);
759778
760− if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) &&
761− protect) {
762− /* If we're not restarting and still haven't
763− * heard a beacon (dtim period unknown) then
764− * make sure we still have enough minimum time
765− * remaining in the time event, since the auth
766− * might actually have taken quite a while
767− * (especially for SAE) and so the remaining
768− * time could be small without us having heard
769− * a beacon yet.
779+ /* If update fails - SF might be running in associated
780+ * mode while disassociated - which is forbidden.
770781 */
771− iwl_mvm_protect_assoc(mvm, vif, 0);
782+ ret = iwl_mvm_sf_update(mvm, vif, false);
783+ WARN_ONCE(ret &&
784+ !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
785+ &mvm->status),
786+ "Failed to update SF upon disassociation\n");
787+
788+ /* If we get an assert during the connection (after the
789+ * station has been added, but before the vif is set
790+ * to associated), mac80211 will re-add the station and
791+ * then configure the vif. Since the vif is not
792+ * associated, we would remove the station here and
793+ * this would fail the recovery.
794+ */
795+ iwl_mvm_mld_vif_delete_all_stas(mvm, vif);
772796 }
773797
774− iwl_mvm_sf_update(mvm, vif, false);
775−
776− /* FIXME: need to decide about misbehaving AP handling */
777− iwl_mvm_power_vif_assoc(mvm, vif);
778− } else if (iwl_mvm_mld_vif_have_valid_ap_sta(mvmvif)) {
779− iwl_mvm_mei_host_disassociated(mvm);
780−
781− /* If update fails - SF might be running in associated
782− * mode while disassociated - which is forbidden.
783− */
784− ret = iwl_mvm_sf_update(mvm, vif, false);
785− WARN_ONCE(ret &&
786− !test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED,
787− &mvm->status),
788− "Failed to update SF upon disassociation\n");
789−
790− /* If we get an assert during the connection (after the
791− * station has been added, but before the vif is set
792− * to associated), mac80211 will re-add the station and
793− * then configure the vif. Since the vif is not
794− * associated, we would remove the station here and
795− * this would fail the recovery.
796− */
797− iwl_mvm_mld_vif_delete_all_stas(mvm, vif);
798+ iwl_mvm_bss_info_changed_station_assoc(mvm, vif, changes);
798799 }
799800
800− iwl_mvm_bss_info_changed_station_assoc(mvm, vif, changes);
801+ if (changes & BSS_CHANGED_PS) {
802+ ret = iwl_mvm_power_update_mac(mvm);
803+ if (ret)
804+ IWL_ERR(mvm, "failed to update power mode\n");
805+ }
801806 }
802807
803808 static void
drivers/net/wireless/intel/iwlwifi/mvm/scan.c+1−1
@@ -2342,7 +2342,7 @@ iwl_mvm_scan_umac_fill_general_p_v12(struct iwl_mvm *mvm, · 2341 unmodified lines
23422342 if (gen_flags & IWL_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2)
23432343 gp->num_of_fragments[SCAN_HB_LMAC_IDX] = IWL_SCAN_NUM_OF_FRAGS;
23442344
2345− if (version < 12) {
2345+ if (version < 16) {
23462346 gp->scan_start_mac_or_link_id = scan_vif->id;
23472347 } else {
23482348 struct iwl_mvm_vif_link_info *link_info;
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+3−0
@@ -1612,6 +1612,7 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm, · 1611 unmodified lines
16121612 iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]);
16131613
16141614 memset(&info->status, 0, sizeof(info->status));
1615+ info->flags &= ~(IEEE80211_TX_STAT_ACK | IEEE80211_TX_STAT_TX_FILTERED);
16151616
16161617 /* inform mac80211 about what happened with the frame */
16171618 switch (status & TX_STATUS_MSK) {
@@ -1964,6 +1965,8 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid, · 346 unmodified lines
19641965 */
19651966 if (!is_flush)
19661967 info->flags |= IEEE80211_TX_STAT_ACK;
1968+ else
1969+ info->flags &= ~IEEE80211_TX_STAT_ACK;
19671970 }
19681971
19691972 /*
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c+19−3
@@ -918,9 +918,17 @@ void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv, · 917 unmodified lines
918918
919919 mwifiex_dbg_dump(priv->adapter, EVT_D, "RXBA_SYNC event:",
920920 event_buf, len);
921− while (tlv_buf_left >= sizeof(*tlv_rxba)) {
921+ while (tlv_buf_left > sizeof(*tlv_rxba)) {
922922 tlv_type = le16_to_cpu(tlv_rxba->header.type);
923923 tlv_len = le16_to_cpu(tlv_rxba->header.len);
924+ if (size_add(sizeof(tlv_rxba->header), tlv_len) > tlv_buf_left) {
925+ mwifiex_dbg(priv->adapter, WARN,
926+ "TLV size (%zu) overflows event_buf buf_left=%d\n",
927+ size_add(sizeof(tlv_rxba->header), tlv_len),
928+ tlv_buf_left);
929+ return;
930+ }
931+
924932 if (tlv_type != TLV_TYPE_RXBA_SYNC) {
925933 mwifiex_dbg(priv->adapter, ERROR,
926934 "Wrong TLV id=0x%x\n", tlv_type);
@@ -929,6 +937,14 @@ void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv, · 2 unmodified lines
929937
930938 tlv_seq_num = le16_to_cpu(tlv_rxba->seq_num);
931939 tlv_bitmap_len = le16_to_cpu(tlv_rxba->bitmap_len);
940+ if (size_add(sizeof(*tlv_rxba), tlv_bitmap_len) > tlv_buf_left) {
941+ mwifiex_dbg(priv->adapter, WARN,
942+ "TLV size (%zu) overflows event_buf buf_left=%d\n",
943+ size_add(sizeof(*tlv_rxba), tlv_bitmap_len),
944+ tlv_buf_left);
945+ return;
946+ }
947+
932948 mwifiex_dbg(priv->adapter, INFO,
933949 "%pM tid=%d seq_num=%d bitmap_len=%d\n",
934950 tlv_rxba->mac, tlv_rxba->tid, tlv_seq_num,
@@ -965,8 +981,8 @@ void mwifiex_11n_rxba_sync_event(struct mwifiex_private *priv, · 30 unmodified lines
965981 }
966982 }
967983
968− tlv_buf_left -= (sizeof(*tlv_rxba) + tlv_len);
969− tmp = (u8 *)tlv_rxba + tlv_len + sizeof(*tlv_rxba);
984+ tlv_buf_left -= (sizeof(tlv_rxba->header) + tlv_len);
985+ tmp = (u8 *)tlv_rxba + sizeof(tlv_rxba->header) + tlv_len;
970986 tlv_rxba = (struct mwifiex_ie_types_rxba_sync *)tmp;
971987 }
972988 }
drivers/net/wireless/marvell/mwifiex/fw.h+1−1
@@ -779,7 +779,7 @@ struct mwifiex_ie_types_rxba_sync { · 778 unmodified lines
779779 u8 reserved;
780780 __le16 seq_num;
781781 __le16 bitmap_len;
782− u8 bitmap[1];
782+ u8 bitmap[];
783783 } __packed;
784784
785785 struct chan_band_param_set {
drivers/net/wireless/marvell/mwifiex/sta_rx.c+9−7
@@ -86,7 +86,8 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, · 85 unmodified lines
8686 rx_pkt_len = le16_to_cpu(local_rx_pd->rx_pkt_length);
8787 rx_pkt_hdr = (void *)local_rx_pd + rx_pkt_off;
8888
89− if (sizeof(*rx_pkt_hdr) + rx_pkt_off > skb->len) {
89+ if (sizeof(rx_pkt_hdr->eth803_hdr) + sizeof(rfc1042_header) +
90+ rx_pkt_off > skb->len) {
9091 mwifiex_dbg(priv->adapter, ERROR,
9192 "wrong rx packet offset: len=%d, rx_pkt_off=%d\n",
9293 skb->len, rx_pkt_off);
@@ -95,12 +96,13 @@ int mwifiex_process_rx_packet(struct mwifiex_private *priv, · 2 unmodified lines
9596 return -1;
9697 }
9798
98− if ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
99− sizeof(bridge_tunnel_header))) ||
100− (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
101− sizeof(rfc1042_header)) &&
102− ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
103− ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX)) {
99+ if (sizeof(*rx_pkt_hdr) + rx_pkt_off <= skb->len &&
100+ ((!memcmp(&rx_pkt_hdr->rfc1042_hdr, bridge_tunnel_header,
101+ sizeof(bridge_tunnel_header))) ||
102+ (!memcmp(&rx_pkt_hdr->rfc1042_hdr, rfc1042_header,
103+ sizeof(rfc1042_header)) &&
104+ ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_AARP &&
105+ ntohs(rx_pkt_hdr->rfc1042_hdr.snap_type) != ETH_P_IPX))) {
104106 /*
105107 * Replace the 803 header and rfc1042 header (llc/snap) with an
106108 * EthernetII header, keep the src/dst and snap_type
drivers/net/wireless/mediatek/mt76/dma.c+4−4
@@ -93,13 +93,13 @@ __mt76_get_rxwi(struct mt76_dev *dev) · 92 unmodified lines
9393 {
9494 struct mt76_txwi_cache *t = NULL;
9595
96− spin_lock(&dev->wed_lock);
96+ spin_lock_bh(&dev->wed_lock);
9797 if (!list_empty(&dev->rxwi_cache)) {
9898 t = list_first_entry(&dev->rxwi_cache, struct mt76_txwi_cache,
9999 list);
100100 list_del(&t->list);
101101 }
102− spin_unlock(&dev->wed_lock);
102+ spin_unlock_bh(&dev->wed_lock);
103103
104104 return t;
105105 }
@@ -145,9 +145,9 @@ mt76_put_rxwi(struct mt76_dev *dev, struct mt76_txwi_cache *t) · 39 unmodified lines
145145 if (!t)
146146 return;
147147
148− spin_lock(&dev->wed_lock);
148+ spin_lock_bh(&dev->wed_lock);
149149 list_add(&t->list, &dev->rxwi_cache);
150− spin_unlock(&dev->wed_lock);
150+ spin_unlock_bh(&dev->wed_lock);
151151 }
152152 EXPORT_SYMBOL_GPL(mt76_put_rxwi);
153153
drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c+0−7
@@ -131,15 +131,8 @@ u8 mt76x02_get_lna_gain(struct mt76x02_dev *dev, · 130 unmodified lines
131131 s8 *lna_2g, s8 *lna_5g,
132132 struct ieee80211_channel *chan)
133133 {
134− u16 val;
135134 u8 lna;
136135
137− val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1);
138− if (val & MT_EE_NIC_CONF_1_LNA_EXT_2G)
139− *lna_2g = 0;
140− if (val & MT_EE_NIC_CONF_1_LNA_EXT_5G)
141− memset(lna_5g, 0, sizeof(s8) * 3);
142−
143136 if (chan->band == NL80211_BAND_2GHZ)
144137 lna = *lna_2g;
145138 else if (chan->hw_value <= 64)
drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c+11−2
@@ -256,7 +256,8 @@ void mt76x2_read_rx_gain(struct mt76x02_dev *dev) · 255 unmodified lines
256256 struct ieee80211_channel *chan = dev->mphy.chandef.chan;
257257 int channel = chan->hw_value;
258258 s8 lna_5g[3], lna_2g;
259− u8 lna;
259+ bool use_lna;
260+ u8 lna = 0;
260261 u16 val;
261262
262263 if (chan->band == NL80211_BAND_2GHZ)
@@ -275,7 +276,15 @@ void mt76x2_read_rx_gain(struct mt76x02_dev *dev) · 12 unmodified lines
275276 dev->cal.rx.mcu_gain |= (lna_5g[1] & 0xff) << 16;
276277 dev->cal.rx.mcu_gain |= (lna_5g[2] & 0xff) << 24;
277278
278− lna = mt76x02_get_lna_gain(dev, &lna_2g, lna_5g, chan);
279+ val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1);
280+ if (chan->band == NL80211_BAND_2GHZ)
281+ use_lna = !(val & MT_EE_NIC_CONF_1_LNA_EXT_2G);
282+ else
283+ use_lna = !(val & MT_EE_NIC_CONF_1_LNA_EXT_5G);
284+
285+ if (use_lna)
286+ lna = mt76x02_get_lna_gain(dev, &lna_2g, lna_5g, chan);
287+
279288 dev->cal.rx.lna_gain = mt76x02_sign_extend(lna, 8);
280289 }
281290 EXPORT_SYMBOL_GPL(mt76x2_read_rx_gain);
drivers/net/wireless/realtek/rtw88/rtw8723d.h+1−0
@@ -46,6 +46,7 @@ struct rtw8723du_efuse { · 45 unmodified lines
4646 u8 vender_id[2]; /* 0x100 */
4747 u8 product_id[2]; /* 0x102 */
4848 u8 usb_option; /* 0x104 */
49+ u8 res5[2]; /* 0x105 */
4950 u8 mac_addr[ETH_ALEN]; /* 0x107 */
5051 };
5152
drivers/net/xen-netback/interface.c+0−4
@@ -41,8 +41,6 @@ · 40 unmodified lines
4141 #include <asm/xen/hypercall.h>
4242 #include <xen/balloon.h>
4343
44−#define XENVIF_QUEUE_LENGTH 32
45−
4644 /* Number of bytes allowed on the internal guest Rx queue. */
4745 #define XENVIF_RX_QUEUE_BYTES (XEN_NETIF_RX_RING_SIZE/2 * PAGE_SIZE)
4846
@@ -530,8 +528,6 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, · 481 unmodified lines
530528 dev->features = dev->hw_features | NETIF_F_RXCSUM;
531529 dev->ethtool_ops = &xenvif_ethtool_ops;
532530
533− dev->tx_queue_len = XENVIF_QUEUE_LENGTH;
534−
535531 dev->min_mtu = ETH_MIN_MTU;
536532 dev->max_mtu = ETH_MAX_MTU - VLAN_ETH_HLEN;
537533
drivers/of/dynamic.c+3−3
@@ -890,13 +890,13 @@ int of_changeset_action(struct of_changeset *ocs, unsigned long action, · 889 unmodified lines
890890 {
891891 struct of_changeset_entry *ce;
892892
893+ if (WARN_ON(action >= ARRAY_SIZE(action_names)))
894+ return -EINVAL;
895+
893896 ce = kzalloc(sizeof(*ce), GFP_KERNEL);
894897 if (!ce)
895898 return -ENOMEM;
896899
897− if (WARN_ON(action >= ARRAY_SIZE(action_names)))
898− return -EINVAL;
899−
900900 /* get a reference to the node */
901901 ce->action = action;
902902 ce->np = of_node_get(np);
drivers/of/overlay.c+1−1
@@ -45,8 +45,8 @@ struct target { · 44 unmodified lines
4545
4646 /**
4747 * struct fragment - info about fragment nodes in overlay expanded device tree
48− * @target: target of the overlay operation
4948 * @overlay: pointer to the __overlay__ node
49+ * @target: target of the overlay operation
5050 */
5151 struct fragment {
5252 struct device_node *overlay;
drivers/pci/controller/dwc/pcie-qcom.c+1−3
@@ -43,7 +43,6 @@ · 42 unmodified lines
4343 #define PARF_PHY_REFCLK 0x4c
4444 #define PARF_CONFIG_BITS 0x50
4545 #define PARF_DBI_BASE_ADDR 0x168
46−#define PARF_SLV_ADDR_SPACE_SIZE_2_3_3 0x16c /* Register offset specific to IP ver 2.3.3 */
4746 #define PARF_MHI_CLOCK_RESET_CTRL 0x174
4847 #define PARF_AXI_MSTR_WR_ADDR_HALT 0x178
4948 #define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1a8
@@ -797,8 +796,7 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie) · 747 unmodified lines
797796 u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
798797 u32 val;
799798
800− writel(SLV_ADDR_SPACE_SZ,
801− pcie->parf + PARF_SLV_ADDR_SPACE_SIZE_2_3_3);
799+ writel(SLV_ADDR_SPACE_SZ, pcie->parf + PARF_SLV_ADDR_SPACE_SIZE);
802800
803801 val = readl(pcie->parf + PARF_PHY_CTRL);
804802 val &= ~PHY_TEST_PWR_DOWN;
drivers/pci/of.c+11−8
@@ -657,30 +657,33 @@ void of_pci_make_dev_node(struct pci_dev *pdev) · 656 unmodified lines
657657
658658 cset = kmalloc(sizeof(*cset), GFP_KERNEL);
659659 if (!cset)
660− goto failed;
660+ goto out_free_name;
661661 of_changeset_init(cset);
662662
663663 np = of_changeset_create_node(cset, ppnode, name);
664664 if (!np)
665− goto failed;
666− np->data = cset;
665+ goto out_destroy_cset;
667666
668667 ret = of_pci_add_properties(pdev, cset, np);
669668 if (ret)
670− goto failed;
669+ goto out_free_node;
671670
672671 ret = of_changeset_apply(cset);
673672 if (ret)
674− goto failed;
673+ goto out_free_node;
675674
675+ np->data = cset;
676676 pdev->dev.of_node = np;
677677 kfree(name);
678678
679679 return;
680680
681−failed:
682− if (np)
683− of_node_put(np);
681+out_free_node:
682+ of_node_put(np);
683+out_destroy_cset:
684+ of_changeset_destroy(cset);
685+ kfree(cset);
686+out_free_name:
684687 kfree(name);
685688 }
686689 #endif
drivers/pci/of_property.c+18−7
@@ -186,8 +186,8 @@ static int of_pci_prop_interrupts(struct pci_dev *pdev, · 185 unmodified lines
186186 static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
187187 struct device_node *np)
188188 {
189+ u32 i, addr_sz[OF_PCI_MAX_INT_PIN] = { 0 }, map_sz = 0;
189190 struct of_phandle_args out_irq[OF_PCI_MAX_INT_PIN];
190− u32 i, addr_sz[OF_PCI_MAX_INT_PIN], map_sz = 0;
191191 __be32 laddr[OF_PCI_ADDRESS_CELLS] = { 0 };
192192 u32 int_map_mask[] = { 0xffff00, 0, 0, 7 };
193193 struct device_node *pnode;
@@ -213,33 +213,44 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, · 19 unmodified lines
213213 out_irq[i].args[0] = pin;
214214 ret = of_irq_parse_raw(laddr, &out_irq[i]);
215215 if (ret) {
216− pci_err(pdev, "parse irq %d failed, ret %d", pin, ret);
216+ out_irq[i].np = NULL;
217+ pci_dbg(pdev, "parse irq %d failed, ret %d", pin, ret);
217218 continue;
218219 }
219− ret = of_property_read_u32(out_irq[i].np, "#address-cells",
220− &addr_sz[i]);
221− if (ret)
222− addr_sz[i] = 0;
220+ of_property_read_u32(out_irq[i].np, "#address-cells",
221+ &addr_sz[i]);
223222 }
224223
225224 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
226225 for (pin = 1; pin <= OF_PCI_MAX_INT_PIN; pin++) {
227226 i = pci_swizzle_interrupt_pin(child, pin) - 1;
227+ if (!out_irq[i].np)
228+ continue;
228229 map_sz += 5 + addr_sz[i] + out_irq[i].args_count;
229230 }
230231 }
231232
233+ /*
234+ * Parsing interrupt failed for all pins. In this case, it does not
235+ * need to generate interrupt-map property.
236+ */
237+ if (!map_sz)
238+ return 0;
239+
232240 int_map = kcalloc(map_sz, sizeof(u32), GFP_KERNEL);
233241 mapp = int_map;
234242
235243 list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
236244 for (pin = 1; pin <= OF_PCI_MAX_INT_PIN; pin++) {
245+ i = pci_swizzle_interrupt_pin(child, pin) - 1;
246+ if (!out_irq[i].np)
247+ continue;
248+
237249 *mapp = (child->bus->number << 16) |
238250 (child->devfn << 8);
239251 mapp += OF_PCI_ADDRESS_CELLS;
240252 *mapp = pin;
241253 mapp++;
242− i = pci_swizzle_interrupt_pin(child, pin) - 1;
243254 *mapp = out_irq[i].np->phandle;
244255 mapp++;
245256 if (addr_sz[i]) {
drivers/pci/pci-driver.c+13−1
@@ -572,7 +572,19 @@ static void pci_pm_default_resume_early(struct pci_dev *pci_dev) · 571 unmodified lines
572572
573573 static void pci_pm_bridge_power_up_actions(struct pci_dev *pci_dev)
574574 {
575− pci_bridge_wait_for_secondary_bus(pci_dev, "resume");
575+ int ret;
576+
577+ ret = pci_bridge_wait_for_secondary_bus(pci_dev, "resume");
578+ if (ret) {
579+ /*
580+ * The downstream link failed to come up, so mark the
581+ * devices below as disconnected to make sure we don't
582+ * attempt to resume them.
583+ */
584+ pci_walk_bus(pci_dev->subordinate, pci_dev_set_disconnected,
585+ NULL);
586+ return;
587+ }
576588
577589 /*
578590 * When powering on a bridge from D3cold, the whole hierarchy may be
drivers/perf/arm-cmn.c+1−1
@@ -1972,7 +1972,7 @@ static irqreturn_t arm_cmn_handle_irq(int irq, void *dev_id) · 1971 unmodified lines
19721972 u64 delta;
19731973 int i;
19741974
1975− for (i = 0; i < CMN_DTM_NUM_COUNTERS; i++) {
1975+ for (i = 0; i < CMN_DT_NUM_COUNTERS; i++) {
19761976 if (status & (1U << i)) {
19771977 ret = IRQ_HANDLED;
19781978 if (WARN_ON(!dtc->counters[i]))
drivers/perf/riscv_pmu.c+2−1
@@ -23,7 +23,8 @@ static bool riscv_perf_user_access(struct perf_event *event) · 22 unmodified lines
2323 return ((event->attr.type == PERF_TYPE_HARDWARE) ||
2424 (event->attr.type == PERF_TYPE_HW_CACHE) ||
2525 (event->attr.type == PERF_TYPE_RAW)) &&
26− !!(event->hw.flags & PERF_EVENT_FLAG_USER_READ_CNT);
26+ !!(event->hw.flags & PERF_EVENT_FLAG_USER_READ_CNT) &&
27+ (event->hw.idx != -1);
2728 }
2829
2930 void arch_perf_update_userpage(struct perf_event *event,
drivers/perf/riscv_pmu_sbi.c+10−6
@@ -510,16 +510,18 @@ static void pmu_sbi_set_scounteren(void *arg) · 509 unmodified lines
510510 {
511511 struct perf_event *event = (struct perf_event *)arg;
512512
513− csr_write(CSR_SCOUNTEREN,
514− csr_read(CSR_SCOUNTEREN) | (1 << pmu_sbi_csr_index(event)));
513+ if (event->hw.idx != -1)
514+ csr_write(CSR_SCOUNTEREN,
515+ csr_read(CSR_SCOUNTEREN) | (1 << pmu_sbi_csr_index(event)));
515516 }
516517
517518 static void pmu_sbi_reset_scounteren(void *arg)
518519 {
519520 struct perf_event *event = (struct perf_event *)arg;
520521
521− csr_write(CSR_SCOUNTEREN,
522− csr_read(CSR_SCOUNTEREN) & ~(1 << pmu_sbi_csr_index(event)));
522+ if (event->hw.idx != -1)
523+ csr_write(CSR_SCOUNTEREN,
524+ csr_read(CSR_SCOUNTEREN) & ~(1 << pmu_sbi_csr_index(event)));
523525 }
524526
525527 static void pmu_sbi_ctr_start(struct perf_event *event, u64 ival)
@@ -541,7 +543,8 @@ static void pmu_sbi_ctr_start(struct perf_event *event, u64 ival) · 15 unmodified lines
541543
542544 if ((hwc->flags & PERF_EVENT_FLAG_USER_ACCESS) &&
543545 (hwc->flags & PERF_EVENT_FLAG_USER_READ_CNT))
544− pmu_sbi_set_scounteren((void *)event);
546+ on_each_cpu_mask(mm_cpumask(event->owner->mm),
547+ pmu_sbi_set_scounteren, (void *)event, 1);
545548 }
546549
547550 static void pmu_sbi_ctr_stop(struct perf_event *event, unsigned long flag)
@@ -551,7 +554,8 @@ static void pmu_sbi_ctr_stop(struct perf_event *event, unsigned long flag) · 3 unmodified lines
551554
552555 if ((hwc->flags & PERF_EVENT_FLAG_USER_ACCESS) &&
553556 (hwc->flags & PERF_EVENT_FLAG_USER_READ_CNT))
554− pmu_sbi_reset_scounteren((void *)event);
557+ on_each_cpu_mask(mm_cpumask(event->owner->mm),
558+ pmu_sbi_reset_scounteren, (void *)event, 1);
555559
556560 ret = sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP, hwc->idx, 1, flag, 0, 0, 0);
557561 if (ret.error && (ret.error != SBI_ERR_ALREADY_STOPPED) &&
drivers/phy/freescale/phy-fsl-lynx-28g.c+24−3
@@ -127,6 +127,10 @@ struct lynx_28g_lane { · 126 unmodified lines
127127 struct lynx_28g_priv {
128128 void __iomem *base;
129129 struct device *dev;
130+ /* Serialize concurrent access to registers shared between lanes,
131+ * like PCCn
132+ */
133+ spinlock_t pcc_lock;
130134 struct lynx_28g_pll pll[LYNX_28G_NUM_PLL];
131135 struct lynx_28g_lane lane[LYNX_28G_NUM_LANE];
132136
@@ -397,6 +401,8 @@ static int lynx_28g_set_mode(struct phy *phy, enum phy_mode mode, int submode) · 264 unmodified lines
397401 if (powered_up)
398402 lynx_28g_power_off(phy);
399403
404+ spin_lock(&priv->pcc_lock);
405+
400406 switch (submode) {
401407 case PHY_INTERFACE_MODE_SGMII:
402408 case PHY_INTERFACE_MODE_1000BASEX:
@@ -413,6 +419,8 @@ static int lynx_28g_set_mode(struct phy *phy, enum phy_mode mode, int submode) · 10 unmodified lines
413419 lane->interface = submode;
414420
415421 out:
422+ spin_unlock(&priv->pcc_lock);
423+
416424 /* Power up the lane if necessary */
417425 if (powered_up)
418426 lynx_28g_power_on(phy);
@@ -508,11 +516,12 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work) · 89 unmodified lines
508516 for (i = 0; i < LYNX_28G_NUM_LANE; i++) {
509517 lane = &priv->lane[i];
510518
511− if (!lane->init)
512− continue;
519+ mutex_lock(&lane->phy->mutex);
513520
514− if (!lane->powered_up)
521+ if (!lane->init || !lane->powered_up) {
522+ mutex_unlock(&lane->phy->mutex);
515523 continue;
524+ }
516525
517526 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL);
518527 if (!(rrstctl & LYNX_28G_LNaRRSTCTL_CDR_LOCK)) {
@@ -521,6 +530,8 @@ static void lynx_28g_cdr_lock_check(struct work_struct *work) · 2 unmodified lines
521530 rrstctl = lynx_28g_lane_read(lane, LNaRRSTCTL);
522531 } while (!(rrstctl & LYNX_28G_LNaRRSTCTL_RST_DONE));
523532 }
533+
534+ mutex_unlock(&lane->phy->mutex);
524535 }
525536 queue_delayed_work(system_power_efficient_wq, &priv->cdr_check,
526537 msecs_to_jiffies(1000));
@@ -593,6 +604,7 @@ static int lynx_28g_probe(struct platform_device *pdev) · 66 unmodified lines
593604
594605 dev_set_drvdata(dev, priv);
595606
607+ spin_lock_init(&priv->pcc_lock);
596608 INIT_DELAYED_WORK(&priv->cdr_check, lynx_28g_cdr_lock_check);
597609
598610 queue_delayed_work(system_power_efficient_wq, &priv->cdr_check,
@@ -604,6 +616,14 @@ static int lynx_28g_probe(struct platform_device *pdev) · 5 unmodified lines
604616 return PTR_ERR_OR_ZERO(provider);
605617 }
606618
619+static void lynx_28g_remove(struct platform_device *pdev)
620+{
621+ struct device *dev = &pdev->dev;
622+ struct lynx_28g_priv *priv = dev_get_drvdata(dev);
623+
624+ cancel_delayed_work_sync(&priv->cdr_check);
625+}
626+
607627 static const struct of_device_id lynx_28g_of_match_table[] = {
608628 { .compatible = "fsl,lynx-28g" },
609629 { },
@@ -612,6 +632,7 @@ MODULE_DEVICE_TABLE(of, lynx_28g_of_match_table); · 2 unmodified lines
612632
613633 static struct platform_driver lynx_28g_driver = {
614634 .probe = lynx_28g_probe,
635+ .remove_new = lynx_28g_remove,
615636 .driver = {
616637 .name = "lynx-28g",
617638 .of_match_table = lynx_28g_of_match_table,
drivers/pinctrl/core.c+9−7
@@ -1022,17 +1022,20 @@ static int add_setting(struct pinctrl *p, struct pinctrl_dev *pctldev, · 1021 unmodified lines
10221022
10231023 static struct pinctrl *find_pinctrl(struct device *dev)
10241024 {
1025− struct pinctrl *p;
1025+ struct pinctrl *entry, *p = NULL;
10261026
10271027 mutex_lock(&pinctrl_list_mutex);
1028− list_for_each_entry(p, &pinctrl_list, node)
1029− if (p->dev == dev) {
1030− mutex_unlock(&pinctrl_list_mutex);
1031− return p;
1028+
1029+ list_for_each_entry(entry, &pinctrl_list, node) {
1030+ if (entry->dev == dev) {
1031+ p = entry;
1032+ kref_get(&p->users);
1033+ break;
10321034 }
1035+ }
10331036
10341037 mutex_unlock(&pinctrl_list_mutex);
1035− return NULL;
1038+ return p;
10361039 }
10371040
10381041 static void pinctrl_free(struct pinctrl *p, bool inlist);
@@ -1140,7 +1143,6 @@ struct pinctrl *pinctrl_get(struct device *dev) · 101 unmodified lines
11401143 p = find_pinctrl(dev);
11411144 if (p) {
11421145 dev_dbg(dev, "obtain a copy of previously claimed pinctrl\n");
1143− kref_get(&p->users);
11441146 return p;
11451147 }
11461148
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c+3−3
@@ -1062,13 +1062,13 @@ static int wpcm450_gpio_register(struct platform_device *pdev, · 1061 unmodified lines
10621062 if (ret < 0)
10631063 return ret;
10641064
1065− gpio = &pctrl->gpio_bank[reg];
1066− gpio->pctrl = pctrl;
1067−
10681065 if (reg >= WPCM450_NUM_BANKS)
10691066 return dev_err_probe(dev, -EINVAL,
10701067 "GPIO index %d out of range!\n", reg);
10711068
1069+ gpio = &pctrl->gpio_bank[reg];
1070+ gpio->pctrl = pctrl;
1071+
10721072 bank = &wpcm450_banks[reg];
10731073 gpio->bank = bank;
10741074
drivers/pinctrl/pinctrl-lantiq.h+0−1
@@ -198,5 +198,4 @@ enum ltq_pin { · 197 unmodified lines
198198
199199 extern int ltq_pinctrl_register(struct platform_device *pdev,
200200 struct ltq_pinmux_info *info);
201−extern int ltq_pinctrl_unregister(struct platform_device *pdev);
202201 #endif /* __PINCTRL_LANTIQ_H */
drivers/pinctrl/renesas/Kconfig+1−0
@@ -235,6 +235,7 @@ config PINCTRL_RZN1 · 234 unmodified lines
235235 depends on OF
236236 depends on ARCH_RZN1 || COMPILE_TEST
237237 select GENERIC_PINCONF
238+ select PINMUX
238239 help
239240 This selects pinctrl driver for Renesas RZ/N1 devices.
240241
drivers/pinctrl/starfive/pinctrl-starfive-jh7110-aon.c+4−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #define JH7110_AON_NGPIO 4
3232 #define JH7110_AON_GC_BASE 64
3333
34+#define JH7110_AON_REGS_NUM 37
35+
3436 /* registers */
3537 #define JH7110_AON_DOEN 0x0
3638 #define JH7110_AON_DOUT 0x4
@@ -145,6 +147,7 @@ static const struct jh7110_pinctrl_soc_info jh7110_aon_pinctrl_info = { · 108 unmodified lines
145147 .gpi_mask = GENMASK(3, 0),
146148 .gpioin_reg_base = JH7110_AON_GPIOIN,
147149 .irq_reg = &jh7110_aon_irq_reg,
150+ .nsaved_regs = JH7110_AON_REGS_NUM,
148151 .jh7110_set_one_pin_mux = jh7110_aon_set_one_pin_mux,
149152 .jh7110_get_padcfg_base = jh7110_aon_get_padcfg_base,
150153 .jh7110_gpio_irq_handler = jh7110_aon_irq_handler,
@@ -165,6 +168,7 @@ static struct platform_driver jh7110_aon_pinctrl_driver = { · 14 unmodified lines
165168 .driver = {
166169 .name = "starfive-jh7110-aon-pinctrl",
167170 .of_match_table = jh7110_aon_pinctrl_of_match,
171+ .pm = pm_sleep_ptr(&jh7110_pinctrl_pm_ops),
168172 },
169173 };
170174 module_platform_driver(jh7110_aon_pinctrl_driver);
drivers/pinctrl/starfive/pinctrl-starfive-jh7110-sys.c+4−0
@@ -31,6 +31,8 @@ · 30 unmodified lines
3131 #define JH7110_SYS_NGPIO 64
3232 #define JH7110_SYS_GC_BASE 0
3333
34+#define JH7110_SYS_REGS_NUM 174
35+
3436 /* registers */
3537 #define JH7110_SYS_DOEN 0x000
3638 #define JH7110_SYS_DOUT 0x040
@@ -417,6 +419,7 @@ static const struct jh7110_pinctrl_soc_info jh7110_sys_pinctrl_info = { · 380 unmodified lines
417419 .gpi_mask = GENMASK(6, 0),
418420 .gpioin_reg_base = JH7110_SYS_GPIOIN,
419421 .irq_reg = &jh7110_sys_irq_reg,
422+ .nsaved_regs = JH7110_SYS_REGS_NUM,
420423 .jh7110_set_one_pin_mux = jh7110_sys_set_one_pin_mux,
421424 .jh7110_get_padcfg_base = jh7110_sys_get_padcfg_base,
422425 .jh7110_gpio_irq_handler = jh7110_sys_irq_handler,
@@ -437,6 +440,7 @@ static struct platform_driver jh7110_sys_pinctrl_driver = { · 14 unmodified lines
437440 .driver = {
438441 .name = "starfive-jh7110-sys-pinctrl",
439442 .of_match_table = jh7110_sys_pinctrl_of_match,
443+ .pm = pm_sleep_ptr(&jh7110_pinctrl_pm_ops),
440444 },
441445 };
442446 module_platform_driver(jh7110_sys_pinctrl_driver);
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c+40−2
@@ -872,6 +872,13 @@ int jh7110_pinctrl_probe(struct platform_device *pdev) · 871 unmodified lines
872872 if (!sfp)
873873 return -ENOMEM;
874874
875+#if IS_ENABLED(CONFIG_PM_SLEEP)
876+ sfp->saved_regs = devm_kcalloc(dev, info->nsaved_regs,
877+ sizeof(*sfp->saved_regs), GFP_KERNEL);
878+ if (!sfp->saved_regs)
879+ return -ENOMEM;
880+#endif
881+
875882 sfp->base = devm_platform_ioremap_resource(pdev, 0);
876883 if (IS_ERR(sfp->base))
877884 return PTR_ERR(sfp->base);
@@ -967,14 +974,45 @@ int jh7110_pinctrl_probe(struct platform_device *pdev) · 89 unmodified lines
967974 if (ret)
968975 return dev_err_probe(dev, ret, "could not register gpiochip\n");
969976
970− irq_domain_set_pm_device(sfp->gc.irq.domain, dev);
971−
972977 dev_info(dev, "StarFive GPIO chip registered %d GPIOs\n", sfp->gc.ngpio);
973978
974979 return pinctrl_enable(sfp->pctl);
975980 }
976981 EXPORT_SYMBOL_GPL(jh7110_pinctrl_probe);
977982
983+static int jh7110_pinctrl_suspend(struct device *dev)
984+{
985+ struct jh7110_pinctrl *sfp = dev_get_drvdata(dev);
986+ unsigned long flags;
987+ unsigned int i;
988+
989+ raw_spin_lock_irqsave(&sfp->lock, flags);
990+ for (i = 0 ; i < sfp->info->nsaved_regs ; i++)
991+ sfp->saved_regs[i] = readl_relaxed(sfp->base + 4 * i);
992+
993+ raw_spin_unlock_irqrestore(&sfp->lock, flags);
994+ return 0;
995+}
996+
997+static int jh7110_pinctrl_resume(struct device *dev)
998+{
999+ struct jh7110_pinctrl *sfp = dev_get_drvdata(dev);
1000+ unsigned long flags;
1001+ unsigned int i;
1002+
1003+ raw_spin_lock_irqsave(&sfp->lock, flags);
1004+ for (i = 0 ; i < sfp->info->nsaved_regs ; i++)
1005+ writel_relaxed(sfp->saved_regs[i], sfp->base + 4 * i);
1006+
1007+ raw_spin_unlock_irqrestore(&sfp->lock, flags);
1008+ return 0;
1009+}
1010+
1011+const struct dev_pm_ops jh7110_pinctrl_pm_ops = {
1012+ LATE_SYSTEM_SLEEP_PM_OPS(jh7110_pinctrl_suspend, jh7110_pinctrl_resume)
1013+};
1014+EXPORT_SYMBOL_GPL(jh7110_pinctrl_pm_ops);
1015+
9781016 MODULE_DESCRIPTION("Pinctrl driver for the StarFive JH7110 SoC");
9791017 MODULE_AUTHOR("Emil Renner Berthing <kernel@esmil.dk>");
9801018 MODULE_AUTHOR("Jianlong Huang <jianlong.huang@starfivetech.com>");
drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h+4−0
@@ -21,6 +21,7 @@ struct jh7110_pinctrl { · 20 unmodified lines
2121 /* register read/write mutex */
2222 struct mutex mutex;
2323 const struct jh7110_pinctrl_soc_info *info;
24+ u32 *saved_regs;
2425 };
2526
2627 struct jh7110_gpio_irq_reg {
@@ -50,6 +51,8 @@ struct jh7110_pinctrl_soc_info { · 23 unmodified lines
5051
5152 const struct jh7110_gpio_irq_reg *irq_reg;
5253
54+ unsigned int nsaved_regs;
55+
5356 /* generic pinmux */
5457 int (*jh7110_set_one_pin_mux)(struct jh7110_pinctrl *sfp,
5558 unsigned int pin,
@@ -66,5 +69,6 @@ void jh7110_set_gpiomux(struct jh7110_pinctrl *sfp, unsigned int pin, · 10 unmodified lines
6669 unsigned int din, u32 dout, u32 doen);
6770 int jh7110_pinctrl_probe(struct platform_device *pdev);
6871 struct jh7110_pinctrl *jh7110_from_irq_desc(struct irq_desc *desc);
72+extern const struct dev_pm_ops jh7110_pinctrl_pm_ops;
6973
7074 #endif /* __PINCTRL_STARFIVE_JH7110_H__ */
drivers/pinctrl/tegra/pinctrl-tegra.c+2−17
@@ -96,7 +96,6 @@ static const struct cfg_param { · 95 unmodified lines
9696 {"nvidia,slew-rate-falling", TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING},
9797 {"nvidia,slew-rate-rising", TEGRA_PINCONF_PARAM_SLEW_RATE_RISING},
9898 {"nvidia,drive-type", TEGRA_PINCONF_PARAM_DRIVE_TYPE},
99− {"nvidia,function", TEGRA_PINCONF_PARAM_FUNCTION},
10099 };
101100
102101 static int tegra_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
@@ -471,12 +470,6 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx, · 368 unmodified lines
471470 *bit = g->drvtype_bit;
472471 *width = 2;
473472 break;
474− case TEGRA_PINCONF_PARAM_FUNCTION:
475− *bank = g->mux_bank;
476− *reg = g->mux_reg;
477− *bit = g->mux_bit;
478− *width = 2;
479− break;
480473 default:
481474 dev_err(pmx->dev, "Invalid config param %04x\n", param);
482475 return -ENOTSUPP;
@@ -640,16 +633,8 @@ static void tegra_pinconf_group_dbg_show(struct pinctrl_dev *pctldev, · 157 unmodified lines
640633 val >>= bit;
641634 val &= (1 << width) - 1;
642635
643− if (cfg_params[i].param == TEGRA_PINCONF_PARAM_FUNCTION) {
644− u8 idx = pmx->soc->groups[group].funcs[val];
645−
646− seq_printf(s, "\n\t%s=%s",
647− strip_prefix(cfg_params[i].property),
648− pmx->functions[idx].name);
649− } else {
650− seq_printf(s, "\n\t%s=%u",
651− strip_prefix(cfg_params[i].property), val);
652− }
636+ seq_printf(s, "\n\t%s=%u",
637+ strip_prefix(cfg_params[i].property), val);
653638 }
654639 }
655640
drivers/pinctrl/tegra/pinctrl-tegra.h+0−2
@@ -54,8 +54,6 @@ enum tegra_pinconf_param { · 53 unmodified lines
5454 TEGRA_PINCONF_PARAM_SLEW_RATE_RISING,
5555 /* argument: Integer, range is HW-dependant */
5656 TEGRA_PINCONF_PARAM_DRIVE_TYPE,
57− /* argument: pinmux settings */
58− TEGRA_PINCONF_PARAM_FUNCTION,
5957 };
6058
6159 enum tegra_pinconf_pull {
drivers/platform/mellanox/mlxbf-tmfifo.c+8−6
@@ -53,7 +53,7 @@ · 52 unmodified lines
5353 struct mlxbf_tmfifo;
5454
5555 /**
56− * mlxbf_tmfifo_vring - Structure of the TmFifo virtual ring
56+ * struct mlxbf_tmfifo_vring - Structure of the TmFifo virtual ring
5757 * @va: virtual address of the ring
5858 * @dma: dma address of the ring
5959 * @vq: pointer to the virtio virtqueue
@@ -113,12 +113,13 @@ enum { · 53 unmodified lines
113113 };
114114
115115 /**
116− * mlxbf_tmfifo_vdev - Structure of the TmFifo virtual device
116+ * struct mlxbf_tmfifo_vdev - Structure of the TmFifo virtual device
117117 * @vdev: virtio device, in which the vdev.id.device field has the
118118 * VIRTIO_ID_xxx id to distinguish the virtual device.
119119 * @status: status of the device
120120 * @features: supported features of the device
121121 * @vrings: array of tmfifo vrings of this device
122+ * @config: non-anonymous union for cons and net
122123 * @config.cons: virtual console config -
123124 * select if vdev.id.device is VIRTIO_ID_CONSOLE
124125 * @config.net: virtual network config -
@@ -138,7 +139,7 @@ struct mlxbf_tmfifo_vdev { · 13 unmodified lines
138139 };
139140
140141 /**
141− * mlxbf_tmfifo_irq_info - Structure of the interrupt information
142+ * struct mlxbf_tmfifo_irq_info - Structure of the interrupt information
142143 * @fifo: pointer to the tmfifo structure
143144 * @irq: interrupt number
144145 * @index: index into the interrupt array
@@ -150,7 +151,7 @@ struct mlxbf_tmfifo_irq_info { · 5 unmodified lines
150151 };
151152
152153 /**
153− * mlxbf_tmfifo_io - Structure of the TmFifo IO resource (for both rx & tx)
154+ * struct mlxbf_tmfifo_io - Structure of the TmFifo IO resource (for both rx & tx)
154155 * @ctl: control register offset (TMFIFO_RX_CTL / TMFIFO_TX_CTL)
155156 * @sts: status register offset (TMFIFO_RX_STS / TMFIFO_TX_STS)
156157 * @data: data register offset (TMFIFO_RX_DATA / TMFIFO_TX_DATA)
@@ -162,7 +163,7 @@ struct mlxbf_tmfifo_io { · 5 unmodified lines
162163 };
163164
164165 /**
165− * mlxbf_tmfifo - Structure of the TmFifo
166+ * struct mlxbf_tmfifo - Structure of the TmFifo
166167 * @vdev: array of the virtual devices running over the TmFifo
167168 * @lock: lock to protect the TmFifo access
168169 * @res0: mapped resource block 0
@@ -198,7 +199,7 @@ struct mlxbf_tmfifo { · 29 unmodified lines
198199 };
199200
200201 /**
201− * mlxbf_tmfifo_msg_hdr - Structure of the TmFifo message header
202+ * struct mlxbf_tmfifo_msg_hdr - Structure of the TmFifo message header
202203 * @type: message type
203204 * @len: payload length in network byte order. Messages sent into the FIFO
204205 * will be read by the other side as data stream in the same byte order.
@@ -208,6 +209,7 @@ struct mlxbf_tmfifo { · 3 unmodified lines
208209 struct mlxbf_tmfifo_msg_hdr {
209210 u8 type;
210211 __be16 len;
212+ /* private: */
211213 u8 unused[5];
212214 } __packed __aligned(sizeof(u64));
213215
drivers/platform/x86/hp/hp-bioscfg/bioscfg.c+10−4
@@ -659,7 +659,7 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type, · 658 unmodified lines
659659 const char *guid, int min_elements,
660660 int instance_id)
661661 {
662− struct kobject *attr_name_kobj;
662+ struct kobject *attr_name_kobj, *duplicate;
663663 union acpi_object *elements;
664664 struct kset *temp_kset;
665665
@@ -704,8 +704,11 @@ static int hp_init_bios_package_attribute(enum hp_wmi_data_type attr_type, · 38 unmodified lines
704704 }
705705
706706 /* All duplicate attributes found are ignored */
707− if (kset_find_obj(temp_kset, str_value)) {
707+ duplicate = kset_find_obj(temp_kset, str_value);
708+ if (duplicate) {
708709 pr_debug("Duplicate attribute name found - %s\n", str_value);
710+ /* kset_find_obj() returns a reference */
711+ kobject_put(duplicate);
709712 goto pack_attr_exit;
710713 }
711714
@@ -768,7 +771,7 @@ static int hp_init_bios_buffer_attribute(enum hp_wmi_data_type attr_type, · 56 unmodified lines
768771 const char *guid, int min_elements,
769772 int instance_id)
770773 {
771− struct kobject *attr_name_kobj;
774+ struct kobject *attr_name_kobj, *duplicate;
772775 struct kset *temp_kset;
773776 char str[MAX_BUFF_SIZE];
774777
@@ -794,8 +797,11 @@ static int hp_init_bios_buffer_attribute(enum hp_wmi_data_type attr_type, · 19 unmodified lines
794797 temp_kset = bioscfg_drv.main_dir_kset;
795798
796799 /* All duplicate attributes found are ignored */
797− if (kset_find_obj(temp_kset, str)) {
800+ duplicate = kset_find_obj(temp_kset, str);
801+ if (duplicate) {
798802 pr_debug("Duplicate attribute name found - %s\n", str);
803+ /* kset_find_obj() returns a reference */
804+ kobject_put(duplicate);
799805 goto buff_attr_exit;
800806 }
801807
drivers/platform/x86/hp/hp-wmi.c+7−1
@@ -1548,7 +1548,13 @@ static const struct dev_pm_ops hp_wmi_pm_ops = { · 1547 unmodified lines
15481548 .restore = hp_wmi_resume_handler,
15491549 };
15501550
1551−static struct platform_driver hp_wmi_driver = {
1551+/*
1552+ * hp_wmi_bios_remove() lives in .exit.text. For drivers registered via
1553+ * module_platform_driver_probe() this is ok because they cannot get unbound at
1554+ * runtime. So mark the driver struct with __refdata to prevent modpost
1555+ * triggering a section mismatch warning.
1556+ */
1557+static struct platform_driver hp_wmi_driver __refdata = {
15521558 .driver = {
15531559 .name = "hp-wmi",
15541560 .pm = &hp_wmi_pm_ops,
drivers/platform/x86/intel/ifs/runtest.c+4−3
@@ -331,14 +331,15 @@ int do_core_test(int cpu, struct device *dev) · 330 unmodified lines
331331 switch (test->test_num) {
332332 case IFS_TYPE_SAF:
333333 if (!ifsd->loaded)
334− return -EPERM;
335− ifs_test_core(cpu, dev);
334+ ret = -EPERM;
335+ else
336+ ifs_test_core(cpu, dev);
336337 break;
337338 case IFS_TYPE_ARRAY_BIST:
338339 ifs_array_test_core(cpu, dev);
339340 break;
340341 default:
341− return -EINVAL;
342+ ret = -EINVAL;
342343 }
343344 out:
344345 cpus_read_unlock();
drivers/platform/x86/think-lmi.c+20−4
@@ -1248,6 +1248,24 @@ static void tlmi_release_attr(void) · 1247 unmodified lines
12481248 kset_unregister(tlmi_priv.authentication_kset);
12491249 }
12501250
1251+static int tlmi_validate_setting_name(struct kset *attribute_kset, char *name)
1252+{
1253+ struct kobject *duplicate;
1254+
1255+ if (!strcmp(name, "Reserved"))
1256+ return -EINVAL;
1257+
1258+ duplicate = kset_find_obj(attribute_kset, name);
1259+ if (duplicate) {
1260+ pr_debug("Duplicate attribute name found - %s\n", name);
1261+ /* kset_find_obj() returns a reference */
1262+ kobject_put(duplicate);
1263+ return -EBUSY;
1264+ }
1265+
1266+ return 0;
1267+}
1268+
12511269 static int tlmi_sysfs_init(void)
12521270 {
12531271 int i, ret;
@@ -1276,10 +1294,8 @@ static int tlmi_sysfs_init(void) · 22 unmodified lines
12761294 continue;
12771295
12781296 /* check for duplicate or reserved values */
1279− if (kset_find_obj(tlmi_priv.attribute_kset, tlmi_priv.setting[i]->display_name) ||
1280− !strcmp(tlmi_priv.setting[i]->display_name, "Reserved")) {
1281− pr_debug("duplicate or reserved attribute name found - %s\n",
1282− tlmi_priv.setting[i]->display_name);
1297+ if (tlmi_validate_setting_name(tlmi_priv.attribute_kset,
1298+ tlmi_priv.setting[i]->display_name) < 0) {
12831299 kfree(tlmi_priv.setting[i]->possible_values);
12841300 kfree(tlmi_priv.setting[i]);
12851301 tlmi_priv.setting[i] = NULL;
drivers/platform/x86/touchscreen_dmi.c+45−0
@@ -42,6 +42,21 @@ static const struct ts_dmi_data archos_101_cesium_educ_data = { · 41 unmodified lines
4242 .properties = archos_101_cesium_educ_props,
4343 };
4444
45+static const struct property_entry bush_bush_windows_tablet_props[] = {
46+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1850),
47+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
48+ PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
49+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
50+ PROPERTY_ENTRY_BOOL("silead,home-button"),
51+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-bush-bush-windows-tablet.fw"),
52+ { }
53+};
54+
55+static const struct ts_dmi_data bush_bush_windows_tablet_data = {
56+ .acpi_name = "MSSL1680:00",
57+ .properties = bush_bush_windows_tablet_props,
58+};
59+
4560 static const struct property_entry chuwi_hi8_props[] = {
4661 PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
4762 PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
@@ -756,6 +771,21 @@ static const struct ts_dmi_data pipo_w11_data = { · 708 unmodified lines
756771 .properties = pipo_w11_props,
757772 };
758773
774+static const struct property_entry positivo_c4128b_props[] = {
775+ PROPERTY_ENTRY_U32("touchscreen-min-x", 4),
776+ PROPERTY_ENTRY_U32("touchscreen-min-y", 13),
777+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1915),
778+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1269),
779+ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-positivo-c4128b.fw"),
780+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
781+ { }
782+};
783+
784+static const struct ts_dmi_data positivo_c4128b_data = {
785+ .acpi_name = "MSSL1680:00",
786+ .properties = positivo_c4128b_props,
787+};
788+
759789 static const struct property_entry pov_mobii_wintab_p800w_v20_props[] = {
760790 PROPERTY_ENTRY_U32("touchscreen-min-x", 32),
761791 PROPERTY_ENTRY_U32("touchscreen-min-y", 16),
@@ -1070,6 +1100,13 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 308 unmodified lines
10701100 DMI_MATCH(DMI_PRODUCT_NAME, "ARCHOS 101 Cesium Educ"),
10711101 },
10721102 },
1103+ {
1104+ /* Bush Windows tablet */
1105+ .driver_data = (void *)&bush_bush_windows_tablet_data,
1106+ .matches = {
1107+ DMI_MATCH(DMI_PRODUCT_NAME, "Bush Windows tablet"),
1108+ },
1109+ },
10731110 {
10741111 /* Chuwi Hi8 */
10751112 .driver_data = (void *)&chuwi_hi8_data,
@@ -1480,6 +1517,14 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 404 unmodified lines
14801517 DMI_MATCH(DMI_BIOS_VERSION, "MOMO.G.WI71C.MABMRBA02"),
14811518 },
14821519 },
1520+ {
1521+ /* Positivo C4128B */
1522+ .driver_data = (void *)&positivo_c4128b_data,
1523+ .matches = {
1524+ DMI_MATCH(DMI_SYS_VENDOR, "Positivo Tecnologia SA"),
1525+ DMI_MATCH(DMI_PRODUCT_NAME, "C4128B-1"),
1526+ },
1527+ },
14831528 {
14841529 /* Point of View mobii wintab p800w (v2.0) */
14851530 .driver_data = (void *)&pov_mobii_wintab_p800w_v20_data,
drivers/pmdomain/imx/scu-pd.c+2−1
@@ -150,7 +150,8 @@ static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = { · 149 unmodified lines
150150 { "mclk-out-1", IMX_SC_R_MCLK_OUT_1, 1, false, 0 },
151151 { "dma0-ch", IMX_SC_R_DMA_0_CH0, 32, true, 0 },
152152 { "dma1-ch", IMX_SC_R_DMA_1_CH0, 16, true, 0 },
153− { "dma2-ch", IMX_SC_R_DMA_2_CH0, 32, true, 0 },
153+ { "dma2-ch-0", IMX_SC_R_DMA_2_CH0, 5, true, 0 },
154+ { "dma2-ch-1", IMX_SC_R_DMA_2_CH5, 27, true, 0 },
154155 { "dma3-ch", IMX_SC_R_DMA_3_CH0, 32, true, 0 },
155156 { "asrc0", IMX_SC_R_ASRC_0, 1, false, 0 },
156157 { "asrc1", IMX_SC_R_ASRC_1, 1, false, 0 },
drivers/power/supply/qcom_battmgr.c+4−4
@@ -105,7 +105,7 @@ struct qcom_battmgr_property_request { · 104 unmodified lines
105105
106106 struct qcom_battmgr_update_request {
107107 struct pmic_glink_hdr hdr;
108− u32 battery_id;
108+ __le32 battery_id;
109109 };
110110
111111 struct qcom_battmgr_charge_time_request {
@@ -1282,9 +1282,9 @@ static void qcom_battmgr_enable_worker(struct work_struct *work) · 1170 unmodified lines
12821282 {
12831283 struct qcom_battmgr *battmgr = container_of(work, struct qcom_battmgr, enable_work);
12841284 struct qcom_battmgr_enable_request req = {
1285− .hdr.owner = PMIC_GLINK_OWNER_BATTMGR,
1286− .hdr.type = PMIC_GLINK_NOTIFY,
1287− .hdr.opcode = BATTMGR_REQUEST_NOTIFICATION,
1285+ .hdr.owner = cpu_to_le32(PMIC_GLINK_OWNER_BATTMGR),
1286+ .hdr.type = cpu_to_le32(PMIC_GLINK_NOTIFY),
1287+ .hdr.opcode = cpu_to_le32(BATTMGR_REQUEST_NOTIFICATION),
12881288 };
12891289 int ret;
12901290
drivers/ptp/ptp_ocp.c+0−1
@@ -3998,7 +3998,6 @@ ptp_ocp_device_init(struct ptp_ocp *bp, struct pci_dev *pdev) · 3997 unmodified lines
39983998 return 0;
39993999
40004000 out:
4001− ptp_ocp_dev_release(&bp->dev);
40024001 put_device(&bp->dev);
40034002 return err;
40044003 }
drivers/regulator/core.c+3−7
@@ -5542,6 +5542,8 @@ regulator_register(struct device *dev, · 5541 unmodified lines
55425542 goto rinse;
55435543 }
55445544 device_initialize(&rdev->dev);
5545+ dev_set_drvdata(&rdev->dev, rdev);
5546+ rdev->dev.class = &regulator_class;
55455547 spin_lock_init(&rdev->err_lock);
55465548
55475549 /*
@@ -5603,11 +5605,9 @@ regulator_register(struct device *dev, · 55 unmodified lines
56035605 rdev->supply_name = regulator_desc->supply_name;
56045606
56055607 /* register with sysfs */
5606− rdev->dev.class = &regulator_class;
56075608 rdev->dev.parent = config->dev;
56085609 dev_set_name(&rdev->dev, "regulator.%lu",
56095610 (unsigned long) atomic_inc_return(&regulator_no));
5610− dev_set_drvdata(&rdev->dev, rdev);
56115611
56125612 /* set regulator constraints */
56135613 if (init_data)
@@ -5724,15 +5724,11 @@ wash: · 110 unmodified lines
57245724 mutex_lock(&regulator_list_mutex);
57255725 regulator_ena_gpio_free(rdev);
57265726 mutex_unlock(&regulator_list_mutex);
5727− put_device(&rdev->dev);
5728− rdev = NULL;
57295727 clean:
57305728 if (dangling_of_gpiod)
57315729 gpiod_put(config->ena_gpiod);
5732− if (rdev && rdev->dev.of_node)
5733− of_node_put(rdev->dev.of_node);
5734− kfree(rdev);
57355730 kfree(config);
5731+ put_device(&rdev->dev);
57365732 rinse:
57375733 if (dangling_cfg_gpiod)
57385734 gpiod_put(cfg->ena_gpiod);
drivers/regulator/mt6358-regulator.c+15−3
@@ -43,7 +43,7 @@ struct mt6358_regulator_info { · 42 unmodified lines
4343 .desc = { \
4444 .name = #vreg, \
4545 .of_match = of_match_ptr(match), \
46− .ops = &mt6358_volt_range_ops, \
46+ .ops = &mt6358_buck_ops, \
4747 .type = REGULATOR_VOLTAGE, \
4848 .id = MT6358_ID_##vreg, \
4949 .owner = THIS_MODULE, \
@@ -139,7 +139,7 @@ struct mt6358_regulator_info { · 89 unmodified lines
139139 .desc = { \
140140 .name = #vreg, \
141141 .of_match = of_match_ptr(match), \
142− .ops = &mt6358_volt_range_ops, \
142+ .ops = &mt6358_buck_ops, \
143143 .type = REGULATOR_VOLTAGE, \
144144 .id = MT6366_ID_##vreg, \
145145 .owner = THIS_MODULE, \
@@ -450,7 +450,7 @@ static unsigned int mt6358_regulator_get_mode(struct regulator_dev *rdev) · 304 unmodified lines
450450 }
451451 }
452452
453−static const struct regulator_ops mt6358_volt_range_ops = {
453+static const struct regulator_ops mt6358_buck_ops = {
454454 .list_voltage = regulator_list_voltage_linear,
455455 .map_voltage = regulator_map_voltage_linear,
456456 .set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -464,6 +464,18 @@ static const struct regulator_ops mt6358_volt_range_ops = { · 7 unmodified lines
464464 .get_mode = mt6358_regulator_get_mode,
465465 };
466466
467+static const struct regulator_ops mt6358_volt_range_ops = {
468+ .list_voltage = regulator_list_voltage_linear,
469+ .map_voltage = regulator_map_voltage_linear,
470+ .set_voltage_sel = regulator_set_voltage_sel_regmap,
471+ .get_voltage_sel = mt6358_get_buck_voltage_sel,
472+ .set_voltage_time_sel = regulator_set_voltage_time_sel,
473+ .enable = regulator_enable_regmap,
474+ .disable = regulator_disable_regmap,
475+ .is_enabled = regulator_is_enabled_regmap,
476+ .get_status = mt6358_get_status,
477+};
478+
467479 static const struct regulator_ops mt6358_volt_table_ops = {
468480 .list_voltage = regulator_list_voltage_table,
469481 .map_voltage = regulator_map_voltage_iterate,
drivers/s390/net/Kconfig+1−1
@@ -102,7 +102,7 @@ config CCWGROUP · 101 unmodified lines
102102
103103 config ISM
104104 tristate "Support for ISM vPCI Adapter"
105− depends on PCI && SMC
105+ depends on PCI
106106 default n
107107 help
108108 Select this option if you want to use the Internal Shared Memory
drivers/s390/scsi/zfcp_aux.c+5−4
@@ -518,12 +518,12 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, · 517 unmodified lines
518518 if (port) {
519519 put_device(&port->dev);
520520 retval = -EEXIST;
521− goto err_out;
521+ goto err_put;
522522 }
523523
524524 port = kzalloc(sizeof(struct zfcp_port), GFP_KERNEL);
525525 if (!port)
526− goto err_out;
526+ goto err_put;
527527
528528 rwlock_init(&port->unit_list_lock);
529529 INIT_LIST_HEAD(&port->unit_list);
@@ -546,7 +546,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, · 16 unmodified lines
546546
547547 if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) {
548548 kfree(port);
549− goto err_out;
549+ goto err_put;
550550 }
551551 retval = -EINVAL;
552552
@@ -563,7 +563,8 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, · 10 unmodified lines
563563
564564 return port;
565565
566−err_out:
566+err_put:
567567 zfcp_ccw_adapter_put(adapter);
568+err_out:
568569 return ERR_PTR(retval);
569570 }
drivers/scsi/fnic/fnic.h+3−1
@@ -27,7 +27,7 @@ · 26 unmodified lines
2727
2828 #define DRV_NAME "fnic"
2929 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
30−#define DRV_VERSION "1.6.0.56"
30+#define DRV_VERSION "1.6.0.57"
3131 #define PFX DRV_NAME ": "
3232 #define DFX DRV_NAME "%d: "
3333
@@ -237,6 +237,8 @@ struct fnic { · 203 unmodified lines
237237 unsigned int cq_count;
238238
239239 struct mutex sgreset_mutex;
240+ spinlock_t sgreset_lock; /* lock for sgreset */
241+ struct scsi_cmnd *sgreset_sc;
240242 struct dentry *fnic_stats_debugfs_host;
241243 struct dentry *fnic_stats_debugfs_file;
242244 struct dentry *fnic_reset_debugfs_file;
drivers/scsi/fnic/fnic_io.h+2−0
@@ -52,6 +52,8 @@ struct fnic_io_req { · 51 unmodified lines
5252 unsigned long start_time; /* in jiffies */
5353 struct completion *abts_done; /* completion for abts */
5454 struct completion *dr_done; /* completion for device reset */
55+ unsigned int tag;
56+ struct scsi_cmnd *sc; /* midlayer's cmd pointer */
5557 };
5658
5759 enum fnic_port_speeds {
drivers/scsi/fnic/fnic_main.c+2−0
@@ -754,6 +754,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 753 unmodified lines
754754 for (i = 0; i < FNIC_IO_LOCKS; i++)
755755 spin_lock_init(&fnic->io_req_lock[i]);
756756
757+ spin_lock_init(&fnic->sgreset_lock);
758+
757759 err = -ENOMEM;
758760 fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
759761 if (!fnic->io_req_pool)
drivers/scsi/fnic/fnic_scsi.c+47−17
@@ -1047,9 +1047,9 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, · 1046 unmodified lines
10471047 {
10481048 u8 type;
10491049 u8 hdr_status;
1050− struct fcpio_tag tag;
1050+ struct fcpio_tag ftag;
10511051 u32 id;
1052− struct scsi_cmnd *sc;
1052+ struct scsi_cmnd *sc = NULL;
10531053 struct fnic_io_req *io_req;
10541054 struct fnic_stats *fnic_stats = &fnic->fnic_stats;
10551055 struct abort_stats *abts_stats = &fnic->fnic_stats.abts_stats;
@@ -1058,27 +1058,43 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, · 2 unmodified lines
10581058 unsigned long flags;
10591059 spinlock_t *io_lock;
10601060 unsigned long start_time;
1061+ unsigned int tag;
10611062
1062− fcpio_header_dec(&desc->hdr, &type, &hdr_status, &tag);
1063− fcpio_tag_id_dec(&tag, &id);
1063+ fcpio_header_dec(&desc->hdr, &type, &hdr_status, &ftag);
1064+ fcpio_tag_id_dec(&ftag, &id);
10641065
1065− if ((id & FNIC_TAG_MASK) >= fnic->fnic_max_tag_id) {
1066+ tag = id & FNIC_TAG_MASK;
1067+ if (tag == fnic->fnic_max_tag_id) {
1068+ if (!(id & FNIC_TAG_DEV_RST)) {
1069+ shost_printk(KERN_ERR, fnic->lport->host,
1070+ "Tag out of range id 0x%x hdr status = %s\n",
1071+ id, fnic_fcpio_status_to_str(hdr_status));
1072+ return;
1073+ }
1074+ } else if (tag > fnic->fnic_max_tag_id) {
10661075 shost_printk(KERN_ERR, fnic->lport->host,
1067− "Tag out of range tag %x hdr status = %s\n",
1068− id, fnic_fcpio_status_to_str(hdr_status));
1076+ "Tag out of range tag 0x%x hdr status = %s\n",
1077+ tag, fnic_fcpio_status_to_str(hdr_status));
10691078 return;
10701079 }
10711080
1072− sc = scsi_host_find_tag(fnic->lport->host, id & FNIC_TAG_MASK);
1081+ if ((tag == fnic->fnic_max_tag_id) && (id & FNIC_TAG_DEV_RST)) {
1082+ sc = fnic->sgreset_sc;
1083+ io_lock = &fnic->sgreset_lock;
1084+ } else {
1085+ sc = scsi_host_find_tag(fnic->lport->host, id & FNIC_TAG_MASK);
1086+ io_lock = fnic_io_lock_hash(fnic, sc);
1087+ }
1088+
10731089 WARN_ON_ONCE(!sc);
10741090 if (!sc) {
10751091 atomic64_inc(&fnic_stats->io_stats.sc_null);
10761092 shost_printk(KERN_ERR, fnic->lport->host,
10771093 "itmf_cmpl sc is null - hdr status = %s tag = 0x%x\n",
1078− fnic_fcpio_status_to_str(hdr_status), id);
1094+ fnic_fcpio_status_to_str(hdr_status), tag);
10791095 return;
10801096 }
1081− io_lock = fnic_io_lock_hash(fnic, sc);
1097+
10821098 spin_lock_irqsave(io_lock, flags);
10831099 io_req = fnic_priv(sc)->io_req;
10841100 WARN_ON_ONCE(!io_req);
@@ -1089,7 +1105,7 @@ static void fnic_fcpio_itmf_cmpl_handler(struct fnic *fnic, · 4 unmodified lines
10891105 shost_printk(KERN_ERR, fnic->lport->host,
10901106 "itmf_cmpl io_req is null - "
10911107 "hdr status = %s tag = 0x%x sc 0x%p\n",
1092− fnic_fcpio_status_to_str(hdr_status), id, sc);
1108+ fnic_fcpio_status_to_str(hdr_status), tag, sc);
10931109 return;
10941110 }
10951111 start_time = io_req->start_time;
@@ -1938,6 +1954,10 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic, · 842 unmodified lines
19381954 struct scsi_lun fc_lun;
19391955 int ret = 0;
19401956 unsigned long intr_flags;
1957+ unsigned int tag = scsi_cmd_to_rq(sc)->tag;
1958+
1959+ if (tag == SCSI_NO_TAG)
1960+ tag = io_req->tag;
19411961
19421962 spin_lock_irqsave(host->host_lock, intr_flags);
19431963 if (unlikely(fnic_chk_state_flags_locked(fnic,
@@ -1964,7 +1984,8 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic, · 20 unmodified lines
19641984 /* fill in the lun info */
19651985 int_to_scsilun(sc->device->lun, &fc_lun);
19661986
1967− fnic_queue_wq_copy_desc_itmf(wq, scsi_cmd_to_rq(sc)->tag | FNIC_TAG_DEV_RST,
1987+ tag |= FNIC_TAG_DEV_RST;
1988+ fnic_queue_wq_copy_desc_itmf(wq, tag,
19681989 0, FCPIO_ITMF_LUN_RESET, SCSI_NO_TAG,
19691990 fc_lun.scsi_lun, io_req->port_id,
19701991 fnic->config.ra_tov, fnic->config.ed_tov);
@@ -2146,8 +2167,7 @@ static int fnic_clean_pending_aborts(struct fnic *fnic, · 175 unmodified lines
21462167 .ret = SUCCESS,
21472168 };
21482169
2149− if (new_sc)
2150− iter_data.lr_sc = lr_sc;
2170+ iter_data.lr_sc = lr_sc;
21512171
21522172 scsi_host_busy_iter(fnic->lport->host,
21532173 fnic_pending_aborts_iter, &iter_data);
@@ -2230,8 +2250,14 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 76 unmodified lines
22302250 mutex_lock(&fnic->sgreset_mutex);
22312251 tag = fnic->fnic_max_tag_id;
22322252 new_sc = 1;
2233− }
2234− io_lock = fnic_io_lock_hash(fnic, sc);
2253+ fnic->sgreset_sc = sc;
2254+ io_lock = &fnic->sgreset_lock;
2255+ FNIC_SCSI_DBG(KERN_INFO, fnic->lport->host,
2256+ "fcid: 0x%x lun: 0x%llx flags: 0x%x tag: 0x%x Issuing sgreset\n",
2257+ rport->port_id, sc->device->lun, fnic_priv(sc)->flags, tag);
2258+ } else
2259+ io_lock = fnic_io_lock_hash(fnic, sc);
2260+
22352261 spin_lock_irqsave(io_lock, flags);
22362262 io_req = fnic_priv(sc)->io_req;
22372263
@@ -2247,6 +2273,8 @@ int fnic_device_reset(struct scsi_cmnd *sc) · 9 unmodified lines
22472273 }
22482274 memset(io_req, 0, sizeof(*io_req));
22492275 io_req->port_id = rport->port_id;
2276+ io_req->tag = tag;
2277+ io_req->sc = sc;
22502278 fnic_priv(sc)->io_req = io_req;
22512279 }
22522280 io_req->dr_done = &tm_done;
@@ -2400,8 +2428,10 @@ fnic_device_reset_end: · 147 unmodified lines
24002428 (u64)sc->cmnd[4] << 8 | sc->cmnd[5]),
24012429 fnic_flags_and_state(sc));
24022430
2403− if (new_sc)
2431+ if (new_sc) {
2432+ fnic->sgreset_sc = NULL;
24042433 mutex_unlock(&fnic->sgreset_mutex);
2434+ }
24052435
24062436 FNIC_SCSI_DBG(KERN_DEBUG, fnic->lport->host,
24072437 "Returning from device reset %s\n",
drivers/scsi/scsi_scan.c+6−5
@@ -1627,12 +1627,13 @@ int scsi_rescan_device(struct scsi_device *sdev) · 1626 unmodified lines
16271627 device_lock(dev);
16281628
16291629 /*
1630− * Bail out if the device is not running. Otherwise, the rescan may
1631− * block waiting for commands to be executed, with us holding the
1632− * device lock. This can result in a potential deadlock in the power
1633− * management core code when system resume is on-going.
1630+ * Bail out if the device or its queue are not running. Otherwise,
1631+ * the rescan may block waiting for commands to be executed, with us
1632+ * holding the device lock. This can result in a potential deadlock
1633+ * in the power management core code when system resume is on-going.
16341634 */
1635− if (sdev->sdev_state != SDEV_RUNNING) {
1635+ if (sdev->sdev_state != SDEV_RUNNING ||
1636+ blk_queue_pm_only(sdev->request_queue)) {
16361637 ret = -EWOULDBLOCK;
16371638 goto unlock;
16381639 }
drivers/soc/renesas/Kconfig+1−0
@@ -333,6 +333,7 @@ if RISCV · 332 unmodified lines
333333
334334 config ARCH_R9A07G043
335335 bool "RISC-V Platform support for RZ/Five"
336+ depends on NONPORTABLE
336337 select ARCH_RZG2L
337338 select AX45MP_L2_CACHE if RISCV_DMA_NONCOHERENT
338339 select DMA_GLOBAL_POOL
drivers/soundwire/Makefile+4−0
@@ -15,6 +15,10 @@ ifdef CONFIG_DEBUG_FS · 14 unmodified lines
1515 soundwire-bus-y += debugfs.o
1616 endif
1717
18+ifdef CONFIG_IRQ_DOMAIN
19+soundwire-bus-y += irq.o
20+endif
21+
1822 #AMD driver
1923 soundwire-amd-y := amd_manager.o
2024 obj-$(CONFIG_SOUNDWIRE_AMD) += soundwire-amd.o
drivers/soundwire/bus.c+5−26
@@ -3,13 +3,13 @@ · 2 unmodified lines
33
44 #include <linux/acpi.h>
55 #include <linux/delay.h>
6−#include <linux/irq.h>
76 #include <linux/mod_devicetable.h>
87 #include <linux/pm_runtime.h>
98 #include <linux/soundwire/sdw_registers.h>
109 #include <linux/soundwire/sdw.h>
1110 #include <linux/soundwire/sdw_type.h>
1211 #include "bus.h"
12+#include "irq.h"
1313 #include "sysfs_local.h"
1414
1515 static DEFINE_IDA(sdw_bus_ida);
@@ -25,23 +25,6 @@ static int sdw_get_id(struct sdw_bus *bus) · 9 unmodified lines
2525 return 0;
2626 }
2727
28−static int sdw_irq_map(struct irq_domain *h, unsigned int virq,
29− irq_hw_number_t hw)
30−{
31− struct sdw_bus *bus = h->host_data;
32−
33− irq_set_chip_data(virq, bus);
34− irq_set_chip(virq, &bus->irq_chip);
35− irq_set_nested_thread(virq, 1);
36− irq_set_noprobe(virq);
37−
38− return 0;
39−}
40−
41−static const struct irq_domain_ops sdw_domain_ops = {
42− .map = sdw_irq_map,
43−};
44−
4528 /**
4629 * sdw_bus_master_add() - add a bus Master instance
4730 * @bus: bus instance
@@ -168,13 +151,9 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, · 120 unmodified lines
168151 bus->params.curr_bank = SDW_BANK0;
169152 bus->params.next_bank = SDW_BANK1;
170153
171− bus->irq_chip.name = dev_name(bus->dev);
172− bus->domain = irq_domain_create_linear(fwnode, SDW_MAX_DEVICES,
173− &sdw_domain_ops, bus);
174− if (!bus->domain) {
175− dev_err(bus->dev, "Failed to add IRQ domain\n");
176− return -EINVAL;
177− }
154+ ret = sdw_irq_create(bus, fwnode);
155+ if (ret)
156+ return ret;
178157
179158 return 0;
180159 }
@@ -213,7 +192,7 @@ void sdw_bus_master_delete(struct sdw_bus *bus) · 32 unmodified lines
213192 {
214193 device_for_each_child(bus->dev, NULL, sdw_delete_slave);
215194
216− irq_domain_remove(bus->domain);
195+ sdw_irq_delete(bus);
217196
218197 sdw_master_device_del(bus);
219198
drivers/soundwire/bus_type.c+4−7
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/soundwire/sdw.h>
88 #include <linux/soundwire/sdw_type.h>
99 #include "bus.h"
10+#include "irq.h"
1011 #include "sysfs_local.h"
1112
1213 /**
@@ -122,11 +123,8 @@ static int sdw_drv_probe(struct device *dev) · 109 unmodified lines
122123 if (drv->ops && drv->ops->read_prop)
123124 drv->ops->read_prop(slave);
124125
125− if (slave->prop.use_domain_irq) {
126− slave->irq = irq_create_mapping(slave->bus->domain, slave->dev_num);
127− if (!slave->irq)
128− dev_warn(dev, "Failed to map IRQ\n");
129− }
126+ if (slave->prop.use_domain_irq)
127+ sdw_irq_create_mapping(slave);
130128
131129 /* init the sysfs as we have properties now */
132130 ret = sdw_slave_sysfs_init(slave);
@@ -176,8 +174,7 @@ static int sdw_drv_remove(struct device *dev) · 43 unmodified lines
176174 slave->probed = false;
177175
178176 if (slave->prop.use_domain_irq)
179− irq_dispose_mapping(irq_find_mapping(slave->bus->domain,
180− slave->dev_num));
177+ sdw_irq_dispose_mapping(slave);
181178
182179 mutex_unlock(&slave->sdw_dev_lock);
183180
drivers/soundwire/irq.c+59−0
@@ -0,0 +1,59 @@
1+// SPDX-License-Identifier: GPL-2.0
2+// Copyright (C) 2023 Cirrus Logic, Inc. and
3+// Cirrus Logic International Semiconductor Ltd.
4+
5+#include <linux/device.h>
6+#include <linux/fwnode.h>
7+#include <linux/irq.h>
8+#include <linux/irqdomain.h>
9+#include <linux/soundwire/sdw.h>
10+#include "irq.h"
11+
12+static int sdw_irq_map(struct irq_domain *h, unsigned int virq,
13+ irq_hw_number_t hw)
14+{
15+ struct sdw_bus *bus = h->host_data;
16+
17+ irq_set_chip_data(virq, bus);
18+ irq_set_chip(virq, &bus->irq_chip);
19+ irq_set_nested_thread(virq, 1);
20+ irq_set_noprobe(virq);
21+
22+ return 0;
23+}
24+
25+static const struct irq_domain_ops sdw_domain_ops = {
26+ .map = sdw_irq_map,
27+};
28+
29+int sdw_irq_create(struct sdw_bus *bus,
30+ struct fwnode_handle *fwnode)
31+{
32+ bus->irq_chip.name = dev_name(bus->dev);
33+
34+ bus->domain = irq_domain_create_linear(fwnode, SDW_MAX_DEVICES,
35+ &sdw_domain_ops, bus);
36+ if (!bus->domain) {
37+ dev_err(bus->dev, "Failed to add IRQ domain\n");
38+ return -EINVAL;
39+ }
40+
41+ return 0;
42+}
43+
44+void sdw_irq_delete(struct sdw_bus *bus)
45+{
46+ irq_domain_remove(bus->domain);
47+}
48+
49+void sdw_irq_create_mapping(struct sdw_slave *slave)
50+{
51+ slave->irq = irq_create_mapping(slave->bus->domain, slave->dev_num);
52+ if (!slave->irq)
53+ dev_warn(&slave->dev, "Failed to map IRQ\n");
54+}
55+
56+void sdw_irq_dispose_mapping(struct sdw_slave *slave)
57+{
58+ irq_dispose_mapping(irq_find_mapping(slave->bus->domain, slave->dev_num));
59+}
drivers/soundwire/irq.h+43−0
@@ -0,0 +1,43 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (C) 2023 Cirrus Logic, Inc. and
4+ * Cirrus Logic International Semiconductor Ltd.
5+ */
6+
7+#ifndef __SDW_IRQ_H
8+#define __SDW_IRQ_H
9+
10+#include <linux/soundwire/sdw.h>
11+#include <linux/fwnode.h>
12+
13+#if IS_ENABLED(CONFIG_IRQ_DOMAIN)
14+
15+int sdw_irq_create(struct sdw_bus *bus,
16+ struct fwnode_handle *fwnode);
17+void sdw_irq_delete(struct sdw_bus *bus);
18+void sdw_irq_create_mapping(struct sdw_slave *slave);
19+void sdw_irq_dispose_mapping(struct sdw_slave *slave);
20+
21+#else /* CONFIG_IRQ_DOMAIN */
22+
23+static inline int sdw_irq_create(struct sdw_bus *bus,
24+ struct fwnode_handle *fwnode)
25+{
26+ return 0;
27+}
28+
29+static inline void sdw_irq_delete(struct sdw_bus *bus)
30+{
31+}
32+
33+static inline void sdw_irq_create_mapping(struct sdw_slave *slave)
34+{
35+}
36+
37+static inline void sdw_irq_dispose_mapping(struct sdw_slave *slave)
38+{
39+}
40+
41+#endif /* CONFIG_IRQ_DOMAIN */
42+
43+#endif /* __SDW_IRQ_H */
drivers/staging/media/atomisp/Kconfig+1−1
@@ -12,12 +12,12 @@ menuconfig INTEL_ATOMISP · 11 unmodified lines
1212 config VIDEO_ATOMISP
1313 tristate "Intel Atom Image Signal Processor Driver"
1414 depends on VIDEO_DEV && INTEL_ATOMISP
15+ depends on IPU_BRIDGE
1516 depends on MEDIA_PCI_SUPPORT
1617 depends on PMIC_OPREGION
1718 depends on I2C
1819 select V4L2_FWNODE
1920 select IOSF_MBI
20− select IPU_BRIDGE
2121 select VIDEOBUF2_VMALLOC
2222 select VIDEO_V4L2_SUBDEV_API
2323 help
drivers/staging/media/tegra-video/vi.c+10−6
@@ -1455,17 +1455,18 @@ static int __maybe_unused vi_runtime_suspend(struct device *dev) · 1454 unmodified lines
14551455 }
14561456
14571457 /*
1458− * Graph Management
1458+ * Find the entity matching a given fwnode in an v4l2_async_notifier list
14591459 */
14601460 static struct tegra_vi_graph_entity *
1461−tegra_vi_graph_find_entity(struct tegra_vi_channel *chan,
1461+tegra_vi_graph_find_entity(struct list_head *list,
14621462 const struct fwnode_handle *fwnode)
14631463 {
14641464 struct tegra_vi_graph_entity *entity;
14651465 struct v4l2_async_connection *asd;
14661466
1467− list_for_each_entry(asd, &chan->notifier.done_list, asc_entry) {
1467+ list_for_each_entry(asd, list, asc_entry) {
14681468 entity = to_tegra_vi_graph_entity(asd);
1469+
14691470 if (entity->asd.match.fwnode == fwnode)
14701471 return entity;
14711472 }
@@ -1532,7 +1533,8 @@ static int tegra_vi_graph_build(struct tegra_vi_channel *chan, · 60 unmodified lines
15321533 }
15331534
15341535 /* find the remote entity from notifier list */
1535− ent = tegra_vi_graph_find_entity(chan, link.remote_node);
1536+ ent = tegra_vi_graph_find_entity(&chan->notifier.done_list,
1537+ link.remote_node);
15361538 if (!ent) {
15371539 dev_err(vi->dev, "no entity found for %pOF\n",
15381540 to_of_node(link.remote_node));
@@ -1664,7 +1666,8 @@ static int tegra_vi_graph_notify_bound(struct v4l2_async_notifier *notifier, · 125 unmodified lines
16641666 * Locate the entity corresponding to the bound subdev and store the
16651667 * subdev pointer.
16661668 */
1667− entity = tegra_vi_graph_find_entity(chan, subdev->fwnode);
1669+ entity = tegra_vi_graph_find_entity(&chan->notifier.waiting_list,
1670+ subdev->fwnode);
16681671 if (!entity) {
16691672 dev_err(vi->dev, "no entity for subdev %s\n", subdev->name);
16701673 return -EINVAL;
@@ -1713,7 +1716,8 @@ static int tegra_vi_graph_parse_one(struct tegra_vi_channel *chan, · 42 unmodified lines
17131716
17141717 /* skip entities that are already processed */
17151718 if (device_match_fwnode(vi->dev, remote) ||
1716− tegra_vi_graph_find_entity(chan, remote)) {
1719+ tegra_vi_graph_find_entity(&chan->notifier.waiting_list,
1720+ remote)) {
17171721 fwnode_handle_put(remote);
17181722 continue;
17191723 }
drivers/target/target_core_device.c+4−7
@@ -843,7 +843,6 @@ sector_t target_to_linux_sector(struct se_device *dev, sector_t lb) · 842 unmodified lines
843843 EXPORT_SYMBOL(target_to_linux_sector);
844844
845845 struct devices_idr_iter {
846− struct config_item *prev_item;
847846 int (*fn)(struct se_device *dev, void *data);
848847 void *data;
849848 };
@@ -853,11 +852,9 @@ static int target_devices_idr_iter(int id, void *p, void *data) · 3 unmodified lines
853852 {
854853 struct devices_idr_iter *iter = data;
855854 struct se_device *dev = p;
855+ struct config_item *item;
856856 int ret;
857857
858− config_item_put(iter->prev_item);
859− iter->prev_item = NULL;
860−
861858 /*
862859 * We add the device early to the idr, so it can be used
863860 * by backend modules during configuration. We do not want
@@ -867,12 +864,13 @@ static int target_devices_idr_iter(int id, void *p, void *data) · 3 unmodified lines
867864 if (!target_dev_configured(dev))
868865 return 0;
869866
870− iter->prev_item = config_item_get_unless_zero(&dev->dev_group.cg_item);
871− if (!iter->prev_item)
867+ item = config_item_get_unless_zero(&dev->dev_group.cg_item);
868+ if (!item)
872869 return 0;
873870 mutex_unlock(&device_mutex);
874871
875872 ret = iter->fn(dev, iter->data);
873+ config_item_put(item);
876874
877875 mutex_lock(&device_mutex);
878876 return ret;
@@ -895,7 +893,6 @@ int target_for_each_device(int (*fn)(struct se_device *dev, void *data), · 16 unmodified lines
895893 mutex_lock(&device_mutex);
896894 ret = idr_for_each(&devices_idr, target_devices_idr_iter, &iter);
897895 mutex_unlock(&device_mutex);
898− config_item_put(iter.prev_item);
899896 return ret;
900897 }
901898
drivers/tee/amdtee/core.c+6−4
@@ -217,12 +217,12 @@ unlock: · 216 unmodified lines
217217 return rc;
218218 }
219219
220+/* mutex must be held by caller */
220221 static void destroy_session(struct kref *ref)
221222 {
222223 struct amdtee_session *sess = container_of(ref, struct amdtee_session,
223224 refcount);
224225
225− mutex_lock(&session_list_mutex);
226226 list_del(&sess->list_node);
227227 mutex_unlock(&session_list_mutex);
228228 kfree(sess);
@@ -272,7 +272,8 @@ int amdtee_open_session(struct tee_context *ctx, · 43 unmodified lines
272272 if (arg->ret != TEEC_SUCCESS) {
273273 pr_err("open_session failed %d\n", arg->ret);
274274 handle_unload_ta(ta_handle);
275− kref_put(&sess->refcount, destroy_session);
275+ kref_put_mutex(&sess->refcount, destroy_session,
276+ &session_list_mutex);
276277 goto out;
277278 }
278279
@@ -290,7 +291,8 @@ int amdtee_open_session(struct tee_context *ctx, · 11 unmodified lines
290291 pr_err("reached maximum session count %d\n", TEE_NUM_SESSIONS);
291292 handle_close_session(ta_handle, session_info);
292293 handle_unload_ta(ta_handle);
293− kref_put(&sess->refcount, destroy_session);
294+ kref_put_mutex(&sess->refcount, destroy_session,
295+ &session_list_mutex);
294296 rc = -ENOMEM;
295297 goto out;
296298 }
@@ -331,7 +333,7 @@ int amdtee_close_session(struct tee_context *ctx, u32 session) · 34 unmodified lines
331333 handle_close_session(ta_handle, session_info);
332334 handle_unload_ta(ta_handle);
333335
334− kref_put(&sess->refcount, destroy_session);
336+ kref_put_mutex(&sess->refcount, destroy_session, &session_list_mutex);
335337
336338 return 0;
337339 }
drivers/thunderbolt/icm.c+20−20
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #define PHY_PORT_CS1_LINK_STATE_SHIFT 26
4242
4343 #define ICM_TIMEOUT 5000 /* ms */
44+#define ICM_RETRIES 3
4445 #define ICM_APPROVE_TIMEOUT 10000 /* ms */
4546 #define ICM_MAX_LINK 4
4647
@@ -296,10 +297,9 @@ static bool icm_copy(struct tb_cfg_request *req, const struct ctl_pkg *pkg) · 249 unmodified lines
296297
297298 static int icm_request(struct tb *tb, const void *request, size_t request_size,
298299 void *response, size_t response_size, size_t npackets,
299− unsigned int timeout_msec)
300+ int retries, unsigned int timeout_msec)
300301 {
301302 struct icm *icm = tb_priv(tb);
302− int retries = 3;
303303
304304 do {
305305 struct tb_cfg_request *req;
@@ -410,7 +410,7 @@ static int icm_fr_get_route(struct tb *tb, u8 link, u8 depth, u64 *route) · 104 unmodified lines
410410 return -ENOMEM;
411411
412412 ret = icm_request(tb, &request, sizeof(request), switches,
413− sizeof(*switches), npackets, ICM_TIMEOUT);
413+ sizeof(*switches), npackets, ICM_RETRIES, ICM_TIMEOUT);
414414 if (ret)
415415 goto err_free;
416416
@@ -463,7 +463,7 @@ icm_fr_driver_ready(struct tb *tb, enum tb_security_level *security_level, · 46 unmodified lines
463463
464464 memset(&reply, 0, sizeof(reply));
465465 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
466− 1, ICM_TIMEOUT);
466+ 1, ICM_RETRIES, ICM_TIMEOUT);
467467 if (ret)
468468 return ret;
469469
@@ -488,7 +488,7 @@ static int icm_fr_approve_switch(struct tb *tb, struct tb_switch *sw) · 18 unmodified lines
488488 memset(&reply, 0, sizeof(reply));
489489 /* Use larger timeout as establishing tunnels can take some time */
490490 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
491− 1, ICM_APPROVE_TIMEOUT);
491+ 1, ICM_RETRIES, ICM_APPROVE_TIMEOUT);
492492 if (ret)
493493 return ret;
494494
@@ -515,7 +515,7 @@ static int icm_fr_add_switch_key(struct tb *tb, struct tb_switch *sw) · 20 unmodified lines
515515
516516 memset(&reply, 0, sizeof(reply));
517517 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
518− 1, ICM_TIMEOUT);
518+ 1, ICM_RETRIES, ICM_TIMEOUT);
519519 if (ret)
520520 return ret;
521521
@@ -543,7 +543,7 @@ static int icm_fr_challenge_switch_key(struct tb *tb, struct tb_switch *sw, · 21 unmodified lines
543543
544544 memset(&reply, 0, sizeof(reply));
545545 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
546− 1, ICM_TIMEOUT);
546+ 1, ICM_RETRIES, ICM_TIMEOUT);
547547 if (ret)
548548 return ret;
549549
@@ -577,7 +577,7 @@ static int icm_fr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, · 27 unmodified lines
577577
578578 memset(&reply, 0, sizeof(reply));
579579 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
580− 1, ICM_TIMEOUT);
580+ 1, ICM_RETRIES, ICM_TIMEOUT);
581581 if (ret)
582582 return ret;
583583
@@ -1020,7 +1020,7 @@ icm_tr_driver_ready(struct tb *tb, enum tb_security_level *security_level, · 436 unmodified lines
10201020
10211021 memset(&reply, 0, sizeof(reply));
10221022 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1023− 1, 20000);
1023+ 1, 10, 2000);
10241024 if (ret)
10251025 return ret;
10261026
@@ -1053,7 +1053,7 @@ static int icm_tr_approve_switch(struct tb *tb, struct tb_switch *sw) · 26 unmodified lines
10531053
10541054 memset(&reply, 0, sizeof(reply));
10551055 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1056− 1, ICM_APPROVE_TIMEOUT);
1056+ 1, ICM_RETRIES, ICM_APPROVE_TIMEOUT);
10571057 if (ret)
10581058 return ret;
10591059
@@ -1081,7 +1081,7 @@ static int icm_tr_add_switch_key(struct tb *tb, struct tb_switch *sw) · 21 unmodified lines
10811081
10821082 memset(&reply, 0, sizeof(reply));
10831083 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1084− 1, ICM_TIMEOUT);
1084+ 1, ICM_RETRIES, ICM_TIMEOUT);
10851085 if (ret)
10861086 return ret;
10871087
@@ -1110,7 +1110,7 @@ static int icm_tr_challenge_switch_key(struct tb *tb, struct tb_switch *sw, · 22 unmodified lines
11101110
11111111 memset(&reply, 0, sizeof(reply));
11121112 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1113− 1, ICM_TIMEOUT);
1113+ 1, ICM_RETRIES, ICM_TIMEOUT);
11141114 if (ret)
11151115 return ret;
11161116
@@ -1144,7 +1144,7 @@ static int icm_tr_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, · 27 unmodified lines
11441144
11451145 memset(&reply, 0, sizeof(reply));
11461146 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1147− 1, ICM_TIMEOUT);
1147+ 1, ICM_RETRIES, ICM_TIMEOUT);
11481148 if (ret)
11491149 return ret;
11501150
@@ -1170,7 +1170,7 @@ static int icm_tr_xdomain_tear_down(struct tb *tb, struct tb_xdomain *xd, · 19 unmodified lines
11701170
11711171 memset(&reply, 0, sizeof(reply));
11721172 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1173− 1, ICM_TIMEOUT);
1173+ 1, ICM_RETRIES, ICM_TIMEOUT);
11741174 if (ret)
11751175 return ret;
11761176
@@ -1496,7 +1496,7 @@ icm_ar_driver_ready(struct tb *tb, enum tb_security_level *security_level, · 319 unmodified lines
14961496
14971497 memset(&reply, 0, sizeof(reply));
14981498 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1499− 1, ICM_TIMEOUT);
1499+ 1, ICM_RETRIES, ICM_TIMEOUT);
15001500 if (ret)
15011501 return ret;
15021502
@@ -1522,7 +1522,7 @@ static int icm_ar_get_route(struct tb *tb, u8 link, u8 depth, u64 *route) · 19 unmodified lines
15221522
15231523 memset(&reply, 0, sizeof(reply));
15241524 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1525− 1, ICM_TIMEOUT);
1525+ 1, ICM_RETRIES, ICM_TIMEOUT);
15261526 if (ret)
15271527 return ret;
15281528
@@ -1543,7 +1543,7 @@ static int icm_ar_get_boot_acl(struct tb *tb, uuid_t *uuids, size_t nuuids) · 14 unmodified lines
15431543
15441544 memset(&reply, 0, sizeof(reply));
15451545 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1546− 1, ICM_TIMEOUT);
1546+ 1, ICM_RETRIES, ICM_TIMEOUT);
15471547 if (ret)
15481548 return ret;
15491549
@@ -1604,7 +1604,7 @@ static int icm_ar_set_boot_acl(struct tb *tb, const uuid_t *uuids, · 54 unmodified lines
16041604
16051605 memset(&reply, 0, sizeof(reply));
16061606 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1607− 1, ICM_TIMEOUT);
1607+ 1, ICM_RETRIES, ICM_TIMEOUT);
16081608 if (ret)
16091609 return ret;
16101610
@@ -1626,7 +1626,7 @@ icm_icl_driver_ready(struct tb *tb, enum tb_security_level *security_level, · 15 unmodified lines
16261626
16271627 memset(&reply, 0, sizeof(reply));
16281628 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
1629− 1, 20000);
1629+ 1, ICM_RETRIES, 20000);
16301630 if (ret)
16311631 return ret;
16321632
@@ -2298,7 +2298,7 @@ static int icm_usb4_switch_op(struct tb_switch *sw, u16 opcode, u32 *metadata, · 665 unmodified lines
22982298
22992299 memset(&reply, 0, sizeof(reply));
23002300 ret = icm_request(tb, &request, sizeof(request), &reply, sizeof(reply),
2301− 1, ICM_TIMEOUT);
2301+ 1, ICM_RETRIES, ICM_TIMEOUT);
23022302 if (ret)
23032303 return ret;
23042304
drivers/thunderbolt/switch.c+7−0
@@ -2725,6 +2725,13 @@ int tb_switch_lane_bonding_enable(struct tb_switch *sw) · 2724 unmodified lines
27252725 !tb_port_is_width_supported(down, TB_LINK_WIDTH_DUAL))
27262726 return 0;
27272727
2728+ /*
2729+ * Both lanes need to be in CL0. Here we assume lane 0 already be in
2730+ * CL0 and check just for lane 1.
2731+ */
2732+ if (tb_wait_for_port(down->dual_link_port, false) <= 0)
2733+ return -ENOTCONN;
2734+
27282735 ret = tb_port_lane_bonding_enable(up);
27292736 if (ret) {
27302737 tb_port_warn(up, "failed to enable lane bonding\n");
drivers/thunderbolt/tmu.c+1−1
@@ -382,7 +382,7 @@ static int tmu_mode_init(struct tb_switch *sw) · 381 unmodified lines
382382 } else if (ucap && tb_port_tmu_is_unidirectional(up)) {
383383 if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate)
384384 sw->tmu.mode = TB_SWITCH_TMU_MODE_LOWRES;
385− else if (tmu_rates[TB_SWITCH_TMU_MODE_LOWRES] == rate)
385+ else if (tmu_rates[TB_SWITCH_TMU_MODE_HIFI_UNI] == rate)
386386 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI;
387387 } else if (rate) {
388388 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_BI;
drivers/thunderbolt/xdomain.c+41−17
@@ -703,6 +703,27 @@ out_unlock: · 702 unmodified lines
703703 mutex_unlock(&xdomain_lock);
704704 }
705705
706+static void start_handshake(struct tb_xdomain *xd)
707+{
708+ xd->state = XDOMAIN_STATE_INIT;
709+ queue_delayed_work(xd->tb->wq, &xd->state_work,
710+ msecs_to_jiffies(XDOMAIN_SHORT_TIMEOUT));
711+}
712+
713+/* Can be called from state_work */
714+static void __stop_handshake(struct tb_xdomain *xd)
715+{
716+ cancel_delayed_work_sync(&xd->properties_changed_work);
717+ xd->properties_changed_retries = 0;
718+ xd->state_retries = 0;
719+}
720+
721+static void stop_handshake(struct tb_xdomain *xd)
722+{
723+ cancel_delayed_work_sync(&xd->state_work);
724+ __stop_handshake(xd);
725+}
726+
706727 static void tb_xdp_handle_request(struct work_struct *work)
707728 {
708729 struct xdomain_request_work *xw = container_of(work, typeof(*xw), work);
@@ -765,6 +786,15 @@ static void tb_xdp_handle_request(struct work_struct *work) · 56 unmodified lines
765786 case UUID_REQUEST:
766787 tb_dbg(tb, "%llx: received XDomain UUID request\n", route);
767788 ret = tb_xdp_uuid_response(ctl, route, sequence, uuid);
789+ /*
790+ * If we've stopped the discovery with an error such as
791+ * timing out, we will restart the handshake now that we
792+ * received UUID request from the remote host.
793+ */
794+ if (!ret && xd && xd->state == XDOMAIN_STATE_ERROR) {
795+ dev_dbg(&xd->dev, "restarting handshake\n");
796+ start_handshake(xd);
797+ }
768798 break;
769799
770800 case LINK_STATE_STATUS_REQUEST:
@@ -1521,6 +1551,13 @@ static void tb_xdomain_queue_properties_changed(struct tb_xdomain *xd) · 750 unmodified lines
15211551 msecs_to_jiffies(XDOMAIN_SHORT_TIMEOUT));
15221552 }
15231553
1554+static void tb_xdomain_failed(struct tb_xdomain *xd)
1555+{
1556+ xd->state = XDOMAIN_STATE_ERROR;
1557+ queue_delayed_work(xd->tb->wq, &xd->state_work,
1558+ msecs_to_jiffies(XDOMAIN_DEFAULT_TIMEOUT));
1559+}
1560+
15241561 static void tb_xdomain_state_work(struct work_struct *work)
15251562 {
15261563 struct tb_xdomain *xd = container_of(work, typeof(*xd), state_work.work);
@@ -1547,7 +1584,7 @@ static void tb_xdomain_state_work(struct work_struct *work) · 20 unmodified lines
15471584 if (ret) {
15481585 if (ret == -EAGAIN)
15491586 goto retry_state;
1550− xd->state = XDOMAIN_STATE_ERROR;
1587+ tb_xdomain_failed(xd);
15511588 } else {
15521589 tb_xdomain_queue_properties_changed(xd);
15531590 if (xd->bonding_possible)
@@ -1612,7 +1649,7 @@ static void tb_xdomain_state_work(struct work_struct *work) · 58 unmodified lines
16121649 if (ret) {
16131650 if (ret == -EAGAIN)
16141651 goto retry_state;
1615− xd->state = XDOMAIN_STATE_ERROR;
1652+ tb_xdomain_failed(xd);
16161653 } else {
16171654 xd->state = XDOMAIN_STATE_ENUMERATED;
16181655 }
@@ -1623,6 +1660,8 @@ static void tb_xdomain_state_work(struct work_struct *work) · 4 unmodified lines
16231660 break;
16241661
16251662 case XDOMAIN_STATE_ERROR:
1663+ dev_dbg(&xd->dev, "discovery failed, stopping handshake\n");
1664+ __stop_handshake(xd);
16261665 break;
16271666
16281667 default:
@@ -1833,21 +1872,6 @@ static void tb_xdomain_release(struct device *dev) · 204 unmodified lines
18331872 kfree(xd);
18341873 }
18351874
1836−static void start_handshake(struct tb_xdomain *xd)
1837−{
1838− xd->state = XDOMAIN_STATE_INIT;
1839− queue_delayed_work(xd->tb->wq, &xd->state_work,
1840− msecs_to_jiffies(XDOMAIN_SHORT_TIMEOUT));
1841−}
1842−
1843−static void stop_handshake(struct tb_xdomain *xd)
1844−{
1845− cancel_delayed_work_sync(&xd->properties_changed_work);
1846− cancel_delayed_work_sync(&xd->state_work);
1847− xd->properties_changed_retries = 0;
1848− xd->state_retries = 0;
1849−}
1850−
18511875 static int __maybe_unused tb_xdomain_suspend(struct device *dev)
18521876 {
18531877 stop_handshake(tb_to_xdomain(dev));
drivers/tty/serial/8250/8250_omap.c+10−15
@@ -1623,7 +1623,7 @@ static int omap8250_suspend(struct device *dev) · 1622 unmodified lines
16231623 {
16241624 struct omap8250_priv *priv = dev_get_drvdata(dev);
16251625 struct uart_8250_port *up = serial8250_get_port(priv->line);
1626− int err;
1626+ int err = 0;
16271627
16281628 serial8250_suspend_port(priv->line);
16291629
@@ -1633,7 +1633,8 @@ static int omap8250_suspend(struct device *dev) · 3 unmodified lines
16331633 if (!device_may_wakeup(dev))
16341634 priv->wer = 0;
16351635 serial_out(up, UART_OMAP_WER, priv->wer);
1636− err = pm_runtime_force_suspend(dev);
1636+ if (uart_console(&up->port) && console_suspend_enabled)
1637+ err = pm_runtime_force_suspend(dev);
16371638 flush_work(&priv->qos_work);
16381639
16391640 return err;
@@ -1642,11 +1643,15 @@ static int omap8250_suspend(struct device *dev) · 2 unmodified lines
16421643 static int omap8250_resume(struct device *dev)
16431644 {
16441645 struct omap8250_priv *priv = dev_get_drvdata(dev);
1646+ struct uart_8250_port *up = serial8250_get_port(priv->line);
16451647 int err;
16461648
1647− err = pm_runtime_force_resume(dev);
1648− if (err)
1649− return err;
1649+ if (uart_console(&up->port) && console_suspend_enabled) {
1650+ err = pm_runtime_force_resume(dev);
1651+ if (err)
1652+ return err;
1653+ }
1654+
16501655 serial8250_resume_port(priv->line);
16511656 /* Paired with pm_runtime_resume_and_get() in omap8250_suspend() */
16521657 pm_runtime_mark_last_busy(dev);
@@ -1723,16 +1728,6 @@ static int omap8250_runtime_suspend(struct device *dev) · 70 unmodified lines
17231728
17241729 if (priv->line >= 0)
17251730 up = serial8250_get_port(priv->line);
1726− /*
1727− * When using 'no_console_suspend', the console UART must not be
1728− * suspended. Since driver suspend is managed by runtime suspend,
1729− * preventing runtime suspend (by returning error) will keep device
1730− * active during suspend.
1731− */
1732− if (priv->is_suspending && !console_suspend_enabled) {
1733− if (up && uart_console(&up->port))
1734− return -EBUSY;
1735− }
17361731
17371732 if (priv->habit & UART_ERRATA_CLOCK_DISABLE) {
17381733 int ret;
drivers/tty/serial/serial_core.c+10−5
@@ -156,7 +156,7 @@ static void __uart_start(struct uart_state *state) · 155 unmodified lines
156156 * enabled, serial_port_runtime_resume() calls start_tx() again
157157 * after enabling the device.
158158 */
159− if (pm_runtime_active(&port_dev->dev))
159+ if (!pm_runtime_enabled(port->dev) || pm_runtime_active(port->dev))
160160 port->ops->start_tx(port);
161161 pm_runtime_mark_last_busy(&port_dev->dev);
162162 pm_runtime_put_autosuspend(&port_dev->dev);
@@ -1407,12 +1407,18 @@ static void uart_set_rs485_termination(struct uart_port *port, · 1244 unmodified lines
14071407 static int uart_rs485_config(struct uart_port *port)
14081408 {
14091409 struct serial_rs485 *rs485 = &port->rs485;
1410+ unsigned long flags;
14101411 int ret;
14111412
1413+ if (!(rs485->flags & SER_RS485_ENABLED))
1414+ return 0;
1415+
14121416 uart_sanitize_serial_rs485(port, rs485);
14131417 uart_set_rs485_termination(port, rs485);
14141418
1419+ uart_port_lock_irqsave(port, &flags);
14151420 ret = port->rs485_config(port, NULL, rs485);
1421+ uart_port_unlock_irqrestore(port, flags);
14161422 if (ret)
14171423 memset(rs485, 0, sizeof(*rs485));
14181424
@@ -2477,11 +2483,10 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) · 1058 unmodified lines
24772483 if (ret == 0) {
24782484 if (tty)
24792485 uart_change_line_settings(tty, state, NULL);
2486+ uart_rs485_config(uport);
24802487 uart_port_lock_irq(uport);
24812488 if (!(uport->rs485.flags & SER_RS485_ENABLED))
24822489 ops->set_mctrl(uport, uport->mctrl);
2483− else
2484− uart_rs485_config(uport);
24852490 ops->start_tx(uport);
24862491 uart_port_unlock_irq(uport);
24872492 tty_port_set_initialized(port, true);
@@ -2590,10 +2595,10 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, · 102 unmodified lines
25902595 port->mctrl &= TIOCM_DTR;
25912596 if (!(port->rs485.flags & SER_RS485_ENABLED))
25922597 port->ops->set_mctrl(port, port->mctrl);
2593− else
2594− uart_rs485_config(port);
25952598 uart_port_unlock_irqrestore(port, flags);
25962599
2600+ uart_rs485_config(port);
2601+
25972602 /*
25982603 * If this driver supports console, and it hasn't been
25992604 * successfully registered yet, try to re-register it.
drivers/ufs/core/ufshcd.c+1−1
@@ -6895,7 +6895,7 @@ static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag) · 6894 unmodified lines
68956895 mask, 0, 1000, 1000);
68966896
68976897 dev_err(hba->dev, "Clearing task management function with tag %d %s\n",
6898− tag, err ? "succeeded" : "failed");
6898+ tag, err < 0 ? "failed" : "succeeded");
68996899
69006900 out:
69016901 return err;
drivers/usb/cdns3/cdnsp-gadget.c+3−0
@@ -1125,6 +1125,9 @@ static int cdnsp_gadget_ep_dequeue(struct usb_ep *ep, · 1124 unmodified lines
11251125 unsigned long flags;
11261126 int ret;
11271127
1128+ if (request->status != -EINPROGRESS)
1129+ return 0;
1130+
11281131 if (!pep->endpoint.desc) {
11291132 dev_err(pdev->dev,
11301133 "%s: can't dequeue to disabled endpoint\n",
drivers/usb/cdns3/core.h+1−2
@@ -131,8 +131,7 @@ void cdns_set_active(struct cdns *cdns, u8 set_active); · 130 unmodified lines
131131 #else /* CONFIG_PM_SLEEP */
132132 static inline int cdns_resume(struct cdns *cdns)
133133 { return 0; }
134−static inline int cdns_set_active(struct cdns *cdns, u8 set_active)
135−{ return 0; }
134+static inline void cdns_set_active(struct cdns *cdns, u8 set_active) { }
136135 static inline int cdns_suspend(struct cdns *cdns)
137136 { return 0; }
138137 #endif /* CONFIG_PM_SLEEP */
drivers/usb/core/hub.c+22−3
@@ -151,6 +151,10 @@ int usb_device_supports_lpm(struct usb_device *udev) · 150 unmodified lines
151151 if (udev->quirks & USB_QUIRK_NO_LPM)
152152 return 0;
153153
154+ /* Skip if the device BOS descriptor couldn't be read */
155+ if (!udev->bos)
156+ return 0;
157+
154158 /* USB 2.1 (and greater) devices indicate LPM support through
155159 * their USB 2.0 Extended Capabilities BOS descriptor.
156160 */
@@ -327,6 +331,10 @@ static void usb_set_lpm_parameters(struct usb_device *udev) · 170 unmodified lines
327331 if (!udev->lpm_capable || udev->speed < USB_SPEED_SUPER)
328332 return;
329333
334+ /* Skip if the device BOS descriptor couldn't be read */
335+ if (!udev->bos)
336+ return;
337+
330338 hub = usb_hub_to_struct_hub(udev->parent);
331339 /* It doesn't take time to transition the roothub into U0, since it
332340 * doesn't have an upstream link.
@@ -2704,13 +2712,17 @@ out_authorized: · 2371 unmodified lines
27042712 static enum usb_ssp_rate get_port_ssp_rate(struct usb_device *hdev,
27052713 u32 ext_portstatus)
27062714 {
2707− struct usb_ssp_cap_descriptor *ssp_cap = hdev->bos->ssp_cap;
2715+ struct usb_ssp_cap_descriptor *ssp_cap;
27082716 u32 attr;
27092717 u8 speed_id;
27102718 u8 ssac;
27112719 u8 lanes;
27122720 int i;
27132721
2722+ if (!hdev->bos)
2723+ goto out;
2724+
2725+ ssp_cap = hdev->bos->ssp_cap;
27142726 if (!ssp_cap)
27152727 goto out;
27162728
@@ -4215,8 +4227,15 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, · 1498 unmodified lines
42154227 enum usb3_link_state state)
42164228 {
42174229 int timeout;
4218− __u8 u1_mel = udev->bos->ss_cap->bU1devExitLat;
4219− __le16 u2_mel = udev->bos->ss_cap->bU2DevExitLat;
4230+ __u8 u1_mel;
4231+ __le16 u2_mel;
4232+
4233+ /* Skip if the device BOS descriptor couldn't be read */
4234+ if (!udev->bos)
4235+ return;
4236+
4237+ u1_mel = udev->bos->ss_cap->bU1devExitLat;
4238+ u2_mel = udev->bos->ss_cap->bU2DevExitLat;
42204239
42214240 /* If the device says it doesn't have *any* exit latency to come out of
42224241 * U1 or U2, it's probably lying. Assume it doesn't implement that link
drivers/usb/core/hub.h+1−1
@@ -153,7 +153,7 @@ static inline int hub_is_superspeedplus(struct usb_device *hdev) · 152 unmodified lines
153153 {
154154 return (hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS &&
155155 le16_to_cpu(hdev->descriptor.bcdUSB) >= 0x0310 &&
156− hdev->bos->ssp_cap);
156+ hdev->bos && hdev->bos->ssp_cap);
157157 }
158158
159159 static inline unsigned hub_power_on_good_delay(struct usb_hub *hub)
drivers/usb/dwc3/core.c+38−1
@@ -279,9 +279,46 @@ int dwc3_core_soft_reset(struct dwc3 *dwc) · 278 unmodified lines
279279 * XHCI driver will reset the host block. If dwc3 was configured for
280280 * host-only mode or current role is host, then we can return early.
281281 */
282− if (dwc->dr_mode == USB_DR_MODE_HOST || dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
282+ if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
283283 return 0;
284284
285+ /*
286+ * If the dr_mode is host and the dwc->current_dr_role is not the
287+ * corresponding DWC3_GCTL_PRTCAP_HOST, then the dwc3_core_init_mode
288+ * isn't executed yet. Ensure the phy is ready before the controller
289+ * updates the GCTL.PRTCAPDIR or other settings by soft-resetting
290+ * the phy.
291+ *
292+ * Note: GUSB3PIPECTL[n] and GUSB2PHYCFG[n] are port settings where n
293+ * is port index. If this is a multiport host, then we need to reset
294+ * all active ports.
295+ */
296+ if (dwc->dr_mode == USB_DR_MODE_HOST) {
297+ u32 usb3_port;
298+ u32 usb2_port;
299+
300+ usb3_port = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
301+ usb3_port |= DWC3_GUSB3PIPECTL_PHYSOFTRST;
302+ dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port);
303+
304+ usb2_port = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
305+ usb2_port |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
306+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port);
307+
308+ /* Small delay for phy reset assertion */
309+ usleep_range(1000, 2000);
310+
311+ usb3_port &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST;
312+ dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), usb3_port);
313+
314+ usb2_port &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST;
315+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), usb2_port);
316+
317+ /* Wait for clock synchronization */
318+ msleep(50);
319+ return 0;
320+ }
321+
285322 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
286323 reg |= DWC3_DCTL_CSFTRST;
287324 reg &= ~DWC3_DCTL_RUN_STOP;
drivers/usb/gadget/function/f_ncm.c+19−7
@@ -1156,7 +1156,8 @@ static int ncm_unwrap_ntb(struct gether *port, · 1155 unmodified lines
11561156 struct sk_buff_head *list)
11571157 {
11581158 struct f_ncm *ncm = func_to_ncm(&port->func);
1159− __le16 *tmp = (void *) skb->data;
1159+ unsigned char *ntb_ptr = skb->data;
1160+ __le16 *tmp;
11601161 unsigned index, index2;
11611162 int ndp_index;
11621163 unsigned dg_len, dg_len2;
@@ -1169,6 +1170,10 @@ static int ncm_unwrap_ntb(struct gether *port, · 6 unmodified lines
11691170 const struct ndp_parser_opts *opts = ncm->parser_opts;
11701171 unsigned crc_len = ncm->is_crc ? sizeof(uint32_t) : 0;
11711172 int dgram_counter;
1173+ int to_process = skb->len;
1174+
1175+parse_ntb:
1176+ tmp = (__le16 *)ntb_ptr;
11721177
11731178 /* dwSignature */
11741179 if (get_unaligned_le32(tmp) != opts->nth_sign) {
@@ -1215,7 +1220,7 @@ static int ncm_unwrap_ntb(struct gether *port, · 40 unmodified lines
12151220 * walk through NDP
12161221 * dwSignature
12171222 */
1218− tmp = (void *)(skb->data + ndp_index);
1223+ tmp = (__le16 *)(ntb_ptr + ndp_index);
12191224 if (get_unaligned_le32(tmp) != ncm->ndp_sign) {
12201225 INFO(port->func.config->cdev, "Wrong NDP SIGN\n");
12211226 goto err;
@@ -1272,11 +1277,11 @@ static int ncm_unwrap_ntb(struct gether *port, · 50 unmodified lines
12721277 if (ncm->is_crc) {
12731278 uint32_t crc, crc2;
12741279
1275− crc = get_unaligned_le32(skb->data +
1280+ crc = get_unaligned_le32(ntb_ptr +
12761281 index + dg_len -
12771282 crc_len);
12781283 crc2 = ~crc32_le(~0,
1279− skb->data + index,
1284+ ntb_ptr + index,
12801285 dg_len - crc_len);
12811286 if (crc != crc2) {
12821287 INFO(port->func.config->cdev,
@@ -1303,7 +1308,7 @@ static int ncm_unwrap_ntb(struct gether *port, · 20 unmodified lines
13031308 dg_len - crc_len);
13041309 if (skb2 == NULL)
13051310 goto err;
1306− skb_put_data(skb2, skb->data + index,
1311+ skb_put_data(skb2, ntb_ptr + index,
13071312 dg_len - crc_len);
13081313
13091314 skb_queue_tail(list, skb2);
@@ -1316,10 +1321,17 @@ static int ncm_unwrap_ntb(struct gether *port, · 6 unmodified lines
13161321 } while (ndp_len > 2 * (opts->dgram_item_len * 2));
13171322 } while (ndp_index);
13181323
1319− dev_consume_skb_any(skb);
1320−
13211324 VDBG(port->func.config->cdev,
13221325 "Parsed NTB with %d frames\n", dgram_counter);
1326+
1327+ to_process -= block_len;
1328+ if (to_process != 0) {
1329+ ntb_ptr = (unsigned char *)(ntb_ptr + block_len);
1330+ goto parse_ntb;
1331+ }
1332+
1333+ dev_consume_skb_any(skb);
1334+
13231335 return 0;
13241336 err:
13251337 skb_queue_purge(list);
drivers/usb/gadget/udc/udc-xilinx.c+12−8
@@ -497,11 +497,13 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xusb_req *req, · 496 unmodified lines
497497 /* Get the Buffer address and copy the transmit data.*/
498498 eprambase = (u32 __force *)(udc->addr + ep->rambase);
499499 if (ep->is_in) {
500− memcpy(eprambase, bufferptr, bytestosend);
500+ memcpy_toio((void __iomem *)eprambase, bufferptr,
501+ bytestosend);
501502 udc->write_fn(udc->addr, ep->offset +
502503 XUSB_EP_BUF0COUNT_OFFSET, bufferlen);
503504 } else {
504− memcpy(bufferptr, eprambase, bytestosend);
505+ memcpy_toio((void __iomem *)bufferptr, eprambase,
506+ bytestosend);
505507 }
506508 /*
507509 * Enable the buffer for transmission.
@@ -515,11 +517,13 @@ static int xudc_eptxrx(struct xusb_ep *ep, struct xusb_req *req, · 7 unmodified lines
515517 eprambase = (u32 __force *)(udc->addr + ep->rambase +
516518 ep->ep_usb.maxpacket);
517519 if (ep->is_in) {
518− memcpy(eprambase, bufferptr, bytestosend);
520+ memcpy_toio((void __iomem *)eprambase, bufferptr,
521+ bytestosend);
519522 udc->write_fn(udc->addr, ep->offset +
520523 XUSB_EP_BUF1COUNT_OFFSET, bufferlen);
521524 } else {
522− memcpy(bufferptr, eprambase, bytestosend);
525+ memcpy_toio((void __iomem *)bufferptr, eprambase,
526+ bytestosend);
523527 }
524528 /*
525529 * Enable the buffer for transmission.
@@ -1021,7 +1025,7 @@ static int __xudc_ep0_queue(struct xusb_ep *ep0, struct xusb_req *req) · 495 unmodified lines
10211025 udc->addr);
10221026 length = req->usb_req.actual = min_t(u32, length,
10231027 EP0_MAX_PACKET);
1024− memcpy(corebuf, req->usb_req.buf, length);
1028+ memcpy_toio((void __iomem *)corebuf, req->usb_req.buf, length);
10251029 udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, length);
10261030 udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1);
10271031 } else {
@@ -1752,7 +1756,7 @@ static void xudc_handle_setup(struct xusb_udc *udc) · 724 unmodified lines
17521756
17531757 /* Load up the chapter 9 command buffer.*/
17541758 ep0rambase = (u32 __force *) (udc->addr + XUSB_SETUP_PKT_ADDR_OFFSET);
1755− memcpy(&setup, ep0rambase, 8);
1759+ memcpy_toio((void __iomem *)&setup, ep0rambase, 8);
17561760
17571761 udc->setup = setup;
17581762 udc->setup.wValue = cpu_to_le16((u16 __force)setup.wValue);
@@ -1839,7 +1843,7 @@ static void xudc_ep0_out(struct xusb_udc *udc) · 80 unmodified lines
18391843 (ep0->rambase << 2));
18401844 buffer = req->usb_req.buf + req->usb_req.actual;
18411845 req->usb_req.actual = req->usb_req.actual + bytes_to_rx;
1842− memcpy(buffer, ep0rambase, bytes_to_rx);
1846+ memcpy_toio((void __iomem *)buffer, ep0rambase, bytes_to_rx);
18431847
18441848 if (req->usb_req.length == req->usb_req.actual) {
18451849 /* Data transfer completed get ready for Status stage */
@@ -1915,7 +1919,7 @@ static void xudc_ep0_in(struct xusb_udc *udc) · 69 unmodified lines
19151919 (ep0->rambase << 2));
19161920 buffer = req->usb_req.buf + req->usb_req.actual;
19171921 req->usb_req.actual = req->usb_req.actual + length;
1918− memcpy(ep0rambase, buffer, length);
1922+ memcpy_toio((void __iomem *)ep0rambase, buffer, length);
19191923 }
19201924 udc->write_fn(udc->addr, XUSB_EP_BUF0COUNT_OFFSET, count);
19211925 udc->write_fn(udc->addr, XUSB_BUFFREADY_OFFSET, 1);
drivers/usb/host/xhci-hub.c+10−9
@@ -1062,19 +1062,19 @@ static void xhci_get_usb3_port_status(struct xhci_port *port, u32 *status, · 1061 unmodified lines
10621062 *status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
10631063
10641064 /* USB3 specific wPortStatus bits */
1065− if (portsc & PORT_POWER) {
1065+ if (portsc & PORT_POWER)
10661066 *status |= USB_SS_PORT_STAT_POWER;
1067− /* link state handling */
1068− if (link_state == XDEV_U0)
1069− bus_state->suspended_ports &= ~(1 << portnum);
1070− }
10711067
1072− /* remote wake resume signaling complete */
1073− if (bus_state->port_remote_wakeup & (1 << portnum) &&
1068+ /* no longer suspended or resuming */
1069+ if (link_state != XDEV_U3 &&
10741070 link_state != XDEV_RESUME &&
10751071 link_state != XDEV_RECOVERY) {
1076− bus_state->port_remote_wakeup &= ~(1 << portnum);
1077− usb_hcd_end_port_resume(&hcd->self, portnum);
1072+ /* remote wake resume signaling complete */
1073+ if (bus_state->port_remote_wakeup & (1 << portnum)) {
1074+ bus_state->port_remote_wakeup &= ~(1 << portnum);
1075+ usb_hcd_end_port_resume(&hcd->self, portnum);
1076+ }
1077+ bus_state->suspended_ports &= ~(1 << portnum);
10781078 }
10791079
10801080 xhci_hub_report_usb3_link_state(xhci, status, portsc);
@@ -1131,6 +1131,7 @@ static void xhci_get_usb2_port_status(struct xhci_port *port, u32 *status, · 50 unmodified lines
11311131 usb_hcd_end_port_resume(&port->rhub->hcd->self, portnum);
11321132 }
11331133 port->rexit_active = 0;
1134+ bus_state->suspended_ports &= ~(1 << portnum);
11341135 }
11351136 }
11361137
drivers/usb/host/xhci-mem.c+2−2
@@ -2285,8 +2285,8 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir, · 2284 unmodified lines
22852285 writel(erst_size, &ir->ir_set->erst_size);
22862286
22872287 erst_base = xhci_read_64(xhci, &ir->ir_set->erst_base);
2288− erst_base &= ERST_PTR_MASK;
2289− erst_base |= (ir->erst.erst_dma_addr & (u64) ~ERST_PTR_MASK);
2288+ erst_base &= ERST_BASE_RSVDP;
2289+ erst_base |= ir->erst.erst_dma_addr & ~ERST_BASE_RSVDP;
22902290 xhci_write_64(xhci, erst_base, &ir->ir_set->erst_base);
22912291
22922292 /* Set the event ring dequeue address of this interrupter */
drivers/usb/host/xhci-ring.c+9−7
@@ -798,7 +798,7 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci, · 797 unmodified lines
798798 static void xhci_unmap_td_bounce_buffer(struct xhci_hcd *xhci,
799799 struct xhci_ring *ring, struct xhci_td *td)
800800 {
801− struct device *dev = xhci_to_hcd(xhci)->self.controller;
801+ struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
802802 struct xhci_segment *seg = td->bounce_seg;
803803 struct urb *urb = td->urb;
804804 size_t len;
@@ -2996,7 +2996,8 @@ static int xhci_handle_event(struct xhci_hcd *xhci, struct xhci_interrupter *ir) · 2191 unmodified lines
29962996 */
29972997 static void xhci_update_erst_dequeue(struct xhci_hcd *xhci,
29982998 struct xhci_interrupter *ir,
2999− union xhci_trb *event_ring_deq)
2999+ union xhci_trb *event_ring_deq,
3000+ bool clear_ehb)
30003001 {
30013002 u64 temp_64;
30023003 dma_addr_t deq;
@@ -3017,12 +3018,13 @@ static void xhci_update_erst_dequeue(struct xhci_hcd *xhci, · 14 unmodified lines
30173018 return;
30183019
30193020 /* Update HC event ring dequeue pointer */
3020− temp_64 &= ERST_PTR_MASK;
3021+ temp_64 &= ERST_DESI_MASK;
30213022 temp_64 |= ((u64) deq & (u64) ~ERST_PTR_MASK);
30223023 }
30233024
30243025 /* Clear the event handler busy flag (RW1C) */
3025− temp_64 |= ERST_EHB;
3026+ if (clear_ehb)
3027+ temp_64 |= ERST_EHB;
30263028 xhci_write_64(xhci, temp_64, &ir->ir_set->erst_dequeue);
30273029 }
30283030
@@ -3103,7 +3105,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) · 74 unmodified lines
31033105 while (xhci_handle_event(xhci, ir) > 0) {
31043106 if (event_loop++ < TRBS_PER_SEGMENT / 2)
31053107 continue;
3106− xhci_update_erst_dequeue(xhci, ir, event_ring_deq);
3108+ xhci_update_erst_dequeue(xhci, ir, event_ring_deq, false);
31073109 event_ring_deq = ir->event_ring->dequeue;
31083110
31093111 /* ring is half-full, force isoc trbs to interrupt more often */
@@ -3113,7 +3115,7 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) · 3 unmodified lines
31133115 event_loop = 0;
31143116 }
31153117
3116− xhci_update_erst_dequeue(xhci, ir, event_ring_deq);
3118+ xhci_update_erst_dequeue(xhci, ir, event_ring_deq, true);
31173119 ret = IRQ_HANDLED;
31183120
31193121 out:
@@ -3469,7 +3471,7 @@ static u32 xhci_td_remainder(struct xhci_hcd *xhci, int transferred, · 349 unmodified lines
34693471 static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len,
34703472 u32 *trb_buff_len, struct xhci_segment *seg)
34713473 {
3472− struct device *dev = xhci_to_hcd(xhci)->self.controller;
3474+ struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
34733475 unsigned int unalign;
34743476 unsigned int max_pkt;
34753477 u32 new_buff_len;
drivers/usb/host/xhci.h+1−1
@@ -514,7 +514,7 @@ struct xhci_intr_reg { · 513 unmodified lines
514514 #define ERST_SIZE_MASK (0xffff << 16)
515515
516516 /* erst_base bitmasks */
517−#define ERST_BASE_RSVDP (0x3f)
517+#define ERST_BASE_RSVDP (GENMASK_ULL(5, 0))
518518
519519 /* erst_dequeue bitmasks */
520520 /* Dequeue ERST Segment Index (DESI) - Segment number (or alias)
drivers/usb/misc/onboard_usb_hub.c+1−0
@@ -434,6 +434,7 @@ static const struct usb_device_id onboard_hub_id_table[] = { · 433 unmodified lines
434434 { USB_DEVICE(VENDOR_ID_GENESYS, 0x0608) }, /* Genesys Logic GL850G USB 2.0 */
435435 { USB_DEVICE(VENDOR_ID_GENESYS, 0x0610) }, /* Genesys Logic GL852G USB 2.0 */
436436 { USB_DEVICE(VENDOR_ID_GENESYS, 0x0620) }, /* Genesys Logic GL3523 USB 3.1 */
437+ { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2412) }, /* USB2412 USB 2.0 */
437438 { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2514) }, /* USB2514B USB 2.0 */
438439 { USB_DEVICE(VENDOR_ID_MICROCHIP, 0x2517) }, /* USB2517 USB 2.0 */
439440 { USB_DEVICE(VENDOR_ID_REALTEK, 0x0411) }, /* RTS5411 USB 3.1 */
drivers/usb/misc/onboard_usb_hub.h+1−0
@@ -47,6 +47,7 @@ static const struct onboard_hub_pdata vialab_vl817_data = { · 46 unmodified lines
4747 };
4848
4949 static const struct of_device_id onboard_hub_match[] = {
50+ { .compatible = "usb424,2412", .data = &microchip_usb424_data, },
5051 { .compatible = "usb424,2514", .data = &microchip_usb424_data, },
5152 { .compatible = "usb424,2517", .data = &microchip_usb424_data, },
5253 { .compatible = "usb451,8140", .data = &ti_tusb8041_data, },
drivers/usb/musb/musb_debugfs.c+1−1
@@ -39,7 +39,7 @@ static const struct musb_register_map musb_regmap[] = { · 38 unmodified lines
3939 { "IntrUsbE", MUSB_INTRUSBE, 8 },
4040 { "DevCtl", MUSB_DEVCTL, 8 },
4141 { "VControl", 0x68, 32 },
42− { "HWVers", 0x69, 16 },
42+ { "HWVers", MUSB_HWVERS, 16 },
4343 { "LinkInfo", MUSB_LINKINFO, 8 },
4444 { "VPLen", MUSB_VPLEN, 8 },
4545 { "HS_EOF1", MUSB_HS_EOF1, 8 },
drivers/usb/musb/musb_host.c+8−1
@@ -321,10 +321,16 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, · 320 unmodified lines
321321 musb_giveback(musb, urb, status);
322322 qh->is_ready = ready;
323323
324+ /*
325+ * musb->lock had been unlocked in musb_giveback, so qh may
326+ * be freed, need to get it again
327+ */
328+ qh = musb_ep_get_qh(hw_ep, is_in);
329+
324330 /* reclaim resources (and bandwidth) ASAP; deschedule it, and
325331 * invalidate qh as soon as list_empty(&hep->urb_list)
326332 */
327− if (list_empty(&qh->hep->urb_list)) {
333+ if (qh && list_empty(&qh->hep->urb_list)) {
328334 struct list_head *head;
329335 struct dma_controller *dma = musb->dma_controller;
330336
@@ -2398,6 +2404,7 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) · 2067 unmodified lines
23982404 * and its URB list has emptied, recycle this qh.
23992405 */
24002406 if (ready && list_empty(&qh->hep->urb_list)) {
2407+ musb_ep_set_qh(qh->hw_ep, is_in, NULL);
24012408 qh->hep->hcpriv = NULL;
24022409 list_del(&qh->ring);
24032410 kfree(qh);
drivers/usb/typec/altmodes/displayport.c+5−0
@@ -304,6 +304,11 @@ static int dp_altmode_vdm(struct typec_altmode *alt, · 303 unmodified lines
304304 typec_altmode_update_active(alt, false);
305305 dp->data.status = 0;
306306 dp->data.conf = 0;
307+ if (dp->hpd) {
308+ drm_connector_oob_hotplug_event(dp->connector_fwnode);
309+ dp->hpd = false;
310+ sysfs_notify(&dp->alt->dev.kobj, "displayport", "hpd");
311+ }
307312 break;
308313 case DP_CMD_STATUS_UPDATE:
309314 dp->data.status = *vdo;
drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c+6−6
@@ -381,10 +381,6 @@ static int qcom_pmic_typec_pdphy_enable(struct pmic_typec_pdphy *pmic_typec_pdph · 380 unmodified lines
381381 struct device *dev = pmic_typec_pdphy->dev;
382382 int ret;
383383
384− ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy);
385− if (ret)
386− return ret;
387−
388384 /* PD 2.0, DR=TYPEC_DEVICE, PR=TYPEC_SINK */
389385 ret = regmap_update_bits(pmic_typec_pdphy->regmap,
390386 pmic_typec_pdphy->base + USB_PDPHY_MSG_CONFIG_REG,
@@ -422,8 +418,6 @@ static int qcom_pmic_typec_pdphy_disable(struct pmic_typec_pdphy *pmic_typec_pdp · 31 unmodified lines
422418 ret = regmap_write(pmic_typec_pdphy->regmap,
423419 pmic_typec_pdphy->base + USB_PDPHY_EN_CONTROL_REG, 0);
424420
425− regulator_disable(pmic_typec_pdphy->vdd_pdphy);
426−
427421 return ret;
428422 }
429423
@@ -447,6 +441,10 @@ int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy, · 17 unmodified lines
447441 int i;
448442 int ret;
449443
444+ ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy);
445+ if (ret)
446+ return ret;
447+
450448 pmic_typec_pdphy->tcpm_port = tcpm_port;
451449
452450 ret = pmic_typec_pdphy_reset(pmic_typec_pdphy);
@@ -467,6 +465,8 @@ void qcom_pmic_typec_pdphy_stop(struct pmic_typec_pdphy *pmic_typec_pdphy) · 14 unmodified lines
467465 disable_irq(pmic_typec_pdphy->irq_data[i].irq);
468466
469467 qcom_pmic_typec_pdphy_reset_on(pmic_typec_pdphy);
468+
469+ regulator_disable(pmic_typec_pdphy->vdd_pdphy);
470470 }
471471
472472 struct pmic_typec_pdphy *qcom_pmic_typec_pdphy_alloc(struct device *dev)
drivers/usb/typec/ucsi/psy.c+9−0
@@ -37,6 +37,15 @@ static int ucsi_psy_get_scope(struct ucsi_connector *con, · 36 unmodified lines
3737 struct device *dev = con->ucsi->dev;
3838
3939 device_property_read_u8(dev, "scope", &scope);
40+ if (scope == POWER_SUPPLY_SCOPE_UNKNOWN) {
41+ u32 mask = UCSI_CAP_ATTR_POWER_AC_SUPPLY |
42+ UCSI_CAP_ATTR_BATTERY_CHARGING;
43+
44+ if (con->ucsi->cap.attributes & mask)
45+ scope = POWER_SUPPLY_SCOPE_SYSTEM;
46+ else
47+ scope = POWER_SUPPLY_SCOPE_DEVICE;
48+ }
4049 val->intval = scope;
4150 return 0;
4251 }
drivers/usb/typec/ucsi/ucsi.c+2−0
@@ -787,6 +787,7 @@ static void ucsi_unregister_partner(struct ucsi_connector *con) · 786 unmodified lines
787787
788788 typec_set_mode(con->port, TYPEC_STATE_SAFE);
789789
790+ typec_partner_set_usb_power_delivery(con->partner, NULL);
790791 ucsi_unregister_partner_pdos(con);
791792 ucsi_unregister_altmodes(con, UCSI_RECIPIENT_SOP);
792793 typec_unregister_partner(con->partner);
@@ -884,6 +885,7 @@ static void ucsi_handle_connector_change(struct work_struct *work) · 91 unmodified lines
884885 if (ret < 0) {
885886 dev_err(ucsi->dev, "%s: GET_CONNECTOR_STATUS failed (%d)\n",
886887 __func__, ret);
888+ clear_bit(EVENT_PENDING, &con->ucsi->flags);
887889 goto out_unlock;
888890 }
889891
drivers/vhost/vringh.c+11−1
@@ -123,8 +123,18 @@ static inline ssize_t vringh_iov_xfer(struct vringh *vrh, · 122 unmodified lines
123123 done += partlen;
124124 len -= partlen;
125125 ptr += partlen;
126+ iov->consumed += partlen;
127+ iov->iov[iov->i].iov_len -= partlen;
128+ iov->iov[iov->i].iov_base += partlen;
126129
127− vringh_kiov_advance(iov, partlen);
130+ if (!iov->iov[iov->i].iov_len) {
131+ /* Fix up old iov element then increment. */
132+ iov->iov[iov->i].iov_len = iov->consumed;
133+ iov->iov[iov->i].iov_base -= iov->consumed;
134+
135+ iov->consumed = 0;
136+ iov->i++;
137+ }
128138 }
129139 return done;
130140 }
drivers/xen/events/events_base.c+46−41
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <linux/slab.h>
3434 #include <linux/irqnr.h>
3535 #include <linux/pci.h>
36+#include <linux/rcupdate.h>
3637 #include <linux/spinlock.h>
3738 #include <linux/cpuhotplug.h>
3839 #include <linux/atomic.h>
@@ -96,6 +97,7 @@ enum xen_irq_type { · 57 unmodified lines
9697 struct irq_info {
9798 struct list_head list;
9899 struct list_head eoi_list;
100+ struct rcu_work rwork;
99101 short refcnt;
100102 u8 spurious_cnt;
101103 u8 is_accounted;
@@ -146,23 +148,13 @@ const struct evtchn_ops *evtchn_ops; · 44 unmodified lines
146148 */
147149 static DEFINE_MUTEX(irq_mapping_update_lock);
148150
149−/*
150− * Lock protecting event handling loop against removing event channels.
151− * Adding of event channels is no issue as the associated IRQ becomes active
152− * only after everything is setup (before request_[threaded_]irq() the handler
153− * can't be entered for an event, as the event channel will be unmasked only
154− * then).
155− */
156−static DEFINE_RWLOCK(evtchn_rwlock);
157−
158151 /*
159152 * Lock hierarchy:
160153 *
161154 * irq_mapping_update_lock
162− * evtchn_rwlock
163− * IRQ-desc lock
164− * percpu eoi_list_lock
165− * irq_info->lock
155+ * IRQ-desc lock
156+ * percpu eoi_list_lock
157+ * irq_info->lock
166158 */
167159
168160 static LIST_HEAD(xen_irq_list_head);
@@ -306,6 +298,22 @@ static void channels_on_cpu_inc(struct irq_info *info) · 137 unmodified lines
306298 info->is_accounted = 1;
307299 }
308300
301+static void delayed_free_irq(struct work_struct *work)
302+{
303+ struct irq_info *info = container_of(to_rcu_work(work), struct irq_info,
304+ rwork);
305+ unsigned int irq = info->irq;
306+
307+ /* Remove the info pointer only now, with no potential users left. */
308+ set_info_for_irq(irq, NULL);
309+
310+ kfree(info);
311+
312+ /* Legacy IRQ descriptors are managed by the arch. */
313+ if (irq >= nr_legacy_irqs())
314+ irq_free_desc(irq);
315+}
316+
309317 /* Constructors for packed IRQ information. */
310318 static int xen_irq_info_common_setup(struct irq_info *info,
311319 unsigned irq,
@@ -668,33 +676,36 @@ static void xen_irq_lateeoi_worker(struct work_struct *work) · 356 unmodified lines
668676
669677 eoi = container_of(to_delayed_work(work), struct lateeoi_work, delayed);
670678
671− read_lock_irqsave(&evtchn_rwlock, flags);
679+ rcu_read_lock();
672680
673681 while (true) {
674− spin_lock(&eoi->eoi_list_lock);
682+ spin_lock_irqsave(&eoi->eoi_list_lock, flags);
675683
676684 info = list_first_entry_or_null(&eoi->eoi_list, struct irq_info,
677685 eoi_list);
678686
679− if (info == NULL || now < info->eoi_time) {
680− spin_unlock(&eoi->eoi_list_lock);
687+ if (info == NULL)
688+ break;
689+
690+ if (now < info->eoi_time) {
691+ mod_delayed_work_on(info->eoi_cpu, system_wq,
692+ &eoi->delayed,
693+ info->eoi_time - now);
681694 break;
682695 }
683696
684697 list_del_init(&info->eoi_list);
685698
686− spin_unlock(&eoi->eoi_list_lock);
699+ spin_unlock_irqrestore(&eoi->eoi_list_lock, flags);
687700
688701 info->eoi_time = 0;
689702
690703 xen_irq_lateeoi_locked(info, false);
691704 }
692705
693− if (info)
694− mod_delayed_work_on(info->eoi_cpu, system_wq,
695− &eoi->delayed, info->eoi_time - now);
706+ spin_unlock_irqrestore(&eoi->eoi_list_lock, flags);
696707
697− read_unlock_irqrestore(&evtchn_rwlock, flags);
708+ rcu_read_unlock();
698709 }
699710
700711 static void xen_cpu_init_eoi(unsigned int cpu)
@@ -709,16 +720,15 @@ static void xen_cpu_init_eoi(unsigned int cpu) · 8 unmodified lines
709720 void xen_irq_lateeoi(unsigned int irq, unsigned int eoi_flags)
710721 {
711722 struct irq_info *info;
712− unsigned long flags;
713723
714− read_lock_irqsave(&evtchn_rwlock, flags);
724+ rcu_read_lock();
715725
716726 info = info_for_irq(irq);
717727
718728 if (info)
719729 xen_irq_lateeoi_locked(info, eoi_flags & XEN_EOI_FLAG_SPURIOUS);
720730
721− read_unlock_irqrestore(&evtchn_rwlock, flags);
731+ rcu_read_unlock();
722732 }
723733 EXPORT_SYMBOL_GPL(xen_irq_lateeoi);
724734
@@ -732,6 +742,7 @@ static void xen_irq_init(unsigned irq) · 7 unmodified lines
732742
733743 info->type = IRQT_UNBOUND;
734744 info->refcnt = -1;
745+ INIT_RCU_WORK(&info->rwork, delayed_free_irq);
735746
736747 set_info_for_irq(irq, info);
737748 /*
@@ -789,31 +800,18 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi) · 51 unmodified lines
789800 static void xen_free_irq(unsigned irq)
790801 {
791802 struct irq_info *info = info_for_irq(irq);
792− unsigned long flags;
793803
794804 if (WARN_ON(!info))
795805 return;
796806
797− write_lock_irqsave(&evtchn_rwlock, flags);
798−
799807 if (!list_empty(&info->eoi_list))
800808 lateeoi_list_del(info);
801809
802810 list_del(&info->list);
803811
804− set_info_for_irq(irq, NULL);
805−
806812 WARN_ON(info->refcnt > 0);
807813
808− write_unlock_irqrestore(&evtchn_rwlock, flags);
809−
810− kfree(info);
811−
812− /* Legacy IRQ descriptors are managed by the arch. */
813− if (irq < nr_legacy_irqs())
814− return;
815−
816− irq_free_desc(irq);
814+ queue_rcu_work(system_wq, &info->rwork);
817815 }
818816
819817 /* Not called for lateeoi events. */
@@ -1711,7 +1709,14 @@ int xen_evtchn_do_upcall(void) · 891 unmodified lines
17111709 int cpu = smp_processor_id();
17121710 struct evtchn_loop_ctrl ctrl = { 0 };
17131711
1714− read_lock(&evtchn_rwlock);
1712+ /*
1713+ * When closing an event channel the associated IRQ must not be freed
1714+ * until all cpus have left the event handling loop. This is ensured
1715+ * by taking the rcu_read_lock() while handling events, as freeing of
1716+ * the IRQ is handled via queue_rcu_work() _after_ closing the event
1717+ * channel.
1718+ */
1719+ rcu_read_lock();
17151720
17161721 do {
17171722 vcpu_info->evtchn_upcall_pending = 0;
@@ -1724,7 +1729,7 @@ int xen_evtchn_do_upcall(void) · 6 unmodified lines
17241729
17251730 } while (vcpu_info->evtchn_upcall_pending);
17261731
1727− read_unlock(&evtchn_rwlock);
1732+ rcu_read_unlock();
17281733
17291734 /*
17301735 * Increment irq_epoch only now to defer EOIs only for
fs/btrfs/ctree.c+39−13
@@ -682,18 +682,30 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans, · 681 unmodified lines
682682 u64 search_start;
683683 int ret;
684684
685− if (test_bit(BTRFS_ROOT_DELETING, &root->state))
686− btrfs_err(fs_info,
687− "COW'ing blocks on a fs root that's being dropped");
688−
689− if (trans->transaction != fs_info->running_transaction)
690− WARN(1, KERN_CRIT "trans %llu running %llu\n",
691− trans->transid,
692− fs_info->running_transaction->transid);
685+ if (unlikely(test_bit(BTRFS_ROOT_DELETING, &root->state))) {
686+ btrfs_abort_transaction(trans, -EUCLEAN);
687+ btrfs_crit(fs_info,
688+ "attempt to COW block %llu on root %llu that is being deleted",
689+ buf->start, btrfs_root_id(root));
690+ return -EUCLEAN;
691+ }
693692
694− if (trans->transid != fs_info->generation)
695− WARN(1, KERN_CRIT "trans %llu running %llu\n",
696− trans->transid, fs_info->generation);
693+ /*
694+ * COWing must happen through a running transaction, which always
695+ * matches the current fs generation (it's a transaction with a state
696+ * less than TRANS_STATE_UNBLOCKED). If it doesn't, then turn the fs
697+ * into error state to prevent the commit of any transaction.
698+ */
699+ if (unlikely(trans->transaction != fs_info->running_transaction ||
700+ trans->transid != fs_info->generation)) {
701+ btrfs_abort_transaction(trans, -EUCLEAN);
702+ btrfs_crit(fs_info,
703+"unexpected transaction when attempting to COW block %llu on root %llu, transaction %llu running transaction %llu fs generation %llu",
704+ buf->start, btrfs_root_id(root), trans->transid,
705+ fs_info->running_transaction->transid,
706+ fs_info->generation);
707+ return -EUCLEAN;
708+ }
697709
698710 if (!should_cow_block(trans, root, buf)) {
699711 *cow_ret = buf;
@@ -805,8 +817,22 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans, · 105 unmodified lines
805817 int progress_passed = 0;
806818 struct btrfs_disk_key disk_key;
807819
808− WARN_ON(trans->transaction != fs_info->running_transaction);
809− WARN_ON(trans->transid != fs_info->generation);
820+ /*
821+ * COWing must happen through a running transaction, which always
822+ * matches the current fs generation (it's a transaction with a state
823+ * less than TRANS_STATE_UNBLOCKED). If it doesn't, then turn the fs
824+ * into error state to prevent the commit of any transaction.
825+ */
826+ if (unlikely(trans->transaction != fs_info->running_transaction ||
827+ trans->transid != fs_info->generation)) {
828+ btrfs_abort_transaction(trans, -EUCLEAN);
829+ btrfs_crit(fs_info,
830+"unexpected transaction when attempting to reallocate parent %llu for root %llu, transaction %llu running transaction %llu fs generation %llu",
831+ parent->start, btrfs_root_id(root), trans->transid,
832+ fs_info->running_transaction->transid,
833+ fs_info->generation);
834+ return -EUCLEAN;
835+ }
810836
811837 parent_nritems = btrfs_header_nritems(parent);
812838 blocksize = fs_info->nodesize;
fs/btrfs/delayed-inode.c+1−1
@@ -313,7 +313,7 @@ static struct btrfs_delayed_item *btrfs_alloc_delayed_item(u16 data_len, · 312 unmodified lines
313313 {
314314 struct btrfs_delayed_item *item;
315315
316− item = kmalloc(sizeof(*item) + data_len, GFP_NOFS);
316+ item = kmalloc(struct_size(item, data, data_len), GFP_NOFS);
317317 if (item) {
318318 item->data_len = data_len;
319319 item->type = type;
fs/btrfs/delayed-inode.h+1−1
@@ -95,7 +95,7 @@ struct btrfs_delayed_item { · 94 unmodified lines
9595 bool logged;
9696 /* The maximum leaf size is 64K, so u16 is more than enough. */
9797 u16 data_len;
98− char data[];
98+ char data[] __counted_by(data_len);
9999 };
100100
101101 static inline void btrfs_init_delayed_root(
fs/btrfs/ioctl.c+2−2
@@ -2978,7 +2978,7 @@ static void get_block_group_info(struct list_head *groups_list, · 2977 unmodified lines
29782978 static long btrfs_ioctl_space_info(struct btrfs_fs_info *fs_info,
29792979 void __user *arg)
29802980 {
2981− struct btrfs_ioctl_space_args space_args;
2981+ struct btrfs_ioctl_space_args space_args = { 0 };
29822982 struct btrfs_ioctl_space_info space;
29832983 struct btrfs_ioctl_space_info *dest;
29842984 struct btrfs_ioctl_space_info *dest_orig;
@@ -4338,7 +4338,7 @@ static int _btrfs_ioctl_send(struct inode *inode, void __user *argp, bool compat · 1353 unmodified lines
43384338
43394339 if (compat) {
43404340 #if defined(CONFIG_64BIT) && defined(CONFIG_COMPAT)
4341− struct btrfs_ioctl_send_args_32 args32;
4341+ struct btrfs_ioctl_send_args_32 args32 = { 0 };
43424342
43434343 ret = copy_from_user(&args32, argp, sizeof(args32));
43444344 if (ret)
fs/btrfs/transaction.h+2−2
@@ -219,8 +219,8 @@ do { \ · 218 unmodified lines
219219 (errno))) { \
220220 /* Stack trace printed. */ \
221221 } else { \
222− btrfs_debug((trans)->fs_info, \
223− "Transaction aborted (error %d)", \
222+ btrfs_err((trans)->fs_info, \
223+ "Transaction aborted (error %d)", \
224224 (errno)); \
225225 } \
226226 } \
fs/ceph/crypto.c+1−1
@@ -460,7 +460,7 @@ int ceph_fname_to_usr(const struct ceph_fname *fname, struct fscrypt_str *tname, · 459 unmodified lines
460460 out:
461461 fscrypt_fname_free_buffer(&_tname);
462462 out_inode:
463− if ((dir != fname->dir) && !IS_ERR(dir)) {
463+ if (dir != fname->dir) {
464464 if ((dir->i_state & I_NEW))
465465 discard_new_inode(dir);
466466 else
fs/ceph/file.c+1−1
@@ -2969,7 +2969,7 @@ static ssize_t __ceph_copy_file_range(struct file *src_file, loff_t src_off, · 2968 unmodified lines
29692969 ret = do_splice_direct(src_file, &src_off, dst_file,
29702970 &dst_off, src_objlen, flags);
29712971 /* Abort on short copies or on error */
2972− if (ret < src_objlen) {
2972+ if (ret < (long)src_objlen) {
29732973 dout("Failed partial copy (%zd)\n", ret);
29742974 goto out;
29752975 }
fs/ceph/inode.c+1−3
@@ -769,9 +769,7 @@ int ceph_fill_file_size(struct inode *inode, int issued, · 768 unmodified lines
769769 ci->i_truncate_seq = truncate_seq;
770770
771771 /* the MDS should have revoked these caps */
772− WARN_ON_ONCE(issued & (CEPH_CAP_FILE_EXCL |
773− CEPH_CAP_FILE_RD |
774− CEPH_CAP_FILE_WR |
772+ WARN_ON_ONCE(issued & (CEPH_CAP_FILE_RD |
775773 CEPH_CAP_FILE_LAZYIO));
776774 /*
777775 * If we hold relevant caps, or in the case where we're
fs/erofs/decompressor_lzma.c+4−1
@@ -217,9 +217,12 @@ again: · 216 unmodified lines
217217 strm->buf.out_size = min_t(u32, outlen,
218218 PAGE_SIZE - pageofs);
219219 outlen -= strm->buf.out_size;
220− if (!rq->out[no] && rq->fillgaps) /* deduped */
220+ if (!rq->out[no] && rq->fillgaps) { /* deduped */
221221 rq->out[no] = erofs_allocpage(pagepool,
222222 GFP_KERNEL | __GFP_NOFAIL);
223+ set_page_private(rq->out[no],
224+ Z_EROFS_SHORTLIVED_PAGE);
225+ }
223226 if (rq->out[no])
224227 strm->buf.out = kmap(rq->out[no]) + pageofs;
225228 pageofs = 0;
fs/erofs/super.c+1−1
@@ -235,7 +235,7 @@ static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb, · 234 unmodified lines
235235 return PTR_ERR(ptr);
236236 dis = ptr + erofs_blkoff(sb, *pos);
237237
238− if (!dif->path) {
238+ if (!sbi->devs->flatdev && !dif->path) {
239239 if (!dis->tag[0]) {
240240 erofs_err(sb, "empty device tag @ pos %llu", *pos);
241241 return -EINVAL;
fs/fs_context.c+29−5
@@ -192,17 +192,19 @@ int vfs_parse_fs_string(struct fs_context *fc, const char *key, · 191 unmodified lines
192192 EXPORT_SYMBOL(vfs_parse_fs_string);
193193
194194 /**
195− * generic_parse_monolithic - Parse key[=val][,key[=val]]* mount data
195+ * vfs_parse_monolithic_sep - Parse key[=val][,key[=val]]* mount data
196196 * @fc: The superblock configuration to fill in.
197197 * @data: The data to parse
198+ * @sep: callback for separating next option
198199 *
199− * Parse a blob of data that's in key[=val][,key[=val]]* form. This can be
200− * called from the ->monolithic_mount_data() fs_context operation.
200+ * Parse a blob of data that's in key[=val][,key[=val]]* form with a custom
201+ * option separator callback.
201202 *
202203 * Returns 0 on success or the error returned by the ->parse_option() fs_context
203204 * operation on failure.
204205 */
205−int generic_parse_monolithic(struct fs_context *fc, void *data)
206+int vfs_parse_monolithic_sep(struct fs_context *fc, void *data,
207+ char *(*sep)(char **))
206208 {
207209 char *options = data, *key;
208210 int ret = 0;
@@ -214,7 +216,7 @@ int generic_parse_monolithic(struct fs_context *fc, void *data) · 5 unmodified lines
214216 if (ret)
215217 return ret;
216218
217− while ((key = strsep(&options, ",")) != NULL) {
219+ while ((key = sep(&options)) != NULL) {
218220 if (*key) {
219221 size_t v_len = 0;
220222 char *value = strchr(key, '=');
@@ -233,6 +235,28 @@ int generic_parse_monolithic(struct fs_context *fc, void *data) · 12 unmodified lines
233235
234236 return ret;
235237 }
238+EXPORT_SYMBOL(vfs_parse_monolithic_sep);
239+
240+static char *vfs_parse_comma_sep(char **s)
241+{
242+ return strsep(s, ",");
243+}
244+
245+/**
246+ * generic_parse_monolithic - Parse key[=val][,key[=val]]* mount data
247+ * @fc: The superblock configuration to fill in.
248+ * @data: The data to parse
249+ *
250+ * Parse a blob of data that's in key[=val][,key[=val]]* form. This can be
251+ * called from the ->monolithic_mount_data() fs_context operation.
252+ *
253+ * Returns 0 on success or the error returned by the ->parse_option() fs_context
254+ * operation on failure.
255+ */
256+int generic_parse_monolithic(struct fs_context *fc, void *data)
257+{
258+ return vfs_parse_monolithic_sep(fc, data, vfs_parse_comma_sep);
259+}
236260 EXPORT_SYMBOL(generic_parse_monolithic);
237261
238262 /**
fs/nfs/nfs4proc.c+3−1
@@ -10622,7 +10622,9 @@ static void nfs4_disable_swap(struct inode *inode) · 10621 unmodified lines
1062210622 */
1062310623 struct nfs_client *clp = NFS_SERVER(inode)->nfs_client;
1062410624
10625− nfs4_schedule_state_manager(clp);
10625+ set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
10626+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
10627+ wake_up_var(&clp->cl_state);
1062610628 }
1062710629
1062810630 static const struct inode_operations nfs4_dir_inode_operations = {
fs/nfs/nfs4state.c+33−12
@@ -1209,16 +1209,26 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) · 1208 unmodified lines
12091209 {
12101210 struct task_struct *task;
12111211 char buf[INET6_ADDRSTRLEN + sizeof("-manager") + 1];
1212+ struct rpc_clnt *clnt = clp->cl_rpcclient;
1213+ bool swapon = false;
12121214
1213− if (clp->cl_rpcclient->cl_shutdown)
1215+ if (clnt->cl_shutdown)
12141216 return;
12151217
12161218 set_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state);
1217− if (test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) != 0) {
1218− wake_up_var(&clp->cl_state);
1219− return;
1219+
1220+ if (atomic_read(&clnt->cl_swapper)) {
1221+ swapon = !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE,
1222+ &clp->cl_state);
1223+ if (!swapon) {
1224+ wake_up_var(&clp->cl_state);
1225+ return;
1226+ }
12201227 }
1221− set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
1228+
1229+ if (test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) != 0)
1230+ return;
1231+
12221232 __module_get(THIS_MODULE);
12231233 refcount_inc(&clp->cl_count);
12241234
@@ -1235,8 +1245,9 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) · 10 unmodified lines
12351245 __func__, PTR_ERR(task));
12361246 if (!nfs_client_init_is_complete(clp))
12371247 nfs_mark_client_ready(clp, PTR_ERR(task));
1248+ if (swapon)
1249+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
12381250 nfs4_clear_state_manager_bit(clp);
1239− clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
12401251 nfs_put_client(clp);
12411252 module_put(THIS_MODULE);
12421253 }
@@ -2703,6 +2714,13 @@ static void nfs4_state_manager(struct nfs_client *clp) · 1460 unmodified lines
27032714 nfs4_end_drain_session(clp);
27042715 nfs4_clear_state_manager_bit(clp);
27052716
2717+ if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2718+ !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING,
2719+ &clp->cl_state)) {
2720+ memflags = memalloc_nofs_save();
2721+ continue;
2722+ }
2723+
27062724 if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) {
27072725 if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) {
27082726 nfs_client_return_marked_delegations(clp);
@@ -2741,22 +2759,25 @@ static int nfs4_run_state_manager(void *ptr) · 32 unmodified lines
27412759
27422760 allow_signal(SIGKILL);
27432761 again:
2744− set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state);
27452762 nfs4_state_manager(clp);
2746− if (atomic_read(&cl->cl_swapper)) {
2763+
2764+ if (test_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state) &&
2765+ !test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state)) {
27472766 wait_var_event_interruptible(&clp->cl_state,
27482767 test_bit(NFS4CLNT_RUN_MANAGER,
27492768 &clp->cl_state));
2750− if (atomic_read(&cl->cl_swapper) &&
2751− test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state))
2769+ if (!atomic_read(&cl->cl_swapper))
2770+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
2771+ if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
2772+ !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
27522773 goto again;
27532774 /* Either no longer a swapper, or were signalled */
2775+ clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
27542776 }
2755− clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state);
27562777
27572778 if (refcount_read(&clp->cl_count) > 1 && !signalled() &&
27582779 test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) &&
2759− !test_and_set_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state))
2780+ !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state))
27602781 goto again;
27612782
27622783 nfs_put_client(clp);
fs/nfs/write.c+1−1
@@ -802,8 +802,8 @@ static void nfs_inode_remove_request(struct nfs_page *req) · 801 unmodified lines
802802 }
803803
804804 if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) {
805− nfs_release_request(req);
806805 atomic_long_dec(&NFS_I(nfs_page_to_inode(req))->nrequests);
806+ nfs_release_request(req);
807807 }
808808 }
809809
fs/overlayfs/export.c+1−1
@@ -188,7 +188,7 @@ static int ovl_check_encode_origin(struct dentry *dentry) · 187 unmodified lines
188188
189189 /* Lower file handle for non-upper non-decodable */
190190 if (!ovl_dentry_upper(dentry) && !decodable)
191− return 0;
191+ return 1;
192192
193193 /* Upper file handle for pure upper */
194194 if (!ovl_dentry_lower(dentry))
fs/overlayfs/file.c+0−2
@@ -341,7 +341,6 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) · 340 unmodified lines
341341 if (!aio_req)
342342 goto out;
343343
344− real.flags = 0;
345344 aio_req->orig_iocb = iocb;
346345 kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
347346 aio_req->iocb.ki_complete = ovl_aio_rw_complete;
@@ -413,7 +412,6 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 65 unmodified lines
413412 if (!aio_req)
414413 goto out;
415414
416− real.flags = 0;
417415 aio_req->orig_iocb = iocb;
418416 kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
419417 aio_req->iocb.ki_flags = ifl;
fs/overlayfs/ovl_entry.h+1−9
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 struct ovl_config {
99 char *upperdir;
1010 char *workdir;
11+ char **lowerdirs;
1112 bool default_permissions;
1213 int redirect_mode;
1314 int verity_mode;
@@ -39,17 +40,8 @@ struct ovl_layer { · 25 unmodified lines
3940 int idx;
4041 /* One fsid per unique underlying sb (upper fsid == 0) */
4142 int fsid;
42− char *name;
4343 };
4444
45−/*
46− * ovl_free_fs() relies on @mnt being the first member when unmounting
47− * the private mounts created for each layer. Let's check both the
48− * offset and type.
49− */
50−static_assert(offsetof(struct ovl_layer, mnt) == 0);
51−static_assert(__same_type(typeof_member(struct ovl_layer, mnt), struct vfsmount *));
52−
5345 struct ovl_path {
5446 const struct ovl_layer *layer;
5547 struct dentry *dentry;
fs/overlayfs/params.c+59−67
@@ -157,6 +157,34 @@ const struct fs_parameter_spec ovl_parameter_spec[] = { · 156 unmodified lines
157157 {}
158158 };
159159
160+static char *ovl_next_opt(char **s)
161+{
162+ char *sbegin = *s;
163+ char *p;
164+
165+ if (sbegin == NULL)
166+ return NULL;
167+
168+ for (p = sbegin; *p; p++) {
169+ if (*p == '\\') {
170+ p++;
171+ if (!*p)
172+ break;
173+ } else if (*p == ',') {
174+ *p = '\0';
175+ *s = p + 1;
176+ return sbegin;
177+ }
178+ }
179+ *s = NULL;
180+ return sbegin;
181+}
182+
183+static int ovl_parse_monolithic(struct fs_context *fc, void *data)
184+{
185+ return vfs_parse_monolithic_sep(fc, data, ovl_next_opt);
186+}
187+
160188 static ssize_t ovl_parse_param_split_lowerdirs(char *str)
161189 {
162190 ssize_t nr_layers = 1, nr_colons = 0;
@@ -164,7 +192,8 @@ static ssize_t ovl_parse_param_split_lowerdirs(char *str) · 1 unmodified line
164192
165193 for (s = d = str;; s++, d++) {
166194 if (*s == '\\') {
167− s++;
195+ /* keep esc chars in split lowerdir */
196+ *d++ = *s++;
168197 } else if (*s == ':') {
169198 bool next_colon = (*(s + 1) == ':');
170199
@@ -239,7 +268,7 @@ static void ovl_unescape(char *s) · 68 unmodified lines
239268 }
240269 }
241270
242−static int ovl_mount_dir(const char *name, struct path *path)
271+static int ovl_mount_dir(const char *name, struct path *path, bool upper)
243272 {
244273 int err = -ENOMEM;
245274 char *tmp = kstrdup(name, GFP_KERNEL);
@@ -248,7 +277,7 @@ static int ovl_mount_dir(const char *name, struct path *path) · 2 unmodified lines
248277 ovl_unescape(tmp);
249278 err = ovl_mount_dir_noesc(tmp, path);
250279
251− if (!err && path->dentry->d_flags & DCACHE_OP_REAL) {
280+ if (!err && upper && path->dentry->d_flags & DCACHE_OP_REAL) {
252281 pr_err("filesystem on '%s' not supported as upperdir\n",
253282 tmp);
254283 path_put_init(path);
@@ -269,7 +298,7 @@ static int ovl_parse_param_upperdir(const char *name, struct fs_context *fc, · 14 unmodified lines
269298 struct path path;
270299 char *dup;
271300
272− err = ovl_mount_dir(name, &path);
301+ err = ovl_mount_dir(name, &path, true);
273302 if (err)
274303 return err;
275304
@@ -321,12 +350,6 @@ static void ovl_parse_param_drop_lowerdir(struct ovl_fs_context *ctx) · 45 unmodified lines
321350 * Set "/lower1", "/lower2", and "/lower3" as lower layers and
322351 * "/data1" and "/data2" as data lower layers. Any existing lower
323352 * layers are replaced.
324− * (2) lowerdir=:/lower4
325− * Append "/lower4" to current stack of lower layers. This requires
326− * that there already is at least one lower layer configured.
327− * (3) lowerdir=::/lower5
328− * Append data "/lower5" as data lower layer. This requires that
329− * there's at least one regular lower layer present.
330353 */
331354 static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc)
332355 {
@@ -348,49 +371,9 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) · 15 unmodified lines
348371 return 0;
349372 }
350373
351− if (strncmp(name, "::", 2) == 0) {
352− /*
353− * This is a data layer.
354− * There must be at least one regular lower layer
355− * specified.
356− */
357− if (ctx->nr == 0) {
358− pr_err("data lower layers without regular lower layers not allowed");
359− return -EINVAL;
360− }
361−
362− /* Skip the leading "::". */
363− name += 2;
364− data_layer = true;
365− /*
366− * A data layer is automatically an append as there
367− * must've been at least one regular lower layer.
368− */
369− append = true;
370− } else if (*name == ':') {
371− /*
372− * This is a regular lower layer.
373− * If users want to append a layer enforce that they
374− * have already specified a first layer before. It's
375− * better to be strict.
376− */
377− if (ctx->nr == 0) {
378− pr_err("cannot append layer if no previous layer has been specified");
379− return -EINVAL;
380− }
381−
382− /*
383− * Once a sequence of data layers has started regular
384− * lower layers are forbidden.
385− */
386− if (ctx->nr_data > 0) {
387− pr_err("regular lower layers cannot follow data lower layers");
388− return -EINVAL;
389− }
390−
391− /* Skip the leading ":". */
392− name++;
393− append = true;
374+ if (*name == ':') {
375+ pr_err("cannot append lower layer");
376+ return -EINVAL;
394377 }
395378
396379 dup = kstrdup(name, GFP_KERNEL);
@@ -472,7 +455,7 @@ static int ovl_parse_param_lowerdir(const char *name, struct fs_context *fc) · 75 unmodified lines
472455 l = &ctx->lower[nr];
473456 memset(l, 0, sizeof(*l));
474457
475− err = ovl_mount_dir_noesc(dup_iter, &l->path);
458+ err = ovl_mount_dir(dup_iter, &l->path, false);
476459 if (err)
477460 goto out_put;
478461
@@ -682,6 +665,7 @@ static int ovl_reconfigure(struct fs_context *fc) · 203 unmodified lines
682665 }
683666
684667 static const struct fs_context_operations ovl_context_ops = {
668+ .parse_monolithic = ovl_parse_monolithic,
685669 .parse_param = ovl_parse_param,
686670 .get_tree = ovl_get_tree,
687671 .reconfigure = ovl_reconfigure,
@@ -752,12 +736,12 @@ void ovl_free_fs(struct ovl_fs *ofs) · 64 unmodified lines
752736 if (ofs->upperdir_locked)
753737 ovl_inuse_unlock(ovl_upper_mnt(ofs)->mnt_root);
754738
755− /* Hack! Reuse ofs->layers as a vfsmount array before freeing it */
756− mounts = (struct vfsmount **) ofs->layers;
739+ /* Reuse ofs->config.lowerdirs as a vfsmount array before freeing it */
740+ mounts = (struct vfsmount **) ofs->config.lowerdirs;
757741 for (i = 0; i < ofs->numlayer; i++) {
758742 iput(ofs->layers[i].trap);
743+ kfree(ofs->config.lowerdirs[i]);
759744 mounts[i] = ofs->layers[i].mnt;
760− kfree(ofs->layers[i].name);
761745 }
762746 kern_unmount_array(mounts, ofs->numlayer);
763747 kfree(ofs->layers);
@@ -765,6 +749,7 @@ void ovl_free_fs(struct ovl_fs *ofs) · 1 unmodified line
765749 free_anon_bdev(ofs->fs[i].pseudo_dev);
766750 kfree(ofs->fs);
767751
752+ kfree(ofs->config.lowerdirs);
768753 kfree(ofs->config.upperdir);
769754 kfree(ofs->config.workdir);
770755 if (ofs->creator_cred)
@@ -949,16 +934,23 @@ int ovl_show_options(struct seq_file *m, struct dentry *dentry) · 178 unmodified lines
949934 struct super_block *sb = dentry->d_sb;
950935 struct ovl_fs *ofs = OVL_FS(sb);
951936 size_t nr, nr_merged_lower = ofs->numlayer - ofs->numdatalayer;
952− const struct ovl_layer *data_layers = &ofs->layers[nr_merged_lower];
953−
954− /* ofs->layers[0] is the upper layer */
955− seq_printf(m, ",lowerdir=%s", ofs->layers[1].name);
956− /* dump regular lower layers */
957− for (nr = 2; nr < nr_merged_lower; nr++)
958− seq_printf(m, ":%s", ofs->layers[nr].name);
959− /* dump data lower layers */
960− for (nr = 0; nr < ofs->numdatalayer; nr++)
961− seq_printf(m, "::%s", data_layers[nr].name);
937+
938+ /*
939+ * lowerdirs[] starts from offset 1, then
940+ * >= 0 regular lower layers prefixed with : and
941+ * >= 0 data-only lower layers prefixed with ::
942+ *
943+ * we need to escase comma and space like seq_show_option() does and
944+ * we also need to escape the colon separator from lowerdir paths.
945+ */
946+ seq_puts(m, ",lowerdir=");
947+ for (nr = 1; nr < ofs->numlayer; nr++) {
948+ if (nr > 1)
949+ seq_putc(m, ':');
950+ if (nr >= nr_merged_lower)
951+ seq_putc(m, ':');
952+ seq_escape(m, ofs->config.lowerdirs[nr], ":, \t\n\\");
953+ }
962954 if (ofs->config.upperdir) {
963955 seq_show_option(m, "upperdir", ofs->config.upperdir);
964956 seq_show_option(m, "workdir", ofs->config.workdir);
fs/overlayfs/super.c+17−10
@@ -104,8 +104,8 @@ static int ovl_revalidate_real(struct dentry *d, unsigned int flags, bool weak) · 103 unmodified lines
104104 static int ovl_dentry_revalidate_common(struct dentry *dentry,
105105 unsigned int flags, bool weak)
106106 {
107− struct ovl_entry *oe = OVL_E(dentry);
108− struct ovl_path *lowerstack = ovl_lowerstack(oe);
107+ struct ovl_entry *oe;
108+ struct ovl_path *lowerstack;
109109 struct inode *inode = d_inode_rcu(dentry);
110110 struct dentry *upper;
111111 unsigned int i;
@@ -115,6 +115,8 @@ static int ovl_dentry_revalidate_common(struct dentry *dentry, · 3 unmodified lines
115115 if (!inode)
116116 return -ECHILD;
117117
118+ oe = OVL_I_E(inode);
119+ lowerstack = ovl_lowerstack(oe);
118120 upper = ovl_i_dentry_upper(inode);
119121 if (upper)
120122 ret = ovl_revalidate_real(upper, flags, weak);
@@ -167,6 +169,7 @@ static void ovl_free_inode(struct inode *inode) · 46 unmodified lines
167169 struct ovl_inode *oi = OVL_I(inode);
168170
169171 kfree(oi->redirect);
172+ kfree(oi->oe);
170173 mutex_destroy(&oi->lock);
171174 kmem_cache_free(ovl_inode_cachep, oi);
172175 }
@@ -176,7 +179,7 @@ static void ovl_destroy_inode(struct inode *inode) · 3 unmodified lines
176179 struct ovl_inode *oi = OVL_I(inode);
177180
178181 dput(oi->__upperdentry);
179− ovl_free_entry(oi->oe);
182+ ovl_stack_put(ovl_lowerstack(oi->oe), ovl_numlower(oi->oe));
180183 if (S_ISDIR(inode->i_mode))
181184 ovl_dir_cache_free(inode);
182185 else
@@ -569,11 +572,6 @@ static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs, · 386 unmodified lines
569572 upper_layer->idx = 0;
570573 upper_layer->fsid = 0;
571574
572− err = -ENOMEM;
573− upper_layer->name = kstrdup(ofs->config.upperdir, GFP_KERNEL);
574− if (!upper_layer->name)
575− goto out;
576−
577575 /*
578576 * Inherit SB_NOSEC flag from upperdir.
579577 *
@@ -1122,7 +1120,8 @@ static int ovl_get_layers(struct super_block *sb, struct ovl_fs *ofs, · 542 unmodified lines
11221120 layers[ofs->numlayer].idx = ofs->numlayer;
11231121 layers[ofs->numlayer].fsid = fsid;
11241122 layers[ofs->numlayer].fs = &ofs->fs[fsid];
1125− layers[ofs->numlayer].name = l->name;
1123+ /* Store for printing lowerdir=... in ovl_show_options() */
1124+ ofs->config.lowerdirs[ofs->numlayer] = l->name;
11261125 l->name = NULL;
11271126 ofs->numlayer++;
11281127 ofs->fs[fsid].is_lower = true;
@@ -1367,8 +1366,16 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc) · 238 unmodified lines
13671366 if (!layers)
13681367 goto out_err;
13691368
1369+ ofs->config.lowerdirs = kcalloc(ctx->nr + 1, sizeof(char *), GFP_KERNEL);
1370+ if (!ofs->config.lowerdirs) {
1371+ kfree(layers);
1372+ goto out_err;
1373+ }
13701374 ofs->layers = layers;
1371− /* Layer 0 is reserved for upper even if there's no upper */
1375+ /*
1376+ * Layer 0 is reserved for upper even if there's no upper.
1377+ * For consistency, config.lowerdirs[0] is NULL.
1378+ */
13721379 ofs->numlayer = 1;
13731380
13741381 sb->s_stack_depth = 0;
fs/quota/dquot.c+39−27
@@ -233,19 +233,18 @@ static void put_quota_format(struct quota_format_type *fmt) · 232 unmodified lines
233233 * All dquots are placed to the end of inuse_list when first created, and this
234234 * list is used for invalidate operation, which must look at every dquot.
235235 *
236− * When the last reference of a dquot will be dropped, the dquot will be
237− * added to releasing_dquots. We'd then queue work item which would call
236+ * When the last reference of a dquot is dropped, the dquot is added to
237+ * releasing_dquots. We'll then queue work item which will call
238238 * synchronize_srcu() and after that perform the final cleanup of all the
239− * dquots on the list. Both releasing_dquots and free_dquots use the
240− * dq_free list_head in the dquot struct. When a dquot is removed from
241− * releasing_dquots, a reference count is always subtracted, and if
242− * dq_count == 0 at that point, the dquot will be added to the free_dquots.
239+ * dquots on the list. Each cleaned up dquot is moved to free_dquots list.
240+ * Both releasing_dquots and free_dquots use the dq_free list_head in the dquot
241+ * struct.
243242 *
244− * Unused dquots (dq_count == 0) are added to the free_dquots list when freed,
245− * and this list is searched whenever we need an available dquot. Dquots are
246− * removed from the list as soon as they are used again, and
247− * dqstats.free_dquots gives the number of dquots on the list. When
248− * dquot is invalidated it's completely released from memory.
243+ * Unused and cleaned up dquots are in the free_dquots list and this list is
244+ * searched whenever we need an available dquot. Dquots are removed from the
245+ * list as soon as they are used again and dqstats.free_dquots gives the number
246+ * of dquots on the list. When dquot is invalidated it's completely released
247+ * from memory.
249248 *
250249 * Dirty dquots are added to the dqi_dirty_list of quota_info when mark
251250 * dirtied, and this list is searched when writing dirty dquots back to
@@ -321,6 +320,7 @@ static inline void put_dquot_last(struct dquot *dquot) · 69 unmodified lines
321320 static inline void put_releasing_dquots(struct dquot *dquot)
322321 {
323322 list_add_tail(&dquot->dq_free, &releasing_dquots);
323+ set_bit(DQ_RELEASING_B, &dquot->dq_flags);
324324 }
325325
326326 static inline void remove_free_dquot(struct dquot *dquot)
@@ -328,8 +328,10 @@ static inline void remove_free_dquot(struct dquot *dquot) · 1 unmodified line
328328 if (list_empty(&dquot->dq_free))
329329 return;
330330 list_del_init(&dquot->dq_free);
331− if (!atomic_read(&dquot->dq_count))
331+ if (!test_bit(DQ_RELEASING_B, &dquot->dq_flags))
332332 dqstats_dec(DQST_FREE_DQUOTS);
333+ else
334+ clear_bit(DQ_RELEASING_B, &dquot->dq_flags);
333335 }
334336
335337 static inline void put_inuse(struct dquot *dquot)
@@ -581,12 +583,6 @@ restart: · 245 unmodified lines
581583 continue;
582584 /* Wait for dquot users */
583585 if (atomic_read(&dquot->dq_count)) {
584− /* dquot in releasing_dquots, flush and retry */
585− if (!list_empty(&dquot->dq_free)) {
586− spin_unlock(&dq_list_lock);
587− goto restart;
588− }
589−
590586 atomic_inc(&dquot->dq_count);
591587 spin_unlock(&dq_list_lock);
592588 /*
@@ -605,6 +601,15 @@ restart: · 12 unmodified lines
605601 * restart. */
606602 goto restart;
607603 }
604+ /*
605+ * The last user already dropped its reference but dquot didn't
606+ * get fully cleaned up yet. Restart the scan which flushes the
607+ * work cleaning up released dquots.
608+ */
609+ if (test_bit(DQ_RELEASING_B, &dquot->dq_flags)) {
610+ spin_unlock(&dq_list_lock);
611+ goto restart;
612+ }
608613 /*
609614 * Quota now has no users and it has been written on last
610615 * dqput()
@@ -696,6 +701,13 @@ int dquot_writeback_dquots(struct super_block *sb, int type) · 85 unmodified lines
696701 dq_dirty);
697702
698703 WARN_ON(!dquot_active(dquot));
704+ /* If the dquot is releasing we should not touch it */
705+ if (test_bit(DQ_RELEASING_B, &dquot->dq_flags)) {
706+ spin_unlock(&dq_list_lock);
707+ flush_delayed_work(&quota_release_work);
708+ spin_lock(&dq_list_lock);
709+ continue;
710+ }
699711
700712 /* Now we have active dquot from which someone is
701713 * holding reference so we can safely just increase
@@ -809,18 +821,18 @@ static void quota_release_workfn(struct work_struct *work) · 107 unmodified lines
809821 /* Exchange the list head to avoid livelock. */
810822 list_replace_init(&releasing_dquots, &rls_head);
811823 spin_unlock(&dq_list_lock);
824+ synchronize_srcu(&dquot_srcu);
812825
813826 restart:
814− synchronize_srcu(&dquot_srcu);
815827 spin_lock(&dq_list_lock);
816828 while (!list_empty(&rls_head)) {
817829 dquot = list_first_entry(&rls_head, struct dquot, dq_free);
818− /* Dquot got used again? */
819− if (atomic_read(&dquot->dq_count) > 1) {
820− remove_free_dquot(dquot);
821− atomic_dec(&dquot->dq_count);
822− continue;
823− }
830+ WARN_ON_ONCE(atomic_read(&dquot->dq_count));
831+ /*
832+ * Note that DQ_RELEASING_B protects us from racing with
833+ * invalidate_dquots() calls so we are safe to work with the
834+ * dquot even after we drop dq_list_lock.
835+ */
824836 if (dquot_dirty(dquot)) {
825837 spin_unlock(&dq_list_lock);
826838 /* Commit dquot before releasing */
@@ -834,7 +846,6 @@ restart: · 7 unmodified lines
834846 }
835847 /* Dquot is inactive and clean, now move it to free list */
836848 remove_free_dquot(dquot);
837− atomic_dec(&dquot->dq_count);
838849 put_dquot_last(dquot);
839850 }
840851 spin_unlock(&dq_list_lock);
@@ -875,6 +886,7 @@ void dqput(struct dquot *dquot) · 34 unmodified lines
875886 BUG_ON(!list_empty(&dquot->dq_free));
876887 #endif
877888 put_releasing_dquots(dquot);
889+ atomic_dec(&dquot->dq_count);
878890 spin_unlock(&dq_list_lock);
879891 queue_delayed_work(system_unbound_wq, &quota_release_work, 1);
880892 }
@@ -963,7 +975,7 @@ we_slept: · 82 unmodified lines
963975 dqstats_inc(DQST_LOOKUPS);
964976 }
965977 /* Wait for dq_lock - after this we know that either dquot_release() is
966− * already finished or it will be canceled due to dq_count > 1 test */
978+ * already finished or it will be canceled due to dq_count > 0 test */
967979 wait_on_dquot(dquot);
968980 /* Read the dquot / allocate space in quota file */
969981 if (!dquot_active(dquot)) {
fs/smb/client/cached_dir.c+68−73
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 static struct cached_fid *init_cached_dir(const char *path);
1616 static void free_cached_dir(struct cached_fid *cfid);
1717 static void smb2_close_cached_fid(struct kref *ref);
18+static void cfids_laundromat_worker(struct work_struct *work);
1819
1920 static struct cached_fid *find_or_create_cached_dir(struct cached_fids *cfids,
2021 const char *path,
@@ -169,15 +170,18 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, · 148 unmodified lines
169170 return -ENOENT;
170171 }
171172 /*
172− * At this point we either have a lease already and we can just
173− * return it. If not we are guaranteed to be the only thread accessing
174− * this cfid.
173+ * Return cached fid if it has a lease. Otherwise, it is either a new
174+ * entry or laundromat worker removed it from @cfids->entries. Caller
175+ * will put last reference if the latter.
175176 */
177+ spin_lock(&cfids->cfid_list_lock);
176178 if (cfid->has_lease) {
179+ spin_unlock(&cfids->cfid_list_lock);
177180 *ret_cfid = cfid;
178181 kfree(utf16_path);
179182 return 0;
180183 }
184+ spin_unlock(&cfids->cfid_list_lock);
181185
182186 /*
183187 * Skip any prefix paths in @path as lookup_positive_unlocked() ends up
@@ -294,9 +298,11 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, · 110 unmodified lines
294298 goto oshr_free;
295299 }
296300 }
301+ spin_lock(&cfids->cfid_list_lock);
297302 cfid->dentry = dentry;
298303 cfid->time = jiffies;
299304 cfid->has_lease = true;
305+ spin_unlock(&cfids->cfid_list_lock);
300306
301307 oshr_free:
302308 kfree(utf16_path);
@@ -305,24 +311,28 @@ oshr_free: · 2 unmodified lines
305311 free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
306312 free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
307313 spin_lock(&cfids->cfid_list_lock);
308− if (rc && !cfid->has_lease) {
309− if (cfid->on_list) {
310− list_del(&cfid->entry);
311− cfid->on_list = false;
312− cfids->num_entries--;
314+ if (!cfid->has_lease) {
315+ if (rc) {
316+ if (cfid->on_list) {
317+ list_del(&cfid->entry);
318+ cfid->on_list = false;
319+ cfids->num_entries--;
320+ }
321+ rc = -ENOENT;
322+ } else {
323+ /*
324+ * We are guaranteed to have two references at this
325+ * point. One for the caller and one for a potential
326+ * lease. Release the Lease-ref so that the directory
327+ * will be closed when the caller closes the cached
328+ * handle.
329+ */
330+ spin_unlock(&cfids->cfid_list_lock);
331+ kref_put(&cfid->refcount, smb2_close_cached_fid);
332+ goto out;
313333 }
314− rc = -ENOENT;
315334 }
316335 spin_unlock(&cfids->cfid_list_lock);
317− if (!rc && !cfid->has_lease) {
318− /*
319− * We are guaranteed to have two references at this point.
320− * One for the caller and one for a potential lease.
321− * Release the Lease-ref so that the directory will be closed
322− * when the caller closes the cached handle.
323− */
324− kref_put(&cfid->refcount, smb2_close_cached_fid);
325− }
326336 if (rc) {
327337 if (cfid->is_open)
328338 SMB2_close(0, cfid->tcon, cfid->fid.persistent_fid,
@@ -330,7 +340,7 @@ oshr_free: · 1 unmodified line
330340 free_cached_dir(cfid);
331341 cfid = NULL;
332342 }
333−
343+out:
334344 if (rc == 0) {
335345 *ret_cfid = cfid;
336346 atomic_inc(&tcon->num_remote_opens);
@@ -572,53 +582,51 @@ static void free_cached_dir(struct cached_fid *cfid) · 235 unmodified lines
572582 kfree(cfid);
573583 }
574584
575−static int
576−cifs_cfids_laundromat_thread(void *p)
585+static void cfids_laundromat_worker(struct work_struct *work)
577586 {
578− struct cached_fids *cfids = p;
587+ struct cached_fids *cfids;
579588 struct cached_fid *cfid, *q;
580− struct list_head entry;
589+ LIST_HEAD(entry);
581590
582− while (!kthread_should_stop()) {
583− ssleep(1);
584− INIT_LIST_HEAD(&entry);
585− if (kthread_should_stop())
586− return 0;
587− spin_lock(&cfids->cfid_list_lock);
588− list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
589− if (time_after(jiffies, cfid->time + HZ * dir_cache_timeout)) {
590− list_del(&cfid->entry);
591− list_add(&cfid->entry, &entry);
592− cfids->num_entries--;
593− }
594− }
595− spin_unlock(&cfids->cfid_list_lock);
591+ cfids = container_of(work, struct cached_fids, laundromat_work.work);
596592
597− list_for_each_entry_safe(cfid, q, &entry, entry) {
593+ spin_lock(&cfids->cfid_list_lock);
594+ list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
595+ if (cfid->time &&
596+ time_after(jiffies, cfid->time + HZ * dir_cache_timeout)) {
598597 cfid->on_list = false;
599− list_del(&cfid->entry);
598+ list_move(&cfid->entry, &entry);
599+ cfids->num_entries--;
600+ /* To prevent race with smb2_cached_lease_break() */
601+ kref_get(&cfid->refcount);
602+ }
603+ }
604+ spin_unlock(&cfids->cfid_list_lock);
605+
606+ list_for_each_entry_safe(cfid, q, &entry, entry) {
607+ list_del(&cfid->entry);
608+ /*
609+ * Cancel and wait for the work to finish in case we are racing
610+ * with it.
611+ */
612+ cancel_work_sync(&cfid->lease_break);
613+ if (cfid->has_lease) {
600614 /*
601− * Cancel, and wait for the work to finish in
602− * case we are racing with it.
615+ * Our lease has not yet been cancelled from the server
616+ * so we need to drop the reference.
603617 */
604− cancel_work_sync(&cfid->lease_break);
605− if (cfid->has_lease) {
606− /*
607− * We lease has not yet been cancelled from
608− * the server so we need to drop the reference.
609− */
610− spin_lock(&cfids->cfid_list_lock);
611− cfid->has_lease = false;
612− spin_unlock(&cfids->cfid_list_lock);
613− kref_put(&cfid->refcount, smb2_close_cached_fid);
614− }
618+ spin_lock(&cfids->cfid_list_lock);
619+ cfid->has_lease = false;
620+ spin_unlock(&cfids->cfid_list_lock);
621+ kref_put(&cfid->refcount, smb2_close_cached_fid);
615622 }
623+ /* Drop the extra reference opened above */
624+ kref_put(&cfid->refcount, smb2_close_cached_fid);
616625 }
617−
618− return 0;
626+ queue_delayed_work(cifsiod_wq, &cfids->laundromat_work,
627+ dir_cache_timeout * HZ);
619628 }
620629
621−
622630 struct cached_fids *init_cached_dirs(void)
623631 {
624632 struct cached_fids *cfids;
@@ -629,19 +637,10 @@ struct cached_fids *init_cached_dirs(void) · 4 unmodified lines
629637 spin_lock_init(&cfids->cfid_list_lock);
630638 INIT_LIST_HEAD(&cfids->entries);
631639
632− /*
633− * since we're in a cifs function already, we know that
634− * this will succeed. No need for try_module_get().
635− */
636− __module_get(THIS_MODULE);
637− cfids->laundromat = kthread_run(cifs_cfids_laundromat_thread,
638− cfids, "cifsd-cfid-laundromat");
639− if (IS_ERR(cfids->laundromat)) {
640− cifs_dbg(VFS, "Failed to start cfids laundromat thread.\n");
641− kfree(cfids);
642− module_put(THIS_MODULE);
643− return NULL;
644− }
640+ INIT_DELAYED_WORK(&cfids->laundromat_work, cfids_laundromat_worker);
641+ queue_delayed_work(cifsiod_wq, &cfids->laundromat_work,
642+ dir_cache_timeout * HZ);
643+
645644 return cfids;
646645 }
647646
@@ -657,11 +656,7 @@ void free_cached_dirs(struct cached_fids *cfids) · 9 unmodified lines
657656 if (cfids == NULL)
658657 return;
659658
660− if (cfids->laundromat) {
661− kthread_stop(cfids->laundromat);
662− cfids->laundromat = NULL;
663− module_put(THIS_MODULE);
664− }
659+ cancel_delayed_work_sync(&cfids->laundromat_work);
665660
666661 spin_lock(&cfids->cfid_list_lock);
667662 list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
fs/smb/client/cached_dir.h+1−1
@@ -57,7 +57,7 @@ struct cached_fids { · 56 unmodified lines
5757 spinlock_t cfid_list_lock;
5858 int num_entries;
5959 struct list_head entries;
60− struct task_struct *laundromat;
60+ struct delayed_work laundromat_work;
6161 };
6262
6363 extern struct cached_fids *init_cached_dirs(void);
fs/smb/client/connect.c+13−13
@@ -2474,8 +2474,9 @@ cifs_put_tcon(struct cifs_tcon *tcon) · 2473 unmodified lines
24742474 static struct cifs_tcon *
24752475 cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
24762476 {
2477− int rc, xid;
24782477 struct cifs_tcon *tcon;
2478+ bool nohandlecache;
2479+ int rc, xid;
24792480
24802481 tcon = cifs_find_tcon(ses, ctx);
24812482 if (tcon) {
@@ -2493,14 +2494,17 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 11 unmodified lines
24932494 goto out_fail;
24942495 }
24952496
2496− if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)
2497− tcon = tcon_info_alloc(true);
2497+ if (ses->server->dialect >= SMB20_PROT_ID &&
2498+ (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING))
2499+ nohandlecache = ctx->nohandlecache;
24982500 else
2499− tcon = tcon_info_alloc(false);
2501+ nohandlecache = true;
2502+ tcon = tcon_info_alloc(!nohandlecache);
25002503 if (tcon == NULL) {
25012504 rc = -ENOMEM;
25022505 goto out_fail;
25032506 }
2507+ tcon->nohandlecache = nohandlecache;
25042508
25052509 if (ctx->snapshot_time) {
25062510 if (ses->server->vals->protocol_id == 0) {
@@ -2662,10 +2666,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 155 unmodified lines
26622666 tcon->nocase = ctx->nocase;
26632667 tcon->broken_sparse_sup = ctx->no_sparse;
26642668 tcon->max_cached_dirs = ctx->max_cached_dirs;
2665− if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)
2666− tcon->nohandlecache = ctx->nohandlecache;
2667− else
2668− tcon->nohandlecache = true;
26692669 tcon->nodelete = ctx->nodelete;
26702670 tcon->local_lease = ctx->local_lease;
26712671 INIT_LIST_HEAD(&tcon->pending_opens);
@@ -2895,9 +2895,9 @@ bind_socket(struct TCP_Server_Info *server) · 223 unmodified lines
28952895 if (server->srcaddr.ss_family != AF_UNSPEC) {
28962896 /* Bind to the specified local IP address */
28972897 struct socket *socket = server->ssocket;
2898− rc = socket->ops->bind(socket,
2899− (struct sockaddr *) &server->srcaddr,
2900− sizeof(server->srcaddr));
2898+ rc = kernel_bind(socket,
2899+ (struct sockaddr *) &server->srcaddr,
2900+ sizeof(server->srcaddr));
29012901 if (rc < 0) {
29022902 struct sockaddr_in *saddr4;
29032903 struct sockaddr_in6 *saddr6;
@@ -3046,8 +3046,8 @@ generic_ip_connect(struct TCP_Server_Info *server) · 142 unmodified lines
30463046 socket->sk->sk_sndbuf,
30473047 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo);
30483048
3049− rc = socket->ops->connect(socket, saddr, slen,
3050− server->noblockcnt ? O_NONBLOCK : 0);
3049+ rc = kernel_connect(socket, saddr, slen,
3050+ server->noblockcnt ? O_NONBLOCK : 0);
30513051 /*
30523052 * When mounting SMB root file systems, we do not want to block in
30533053 * connect. Otherwise bail out and then let cifs_reconnect() perform
fs/smb/server/connection.c+2−0
@@ -84,6 +84,8 @@ struct ksmbd_conn *ksmbd_conn_alloc(void) · 83 unmodified lines
8484 spin_lock_init(&conn->llist_lock);
8585 INIT_LIST_HEAD(&conn->lock_list);
8686
87+ init_rwsem(&conn->session_lock);
88+
8789 down_write(&conn_list_lock);
8890 list_add(&conn->conns_list, &conn_list);
8991 up_write(&conn_list_lock);
fs/smb/server/connection.h+1−0
@@ -50,6 +50,7 @@ struct ksmbd_conn { · 49 unmodified lines
5050 struct nls_table *local_nls;
5151 struct unicode_map *um;
5252 struct list_head conns_list;
53+ struct rw_semaphore session_lock;
5354 /* smb session 1 per user */
5455 struct xarray sessions;
5556 unsigned long last_active;
fs/smb/server/mgmt/tree_connect.c+39−3
@@ -73,7 +73,10 @@ ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess, · 72 unmodified lines
7373
7474 tree_conn->user = sess->user;
7575 tree_conn->share_conf = sc;
76+ tree_conn->t_state = TREE_NEW;
7677 status.tree_conn = tree_conn;
78+ atomic_set(&tree_conn->refcount, 1);
79+ init_waitqueue_head(&tree_conn->refcount_q);
7780
7881 ret = xa_err(xa_store(&sess->tree_conns, tree_conn->id, tree_conn,
7982 GFP_KERNEL));
@@ -93,14 +96,33 @@ out_error: · 13 unmodified lines
9396 return status;
9497 }
9598
99+void ksmbd_tree_connect_put(struct ksmbd_tree_connect *tcon)
100+{
101+ /*
102+ * Checking waitqueue to releasing tree connect on
103+ * tree disconnect. waitqueue_active is safe because it
104+ * uses atomic operation for condition.
105+ */
106+ if (!atomic_dec_return(&tcon->refcount) &&
107+ waitqueue_active(&tcon->refcount_q))
108+ wake_up(&tcon->refcount_q);
109+}
110+
96111 int ksmbd_tree_conn_disconnect(struct ksmbd_session *sess,
97112 struct ksmbd_tree_connect *tree_conn)
98113 {
99114 int ret;
100115
116+ write_lock(&sess->tree_conns_lock);
117+ xa_erase(&sess->tree_conns, tree_conn->id);
118+ write_unlock(&sess->tree_conns_lock);
119+
120+ if (!atomic_dec_and_test(&tree_conn->refcount))
121+ wait_event(tree_conn->refcount_q,
122+ atomic_read(&tree_conn->refcount) == 0);
123+
101124 ret = ksmbd_ipc_tree_disconnect_request(sess->id, tree_conn->id);
102125 ksmbd_release_tree_conn_id(sess, tree_conn->id);
103− xa_erase(&sess->tree_conns, tree_conn->id);
104126 ksmbd_share_config_put(tree_conn->share_conf);
105127 kfree(tree_conn);
106128 return ret;
@@ -111,11 +133,15 @@ struct ksmbd_tree_connect *ksmbd_tree_conn_lookup(struct ksmbd_session *sess, · 4 unmodified lines
111133 {
112134 struct ksmbd_tree_connect *tcon;
113135
136+ read_lock(&sess->tree_conns_lock);
114137 tcon = xa_load(&sess->tree_conns, id);
115138 if (tcon) {
116− if (test_bit(TREE_CONN_EXPIRE, &tcon->status))
139+ if (tcon->t_state != TREE_CONNECTED)
140+ tcon = NULL;
141+ else if (!atomic_inc_not_zero(&tcon->refcount))
117142 tcon = NULL;
118143 }
144+ read_unlock(&sess->tree_conns_lock);
119145
120146 return tcon;
121147 }
@@ -129,8 +155,18 @@ int ksmbd_tree_conn_session_logoff(struct ksmbd_session *sess) · 7 unmodified lines
129155 if (!sess)
130156 return -EINVAL;
131157
132− xa_for_each(&sess->tree_conns, id, tc)
158+ xa_for_each(&sess->tree_conns, id, tc) {
159+ write_lock(&sess->tree_conns_lock);
160+ if (tc->t_state == TREE_DISCONNECTED) {
161+ write_unlock(&sess->tree_conns_lock);
162+ ret = -ENOENT;
163+ continue;
164+ }
165+ tc->t_state = TREE_DISCONNECTED;
166+ write_unlock(&sess->tree_conns_lock);
167+
133168 ret |= ksmbd_tree_conn_disconnect(sess, tc);
169+ }
134170 xa_destroy(&sess->tree_conns);
135171 return ret;
136172 }
fs/smb/server/mgmt/tree_connect.h+9−2
@@ -14,7 +14,11 @@ struct ksmbd_share_config; · 13 unmodified lines
1414 struct ksmbd_user;
1515 struct ksmbd_conn;
1616
17−#define TREE_CONN_EXPIRE 1
17+enum {
18+ TREE_NEW = 0,
19+ TREE_CONNECTED,
20+ TREE_DISCONNECTED
21+};
1822
1923 struct ksmbd_tree_connect {
2024 int id;
@@ -27,7 +31,9 @@ struct ksmbd_tree_connect { · 6 unmodified lines
2731
2832 int maximal_access;
2933 bool posix_extensions;
30− unsigned long status;
34+ atomic_t refcount;
35+ wait_queue_head_t refcount_q;
36+ unsigned int t_state;
3137 };
3238
3339 struct ksmbd_tree_conn_status {
@@ -46,6 +52,7 @@ struct ksmbd_session; · 12 unmodified lines
4652 struct ksmbd_tree_conn_status
4753 ksmbd_tree_conn_connect(struct ksmbd_conn *conn, struct ksmbd_session *sess,
4854 const char *share_name);
55+void ksmbd_tree_connect_put(struct ksmbd_tree_connect *tcon);
4956
5057 int ksmbd_tree_conn_disconnect(struct ksmbd_session *sess,
5158 struct ksmbd_tree_connect *tree_conn);
fs/smb/server/mgmt/user_session.c+8−3
@@ -174,7 +174,7 @@ static void ksmbd_expire_session(struct ksmbd_conn *conn) · 173 unmodified lines
174174 unsigned long id;
175175 struct ksmbd_session *sess;
176176
177− down_write(&sessions_table_lock);
177+ down_write(&conn->session_lock);
178178 xa_for_each(&conn->sessions, id, sess) {
179179 if (sess->state != SMB2_SESSION_VALID ||
180180 time_after(jiffies,
@@ -185,7 +185,7 @@ static void ksmbd_expire_session(struct ksmbd_conn *conn) · 4 unmodified lines
185185 continue;
186186 }
187187 }
188− up_write(&sessions_table_lock);
188+ up_write(&conn->session_lock);
189189 }
190190
191191 int ksmbd_session_register(struct ksmbd_conn *conn,
@@ -227,7 +227,9 @@ void ksmbd_sessions_deregister(struct ksmbd_conn *conn) · 35 unmodified lines
227227 }
228228 }
229229 }
230+ up_write(&sessions_table_lock);
230231
232+ down_write(&conn->session_lock);
231233 xa_for_each(&conn->sessions, id, sess) {
232234 unsigned long chann_id;
233235 struct channel *chann;
@@ -244,7 +246,7 @@ void ksmbd_sessions_deregister(struct ksmbd_conn *conn) · 10 unmodified lines
244246 ksmbd_session_destroy(sess);
245247 }
246248 }
247− up_write(&sessions_table_lock);
249+ up_write(&conn->session_lock);
248250 }
249251
250252 struct ksmbd_session *ksmbd_session_lookup(struct ksmbd_conn *conn,
@@ -252,9 +254,11 @@ struct ksmbd_session *ksmbd_session_lookup(struct ksmbd_conn *conn, · 1 unmodified line
252254 {
253255 struct ksmbd_session *sess;
254256
257+ down_read(&conn->session_lock);
255258 sess = xa_load(&conn->sessions, id);
256259 if (sess)
257260 sess->last_active = jiffies;
261+ up_read(&conn->session_lock);
258262 return sess;
259263 }
260264
@@ -351,6 +355,7 @@ static struct ksmbd_session *__session_create(int protocol) · 90 unmodified lines
351355 xa_init(&sess->ksmbd_chann_list);
352356 xa_init(&sess->rpc_handle_list);
353357 sess->sequence_number = 1;
358+ rwlock_init(&sess->tree_conns_lock);
354359
355360 ret = __init_smb2_session(sess);
356361 if (ret)
fs/smb/server/mgmt/user_session.h+1−0
@@ -60,6 +60,7 @@ struct ksmbd_session { · 59 unmodified lines
6060
6161 struct ksmbd_file_table file_table;
6262 unsigned long last_active;
63+ rwlock_t tree_conns_lock;
6364 };
6465
6566 static inline int test_session_flag(struct ksmbd_session *sess, int bit)
fs/smb/server/server.c+2−0
@@ -241,6 +241,8 @@ static void __handle_ksmbd_work(struct ksmbd_work *work, · 240 unmodified lines
241241 } while (is_chained == true);
242242
243243 send:
244+ if (work->tcon)
245+ ksmbd_tree_connect_put(work->tcon);
244246 smb3_preauth_hash_rsp(work);
245247 if (work->sess && work->sess->enc && work->encrypted &&
246248 conn->ops->encrypt_resp) {
fs/smb/server/smb2pdu.c+66−39
@@ -231,11 +231,12 @@ void set_smb2_rsp_status(struct ksmbd_work *work, __le32 err) · 230 unmodified lines
231231 {
232232 struct smb2_hdr *rsp_hdr;
233233
234− if (work->next_smb2_rcv_hdr_off)
235− rsp_hdr = ksmbd_resp_buf_next(work);
236− else
237− rsp_hdr = smb2_get_msg(work->response_buf);
234+ rsp_hdr = smb2_get_msg(work->response_buf);
238235 rsp_hdr->Status = err;
236+
237+ work->iov_idx = 0;
238+ work->iov_cnt = 0;
239+ work->next_smb2_rcv_hdr_off = 0;
239240 smb2_set_err_rsp(work);
240241 }
241242
@@ -1993,6 +1994,9 @@ int smb2_tree_connect(struct ksmbd_work *work) · 1751 unmodified lines
19931994 if (conn->posix_ext_supported)
19941995 status.tree_conn->posix_extensions = true;
19951996
1997+ write_lock(&sess->tree_conns_lock);
1998+ status.tree_conn->t_state = TREE_CONNECTED;
1999+ write_unlock(&sess->tree_conns_lock);
19962000 rsp->StructureSize = cpu_to_le16(16);
19972001 out_err1:
19982002 rsp->Capabilities = 0;
@@ -2122,27 +2126,50 @@ int smb2_tree_disconnect(struct ksmbd_work *work) · 123 unmodified lines
21222126
21232127 ksmbd_debug(SMB, "request\n");
21242128
2129+ if (!tcon) {
2130+ ksmbd_debug(SMB, "Invalid tid %d\n", req->hdr.Id.SyncId.TreeId);
2131+
2132+ rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2133+ err = -ENOENT;
2134+ goto err_out;
2135+ }
2136+
2137+ ksmbd_close_tree_conn_fds(work);
2138+
2139+ write_lock(&sess->tree_conns_lock);
2140+ if (tcon->t_state == TREE_DISCONNECTED) {
2141+ write_unlock(&sess->tree_conns_lock);
2142+ rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2143+ err = -ENOENT;
2144+ goto err_out;
2145+ }
2146+
2147+ WARN_ON_ONCE(atomic_dec_and_test(&tcon->refcount));
2148+ tcon->t_state = TREE_DISCONNECTED;
2149+ write_unlock(&sess->tree_conns_lock);
2150+
2151+ err = ksmbd_tree_conn_disconnect(sess, tcon);
2152+ if (err) {
2153+ rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2154+ goto err_out;
2155+ }
2156+
2157+ work->tcon = NULL;
2158+
21252159 rsp->StructureSize = cpu_to_le16(4);
21262160 err = ksmbd_iov_pin_rsp(work, rsp,
21272161 sizeof(struct smb2_tree_disconnect_rsp));
21282162 if (err) {
21292163 rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
2130− smb2_set_err_rsp(work);
2131− return err;
2164+ goto err_out;
21322165 }
21332166
2134− if (!tcon || test_and_set_bit(TREE_CONN_EXPIRE, &tcon->status)) {
2135− ksmbd_debug(SMB, "Invalid tid %d\n", req->hdr.Id.SyncId.TreeId);
2167+ return 0;
21362168
2137− rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
2138− smb2_set_err_rsp(work);
2139− return -ENOENT;
2140− }
2169+err_out:
2170+ smb2_set_err_rsp(work);
2171+ return err;
21412172
2142− ksmbd_close_tree_conn_fds(work);
2143− ksmbd_tree_conn_disconnect(sess, tcon);
2144− work->tcon = NULL;
2145− return 0;
21462173 }
21472174
21482175 /**
@@ -2164,17 +2191,17 @@ int smb2_session_logoff(struct ksmbd_work *work) · 15 unmodified lines
21642191
21652192 ksmbd_debug(SMB, "request\n");
21662193
2167− sess_id = le64_to_cpu(req->hdr.SessionId);
2168−
2169− rsp->StructureSize = cpu_to_le16(4);
2170− err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_logoff_rsp));
2171− if (err) {
2172− rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
2194+ ksmbd_conn_lock(conn);
2195+ if (!ksmbd_conn_good(conn)) {
2196+ ksmbd_conn_unlock(conn);
2197+ rsp->hdr.Status = STATUS_NETWORK_NAME_DELETED;
21732198 smb2_set_err_rsp(work);
2174− return err;
2199+ return -ENOENT;
21752200 }
2176−
2201+ sess_id = le64_to_cpu(req->hdr.SessionId);
21772202 ksmbd_all_conn_set_status(sess_id, KSMBD_SESS_NEED_RECONNECT);
2203+ ksmbd_conn_unlock(conn);
2204+
21782205 ksmbd_close_session_fds(work);
21792206 ksmbd_conn_wait_idle(conn, sess_id);
21802207
@@ -2196,6 +2223,14 @@ int smb2_session_logoff(struct ksmbd_work *work) · 15 unmodified lines
21962223 ksmbd_free_user(sess->user);
21972224 sess->user = NULL;
21982225 ksmbd_all_conn_set_status(sess_id, KSMBD_SESS_NEED_NEGOTIATE);
2226+
2227+ rsp->StructureSize = cpu_to_le16(4);
2228+ err = ksmbd_iov_pin_rsp(work, rsp, sizeof(struct smb2_logoff_rsp));
2229+ if (err) {
2230+ rsp->hdr.Status = STATUS_INSUFFICIENT_RESOURCES;
2231+ smb2_set_err_rsp(work);
2232+ return err;
2233+ }
21992234 return 0;
22002235 }
22012236
@@ -3370,8 +3405,10 @@ err_out: · 1168 unmodified lines
33703405 }
33713406 ksmbd_revert_fsids(work);
33723407 err_out1:
3373− if (!rc)
3408+ if (!rc) {
3409+ ksmbd_update_fstate(&work->sess->file_table, fp, FP_INITED);
33743410 rc = ksmbd_iov_pin_rsp(work, (void *)rsp, iov_len);
3411+ }
33753412 if (rc) {
33763413 if (rc == -EINVAL)
33773414 rsp->hdr.Status = STATUS_INVALID_PARAMETER;
@@ -6115,12 +6152,12 @@ static noinline int smb2_read_pipe(struct ksmbd_work *work) · 2737 unmodified lines
61156152 memcpy(aux_payload_buf, rpc_resp->payload, rpc_resp->payload_sz);
61166153
61176154 nbytes = rpc_resp->payload_sz;
6118− kvfree(rpc_resp);
61196155 err = ksmbd_iov_pin_rsp_read(work, (void *)rsp,
61206156 offsetof(struct smb2_read_rsp, Buffer),
61216157 aux_payload_buf, nbytes);
61226158 if (err)
61236159 goto out;
6160+ kvfree(rpc_resp);
61246161 } else {
61256162 err = ksmbd_iov_pin_rsp(work, (void *)rsp,
61266163 offsetof(struct smb2_read_rsp, Buffer));
@@ -7028,10 +7065,6 @@ skip: · 901 unmodified lines
70287065
70297066 ksmbd_debug(SMB,
70307067 "would have to wait for getting lock\n");
7031− spin_lock(&work->conn->llist_lock);
7032− list_add_tail(&smb_lock->clist,
7033− &work->conn->lock_list);
7034− spin_unlock(&work->conn->llist_lock);
70357068 list_add(&smb_lock->llist, &rollback_list);
70367069
70377070 argv = kmalloc(sizeof(void *), GFP_KERNEL);
@@ -7062,9 +7095,6 @@ skip: · 24 unmodified lines
70627095
70637096 if (work->state != KSMBD_WORK_ACTIVE) {
70647097 list_del(&smb_lock->llist);
7065− spin_lock(&work->conn->llist_lock);
7066− list_del(&smb_lock->clist);
7067− spin_unlock(&work->conn->llist_lock);
70687098 locks_free_lock(flock);
70697099
70707100 if (work->state == KSMBD_WORK_CANCELLED) {
@@ -7084,19 +7114,16 @@ skip: · 13 unmodified lines
70847114 }
70857115
70867116 list_del(&smb_lock->llist);
7087− spin_lock(&work->conn->llist_lock);
7088− list_del(&smb_lock->clist);
7089− spin_unlock(&work->conn->llist_lock);
70907117 release_async_work(work);
70917118 goto retry;
70927119 } else if (!rc) {
7120+ list_add(&smb_lock->llist, &rollback_list);
70937121 spin_lock(&work->conn->llist_lock);
70947122 list_add_tail(&smb_lock->clist,
70957123 &work->conn->lock_list);
70967124 list_add_tail(&smb_lock->flist,
70977125 &fp->lock_list);
70987126 spin_unlock(&work->conn->llist_lock);
7099− list_add(&smb_lock->llist, &rollback_list);
71007127 ksmbd_debug(SMB, "successful in taking lock\n");
71017128 } else {
71027129 goto out;
@@ -8036,10 +8063,10 @@ static void smb20_oplock_break_ack(struct ksmbd_work *work) · 933 unmodified lines
80368063 goto err_out;
80378064 }
80388065
8039− opinfo_put(opinfo);
8040− ksmbd_fd_put(work, fp);
80418066 opinfo->op_state = OPLOCK_STATE_NONE;
80428067 wake_up_interruptible_all(&opinfo->oplock_q);
8068+ opinfo_put(opinfo);
8069+ ksmbd_fd_put(work, fp);
80438070
80448071 rsp->StructureSize = cpu_to_le16(24);
80458072 rsp->OplockLevel = rsp_oplevel;
fs/smb/server/vfs_cache.c+25−5
@@ -106,7 +106,7 @@ int ksmbd_query_inode_status(struct inode *inode) · 105 unmodified lines
106106 ci = __ksmbd_inode_lookup(inode);
107107 if (ci) {
108108 ret = KSMBD_INODE_STATUS_OK;
109− if (ci->m_flags & S_DEL_PENDING)
109+ if (ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS))
110110 ret = KSMBD_INODE_STATUS_PENDING_DELETE;
111111 atomic_dec(&ci->m_count);
112112 }
@@ -116,7 +116,7 @@ int ksmbd_query_inode_status(struct inode *inode) · 3 unmodified lines
116116
117117 bool ksmbd_inode_pending_delete(struct ksmbd_file *fp)
118118 {
119− return (fp->f_ci->m_flags & S_DEL_PENDING);
119+ return (fp->f_ci->m_flags & (S_DEL_PENDING | S_DEL_ON_CLS));
120120 }
121121
122122 void ksmbd_set_inode_pending_delete(struct ksmbd_file *fp)
@@ -333,6 +333,9 @@ static void __ksmbd_close_fd(struct ksmbd_file_table *ft, struct ksmbd_file *fp) · 210 unmodified lines
333333
334334 static struct ksmbd_file *ksmbd_fp_get(struct ksmbd_file *fp)
335335 {
336+ if (fp->f_state != FP_INITED)
337+ return NULL;
338+
336339 if (!atomic_inc_not_zero(&fp->refcount))
337340 return NULL;
338341 return fp;
@@ -382,15 +385,20 @@ int ksmbd_close_fd(struct ksmbd_work *work, u64 id) · 43 unmodified lines
382385 return 0;
383386
384387 ft = &work->sess->file_table;
385− read_lock(&ft->lock);
388+ write_lock(&ft->lock);
386389 fp = idr_find(ft->idr, id);
387390 if (fp) {
388391 set_close_state_blocked_works(fp);
389392
390− if (!atomic_dec_and_test(&fp->refcount))
393+ if (fp->f_state != FP_INITED)
391394 fp = NULL;
395+ else {
396+ fp->f_state = FP_CLOSED;
397+ if (!atomic_dec_and_test(&fp->refcount))
398+ fp = NULL;
399+ }
392400 }
393− read_unlock(&ft->lock);
401+ write_unlock(&ft->lock);
394402
395403 if (!fp)
396404 return -EINVAL;
@@ -570,6 +578,7 @@ struct ksmbd_file *ksmbd_open_fd(struct ksmbd_work *work, struct file *filp) · 173 unmodified lines
570578 fp->tcon = work->tcon;
571579 fp->volatile_id = KSMBD_NO_FID;
572580 fp->persistent_id = KSMBD_NO_FID;
581+ fp->f_state = FP_NEW;
573582 fp->f_ci = ksmbd_inode_get(fp);
574583
575584 if (!fp->f_ci) {
@@ -591,6 +600,17 @@ err_out: · 15 unmodified lines
591600 return ERR_PTR(ret);
592601 }
593602
603+void ksmbd_update_fstate(struct ksmbd_file_table *ft, struct ksmbd_file *fp,
604+ unsigned int state)
605+{
606+ if (!fp)
607+ return;
608+
609+ write_lock(&ft->lock);
610+ fp->f_state = state;
611+ write_unlock(&ft->lock);
612+}
613+
594614 static int
595615 __close_file_table_ids(struct ksmbd_file_table *ft,
596616 struct ksmbd_tree_connect *tcon,
fs/smb/server/vfs_cache.h+9−0
@@ -60,6 +60,12 @@ struct ksmbd_inode { · 59 unmodified lines
6060 __le32 m_fattr;
6161 };
6262
63+enum {
64+ FP_NEW = 0,
65+ FP_INITED,
66+ FP_CLOSED
67+};
68+
6369 struct ksmbd_file {
6470 struct file *filp;
6571 u64 persistent_id;
@@ -98,6 +104,7 @@ struct ksmbd_file { · 32 unmodified lines
98104 /* if ls is happening on directory, below is valid*/
99105 struct ksmbd_readdir_data readdir_data;
100106 int dot_dotdot[2];
107+ unsigned int f_state;
101108 };
102109
103110 static inline void set_ctx_actor(struct dir_context *ctx,
@@ -142,6 +149,8 @@ int ksmbd_close_inode_fds(struct ksmbd_work *work, struct inode *inode); · 38 unmodified lines
142149 int ksmbd_init_global_file_table(void);
143150 void ksmbd_free_global_file_table(void);
144151 void ksmbd_set_fd_limit(unsigned long limit);
152+void ksmbd_update_fstate(struct ksmbd_file_table *ft, struct ksmbd_file *fp,
153+ unsigned int state);
145154
146155 /*
147156 * INODE hash
fs/xfs/libxfs/xfs_ag.c+6−0
@@ -1001,6 +1001,12 @@ xfs_ag_shrink_space( · 1000 unmodified lines
10011001 error = -ENOSPC;
10021002 goto resv_init_out;
10031003 }
1004+
1005+ /* Update perag geometry */
1006+ pag->block_count -= delta;
1007+ __xfs_agino_range(pag->pag_mount, pag->block_count, &pag->agino_min,
1008+ &pag->agino_max);
1009+
10041010 xfs_ialloc_log_agi(*tpp, agibp, XFS_AGI_LENGTH);
10051011 xfs_alloc_log_agf(*tpp, agfbp, XFS_AGF_LENGTH);
10061012 return 0;
fs/xfs/scrub/xfile.c+0−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010 #include "xfs_log_format.h"
1111 #include "xfs_trans_resv.h"
1212 #include "xfs_mount.h"
13−#include "xfs_format.h"
1413 #include "scrub/xfile.h"
1514 #include "scrub/xfarray.h"
1615 #include "scrub/scrub.h"
fs/xfs/xfs_discard.c+242−24
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
3− * Copyright (C) 2010 Red Hat, Inc.
3+ * Copyright (C) 2010, 2023 Red Hat, Inc.
44 * All Rights Reserved.
55 */
66 #include "xfs.h"
@@ -19,21 +19,147 @@ · 12 unmodified lines
1919 #include "xfs_log.h"
2020 #include "xfs_ag.h"
2121
22−STATIC int
23−xfs_trim_extents(
22+/*
23+ * Notes on an efficient, low latency fstrim algorithm
24+ *
25+ * We need to walk the filesystem free space and issue discards on the free
26+ * space that meet the search criteria (size and location). We cannot issue
27+ * discards on extents that might be in use, or are so recently in use they are
28+ * still marked as busy. To serialise against extent state changes whilst we are
29+ * gathering extents to trim, we must hold the AGF lock to lock out other
30+ * allocations and extent free operations that might change extent state.
31+ *
32+ * However, we cannot just hold the AGF for the entire AG free space walk whilst
33+ * we issue discards on each free space that is found. Storage devices can have
34+ * extremely slow discard implementations (e.g. ceph RBD) and so walking a
35+ * couple of million free extents and issuing synchronous discards on each
36+ * extent can take a *long* time. Whilst we are doing this walk, nothing else
37+ * can access the AGF, and we can stall transactions and hence the log whilst
38+ * modifications wait for the AGF lock to be released. This can lead hung tasks
39+ * kicking the hung task timer and rebooting the system. This is bad.
40+ *
41+ * Hence we need to take a leaf from the bulkstat playbook. It takes the AGI
42+ * lock, gathers a range of inode cluster buffers that are allocated, drops the
43+ * AGI lock and then reads all the inode cluster buffers and processes them. It
44+ * loops doing this, using a cursor to keep track of where it is up to in the AG
45+ * for each iteration to restart the INOBT lookup from.
46+ *
47+ * We can't do this exactly with free space - once we drop the AGF lock, the
48+ * state of the free extent is out of our control and we cannot run a discard
49+ * safely on it in this situation. Unless, of course, we've marked the free
50+ * extent as busy and undergoing a discard operation whilst we held the AGF
51+ * locked.
52+ *
53+ * This is exactly how online discard works - free extents are marked busy when
54+ * they are freed, and once the extent free has been committed to the journal,
55+ * the busy extent record is marked as "undergoing discard" and the discard is
56+ * then issued on the free extent. Once the discard completes, the busy extent
57+ * record is removed and the extent is able to be allocated again.
58+ *
59+ * In the context of fstrim, if we find a free extent we need to discard, we
60+ * don't have to discard it immediately. All we need to do it record that free
61+ * extent as being busy and under discard, and all the allocation routines will
62+ * now avoid trying to allocate it. Hence if we mark the extent as busy under
63+ * the AGF lock, we can safely discard it without holding the AGF lock because
64+ * nothing will attempt to allocate that free space until the discard completes.
65+ *
66+ * This also allows us to issue discards asynchronously like we do with online
67+ * discard, and so for fast devices fstrim will run much faster as we can have
68+ * multiple discard operations in flight at once, as well as pipeline the free
69+ * extent search so that it overlaps in flight discard IO.
70+ */
71+
72+struct workqueue_struct *xfs_discard_wq;
73+
74+static void
75+xfs_discard_endio_work(
76+ struct work_struct *work)
77+{
78+ struct xfs_busy_extents *extents =
79+ container_of(work, struct xfs_busy_extents, endio_work);
80+
81+ xfs_extent_busy_clear(extents->mount, &extents->extent_list, false);
82+ kmem_free(extents->owner);
83+}
84+
85+/*
86+ * Queue up the actual completion to a thread to avoid IRQ-safe locking for
87+ * pagb_lock.
88+ */
89+static void
90+xfs_discard_endio(
91+ struct bio *bio)
92+{
93+ struct xfs_busy_extents *extents = bio->bi_private;
94+
95+ INIT_WORK(&extents->endio_work, xfs_discard_endio_work);
96+ queue_work(xfs_discard_wq, &extents->endio_work);
97+ bio_put(bio);
98+}
99+
100+/*
101+ * Walk the discard list and issue discards on all the busy extents in the
102+ * list. We plug and chain the bios so that we only need a single completion
103+ * call to clear all the busy extents once the discards are complete.
104+ */
105+int
106+xfs_discard_extents(
107+ struct xfs_mount *mp,
108+ struct xfs_busy_extents *extents)
109+{
110+ struct xfs_extent_busy *busyp;
111+ struct bio *bio = NULL;
112+ struct blk_plug plug;
113+ int error = 0;
114+
115+ blk_start_plug(&plug);
116+ list_for_each_entry(busyp, &extents->extent_list, list) {
117+ trace_xfs_discard_extent(mp, busyp->agno, busyp->bno,
118+ busyp->length);
119+
120+ error = __blkdev_issue_discard(mp->m_ddev_targp->bt_bdev,
121+ XFS_AGB_TO_DADDR(mp, busyp->agno, busyp->bno),
122+ XFS_FSB_TO_BB(mp, busyp->length),
123+ GFP_NOFS, &bio);
124+ if (error && error != -EOPNOTSUPP) {
125+ xfs_info(mp,
126+ "discard failed for extent [0x%llx,%u], error %d",
127+ (unsigned long long)busyp->bno,
128+ busyp->length,
129+ error);
130+ break;
131+ }
132+ }
133+
134+ if (bio) {
135+ bio->bi_private = extents;
136+ bio->bi_end_io = xfs_discard_endio;
137+ submit_bio(bio);
138+ } else {
139+ xfs_discard_endio_work(&extents->endio_work);
140+ }
141+ blk_finish_plug(&plug);
142+
143+ return error;
144+}
145+
146+
147+static int
148+xfs_trim_gather_extents(
24149 struct xfs_perag *pag,
25150 xfs_daddr_t start,
26151 xfs_daddr_t end,
27152 xfs_daddr_t minlen,
153+ struct xfs_alloc_rec_incore *tcur,
154+ struct xfs_busy_extents *extents,
28155 uint64_t *blocks_trimmed)
29156 {
30157 struct xfs_mount *mp = pag->pag_mount;
31− struct block_device *bdev = mp->m_ddev_targp->bt_bdev;
32158 struct xfs_btree_cur *cur;
33159 struct xfs_buf *agbp;
34− struct xfs_agf *agf;
35160 int error;
36161 int i;
162+ int batch = 100;
37163
38164 /*
39165 * Force out the log. This means any transactions that might have freed
@@ -45,20 +171,28 @@ xfs_trim_extents( · 5 unmodified lines
45171 error = xfs_alloc_read_agf(pag, NULL, 0, &agbp);
46172 if (error)
47173 return error;
48− agf = agbp->b_addr;
49174
50175 cur = xfs_allocbt_init_cursor(mp, NULL, agbp, pag, XFS_BTNUM_CNT);
51176
52177 /*
53− * Look up the longest btree in the AGF and start with it.
178+ * Look up the extent length requested in the AGF and start with it.
54179 */
55− error = xfs_alloc_lookup_ge(cur, 0, be32_to_cpu(agf->agf_longest), &i);
180+ if (tcur->ar_startblock == NULLAGBLOCK)
181+ error = xfs_alloc_lookup_ge(cur, 0, tcur->ar_blockcount, &i);
182+ else
183+ error = xfs_alloc_lookup_le(cur, tcur->ar_startblock,
184+ tcur->ar_blockcount, &i);
56185 if (error)
57186 goto out_del_cursor;
187+ if (i == 0) {
188+ /* nothing of that length left in the AG, we are done */
189+ tcur->ar_blockcount = 0;
190+ goto out_del_cursor;
191+ }
58192
59193 /*
60194 * Loop until we are done with all extents that are large
61− * enough to be worth discarding.
195+ * enough to be worth discarding or we hit batch limits.
62196 */
63197 while (i) {
64198 xfs_agblock_t fbno;
@@ -73,7 +207,16 @@ xfs_trim_extents( · 8 unmodified lines
73207 error = -EFSCORRUPTED;
74208 break;
75209 }
76− ASSERT(flen <= be32_to_cpu(agf->agf_longest));
210+
211+ if (--batch <= 0) {
212+ /*
213+ * Update the cursor to point at this extent so we
214+ * restart the next batch from this extent.
215+ */
216+ tcur->ar_startblock = fbno;
217+ tcur->ar_blockcount = flen;
218+ break;
219+ }
77220
78221 /*
79222 * use daddr format for all range/len calculations as that is
@@ -88,6 +231,7 @@ xfs_trim_extents( · 8 unmodified lines
88231 */
89232 if (dlen < minlen) {
90233 trace_xfs_discard_toosmall(mp, pag->pag_agno, fbno, flen);
234+ tcur->ar_blockcount = 0;
91235 break;
92236 }
93237
@@ -110,29 +254,103 @@ xfs_trim_extents( · 16 unmodified lines
110254 goto next_extent;
111255 }
112256
113− trace_xfs_discard_extent(mp, pag->pag_agno, fbno, flen);
114− error = blkdev_issue_discard(bdev, dbno, dlen, GFP_NOFS);
115− if (error)
116− break;
257+ xfs_extent_busy_insert_discard(pag, fbno, flen,
258+ &extents->extent_list);
117259 *blocks_trimmed += flen;
118−
119260 next_extent:
120261 error = xfs_btree_decrement(cur, 0, &i);
121262 if (error)
122263 break;
123264
124− if (fatal_signal_pending(current)) {
125− error = -ERESTARTSYS;
126− break;
127− }
265+ /*
266+ * If there's no more records in the tree, we are done. Set the
267+ * cursor block count to 0 to indicate to the caller that there
268+ * is no more extents to search.
269+ */
270+ if (i == 0)
271+ tcur->ar_blockcount = 0;
128272 }
129273
274+ /*
275+ * If there was an error, release all the gathered busy extents because
276+ * we aren't going to issue a discard on them any more.
277+ */
278+ if (error)
279+ xfs_extent_busy_clear(mp, &extents->extent_list, false);
130280 out_del_cursor:
131281 xfs_btree_del_cursor(cur, error);
132282 xfs_buf_relse(agbp);
133283 return error;
134284 }
135285
286+static bool
287+xfs_trim_should_stop(void)
288+{
289+ return fatal_signal_pending(current) || freezing(current);
290+}
291+
292+/*
293+ * Iterate the free list gathering extents and discarding them. We need a cursor
294+ * for the repeated iteration of gather/discard loop, so use the longest extent
295+ * we found in the last batch as the key to start the next.
296+ */
297+static int
298+xfs_trim_extents(
299+ struct xfs_perag *pag,
300+ xfs_daddr_t start,
301+ xfs_daddr_t end,
302+ xfs_daddr_t minlen,
303+ uint64_t *blocks_trimmed)
304+{
305+ struct xfs_alloc_rec_incore tcur = {
306+ .ar_blockcount = pag->pagf_longest,
307+ .ar_startblock = NULLAGBLOCK,
308+ };
309+ int error = 0;
310+
311+ do {
312+ struct xfs_busy_extents *extents;
313+
314+ extents = kzalloc(sizeof(*extents), GFP_KERNEL);
315+ if (!extents) {
316+ error = -ENOMEM;
317+ break;
318+ }
319+
320+ extents->mount = pag->pag_mount;
321+ extents->owner = extents;
322+ INIT_LIST_HEAD(&extents->extent_list);
323+
324+ error = xfs_trim_gather_extents(pag, start, end, minlen,
325+ &tcur, extents, blocks_trimmed);
326+ if (error) {
327+ kfree(extents);
328+ break;
329+ }
330+
331+ /*
332+ * We hand the extent list to the discard function here so the
333+ * discarded extents can be removed from the busy extent list.
334+ * This allows the discards to run asynchronously with gathering
335+ * the next round of extents to discard.
336+ *
337+ * However, we must ensure that we do not reference the extent
338+ * list after this function call, as it may have been freed by
339+ * the time control returns to us.
340+ */
341+ error = xfs_discard_extents(pag->pag_mount, extents);
342+ if (error)
343+ break;
344+
345+ if (xfs_trim_should_stop())
346+ break;
347+
348+ } while (tcur.ar_blockcount != 0);
349+
350+ return error;
351+
352+}
353+
136354 /*
137355 * trim a range of the filesystem.
138356 *
@@ -195,12 +413,12 @@ xfs_ioc_trim( · 56 unmodified lines
195413 for_each_perag_range(mp, agno, xfs_daddr_to_agno(mp, end), pag) {
196414 error = xfs_trim_extents(pag, start, end, minlen,
197415 &blocks_trimmed);
198− if (error) {
416+ if (error)
199417 last_error = error;
200− if (error == -ERESTARTSYS) {
201− xfs_perag_rele(pag);
202− break;
203− }
418+
419+ if (xfs_trim_should_stop()) {
420+ xfs_perag_rele(pag);
421+ break;
204422 }
205423 }
206424
fs/xfs/xfs_discard.h+4−2
@@ -3,8 +3,10 @@ · 2 unmodified lines
33 #define XFS_DISCARD_H 1
44
55 struct fstrim_range;
6−struct list_head;
6+struct xfs_mount;
7+struct xfs_busy_extents;
78
8−extern int xfs_ioc_trim(struct xfs_mount *, struct fstrim_range __user *);
9+int xfs_discard_extents(struct xfs_mount *mp, struct xfs_busy_extents *busy);
10+int xfs_ioc_trim(struct xfs_mount *mp, struct fstrim_range __user *fstrim);
911
1012 #endif /* XFS_DISCARD_H */
fs/xfs/xfs_extent_busy.c+29−6
@@ -19,13 +19,13 @@ · 18 unmodified lines
1919 #include "xfs_log.h"
2020 #include "xfs_ag.h"
2121
22−void
23−xfs_extent_busy_insert(
24− struct xfs_trans *tp,
22+static void
23+xfs_extent_busy_insert_list(
2524 struct xfs_perag *pag,
2625 xfs_agblock_t bno,
2726 xfs_extlen_t len,
28− unsigned int flags)
27+ unsigned int flags,
28+ struct list_head *busy_list)
2929 {
3030 struct xfs_extent_busy *new;
3131 struct xfs_extent_busy *busyp;
@@ -40,7 +40,7 @@ xfs_extent_busy_insert( · 8 unmodified lines
4040 new->flags = flags;
4141
4242 /* trace before insert to be able to see failed inserts */
43− trace_xfs_extent_busy(tp->t_mountp, pag->pag_agno, bno, len);
43+ trace_xfs_extent_busy(pag->pag_mount, pag->pag_agno, bno, len);
4444
4545 spin_lock(&pag->pagb_lock);
4646 rbp = &pag->pagb_tree.rb_node;
@@ -62,10 +62,33 @@ xfs_extent_busy_insert( · 15 unmodified lines
6262 rb_link_node(&new->rb_node, parent, rbp);
6363 rb_insert_color(&new->rb_node, &pag->pagb_tree);
6464
65− list_add(&new->list, &tp->t_busy);
65+ /* always process discard lists in fifo order */
66+ list_add_tail(&new->list, busy_list);
6667 spin_unlock(&pag->pagb_lock);
6768 }
6869
70+void
71+xfs_extent_busy_insert(
72+ struct xfs_trans *tp,
73+ struct xfs_perag *pag,
74+ xfs_agblock_t bno,
75+ xfs_extlen_t len,
76+ unsigned int flags)
77+{
78+ xfs_extent_busy_insert_list(pag, bno, len, flags, &tp->t_busy);
79+}
80+
81+void
82+xfs_extent_busy_insert_discard(
83+ struct xfs_perag *pag,
84+ xfs_agblock_t bno,
85+ xfs_extlen_t len,
86+ struct list_head *busy_list)
87+{
88+ xfs_extent_busy_insert_list(pag, bno, len, XFS_EXTENT_BUSY_DISCARDED,
89+ busy_list);
90+}
91+
6992 /*
7093 * Search for a busy extent within the range of the extent we are about to
7194 * allocate. You need to be holding the busy extent tree lock when calling
fs/xfs/xfs_extent_busy.h+21−3
@@ -16,9 +16,6 @@ struct xfs_alloc_arg; · 15 unmodified lines
1616 /*
1717 * Busy block/extent entry. Indexed by a rbtree in perag to mark blocks that
1818 * have been freed but whose transactions aren't committed to disk yet.
19− *
20− * Note that we use the transaction ID to record the transaction, not the
21− * transaction structure itself. See xfs_extent_busy_insert() for details.
2219 */
2320 struct xfs_extent_busy {
2421 struct rb_node rb_node; /* ag by-bno indexed search tree */
@@ -31,10 +28,31 @@ struct xfs_extent_busy { · 6 unmodified lines
3128 #define XFS_EXTENT_BUSY_SKIP_DISCARD 0x02 /* do not discard */
3229 };
3330
31+/*
32+ * List used to track groups of related busy extents all the way through
33+ * to discard completion.
34+ */
35+struct xfs_busy_extents {
36+ struct xfs_mount *mount;
37+ struct list_head extent_list;
38+ struct work_struct endio_work;
39+
40+ /*
41+ * Owner is the object containing the struct xfs_busy_extents to free
42+ * once the busy extents have been processed. If only the
43+ * xfs_busy_extents object needs freeing, then point this at itself.
44+ */
45+ void *owner;
46+};
47+
3448 void
3549 xfs_extent_busy_insert(struct xfs_trans *tp, struct xfs_perag *pag,
3650 xfs_agblock_t bno, xfs_extlen_t len, unsigned int flags);
3751
52+void
53+xfs_extent_busy_insert_discard(struct xfs_perag *pag, xfs_agblock_t bno,
54+ xfs_extlen_t len, struct list_head *busy_list);
55+
3856 void
3957 xfs_extent_busy_clear(struct xfs_mount *mp, struct list_head *list,
4058 bool do_discard);
fs/xfs/xfs_iops.c+5−0
@@ -584,6 +584,11 @@ xfs_vn_getattr( · 583 unmodified lines
584584 }
585585 }
586586
587+ if ((request_mask & STATX_CHANGE_COOKIE) && IS_I_VERSION(inode)) {
588+ stat->change_cookie = inode_query_iversion(inode);
589+ stat->result_mask |= STATX_CHANGE_COOKIE;
590+ }
591+
587592 /*
588593 * Note: If you add another clause to set an attribute flag, please
589594 * update attributes_mask below.
fs/xfs/xfs_log_cil.c+13−80
@@ -16,8 +16,7 @@ · 15 unmodified lines
1616 #include "xfs_log.h"
1717 #include "xfs_log_priv.h"
1818 #include "xfs_trace.h"
19−
20−struct workqueue_struct *xfs_discard_wq;
19+#include "xfs_discard.h"
2120
2221 /*
2322 * Allocate a new ticket. Failing to get a new ticket makes it really hard to
@@ -103,7 +102,7 @@ xlog_cil_ctx_alloc(void) · 79 unmodified lines
103102
104103 ctx = kmem_zalloc(sizeof(*ctx), KM_NOFS);
105104 INIT_LIST_HEAD(&ctx->committing);
106− INIT_LIST_HEAD(&ctx->busy_extents);
105+ INIT_LIST_HEAD(&ctx->busy_extents.extent_list);
107106 INIT_LIST_HEAD(&ctx->log_items);
108107 INIT_LIST_HEAD(&ctx->lv_chain);
109108 INIT_WORK(&ctx->push_work, xlog_cil_push_work);
@@ -132,7 +131,7 @@ xlog_cil_push_pcp_aggregate( · 22 unmodified lines
132131
133132 if (!list_empty(&cilpcp->busy_extents)) {
134133 list_splice_init(&cilpcp->busy_extents,
135− &ctx->busy_extents);
134+ &ctx->busy_extents.extent_list);
136135 }
137136 if (!list_empty(&cilpcp->log_items))
138137 list_splice_init(&cilpcp->log_items, &ctx->log_items);
@@ -708,76 +707,6 @@ xlog_cil_free_logvec( · 569 unmodified lines
708707 }
709708 }
710709
711−static void
712−xlog_discard_endio_work(
713− struct work_struct *work)
714−{
715− struct xfs_cil_ctx *ctx =
716− container_of(work, struct xfs_cil_ctx, discard_endio_work);
717− struct xfs_mount *mp = ctx->cil->xc_log->l_mp;
718−
719− xfs_extent_busy_clear(mp, &ctx->busy_extents, false);
720− kmem_free(ctx);
721−}
722−
723−/*
724− * Queue up the actual completion to a thread to avoid IRQ-safe locking for
725− * pagb_lock. Note that we need a unbounded workqueue, otherwise we might
726− * get the execution delayed up to 30 seconds for weird reasons.
727− */
728−static void
729−xlog_discard_endio(
730− struct bio *bio)
731−{
732− struct xfs_cil_ctx *ctx = bio->bi_private;
733−
734− INIT_WORK(&ctx->discard_endio_work, xlog_discard_endio_work);
735− queue_work(xfs_discard_wq, &ctx->discard_endio_work);
736− bio_put(bio);
737−}
738−
739−static void
740−xlog_discard_busy_extents(
741− struct xfs_mount *mp,
742− struct xfs_cil_ctx *ctx)
743−{
744− struct list_head *list = &ctx->busy_extents;
745− struct xfs_extent_busy *busyp;
746− struct bio *bio = NULL;
747− struct blk_plug plug;
748− int error = 0;
749−
750− ASSERT(xfs_has_discard(mp));
751−
752− blk_start_plug(&plug);
753− list_for_each_entry(busyp, list, list) {
754− trace_xfs_discard_extent(mp, busyp->agno, busyp->bno,
755− busyp->length);
756−
757− error = __blkdev_issue_discard(mp->m_ddev_targp->bt_bdev,
758− XFS_AGB_TO_DADDR(mp, busyp->agno, busyp->bno),
759− XFS_FSB_TO_BB(mp, busyp->length),
760− GFP_NOFS, &bio);
761− if (error && error != -EOPNOTSUPP) {
762− xfs_info(mp,
763− "discard failed for extent [0x%llx,%u], error %d",
764− (unsigned long long)busyp->bno,
765− busyp->length,
766− error);
767− break;
768− }
769− }
770−
771− if (bio) {
772− bio->bi_private = ctx;
773− bio->bi_end_io = xlog_discard_endio;
774− submit_bio(bio);
775− } else {
776− xlog_discard_endio_work(&ctx->discard_endio_work);
777− }
778− blk_finish_plug(&plug);
779−}
780−
781710 /*
782711 * Mark all items committed and clear busy extents. We free the log vector
783712 * chains in a separate pass so that we unpin the log items as quickly as
@@ -807,8 +736,8 @@ xlog_cil_committed( · 23 unmodified lines
807736 xfs_trans_committed_bulk(ctx->cil->xc_log->l_ailp, &ctx->lv_chain,
808737 ctx->start_lsn, abort);
809738
810− xfs_extent_busy_sort(&ctx->busy_extents);
811− xfs_extent_busy_clear(mp, &ctx->busy_extents,
739+ xfs_extent_busy_sort(&ctx->busy_extents.extent_list);
740+ xfs_extent_busy_clear(mp, &ctx->busy_extents.extent_list,
812741 xfs_has_discard(mp) && !abort);
813742
814743 spin_lock(&ctx->cil->xc_push_lock);
@@ -817,10 +746,14 @@ xlog_cil_committed( · 2 unmodified lines
817746
818747 xlog_cil_free_logvec(&ctx->lv_chain);
819748
820− if (!list_empty(&ctx->busy_extents))
821− xlog_discard_busy_extents(mp, ctx);
822− else
823− kmem_free(ctx);
749+ if (!list_empty(&ctx->busy_extents.extent_list)) {
750+ ctx->busy_extents.mount = mp;
751+ ctx->busy_extents.owner = ctx;
752+ xfs_discard_extents(mp, &ctx->busy_extents);
753+ return;
754+ }
755+
756+ kmem_free(ctx);
824757 }
825758
826759 void
fs/xfs/xfs_log_priv.h+3−2
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 #ifndef __XFS_LOG_PRIV_H__
77 #define __XFS_LOG_PRIV_H__
88
9+#include "xfs_extent_busy.h" /* for struct xfs_busy_extents */
10+
911 struct xfs_buf;
1012 struct xlog;
1113 struct xlog_ticket;
@@ -223,12 +225,11 @@ struct xfs_cil_ctx { · 211 unmodified lines
223225 struct xlog_in_core *commit_iclog;
224226 struct xlog_ticket *ticket; /* chkpt ticket */
225227 atomic_t space_used; /* aggregate size of regions */
226− struct list_head busy_extents; /* busy extents in chkpt */
228+ struct xfs_busy_extents busy_extents;
227229 struct list_head log_items; /* log items in chkpt */
228230 struct list_head lv_chain; /* logvecs being pushed */
229231 struct list_head iclog_entry;
230232 struct list_head committing; /* ctx committing list */
231− struct work_struct discard_endio_work;
232233 struct work_struct push_work;
233234 atomic_t order_id;
234235
fs/xfs/xfs_notify_failure.c+3−3
@@ -126,8 +126,8 @@ xfs_dax_notify_ddev_failure( · 125 unmodified lines
126126 struct xfs_rmap_irec ri_low = { };
127127 struct xfs_rmap_irec ri_high;
128128 struct xfs_agf *agf;
129− xfs_agblock_t agend;
130129 struct xfs_perag *pag;
130+ xfs_agblock_t range_agend;
131131
132132 pag = xfs_perag_get(mp, agno);
133133 error = xfs_alloc_read_agf(pag, tp, 0, &agf_bp);
@@ -148,10 +148,10 @@ xfs_dax_notify_ddev_failure( · 14 unmodified lines
148148 ri_high.rm_startblock = XFS_FSB_TO_AGBNO(mp, end_fsbno);
149149
150150 agf = agf_bp->b_addr;
151− agend = min(be32_to_cpu(agf->agf_length),
151+ range_agend = min(be32_to_cpu(agf->agf_length) - 1,
152152 ri_high.rm_startblock);
153153 notify.startblock = ri_low.rm_startblock;
154− notify.blockcount = agend - ri_low.rm_startblock;
154+ notify.blockcount = range_agend + 1 - ri_low.rm_startblock;
155155
156156 error = xfs_rmap_query_range(cur, &ri_low, &ri_high,
157157 xfs_dax_failure_fn, &notify);
include/acpi/processor.h+0−5
@@ -465,9 +465,4 @@ extern int acpi_processor_ffh_lpi_probe(unsigned int cpu); · 464 unmodified lines
465465 extern int acpi_processor_ffh_lpi_enter(struct acpi_lpi_state *lpi);
466466 #endif
467467
468−#ifdef CONFIG_ACPI_HOTPLUG_CPU
469−extern int arch_register_cpu(int cpu);
470−extern void arch_unregister_cpu(int cpu);
471−#endif
472−
473468 #endif
include/asm-generic/mshyperv.h+1−1
@@ -36,6 +36,7 @@ struct ms_hyperv_info { · 35 unmodified lines
3636 u32 nested_features;
3737 u32 max_vp_index;
3838 u32 max_lp_index;
39+ u8 vtl;
3940 union {
4041 u32 isolation_config_a;
4142 struct {
@@ -54,7 +55,6 @@ struct ms_hyperv_info { · 12 unmodified lines
5455 };
5556 };
5657 u64 shared_gpa_boundary;
57− u8 vtl;
5858 };
5959 extern struct ms_hyperv_info ms_hyperv;
6060 extern bool hv_nested;
include/linux/acpi.h+9−0
@@ -1480,6 +1480,15 @@ static inline int lpit_read_residency_count_address(u64 *address) · 1479 unmodified lines
14801480 }
14811481 #endif
14821482
1483+#ifdef CONFIG_ACPI_PROCESSOR_IDLE
1484+#ifndef arch_get_idle_state_flags
1485+static inline unsigned int arch_get_idle_state_flags(u32 arch_flags)
1486+{
1487+ return 0;
1488+}
1489+#endif
1490+#endif /* CONFIG_ACPI_PROCESSOR_IDLE */
1491+
14831492 #ifdef CONFIG_ACPI_PPTT
14841493 int acpi_pptt_cpu_is_thread(unsigned int cpu);
14851494 int find_acpi_cpu_topology(unsigned int cpu, int level);
include/linux/bpf.h+1−1
@@ -1307,7 +1307,7 @@ static inline int bpf_trampoline_unlink_prog(struct bpf_tramp_link *link, · 1306 unmodified lines
13071307 static inline struct bpf_trampoline *bpf_trampoline_get(u64 key,
13081308 struct bpf_attach_target_info *tgt_info)
13091309 {
1310− return ERR_PTR(-EOPNOTSUPP);
1310+ return NULL;
13111311 }
13121312 static inline void bpf_trampoline_put(struct bpf_trampoline *tr) {}
13131313 #define DEFINE_BPF_DISPATCHER(name)
include/linux/cgroup-defs.h+1−1
@@ -238,7 +238,7 @@ struct css_set { · 237 unmodified lines
238238 * Lists running through all tasks using this cgroup group.
239239 * mg_tasks lists tasks which belong to this cset but are in the
240240 * process of being migrated out or in. Protected by
241− * css_set_rwsem, but, during migration, once tasks are moved to
241+ * css_set_lock, but, during migration, once tasks are moved to
242242 * mg_tasks, it can be read safely while holding cgroup_mutex.
243243 */
244244 struct list_head tasks;
include/linux/cpu.h+2−0
@@ -80,6 +80,8 @@ extern __printf(4, 5) · 79 unmodified lines
8080 struct device *cpu_device_create(struct device *parent, void *drvdata,
8181 const struct attribute_group **groups,
8282 const char *fmt, ...);
83+extern int arch_register_cpu(int cpu);
84+extern void arch_unregister_cpu(int cpu);
8385 #ifdef CONFIG_HOTPLUG_CPU
8486 extern void unregister_cpu(struct cpu *cpu);
8587 extern ssize_t arch_cpu_probe(const char *, size_t);
include/linux/dma-fence.h+19−0
@@ -568,6 +568,25 @@ static inline void dma_fence_set_error(struct dma_fence *fence, · 567 unmodified lines
568568 fence->error = error;
569569 }
570570
571+/**
572+ * dma_fence_timestamp - helper to get the completion timestamp of a fence
573+ * @fence: fence to get the timestamp from.
574+ *
575+ * After a fence is signaled the timestamp is updated with the signaling time,
576+ * but setting the timestamp can race with tasks waiting for the signaling. This
577+ * helper busy waits for the correct timestamp to appear.
578+ */
579+static inline ktime_t dma_fence_timestamp(struct dma_fence *fence)
580+{
581+ if (WARN_ON(!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)))
582+ return ktime_get();
583+
584+ while (!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags))
585+ cpu_relax();
586+
587+ return fence->timestamp;
588+}
589+
571590 signed long dma_fence_wait_timeout(struct dma_fence *,
572591 bool intr, signed long timeout);
573592 signed long dma_fence_wait_any_timeout(struct dma_fence **fences,
include/linux/fs_context.h+2−0
@@ -136,6 +136,8 @@ extern struct fs_context *vfs_dup_fs_context(struct fs_context *fc); · 135 unmodified lines
136136 extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);
137137 extern int vfs_parse_fs_string(struct fs_context *fc, const char *key,
138138 const char *value, size_t v_size);
139+int vfs_parse_monolithic_sep(struct fs_context *fc, void *data,
140+ char *(*sep)(char **));
139141 extern int generic_parse_monolithic(struct fs_context *fc, void *data);
140142 extern int vfs_get_tree(struct fs_context *fc);
141143 extern void put_fs_context(struct fs_context *fc);
include/linux/mcb.h+0−1
@@ -63,7 +63,6 @@ static inline struct mcb_bus *to_mcb_bus(struct device *dev) · 62 unmodified lines
6363 struct mcb_device {
6464 struct device dev;
6565 struct mcb_bus *bus;
66− bool is_added;
6766 struct mcb_driver *driver;
6867 u16 id;
6968 int inst;
include/linux/netfilter/nf_conntrack_sctp.h+1−0
@@ -9,6 +9,7 @@ struct ip_ct_sctp { · 8 unmodified lines
99 enum sctp_conntrack state;
1010
1111 __be32 vtag[IP_CT_DIR_MAX];
12+ u8 init[IP_CT_DIR_MAX];
1213 u8 last_dir;
1314 u8 flags;
1415 };
include/linux/quota.h+3−1
@@ -285,7 +285,9 @@ static inline void dqstats_dec(unsigned int type) · 284 unmodified lines
285285 #define DQ_FAKE_B 3 /* no limits only usage */
286286 #define DQ_READ_B 4 /* dquot was read into memory */
287287 #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
288−#define DQ_LASTSET_B 6 /* Following 6 bits (see QIF_) are reserved\
288+#define DQ_RELEASING_B 6 /* dquot is in releasing_dquots list waiting
289+ * to be cleaned up */
290+#define DQ_LASTSET_B 7 /* Following 6 bits (see QIF_) are reserved\
289291 * for the mask of entries set via SETQUOTA\
290292 * quotactl. They are set under dq_data_lock\
291293 * and the quota format handling dquot can\
include/linux/quotaops.h+1−1
@@ -57,7 +57,7 @@ static inline bool dquot_is_busy(struct dquot *dquot) · 56 unmodified lines
5757 {
5858 if (test_bit(DQ_MOD_B, &dquot->dq_flags))
5959 return true;
60− if (atomic_read(&dquot->dq_count) > 1)
60+ if (atomic_read(&dquot->dq_count) > 0)
6161 return true;
6262 return false;
6363 }
include/linux/skbuff.h+2−2
@@ -1309,7 +1309,7 @@ struct sk_buff_fclones { · 1308 unmodified lines
13091309 *
13101310 * Returns true if skb is a fast clone, and its clone is not freed.
13111311 * Some drivers call skb_orphan() in their ndo_start_xmit(),
1312− * so we also check that this didnt happen.
1312+ * so we also check that didn't happen.
13131313 */
13141314 static inline bool skb_fclone_busy(const struct sock *sk,
13151315 const struct sk_buff *skb)
@@ -2016,7 +2016,7 @@ static inline struct sk_buff *skb_share_check(struct sk_buff *skb, gfp_t pri) · 700 unmodified lines
20162016 * Copy shared buffers into a new sk_buff. We effectively do COW on
20172017 * packets to handle cases where we have a local reader and forward
20182018 * and a couple of other messy ones. The normal one is tcpdumping
2019− * a packet thats being forwarded.
2019+ * a packet that's being forwarded.
20202020 */
20212021
20222022 /**
include/net/bluetooth/hci_core.h+1−1
@@ -350,7 +350,7 @@ struct hci_dev { · 349 unmodified lines
350350 struct list_head list;
351351 struct mutex lock;
352352
353− char name[8];
353+ const char *name;
354354 unsigned long flags;
355355 __u16 id;
356356 __u8 bus;
include/net/cfg80211.h+4−2
@@ -5941,6 +5941,7 @@ void wiphy_delayed_work_cancel(struct wiphy *wiphy, · 5940 unmodified lines
59415941 * @event_lock: (private) lock for event list
59425942 * @owner_nlportid: (private) owner socket port ID
59435943 * @nl_owner_dead: (private) owner socket went away
5944+ * @cqm_rssi_work: (private) CQM RSSI reporting work
59445945 * @cqm_config: (private) nl80211 RSSI monitor state
59455946 * @pmsr_list: (private) peer measurement requests
59465947 * @pmsr_lock: (private) peer measurements requests/results lock
@@ -6013,7 +6014,8 @@ struct wireless_dev { · 66 unmodified lines
60136014 } wext;
60146015 #endif
60156016
6016− struct cfg80211_cqm_config *cqm_config;
6017+ struct wiphy_work cqm_rssi_work;
6018+ struct cfg80211_cqm_config __rcu *cqm_config;
60176019
60186020 struct list_head pmsr_list;
60196021 spinlock_t pmsr_lock;
@@ -7231,7 +7233,7 @@ struct cfg80211_rx_assoc_resp { · 1211 unmodified lines
72317233 int uapsd_queues;
72327234 const u8 *ap_mld_addr;
72337235 struct {
7234− const u8 *addr;
7236+ u8 addr[ETH_ALEN] __aligned(2);
72357237 struct cfg80211_bss *bss;
72367238 u16 status;
72377239 } links[IEEE80211_MLD_MAX_NUM_LINKS];
include/net/ip_fib.h+1−0
@@ -154,6 +154,7 @@ struct fib_info { · 153 unmodified lines
154154 int fib_nhs;
155155 bool fib_nh_is_v6;
156156 bool nh_updated;
157+ bool pfsrc_removed;
157158 struct nexthop *nh;
158159 struct rcu_head rcu;
159160 struct fib_nh fib_nh[];
include/net/macsec.h+1−0
@@ -258,6 +258,7 @@ struct macsec_context { · 257 unmodified lines
258258 struct macsec_secy *secy;
259259 struct macsec_rx_sc *rx_sc;
260260 struct {
261+ bool update_pn;
261262 unsigned char assoc_num;
262263 u8 key[MACSEC_MAX_KEY_LEN];
263264 union {
include/net/mana/mana.h+3−2
@@ -103,9 +103,10 @@ struct mana_txq { · 102 unmodified lines
103103
104104 /* skb data and frags dma mappings */
105105 struct mana_skb_head {
106− dma_addr_t dma_handle[MAX_SKB_FRAGS + 1];
106+ /* GSO pkts may have 2 SGEs for the linear part*/
107+ dma_addr_t dma_handle[MAX_SKB_FRAGS + 2];
107108
108− u32 size[MAX_SKB_FRAGS + 1];
109+ u32 size[MAX_SKB_FRAGS + 2];
109110 };
110111
111112 #define MANA_HEADROOM sizeof(struct mana_skb_head)
include/net/neighbour.h+1−1
@@ -539,7 +539,7 @@ static inline int neigh_output(struct neighbour *n, struct sk_buff *skb, · 538 unmodified lines
539539 READ_ONCE(hh->hh_len))
540540 return neigh_hh_output(hh, skb);
541541
542− return n->output(n, skb);
542+ return READ_ONCE(n->output)(n, skb);
543543 }
544544
545545 static inline struct neighbour *
include/net/page_pool/helpers.h+3−3
@@ -16,13 +16,13 @@ · 15 unmodified lines
1616 * page_pool_alloc_pages() call. Drivers should use
1717 * page_pool_dev_alloc_pages() replacing dev_alloc_pages().
1818 *
19− * API keeps track of in-flight pages, in order to let API user know
19+ * The API keeps track of in-flight pages, in order to let API users know
2020 * when it is safe to free a page_pool object. Thus, API users
2121 * must call page_pool_put_page() to free the page, or attach
22− * the page to a page_pool-aware objects like skbs marked with
22+ * the page to a page_pool-aware object like skbs marked with
2323 * skb_mark_for_recycle().
2424 *
25− * API user must call page_pool_put_page() once on a page, as it
25+ * API users must call page_pool_put_page() once on a page, as it
2626 * will either recycle the page, or in case of refcnt > 1, it will
2727 * release the DMA mapping and in-flight state accounting.
2828 */
include/net/tcp.h+4−2
@@ -348,12 +348,14 @@ ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, · 347 unmodified lines
348348 struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, gfp_t gfp,
349349 bool force_schedule);
350350
351−static inline void tcp_dec_quickack_mode(struct sock *sk,
352− const unsigned int pkts)
351+static inline void tcp_dec_quickack_mode(struct sock *sk)
353352 {
354353 struct inet_connection_sock *icsk = inet_csk(sk);
355354
356355 if (icsk->icsk_ack.quick) {
356+ /* How many ACKs S/ACKing new data have we sent? */
357+ const unsigned int pkts = inet_csk_ack_scheduled(sk) ? 1 : 0;
358+
357359 if (pkts >= icsk->icsk_ack.quick) {
358360 icsk->icsk_ack.quick = 0;
359361 /* Leaving quickack mode we deflate ATO. */
include/sound/soc.h+2−0
@@ -1126,6 +1126,8 @@ struct snd_soc_pcm_runtime { · 1125 unmodified lines
11261126 unsigned int pop_wait:1;
11271127 unsigned int fe_compr:1; /* for Dynamic PCM */
11281128
1129+ bool initialized;
1130+
11291131 int num_components;
11301132 struct snd_soc_component *components[]; /* CPU/Codec/Platform */
11311133 };
include/uapi/drm/nouveau_drm.h+10−0
@@ -44,6 +44,16 @@ extern "C" { · 43 unmodified lines
4444 #define NOUVEAU_GETPARAM_PTIMER_TIME 14
4545 #define NOUVEAU_GETPARAM_HAS_BO_USAGE 15
4646 #define NOUVEAU_GETPARAM_HAS_PAGEFLIP 16
47+
48+/**
49+ * @NOUVEAU_GETPARAM_EXEC_PUSH_MAX
50+ *
51+ * Query the maximum amount of IBs that can be pushed through a single
52+ * &drm_nouveau_exec structure and hence a single &DRM_IOCTL_NOUVEAU_EXEC
53+ * ioctl().
54+ */
55+#define NOUVEAU_GETPARAM_EXEC_PUSH_MAX 17
56+
4757 struct drm_nouveau_getparam {
4858 __u64 param;
4959 __u64 value;
include/uapi/linux/if_packet.h+1−5
@@ -18,11 +18,7 @@ struct sockaddr_ll { · 17 unmodified lines
1818 unsigned short sll_hatype;
1919 unsigned char sll_pkttype;
2020 unsigned char sll_halen;
21− union {
22− unsigned char sll_addr[8];
23− /* Actual length is in sll_halen. */
24− __DECLARE_FLEX_ARRAY(unsigned char, sll_addr_flex);
25− };
21+ unsigned char sll_addr[8];
2622 };
2723
2824 /* Packet types */
io_uring/io-wq.c+4−6
@@ -1151,9 +1151,6 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) · 1150 unmodified lines
11511151 wq = kzalloc(sizeof(struct io_wq), GFP_KERNEL);
11521152 if (!wq)
11531153 return ERR_PTR(-ENOMEM);
1154− ret = cpuhp_state_add_instance_nocalls(io_wq_online, &wq->cpuhp_node);
1155− if (ret)
1156− goto err_wq;
11571154
11581155 refcount_inc(&data->hash->refs);
11591156 wq->hash = data->hash;
@@ -1186,13 +1183,14 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data) · 26 unmodified lines
11861183 wq->task = get_task_struct(data->task);
11871184 atomic_set(&wq->worker_refs, 1);
11881185 init_completion(&wq->worker_done);
1186+ ret = cpuhp_state_add_instance_nocalls(io_wq_online, &wq->cpuhp_node);
1187+ if (ret)
1188+ goto err;
1189+
11891190 return wq;
11901191 err:
11911192 io_wq_put_hash(data->hash);
1192− cpuhp_state_remove_instance_nocalls(io_wq_online, &wq->cpuhp_node);
1193−
11941193 free_cpumask_var(wq->cpu_mask);
1195−err_wq:
11961194 kfree(wq);
11971195 return ERR_PTR(ret);
11981196 }
io_uring/io_uring.c+15−1
@@ -2686,7 +2686,7 @@ static void *__io_uaddr_map(struct page ***pages, unsigned short *npages, · 2685 unmodified lines
26862686 {
26872687 struct page **page_array;
26882688 unsigned int nr_pages;
2689− int ret;
2689+ int ret, i;
26902690
26912691 *npages = 0;
26922692
@@ -2716,6 +2716,20 @@ err: · 23 unmodified lines
27162716 */
27172717 if (page_array[0] != page_array[ret - 1])
27182718 goto err;
2719+
2720+ /*
2721+ * Can't support mapping user allocated ring memory on 32-bit archs
2722+ * where it could potentially reside in highmem. Just fail those with
2723+ * -EINVAL, just like we did on kernels that didn't support this
2724+ * feature.
2725+ */
2726+ for (i = 0; i < nr_pages; i++) {
2727+ if (PageHighMem(page_array[i])) {
2728+ ret = -EINVAL;
2729+ goto err;
2730+ }
2731+ }
2732+
27192733 *pages = page_array;
27202734 *npages = nr_pages;
27212735 return page_to_virt(page_array[0]);
io_uring/io_uring.h+27−14
@@ -86,20 +86,33 @@ bool __io_alloc_req_refill(struct io_ring_ctx *ctx); · 85 unmodified lines
8686 bool io_match_task_safe(struct io_kiocb *head, struct task_struct *task,
8787 bool cancel_all);
8888
89−#define io_lockdep_assert_cq_locked(ctx) \
90− do { \
91− lockdep_assert(in_task()); \
92− \
93− if (ctx->flags & IORING_SETUP_IOPOLL) { \
94− lockdep_assert_held(&ctx->uring_lock); \
95− } else if (!ctx->task_complete) { \
96− lockdep_assert_held(&ctx->completion_lock); \
97− } else if (ctx->submitter_task->flags & PF_EXITING) { \
98− lockdep_assert(current_work()); \
99− } else { \
100− lockdep_assert(current == ctx->submitter_task); \
101− } \
102− } while (0)
89+#if defined(CONFIG_PROVE_LOCKING)
90+static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
91+{
92+ lockdep_assert(in_task());
93+
94+ if (ctx->flags & IORING_SETUP_IOPOLL) {
95+ lockdep_assert_held(&ctx->uring_lock);
96+ } else if (!ctx->task_complete) {
97+ lockdep_assert_held(&ctx->completion_lock);
98+ } else if (ctx->submitter_task) {
99+ /*
100+ * ->submitter_task may be NULL and we can still post a CQE,
101+ * if the ring has been setup with IORING_SETUP_R_DISABLED.
102+ * Not from an SQE, as those cannot be submitted, but via
103+ * updating tagged resources.
104+ */
105+ if (ctx->submitter_task->flags & PF_EXITING)
106+ lockdep_assert(current_work());
107+ else
108+ lockdep_assert(current == ctx->submitter_task);
109+ }
110+}
111+#else
112+static inline void io_lockdep_assert_cq_locked(struct io_ring_ctx *ctx)
113+{
114+}
115+#endif
103116
104117 static inline void io_req_task_work_add(struct io_kiocb *req)
105118 {
io_uring/kbuf.c+19−8
@@ -477,7 +477,7 @@ static int io_pin_pbuf_ring(struct io_uring_buf_reg *reg, · 476 unmodified lines
477477 {
478478 struct io_uring_buf_ring *br;
479479 struct page **pages;
480− int nr_pages;
480+ int i, nr_pages;
481481
482482 pages = io_pin_pages(reg->ring_addr,
483483 flex_array_size(br, bufs, reg->ring_entries),
@@ -485,6 +485,17 @@ static int io_pin_pbuf_ring(struct io_uring_buf_reg *reg, · 1 unmodified line
485485 if (IS_ERR(pages))
486486 return PTR_ERR(pages);
487487
488+ /*
489+ * Apparently some 32-bit boxes (ARM) will return highmem pages,
490+ * which then need to be mapped. We could support that, but it'd
491+ * complicate the code and slowdown the common cases quite a bit.
492+ * So just error out, returning -EINVAL just like we did on kernels
493+ * that didn't support mapped buffer rings.
494+ */
495+ for (i = 0; i < nr_pages; i++)
496+ if (PageHighMem(pages[i]))
497+ goto error_unpin;
498+
488499 br = page_address(pages[0]);
489500 #ifdef SHM_COLOUR
490501 /*
@@ -496,13 +507,8 @@ static int io_pin_pbuf_ring(struct io_uring_buf_reg *reg, · 5 unmodified lines
496507 * should use IOU_PBUF_RING_MMAP instead, and liburing will handle
497508 * this transparently.
498509 */
499− if ((reg->ring_addr | (unsigned long) br) & (SHM_COLOUR - 1)) {
500− int i;
501−
502− for (i = 0; i < nr_pages; i++)
503− unpin_user_page(pages[i]);
504− return -EINVAL;
505− }
510+ if ((reg->ring_addr | (unsigned long) br) & (SHM_COLOUR - 1))
511+ goto error_unpin;
506512 #endif
507513 bl->buf_pages = pages;
508514 bl->buf_nr_pages = nr_pages;
@@ -510,6 +516,11 @@ static int io_pin_pbuf_ring(struct io_uring_buf_reg *reg, · 1 unmodified line
510516 bl->is_mapped = 1;
511517 bl->is_mmap = 0;
512518 return 0;
519+error_unpin:
520+ for (i = 0; i < nr_pages; i++)
521+ unpin_user_page(pages[i]);
522+ kvfree(pages);
523+ return -EINVAL;
513524 }
514525
515526 static int io_alloc_pbuf_ring(struct io_uring_buf_reg *reg,
kernel/bpf/memalloc.c+19−25
@@ -965,37 +965,31 @@ void notrace *bpf_mem_cache_alloc_flags(struct bpf_mem_alloc *ma, gfp_t flags) · 964 unmodified lines
965965 return !ret ? NULL : ret + LLIST_NODE_SZ;
966966 }
967967
968−/* Most of the logic is taken from setup_kmalloc_cache_index_table() */
969968 static __init int bpf_mem_cache_adjust_size(void)
970969 {
971− unsigned int size, index;
970+ unsigned int size;
972971
973− /* Normally KMALLOC_MIN_SIZE is 8-bytes, but it can be
974− * up-to 256-bytes.
972+ /* Adjusting the indexes in size_index() according to the object_size
973+ * of underlying slab cache, so bpf_mem_alloc() will select a
974+ * bpf_mem_cache with unit_size equal to the object_size of
975+ * the underlying slab cache.
976+ *
977+ * The maximal value of KMALLOC_MIN_SIZE and __kmalloc_minalign() is
978+ * 256-bytes, so only do adjustment for [8-bytes, 192-bytes].
975979 */
976− size = KMALLOC_MIN_SIZE;
977− if (size <= 192)
978− index = size_index[(size - 1) / 8];
979− else
980− index = fls(size - 1) - 1;
981− for (size = 8; size < KMALLOC_MIN_SIZE && size <= 192; size += 8)
982− size_index[(size - 1) / 8] = index;
980+ for (size = 192; size >= 8; size -= 8) {
981+ unsigned int kmalloc_size, index;
983982
984− /* The minimal alignment is 64-bytes, so disable 96-bytes cache and
985− * use 128-bytes cache instead.
986− */
987− if (KMALLOC_MIN_SIZE >= 64) {
988− index = size_index[(128 - 1) / 8];
989− for (size = 64 + 8; size <= 96; size += 8)
990− size_index[(size - 1) / 8] = index;
991− }
983+ kmalloc_size = kmalloc_size_roundup(size);
984+ if (kmalloc_size == size)
985+ continue;
992986
993− /* The minimal alignment is 128-bytes, so disable 192-bytes cache and
994− * use 256-bytes cache instead.
995− */
996− if (KMALLOC_MIN_SIZE >= 128) {
997− index = fls(256 - 1) - 1;
998− for (size = 128 + 8; size <= 192; size += 8)
987+ if (kmalloc_size <= 192)
988+ index = size_index[(kmalloc_size - 1) / 8];
989+ else
990+ index = fls(kmalloc_size - 1) - 1;
991+ /* Only overwrite if necessary */
992+ if (size_index[(size - 1) / 8] != index)
999993 size_index[(size - 1) / 8] = index;
1000994 }
1001995
kernel/bpf/mprog.c+9−4
@@ -253,6 +253,9 @@ int bpf_mprog_attach(struct bpf_mprog_entry *entry, · 252 unmodified lines
253253 goto out;
254254 }
255255 idx = tidx;
256+ } else if (bpf_mprog_total(entry) == bpf_mprog_max()) {
257+ ret = -ERANGE;
258+ goto out;
256259 }
257260 if (flags & BPF_F_BEFORE) {
258261 tidx = bpf_mprog_pos_before(entry, &rtuple);
@@ -398,14 +401,16 @@ int bpf_mprog_query(const union bpf_attr *attr, union bpf_attr __user *uattr, · 139 unmodified lines
398401 struct bpf_mprog_cp *cp;
399402 struct bpf_prog *prog;
400403 const u32 flags = 0;
404+ u32 id, count = 0;
405+ u64 revision = 1;
401406 int i, ret = 0;
402− u32 id, count;
403− u64 revision;
404407
405408 if (attr->query.query_flags || attr->query.attach_flags)
406409 return -EINVAL;
407− revision = bpf_mprog_revision(entry);
408− count = bpf_mprog_total(entry);
410+ if (entry) {
411+ revision = bpf_mprog_revision(entry);
412+ count = bpf_mprog_total(entry);
413+ }
409414 if (copy_to_user(&uattr->query.attach_flags, &flags, sizeof(flags)))
410415 return -EFAULT;
411416 if (copy_to_user(&uattr->query.revision, &revision, sizeof(revision)))
kernel/bpf/syscall.c+15−6
@@ -3796,7 +3796,6 @@ static int bpf_prog_attach(const union bpf_attr *attr) · 3795 unmodified lines
37963796 {
37973797 enum bpf_prog_type ptype;
37983798 struct bpf_prog *prog;
3799− u32 mask;
38003799 int ret;
38013800
38023801 if (CHECK_ATTR(BPF_PROG_ATTACH))
@@ -3805,10 +3804,16 @@ static int bpf_prog_attach(const union bpf_attr *attr) · 2 unmodified lines
38053804 ptype = attach_type_to_prog_type(attr->attach_type);
38063805 if (ptype == BPF_PROG_TYPE_UNSPEC)
38073806 return -EINVAL;
3808− mask = bpf_mprog_supported(ptype) ?
3809− BPF_F_ATTACH_MASK_MPROG : BPF_F_ATTACH_MASK_BASE;
3810− if (attr->attach_flags & ~mask)
3811− return -EINVAL;
3807+ if (bpf_mprog_supported(ptype)) {
3808+ if (attr->attach_flags & ~BPF_F_ATTACH_MASK_MPROG)
3809+ return -EINVAL;
3810+ } else {
3811+ if (attr->attach_flags & ~BPF_F_ATTACH_MASK_BASE)
3812+ return -EINVAL;
3813+ if (attr->relative_fd ||
3814+ attr->expected_revision)
3815+ return -EINVAL;
3816+ }
38123817
38133818 prog = bpf_prog_get_type(attr->attach_bpf_fd, ptype);
38143819 if (IS_ERR(prog))
@@ -3878,6 +3883,10 @@ static int bpf_prog_detach(const union bpf_attr *attr) · 63 unmodified lines
38783883 if (IS_ERR(prog))
38793884 return PTR_ERR(prog);
38803885 }
3886+ } else if (attr->attach_flags ||
3887+ attr->relative_fd ||
3888+ attr->expected_revision) {
3889+ return -EINVAL;
38813890 }
38823891
38833892 switch (ptype) {
@@ -3913,7 +3922,7 @@ static int bpf_prog_detach(const union bpf_attr *attr) · 29 unmodified lines
39133922 return ret;
39143923 }
39153924
3916−#define BPF_PROG_QUERY_LAST_FIELD query.link_attach_flags
3925+#define BPF_PROG_QUERY_LAST_FIELD query.revision
39173926
39183927 static int bpf_prog_query(const union bpf_attr *attr,
39193928 union bpf_attr __user *uattr)
kernel/bpf/tcx.c+1−7
@@ -123,7 +123,6 @@ int tcx_prog_query(const union bpf_attr *attr, union bpf_attr __user *uattr) · 122 unmodified lines
123123 {
124124 bool ingress = attr->query.attach_type == BPF_TCX_INGRESS;
125125 struct net *net = current->nsproxy->net_ns;
126− struct bpf_mprog_entry *entry;
127126 struct net_device *dev;
128127 int ret;
129128
@@ -133,12 +132,7 @@ int tcx_prog_query(const union bpf_attr *attr, union bpf_attr __user *uattr) · 3 unmodified lines
133132 ret = -ENODEV;
134133 goto out;
135134 }
136− entry = tcx_entry_fetch(dev, ingress);
137− if (!entry) {
138− ret = -ENOENT;
139− goto out;
140− }
141− ret = bpf_mprog_query(attr, uattr, entry);
135+ ret = bpf_mprog_query(attr, uattr, tcx_entry_fetch(dev, ingress));
142136 out:
143137 rtnl_unlock();
144138 return ret;
kernel/bpf/verifier.c+6−8
@@ -4047,11 +4047,9 @@ static int __mark_chain_precision(struct bpf_verifier_env *env, int regno) · 4046 unmodified lines
40474047 bitmap_from_u64(mask, bt_reg_mask(bt));
40484048 for_each_set_bit(i, mask, 32) {
40494049 reg = &st->frame[0]->regs[i];
4050− if (reg->type != SCALAR_VALUE) {
4051− bt_clear_reg(bt, i);
4052− continue;
4053− }
4054− reg->precise = true;
4050+ bt_clear_reg(bt, i);
4051+ if (reg->type == SCALAR_VALUE)
4052+ reg->precise = true;
40554053 }
40564054 return 0;
40574055 }
@@ -14481,7 +14479,7 @@ static int check_return_code(struct bpf_verifier_env *env) · 10423 unmodified lines
1448114479 struct tnum enforce_attach_type_range = tnum_unknown;
1448214480 const struct bpf_prog *prog = env->prog;
1448314481 struct bpf_reg_state *reg;
14484− struct tnum range = tnum_range(0, 1);
14482+ struct tnum range = tnum_range(0, 1), const_0 = tnum_const(0);
1448514483 enum bpf_prog_type prog_type = resolve_prog_type(env->prog);
1448614484 int err;
1448714485 struct bpf_func_state *frame = env->cur_state->frame[0];
@@ -14529,8 +14527,8 @@ static int check_return_code(struct bpf_verifier_env *env) · 41 unmodified lines
1452914527 return -EINVAL;
1453014528 }
1453114529
14532− if (!tnum_in(tnum_const(0), reg->var_off)) {
14533− verbose_invalid_scalar(env, reg, &range, "async callback", "R0");
14530+ if (!tnum_in(const_0, reg->var_off)) {
14531+ verbose_invalid_scalar(env, reg, &const_0, "async callback", "R0");
1453414532 return -EINVAL;
1453514533 }
1453614534 return 0;
kernel/cgroup/cgroup-v1.c+2−3
@@ -360,10 +360,9 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type, · 359 unmodified lines
360360 }
361361 css_task_iter_end(&it);
362362 length = n;
363− /* now sort & (if procs) strip out duplicates */
363+ /* now sort & strip out duplicates (tgids or recycled thread PIDs) */
364364 sort(array, length, sizeof(pid_t), cmppid, NULL);
365− if (type == CGROUP_FILE_PROCS)
366− length = pidlist_uniq(array, length);
365+ length = pidlist_uniq(array, length);
367366
368367 l = cgroup_pidlist_find_create(cgrp, type);
369368 if (!l) {
kernel/power/snapshot.c+2−2
@@ -2647,7 +2647,7 @@ static int prepare_image(struct memory_bitmap *new_bm, struct memory_bitmap *bm, · 2646 unmodified lines
26472647 memory_bm_free(bm, PG_UNSAFE_KEEP);
26482648
26492649 /* Make a copy of zero_bm so it can be created in safe pages */
2650− error = memory_bm_create(&tmp, GFP_ATOMIC, PG_ANY);
2650+ error = memory_bm_create(&tmp, GFP_ATOMIC, PG_SAFE);
26512651 if (error)
26522652 goto Free;
26532653
@@ -2660,7 +2660,7 @@ static int prepare_image(struct memory_bitmap *new_bm, struct memory_bitmap *bm, · 6 unmodified lines
26602660 goto Free;
26612661
26622662 duplicate_memory_bitmap(zero_bm, &tmp);
2663− memory_bm_free(&tmp, PG_UNSAFE_KEEP);
2663+ memory_bm_free(&tmp, PG_UNSAFE_CLEAR);
26642664 /* At this point zero_bm is in safe pages and it can be used for restoring. */
26652665
26662666 if (nr_highmem > 0) {
kernel/printk/printk.c+7−1
@@ -3740,12 +3740,18 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre · 3739 unmodified lines
37403740
37413741 seq = prb_next_seq(prb);
37423742
3743+ /* Flush the consoles so that records up to @seq are printed. */
3744+ console_lock();
3745+ console_unlock();
3746+
37433747 for (;;) {
37443748 diff = 0;
37453749
37463750 /*
37473751 * Hold the console_lock to guarantee safe access to
3748− * console->seq.
3752+ * console->seq. Releasing console_lock flushes more
3753+ * records in case @seq is still not printed on all
3754+ * usable consoles.
37493755 */
37503756 console_lock();
37513757
kernel/sched/cpufreq_schedutil.c+2−1
@@ -350,7 +350,8 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time, · 349 unmodified lines
350350 * Except when the rq is capped by uclamp_max.
351351 */
352352 if (!uclamp_rq_is_capped(cpu_rq(sg_cpu->cpu)) &&
353− sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
353+ sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq &&
354+ !sg_policy->need_freq_update) {
354355 next_f = sg_policy->next_freq;
355356
356357 /* Restore cached freq as next_freq has changed */
kernel/sched/fair.c+72−17
@@ -664,6 +664,10 @@ void avg_vruntime_update(struct cfs_rq *cfs_rq, s64 delta) · 663 unmodified lines
664664 cfs_rq->avg_vruntime -= cfs_rq->avg_load * delta;
665665 }
666666
667+/*
668+ * Specifically: avg_runtime() + 0 must result in entity_eligible() := true
669+ * For this to be so, the result of this function must have a left bias.
670+ */
667671 u64 avg_vruntime(struct cfs_rq *cfs_rq)
668672 {
669673 struct sched_entity *curr = cfs_rq->curr;
@@ -677,8 +681,12 @@ u64 avg_vruntime(struct cfs_rq *cfs_rq) · 7 unmodified lines
677681 load += weight;
678682 }
679683
680− if (load)
684+ if (load) {
685+ /* sign flips effective floor / ceil */
686+ if (avg < 0)
687+ avg -= (load - 1);
681688 avg = div_s64(avg, load);
689+ }
682690
683691 return cfs_rq->min_vruntime + avg;
684692 }
@@ -864,14 +872,16 @@ struct sched_entity *__pick_first_entity(struct cfs_rq *cfs_rq) · 179 unmodified lines
864872 *
865873 * Which allows an EDF like search on (sub)trees.
866874 */
867−static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
875+static struct sched_entity *__pick_eevdf(struct cfs_rq *cfs_rq)
868876 {
869877 struct rb_node *node = cfs_rq->tasks_timeline.rb_root.rb_node;
870878 struct sched_entity *curr = cfs_rq->curr;
871879 struct sched_entity *best = NULL;
880+ struct sched_entity *best_left = NULL;
872881
873882 if (curr && (!curr->on_rq || !entity_eligible(cfs_rq, curr)))
874883 curr = NULL;
884+ best = curr;
875885
876886 /*
877887 * Once selected, run a task until it either becomes non-eligible or
@@ -892,33 +902,75 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) · 14 unmodified lines
892902 }
893903
894904 /*
895− * If this entity has an earlier deadline than the previous
896− * best, take this one. If it also has the earliest deadline
897− * of its subtree, we're done.
905+ * Now we heap search eligible trees for the best (min_)deadline
898906 */
899− if (!best || deadline_gt(deadline, best, se)) {
907+ if (!best || deadline_gt(deadline, best, se))
900908 best = se;
901− if (best->deadline == best->min_deadline)
902− break;
903− }
904909
905910 /*
906− * If the earlest deadline in this subtree is in the fully
907− * eligible left half of our space, go there.
911+ * Every se in a left branch is eligible, keep track of the
912+ * branch with the best min_deadline
908913 */
914+ if (node->rb_left) {
915+ struct sched_entity *left = __node_2_se(node->rb_left);
916+
917+ if (!best_left || deadline_gt(min_deadline, best_left, left))
918+ best_left = left;
919+
920+ /*
921+ * min_deadline is in the left branch. rb_left and all
922+ * descendants are eligible, so immediately switch to the second
923+ * loop.
924+ */
925+ if (left->min_deadline == se->min_deadline)
926+ break;
927+ }
928+
929+ /* min_deadline is at this node, no need to look right */
930+ if (se->deadline == se->min_deadline)
931+ break;
932+
933+ /* else min_deadline is in the right branch. */
934+ node = node->rb_right;
935+ }
936+
937+ /*
938+ * We ran into an eligible node which is itself the best.
939+ * (Or nr_running == 0 and both are NULL)
940+ */
941+ if (!best_left || (s64)(best_left->min_deadline - best->deadline) > 0)
942+ return best;
943+
944+ /*
945+ * Now best_left and all of its children are eligible, and we are just
946+ * looking for deadline == min_deadline
947+ */
948+ node = &best_left->run_node;
949+ while (node) {
950+ struct sched_entity *se = __node_2_se(node);
951+
952+ /* min_deadline is the current node */
953+ if (se->deadline == se->min_deadline)
954+ return se;
955+
956+ /* min_deadline is in the left branch */
909957 if (node->rb_left &&
910958 __node_2_se(node->rb_left)->min_deadline == se->min_deadline) {
911959 node = node->rb_left;
912960 continue;
913961 }
914962
963+ /* else min_deadline is in the right branch */
915964 node = node->rb_right;
916965 }
966+ return NULL;
967+}
917968
918− if (!best || (curr && deadline_gt(deadline, best, curr)))
919− best = curr;
969+static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq)
970+{
971+ struct sched_entity *se = __pick_eevdf(cfs_rq);
920972
921− if (unlikely(!best)) {
973+ if (!se) {
922974 struct sched_entity *left = __pick_first_entity(cfs_rq);
923975 if (left) {
924976 pr_err("EEVDF scheduling fail, picking leftmost\n");
@@ -926,7 +978,7 @@ static struct sched_entity *pick_eevdf(struct cfs_rq *cfs_rq) · 1 unmodified line
926978 }
927979 }
928980
929− return best;
981+ return se;
930982 }
931983
932984 #ifdef CONFIG_SCHED_DEBUG
@@ -3605,6 +3657,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, · 2672 unmodified lines
36053657 */
36063658 deadline = div_s64(deadline * old_weight, weight);
36073659 se->deadline = se->vruntime + deadline;
3660+ min_deadline_cb_propagate(&se->run_node, NULL);
36083661 }
36093662
36103663 #ifdef CONFIG_SMP
@@ -4919,10 +4972,12 @@ static inline void update_misfit_status(struct task_struct *p, struct rq *rq) {} · 1308 unmodified lines
49194972 static void
49204973 place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
49214974 {
4922− u64 vslice = calc_delta_fair(se->slice, se);
4923− u64 vruntime = avg_vruntime(cfs_rq);
4975+ u64 vslice, vruntime = avg_vruntime(cfs_rq);
49244976 s64 lag = 0;
49254977
4978+ se->slice = sysctl_sched_base_slice;
4979+ vslice = calc_delta_fair(se->slice, se);
4980+
49264981 /*
49274982 * Due to how V is constructed as the weighted average of entities,
49284983 * adding tasks with positive lag, or removing tasks with negative lag
kernel/workqueue.c+19−5
@@ -2166,7 +2166,7 @@ static struct worker *create_worker(struct worker_pool *pool) · 2165 unmodified lines
21662166 {
21672167 struct worker *worker;
21682168 int id;
2169− char id_buf[16];
2169+ char id_buf[23];
21702170
21712171 /* ID is needed to determine kthread name */
21722172 id = ida_alloc(&pool->worker_ida, GFP_KERNEL);
@@ -4600,12 +4600,22 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq) · 2427 unmodified lines
46004600 }
46014601 cpus_read_unlock();
46024602
4603+ /* for unbound pwq, flush the pwq_release_worker ensures that the
4604+ * pwq_release_workfn() completes before calling kfree(wq).
4605+ */
4606+ if (ret)
4607+ kthread_flush_worker(pwq_release_worker);
4608+
46034609 return ret;
46044610
46054611 enomem:
46064612 if (wq->cpu_pwq) {
4607− for_each_possible_cpu(cpu)
4608− kfree(*per_cpu_ptr(wq->cpu_pwq, cpu));
4613+ for_each_possible_cpu(cpu) {
4614+ struct pool_workqueue *pwq = *per_cpu_ptr(wq->cpu_pwq, cpu);
4615+
4616+ if (pwq)
4617+ kmem_cache_free(pwq_cache, pwq);
4618+ }
46094619 free_percpu(wq->cpu_pwq);
46104620 wq->cpu_pwq = NULL;
46114621 }
@@ -5782,9 +5792,13 @@ static int workqueue_apply_unbound_cpumask(const cpumask_var_t unbound_cpumask) · 1170 unmodified lines
57825792 list_for_each_entry(wq, &workqueues, list) {
57835793 if (!(wq->flags & WQ_UNBOUND))
57845794 continue;
5795+
57855796 /* creating multiple pwqs breaks ordering guarantee */
5786− if (wq->flags & __WQ_ORDERED)
5787− continue;
5797+ if (!list_empty(&wq->pwqs)) {
5798+ if (wq->flags & __WQ_ORDERED_EXPLICIT)
5799+ continue;
5800+ wq->flags &= ~__WQ_ORDERED;
5801+ }
57885802
57895803 ctx = apply_wqattrs_prepare(wq, wq->unbound_attrs, unbound_cpumask);
57905804 if (IS_ERR(ctx)) {
net/bluetooth/hci_conn.c+35−28
@@ -2413,34 +2413,41 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type, · 2412 unmodified lines
24132413 if (!test_bit(HCI_CONN_AUTH, &conn->flags))
24142414 goto auth;
24152415
2416− /* An authenticated FIPS approved combination key has sufficient
2417− * security for security level 4. */
2418− if (conn->key_type == HCI_LK_AUTH_COMBINATION_P256 &&
2419− sec_level == BT_SECURITY_FIPS)
2420− goto encrypt;
2421−
2422− /* An authenticated combination key has sufficient security for
2423− security level 3. */
2424− if ((conn->key_type == HCI_LK_AUTH_COMBINATION_P192 ||
2425− conn->key_type == HCI_LK_AUTH_COMBINATION_P256) &&
2426− sec_level == BT_SECURITY_HIGH)
2427− goto encrypt;
2428−
2429− /* An unauthenticated combination key has sufficient security for
2430− security level 1 and 2. */
2431− if ((conn->key_type == HCI_LK_UNAUTH_COMBINATION_P192 ||
2432− conn->key_type == HCI_LK_UNAUTH_COMBINATION_P256) &&
2433− (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW))
2434− goto encrypt;
2435−
2436− /* A combination key has always sufficient security for the security
2437− levels 1 or 2. High security level requires the combination key
2438− is generated using maximum PIN code length (16).
2439− For pre 2.1 units. */
2440− if (conn->key_type == HCI_LK_COMBINATION &&
2441− (sec_level == BT_SECURITY_MEDIUM || sec_level == BT_SECURITY_LOW ||
2442− conn->pin_length == 16))
2443− goto encrypt;
2416+ switch (conn->key_type) {
2417+ case HCI_LK_AUTH_COMBINATION_P256:
2418+ /* An authenticated FIPS approved combination key has
2419+ * sufficient security for security level 4 or lower.
2420+ */
2421+ if (sec_level <= BT_SECURITY_FIPS)
2422+ goto encrypt;
2423+ break;
2424+ case HCI_LK_AUTH_COMBINATION_P192:
2425+ /* An authenticated combination key has sufficient security for
2426+ * security level 3 or lower.
2427+ */
2428+ if (sec_level <= BT_SECURITY_HIGH)
2429+ goto encrypt;
2430+ break;
2431+ case HCI_LK_UNAUTH_COMBINATION_P192:
2432+ case HCI_LK_UNAUTH_COMBINATION_P256:
2433+ /* An unauthenticated combination key has sufficient security
2434+ * for security level 2 or lower.
2435+ */
2436+ if (sec_level <= BT_SECURITY_MEDIUM)
2437+ goto encrypt;
2438+ break;
2439+ case HCI_LK_COMBINATION:
2440+ /* A combination key has always sufficient security for the
2441+ * security levels 2 or lower. High security level requires the
2442+ * combination key is generated using maximum PIN code length
2443+ * (16). For pre 2.1 units.
2444+ */
2445+ if (sec_level <= BT_SECURITY_MEDIUM || conn->pin_length == 16)
2446+ goto encrypt;
2447+ break;
2448+ default:
2449+ break;
2450+ }
24442451
24452452 auth:
24462453 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags))
net/bluetooth/hci_core.c+11−3
@@ -2617,7 +2617,11 @@ int hci_register_dev(struct hci_dev *hdev) · 2616 unmodified lines
26172617 if (id < 0)
26182618 return id;
26192619
2620− snprintf(hdev->name, sizeof(hdev->name), "hci%d", id);
2620+ error = dev_set_name(&hdev->dev, "hci%u", id);
2621+ if (error)
2622+ return error;
2623+
2624+ hdev->name = dev_name(&hdev->dev);
26212625 hdev->id = id;
26222626
26232627 BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
@@ -2639,8 +2643,6 @@ int hci_register_dev(struct hci_dev *hdev) · 15 unmodified lines
26392643 if (!IS_ERR_OR_NULL(bt_debugfs))
26402644 hdev->debugfs = debugfs_create_dir(hdev->name, bt_debugfs);
26412645
2642− dev_set_name(&hdev->dev, "%s", hdev->name);
2643−
26442646 error = device_add(&hdev->dev);
26452647 if (error < 0)
26462648 goto err_wqueue;
@@ -2784,6 +2786,7 @@ void hci_release_dev(struct hci_dev *hdev) · 137 unmodified lines
27842786 hci_conn_params_clear_all(hdev);
27852787 hci_discovery_filter_clear(hdev);
27862788 hci_blocked_keys_clear(hdev);
2789+ hci_codec_list_clear(&hdev->local_codecs);
27872790 hci_dev_unlock(hdev);
27882791
27892792 ida_simple_remove(&hci_index_ida, hdev->id);
@@ -3418,7 +3421,12 @@ static void hci_link_tx_to(struct hci_dev *hdev, __u8 type) · 628 unmodified lines
34183421 if (c->type == type && c->sent) {
34193422 bt_dev_err(hdev, "killing stalled connection %pMR",
34203423 &c->dst);
3424+ /* hci_disconnect might sleep, so, we have to release
3425+ * the RCU read lock before calling it.
3426+ */
3427+ rcu_read_unlock();
34213428 hci_disconnect(c, HCI_ERROR_REMOTE_USER_TERM);
3429+ rcu_read_lock();
34223430 }
34233431 }
34243432
net/bluetooth/hci_event.c+1−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333
3434 #include "hci_request.h"
3535 #include "hci_debugfs.h"
36+#include "hci_codec.h"
3637 #include "a2mp.h"
3738 #include "amp.h"
3839 #include "smp.h"
net/bluetooth/hci_request.h+0−2
@@ -71,7 +71,5 @@ struct sk_buff *hci_prepare_cmd(struct hci_dev *hdev, u16 opcode, u32 plen, · 70 unmodified lines
7171 void hci_req_add_le_scan_disable(struct hci_request *req, bool rpa_le_conn);
7272 void hci_req_add_le_passive_scan(struct hci_request *req);
7373
74−void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next);
75−
7674 void hci_request_setup(struct hci_dev *hdev);
7775 void hci_request_cancel_all(struct hci_dev *hdev);
net/bluetooth/hci_sync.c+5−9
@@ -413,11 +413,6 @@ static int hci_le_scan_restart_sync(struct hci_dev *hdev) · 412 unmodified lines
413413 LE_SCAN_FILTER_DUP_ENABLE);
414414 }
415415
416−static int le_scan_restart_sync(struct hci_dev *hdev, void *data)
417−{
418− return hci_le_scan_restart_sync(hdev);
419−}
420−
421416 static void le_scan_restart(struct work_struct *work)
422417 {
423418 struct hci_dev *hdev = container_of(work, struct hci_dev,
@@ -427,15 +422,15 @@ static void le_scan_restart(struct work_struct *work) · 3 unmodified lines
427422
428423 bt_dev_dbg(hdev, "");
429424
430− hci_dev_lock(hdev);
431−
432− status = hci_cmd_sync_queue(hdev, le_scan_restart_sync, NULL, NULL);
425+ status = hci_le_scan_restart_sync(hdev);
433426 if (status) {
434427 bt_dev_err(hdev, "failed to restart LE scan: status %d",
435428 status);
436− goto unlock;
429+ return;
437430 }
438431
432+ hci_dev_lock(hdev);
433+
439434 if (!test_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks) ||
440435 !hdev->discovery.scan_start)
441436 goto unlock;
@@ -5079,6 +5074,7 @@ int hci_dev_close_sync(struct hci_dev *hdev) · 4637 unmodified lines
50795074 memset(hdev->eir, 0, sizeof(hdev->eir));
50805075 memset(hdev->dev_class, 0, sizeof(hdev->dev_class));
50815076 bacpy(&hdev->random_addr, BDADDR_ANY);
5077+ hci_codec_list_clear(&hdev->local_codecs);
50825078
50835079 hci_dev_put(hdev);
50845080 return err;
net/bluetooth/iso.c+6−3
@@ -502,7 +502,7 @@ drop: · 501 unmodified lines
502502 }
503503
504504 /* -------- Socket interface ---------- */
505−static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba)
505+static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *src, bdaddr_t *dst)
506506 {
507507 struct sock *sk;
508508
@@ -510,7 +510,10 @@ static struct sock *__iso_get_sock_listen_by_addr(bdaddr_t *ba) · 1 unmodified line
510510 if (sk->sk_state != BT_LISTEN)
511511 continue;
512512
513− if (!bacmp(&iso_pi(sk)->src, ba))
513+ if (bacmp(&iso_pi(sk)->dst, dst))
514+ continue;
515+
516+ if (!bacmp(&iso_pi(sk)->src, src))
514517 return sk;
515518 }
516519
@@ -952,7 +955,7 @@ static int iso_listen_cis(struct sock *sk) · 435 unmodified lines
952955
953956 write_lock(&iso_sk_list.lock);
954957
955− if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src))
958+ if (__iso_get_sock_listen_by_addr(&iso_pi(sk)->src, &iso_pi(sk)->dst))
956959 err = -EADDRINUSE;
957960
958961 write_unlock(&iso_sk_list.lock);
net/bridge/br_netfilter_hooks.c+1−1
@@ -294,7 +294,7 @@ int br_nf_pre_routing_finish_bridge(struct net *net, struct sock *sk, struct sk_ · 293 unmodified lines
294294 /* tell br_dev_xmit to continue with forwarding */
295295 nf_bridge->bridged_dnat = 1;
296296 /* FIXME Need to refragment */
297− ret = neigh->output(neigh, skb);
297+ ret = READ_ONCE(neigh->output)(neigh, skb);
298298 }
299299 neigh_release(neigh);
300300 return ret;
net/can/isotp.c+8−11
@@ -948,21 +948,18 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) · 947 unmodified lines
948948 if (!so->bound || so->tx.state == ISOTP_SHUTDOWN)
949949 return -EADDRNOTAVAIL;
950950
951−wait_free_buffer:
952− /* we do not support multiple buffers - for now */
953− if (wq_has_sleeper(&so->wait) && (msg->msg_flags & MSG_DONTWAIT))
954− return -EAGAIN;
951+ while (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) {
952+ /* we do not support multiple buffers - for now */
953+ if (msg->msg_flags & MSG_DONTWAIT)
954+ return -EAGAIN;
955955
956− /* wait for complete transmission of current pdu */
957− err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE);
958− if (err)
959− goto err_event_drop;
960−
961− if (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) {
962956 if (so->tx.state == ISOTP_SHUTDOWN)
963957 return -EADDRNOTAVAIL;
964958
965− goto wait_free_buffer;
959+ /* wait for complete transmission of current pdu */
960+ err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE);
961+ if (err)
962+ goto err_event_drop;
966963 }
967964
968965 /* PDU size > default => try max_pdu_size */
net/ceph/messenger.c+2−2
@@ -459,8 +459,8 @@ int ceph_tcp_connect(struct ceph_connection *con) · 458 unmodified lines
459459 set_sock_callbacks(sock, con);
460460
461461 con_sock_state_connecting(con);
462− ret = sock->ops->connect(sock, (struct sockaddr *)&ss, sizeof(ss),
463− O_NONBLOCK);
462+ ret = kernel_connect(sock, (struct sockaddr *)&ss, sizeof(ss),
463+ O_NONBLOCK);
464464 if (ret == -EINPROGRESS) {
465465 dout("connect %s EINPROGRESS sk_state = %u\n",
466466 ceph_pr_addr(&con->peer_addr),
net/core/dev.c+6−2
@@ -3292,15 +3292,19 @@ int skb_checksum_help(struct sk_buff *skb) · 3291 unmodified lines
32923292
32933293 offset = skb_checksum_start_offset(skb);
32943294 ret = -EINVAL;
3295− if (WARN_ON_ONCE(offset >= skb_headlen(skb))) {
3295+ if (unlikely(offset >= skb_headlen(skb))) {
32963296 DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);
3297+ WARN_ONCE(true, "offset (%d) >= skb_headlen() (%u)\n",
3298+ offset, skb_headlen(skb));
32973299 goto out;
32983300 }
32993301 csum = skb_checksum(skb, offset, skb->len - offset, 0);
33003302
33013303 offset += skb->csum_offset;
3302− if (WARN_ON_ONCE(offset + sizeof(__sum16) > skb_headlen(skb))) {
3304+ if (unlikely(offset + sizeof(__sum16) > skb_headlen(skb))) {
33033305 DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);
3306+ WARN_ONCE(true, "offset+2 (%zu) > skb_headlen() (%u)\n",
3307+ offset + sizeof(__sum16), skb_headlen(skb));
33043308 goto out;
33053309 }
33063310 ret = skb_ensure_writable(skb, offset + sizeof(__sum16));
net/core/neighbour.c+8−6
@@ -410,7 +410,7 @@ static void neigh_flush_dev(struct neigh_table *tbl, struct net_device *dev, · 409 unmodified lines
410410 */
411411 __skb_queue_purge(&n->arp_queue);
412412 n->arp_queue_len_bytes = 0;
413− n->output = neigh_blackhole;
413+ WRITE_ONCE(n->output, neigh_blackhole);
414414 if (n->nud_state & NUD_VALID)
415415 n->nud_state = NUD_NOARP;
416416 else
@@ -920,7 +920,7 @@ static void neigh_suspect(struct neighbour *neigh) · 503 unmodified lines
920920 {
921921 neigh_dbg(2, "neigh %p is suspected\n", neigh);
922922
923− neigh->output = neigh->ops->output;
923+ WRITE_ONCE(neigh->output, neigh->ops->output);
924924 }
925925
926926 /* Neighbour state is OK;
@@ -932,7 +932,7 @@ static void neigh_connect(struct neighbour *neigh) · 5 unmodified lines
932932 {
933933 neigh_dbg(2, "neigh %p is connected\n", neigh);
934934
935− neigh->output = neigh->ops->connected_output;
935+ WRITE_ONCE(neigh->output, neigh->ops->connected_output);
936936 }
937937
938938 static void neigh_periodic_work(struct work_struct *work)
@@ -988,7 +988,9 @@ static void neigh_periodic_work(struct work_struct *work) · 49 unmodified lines
988988 (state == NUD_FAILED ||
989989 !time_in_range_open(jiffies, n->used,
990990 n->used + NEIGH_VAR(n->parms, GC_STALETIME)))) {
991− *np = n->next;
991+ rcu_assign_pointer(*np,
992+ rcu_dereference_protected(n->next,
993+ lockdep_is_held(&tbl->lock)));
992994 neigh_mark_dead(n);
993995 write_unlock(&n->lock);
994996 neigh_cleanup_and_release(n);
@@ -1447,7 +1449,7 @@ static int __neigh_update(struct neighbour *neigh, const u8 *lladdr, · 452 unmodified lines
14471449 if (n2)
14481450 n1 = n2;
14491451 }
1450− n1->output(n1, skb);
1452+ READ_ONCE(n1->output)(n1, skb);
14511453 if (n2)
14521454 neigh_release(n2);
14531455 rcu_read_unlock();
@@ -3153,7 +3155,7 @@ int neigh_xmit(int index, struct net_device *dev, · 1699 unmodified lines
31533155 rcu_read_unlock();
31543156 goto out_kfree_skb;
31553157 }
3156− err = neigh->output(neigh, skb);
3158+ err = READ_ONCE(neigh->output)(neigh, skb);
31573159 rcu_read_unlock();
31583160 }
31593161 else if (index == NEIGH_LINK_TABLE) {
net/core/sock_map.c+4−0
@@ -668,6 +668,8 @@ BPF_CALL_4(bpf_msg_redirect_map, struct sk_msg *, msg, · 667 unmodified lines
668668 sk = __sock_map_lookup_elem(map, key);
669669 if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
670670 return SK_DROP;
671+ if (!(flags & BPF_F_INGRESS) && !sk_is_tcp(sk))
672+ return SK_DROP;
671673
672674 msg->flags = flags;
673675 msg->sk_redir = sk;
@@ -1267,6 +1269,8 @@ BPF_CALL_4(bpf_msg_redirect_hash, struct sk_msg *, msg, · 593 unmodified lines
12671269 sk = __sock_hash_lookup_elem(map, key);
12681270 if (unlikely(!sk || !sock_map_redirect_allowed(sk)))
12691271 return SK_DROP;
1272+ if (!(flags & BPF_F_INGRESS) && !sk_is_tcp(sk))
1273+ return SK_DROP;
12701274
12711275 msg->flags = flags;
12721276 msg->sk_redir = sk;
net/devlink/health.c+16−14
@@ -58,7 +58,6 @@ struct devlink_health_reporter { · 57 unmodified lines
5858 struct devlink *devlink;
5959 struct devlink_port *devlink_port;
6060 struct devlink_fmsg *dump_fmsg;
61− struct mutex dump_lock; /* lock parallel read/write from dump buffers */
6261 u64 graceful_period;
6362 bool auto_recover;
6463 bool auto_dump;
@@ -125,7 +124,6 @@ __devlink_health_reporter_create(struct devlink *devlink, · 60 unmodified lines
125124 reporter->graceful_period = graceful_period;
126125 reporter->auto_recover = !!ops->recover;
127126 reporter->auto_dump = !!ops->dump;
128− mutex_init(&reporter->dump_lock);
129127 return reporter;
130128 }
131129
@@ -226,7 +224,6 @@ EXPORT_SYMBOL_GPL(devlink_health_reporter_create); · 94 unmodified lines
226224 static void
227225 devlink_health_reporter_free(struct devlink_health_reporter *reporter)
228226 {
229− mutex_destroy(&reporter->dump_lock);
230227 if (reporter->dump_fmsg)
231228 devlink_fmsg_free(reporter->dump_fmsg);
232229 kfree(reporter);
@@ -625,10 +622,10 @@ int devlink_health_report(struct devlink_health_reporter *reporter, · 392 unmodified lines
625622 }
626623
627624 if (reporter->auto_dump) {
628− mutex_lock(&reporter->dump_lock);
625+ devl_lock(devlink);
629626 /* store current dump of current error, for later analysis */
630627 devlink_health_do_dump(reporter, priv_ctx, NULL);
631− mutex_unlock(&reporter->dump_lock);
628+ devl_unlock(devlink);
632629 }
633630
634631 if (!reporter->auto_recover)
@@ -1262,7 +1259,7 @@ out: · 627 unmodified lines
12621259 }
12631260
12641261 static struct devlink_health_reporter *
1265−devlink_health_reporter_get_from_cb(struct netlink_callback *cb)
1262+devlink_health_reporter_get_from_cb_lock(struct netlink_callback *cb)
12661263 {
12671264 const struct genl_info *info = genl_info_dump(cb);
12681265 struct devlink_health_reporter *reporter;
@@ -1272,10 +1269,12 @@ devlink_health_reporter_get_from_cb(struct netlink_callback *cb) · 3 unmodified lines
12721269 devlink = devlink_get_from_attrs_lock(sock_net(cb->skb->sk), attrs);
12731270 if (IS_ERR(devlink))
12741271 return NULL;
1275− devl_unlock(devlink);
12761272
12771273 reporter = devlink_health_reporter_get_from_attrs(devlink, attrs);
1278− devlink_put(devlink);
1274+ if (!reporter) {
1275+ devl_unlock(devlink);
1276+ devlink_put(devlink);
1277+ }
12791278 return reporter;
12801279 }
12811280
@@ -1284,16 +1283,20 @@ int devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb, · 2 unmodified lines
12841283 {
12851284 struct devlink_nl_dump_state *state = devlink_dump_state(cb);
12861285 struct devlink_health_reporter *reporter;
1286+ struct devlink *devlink;
12871287 int err;
12881288
1289− reporter = devlink_health_reporter_get_from_cb(cb);
1289+ reporter = devlink_health_reporter_get_from_cb_lock(cb);
12901290 if (!reporter)
12911291 return -EINVAL;
12921292
1293− if (!reporter->ops->dump)
1293+ devlink = reporter->devlink;
1294+ if (!reporter->ops->dump) {
1295+ devl_unlock(devlink);
1296+ devlink_put(devlink);
12941297 return -EOPNOTSUPP;
1298+ }
12951299
1296− mutex_lock(&reporter->dump_lock);
12971300 if (!state->idx) {
12981301 err = devlink_health_do_dump(reporter, NULL, cb->extack);
12991302 if (err)
@@ -1309,7 +1312,8 @@ int devlink_nl_cmd_health_reporter_dump_get_dumpit(struct sk_buff *skb, · 9 unmodified lines
13091312 err = devlink_fmsg_dumpit(reporter->dump_fmsg, skb, cb,
13101313 DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET);
13111314 unlock:
1312− mutex_unlock(&reporter->dump_lock);
1315+ devl_unlock(devlink);
1316+ devlink_put(devlink);
13131317 return err;
13141318 }
13151319
@@ -1326,9 +1330,7 @@ int devlink_nl_cmd_health_reporter_dump_clear_doit(struct sk_buff *skb, · 10 unmodified lines
13261330 if (!reporter->ops->dump)
13271331 return -EOPNOTSUPP;
13281332
1329− mutex_lock(&reporter->dump_lock);
13301333 devlink_health_dump_clear(reporter);
1331− mutex_unlock(&reporter->dump_lock);
13321334 return 0;
13331335 }
13341336
net/ethtool/bitset.c+26−6
@@ -431,8 +431,10 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, · 430 unmodified lines
431431 ethnl_string_array_t names,
432432 struct netlink_ext_ack *extack, bool *mod)
433433 {
434+ u32 *orig_bitmap, *saved_bitmap = NULL;
434435 struct nlattr *bit_attr;
435436 bool no_mask;
437+ bool dummy;
436438 int rem;
437439 int ret;
438440
@@ -448,8 +450,22 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, · 9 unmodified lines
448450 }
449451
450452 no_mask = tb[ETHTOOL_A_BITSET_NOMASK];
451− if (no_mask)
452− ethnl_bitmap32_clear(bitmap, 0, nbits, mod);
453+ if (no_mask) {
454+ unsigned int nwords = DIV_ROUND_UP(nbits, 32);
455+ unsigned int nbytes = nwords * sizeof(u32);
456+
457+ /* The bitmap size is only the size of the map part without
458+ * its mask part.
459+ */
460+ saved_bitmap = kcalloc(nwords, sizeof(u32), GFP_KERNEL);
461+ if (!saved_bitmap)
462+ return -ENOMEM;
463+ memcpy(saved_bitmap, bitmap, nbytes);
464+ ethnl_bitmap32_clear(bitmap, 0, nbits, &dummy);
465+ orig_bitmap = saved_bitmap;
466+ } else {
467+ orig_bitmap = bitmap;
468+ }
453469
454470 nla_for_each_nested(bit_attr, tb[ETHTOOL_A_BITSET_BITS], rem) {
455471 bool old_val, new_val;
@@ -458,13 +474,14 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, · 2 unmodified lines
458474 if (nla_type(bit_attr) != ETHTOOL_A_BITSET_BITS_BIT) {
459475 NL_SET_ERR_MSG_ATTR(extack, bit_attr,
460476 "only ETHTOOL_A_BITSET_BITS_BIT allowed in ETHTOOL_A_BITSET_BITS");
461− return -EINVAL;
477+ ret = -EINVAL;
478+ goto out;
462479 }
463480 ret = ethnl_parse_bit(&idx, &new_val, nbits, bit_attr, no_mask,
464481 names, extack);
465482 if (ret < 0)
466− return ret;
467− old_val = bitmap[idx / 32] & ((u32)1 << (idx % 32));
483+ goto out;
484+ old_val = orig_bitmap[idx / 32] & ((u32)1 << (idx % 32));
468485 if (new_val != old_val) {
469486 if (new_val)
470487 bitmap[idx / 32] |= ((u32)1 << (idx % 32));
@@ -474,7 +491,10 @@ ethnl_update_bitset32_verbose(u32 *bitmap, unsigned int nbits, · 3 unmodified lines
474491 }
475492 }
476493
477− return 0;
494+ ret = 0;
495+out:
496+ kfree(saved_bitmap);
497+ return ret;
478498 }
479499
480500 static int ethnl_compact_sanity_checks(unsigned int nbits,
net/ethtool/plca.c+29−16
@@ -21,16 +21,6 @@ struct plca_reply_data { · 20 unmodified lines
2121 #define PLCA_REPDATA(__reply_base) \
2222 container_of(__reply_base, struct plca_reply_data, base)
2323
24−static void plca_update_sint(int *dst, const struct nlattr *attr,
25− bool *mod)
26−{
27− if (!attr)
28− return;
29−
30− *dst = nla_get_u32(attr);
31− *mod = true;
32−}
33−
3424 // PLCA get configuration message ------------------------------------------- //
3525
3626 const struct nla_policy ethnl_plca_get_cfg_policy[] = {
@@ -38,6 +28,29 @@ const struct nla_policy ethnl_plca_get_cfg_policy[] = { · 1 unmodified line
3828 NLA_POLICY_NESTED(ethnl_header_policy),
3929 };
4030
31+static void plca_update_sint(int *dst, struct nlattr **tb, u32 attrid,
32+ bool *mod)
33+{
34+ const struct nlattr *attr = tb[attrid];
35+
36+ if (!attr ||
37+ WARN_ON_ONCE(attrid >= ARRAY_SIZE(ethnl_plca_set_cfg_policy)))
38+ return;
39+
40+ switch (ethnl_plca_set_cfg_policy[attrid].type) {
41+ case NLA_U8:
42+ *dst = nla_get_u8(attr);
43+ break;
44+ case NLA_U32:
45+ *dst = nla_get_u32(attr);
46+ break;
47+ default:
48+ WARN_ON_ONCE(1);
49+ }
50+
51+ *mod = true;
52+}
53+
4154 static int plca_get_cfg_prepare_data(const struct ethnl_req_info *req_base,
4255 struct ethnl_reply_data *reply_base,
4356 const struct genl_info *info)
@@ -144,13 +157,13 @@ ethnl_set_plca(struct ethnl_req_info *req_info, struct genl_info *info) · 100 unmodified lines
144157 return -EOPNOTSUPP;
145158
146159 memset(&plca_cfg, 0xff, sizeof(plca_cfg));
147− plca_update_sint(&plca_cfg.enabled, tb[ETHTOOL_A_PLCA_ENABLED], &mod);
148− plca_update_sint(&plca_cfg.node_id, tb[ETHTOOL_A_PLCA_NODE_ID], &mod);
149− plca_update_sint(&plca_cfg.node_cnt, tb[ETHTOOL_A_PLCA_NODE_CNT], &mod);
150− plca_update_sint(&plca_cfg.to_tmr, tb[ETHTOOL_A_PLCA_TO_TMR], &mod);
151− plca_update_sint(&plca_cfg.burst_cnt, tb[ETHTOOL_A_PLCA_BURST_CNT],
160+ plca_update_sint(&plca_cfg.enabled, tb, ETHTOOL_A_PLCA_ENABLED, &mod);
161+ plca_update_sint(&plca_cfg.node_id, tb, ETHTOOL_A_PLCA_NODE_ID, &mod);
162+ plca_update_sint(&plca_cfg.node_cnt, tb, ETHTOOL_A_PLCA_NODE_CNT, &mod);
163+ plca_update_sint(&plca_cfg.to_tmr, tb, ETHTOOL_A_PLCA_TO_TMR, &mod);
164+ plca_update_sint(&plca_cfg.burst_cnt, tb, ETHTOOL_A_PLCA_BURST_CNT,
152165 &mod);
153− plca_update_sint(&plca_cfg.burst_tmr, tb[ETHTOOL_A_PLCA_BURST_TMR],
166+ plca_update_sint(&plca_cfg.burst_tmr, tb, ETHTOOL_A_PLCA_BURST_TMR,
154167 &mod);
155168 if (!mod)
156169 return 0;
net/ipv4/fib_semantics.c+1−0
@@ -1887,6 +1887,7 @@ int fib_sync_down_addr(struct net_device *dev, __be32 local) · 1886 unmodified lines
18871887 continue;
18881888 if (fi->fib_prefsrc == local) {
18891889 fi->fib_flags |= RTNH_F_DEAD;
1890+ fi->pfsrc_removed = true;
18901891 ret++;
18911892 }
18921893 }
net/ipv4/fib_trie.c+4−0
@@ -2027,6 +2027,7 @@ void fib_table_flush_external(struct fib_table *tb) · 2026 unmodified lines
20272027 int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all)
20282028 {
20292029 struct trie *t = (struct trie *)tb->tb_data;
2030+ struct nl_info info = { .nl_net = net };
20302031 struct key_vector *pn = t->kv;
20312032 unsigned long cindex = 1;
20322033 struct hlist_node *tmp;
@@ -2089,6 +2090,9 @@ int fib_table_flush(struct net *net, struct fib_table *tb, bool flush_all) · 56 unmodified lines
20892090
20902091 fib_notify_alias_delete(net, n->key, &n->leaf, fa,
20912092 NULL);
2093+ if (fi->pfsrc_removed)
2094+ rtmsg_fib(RTM_DELROUTE, htonl(n->key), fa,
2095+ KEYLENGTH - fa->fa_slen, tb->tb_id, &info, 0);
20922096 hlist_del_rcu(&fa->fa_list);
20932097 fib_release_info(fa->fa_info);
20942098 alias_free_mem_rcu(fa);
net/ipv4/route.c+2−0
@@ -3417,6 +3417,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, · 3416 unmodified lines
34173417 fa->fa_type == fri.type) {
34183418 fri.offload = READ_ONCE(fa->offload);
34193419 fri.trap = READ_ONCE(fa->trap);
3420+ fri.offload_failed =
3421+ READ_ONCE(fa->offload_failed);
34203422 break;
34213423 }
34223424 }
net/ipv4/tcp.c+2−8
@@ -1621,16 +1621,13 @@ EXPORT_SYMBOL(tcp_read_sock); · 1620 unmodified lines
16211621
16221622 int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
16231623 {
1624− struct tcp_sock *tp = tcp_sk(sk);
1625− u32 seq = tp->copied_seq;
16261624 struct sk_buff *skb;
16271625 int copied = 0;
1628− u32 offset;
16291626
16301627 if (sk->sk_state == TCP_LISTEN)
16311628 return -ENOTCONN;
16321629
1633− while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) {
1630+ while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) {
16341631 u8 tcp_flags;
16351632 int used;
16361633
@@ -1643,13 +1640,10 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor) · 6 unmodified lines
16431640 copied = used;
16441641 break;
16451642 }
1646− seq += used;
16471643 copied += used;
16481644
1649− if (tcp_flags & TCPHDR_FIN) {
1650− ++seq;
1645+ if (tcp_flags & TCPHDR_FIN)
16511646 break;
1652− }
16531647 }
16541648 return copied;
16551649 }
net/ipv4/tcp_bpf.c+3−1
@@ -222,6 +222,7 @@ static int tcp_bpf_recvmsg_parser(struct sock *sk, · 221 unmodified lines
222222 int *addr_len)
223223 {
224224 struct tcp_sock *tcp = tcp_sk(sk);
225+ int peek = flags & MSG_PEEK;
225226 u32 seq = tcp->copied_seq;
226227 struct sk_psock *psock;
227228 int copied = 0;
@@ -311,7 +312,8 @@ msg_bytes_ready: · 83 unmodified lines
311312 copied = -EAGAIN;
312313 }
313314 out:
314− WRITE_ONCE(tcp->copied_seq, seq);
315+ if (!peek)
316+ WRITE_ONCE(tcp->copied_seq, seq);
315317 tcp_rcv_space_adjust(sk);
316318 if (copied > 0)
317319 __tcp_cleanup_rbuf(sk, copied);
net/ipv4/tcp_input.c+13−0
@@ -253,6 +253,19 @@ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb) · 252 unmodified lines
253253 if (unlikely(len > icsk->icsk_ack.rcv_mss +
254254 MAX_TCP_OPTION_SPACE))
255255 tcp_gro_dev_warn(sk, skb, len);
256+ /* If the skb has a len of exactly 1*MSS and has the PSH bit
257+ * set then it is likely the end of an application write. So
258+ * more data may not be arriving soon, and yet the data sender
259+ * may be waiting for an ACK if cwnd-bound or using TX zero
260+ * copy. So we set ICSK_ACK_PUSHED here so that
261+ * tcp_cleanup_rbuf() will send an ACK immediately if the app
262+ * reads all of the data and is not ping-pong. If len > MSS
263+ * then this logic does not matter (and does not hurt) because
264+ * tcp_cleanup_rbuf() will always ACK immediately if the app
265+ * reads data and there is more than an MSS of unACKed data.
266+ */
267+ if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_PSH)
268+ icsk->icsk_ack.pending |= ICSK_ACK_PUSHED;
256269 } else {
257270 /* Otherwise, we make more careful check taking into account,
258271 * that SACKs block is variable.
net/ipv4/tcp_output.c+4−4
@@ -177,8 +177,7 @@ static void tcp_event_data_sent(struct tcp_sock *tp, · 176 unmodified lines
177177 }
178178
179179 /* Account for an ACK we sent. */
180−static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts,
181− u32 rcv_nxt)
180+static inline void tcp_event_ack_sent(struct sock *sk, u32 rcv_nxt)
182181 {
183182 struct tcp_sock *tp = tcp_sk(sk);
184183
@@ -192,7 +191,7 @@ static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts, · 7 unmodified lines
192191
193192 if (unlikely(rcv_nxt != tp->rcv_nxt))
194193 return; /* Special ACK sent by DCTCP to reflect ECN */
195− tcp_dec_quickack_mode(sk, pkts);
194+ tcp_dec_quickack_mode(sk);
196195 inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
197196 }
198197
@@ -1387,7 +1386,7 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, · 1188 unmodified lines
13871386 sk, skb);
13881387
13891388 if (likely(tcb->tcp_flags & TCPHDR_ACK))
1390− tcp_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt);
1389+ tcp_event_ack_sent(sk, rcv_nxt);
13911390
13921391 if (skb->len != tcp_header_size) {
13931392 tcp_event_data_sent(tp, sk);
@@ -2457,6 +2456,7 @@ static int tcp_mtu_probe(struct sock *sk) · 1063 unmodified lines
24572456
24582457 /* build the payload, and be prepared to abort if this fails. */
24592458 if (tcp_clone_payload(sk, nskb, probe_size)) {
2459+ tcp_skb_tsorted_anchor_cleanup(nskb);
24602460 consume_skb(nskb);
24612461 return -1;
24622462 }
net/ipv6/tcp_ipv6.c+7−3
@@ -1640,9 +1640,12 @@ process: · 1639 unmodified lines
16401640 struct sock *nsk;
16411641
16421642 sk = req->rsk_listener;
1643− drop_reason = tcp_inbound_md5_hash(sk, skb,
1644− &hdr->saddr, &hdr->daddr,
1645− AF_INET6, dif, sdif);
1643+ if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
1644+ drop_reason = SKB_DROP_REASON_XFRM_POLICY;
1645+ else
1646+ drop_reason = tcp_inbound_md5_hash(sk, skb,
1647+ &hdr->saddr, &hdr->daddr,
1648+ AF_INET6, dif, sdif);
16461649 if (drop_reason) {
16471650 sk_drops_add(sk, skb);
16481651 reqsk_put(req);
@@ -1689,6 +1692,7 @@ process: · 40 unmodified lines
16891692 }
16901693 goto discard_and_relse;
16911694 }
1695+ nf_reset_ct(skb);
16921696 if (nsk == sk) {
16931697 reqsk_put(req);
16941698 tcp_v6_restore_cb(skb);
net/l2tp/l2tp_ip6.c+1−1
@@ -507,7 +507,6 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 506 unmodified lines
507507 */
508508 if (len > INT_MAX - transhdrlen)
509509 return -EMSGSIZE;
510− ulen = len + transhdrlen;
511510
512511 /* Mirror BSD error message compatibility */
513512 if (msg->msg_flags & MSG_OOB)
@@ -628,6 +627,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) · 114 unmodified lines
628627
629628 back_from_confirm:
630629 lock_sock(sk);
630+ ulen = len + skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0;
631631 err = ip6_append_data(sk, ip_generic_getfrag, msg,
632632 ulen, transhdrlen, &ipc6,
633633 &fl6, (struct rt6_info *)dst,
net/mac80211/cfg.c+5−1
@@ -566,6 +566,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 565 unmodified lines
566566 }
567567
568568 err = ieee80211_key_link(key, link, sta);
569+ /* KRACK protection, shouldn't happen but just silently accept key */
570+ if (err == -EALREADY)
571+ err = 0;
569572
570573 out_unlock:
571574 mutex_unlock(&local->sta_mtx);
@@ -1857,7 +1860,8 @@ static int sta_link_apply_parameters(struct ieee80211_local *local, · 1285 unmodified lines
18571860 /* VHT can override some HT caps such as the A-MSDU max length */
18581861 if (params->vht_capa)
18591862 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
1860− params->vht_capa, link_sta);
1863+ params->vht_capa, NULL,
1864+ link_sta);
18611865
18621866 if (params->he_capa)
18631867 ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband,
net/mac80211/ibss.c+1−1
@@ -1072,7 +1072,7 @@ static void ieee80211_update_sta_info(struct ieee80211_sub_if_data *sdata, · 1071 unmodified lines
10721072 &chandef);
10731073 memcpy(&cap_ie, elems->vht_cap_elem, sizeof(cap_ie));
10741074 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
1075− &cap_ie,
1075+ &cap_ie, NULL,
10761076 &sta->deflink);
10771077 if (memcmp(&cap, &sta->sta.deflink.vht_cap, sizeof(cap)))
10781078 rates_updated |= true;
net/mac80211/ieee80211_i.h+2−1
@@ -676,7 +676,7 @@ struct ieee80211_if_mesh { · 675 unmodified lines
676676 struct timer_list mesh_path_root_timer;
677677
678678 unsigned long wrkq_flags;
679− unsigned long mbss_changed;
679+ unsigned long mbss_changed[64 / BITS_PER_LONG];
680680
681681 bool userspace_handles_dfs;
682682
@@ -2141,6 +2141,7 @@ void · 1458 unmodified lines
21412141 ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
21422142 struct ieee80211_supported_band *sband,
21432143 const struct ieee80211_vht_cap *vht_cap_ie,
2144+ const struct ieee80211_vht_cap *vht_cap_ie2,
21442145 struct link_sta_info *link_sta);
21452146 enum ieee80211_sta_rx_bandwidth
21462147 ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta);
net/mac80211/key.c+16−6
@@ -802,6 +802,9 @@ static void ieee80211_key_destroy(struct ieee80211_key *key, · 801 unmodified lines
802802
803803 void ieee80211_key_free_unused(struct ieee80211_key *key)
804804 {
805+ if (!key)
806+ return;
807+
805808 WARN_ON(key->sdata || key->local);
806809 ieee80211_key_free_common(key);
807810 }
@@ -854,7 +857,7 @@ int ieee80211_key_link(struct ieee80211_key *key, · 46 unmodified lines
854857 * can cause warnings to appear.
855858 */
856859 bool delay_tailroom = sdata->vif.type == NL80211_IFTYPE_STATION;
857− int ret = -EOPNOTSUPP;
860+ int ret;
858861
859862 mutex_lock(&sdata->local->key_mtx);
860863
@@ -868,8 +871,10 @@ int ieee80211_key_link(struct ieee80211_key *key, · 7 unmodified lines
868871 * the same cipher. Enforce the assumption for pairwise keys.
869872 */
870873 if ((alt_key && alt_key->conf.cipher != key->conf.cipher) ||
871− (old_key && old_key->conf.cipher != key->conf.cipher))
874+ (old_key && old_key->conf.cipher != key->conf.cipher)) {
875+ ret = -EOPNOTSUPP;
872876 goto out;
877+ }
873878 } else if (sta) {
874879 struct link_sta_info *link_sta = &sta->deflink;
875880 int link_id = key->conf.link_id;
@@ -895,8 +900,10 @@ int ieee80211_key_link(struct ieee80211_key *key, · 19 unmodified lines
895900
896901 /* Non-pairwise keys must also not switch the cipher on rekey */
897902 if (!pairwise) {
898− if (old_key && old_key->conf.cipher != key->conf.cipher)
903+ if (old_key && old_key->conf.cipher != key->conf.cipher) {
904+ ret = -EOPNOTSUPP;
899905 goto out;
906+ }
900907 }
901908
902909 /*
@@ -904,9 +911,8 @@ int ieee80211_key_link(struct ieee80211_key *key, · 1 unmodified line
904911 * new version of the key to avoid nonce reuse or replay issues.
905912 */
906913 if (ieee80211_key_identical(sdata, old_key, key)) {
907− ieee80211_key_free_unused(key);
908− ret = 0;
909− goto out;
914+ ret = -EALREADY;
915+ goto unlock;
910916 }
911917
912918 key->local = sdata->local;
@@ -930,7 +936,11 @@ int ieee80211_key_link(struct ieee80211_key *key, · 17 unmodified lines
930936 ieee80211_key_free(key, delay_tailroom);
931937 }
932938
939+ key = NULL;
940+
933941 out:
942+ ieee80211_key_free_unused(key);
943+ unlock:
934944 mutex_unlock(&sdata->local->key_mtx);
935945
936946 return ret;
net/mac80211/mesh.c+4−4
@@ -1175,7 +1175,7 @@ void ieee80211_mbss_info_change_notify(struct ieee80211_sub_if_data *sdata, · 1174 unmodified lines
11751175
11761176 /* if we race with running work, worst case this work becomes a noop */
11771177 for_each_set_bit(bit, &bits, sizeof(changed) * BITS_PER_BYTE)
1178− set_bit(bit, &ifmsh->mbss_changed);
1178+ set_bit(bit, ifmsh->mbss_changed);
11791179 set_bit(MESH_WORK_MBSS_CHANGED, &ifmsh->wrkq_flags);
11801180 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work);
11811181 }
@@ -1257,7 +1257,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) · 75 unmodified lines
12571257
12581258 /* clear any mesh work (for next join) we may have accrued */
12591259 ifmsh->wrkq_flags = 0;
1260− ifmsh->mbss_changed = 0;
1260+ memset(ifmsh->mbss_changed, 0, sizeof(ifmsh->mbss_changed));
12611261
12621262 local->fif_other_bss--;
12631263 atomic_dec(&local->iff_allmultis);
@@ -1724,9 +1724,9 @@ static void mesh_bss_info_changed(struct ieee80211_sub_if_data *sdata) · 460 unmodified lines
17241724 u32 bit;
17251725 u64 changed = 0;
17261726
1727− for_each_set_bit(bit, &ifmsh->mbss_changed,
1727+ for_each_set_bit(bit, ifmsh->mbss_changed,
17281728 sizeof(changed) * BITS_PER_BYTE) {
1729− clear_bit(bit, &ifmsh->mbss_changed);
1729+ clear_bit(bit, ifmsh->mbss_changed);
17301730 changed |= BIT(bit);
17311731 }
17321732
net/mac80211/mesh_plink.c+1−1
@@ -451,7 +451,7 @@ static void mesh_sta_info_init(struct ieee80211_sub_if_data *sdata, · 450 unmodified lines
451451 changed |= IEEE80211_RC_BW_CHANGED;
452452
453453 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
454− elems->vht_cap_elem,
454+ elems->vht_cap_elem, NULL,
455455 &sta->deflink);
456456
457457 ieee80211_he_cap_ie_to_sta_he_cap(sdata, sband, elems->he_cap,
net/mac80211/mlme.c+35−10
@@ -4202,10 +4202,33 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link, · 4201 unmodified lines
42024202 elems->ht_cap_elem,
42034203 link_sta);
42044204
4205− if (elems->vht_cap_elem && !(link->u.mgd.conn_flags & IEEE80211_CONN_DISABLE_VHT))
4205+ if (elems->vht_cap_elem &&
4206+ !(link->u.mgd.conn_flags & IEEE80211_CONN_DISABLE_VHT)) {
4207+ const struct ieee80211_vht_cap *bss_vht_cap = NULL;
4208+ const struct cfg80211_bss_ies *ies;
4209+
4210+ /*
4211+ * Cisco AP module 9115 with FW 17.3 has a bug and sends a
4212+ * too large maximum MPDU length in the association response
4213+ * (indicating 12k) that it cannot actually process ...
4214+ * Work around that.
4215+ */
4216+ rcu_read_lock();
4217+ ies = rcu_dereference(cbss->ies);
4218+ if (ies) {
4219+ const struct element *elem;
4220+
4221+ elem = cfg80211_find_elem(WLAN_EID_VHT_CAPABILITY,
4222+ ies->data, ies->len);
4223+ if (elem && elem->datalen >= sizeof(*bss_vht_cap))
4224+ bss_vht_cap = (const void *)elem->data;
4225+ }
4226+
42064227 ieee80211_vht_cap_ie_to_sta_vht_cap(sdata, sband,
42074228 elems->vht_cap_elem,
4208− link_sta);
4229+ bss_vht_cap, link_sta);
4230+ rcu_read_unlock();
4231+ }
42094232
42104233 if (elems->he_operation && !(link->u.mgd.conn_flags & IEEE80211_CONN_DISABLE_HE) &&
42114234 elems->he_cap) {
@@ -5107,9 +5130,10 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, · 895 unmodified lines
51075130 continue;
51085131
51095132 valid_links |= BIT(link_id);
5110− if (assoc_data->link[link_id].disabled) {
5133+ if (assoc_data->link[link_id].disabled)
51115134 dormant_links |= BIT(link_id);
5112− } else if (link_id != assoc_data->assoc_link_id) {
5135+
5136+ if (link_id != assoc_data->assoc_link_id) {
51135137 err = ieee80211_sta_allocate_link(sta, link_id);
51145138 if (err)
51155139 goto out_err;
@@ -5124,7 +5148,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, · 8 unmodified lines
51245148 struct ieee80211_link_data *link;
51255149 struct link_sta_info *link_sta;
51265150
5127− if (!cbss || assoc_data->link[link_id].disabled)
5151+ if (!cbss)
51285152 continue;
51295153
51305154 link = sdata_dereference(sdata->link[link_id], sdata);
@@ -5429,17 +5453,18 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata, · 298 unmodified lines
54295453 for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS; link_id++) {
54305454 struct ieee80211_link_data *link;
54315455
5432− link = sdata_dereference(sdata->link[link_id], sdata);
5433− if (!link)
5434− continue;
5435−
54365456 if (!assoc_data->link[link_id].bss)
54375457 continue;
54385458
54395459 resp.links[link_id].bss = assoc_data->link[link_id].bss;
5440− resp.links[link_id].addr = link->conf->addr;
5460+ ether_addr_copy(resp.links[link_id].addr,
5461+ assoc_data->link[link_id].addr);
54415462 resp.links[link_id].status = assoc_data->link[link_id].status;
54425463
5464+ link = sdata_dereference(sdata->link[link_id], sdata);
5465+ if (!link)
5466+ continue;
5467+
54435468 /* get uapsd queues configuration - same for all links */
54445469 resp.uapsd_queues = 0;
54455470 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++)
net/mac80211/tx.c+2−1
@@ -665,7 +665,8 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) · 664 unmodified lines
665665 }
666666
667667 if (unlikely(tx->key && tx->key->flags & KEY_FLAG_TAINTED &&
668− !ieee80211_is_deauth(hdr->frame_control)))
668+ !ieee80211_is_deauth(hdr->frame_control)) &&
669+ tx->skb->protocol != tx->sdata->control_port_protocol)
669670 return TX_DROP;
670671
671672 if (!skip_hw && tx->key &&
net/mac80211/vht.c+14−2
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 *
55 * Portions of this file
66 * Copyright(c) 2015 - 2016 Intel Deutschland GmbH
7− * Copyright (C) 2018 - 2022 Intel Corporation
7+ * Copyright (C) 2018 - 2023 Intel Corporation
88 */
99
1010 #include <linux/ieee80211.h>
@@ -116,12 +116,14 @@ void · 105 unmodified lines
116116 ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
117117 struct ieee80211_supported_band *sband,
118118 const struct ieee80211_vht_cap *vht_cap_ie,
119+ const struct ieee80211_vht_cap *vht_cap_ie2,
119120 struct link_sta_info *link_sta)
120121 {
121122 struct ieee80211_sta_vht_cap *vht_cap = &link_sta->pub->vht_cap;
122123 struct ieee80211_sta_vht_cap own_cap;
123124 u32 cap_info, i;
124125 bool have_80mhz;
126+ u32 mpdu_len;
125127
126128 memset(vht_cap, 0, sizeof(*vht_cap));
127129
@@ -317,11 +319,21 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, · 189 unmodified lines
317319
318320 link_sta->pub->bandwidth = ieee80211_sta_cur_vht_bw(link_sta);
319321
322+ /*
323+ * Work around the Cisco 9115 FW 17.3 bug by taking the min of
324+ * both reported MPDU lengths.
325+ */
326+ mpdu_len = vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK;
327+ if (vht_cap_ie2)
328+ mpdu_len = min_t(u32, mpdu_len,
329+ le32_get_bits(vht_cap_ie2->vht_cap_info,
330+ IEEE80211_VHT_CAP_MAX_MPDU_MASK));
331+
320332 /*
321333 * FIXME - should the amsdu len be per link? store per link
322334 * and maintain a minimum?
323335 */
324− switch (vht_cap->cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK) {
336+ switch (mpdu_len) {
325337 case IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454:
326338 link_sta->pub->agg.max_amsdu_len = IEEE80211_MAX_MPDU_LEN_VHT_11454;
327339 break;
net/mctp/route.c+16−6
@@ -737,6 +737,8 @@ struct mctp_route *mctp_route_lookup(struct net *net, unsigned int dnet, · 736 unmodified lines
737737 {
738738 struct mctp_route *tmp, *rt = NULL;
739739
740+ rcu_read_lock();
741+
740742 list_for_each_entry_rcu(tmp, &net->mctp.routes, list) {
741743 /* TODO: add metrics */
742744 if (mctp_rt_match_eid(tmp, dnet, daddr)) {
@@ -747,21 +749,29 @@ struct mctp_route *mctp_route_lookup(struct net *net, unsigned int dnet, · 4 unmodified lines
747749 }
748750 }
749751
752+ rcu_read_unlock();
753+
750754 return rt;
751755 }
752756
753757 static struct mctp_route *mctp_route_lookup_null(struct net *net,
754758 struct net_device *dev)
755759 {
756− struct mctp_route *rt;
760+ struct mctp_route *tmp, *rt = NULL;
757761
758− list_for_each_entry_rcu(rt, &net->mctp.routes, list) {
759− if (rt->dev->dev == dev && rt->type == RTN_LOCAL &&
760− refcount_inc_not_zero(&rt->refs))
761− return rt;
762+ rcu_read_lock();
763+
764+ list_for_each_entry_rcu(tmp, &net->mctp.routes, list) {
765+ if (tmp->dev->dev == dev && tmp->type == RTN_LOCAL &&
766+ refcount_inc_not_zero(&tmp->refs)) {
767+ rt = tmp;
768+ break;
769+ }
762770 }
763771
764− return NULL;
772+ rcu_read_unlock();
773+
774+ return rt;
765775 }
766776
767777 static int mctp_do_fragment_route(struct mctp_route *rt, struct sk_buff *skb,
net/mptcp/pm_userspace.c+0−6
@@ -307,12 +307,6 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) · 306 unmodified lines
307307 goto create_err;
308308 }
309309
310− if (addr_l.id == 0) {
311− NL_SET_ERR_MSG_ATTR(info->extack, laddr, "missing local addr id");
312− err = -EINVAL;
313− goto create_err;
314− }
315−
316310 err = mptcp_pm_parse_addr(raddr, info, &addr_r);
317311 if (err < 0) {
318312 NL_SET_ERR_MSG_ATTR(info->extack, raddr, "error parsing remote addr");
net/mptcp/protocol.c+14−14
@@ -3425,24 +3425,21 @@ static void schedule_3rdack_retransmission(struct sock *ssk) · 3424 unmodified lines
34253425 sk_reset_timer(ssk, &icsk->icsk_delack_timer, timeout);
34263426 }
34273427
3428−void mptcp_subflow_process_delegated(struct sock *ssk)
3428+void mptcp_subflow_process_delegated(struct sock *ssk, long status)
34293429 {
34303430 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
34313431 struct sock *sk = subflow->conn;
34323432
3433− if (test_bit(MPTCP_DELEGATE_SEND, &subflow->delegated_status)) {
3433+ if (status & BIT(MPTCP_DELEGATE_SEND)) {
34343434 mptcp_data_lock(sk);
34353435 if (!sock_owned_by_user(sk))
34363436 __mptcp_subflow_push_pending(sk, ssk, true);
34373437 else
34383438 __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags);
34393439 mptcp_data_unlock(sk);
3440− mptcp_subflow_delegated_done(subflow, MPTCP_DELEGATE_SEND);
34413440 }
3442− if (test_bit(MPTCP_DELEGATE_ACK, &subflow->delegated_status)) {
3441+ if (status & BIT(MPTCP_DELEGATE_ACK))
34433442 schedule_3rdack_retransmission(ssk);
3444− mptcp_subflow_delegated_done(subflow, MPTCP_DELEGATE_ACK);
3445− }
34463443 }
34473444
34483445 static int mptcp_hash(struct sock *sk)
@@ -3968,14 +3965,17 @@ static int mptcp_napi_poll(struct napi_struct *napi, int budget) · 519 unmodified lines
39683965 struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
39693966
39703967 bh_lock_sock_nested(ssk);
3971− if (!sock_owned_by_user(ssk) &&
3972− mptcp_subflow_has_delegated_action(subflow))
3973− mptcp_subflow_process_delegated(ssk);
3974− /* ... elsewhere tcp_release_cb_override already processed
3975− * the action or will do at next release_sock().
3976− * In both case must dequeue the subflow here - on the same
3977− * CPU that scheduled it.
3978− */
3968+ if (!sock_owned_by_user(ssk)) {
3969+ mptcp_subflow_process_delegated(ssk, xchg(&subflow->delegated_status, 0));
3970+ } else {
3971+ /* tcp_release_cb_override already processed
3972+ * the action or will do at next release_sock().
3973+ * In both case must dequeue the subflow here - on the same
3974+ * CPU that scheduled it.
3975+ */
3976+ smp_wmb();
3977+ clear_bit(MPTCP_DELEGATE_SCHEDULED, &subflow->delegated_status);
3978+ }
39793979 bh_unlock_sock(ssk);
39803980 sock_put(ssk);
39813981
net/mptcp/protocol.h+12−23
@@ -444,9 +444,11 @@ struct mptcp_delegated_action { · 443 unmodified lines
444444
445445 DECLARE_PER_CPU(struct mptcp_delegated_action, mptcp_delegated_actions);
446446
447−#define MPTCP_DELEGATE_SEND 0
448−#define MPTCP_DELEGATE_ACK 1
447+#define MPTCP_DELEGATE_SCHEDULED 0
448+#define MPTCP_DELEGATE_SEND 1
449+#define MPTCP_DELEGATE_ACK 2
449450
451+#define MPTCP_DELEGATE_ACTIONS_MASK (~BIT(MPTCP_DELEGATE_SCHEDULED))
450452 /* MPTCP subflow context */
451453 struct mptcp_subflow_context {
452454 struct list_head node;/* conn_list of subflows */
@@ -564,23 +566,24 @@ mptcp_subflow_get_mapped_dsn(const struct mptcp_subflow_context *subflow) · 111 unmodified lines
564566 return subflow->map_seq + mptcp_subflow_get_map_offset(subflow);
565567 }
566568
567−void mptcp_subflow_process_delegated(struct sock *ssk);
569+void mptcp_subflow_process_delegated(struct sock *ssk, long actions);
568570
569571 static inline void mptcp_subflow_delegate(struct mptcp_subflow_context *subflow, int action)
570572 {
573+ long old, set_bits = BIT(MPTCP_DELEGATE_SCHEDULED) | BIT(action);
571574 struct mptcp_delegated_action *delegated;
572575 bool schedule;
573576
574577 /* the caller held the subflow bh socket lock */
575578 lockdep_assert_in_softirq();
576579
577− /* The implied barrier pairs with mptcp_subflow_delegated_done(), and
578− * ensures the below list check sees list updates done prior to status
579− * bit changes
580+ /* The implied barrier pairs with tcp_release_cb_override()
581+ * mptcp_napi_poll(), and ensures the below list check sees list
582+ * updates done prior to delegated status bits changes
580583 */
581− if (!test_and_set_bit(action, &subflow->delegated_status)) {
582− /* still on delegated list from previous scheduling */
583− if (!list_empty(&subflow->delegated_node))
584+ old = set_mask_bits(&subflow->delegated_status, 0, set_bits);
585+ if (!(old & BIT(MPTCP_DELEGATE_SCHEDULED))) {
586+ if (WARN_ON_ONCE(!list_empty(&subflow->delegated_node)))
584587 return;
585588
586589 delegated = this_cpu_ptr(&mptcp_delegated_actions);
@@ -605,20 +608,6 @@ mptcp_subflow_delegated_next(struct mptcp_delegated_action *delegated) · 18 unmodified lines
605608 return ret;
606609 }
607610
608−static inline bool mptcp_subflow_has_delegated_action(const struct mptcp_subflow_context *subflow)
609−{
610− return !!READ_ONCE(subflow->delegated_status);
611−}
612−
613−static inline void mptcp_subflow_delegated_done(struct mptcp_subflow_context *subflow, int action)
614−{
615− /* pairs with mptcp_subflow_delegate, ensures delegate_node is updated before
616− * touching the status bit
617− */
618− smp_wmb();
619− clear_bit(action, &subflow->delegated_status);
620−}
621−
622611 int mptcp_is_enabled(const struct net *net);
623612 unsigned int mptcp_get_add_addr_timeout(const struct net *net);
624613 int mptcp_is_checksum_enabled(const struct net *net);
net/mptcp/subflow.c+8−2
@@ -1956,9 +1956,15 @@ static void subflow_ulp_clone(const struct request_sock *req, · 1955 unmodified lines
19561956 static void tcp_release_cb_override(struct sock *ssk)
19571957 {
19581958 struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
1959+ long status;
19591960
1960− if (mptcp_subflow_has_delegated_action(subflow))
1961− mptcp_subflow_process_delegated(ssk);
1961+ /* process and clear all the pending actions, but leave the subflow into
1962+ * the napi queue. To respect locking, only the same CPU that originated
1963+ * the action can touch the list. mptcp_napi_poll will take care of it.
1964+ */
1965+ status = set_mask_bits(&subflow->delegated_status, MPTCP_DELEGATE_ACTIONS_MASK, 0);
1966+ if (status)
1967+ mptcp_subflow_process_delegated(ssk, status);
19621968
19631969 tcp_release_cb(ssk);
19641970 }
net/netfilter/ipvs/ip_vs_sync.c+4−4
@@ -1439,7 +1439,7 @@ static int bind_mcastif_addr(struct socket *sock, struct net_device *dev) · 1438 unmodified lines
14391439 sin.sin_addr.s_addr = addr;
14401440 sin.sin_port = 0;
14411441
1442− return sock->ops->bind(sock, (struct sockaddr*)&sin, sizeof(sin));
1442+ return kernel_bind(sock, (struct sockaddr *)&sin, sizeof(sin));
14431443 }
14441444
14451445 static void get_mcast_sockaddr(union ipvs_sockaddr *sa, int *salen,
@@ -1505,8 +1505,8 @@ static int make_send_sock(struct netns_ipvs *ipvs, int id, · 59 unmodified lines
15051505 }
15061506
15071507 get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->mcfg, id);
1508− result = sock->ops->connect(sock, (struct sockaddr *) &mcast_addr,
1509− salen, 0);
1508+ result = kernel_connect(sock, (struct sockaddr *)&mcast_addr,
1509+ salen, 0);
15101510 if (result < 0) {
15111511 pr_err("Error connecting to the multicast addr\n");
15121512 goto error;
@@ -1546,7 +1546,7 @@ static int make_receive_sock(struct netns_ipvs *ipvs, int id, · 33 unmodified lines
15461546
15471547 get_mcast_sockaddr(&mcast_addr, &salen, &ipvs->bcfg, id);
15481548 sock->sk->sk_bound_dev_if = dev->ifindex;
1549− result = sock->ops->bind(sock, (struct sockaddr *)&mcast_addr, salen);
1549+ result = kernel_bind(sock, (struct sockaddr *)&mcast_addr, salen);
15501550 if (result < 0) {
15511551 pr_err("Error binding to the multicast addr\n");
15521552 goto error;
net/netfilter/nf_conntrack_proto_sctp.c+33−10
@@ -112,7 +112,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { · 111 unmodified lines
112112 /* shutdown_ack */ {sSA, sCL, sCW, sCE, sES, sSA, sSA, sSA, sSA},
113113 /* error */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL},/* Can't have Stale cookie*/
114114 /* cookie_echo */ {sCL, sCL, sCE, sCE, sES, sSS, sSR, sSA, sCL},/* 5.2.4 - Big TODO */
115−/* cookie_ack */ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sCL},/* Can't come in orig dir */
115+/* cookie_ack */ {sCL, sCL, sCW, sES, sES, sSS, sSR, sSA, sCL},/* Can't come in orig dir */
116116 /* shutdown_comp*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sCL, sCL},
117117 /* heartbeat */ {sHS, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS},
118118 /* heartbeat_ack*/ {sCL, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS},
@@ -126,7 +126,7 @@ static const u8 sctp_conntracks[2][11][SCTP_CONNTRACK_MAX] = { · 7 unmodified lines
126126 /* shutdown */ {sIV, sCL, sCW, sCE, sSR, sSS, sSR, sSA, sIV},
127127 /* shutdown_ack */ {sIV, sCL, sCW, sCE, sES, sSA, sSA, sSA, sIV},
128128 /* error */ {sIV, sCL, sCW, sCL, sES, sSS, sSR, sSA, sIV},
129−/* cookie_echo */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sIV},/* Can't come in reply dir */
129+/* cookie_echo */ {sIV, sCL, sCE, sCE, sES, sSS, sSR, sSA, sIV},/* Can't come in reply dir */
130130 /* cookie_ack */ {sIV, sCL, sCW, sES, sES, sSS, sSR, sSA, sIV},
131131 /* shutdown_comp*/ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sCL, sIV},
132132 /* heartbeat */ {sIV, sCL, sCW, sCE, sES, sSS, sSR, sSA, sHS},
@@ -412,6 +412,9 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 279 unmodified lines
412412 /* (D) vtag must be same as init_vtag as found in INIT_ACK */
413413 if (sh->vtag != ct->proto.sctp.vtag[dir])
414414 goto out_unlock;
415+ } else if (sch->type == SCTP_CID_COOKIE_ACK) {
416+ ct->proto.sctp.init[dir] = 0;
417+ ct->proto.sctp.init[!dir] = 0;
415418 } else if (sch->type == SCTP_CID_HEARTBEAT) {
416419 if (ct->proto.sctp.vtag[dir] == 0) {
417420 pr_debug("Setting %d vtag %x for dir %d\n", sch->type, sh->vtag, dir);
@@ -461,16 +464,18 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 43 unmodified lines
461464 }
462465
463466 /* If it is an INIT or an INIT ACK note down the vtag */
464− if (sch->type == SCTP_CID_INIT ||
465− sch->type == SCTP_CID_INIT_ACK) {
466− struct sctp_inithdr _inithdr, *ih;
467+ if (sch->type == SCTP_CID_INIT) {
468+ struct sctp_inithdr _ih, *ih;
467469
468− ih = skb_header_pointer(skb, offset + sizeof(_sch),
469− sizeof(_inithdr), &_inithdr);
470− if (ih == NULL)
470+ ih = skb_header_pointer(skb, offset + sizeof(_sch), sizeof(*ih), &_ih);
471+ if (!ih)
471472 goto out_unlock;
472− pr_debug("Setting vtag %x for dir %d\n",
473− ih->init_tag, !dir);
473+
474+ if (ct->proto.sctp.init[dir] && ct->proto.sctp.init[!dir])
475+ ct->proto.sctp.init[!dir] = 0;
476+ ct->proto.sctp.init[dir] = 1;
477+
478+ pr_debug("Setting vtag %x for dir %d\n", ih->init_tag, !dir);
474479 ct->proto.sctp.vtag[!dir] = ih->init_tag;
475480
476481 /* don't renew timeout on init retransmit so
@@ -481,6 +486,24 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, · 4 unmodified lines
481486 old_state == SCTP_CONNTRACK_CLOSED &&
482487 nf_ct_is_confirmed(ct))
483488 ignore = true;
489+ } else if (sch->type == SCTP_CID_INIT_ACK) {
490+ struct sctp_inithdr _ih, *ih;
491+ __be32 vtag;
492+
493+ ih = skb_header_pointer(skb, offset + sizeof(_sch), sizeof(*ih), &_ih);
494+ if (!ih)
495+ goto out_unlock;
496+
497+ vtag = ct->proto.sctp.vtag[!dir];
498+ if (!ct->proto.sctp.init[!dir] && vtag && vtag != ih->init_tag)
499+ goto out_unlock;
500+ /* collision */
501+ if (ct->proto.sctp.init[dir] && ct->proto.sctp.init[!dir] &&
502+ vtag != ih->init_tag)
503+ goto out_unlock;
504+
505+ pr_debug("Setting vtag %x for dir %d\n", ih->init_tag, !dir);
506+ ct->proto.sctp.vtag[!dir] = ih->init_tag;
484507 }
485508
486509 ct->proto.sctp.state = new_state;
net/netfilter/nf_tables_api.c+28−16
@@ -7871,24 +7871,14 @@ static int nf_tables_delobj(struct sk_buff *skb, const struct nfnl_info *info, · 7870 unmodified lines
78717871 return nft_delobj(&ctx, obj);
78727872 }
78737873
7874−void nft_obj_notify(struct net *net, const struct nft_table *table,
7875− struct nft_object *obj, u32 portid, u32 seq, int event,
7876− u16 flags, int family, int report, gfp_t gfp)
7874+static void
7875+__nft_obj_notify(struct net *net, const struct nft_table *table,
7876+ struct nft_object *obj, u32 portid, u32 seq, int event,
7877+ u16 flags, int family, int report, gfp_t gfp)
78777878 {
78787879 struct nftables_pernet *nft_net = nft_pernet(net);
78797880 struct sk_buff *skb;
78807881 int err;
7881− char *buf = kasprintf(gfp, "%s:%u",
7882− table->name, nft_net->base_seq);
7883−
7884− audit_log_nfcfg(buf,
7885− family,
7886− obj->handle,
7887− event == NFT_MSG_NEWOBJ ?
7888− AUDIT_NFT_OP_OBJ_REGISTER :
7889− AUDIT_NFT_OP_OBJ_UNREGISTER,
7890− gfp);
7891− kfree(buf);
78927882
78937883 if (!report &&
78947884 !nfnetlink_has_listeners(net, NFNLGRP_NFTABLES))
@@ -7911,13 +7901,35 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, · 16 unmodified lines
79117901 err:
79127902 nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
79137903 }
7904+
7905+void nft_obj_notify(struct net *net, const struct nft_table *table,
7906+ struct nft_object *obj, u32 portid, u32 seq, int event,
7907+ u16 flags, int family, int report, gfp_t gfp)
7908+{
7909+ struct nftables_pernet *nft_net = nft_pernet(net);
7910+ char *buf = kasprintf(gfp, "%s:%u",
7911+ table->name, nft_net->base_seq);
7912+
7913+ audit_log_nfcfg(buf,
7914+ family,
7915+ obj->handle,
7916+ event == NFT_MSG_NEWOBJ ?
7917+ AUDIT_NFT_OP_OBJ_REGISTER :
7918+ AUDIT_NFT_OP_OBJ_UNREGISTER,
7919+ gfp);
7920+ kfree(buf);
7921+
7922+ __nft_obj_notify(net, table, obj, portid, seq, event,
7923+ flags, family, report, gfp);
7924+}
79147925 EXPORT_SYMBOL_GPL(nft_obj_notify);
79157926
79167927 static void nf_tables_obj_notify(const struct nft_ctx *ctx,
79177928 struct nft_object *obj, int event)
79187929 {
7919− nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid, ctx->seq, event,
7920− ctx->flags, ctx->family, ctx->report, GFP_KERNEL);
7930+ __nft_obj_notify(ctx->net, ctx->table, obj, ctx->portid,
7931+ ctx->seq, event, ctx->flags, ctx->family,
7932+ ctx->report, GFP_KERNEL);
79217933 }
79227934
79237935 /*
net/netfilter/nft_payload.c+12−1
@@ -154,6 +154,17 @@ int nft_payload_inner_offset(const struct nft_pktinfo *pkt) · 153 unmodified lines
154154 return pkt->inneroff;
155155 }
156156
157+static bool nft_payload_need_vlan_copy(const struct nft_payload *priv)
158+{
159+ unsigned int len = priv->offset + priv->len;
160+
161+ /* data past ether src/dst requested, copy needed */
162+ if (len > offsetof(struct ethhdr, h_proto))
163+ return true;
164+
165+ return false;
166+}
167+
157168 void nft_payload_eval(const struct nft_expr *expr,
158169 struct nft_regs *regs,
159170 const struct nft_pktinfo *pkt)
@@ -172,7 +183,7 @@ void nft_payload_eval(const struct nft_expr *expr, · 12 unmodified lines
172183 goto err;
173184
174185 if (skb_vlan_tag_present(skb) &&
175− priv->offset >= offsetof(struct ethhdr, h_proto)) {
186+ nft_payload_need_vlan_copy(priv)) {
176187 if (!nft_payload_copy_vlan(dest, skb,
177188 priv->offset, priv->len))
178189 goto err;
net/netfilter/nft_set_rbtree.c+29−17
@@ -233,10 +233,9 @@ static void nft_rbtree_gc_remove(struct net *net, struct nft_set *set, · 232 unmodified lines
233233 rb_erase(&rbe->node, &priv->root);
234234 }
235235
236−static int nft_rbtree_gc_elem(const struct nft_set *__set,
237− struct nft_rbtree *priv,
238− struct nft_rbtree_elem *rbe,
239− u8 genmask)
236+static const struct nft_rbtree_elem *
237+nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv,
238+ struct nft_rbtree_elem *rbe, u8 genmask)
240239 {
241240 struct nft_set *set = (struct nft_set *)__set;
242241 struct rb_node *prev = rb_prev(&rbe->node);
@@ -246,7 +245,7 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 3 unmodified lines
246245
247246 gc = nft_trans_gc_alloc(set, 0, GFP_ATOMIC);
248247 if (!gc)
249− return -ENOMEM;
248+ return ERR_PTR(-ENOMEM);
250249
251250 /* search for end interval coming before this element.
252251 * end intervals don't carry a timeout extension, they
@@ -261,6 +260,7 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 8 unmodified lines
261260 prev = rb_prev(prev);
262261 }
263262
263+ rbe_prev = NULL;
264264 if (prev) {
265265 rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node);
266266 nft_rbtree_gc_remove(net, set, priv, rbe_prev);
@@ -272,7 +272,7 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 5 unmodified lines
272272 */
273273 gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC);
274274 if (WARN_ON_ONCE(!gc))
275− return -ENOMEM;
275+ return ERR_PTR(-ENOMEM);
276276
277277 nft_trans_gc_elem_add(gc, rbe_prev);
278278 }
@@ -280,13 +280,13 @@ static int nft_rbtree_gc_elem(const struct nft_set *__set, · 1 unmodified line
280280 nft_rbtree_gc_remove(net, set, priv, rbe);
281281 gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC);
282282 if (WARN_ON_ONCE(!gc))
283− return -ENOMEM;
283+ return ERR_PTR(-ENOMEM);
284284
285285 nft_trans_gc_elem_add(gc, rbe);
286286
287287 nft_trans_gc_queue_sync_done(gc);
288288
289− return 0;
289+ return rbe_prev;
290290 }
291291
292292 static bool nft_rbtree_update_first(const struct nft_set *set,
@@ -314,7 +314,7 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 21 unmodified lines
314314 struct nft_rbtree *priv = nft_set_priv(set);
315315 u8 cur_genmask = nft_genmask_cur(net);
316316 u8 genmask = nft_genmask_next(net);
317− int d, err;
317+ int d;
318318
319319 /* Descend the tree to search for an existing element greater than the
320320 * key value to insert that is greater than the new element. This is the
@@ -363,9 +363,14 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 42 unmodified lines
363363 */
364364 if (nft_set_elem_expired(&rbe->ext) &&
365365 nft_set_elem_active(&rbe->ext, cur_genmask)) {
366− err = nft_rbtree_gc_elem(set, priv, rbe, genmask);
367− if (err < 0)
368− return err;
366+ const struct nft_rbtree_elem *removed_end;
367+
368+ removed_end = nft_rbtree_gc_elem(set, priv, rbe, genmask);
369+ if (IS_ERR(removed_end))
370+ return PTR_ERR(removed_end);
371+
372+ if (removed_end == rbe_le || removed_end == rbe_ge)
373+ return -EAGAIN;
369374
370375 continue;
371376 }
@@ -486,11 +491,18 @@ static int nft_rbtree_insert(const struct net *net, const struct nft_set *set, · 114 unmodified lines
486491 struct nft_rbtree_elem *rbe = elem->priv;
487492 int err;
488493
489− write_lock_bh(&priv->lock);
490− write_seqcount_begin(&priv->count);
491− err = __nft_rbtree_insert(net, set, rbe, ext);
492− write_seqcount_end(&priv->count);
493− write_unlock_bh(&priv->lock);
494+ do {
495+ if (fatal_signal_pending(current))
496+ return -EINTR;
497+
498+ cond_resched();
499+
500+ write_lock_bh(&priv->lock);
501+ write_seqcount_begin(&priv->count);
502+ err = __nft_rbtree_insert(net, set, rbe, ext);
503+ write_seqcount_end(&priv->count);
504+ write_unlock_bh(&priv->lock);
505+ } while (err == -EAGAIN);
494506
495507 return err;
496508 }
net/netlink/af_netlink.c+4−4
@@ -352,7 +352,7 @@ static void netlink_overrun(struct sock *sk) · 351 unmodified lines
352352 if (!nlk_test_bit(RECV_NO_ENOBUFS, sk)) {
353353 if (!test_and_set_bit(NETLINK_S_CONGESTED,
354354 &nlk_sk(sk)->state)) {
355− sk->sk_err = ENOBUFS;
355+ WRITE_ONCE(sk->sk_err, ENOBUFS);
356356 sk_error_report(sk);
357357 }
358358 }
@@ -1605,7 +1605,7 @@ static int do_one_set_err(struct sock *sk, struct netlink_set_err_data *p) · 1246 unmodified lines
16051605 goto out;
16061606 }
16071607
1608− sk->sk_err = p->code;
1608+ WRITE_ONCE(sk->sk_err, p->code);
16091609 sk_error_report(sk);
16101610 out:
16111611 return ret;
@@ -1991,7 +1991,7 @@ static int netlink_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, · 379 unmodified lines
19911991 atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) {
19921992 ret = netlink_dump(sk);
19931993 if (ret) {
1994− sk->sk_err = -ret;
1994+ WRITE_ONCE(sk->sk_err, -ret);
19951995 sk_error_report(sk);
19961996 }
19971997 }
@@ -2511,7 +2511,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err, · 513 unmodified lines
25112511 err_bad_put:
25122512 nlmsg_free(skb);
25132513 err_skb:
2514− NETLINK_CB(in_skb).sk->sk_err = ENOBUFS;
2514+ WRITE_ONCE(NETLINK_CB(in_skb).sk->sk_err, ENOBUFS);
25152515 sk_error_report(NETLINK_CB(in_skb).sk);
25162516 }
25172517 EXPORT_SYMBOL(netlink_ack);
net/nfc/llcp_core.c+14−18
@@ -203,17 +203,13 @@ static struct nfc_llcp_sock *nfc_llcp_sock_get(struct nfc_llcp_local *local, · 202 unmodified lines
203203
204204 if (tmp_sock->ssap == ssap && tmp_sock->dsap == dsap) {
205205 llcp_sock = tmp_sock;
206+ sock_hold(&llcp_sock->sk);
206207 break;
207208 }
208209 }
209210
210211 read_unlock(&local->sockets.lock);
211212
212− if (llcp_sock == NULL)
213− return NULL;
214−
215− sock_hold(&llcp_sock->sk);
216−
217213 return llcp_sock;
218214 }
219215
@@ -346,7 +342,8 @@ static int nfc_llcp_wks_sap(const char *service_name, size_t service_name_len) · 126 unmodified lines
346342
347343 static
348344 struct nfc_llcp_sock *nfc_llcp_sock_from_sn(struct nfc_llcp_local *local,
349− const u8 *sn, size_t sn_len)
345+ const u8 *sn, size_t sn_len,
346+ bool needref)
350347 {
351348 struct sock *sk;
352349 struct nfc_llcp_sock *llcp_sock, *tmp_sock;
@@ -382,6 +379,8 @@ struct nfc_llcp_sock *nfc_llcp_sock_from_sn(struct nfc_llcp_local *local, · 29 unmodified lines
382379
383380 if (memcmp(sn, tmp_sock->service_name, sn_len) == 0) {
384381 llcp_sock = tmp_sock;
382+ if (needref)
383+ sock_hold(&llcp_sock->sk);
385384 break;
386385 }
387386 }
@@ -423,7 +422,8 @@ u8 nfc_llcp_get_sdp_ssap(struct nfc_llcp_local *local, · 35 unmodified lines
423422 * to this service name.
424423 */
425424 if (nfc_llcp_sock_from_sn(local, sock->service_name,
426− sock->service_name_len) != NULL) {
425+ sock->service_name_len,
426+ false) != NULL) {
427427 mutex_unlock(&local->sdp_lock);
428428
429429 return LLCP_SAP_MAX;
@@ -824,16 +824,7 @@ out: · 394 unmodified lines
824824 static struct nfc_llcp_sock *nfc_llcp_sock_get_sn(struct nfc_llcp_local *local,
825825 const u8 *sn, size_t sn_len)
826826 {
827− struct nfc_llcp_sock *llcp_sock;
828−
829− llcp_sock = nfc_llcp_sock_from_sn(local, sn, sn_len);
830−
831− if (llcp_sock == NULL)
832− return NULL;
833−
834− sock_hold(&llcp_sock->sk);
835−
836− return llcp_sock;
827+ return nfc_llcp_sock_from_sn(local, sn, sn_len, true);
837828 }
838829
839830 static const u8 *nfc_llcp_connect_sn(const struct sk_buff *skb, size_t *sn_len)
@@ -1298,7 +1289,8 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local *local, · 458 unmodified lines
12981289 }
12991290
13001291 llcp_sock = nfc_llcp_sock_from_sn(local, service_name,
1301− service_name_len);
1292+ service_name_len,
1293+ true);
13021294 if (!llcp_sock) {
13031295 sap = 0;
13041296 goto add_snl;
@@ -1318,6 +1310,7 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local *local, · 13 unmodified lines
13181310
13191311 if (sap == LLCP_SAP_MAX) {
13201312 sap = 0;
1313+ nfc_llcp_sock_put(llcp_sock);
13211314 goto add_snl;
13221315 }
13231316
@@ -1335,6 +1328,7 @@ static void nfc_llcp_recv_snl(struct nfc_llcp_local *local, · 11 unmodified lines
13351328
13361329 pr_debug("%p %d\n", llcp_sock, sap);
13371330
1331+ nfc_llcp_sock_put(llcp_sock);
13381332 add_snl:
13391333 sdp = nfc_llcp_build_sdres_tlv(tid, sap);
13401334 if (sdp == NULL)
@@ -1636,7 +1630,9 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) · 295 unmodified lines
16361630 timer_setup(&local->sdreq_timer, nfc_llcp_sdreq_timer, 0);
16371631 INIT_WORK(&local->sdreq_timeout_work, nfc_llcp_sdreq_timeout_work);
16381632
1633+ spin_lock(&llcp_devices_lock);
16391634 list_add(&local->list, &llcp_devices);
1635+ spin_unlock(&llcp_devices_lock);
16401636
16411637 return 0;
16421638 }
net/nfc/nci/core.c+5−0
@@ -909,6 +909,11 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, · 908 unmodified lines
909909 return -EINVAL;
910910 }
911911
912+ if (protocol >= NFC_PROTO_MAX) {
913+ pr_err("the requested nfc protocol is invalid\n");
914+ return -EINVAL;
915+ }
916+
912917 if (!(nci_target->supported_protocols & (1 << protocol))) {
913918 pr_err("target does not support the requested protocol 0x%x\n",
914919 protocol);
net/packet/af_packet.c+6−1
@@ -3607,7 +3607,12 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, · 3606 unmodified lines
36073607 if (dev) {
36083608 sll->sll_hatype = dev->type;
36093609 sll->sll_halen = dev->addr_len;
3610− memcpy(sll->sll_addr_flex, dev->dev_addr, dev->addr_len);
3610+
3611+ /* Let __fortify_memcpy_chk() know the actual buffer size. */
3612+ memcpy(((struct sockaddr_storage *)sll)->__data +
3613+ offsetof(struct sockaddr_ll, sll_addr) -
3614+ offsetofend(struct sockaddr_ll, sll_family),
3615+ dev->dev_addr, dev->addr_len);
36113616 } else {
36123617 sll->sll_hatype = 0; /* Bad: we have no ARPHRD_UNSPEC */
36133618 sll->sll_halen = 0;
net/rds/tcp_connect.c+2−2
@@ -145,7 +145,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp) · 144 unmodified lines
145145 addrlen = sizeof(sin);
146146 }
147147
148− ret = sock->ops->bind(sock, addr, addrlen);
148+ ret = kernel_bind(sock, addr, addrlen);
149149 if (ret) {
150150 rdsdebug("bind failed with %d at address %pI6c\n",
151151 ret, &conn->c_laddr);
@@ -173,7 +173,7 @@ int rds_tcp_conn_path_connect(struct rds_conn_path *cp) · 21 unmodified lines
173173 * own the socket
174174 */
175175 rds_tcp_set_callbacks(sock, cp);
176− ret = sock->ops->connect(sock, addr, addrlen, O_NONBLOCK);
176+ ret = kernel_connect(sock, addr, addrlen, O_NONBLOCK);
177177
178178 rdsdebug("connect to address %pI6c returned %d\n", &conn->c_faddr, ret);
179179 if (ret == -EINPROGRESS)
net/rds/tcp_listen.c+1−1
@@ -306,7 +306,7 @@ struct socket *rds_tcp_listen_init(struct net *net, bool isv6) · 305 unmodified lines
306306 addr_len = sizeof(*sin);
307307 }
308308
309− ret = sock->ops->bind(sock, (struct sockaddr *)&ss, addr_len);
309+ ret = kernel_bind(sock, (struct sockaddr *)&ss, addr_len);
310310 if (ret < 0) {
311311 rdsdebug("could not bind %s listener socket: %d\n",
312312 isv6 ? "IPv6" : "IPv4", ret);
net/rfkill/core.c+26−6
@@ -48,6 +48,7 @@ struct rfkill { · 47 unmodified lines
4848 bool persistent;
4949 bool polling_paused;
5050 bool suspended;
51+ bool need_sync;
5152
5253 const struct rfkill_ops *ops;
5354 void *data;
@@ -368,6 +369,17 @@ static void rfkill_set_block(struct rfkill *rfkill, bool blocked) · 314 unmodified lines
368369 rfkill_event(rfkill);
369370 }
370371
372+static void rfkill_sync(struct rfkill *rfkill)
373+{
374+ lockdep_assert_held(&rfkill_global_mutex);
375+
376+ if (!rfkill->need_sync)
377+ return;
378+
379+ rfkill_set_block(rfkill, rfkill_global_states[rfkill->type].cur);
380+ rfkill->need_sync = false;
381+}
382+
371383 static void rfkill_update_global_state(enum rfkill_type type, bool blocked)
372384 {
373385 int i;
@@ -730,6 +742,10 @@ static ssize_t soft_show(struct device *dev, struct device_attribute *attr, · 356 unmodified lines
730742 {
731743 struct rfkill *rfkill = to_rfkill(dev);
732744
745+ mutex_lock(&rfkill_global_mutex);
746+ rfkill_sync(rfkill);
747+ mutex_unlock(&rfkill_global_mutex);
748+
733749 return sysfs_emit(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_SW) ? 1 : 0);
734750 }
735751
@@ -751,6 +767,7 @@ static ssize_t soft_store(struct device *dev, struct device_attribute *attr, · 15 unmodified lines
751767 return -EINVAL;
752768
753769 mutex_lock(&rfkill_global_mutex);
770+ rfkill_sync(rfkill);
754771 rfkill_set_block(rfkill, state);
755772 mutex_unlock(&rfkill_global_mutex);
756773
@@ -783,6 +800,10 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr, · 26 unmodified lines
783800 {
784801 struct rfkill *rfkill = to_rfkill(dev);
785802
803+ mutex_lock(&rfkill_global_mutex);
804+ rfkill_sync(rfkill);
805+ mutex_unlock(&rfkill_global_mutex);
806+
786807 return sysfs_emit(buf, "%d\n", user_state_from_blocked(rfkill->state));
787808 }
788809
@@ -805,6 +826,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr, · 16 unmodified lines
805826 return -EINVAL;
806827
807828 mutex_lock(&rfkill_global_mutex);
829+ rfkill_sync(rfkill);
808830 rfkill_set_block(rfkill, state == RFKILL_USER_STATE_SOFT_BLOCKED);
809831 mutex_unlock(&rfkill_global_mutex);
810832
@@ -1032,14 +1054,10 @@ static void rfkill_uevent_work(struct work_struct *work) · 221 unmodified lines
10321054
10331055 static void rfkill_sync_work(struct work_struct *work)
10341056 {
1035− struct rfkill *rfkill;
1036− bool cur;
1037−
1038− rfkill = container_of(work, struct rfkill, sync_work);
1057+ struct rfkill *rfkill = container_of(work, struct rfkill, sync_work);
10391058
10401059 mutex_lock(&rfkill_global_mutex);
1041− cur = rfkill_global_states[rfkill->type].cur;
1042− rfkill_set_block(rfkill, cur);
1060+ rfkill_sync(rfkill);
10431061 mutex_unlock(&rfkill_global_mutex);
10441062 }
10451063
@@ -1087,6 +1105,7 @@ int __must_check rfkill_register(struct rfkill *rfkill) · 41 unmodified lines
10871105 round_jiffies_relative(POLL_INTERVAL));
10881106
10891107 if (!rfkill->persistent || rfkill_epo_lock_active) {
1108+ rfkill->need_sync = true;
10901109 schedule_work(&rfkill->sync_work);
10911110 } else {
10921111 #ifdef CONFIG_RFKILL_INPUT
@@ -1171,6 +1190,7 @@ static int rfkill_fop_open(struct inode *inode, struct file *file) · 78 unmodified lines
11711190 ev = kzalloc(sizeof(*ev), GFP_KERNEL);
11721191 if (!ev)
11731192 goto free;
1193+ rfkill_sync(rfkill);
11741194 rfkill_fill_event(&ev->ev, rfkill, RFKILL_OP_ADD);
11751195 list_add_tail(&ev->list, &data->events);
11761196 }
net/sched/cls_u32.c+1−1
@@ -366,7 +366,7 @@ static int u32_init(struct tcf_proto *tp) · 365 unmodified lines
366366 idr_init(&root_ht->handle_idr);
367367
368368 if (tp_c == NULL) {
369− tp_c = kzalloc(struct_size(tp_c, hlist->ht, 1), GFP_KERNEL);
369+ tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL);
370370 if (tp_c == NULL) {
371371 kfree(root_ht);
372372 return -ENOBUFS;
net/sctp/associola.c+1−2
@@ -1159,8 +1159,7 @@ int sctp_assoc_update(struct sctp_association *asoc, · 1158 unmodified lines
11591159 /* Add any peer addresses from the new association. */
11601160 list_for_each_entry(trans, &new->peer.transport_addr_list,
11611161 transports)
1162− if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr) &&
1163− !sctp_assoc_add_peer(asoc, &trans->ipaddr,
1162+ if (!sctp_assoc_add_peer(asoc, &trans->ipaddr,
11641163 GFP_ATOMIC, trans->state))
11651164 return -ENOMEM;
11661165
net/sctp/socket.c+1−0
@@ -2450,6 +2450,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, · 2449 unmodified lines
24502450 if (trans) {
24512451 trans->hbinterval =
24522452 msecs_to_jiffies(params->spp_hbinterval);
2453+ sctp_transport_reset_hb_timer(trans);
24532454 } else if (asoc) {
24542455 asoc->hbinterval =
24552456 msecs_to_jiffies(params->spp_hbinterval);
net/smc/Kconfig+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 config SMC
33 tristate "SMC socket protocol family"
44 depends on INET && INFINIBAND
5+ depends on m || ISM != m
56 help
67 SMC-R provides a "sockets over RDMA" solution making use of
78 RDMA over Converged Ethernet (RoCE) technology to upgrade
net/smc/smc_stats.h+9−5
@@ -92,13 +92,14 @@ do { \ · 91 unmodified lines
9292 typeof(_smc_stats) stats = (_smc_stats); \
9393 typeof(_tech) t = (_tech); \
9494 typeof(_len) l = (_len); \
95− int _pos = fls64((l) >> 13); \
95+ int _pos; \
9696 typeof(_rc) r = (_rc); \
9797 int m = SMC_BUF_MAX - 1; \
9898 this_cpu_inc((*stats).smc[t].key ## _cnt); \
99− if (r <= 0) \
99+ if (r <= 0 || l <= 0) \
100100 break; \
101− _pos = (_pos < m) ? ((l == 1 << (_pos + 12)) ? _pos - 1 : _pos) : m; \
101+ _pos = fls64((l - 1) >> 13); \
102+ _pos = (_pos <= m) ? _pos : m; \
102103 this_cpu_inc((*stats).smc[t].key ## _pd.buf[_pos]); \
103104 this_cpu_add((*stats).smc[t].key ## _bytes, r); \
104105 } \
@@ -138,9 +139,12 @@ while (0) · 33 unmodified lines
138139 do { \
139140 typeof(_len) _l = (_len); \
140141 typeof(_tech) t = (_tech); \
141− int _pos = fls((_l) >> 13); \
142+ int _pos; \
142143 int m = SMC_BUF_MAX - 1; \
143− _pos = (_pos < m) ? ((_l == 1 << (_pos + 12)) ? _pos - 1 : _pos) : m; \
144+ if (_l <= 0) \
145+ break; \
146+ _pos = fls((_l - 1) >> 13); \
147+ _pos = (_pos <= m) ? _pos : m; \
144148 this_cpu_inc((*(_smc_stats)).smc[t].k ## _rmbsize.buf[_pos]); \
145149 } \
146150 while (0)
net/socket.c+29−7
@@ -737,6 +737,14 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) · 736 unmodified lines
737737 return ret;
738738 }
739739
740+static int __sock_sendmsg(struct socket *sock, struct msghdr *msg)
741+{
742+ int err = security_socket_sendmsg(sock, msg,
743+ msg_data_left(msg));
744+
745+ return err ?: sock_sendmsg_nosec(sock, msg);
746+}
747+
740748 /**
741749 * sock_sendmsg - send a message through @sock
742750 * @sock: socket
@@ -747,10 +755,19 @@ static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg) · 4 unmodified lines
747755 */
748756 int sock_sendmsg(struct socket *sock, struct msghdr *msg)
749757 {
750− int err = security_socket_sendmsg(sock, msg,
751− msg_data_left(msg));
758+ struct sockaddr_storage *save_addr = (struct sockaddr_storage *)msg->msg_name;
759+ struct sockaddr_storage address;
760+ int ret;
752761
753− return err ?: sock_sendmsg_nosec(sock, msg);
762+ if (msg->msg_name) {
763+ memcpy(&address, msg->msg_name, msg->msg_namelen);
764+ msg->msg_name = &address;
765+ }
766+
767+ ret = __sock_sendmsg(sock, msg);
768+ msg->msg_name = save_addr;
769+
770+ return ret;
754771 }
755772 EXPORT_SYMBOL(sock_sendmsg);
756773
@@ -1138,7 +1155,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from) · 381 unmodified lines
11381155 if (sock->type == SOCK_SEQPACKET)
11391156 msg.msg_flags |= MSG_EOR;
11401157
1141− res = sock_sendmsg(sock, &msg);
1158+ res = __sock_sendmsg(sock, &msg);
11421159 *from = msg.msg_iter;
11431160 return res;
11441161 }
@@ -2174,7 +2191,7 @@ int __sys_sendto(int fd, void __user *buff, size_t len, unsigned int flags, · 1029 unmodified lines
21742191 if (sock->file->f_flags & O_NONBLOCK)
21752192 flags |= MSG_DONTWAIT;
21762193 msg.msg_flags = flags;
2177− err = sock_sendmsg(sock, &msg);
2194+ err = __sock_sendmsg(sock, &msg);
21782195
21792196 out_put:
21802197 fput_light(sock->file, fput_needed);
@@ -2538,7 +2555,7 @@ static int ____sys_sendmsg(struct socket *sock, struct msghdr *msg_sys, · 357 unmodified lines
25382555 err = sock_sendmsg_nosec(sock, msg_sys);
25392556 goto out_freectl;
25402557 }
2541− err = sock_sendmsg(sock, msg_sys);
2558+ err = __sock_sendmsg(sock, msg_sys);
25422559 /*
25432560 * If this is sendmmsg() and sending to current destination address was
25442561 * successful, remember it.
@@ -3499,7 +3516,12 @@ static long compat_sock_ioctl(struct file *file, unsigned int cmd, · 954 unmodified lines
34993516
35003517 int kernel_bind(struct socket *sock, struct sockaddr *addr, int addrlen)
35013518 {
3502− return READ_ONCE(sock->ops)->bind(sock, addr, addrlen);
3519+ struct sockaddr_storage address;
3520+
3521+ memcpy(&address, addr, addrlen);
3522+
3523+ return READ_ONCE(sock->ops)->bind(sock, (struct sockaddr *)&address,
3524+ addrlen);
35033525 }
35043526 EXPORT_SYMBOL(kernel_bind);
35053527
net/sunrpc/auth.c+8−3
@@ -769,9 +769,14 @@ int rpcauth_wrap_req(struct rpc_task *task, struct xdr_stream *xdr) · 768 unmodified lines
769769 * @task: controlling RPC task
770770 * @xdr: xdr_stream containing RPC Reply header
771771 *
772− * On success, @xdr is updated to point past the verifier and
773− * zero is returned. Otherwise, @xdr is in an undefined state
774− * and a negative errno is returned.
772+ * Return values:
773+ * %0: Verifier is valid. @xdr now points past the verifier.
774+ * %-EIO: Verifier is corrupted or message ended early.
775+ * %-EACCES: Verifier is intact but not valid.
776+ * %-EPROTONOSUPPORT: Server does not support the requested auth type.
777+ *
778+ * When a negative errno is returned, @xdr is left in an undefined
779+ * state.
775780 */
776781 int
777782 rpcauth_checkverf(struct rpc_task *task, struct xdr_stream *xdr)
net/sunrpc/auth_tls.c+2−2
@@ -129,9 +129,9 @@ static int tls_validate(struct rpc_task *task, struct xdr_stream *xdr) · 128 unmodified lines
129129 if (*p != rpc_auth_null)
130130 return -EIO;
131131 if (xdr_stream_decode_opaque_inline(xdr, &str, starttls_len) != starttls_len)
132− return -EIO;
132+ return -EPROTONOSUPPORT;
133133 if (memcmp(str, starttls_token, starttls_len))
134− return -EIO;
134+ return -EPROTONOSUPPORT;
135135 return 0;
136136 }
137137
net/sunrpc/clnt.c+10−3
@@ -2476,8 +2476,7 @@ call_status(struct rpc_task *task) · 2475 unmodified lines
24762476 goto out_exit;
24772477 }
24782478 task->tk_action = call_encode;
2479− if (status != -ECONNRESET && status != -ECONNABORTED)
2480− rpc_check_timeout(task);
2479+ rpc_check_timeout(task);
24812480 return;
24822481 out_exit:
24832482 rpc_call_rpcerror(task, status);
@@ -2725,7 +2724,15 @@ out_unparsable: · 241 unmodified lines
27252724
27262725 out_verifier:
27272726 trace_rpc_bad_verifier(task);
2728− goto out_garbage;
2727+ switch (error) {
2728+ case -EPROTONOSUPPORT:
2729+ goto out_err;
2730+ case -EACCES:
2731+ /* Re-encode with a fresh cred */
2732+ fallthrough;
2733+ default:
2734+ goto out_garbage;
2735+ }
27292736
27302737 out_msg_denied:
27312738 error = -EACCES;
net/sunrpc/xprtsock.c+6−0
@@ -2672,6 +2672,10 @@ static void xs_tcp_tls_setup_socket(struct work_struct *work) · 2671 unmodified lines
26722672 rcu_read_lock();
26732673 lower_xprt = rcu_dereference(lower_clnt->cl_xprt);
26742674 rcu_read_unlock();
2675+
2676+ if (wait_on_bit_lock(&lower_xprt->state, XPRT_LOCKED, TASK_KILLABLE))
2677+ goto out_unlock;
2678+
26752679 status = xs_tls_handshake_sync(lower_xprt, &upper_xprt->xprtsec);
26762680 if (status) {
26772681 trace_rpc_tls_not_started(upper_clnt, upper_xprt);
@@ -2681,6 +2685,7 @@ static void xs_tcp_tls_setup_socket(struct work_struct *work) · 3 unmodified lines
26812685 status = xs_tcp_tls_finish_connecting(lower_xprt, upper_transport);
26822686 if (status)
26832687 goto out_close;
2688+ xprt_release_write(lower_xprt, NULL);
26842689
26852690 trace_rpc_socket_connect(upper_xprt, upper_transport->sock, 0);
26862691 if (!xprt_test_and_set_connected(upper_xprt)) {
@@ -2702,6 +2707,7 @@ out_unlock: · 15 unmodified lines
27022707 return;
27032708
27042709 out_close:
2710+ xprt_release_write(lower_xprt, NULL);
27052711 rpc_shutdown_client(lower_clnt);
27062712
27072713 /* xprt_force_disconnect() wakes tasks with a fixed tk_status code.
net/tipc/crypto.c+2−2
@@ -1441,14 +1441,14 @@ static int tipc_crypto_key_revoke(struct net *net, u8 tx_key) · 1440 unmodified lines
14411441 struct tipc_crypto *tx = tipc_net(net)->crypto_tx;
14421442 struct tipc_key key;
14431443
1444− spin_lock(&tx->lock);
1444+ spin_lock_bh(&tx->lock);
14451445 key = tx->key;
14461446 WARN_ON(!key.active || tx_key != key.active);
14471447
14481448 /* Free the active key */
14491449 tipc_crypto_key_set_state(tx, key.passive, 0, key.pending);
14501450 tipc_crypto_key_detach(tx->aead[key.active], &tx->lock);
1451− spin_unlock(&tx->lock);
1451+ spin_unlock_bh(&tx->lock);
14521452
14531453 pr_warn("%s: key is revoked\n", tx->name);
14541454 return -EKEYREVOKED;
net/wireless/core.c+7−7
@@ -1181,16 +1181,11 @@ void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, · 1180 unmodified lines
11811181 }
11821182 EXPORT_SYMBOL(wiphy_rfkill_set_hw_state_reason);
11831183
1184−void cfg80211_cqm_config_free(struct wireless_dev *wdev)
1185−{
1186− kfree(wdev->cqm_config);
1187− wdev->cqm_config = NULL;
1188−}
1189−
11901184 static void _cfg80211_unregister_wdev(struct wireless_dev *wdev,
11911185 bool unregister_netdev)
11921186 {
11931187 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1188+ struct cfg80211_cqm_config *cqm_config;
11941189 unsigned int link_id;
11951190
11961191 ASSERT_RTNL();
@@ -1227,7 +1222,10 @@ static void _cfg80211_unregister_wdev(struct wireless_dev *wdev, · 30 unmodified lines
12271222 kfree_sensitive(wdev->wext.keys);
12281223 wdev->wext.keys = NULL;
12291224 #endif
1230− cfg80211_cqm_config_free(wdev);
1225+ wiphy_work_cancel(wdev->wiphy, &wdev->cqm_rssi_work);
1226+ /* deleted from the list, so can't be found from nl80211 any more */
1227+ cqm_config = rcu_access_pointer(wdev->cqm_config);
1228+ kfree_rcu(cqm_config, rcu_head);
12311229
12321230 /*
12331231 * Ensure that all events have been processed and
@@ -1379,6 +1377,8 @@ void cfg80211_init_wdev(struct wireless_dev *wdev) · 145 unmodified lines
13791377 wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
13801378 #endif
13811379
1380+ wiphy_work_init(&wdev->cqm_rssi_work, cfg80211_cqm_rssi_notify_work);
1381+
13821382 if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
13831383 wdev->ps = true;
13841384 else
net/wireless/core.h+5−2
@@ -295,12 +295,17 @@ struct cfg80211_beacon_registration { · 294 unmodified lines
295295 };
296296
297297 struct cfg80211_cqm_config {
298+ struct rcu_head rcu_head;
298299 u32 rssi_hyst;
299300 s32 last_rssi_event_value;
301+ enum nl80211_cqm_rssi_threshold_event last_rssi_event_type;
300302 int n_rssi_thresholds;
301303 s32 rssi_thresholds[] __counted_by(n_rssi_thresholds);
302304 };
303305
306+void cfg80211_cqm_rssi_notify_work(struct wiphy *wiphy,
307+ struct wiphy_work *work);
308+
304309 void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev);
305310
306311 /* free object */
@@ -566,8 +571,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, · 259 unmodified lines
566571 #define CFG80211_DEV_WARN_ON(cond) ({bool __r = (cond); __r; })
567572 #endif
568573
569−void cfg80211_cqm_config_free(struct wireless_dev *wdev);
570−
571574 void cfg80211_release_pmsr(struct wireless_dev *wdev, u32 portid);
572575 void cfg80211_pmsr_wdev_down(struct wireless_dev *wdev);
573576 void cfg80211_pmsr_free_wk(struct work_struct *work);
net/wireless/mlme.c+2−1
@@ -52,7 +52,8 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, · 51 unmodified lines
5252 cr.links[link_id].bssid = data->links[link_id].bss->bssid;
5353 cr.links[link_id].addr = data->links[link_id].addr;
5454 /* need to have local link addresses for MLO connections */
55− WARN_ON(cr.ap_mld_addr && !cr.links[link_id].addr);
55+ WARN_ON(cr.ap_mld_addr &&
56+ !is_valid_ether_addr(cr.links[link_id].addr));
5657
5758 BUG_ON(!cr.links[link_id].bss->channel);
5859
net/wireless/nl80211.c+81−33
@@ -5909,6 +5909,21 @@ out: · 5908 unmodified lines
59095909 nlmsg_free(msg);
59105910 }
59115911
5912+static int nl80211_validate_ap_phy_operation(struct cfg80211_ap_settings *params)
5913+{
5914+ struct ieee80211_channel *channel = params->chandef.chan;
5915+
5916+ if ((params->he_cap || params->he_oper) &&
5917+ (channel->flags & IEEE80211_CHAN_NO_HE))
5918+ return -EOPNOTSUPP;
5919+
5920+ if ((params->eht_cap || params->eht_oper) &&
5921+ (channel->flags & IEEE80211_CHAN_NO_EHT))
5922+ return -EOPNOTSUPP;
5923+
5924+ return 0;
5925+}
5926+
59125927 static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
59135928 {
59145929 struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -6178,6 +6193,10 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · 263 unmodified lines
61786193 if (err)
61796194 goto out_unlock;
61806195
6196+ err = nl80211_validate_ap_phy_operation(params);
6197+ if (err)
6198+ goto out_unlock;
6199+
61816200 if (info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS])
61826201 params->flags = nla_get_u32(
61836202 info->attrs[NL80211_ATTR_AP_SETTINGS_FLAGS]);
@@ -8482,7 +8501,7 @@ static int nl80211_update_mesh_config(struct sk_buff *skb, · 2298 unmodified lines
84828501 struct cfg80211_registered_device *rdev = info->user_ptr[0];
84838502 struct net_device *dev = info->user_ptr[1];
84848503 struct wireless_dev *wdev = dev->ieee80211_ptr;
8485− struct mesh_config cfg;
8504+ struct mesh_config cfg = {};
84868505 u32 mask;
84878506 int err;
84888507
@@ -12796,7 +12815,8 @@ static int nl80211_set_cqm_txe(struct genl_info *info, · 4307 unmodified lines
1279612815 }
1279712816
1279812817 static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
12799− struct net_device *dev)
12818+ struct net_device *dev,
12819+ struct cfg80211_cqm_config *cqm_config)
1280012820 {
1280112821 struct wireless_dev *wdev = dev->ieee80211_ptr;
1280212822 s32 last, low, high;
@@ -12805,7 +12825,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 2 unmodified lines
1280512825 int err;
1280612826
1280712827 /* RSSI reporting disabled? */
12808− if (!wdev->cqm_config)
12828+ if (!cqm_config)
1280912829 return rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0);
1281012830
1281112831 /*
@@ -12814,7 +12834,7 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 2 unmodified lines
1281412834 * connection is established and enough beacons received to calculate
1281512835 * the average.
1281612836 */
12817− if (!wdev->cqm_config->last_rssi_event_value &&
12837+ if (!cqm_config->last_rssi_event_value &&
1281812838 wdev->links[0].client.current_bss &&
1281912839 rdev->ops->get_station) {
1282012840 struct station_info sinfo = {};
@@ -12828,30 +12848,30 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev, · 7 unmodified lines
1282812848
1282912849 cfg80211_sinfo_release_content(&sinfo);
1283012850 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_BEACON_SIGNAL_AVG))
12831− wdev->cqm_config->last_rssi_event_value =
12851+ cqm_config->last_rssi_event_value =
1283212852 (s8) sinfo.rx_beacon_signal_avg;
1283312853 }
1283412854
12835− last = wdev->cqm_config->last_rssi_event_value;
12836− hyst = wdev->cqm_config->rssi_hyst;
12837− n = wdev->cqm_config->n_rssi_thresholds;
12855+ last = cqm_config->last_rssi_event_value;
12856+ hyst = cqm_config->rssi_hyst;
12857+ n = cqm_config->n_rssi_thresholds;
1283812858
1283912859 for (i = 0; i < n; i++) {
1284012860 i = array_index_nospec(i, n);
12841− if (last < wdev->cqm_config->rssi_thresholds[i])
12861+ if (last < cqm_config->rssi_thresholds[i])
1284212862 break;
1284312863 }
1284412864
1284512865 low_index = i - 1;
1284612866 if (low_index >= 0) {
1284712867 low_index = array_index_nospec(low_index, n);
12848− low = wdev->cqm_config->rssi_thresholds[low_index] - hyst;
12868+ low = cqm_config->rssi_thresholds[low_index] - hyst;
1284912869 } else {
1285012870 low = S32_MIN;
1285112871 }
1285212872 if (i < n) {
1285312873 i = array_index_nospec(i, n);
12854− high = wdev->cqm_config->rssi_thresholds[i] + hyst - 1;
12874+ high = cqm_config->rssi_thresholds[i] + hyst - 1;
1285512875 } else {
1285612876 high = S32_MAX;
1285712877 }
@@ -12864,6 +12884,7 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 6 unmodified lines
1286412884 u32 hysteresis)
1286512885 {
1286612886 struct cfg80211_registered_device *rdev = info->user_ptr[0];
12887+ struct cfg80211_cqm_config *cqm_config = NULL, *old;
1286712888 struct net_device *dev = info->user_ptr[1];
1286812889 struct wireless_dev *wdev = dev->ieee80211_ptr;
1286912890 int i, err;
@@ -12881,10 +12902,6 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 11 unmodified lines
1288112902 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
1288212903 return -EOPNOTSUPP;
1288312904
12884− wdev_lock(wdev);
12885− cfg80211_cqm_config_free(wdev);
12886− wdev_unlock(wdev);
12887−
1288812905 if (n_thresholds <= 1 && rdev->ops->set_cqm_rssi_config) {
1288912906 if (n_thresholds == 0 || thresholds[0] == 0) /* Disabling */
1289012907 return rdev_set_cqm_rssi_config(rdev, dev, 0, 0);
@@ -12901,9 +12918,10 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 10 unmodified lines
1290112918 n_thresholds = 0;
1290212919
1290312920 wdev_lock(wdev);
12904− if (n_thresholds) {
12905− struct cfg80211_cqm_config *cqm_config;
12921+ old = rcu_dereference_protected(wdev->cqm_config,
12922+ lockdep_is_held(&wdev->mtx));
1290612923
12924+ if (n_thresholds) {
1290712925 cqm_config = kzalloc(struct_size(cqm_config, rssi_thresholds,
1290812926 n_thresholds),
1290912927 GFP_KERNEL);
@@ -12918,11 +12936,18 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, · 8 unmodified lines
1291812936 flex_array_size(cqm_config, rssi_thresholds,
1291912937 n_thresholds));
1292012938
12921− wdev->cqm_config = cqm_config;
12939+ rcu_assign_pointer(wdev->cqm_config, cqm_config);
12940+ } else {
12941+ RCU_INIT_POINTER(wdev->cqm_config, NULL);
1292212942 }
1292312943
12924− err = cfg80211_cqm_rssi_update(rdev, dev);
12925−
12944+ err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config);
12945+ if (err) {
12946+ rcu_assign_pointer(wdev->cqm_config, old);
12947+ kfree_rcu(cqm_config, rcu_head);
12948+ } else {
12949+ kfree_rcu(old, rcu_head);
12950+ }
1292612951 unlock:
1292712952 wdev_unlock(wdev);
1292812953
@@ -19073,9 +19098,8 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 6144 unmodified lines
1907319098 enum nl80211_cqm_rssi_threshold_event rssi_event,
1907419099 s32 rssi_level, gfp_t gfp)
1907519100 {
19076− struct sk_buff *msg;
1907719101 struct wireless_dev *wdev = dev->ieee80211_ptr;
19078− struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
19102+ struct cfg80211_cqm_config *cqm_config;
1907919103
1908019104 trace_cfg80211_cqm_rssi_notify(dev, rssi_event, rssi_level);
1908119105
@@ -19083,18 +19107,41 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 1 unmodified line
1908319107 rssi_event != NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH))
1908419108 return;
1908519109
19086− if (wdev->cqm_config) {
19087− wdev->cqm_config->last_rssi_event_value = rssi_level;
19110+ rcu_read_lock();
19111+ cqm_config = rcu_dereference(wdev->cqm_config);
19112+ if (cqm_config) {
19113+ cqm_config->last_rssi_event_value = rssi_level;
19114+ cqm_config->last_rssi_event_type = rssi_event;
19115+ wiphy_work_queue(wdev->wiphy, &wdev->cqm_rssi_work);
19116+ }
19117+ rcu_read_unlock();
19118+}
19119+EXPORT_SYMBOL(cfg80211_cqm_rssi_notify);
1908819120
19089− cfg80211_cqm_rssi_update(rdev, dev);
19121+void cfg80211_cqm_rssi_notify_work(struct wiphy *wiphy, struct wiphy_work *work)
19122+{
19123+ struct wireless_dev *wdev = container_of(work, struct wireless_dev,
19124+ cqm_rssi_work);
19125+ struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
19126+ enum nl80211_cqm_rssi_threshold_event rssi_event;
19127+ struct cfg80211_cqm_config *cqm_config;
19128+ struct sk_buff *msg;
19129+ s32 rssi_level;
1909019130
19091− if (rssi_level == 0)
19092− rssi_level = wdev->cqm_config->last_rssi_event_value;
19093− }
19131+ wdev_lock(wdev);
19132+ cqm_config = rcu_dereference_protected(wdev->cqm_config,
19133+ lockdep_is_held(&wdev->mtx));
19134+ if (!wdev->cqm_config)
19135+ goto unlock;
1909419136
19095− msg = cfg80211_prepare_cqm(dev, NULL, gfp);
19137+ cfg80211_cqm_rssi_update(rdev, wdev->netdev, cqm_config);
19138+
19139+ rssi_level = cqm_config->last_rssi_event_value;
19140+ rssi_event = cqm_config->last_rssi_event_type;
19141+
19142+ msg = cfg80211_prepare_cqm(wdev->netdev, NULL, GFP_KERNEL);
1909619143 if (!msg)
19097− return;
19144+ goto unlock;
1909819145
1909919146 if (nla_put_u32(msg, NL80211_ATTR_CQM_RSSI_THRESHOLD_EVENT,
1910019147 rssi_event))
@@ -19104,14 +19151,15 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, · 3 unmodified lines
1910419151 rssi_level))
1910519152 goto nla_put_failure;
1910619153
19107− cfg80211_send_cqm(msg, gfp);
19154+ cfg80211_send_cqm(msg, GFP_KERNEL);
1910819155
19109− return;
19156+ goto unlock;
1911019157
1911119158 nla_put_failure:
1911219159 nlmsg_free(msg);
19160+ unlock:
19161+ wdev_unlock(wdev);
1911319162 }
19114−EXPORT_SYMBOL(cfg80211_cqm_rssi_notify);
1911519163
1911619164 void cfg80211_cqm_txe_notify(struct net_device *dev,
1911719165 const u8 *peer, u32 num_packets,
net/wireless/scan.c+4−0
@@ -908,6 +908,10 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev) · 907 unmodified lines
908908 !cfg80211_find_ssid_match(ap, request))
909909 continue;
910910
911+ if (!is_broadcast_ether_addr(request->bssid) &&
912+ !ether_addr_equal(request->bssid, ap->bssid))
913+ continue;
914+
911915 if (!request->n_ssids && ap->multi_bss && !ap->transmitted_bssid)
912916 continue;
913917
net/xdp/xsk_queue.c+10−0
@@ -34,6 +34,16 @@ struct xsk_queue *xskq_create(u32 nentries, bool umem_queue) · 33 unmodified lines
3434 q->ring_mask = nentries - 1;
3535
3636 size = xskq_get_ring_size(q, umem_queue);
37+
38+ /* size which is overflowing or close to SIZE_MAX will become 0 in
39+ * PAGE_ALIGN(), checking SIZE_MAX is enough due to the previous
40+ * is_power_of_2(), the rest will be handled by vmalloc_user()
41+ */
42+ if (unlikely(size == SIZE_MAX)) {
43+ kfree(q);
44+ return NULL;
45+ }
46+
3747 size = PAGE_ALIGN(size);
3848
3949 q->ring = vmalloc_user(size);
security/integrity/ima/Kconfig+8−14
@@ -29,9 +29,11 @@ config IMA · 28 unmodified lines
2929 to learn more about IMA.
3030 If unsure, say N.
3131
32+if IMA
33+
3234 config IMA_KEXEC
3335 bool "Enable carrying the IMA measurement list across a soft boot"
34− depends on IMA && TCG_TPM && HAVE_IMA_KEXEC
36+ depends on TCG_TPM && HAVE_IMA_KEXEC
3537 default n
3638 help
3739 TPM PCRs are only reset on a hard reboot. In order to validate
@@ -43,7 +45,6 @@ config IMA_KEXEC · 5 unmodified lines
4345
4446 config IMA_MEASURE_PCR_IDX
4547 int
46− depends on IMA
4748 range 8 14
4849 default 10
4950 help
@@ -53,7 +54,7 @@ config IMA_MEASURE_PCR_IDX · 3 unmodified lines
5354
5455 config IMA_LSM_RULES
5556 bool
56− depends on IMA && AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR)
57+ depends on AUDIT && (SECURITY_SELINUX || SECURITY_SMACK || SECURITY_APPARMOR)
5758 default y
5859 help
5960 Disabling this option will disregard LSM based policy rules.
@@ -61,7 +62,6 @@ config IMA_LSM_RULES · 1 unmodified line
6162 choice
6263 prompt "Default template"
6364 default IMA_NG_TEMPLATE
64− depends on IMA
6565 help
6666 Select the default IMA measurement template.
6767
@@ -80,14 +80,12 @@ endchoice · 12 unmodified lines
8080
8181 config IMA_DEFAULT_TEMPLATE
8282 string
83− depends on IMA
8483 default "ima-ng" if IMA_NG_TEMPLATE
8584 default "ima-sig" if IMA_SIG_TEMPLATE
8685
8786 choice
8887 prompt "Default integrity hash algorithm"
8988 default IMA_DEFAULT_HASH_SHA1
90− depends on IMA
9189 help
9290 Select the default hash algorithm used for the measurement
9391 list, integrity appraisal and audit log. The compiled default
@@ -117,7 +115,6 @@ endchoice · 23 unmodified lines
117115
118116 config IMA_DEFAULT_HASH
119117 string
120− depends on IMA
121118 default "sha1" if IMA_DEFAULT_HASH_SHA1
122119 default "sha256" if IMA_DEFAULT_HASH_SHA256
123120 default "sha512" if IMA_DEFAULT_HASH_SHA512
@@ -126,7 +123,6 @@ config IMA_DEFAULT_HASH · 2 unmodified lines
126123
127124 config IMA_WRITE_POLICY
128125 bool "Enable multiple writes to the IMA policy"
129− depends on IMA
130126 default n
131127 help
132128 IMA policy can now be updated multiple times. The new rules get
@@ -137,7 +133,6 @@ config IMA_WRITE_POLICY · 4 unmodified lines
137133
138134 config IMA_READ_POLICY
139135 bool "Enable reading back the current IMA policy"
140− depends on IMA
141136 default y if IMA_WRITE_POLICY
142137 default n if !IMA_WRITE_POLICY
143138 help
@@ -147,7 +142,6 @@ config IMA_READ_POLICY · 3 unmodified lines
147142
148143 config IMA_APPRAISE
149144 bool "Appraise integrity measurements"
150− depends on IMA
151145 default n
152146 help
153147 This option enables local measurement integrity appraisal.
@@ -269,7 +263,7 @@ config IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY · 115 unmodified lines
269263 config IMA_BLACKLIST_KEYRING
270264 bool "Create IMA machine owner blacklist keyrings (EXPERIMENTAL)"
271265 depends on SYSTEM_TRUSTED_KEYRING
272− depends on IMA_TRUSTED_KEYRING
266+ depends on INTEGRITY_TRUSTED_KEYRING
273267 default n
274268 help
275269 This option creates an IMA blacklist keyring, which contains all
@@ -279,7 +273,7 @@ config IMA_BLACKLIST_KEYRING · 3 unmodified lines
279273
280274 config IMA_LOAD_X509
281275 bool "Load X509 certificate onto the '.ima' trusted keyring"
282− depends on IMA_TRUSTED_KEYRING
276+ depends on INTEGRITY_TRUSTED_KEYRING
283277 default n
284278 help
285279 File signature verification is based on the public keys
@@ -304,7 +298,6 @@ config IMA_APPRAISE_SIGNED_INIT · 18 unmodified lines
304298
305299 config IMA_MEASURE_ASYMMETRIC_KEYS
306300 bool
307− depends on IMA
308301 depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
309302 default y
310303
@@ -323,7 +316,8 @@ config IMA_SECURE_AND_OR_TRUSTED_BOOT · 12 unmodified lines
323316
324317 config IMA_DISABLE_HTABLE
325318 bool "Disable htable to allow measurement of duplicate records"
326− depends on IMA
327319 default n
328320 help
329321 This option disables htable to allow measurement of duplicate records.
322+
323+endif
security/keys/trusted-keys/trusted_core.c+5−8
@@ -44,13 +44,12 @@ static const struct trusted_key_source trusted_key_sources[] = { · 43 unmodified lines
4444 #endif
4545 };
4646
47−DEFINE_STATIC_CALL_NULL(trusted_key_init, *trusted_key_sources[0].ops->init);
4847 DEFINE_STATIC_CALL_NULL(trusted_key_seal, *trusted_key_sources[0].ops->seal);
4948 DEFINE_STATIC_CALL_NULL(trusted_key_unseal,
5049 *trusted_key_sources[0].ops->unseal);
5150 DEFINE_STATIC_CALL_NULL(trusted_key_get_random,
5251 *trusted_key_sources[0].ops->get_random);
53−DEFINE_STATIC_CALL_NULL(trusted_key_exit, *trusted_key_sources[0].ops->exit);
52+static void (*trusted_key_exit)(void);
5453 static unsigned char migratable;
5554
5655 enum {
@@ -359,19 +358,16 @@ static int __init init_trusted(void) · 302 unmodified lines
359358 if (!get_random)
360359 get_random = kernel_get_random;
361360
362− static_call_update(trusted_key_init,
363− trusted_key_sources[i].ops->init);
364361 static_call_update(trusted_key_seal,
365362 trusted_key_sources[i].ops->seal);
366363 static_call_update(trusted_key_unseal,
367364 trusted_key_sources[i].ops->unseal);
368365 static_call_update(trusted_key_get_random,
369366 get_random);
370− static_call_update(trusted_key_exit,
371− trusted_key_sources[i].ops->exit);
367+ trusted_key_exit = trusted_key_sources[i].ops->exit;
372368 migratable = trusted_key_sources[i].ops->migratable;
373369
374− ret = static_call(trusted_key_init)();
370+ ret = trusted_key_sources[i].ops->init();
375371 if (!ret)
376372 break;
377373 }
@@ -388,7 +384,8 @@ static int __init init_trusted(void) · 10 unmodified lines
388384
389385 static void __exit cleanup_trusted(void)
390386 {
391− static_call_cond(trusted_key_exit)();
387+ if (trusted_key_exit)
388+ (*trusted_key_exit)();
392389 }
393390
394391 late_initcall(init_trusted);
sound/pci/hda/cs35l41_hda.c+79−36
@@ -185,10 +185,14 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, · 184 unmodified lines
185185 cs35l41->speaker_id, "wmfw");
186186 if (!ret) {
187187 /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */
188− return cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
189− CS35L41_FIRMWARE_ROOT,
190− cs35l41->acpi_subsystem_id, cs35l41->amp_name,
191− cs35l41->speaker_id, "bin");
188+ ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
189+ CS35L41_FIRMWARE_ROOT,
190+ cs35l41->acpi_subsystem_id, cs35l41->amp_name,
191+ cs35l41->speaker_id, "bin");
192+ if (ret)
193+ goto coeff_err;
194+
195+ return 0;
192196 }
193197
194198 /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */
@@ -197,10 +201,14 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, · 2 unmodified lines
197201 cs35l41->amp_name, -1, "wmfw");
198202 if (!ret) {
199203 /* try cirrus/part-dspN-fwtype-sub<-spkidN><-ampname>.bin */
200− return cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
201− CS35L41_FIRMWARE_ROOT,
202− cs35l41->acpi_subsystem_id, cs35l41->amp_name,
203− cs35l41->speaker_id, "bin");
204+ ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
205+ CS35L41_FIRMWARE_ROOT,
206+ cs35l41->acpi_subsystem_id, cs35l41->amp_name,
207+ cs35l41->speaker_id, "bin");
208+ if (ret)
209+ goto coeff_err;
210+
211+ return 0;
204212 }
205213
206214 /* try cirrus/part-dspN-fwtype-sub<-spkidN>.wmfw */
@@ -215,10 +223,14 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, · 8 unmodified lines
215223 cs35l41->amp_name, cs35l41->speaker_id, "bin");
216224 if (ret)
217225 /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */
218− return cs35l41_request_firmware_file(cs35l41, coeff_firmware,
219− coeff_filename, CS35L41_FIRMWARE_ROOT,
220− cs35l41->acpi_subsystem_id, NULL,
221− cs35l41->speaker_id, "bin");
226+ ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware,
227+ coeff_filename, CS35L41_FIRMWARE_ROOT,
228+ cs35l41->acpi_subsystem_id, NULL,
229+ cs35l41->speaker_id, "bin");
230+ if (ret)
231+ goto coeff_err;
232+
233+ return 0;
222234 }
223235
224236 /* try cirrus/part-dspN-fwtype-sub.wmfw */
@@ -233,12 +245,50 @@ static int cs35l41_request_firmware_files_spkid(struct cs35l41_hda *cs35l41, · 8 unmodified lines
233245 cs35l41->speaker_id, "bin");
234246 if (ret)
235247 /* try cirrus/part-dspN-fwtype-sub<-spkidN>.bin */
236− return cs35l41_request_firmware_file(cs35l41, coeff_firmware,
237− coeff_filename, CS35L41_FIRMWARE_ROOT,
238− cs35l41->acpi_subsystem_id, NULL,
239− cs35l41->speaker_id, "bin");
248+ ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware,
249+ coeff_filename, CS35L41_FIRMWARE_ROOT,
250+ cs35l41->acpi_subsystem_id, NULL,
251+ cs35l41->speaker_id, "bin");
252+ if (ret)
253+ goto coeff_err;
254+ }
255+
256+ return ret;
257+coeff_err:
258+ release_firmware(*wmfw_firmware);
259+ kfree(*wmfw_filename);
260+ return ret;
261+}
262+
263+static int cs35l41_fallback_firmware_file(struct cs35l41_hda *cs35l41,
264+ const struct firmware **wmfw_firmware,
265+ char **wmfw_filename,
266+ const struct firmware **coeff_firmware,
267+ char **coeff_filename)
268+{
269+ int ret;
270+
271+ /* Handle fallback */
272+ dev_warn(cs35l41->dev, "Falling back to default firmware.\n");
273+
274+ /* fallback try cirrus/part-dspN-fwtype.wmfw */
275+ ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename,
276+ CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw");
277+ if (ret)
278+ goto err;
279+
280+ /* fallback try cirrus/part-dspN-fwtype.bin */
281+ ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
282+ CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin");
283+ if (ret) {
284+ release_firmware(*wmfw_firmware);
285+ kfree(*wmfw_filename);
286+ goto err;
240287 }
288+ return 0;
241289
290+err:
291+ dev_warn(cs35l41->dev, "Unable to find firmware and tuning\n");
242292 return ret;
243293 }
244294
@@ -254,7 +304,6 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, · 9 unmodified lines
254304 ret = cs35l41_request_firmware_files_spkid(cs35l41, wmfw_firmware, wmfw_filename,
255305 coeff_firmware, coeff_filename);
256306 goto out;
257−
258307 }
259308
260309 /* try cirrus/part-dspN-fwtype-sub<-ampname>.wmfw */
@@ -267,6 +316,9 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, · 6 unmodified lines
267316 CS35L41_FIRMWARE_ROOT,
268317 cs35l41->acpi_subsystem_id, cs35l41->amp_name,
269318 -1, "bin");
319+ if (ret)
320+ goto coeff_err;
321+
270322 goto out;
271323 }
272324
@@ -286,32 +338,23 @@ static int cs35l41_request_firmware_files(struct cs35l41_hda *cs35l41, · 13 unmodified lines
286338 CS35L41_FIRMWARE_ROOT,
287339 cs35l41->acpi_subsystem_id, NULL, -1,
288340 "bin");
341+ if (ret)
342+ goto coeff_err;
289343 }
290344
291345 out:
292− if (!ret)
293− return 0;
346+ if (ret)
347+ /* if all attempts at finding firmware fail, try fallback */
348+ goto fallback;
294349
295− /* Handle fallback */
296− dev_warn(cs35l41->dev, "Falling back to default firmware.\n");
350+ return 0;
297351
352+coeff_err:
298353 release_firmware(*wmfw_firmware);
299354 kfree(*wmfw_filename);
300−
301− /* fallback try cirrus/part-dspN-fwtype.wmfw */
302− ret = cs35l41_request_firmware_file(cs35l41, wmfw_firmware, wmfw_filename,
303− CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "wmfw");
304− if (!ret)
305− /* fallback try cirrus/part-dspN-fwtype.bin */
306− ret = cs35l41_request_firmware_file(cs35l41, coeff_firmware, coeff_filename,
307− CS35L41_FIRMWARE_ROOT, NULL, NULL, -1, "bin");
308−
309− if (ret) {
310− release_firmware(*wmfw_firmware);
311− kfree(*wmfw_filename);
312− dev_warn(cs35l41->dev, "Unable to find firmware and tuning\n");
313− }
314− return ret;
355+fallback:
356+ return cs35l41_fallback_firmware_file(cs35l41, wmfw_firmware, wmfw_filename,
357+ coeff_firmware, coeff_filename);
315358 }
316359
317360 #if IS_ENABLED(CONFIG_EFI)
sound/pci/hda/patch_realtek.c+17−10
@@ -7343,6 +7343,7 @@ enum { · 7342 unmodified lines
73437343 ALC245_FIXUP_HP_MUTE_LED_COEFBIT,
73447344 ALC245_FIXUP_HP_X360_MUTE_LEDS,
73457345 ALC287_FIXUP_THINKPAD_I2S_SPK,
7346+ ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD,
73467347 };
73477348
73487349 /* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -9441,6 +9442,12 @@ static const struct hda_fixup alc269_fixups[] = { · 2092 unmodified lines
94419442 .type = HDA_FIXUP_FUNC,
94429443 .v.func = alc287_fixup_bind_dacs,
94439444 },
9445+ [ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD] = {
9446+ .type = HDA_FIXUP_FUNC,
9447+ .v.func = alc287_fixup_bind_dacs,
9448+ .chained = true,
9449+ .chain_id = ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI,
9450+ },
94449451 };
94459452
94469453 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -9854,7 +9861,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 407 unmodified lines
98549861 SND_PCI_QUIRK(0x10ec, 0x124c, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
98559862 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
98569863 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9857− SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC225_FIXUP_HEADSET_JACK),
9864+ SND_PCI_QUIRK(0x10ec, 0x12cc, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
98589865 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
98599866 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
98609867 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
@@ -9988,14 +9995,14 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 127 unmodified lines
99889995 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
99899996 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
99909997 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9991− SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9992− SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9993− SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9994− SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9995− SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9996− SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9997− SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9998− SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_CS35L41_I2C_2_THINKPAD_ACPI),
9998+ SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
9999+ SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10000+ SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10001+ SND_PCI_QUIRK(0x17aa, 0x2316, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10002+ SND_PCI_QUIRK(0x17aa, 0x2317, "Thinkpad P1 Gen 6", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10003+ SND_PCI_QUIRK(0x17aa, 0x2318, "Thinkpad Z13 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10004+ SND_PCI_QUIRK(0x17aa, 0x2319, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
10005+ SND_PCI_QUIRK(0x17aa, 0x231a, "Thinkpad Z16 Gen2", ALC287_FIXUP_MG_RTKC_CSAMP_CS35L41_I2C_THINKPAD),
999910006 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
1000010007 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
1000110008 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
@@ -10091,7 +10098,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 89 unmodified lines
1009110098 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
1009210099 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
1009310100 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
10094− SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC225_FIXUP_HEADSET_JACK),
10101+ SND_PCI_QUIRK(0x8086, 0x3038, "Intel NUC 13", ALC295_FIXUP_CHROME_BOOK),
1009510102 SND_PCI_QUIRK(0xf111, 0x0001, "Framework Laptop", ALC295_FIXUP_FRAMEWORK_LAPTOP_MIC_NO_PRESENCE),
1009610103
1009710104 #if 0
sound/soc/amd/yc/acp6x-mach.c+7−0
@@ -241,6 +241,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { · 240 unmodified lines
241241 DMI_MATCH(DMI_PRODUCT_NAME, "82V2"),
242242 }
243243 },
244+ {
245+ .driver_data = &acp6x_card,
246+ .matches = {
247+ DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
248+ DMI_MATCH(DMI_PRODUCT_NAME, "82YM"),
249+ }
250+ },
244251 {
245252 .driver_data = &acp6x_card,
246253 .matches = {
sound/soc/codecs/hdmi-codec.c+4−1
@@ -531,7 +531,10 @@ static int hdmi_codec_fill_codec_params(struct snd_soc_dai *dai, · 530 unmodified lines
531531 hp->sample_rate = sample_rate;
532532 hp->channels = channels;
533533
534− hcp->chmap_idx = idx;
534+ if (pcm_audio)
535+ hcp->chmap_idx = ca_id;
536+ else
537+ hcp->chmap_idx = HDMI_CODEC_CHMAP_IDX_UNKNOWN;
535538
536539 return 0;
537540 }
sound/soc/codecs/rt5682-i2c.c+5−5
@@ -157,11 +157,6 @@ static int rt5682_i2c_probe(struct i2c_client *i2c) · 156 unmodified lines
157157 return ret;
158158 }
159159
160− ret = devm_add_action_or_reset(&i2c->dev, rt5682_i2c_disable_regulators,
161− rt5682);
162− if (ret)
163− return ret;
164−
165160 ret = regulator_bulk_enable(ARRAY_SIZE(rt5682->supplies),
166161 rt5682->supplies);
167162 if (ret) {
@@ -169,6 +164,11 @@ static int rt5682_i2c_probe(struct i2c_client *i2c) · 1 unmodified line
169164 return ret;
170165 }
171166
167+ ret = devm_add_action_or_reset(&i2c->dev, rt5682_i2c_disable_regulators,
168+ rt5682);
169+ if (ret)
170+ return ret;
171+
172172 ret = rt5682_get_ldo1(rt5682, &i2c->dev);
173173 if (ret)
174174 return ret;
sound/soc/codecs/tlv320adc3xxx.c+2−2
@@ -293,7 +293,7 @@ · 292 unmodified lines
293293 #define ADC3XXX_BYPASS_RPGA 0x80
294294
295295 /* MICBIAS control bits */
296−#define ADC3XXX_MICBIAS_MASK 0x2
296+#define ADC3XXX_MICBIAS_MASK 0x3
297297 #define ADC3XXX_MICBIAS1_SHIFT 5
298298 #define ADC3XXX_MICBIAS2_SHIFT 3
299299
@@ -1099,7 +1099,7 @@ static int adc3xxx_parse_dt_micbias(struct adc3xxx *adc3xxx, · 799 unmodified lines
10991099 unsigned int val;
11001100
11011101 if (!of_property_read_u32(np, propname, &val)) {
1102− if (val >= ADC3XXX_MICBIAS_AVDD) {
1102+ if (val > ADC3XXX_MICBIAS_AVDD) {
11031103 dev_err(dev, "Invalid property value for '%s'\n", propname);
11041104 return -EINVAL;
11051105 }
sound/soc/fsl/fsl-asoc-card.c+8−4
@@ -52,8 +52,8 @@ struct codec_priv { · 51 unmodified lines
5252 unsigned long mclk_freq;
5353 unsigned long free_freq;
5454 u32 mclk_id;
55− u32 fll_id;
56− u32 pll_id;
55+ int fll_id;
56+ int pll_id;
5757 };
5858
5959 /**
@@ -206,7 +206,7 @@ static int fsl_asoc_card_hw_params(struct snd_pcm_substream *substream, · 146 unmodified lines
206206 }
207207
208208 /* Specific configuration for PLL */
209− if (codec_priv->pll_id && codec_priv->fll_id) {
209+ if (codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
210210 if (priv->sample_format == SNDRV_PCM_FORMAT_S24_LE)
211211 pll_out = priv->sample_rate * 384;
212212 else
@@ -248,7 +248,7 @@ static int fsl_asoc_card_hw_free(struct snd_pcm_substream *substream) · 35 unmodified lines
248248
249249 priv->streams &= ~BIT(substream->stream);
250250
251− if (!priv->streams && codec_priv->pll_id && codec_priv->fll_id) {
251+ if (!priv->streams && codec_priv->pll_id >= 0 && codec_priv->fll_id >= 0) {
252252 /* Force freq to be free_freq to avoid error message in codec */
253253 ret = snd_soc_dai_set_sysclk(asoc_rtd_to_codec(rtd, 0),
254254 codec_priv->mclk_id,
@@ -621,6 +621,10 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) · 366 unmodified lines
621621 priv->card.dapm_routes = audio_map;
622622 priv->card.num_dapm_routes = ARRAY_SIZE(audio_map);
623623 priv->card.driver_name = DRIVER_NAME;
624+
625+ priv->codec_priv.fll_id = -1;
626+ priv->codec_priv.pll_id = -1;
627+
624628 /* Diversify the card configurations */
625629 if (of_device_is_compatible(np, "fsl,imx-audio-cs42888")) {
626630 codec_dai_name = "cs42888";
sound/soc/fsl/fsl_sai.c+7−2
@@ -710,10 +710,15 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir) · 709 unmodified lines
710710 {
711711 unsigned int ofs = sai->soc_data->reg_offset;
712712 bool tx = dir == TX;
713− u32 xcsr, count = 100;
713+ u32 xcsr, count = 100, mask;
714+
715+ if (sai->soc_data->mclk_with_tere && sai->mclk_direction_output)
716+ mask = FSL_SAI_CSR_TERE;
717+ else
718+ mask = FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE;
714719
715720 regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),
716− FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE, 0);
721+ mask, 0);
717722
718723 /* TERE will remain set till the end of current frame */
719724 do {
sound/soc/generic/simple-card-utils.c+2−1
@@ -310,7 +310,8 @@ int asoc_simple_startup(struct snd_pcm_substream *substream) · 309 unmodified lines
310310 if (fixed_sysclk % props->mclk_fs) {
311311 dev_err(rtd->dev, "fixed sysclk %u not divisible by mclk_fs %u\n",
312312 fixed_sysclk, props->mclk_fs);
313− return -EINVAL;
313+ ret = -EINVAL;
314+ goto codec_err;
314315 }
315316 ret = snd_pcm_hw_constraint_minmax(substream->runtime, SNDRV_PCM_HW_PARAM_RATE,
316317 fixed_rate, fixed_rate);
sound/soc/generic/simple-card.c+4−2
@@ -759,10 +759,12 @@ static int asoc_simple_probe(struct platform_device *pdev) · 758 unmodified lines
759759 struct snd_soc_dai_link *dai_link = priv->dai_link;
760760 struct simple_dai_props *dai_props = priv->dai_props;
761761
762+ ret = -EINVAL;
763+
762764 cinfo = dev->platform_data;
763765 if (!cinfo) {
764766 dev_err(dev, "no info for asoc-simple-card\n");
765− return -EINVAL;
767+ goto err;
766768 }
767769
768770 if (!cinfo->name ||
@@ -771,7 +773,7 @@ static int asoc_simple_probe(struct platform_device *pdev) · 2 unmodified lines
771773 !cinfo->platform ||
772774 !cinfo->cpu_dai.name) {
773775 dev_err(dev, "insufficient asoc_simple_card_info settings\n");
774− return -EINVAL;
776+ goto err;
775777 }
776778
777779 cpus = dai_link->cpus;
sound/soc/intel/boards/sof_es8336.c+10−0
@@ -808,6 +808,16 @@ static const struct platform_device_id board_ids[] = { · 807 unmodified lines
808808 SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK |
809809 SOF_ES8336_JD_INVERTED),
810810 },
811+ {
812+ .name = "mtl_es83x6_c1_h02",
813+ .driver_data = (kernel_ulong_t)(SOF_ES8336_SSP_CODEC(1) |
814+ SOF_NO_OF_HDMI_CAPTURE_SSP(2) |
815+ SOF_HDMI_CAPTURE_1_SSP(0) |
816+ SOF_HDMI_CAPTURE_2_SSP(2) |
817+ SOF_SSP_HDMI_CAPTURE_PRESENT |
818+ SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK |
819+ SOF_ES8336_JD_INVERTED),
820+ },
811821 { }
812822 };
813823 MODULE_DEVICE_TABLE(platform, board_ids);
sound/soc/intel/boards/sof_sdw.c+10−0
@@ -376,6 +376,16 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { · 375 unmodified lines
376376 /* No Jack */
377377 .driver_data = (void *)SOF_SDW_TGL_HDMI,
378378 },
379+ {
380+ .callback = sof_sdw_quirk_cb,
381+ .matches = {
382+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
383+ DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0B14"),
384+ },
385+ /* No Jack */
386+ .driver_data = (void *)SOF_SDW_TGL_HDMI,
387+ },
388+
379389 {
380390 .callback = sof_sdw_quirk_cb,
381391 .matches = {
sound/soc/intel/common/soc-acpi-intel-adl-match.c+6−6
@@ -655,18 +655,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = { · 654 unmodified lines
655655 .drv_name = "sof_sdw",
656656 .sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg",
657657 },
658− {
659− .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
660− .links = adl_sdw_rt1316_link1_rt714_link0,
661− .drv_name = "sof_sdw",
662− .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
663− },
664658 {
665659 .link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
666660 .links = adl_sdw_rt1316_link12_rt714_link0,
667661 .drv_name = "sof_sdw",
668662 .sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg",
669663 },
664+ {
665+ .link_mask = 0x3, /* rt1316 on link1 & rt714 on link0 */
666+ .links = adl_sdw_rt1316_link1_rt714_link0,
667+ .drv_name = "sof_sdw",
668+ .sof_tplg_filename = "sof-adl-rt1316-l1-mono-rt714-l0.tplg",
669+ },
670670 {
671671 .link_mask = 0x5, /* 2 active links required */
672672 .links = adl_sdw_rt1316_link2_rt714_link0,
sound/soc/intel/common/soc-acpi-intel-mtl-match.c+25−0
@@ -30,6 +30,16 @@ static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = { · 29 unmodified lines
3030 .codecs = {"10EC5682", "RTL5682"},
3131 };
3232
33+static const struct snd_soc_acpi_codecs mtl_essx_83x6 = {
34+ .num_codecs = 3,
35+ .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
36+};
37+
38+static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = {
39+ .num_codecs = 1,
40+ .codecs = {"INTC10B0"}
41+};
42+
3343 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
3444 {
3545 .comp_ids = &mtl_rt5682_rt5682s_hp,
@@ -52,6 +62,21 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = { · 16 unmodified lines
5262 .quirk_data = &mtl_rt1019p_amp,
5363 .sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg",
5464 },
65+ {
66+ .comp_ids = &mtl_essx_83x6,
67+ .drv_name = "mtl_es83x6_c1_h02",
68+ .machine_quirk = snd_soc_acpi_codec_list,
69+ .quirk_data = &mtl_lt6911_hdmi,
70+ .sof_tplg_filename = "sof-mtl-es83x6-ssp1-hdmi-ssp02.tplg",
71+ },
72+ {
73+ .comp_ids = &mtl_essx_83x6,
74+ .drv_name = "sof-essx8336",
75+ .sof_tplg_filename = "sof-mtl-es8336", /* the tplg suffix is added at run time */
76+ .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
77+ SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
78+ SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
79+ },
5580 {},
5681 };
5782 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines);
sound/soc/soc-core.c+17−7
@@ -1347,7 +1347,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, · 1346 unmodified lines
13471347 snd_soc_runtime_get_dai_fmt(rtd);
13481348 ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt);
13491349 if (ret)
1350− return ret;
1350+ goto err;
13511351
13521352 /* add DPCM sysfs entries */
13531353 soc_dpcm_debugfs_add(rtd);
@@ -1372,17 +1372,26 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, · 18 unmodified lines
13721372 /* create compress_device if possible */
13731373 ret = snd_soc_dai_compress_new(cpu_dai, rtd, num);
13741374 if (ret != -ENOTSUPP)
1375− return ret;
1375+ goto err;
13761376
13771377 /* create the pcm */
13781378 ret = soc_new_pcm(rtd, num);
13791379 if (ret < 0) {
13801380 dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
13811381 dai_link->stream_name, ret);
1382− return ret;
1382+ goto err;
13831383 }
13841384
1385− return snd_soc_pcm_dai_new(rtd);
1385+ ret = snd_soc_pcm_dai_new(rtd);
1386+ if (ret < 0)
1387+ goto err;
1388+
1389+ rtd->initialized = true;
1390+
1391+ return 0;
1392+err:
1393+ snd_soc_link_exit(rtd);
1394+ return ret;
13861395 }
13871396
13881397 static void soc_set_name_prefix(struct snd_soc_card *card,
@@ -1445,8 +1454,8 @@ static int soc_probe_component(struct snd_soc_card *card, · 56 unmodified lines
14451454 if (component->card) {
14461455 if (component->card != card) {
14471456 dev_err(component->dev,
1448− "Trying to bind component to card \"%s\" but is already bound to card \"%s\"\n",
1449− card->name, component->card->name);
1457+ "Trying to bind component \"%s\" to card \"%s\" but is already bound to card \"%s\"\n",
1458+ component->name, card->name, component->card->name);
14501459 return -ENODEV;
14511460 }
14521461 return 0;
@@ -1980,7 +1989,8 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card) · 527 unmodified lines
19801989
19811990 /* release machine specific resources */
19821991 for_each_card_rtds(card, rtd)
1983− snd_soc_link_exit(rtd);
1992+ if (rtd->initialized)
1993+ snd_soc_link_exit(rtd);
19841994 /* remove and free each DAI */
19851995 soc_remove_link_dais(card);
19861996 soc_remove_link_components(card);
sound/soc/soc-generic-dmaengine-pcm.c+2−2
@@ -44,8 +44,8 @@ static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm, · 43 unmodified lines
4444 * platforms which make use of the snd_dmaengine_dai_dma_data struct for their
4545 * DAI DMA data. Internally the function will first call
4646 * snd_hwparams_to_dma_slave_config to fill in the slave config based on the
47− * hw_params, followed by snd_dmaengine_set_config_from_dai_data to fill in the
48− * remaining fields based on the DAI DMA data.
47+ * hw_params, followed by snd_dmaengine_pcm_set_config_from_dai_data to fill in
48+ * the remaining fields based on the DAI DMA data.
4949 */
5050 int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
5151 struct snd_pcm_hw_params *params, struct dma_slave_config *slave_config)
sound/soc/sof/amd/pci-rmb.c+0−1
@@ -35,7 +35,6 @@ static const struct sof_amd_acp_desc rembrandt_chip_info = { · 34 unmodified lines
3535 .dsp_intr_base = ACP6X_DSP_SW_INTR_BASE,
3636 .sram_pte_offset = ACP6X_SRAM_PTE_OFFSET,
3737 .hw_semaphore_offset = ACP6X_AXI2DAGB_SEM_0,
38− .acp_clkmux_sel = ACP6X_CLKMUX_SEL,
3938 .fusion_dsp_offset = ACP6X_DSP_FUSION_RUNSTALL,
4039 .probe_reg_offset = ACP6X_FUTURE_REG_ACLK_0,
4140 };
sound/soc/ti/ams-delta.c+2−2
@@ -336,8 +336,8 @@ static void cx81801_hangup(struct tty_struct *tty) · 335 unmodified lines
336336 }
337337
338338 /* Line discipline .receive_buf() */
339−static void cx81801_receive(struct tty_struct *tty, const u8 *cp,
340− const char *fp, int count)
339+static void cx81801_receive(struct tty_struct *tty, const u8 *cp, const u8 *fp,
340+ size_t count)
341341 {
342342 struct snd_soc_component *component = tty->disc_data;
343343 const unsigned char *c;
sound/usb/mixer.c+7−0
@@ -1204,6 +1204,13 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, · 1203 unmodified lines
12041204 cval->res = 16;
12051205 }
12061206 break;
1207+ case USB_ID(0x1bcf, 0x2283): /* NexiGo N930AF FHD Webcam */
1208+ if (!strcmp(kctl->id.name, "Mic Capture Volume")) {
1209+ usb_audio_info(chip,
1210+ "set resolution quirk: cval->res = 16\n");
1211+ cval->res = 16;
1212+ }
1213+ break;
12071214 }
12081215 }
12091216
sound/usb/quirks.c+7−1
@@ -1994,7 +1994,11 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip, · 1993 unmodified lines
19941994 /* mic works only when ep packet size is set to wMaxPacketSize */
19951995 fp->attributes |= UAC_EP_CS_ATTR_FILL_MAX;
19961996 break;
1997−
1997+ case USB_ID(0x3511, 0x2b1e): /* Opencomm2 UC USB Bluetooth dongle */
1998+ /* mic works only when ep pitch control is not set */
1999+ if (stream == SNDRV_PCM_STREAM_CAPTURE)
2000+ fp->attributes &= ~UAC_EP_CS_ATTR_PITCH_CONTROL;
2001+ break;
19982002 }
19992003 }
20002004
@@ -2173,6 +2177,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { · 172 unmodified lines
21732177 QUIRK_FLAG_FIXED_RATE),
21742178 DEVICE_FLG(0x0ecb, 0x2069, /* JBL Quantum810 Wireless */
21752179 QUIRK_FLAG_FIXED_RATE),
2180+ DEVICE_FLG(0x1bcf, 0x2283, /* NexiGo N930AF FHD Webcam */
2181+ QUIRK_FLAG_GET_SAMPLE_RATE),
21762182
21772183 /* Vendor matches */
21782184 VENDOR_FLG(0x045e, /* MS Lifecam */
tools/hv/hv_kvp_daemon.c+202−31
@@ -1171,12 +1171,79 @@ static int process_ip_string(FILE *f, char *ip_string, int type) · 1170 unmodified lines
11711171 return 0;
11721172 }
11731173
1174+/*
1175+ * Only IPv4 subnet strings needs to be converted to plen
1176+ * For IPv6 the subnet is already privided in plen format
1177+ */
1178+static int kvp_subnet_to_plen(char *subnet_addr_str)
1179+{
1180+ int plen = 0;
1181+ struct in_addr subnet_addr4;
1182+
1183+ /*
1184+ * Convert subnet address to binary representation
1185+ */
1186+ if (inet_pton(AF_INET, subnet_addr_str, &subnet_addr4) == 1) {
1187+ uint32_t subnet_mask = ntohl(subnet_addr4.s_addr);
1188+
1189+ while (subnet_mask & 0x80000000) {
1190+ plen++;
1191+ subnet_mask <<= 1;
1192+ }
1193+ } else {
1194+ return -1;
1195+ }
1196+
1197+ return plen;
1198+}
1199+
1200+static int process_ip_string_nm(FILE *f, char *ip_string, char *subnet,
1201+ int is_ipv6)
1202+{
1203+ char addr[INET6_ADDRSTRLEN];
1204+ char subnet_addr[INET6_ADDRSTRLEN];
1205+ int error, i = 0;
1206+ int ip_offset = 0, subnet_offset = 0;
1207+ int plen;
1208+
1209+ memset(addr, 0, sizeof(addr));
1210+ memset(subnet_addr, 0, sizeof(subnet_addr));
1211+
1212+ while (parse_ip_val_buffer(ip_string, &ip_offset, addr,
1213+ (MAX_IP_ADDR_SIZE * 2)) &&
1214+ parse_ip_val_buffer(subnet,
1215+ &subnet_offset,
1216+ subnet_addr,
1217+ (MAX_IP_ADDR_SIZE *
1218+ 2))) {
1219+ if (!is_ipv6)
1220+ plen = kvp_subnet_to_plen((char *)subnet_addr);
1221+ else
1222+ plen = atoi(subnet_addr);
1223+
1224+ if (plen < 0)
1225+ return plen;
1226+
1227+ error = fprintf(f, "address%d=%s/%d\n", ++i, (char *)addr,
1228+ plen);
1229+ if (error < 0)
1230+ return error;
1231+
1232+ memset(addr, 0, sizeof(addr));
1233+ memset(subnet_addr, 0, sizeof(subnet_addr));
1234+ }
1235+
1236+ return 0;
1237+}
1238+
11741239 static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val)
11751240 {
11761241 int error = 0;
1177− char if_file[PATH_MAX];
1178− FILE *file;
1242+ char if_filename[PATH_MAX];
1243+ char nm_filename[PATH_MAX];
1244+ FILE *ifcfg_file, *nmfile;
11791245 char cmd[PATH_MAX];
1246+ int is_ipv6 = 0;
11801247 char *mac_addr;
11811248 int str_len;
11821249
@@ -1197,7 +1264,7 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) · 14 unmodified lines
11971264 * in a given distro to configure the interface and so are free
11981265 * ignore information that may not be relevant.
11991266 *
1200− * Here is the format of the ip configuration file:
1267+ * Here is the ifcfg format of the ip configuration file:
12011268 *
12021269 * HWADDR=macaddr
12031270 * DEVICE=interface name
@@ -1220,6 +1287,32 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) · 16 unmodified lines
12201287 * tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
12211288 * IPV6NETMASK.
12221289 *
1290+ * Here is the keyfile format of the ip configuration file:
1291+ *
1292+ * [ethernet]
1293+ * mac-address=macaddr
1294+ * [connection]
1295+ * interface-name=interface name
1296+ *
1297+ * [ipv4]
1298+ * method=<protocol> (where <protocol> is "auto" if DHCP is configured
1299+ * or "manual" if no boot-time protocol should be used)
1300+ *
1301+ * address1=ipaddr1/plen
1302+ * address2=ipaddr2/plen
1303+ *
1304+ * gateway=gateway1;gateway2
1305+ *
1306+ * dns=dns1;dns2
1307+ *
1308+ * [ipv6]
1309+ * address1=ipaddr1/plen
1310+ * address2=ipaddr2/plen
1311+ *
1312+ * gateway=gateway1;gateway2
1313+ *
1314+ * dns=dns1;dns2
1315+ *
12231316 * The host can specify multiple ipv4 and ipv6 addresses to be
12241317 * configured for the interface. Furthermore, the configuration
12251318 * needs to be persistent. A subsequent GET call on the interface
@@ -1227,14 +1320,29 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) · 1 unmodified line
12271320 * call.
12281321 */
12291322
1230− snprintf(if_file, sizeof(if_file), "%s%s%s", KVP_CONFIG_LOC,
1231− "/ifcfg-", if_name);
1323+ /*
1324+ * We are populating both ifcfg and nmconnection files
1325+ */
1326+ snprintf(if_filename, sizeof(if_filename), "%s%s%s", KVP_CONFIG_LOC,
1327+ "/ifcfg-", if_name);
12321328
1233− file = fopen(if_file, "w");
1329+ ifcfg_file = fopen(if_filename, "w");
12341330
1235− if (file == NULL) {
1331+ if (!ifcfg_file) {
12361332 syslog(LOG_ERR, "Failed to open config file; error: %d %s",
1237− errno, strerror(errno));
1333+ errno, strerror(errno));
1334+ return HV_E_FAIL;
1335+ }
1336+
1337+ snprintf(nm_filename, sizeof(nm_filename), "%s%s%s%s", KVP_CONFIG_LOC,
1338+ "/", if_name, ".nmconnection");
1339+
1340+ nmfile = fopen(nm_filename, "w");
1341+
1342+ if (!nmfile) {
1343+ syslog(LOG_ERR, "Failed to open config file; error: %d %s",
1344+ errno, strerror(errno));
1345+ fclose(ifcfg_file);
12381346 return HV_E_FAIL;
12391347 }
12401348
@@ -1248,14 +1356,31 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) · 7 unmodified lines
12481356 goto setval_error;
12491357 }
12501358
1251− error = kvp_write_file(file, "HWADDR", "", mac_addr);
1252− free(mac_addr);
1359+ error = kvp_write_file(ifcfg_file, "HWADDR", "", mac_addr);
1360+ if (error < 0)
1361+ goto setmac_error;
1362+
1363+ error = kvp_write_file(ifcfg_file, "DEVICE", "", if_name);
1364+ if (error < 0)
1365+ goto setmac_error;
1366+
1367+ error = fprintf(nmfile, "\n[connection]\n");
1368+ if (error < 0)
1369+ goto setmac_error;
1370+
1371+ error = kvp_write_file(nmfile, "interface-name", "", if_name);
12531372 if (error)
1254− goto setval_error;
1373+ goto setmac_error;
12551374
1256− error = kvp_write_file(file, "DEVICE", "", if_name);
1375+ error = fprintf(nmfile, "\n[ethernet]\n");
1376+ if (error < 0)
1377+ goto setmac_error;
1378+
1379+ error = kvp_write_file(nmfile, "mac-address", "", mac_addr);
12571380 if (error)
1258− goto setval_error;
1381+ goto setmac_error;
1382+
1383+ free(mac_addr);
12591384
12601385 /*
12611386 * The dhcp_enabled flag is only for IPv4. In the case the host only
@@ -1263,47 +1388,91 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) · 1 unmodified line
12631388 * proceed to parse and pass the IPv6 information to the
12641389 * disto-specific script hv_set_ifconfig.
12651390 */
1391+
1392+ /*
1393+ * First populate the ifcfg file format
1394+ */
12661395 if (new_val->dhcp_enabled) {
1267− error = kvp_write_file(file, "BOOTPROTO", "", "dhcp");
1396+ error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "dhcp");
12681397 if (error)
12691398 goto setval_error;
1270−
12711399 } else {
1272− error = kvp_write_file(file, "BOOTPROTO", "", "none");
1400+ error = kvp_write_file(ifcfg_file, "BOOTPROTO", "", "none");
12731401 if (error)
12741402 goto setval_error;
12751403 }
12761404
1277− /*
1278− * Write the configuration for ipaddress, netmask, gateway and
1279− * name servers.
1280− */
1281−
1282− error = process_ip_string(file, (char *)new_val->ip_addr, IPADDR);
1405+ error = process_ip_string(ifcfg_file, (char *)new_val->ip_addr,
1406+ IPADDR);
12831407 if (error)
12841408 goto setval_error;
12851409
1286− error = process_ip_string(file, (char *)new_val->sub_net, NETMASK);
1410+ error = process_ip_string(ifcfg_file, (char *)new_val->sub_net,
1411+ NETMASK);
12871412 if (error)
12881413 goto setval_error;
12891414
1290− error = process_ip_string(file, (char *)new_val->gate_way, GATEWAY);
1415+ error = process_ip_string(ifcfg_file, (char *)new_val->gate_way,
1416+ GATEWAY);
12911417 if (error)
12921418 goto setval_error;
12931419
1294− error = process_ip_string(file, (char *)new_val->dns_addr, DNS);
1420+ error = process_ip_string(ifcfg_file, (char *)new_val->dns_addr, DNS);
12951421 if (error)
12961422 goto setval_error;
12971423
1298− fclose(file);
1424+ if (new_val->addr_family == ADDR_FAMILY_IPV6) {
1425+ error = fprintf(nmfile, "\n[ipv6]\n");
1426+ if (error < 0)
1427+ goto setval_error;
1428+ is_ipv6 = 1;
1429+ } else {
1430+ error = fprintf(nmfile, "\n[ipv4]\n");
1431+ if (error < 0)
1432+ goto setval_error;
1433+ }
1434+
1435+ /*
1436+ * Now we populate the keyfile format
1437+ */
1438+
1439+ if (new_val->dhcp_enabled) {
1440+ error = kvp_write_file(nmfile, "method", "", "auto");
1441+ if (error < 0)
1442+ goto setval_error;
1443+ } else {
1444+ error = kvp_write_file(nmfile, "method", "", "manual");
1445+ if (error < 0)
1446+ goto setval_error;
1447+ }
1448+
1449+ /*
1450+ * Write the configuration for ipaddress, netmask, gateway and
1451+ * name services
1452+ */
1453+ error = process_ip_string_nm(nmfile, (char *)new_val->ip_addr,
1454+ (char *)new_val->sub_net, is_ipv6);
1455+ if (error < 0)
1456+ goto setval_error;
1457+
1458+ error = fprintf(nmfile, "gateway=%s\n", (char *)new_val->gate_way);
1459+ if (error < 0)
1460+ goto setval_error;
1461+
1462+ error = fprintf(nmfile, "dns=%s\n", (char *)new_val->dns_addr);
1463+ if (error < 0)
1464+ goto setval_error;
1465+
1466+ fclose(nmfile);
1467+ fclose(ifcfg_file);
12991468
13001469 /*
13011470 * Now that we have populated the configuration file,
13021471 * invoke the external script to do its magic.
13031472 */
13041473
1305− str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s",
1306− "hv_set_ifconfig", if_file);
1474+ str_len = snprintf(cmd, sizeof(cmd), KVP_SCRIPTS_PATH "%s %s %s",
1475+ "hv_set_ifconfig", if_filename, nm_filename);
13071476 /*
13081477 * This is a little overcautious, but it's necessary to suppress some
13091478 * false warnings from gcc 8.0.1.
@@ -1316,14 +1485,16 @@ static int kvp_set_ip_info(char *if_name, struct hv_kvp_ipaddr_value *new_val) · 6 unmodified lines
13161485
13171486 if (system(cmd)) {
13181487 syslog(LOG_ERR, "Failed to execute cmd '%s'; error: %d %s",
1319− cmd, errno, strerror(errno));
1488+ cmd, errno, strerror(errno));
13201489 return HV_E_FAIL;
13211490 }
13221491 return 0;
1323−
1492+setmac_error:
1493+ free(mac_addr);
13241494 setval_error:
13251495 syslog(LOG_ERR, "Failed to write config file");
1326− fclose(file);
1496+ fclose(ifcfg_file);
1497+ fclose(nmfile);
13271498 return error;
13281499 }
13291500
tools/hv/hv_set_ifconfig.sh+33−6
@@ -18,12 +18,12 @@ · 17 unmodified lines
1818 #
1919 # This example script is based on a RHEL environment.
2020 #
21−# Here is the format of the ip configuration file:
21+# Here is the ifcfg format of the ip configuration file:
2222 #
2323 # HWADDR=macaddr
2424 # DEVICE=interface name
2525 # BOOTPROTO=<protocol> (where <protocol> is "dhcp" if DHCP is configured
26−# or "none" if no boot-time protocol should be used)
26+# or "none" if no boot-time protocol should be used)
2727 #
2828 # IPADDR0=ipaddr1
2929 # IPADDR1=ipaddr2
@@ -41,6 +41,32 @@ · 11 unmodified lines
4141 # tagged as IPV6_DEFAULTGW and IPV6 NETMASK will be tagged as
4242 # IPV6NETMASK.
4343 #
44+# Here is the keyfile format of the ip configuration file:
45+#
46+# [ethernet]
47+# mac-address=macaddr
48+# [connection]
49+# interface-name=interface name
50+#
51+# [ipv4]
52+# method=<protocol> (where <protocol> is "auto" if DHCP is configured
53+# or "manual" if no boot-time protocol should be used)
54+#
55+# address1=ipaddr1/plen
56+# address=ipaddr2/plen
57+#
58+# gateway=gateway1;gateway2
59+#
60+# dns=dns1;
61+#
62+# [ipv6]
63+# address1=ipaddr1/plen
64+# address2=ipaddr1/plen
65+#
66+# gateway=gateway1;gateway2
67+#
68+# dns=dns1;dns2
69+#
4470 # The host can specify multiple ipv4 and ipv6 addresses to be
4571 # configured for the interface. Furthermore, the configuration
4672 # needs to be persistent. A subsequent GET call on the interface
@@ -48,18 +74,19 @@ · 1 unmodified line
4874 # call.
4975 #
5076
51−
52−
5377 echo "IPV6INIT=yes" >> $1
5478 echo "NM_CONTROLLED=no" >> $1
5579 echo "PEERDNS=yes" >> $1
5680 echo "ONBOOT=yes" >> $1
5781
58−
5982 cp $1 /etc/sysconfig/network-scripts/
6083
84+chmod 600 $2
85+interface=$(echo $2 | awk -F - '{ print $2 }')
86+filename="${2##*/}"
87+
88+sed '/\[connection\]/a autoconnect=true' $2 > /etc/NetworkManager/system-connections/${filename}
6189
62−interface=$(echo $1 | awk -F - '{ print $2 }')
6390
6491 /sbin/ifdown $interface 2>/dev/null
6592 /sbin/ifup $interface 2>/dev/null
tools/testing/selftests/Makefile+1−1
@@ -92,7 +92,7 @@ endif · 91 unmodified lines
9292 TARGETS += tmpfs
9393 TARGETS += tpm2
9494 TARGETS += tty
95−TARGETS += uevents
95+TARGETS += uevent
9696 TARGETS += user
9797 TARGETS += user_events
9898 TARGETS += vDSO
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c+2−0
@@ -185,6 +185,8 @@ static void test_cubic(void) · 184 unmodified lines
185185
186186 do_test("bpf_cubic", NULL);
187187
188+ ASSERT_EQ(cubic_skel->bss->bpf_cubic_acked_called, 1, "pkts_acked called");
189+
188190 bpf_link__destroy(link);
189191 bpf_cubic__destroy(cubic_skel);
190192 }
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c+51−0
@@ -475,6 +475,55 @@ out: · 474 unmodified lines
475475 test_sockmap_drop_prog__destroy(drop);
476476 }
477477
478+static void test_sockmap_skb_verdict_peek(void)
479+{
480+ int err, map, verdict, s, c1, p1, zero = 0, sent, recvd, avail;
481+ struct test_sockmap_pass_prog *pass;
482+ char snd[256] = "0123456789";
483+ char rcv[256] = "0";
484+
485+ pass = test_sockmap_pass_prog__open_and_load();
486+ if (!ASSERT_OK_PTR(pass, "open_and_load"))
487+ return;
488+ verdict = bpf_program__fd(pass->progs.prog_skb_verdict);
489+ map = bpf_map__fd(pass->maps.sock_map_rx);
490+
491+ err = bpf_prog_attach(verdict, map, BPF_SK_SKB_STREAM_VERDICT, 0);
492+ if (!ASSERT_OK(err, "bpf_prog_attach"))
493+ goto out;
494+
495+ s = socket_loopback(AF_INET, SOCK_STREAM);
496+ if (!ASSERT_GT(s, -1, "socket_loopback(s)"))
497+ goto out;
498+
499+ err = create_pair(s, AF_INET, SOCK_STREAM, &c1, &p1);
500+ if (!ASSERT_OK(err, "create_pairs(s)"))
501+ goto out;
502+
503+ err = bpf_map_update_elem(map, &zero, &c1, BPF_NOEXIST);
504+ if (!ASSERT_OK(err, "bpf_map_update_elem(c1)"))
505+ goto out_close;
506+
507+ sent = xsend(p1, snd, sizeof(snd), 0);
508+ ASSERT_EQ(sent, sizeof(snd), "xsend(p1)");
509+ recvd = recv(c1, rcv, sizeof(rcv), MSG_PEEK);
510+ ASSERT_EQ(recvd, sizeof(rcv), "recv(c1)");
511+ err = ioctl(c1, FIONREAD, &avail);
512+ ASSERT_OK(err, "ioctl(FIONREAD) error");
513+ ASSERT_EQ(avail, sizeof(snd), "after peek ioctl(FIONREAD)");
514+ recvd = recv(c1, rcv, sizeof(rcv), 0);
515+ ASSERT_EQ(recvd, sizeof(rcv), "recv(p0)");
516+ err = ioctl(c1, FIONREAD, &avail);
517+ ASSERT_OK(err, "ioctl(FIONREAD) error");
518+ ASSERT_EQ(avail, 0, "after read ioctl(FIONREAD)");
519+
520+out_close:
521+ close(c1);
522+ close(p1);
523+out:
524+ test_sockmap_pass_prog__destroy(pass);
525+}
526+
478527 void test_sockmap_basic(void)
479528 {
480529 if (test__start_subtest("sockmap create_update_free"))
@@ -515,4 +564,6 @@ void test_sockmap_basic(void) · 34 unmodified lines
515564 test_sockmap_skb_verdict_fionread(true);
516565 if (test__start_subtest("sockmap skb_verdict fionread on drop"))
517566 test_sockmap_skb_verdict_fionread(false);
567+ if (test__start_subtest("sockmap skb_verdict msg_f_peek"))
568+ test_sockmap_skb_verdict_peek();
518569 }
tools/testing/selftests/bpf/prog_tests/tc_helpers.h+9−7
@@ -45,7 +45,7 @@ static inline __u32 ifindex_from_link_fd(int fd) · 44 unmodified lines
4545 return link_info.tcx.ifindex;
4646 }
4747
48−static inline void __assert_mprog_count(int target, int expected, bool miniq, int ifindex)
48+static inline void __assert_mprog_count(int target, int expected, int ifindex)
4949 {
5050 __u32 count = 0, attach_flags = 0;
5151 int err;
@@ -53,20 +53,22 @@ static inline void __assert_mprog_count(int target, int expected, bool miniq, in · 1 unmodified line
5353 err = bpf_prog_query(ifindex, target, 0, &attach_flags,
5454 NULL, &count);
5555 ASSERT_EQ(count, expected, "count");
56− if (!expected && !miniq)
57− ASSERT_EQ(err, -ENOENT, "prog_query");
58− else
59− ASSERT_EQ(err, 0, "prog_query");
56+ ASSERT_EQ(err, 0, "prog_query");
6057 }
6158
6259 static inline void assert_mprog_count(int target, int expected)
6360 {
64− __assert_mprog_count(target, expected, false, loopback);
61+ __assert_mprog_count(target, expected, loopback);
6562 }
6663
6764 static inline void assert_mprog_count_ifindex(int ifindex, int target, int expected)
6865 {
69− __assert_mprog_count(target, expected, false, ifindex);
66+ __assert_mprog_count(target, expected, ifindex);
67+}
68+
69+static inline void tc_skel_reset_all_seen(struct test_tc_link *skel)
70+{
71+ memset(skel->bss, 0, sizeof(*skel->bss));
7072 }
7173
7274 #endif /* TC_HELPERS */
tools/testing/selftests/bpf/prog_tests/tc_links.c+23−41
@@ -65,6 +65,7 @@ void serial_test_tc_links_basic(void) · 64 unmodified lines
6565 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
6666 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]");
6767
68+ tc_skel_reset_all_seen(skel);
6869 ASSERT_OK(system(ping_cmd), ping_cmd);
6970
7071 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -97,6 +98,7 @@ void serial_test_tc_links_basic(void) · 26 unmodified lines
9798 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
9899 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]");
99100
101+ tc_skel_reset_all_seen(skel);
100102 ASSERT_OK(system(ping_cmd), ping_cmd);
101103
102104 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -187,6 +189,7 @@ static void test_tc_links_before_target(int target) · 84 unmodified lines
187189 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
188190 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]");
189191
192+ tc_skel_reset_all_seen(skel);
190193 ASSERT_OK(system(ping_cmd), ping_cmd);
191194
192195 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -194,9 +197,6 @@ static void test_tc_links_before_target(int target) · 1 unmodified line
194197 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
195198 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
196199
197− skel->bss->seen_tc1 = false;
198− skel->bss->seen_tc2 = false;
199−
200200 LIBBPF_OPTS_RESET(optl,
201201 .flags = BPF_F_BEFORE,
202202 .relative_fd = bpf_program__fd(skel->progs.tc2),
@@ -246,6 +246,7 @@ static void test_tc_links_before_target(int target) · 43 unmodified lines
246246 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
247247 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]");
248248
249+ tc_skel_reset_all_seen(skel);
249250 ASSERT_OK(system(ping_cmd), ping_cmd);
250251
251252 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -342,6 +343,7 @@ static void test_tc_links_after_target(int target) · 90 unmodified lines
342343 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
343344 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]");
344345
346+ tc_skel_reset_all_seen(skel);
345347 ASSERT_OK(system(ping_cmd), ping_cmd);
346348
347349 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -349,9 +351,6 @@ static void test_tc_links_after_target(int target) · 1 unmodified line
349351 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
350352 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
351353
352− skel->bss->seen_tc1 = false;
353− skel->bss->seen_tc2 = false;
354−
355354 LIBBPF_OPTS_RESET(optl,
356355 .flags = BPF_F_AFTER,
357356 .relative_fd = bpf_program__fd(skel->progs.tc1),
@@ -401,6 +400,7 @@ static void test_tc_links_after_target(int target) · 43 unmodified lines
401400 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
402401 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]");
403402
403+ tc_skel_reset_all_seen(skel);
404404 ASSERT_OK(system(ping_cmd), ping_cmd);
405405
406406 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -502,6 +502,7 @@ static void test_tc_links_revision_target(int target) · 95 unmodified lines
502502 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
503503 ASSERT_EQ(optq.link_ids[2], 0, "prog_ids[2]");
504504
505+ tc_skel_reset_all_seen(skel);
505506 ASSERT_OK(system(ping_cmd), ping_cmd);
506507
507508 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -581,22 +582,20 @@ static void test_tc_chain_classic(int target, bool chain_tc_old) · 73 unmodified lines
581582
582583 assert_mprog_count(target, 2);
583584
585+ tc_skel_reset_all_seen(skel);
584586 ASSERT_OK(system(ping_cmd), ping_cmd);
585587
586588 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
587589 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2");
588590 ASSERT_EQ(skel->bss->seen_tc3, chain_tc_old, "seen_tc3");
589591
590− skel->bss->seen_tc1 = false;
591− skel->bss->seen_tc2 = false;
592− skel->bss->seen_tc3 = false;
593−
594592 err = bpf_link__detach(skel->links.tc2);
595593 if (!ASSERT_OK(err, "prog_detach"))
596594 goto cleanup;
597595
598596 assert_mprog_count(target, 1);
599597
598+ tc_skel_reset_all_seen(skel);
600599 ASSERT_OK(system(ping_cmd), ping_cmd);
601600
602601 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -707,16 +706,13 @@ static void test_tc_links_replace_target(int target) · 104 unmodified lines
707706 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
708707 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]");
709708
709+ tc_skel_reset_all_seen(skel);
710710 ASSERT_OK(system(ping_cmd), ping_cmd);
711711
712712 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
713713 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2");
714714 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
715715
716− skel->bss->seen_tc1 = false;
717− skel->bss->seen_tc2 = false;
718− skel->bss->seen_tc3 = false;
719−
720716 LIBBPF_OPTS_RESET(optl,
721717 .flags = BPF_F_REPLACE,
722718 .relative_fd = bpf_program__fd(skel->progs.tc2),
@@ -781,16 +777,13 @@ static void test_tc_links_replace_target(int target) · 58 unmodified lines
781777 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
782778 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]");
783779
780+ tc_skel_reset_all_seen(skel);
784781 ASSERT_OK(system(ping_cmd), ping_cmd);
785782
786783 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
787784 ASSERT_EQ(skel->bss->seen_tc2, false, "seen_tc2");
788785 ASSERT_EQ(skel->bss->seen_tc3, true, "seen_tc3");
789786
790− skel->bss->seen_tc1 = false;
791− skel->bss->seen_tc2 = false;
792− skel->bss->seen_tc3 = false;
793−
794787 err = bpf_link__detach(skel->links.tc2);
795788 if (!ASSERT_OK(err, "link_detach"))
796789 goto cleanup;
@@ -812,16 +805,13 @@ static void test_tc_links_replace_target(int target) · 15 unmodified lines
812805 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
813806 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]");
814807
808+ tc_skel_reset_all_seen(skel);
815809 ASSERT_OK(system(ping_cmd), ping_cmd);
816810
817811 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
818812 ASSERT_EQ(skel->bss->seen_tc2, false, "seen_tc2");
819813 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
820814
821− skel->bss->seen_tc1 = false;
822− skel->bss->seen_tc2 = false;
823− skel->bss->seen_tc3 = false;
824−
825815 err = bpf_link__update_program(skel->links.tc1, skel->progs.tc1);
826816 if (!ASSERT_OK(err, "link_update_self"))
827817 goto cleanup;
@@ -843,6 +833,7 @@ static void test_tc_links_replace_target(int target) · 15 unmodified lines
843833 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
844834 ASSERT_EQ(optq.link_ids[1], 0, "link_ids[1]");
845835
836+ tc_skel_reset_all_seen(skel);
846837 ASSERT_OK(system(ping_cmd), ping_cmd);
847838
848839 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1254,6 +1245,7 @@ static void test_tc_links_prepend_target(int target) · 405 unmodified lines
12541245 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
12551246 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]");
12561247
1248+ tc_skel_reset_all_seen(skel);
12571249 ASSERT_OK(system(ping_cmd), ping_cmd);
12581250
12591251 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1261,9 +1253,6 @@ static void test_tc_links_prepend_target(int target) · 1 unmodified line
12611253 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
12621254 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
12631255
1264− skel->bss->seen_tc1 = false;
1265− skel->bss->seen_tc2 = false;
1266−
12671256 LIBBPF_OPTS_RESET(optl,
12681257 .flags = BPF_F_BEFORE,
12691258 );
@@ -1311,6 +1300,7 @@ static void test_tc_links_prepend_target(int target) · 41 unmodified lines
13111300 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
13121301 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]");
13131302
1303+ tc_skel_reset_all_seen(skel);
13141304 ASSERT_OK(system(ping_cmd), ping_cmd);
13151305
13161306 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1411,6 +1401,7 @@ static void test_tc_links_append_target(int target) · 94 unmodified lines
14111401 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
14121402 ASSERT_EQ(optq.link_ids[2], 0, "link_ids[2]");
14131403
1404+ tc_skel_reset_all_seen(skel);
14141405 ASSERT_OK(system(ping_cmd), ping_cmd);
14151406
14161407 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1418,9 +1409,6 @@ static void test_tc_links_append_target(int target) · 1 unmodified line
14181409 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
14191410 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
14201411
1421− skel->bss->seen_tc1 = false;
1422− skel->bss->seen_tc2 = false;
1423−
14241412 LIBBPF_OPTS_RESET(optl,
14251413 .flags = BPF_F_AFTER,
14261414 );
@@ -1468,6 +1456,7 @@ static void test_tc_links_append_target(int target) · 41 unmodified lines
14681456 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
14691457 ASSERT_EQ(optq.link_ids[4], 0, "link_ids[4]");
14701458
1459+ tc_skel_reset_all_seen(skel);
14711460 ASSERT_OK(system(ping_cmd), ping_cmd);
14721461
14731462 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1637,38 +1626,33 @@ static void test_tc_chain_mixed(int target) · 163 unmodified lines
16371626
16381627 assert_mprog_count(target, 1);
16391628
1629+ tc_skel_reset_all_seen(skel);
16401630 ASSERT_OK(system(ping_cmd), ping_cmd);
16411631
16421632 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
16431633 ASSERT_EQ(skel->bss->seen_tc5, false, "seen_tc5");
16441634 ASSERT_EQ(skel->bss->seen_tc6, true, "seen_tc6");
16451635
1646− skel->bss->seen_tc4 = false;
1647− skel->bss->seen_tc5 = false;
1648− skel->bss->seen_tc6 = false;
1649−
16501636 err = bpf_link__update_program(skel->links.tc6, skel->progs.tc4);
16511637 if (!ASSERT_OK(err, "link_update"))
16521638 goto cleanup;
16531639
16541640 assert_mprog_count(target, 1);
16551641
1642+ tc_skel_reset_all_seen(skel);
16561643 ASSERT_OK(system(ping_cmd), ping_cmd);
16571644
16581645 ASSERT_EQ(skel->bss->seen_tc4, true, "seen_tc4");
16591646 ASSERT_EQ(skel->bss->seen_tc5, true, "seen_tc5");
16601647 ASSERT_EQ(skel->bss->seen_tc6, false, "seen_tc6");
16611648
1662− skel->bss->seen_tc4 = false;
1663− skel->bss->seen_tc5 = false;
1664− skel->bss->seen_tc6 = false;
1665−
16661649 err = bpf_link__detach(skel->links.tc6);
16671650 if (!ASSERT_OK(err, "prog_detach"))
16681651 goto cleanup;
16691652
1670− __assert_mprog_count(target, 0, true, loopback);
1653+ assert_mprog_count(target, 0);
16711654
1655+ tc_skel_reset_all_seen(skel);
16721656 ASSERT_OK(system(ping_cmd), ping_cmd);
16731657
16741658 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
@@ -1758,22 +1742,20 @@ static void test_tc_links_ingress(int target, bool chain_tc_old, · 83 unmodified lines
17581742
17591743 assert_mprog_count(target, 2);
17601744
1745+ tc_skel_reset_all_seen(skel);
17611746 ASSERT_OK(system(ping_cmd), ping_cmd);
17621747
17631748 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
17641749 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2");
17651750 ASSERT_EQ(skel->bss->seen_tc3, chain_tc_old, "seen_tc3");
17661751
1767− skel->bss->seen_tc1 = false;
1768− skel->bss->seen_tc2 = false;
1769− skel->bss->seen_tc3 = false;
1770−
17711752 err = bpf_link__detach(skel->links.tc2);
17721753 if (!ASSERT_OK(err, "prog_detach"))
17731754 goto cleanup;
17741755
17751756 assert_mprog_count(target, 1);
17761757
1758+ tc_skel_reset_all_seen(skel);
17771759 ASSERT_OK(system(ping_cmd), ping_cmd);
17781760
17791761 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
tools/testing/selftests/bpf/prog_tests/tc_opts.c+332−23
@@ -59,6 +59,7 @@ void serial_test_tc_opts_basic(void) · 58 unmodified lines
5959 ASSERT_EQ(optq.prog_ids[0], id1, "prog_ids[0]");
6060 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
6161
62+ tc_skel_reset_all_seen(skel);
6263 ASSERT_OK(system(ping_cmd), ping_cmd);
6364
6465 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -83,6 +84,7 @@ void serial_test_tc_opts_basic(void) · 18 unmodified lines
8384 ASSERT_EQ(optq.prog_ids[0], id2, "prog_ids[0]");
8485 ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
8586
87+ tc_skel_reset_all_seen(skel);
8688 ASSERT_OK(system(ping_cmd), ping_cmd);
8789
8890 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -163,6 +165,7 @@ static void test_tc_opts_before_target(int target) · 74 unmodified lines
163165 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]");
164166 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
165167
168+ tc_skel_reset_all_seen(skel);
166169 ASSERT_OK(system(ping_cmd), ping_cmd);
167170
168171 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -219,6 +222,7 @@ static void test_tc_opts_before_target(int target) · 50 unmodified lines
219222 ASSERT_EQ(optq.prog_ids[3], id2, "prog_ids[3]");
220223 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
221224
225+ tc_skel_reset_all_seen(skel);
222226 ASSERT_OK(system(ping_cmd), ping_cmd);
223227
224228 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -313,6 +317,7 @@ static void test_tc_opts_after_target(int target) · 88 unmodified lines
313317 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]");
314318 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
315319
320+ tc_skel_reset_all_seen(skel);
316321 ASSERT_OK(system(ping_cmd), ping_cmd);
317322
318323 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -369,6 +374,7 @@ static void test_tc_opts_after_target(int target) · 50 unmodified lines
369374 ASSERT_EQ(optq.prog_ids[3], id4, "prog_ids[3]");
370375 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
371376
377+ tc_skel_reset_all_seen(skel);
372378 ASSERT_OK(system(ping_cmd), ping_cmd);
373379
374380 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -514,6 +520,7 @@ static void test_tc_opts_revision_target(int target) · 139 unmodified lines
514520 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]");
515521 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
516522
523+ tc_skel_reset_all_seen(skel);
517524 ASSERT_OK(system(ping_cmd), ping_cmd);
518525
519526 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -608,22 +615,20 @@ static void test_tc_chain_classic(int target, bool chain_tc_old) · 88 unmodified lines
608615
609616 assert_mprog_count(target, 2);
610617
618+ tc_skel_reset_all_seen(skel);
611619 ASSERT_OK(system(ping_cmd), ping_cmd);
612620
613621 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
614622 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2");
615623 ASSERT_EQ(skel->bss->seen_tc3, chain_tc_old, "seen_tc3");
616624
617− skel->bss->seen_tc1 = false;
618− skel->bss->seen_tc2 = false;
619− skel->bss->seen_tc3 = false;
620−
621625 err = bpf_prog_detach_opts(fd2, loopback, target, &optd);
622626 if (!ASSERT_OK(err, "prog_detach"))
623627 goto cleanup_detach;
624628
625629 assert_mprog_count(target, 1);
626630
631+ tc_skel_reset_all_seen(skel);
627632 ASSERT_OK(system(ping_cmd), ping_cmd);
628633
629634 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -635,7 +640,7 @@ cleanup_detach: · 5 unmodified lines
635640 if (!ASSERT_OK(err, "prog_detach"))
636641 goto cleanup;
637642
638− __assert_mprog_count(target, 0, chain_tc_old, loopback);
643+ assert_mprog_count(target, 0);
639644 cleanup:
640645 if (tc_attached) {
641646 tc_opts.flags = tc_opts.prog_fd = tc_opts.prog_id = 0;
@@ -730,16 +735,13 @@ static void test_tc_opts_replace_target(int target) · 88 unmodified lines
730735 ASSERT_EQ(optq.prog_attach_flags[1], 0, "prog_flags[1]");
731736 ASSERT_EQ(optq.prog_attach_flags[2], 0, "prog_flags[2]");
732737
738+ tc_skel_reset_all_seen(skel);
733739 ASSERT_OK(system(ping_cmd), ping_cmd);
734740
735741 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
736742 ASSERT_EQ(skel->bss->seen_tc2, true, "seen_tc2");
737743 ASSERT_EQ(skel->bss->seen_tc3, false, "seen_tc3");
738744
739− skel->bss->seen_tc1 = false;
740− skel->bss->seen_tc2 = false;
741− skel->bss->seen_tc3 = false;
742−
743745 LIBBPF_OPTS_RESET(opta,
744746 .flags = BPF_F_REPLACE,
745747 .replace_prog_fd = fd2,
@@ -767,16 +769,13 @@ static void test_tc_opts_replace_target(int target) · 21 unmodified lines
767769 ASSERT_EQ(optq.prog_ids[1], id1, "prog_ids[1]");
768770 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
769771
772+ tc_skel_reset_all_seen(skel);
770773 ASSERT_OK(system(ping_cmd), ping_cmd);
771774
772775 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
773776 ASSERT_EQ(skel->bss->seen_tc2, false, "seen_tc2");
774777 ASSERT_EQ(skel->bss->seen_tc3, true, "seen_tc3");
775778
776− skel->bss->seen_tc1 = false;
777− skel->bss->seen_tc2 = false;
778− skel->bss->seen_tc3 = false;
779−
780779 LIBBPF_OPTS_RESET(opta,
781780 .flags = BPF_F_REPLACE | BPF_F_BEFORE,
782781 .replace_prog_fd = fd3,
@@ -805,6 +804,7 @@ static void test_tc_opts_replace_target(int target) · 22 unmodified lines
805804 ASSERT_EQ(optq.prog_ids[1], id1, "prog_ids[1]");
806805 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
807806
807+ tc_skel_reset_all_seen(skel);
808808 ASSERT_OK(system(ping_cmd), ping_cmd);
809809
810810 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1084,6 +1084,7 @@ static void test_tc_opts_prepend_target(int target) · 273 unmodified lines
10841084 ASSERT_EQ(optq.prog_ids[1], id1, "prog_ids[1]");
10851085 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
10861086
1087+ tc_skel_reset_all_seen(skel);
10871088 ASSERT_OK(system(ping_cmd), ping_cmd);
10881089
10891090 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1124,6 +1125,7 @@ static void test_tc_opts_prepend_target(int target) · 34 unmodified lines
11241125 ASSERT_EQ(optq.prog_ids[3], id1, "prog_ids[3]");
11251126 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
11261127
1128+ tc_skel_reset_all_seen(skel);
11271129 ASSERT_OK(system(ping_cmd), ping_cmd);
11281130
11291131 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1222,6 +1224,7 @@ static void test_tc_opts_append_target(int target) · 92 unmodified lines
12221224 ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]");
12231225 ASSERT_EQ(optq.prog_ids[2], 0, "prog_ids[2]");
12241226
1227+ tc_skel_reset_all_seen(skel);
12251228 ASSERT_OK(system(ping_cmd), ping_cmd);
12261229
12271230 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -1262,6 +1265,7 @@ static void test_tc_opts_append_target(int target) · 34 unmodified lines
12621265 ASSERT_EQ(optq.prog_ids[3], id4, "prog_ids[3]");
12631266 ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
12641267
1268+ tc_skel_reset_all_seen(skel);
12651269 ASSERT_OK(system(ping_cmd), ping_cmd);
12661270
12671271 ASSERT_EQ(skel->bss->seen_tc1, true, "seen_tc1");
@@ -2250,7 +2254,7 @@ static void test_tc_opts_delete_empty(int target, bool chain_tc_old) · 982 unmodified lines
22502254 BPF_TC_INGRESS : BPF_TC_EGRESS;
22512255 err = bpf_tc_hook_create(&tc_hook);
22522256 ASSERT_OK(err, "bpf_tc_hook_create");
2253− __assert_mprog_count(target, 0, true, loopback);
2257+ assert_mprog_count(target, 0);
22542258 }
22552259 err = bpf_prog_detach_opts(0, loopback, target, &optd);
22562260 ASSERT_EQ(err, -ENOENT, "prog_detach");
@@ -2316,16 +2320,13 @@ static void test_tc_chain_mixed(int target) · 59 unmodified lines
23162320
23172321 assert_mprog_count(target, 1);
23182322
2323+ tc_skel_reset_all_seen(skel);
23192324 ASSERT_OK(system(ping_cmd), ping_cmd);
23202325
23212326 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
23222327 ASSERT_EQ(skel->bss->seen_tc5, false, "seen_tc5");
23232328 ASSERT_EQ(skel->bss->seen_tc6, true, "seen_tc6");
23242329
2325− skel->bss->seen_tc4 = false;
2326− skel->bss->seen_tc5 = false;
2327− skel->bss->seen_tc6 = false;
2328−
23292330 LIBBPF_OPTS_RESET(opta,
23302331 .flags = BPF_F_REPLACE,
23312332 .replace_prog_fd = fd3,
@@ -2339,21 +2340,19 @@ static void test_tc_chain_mixed(int target) · 7 unmodified lines
23392340
23402341 assert_mprog_count(target, 1);
23412342
2343+ tc_skel_reset_all_seen(skel);
23422344 ASSERT_OK(system(ping_cmd), ping_cmd);
23432345
23442346 ASSERT_EQ(skel->bss->seen_tc4, true, "seen_tc4");
23452347 ASSERT_EQ(skel->bss->seen_tc5, true, "seen_tc5");
23462348 ASSERT_EQ(skel->bss->seen_tc6, false, "seen_tc6");
23472349
2348− skel->bss->seen_tc4 = false;
2349− skel->bss->seen_tc5 = false;
2350− skel->bss->seen_tc6 = false;
2351−
23522350 cleanup_opts:
23532351 err = bpf_prog_detach_opts(detach_fd, loopback, target, &optd);
23542352 ASSERT_OK(err, "prog_detach");
2355− __assert_mprog_count(target, 0, true, loopback);
2353+ assert_mprog_count(target, 0);
23562354
2355+ tc_skel_reset_all_seen(skel);
23572356 ASSERT_OK(system(ping_cmd), ping_cmd);
23582357
23592358 ASSERT_EQ(skel->bss->seen_tc4, false, "seen_tc4");
@@ -2378,3 +2377,313 @@ void serial_test_tc_opts_chain_mixed(void) · 18 unmodified lines
23782377 test_tc_chain_mixed(BPF_TCX_INGRESS);
23792378 test_tc_chain_mixed(BPF_TCX_EGRESS);
23802379 }
2380+
2381+static int generate_dummy_prog(void)
2382+{
2383+ const struct bpf_insn prog_insns[] = {
2384+ BPF_MOV64_IMM(BPF_REG_0, 0),
2385+ BPF_EXIT_INSN(),
2386+ };
2387+ const size_t prog_insn_cnt = sizeof(prog_insns) / sizeof(struct bpf_insn);
2388+ LIBBPF_OPTS(bpf_prog_load_opts, opts);
2389+ const size_t log_buf_sz = 256;
2390+ char *log_buf;
2391+ int fd = -1;
2392+
2393+ log_buf = malloc(log_buf_sz);
2394+ if (!ASSERT_OK_PTR(log_buf, "log_buf_alloc"))
2395+ return fd;
2396+ opts.log_buf = log_buf;
2397+ opts.log_size = log_buf_sz;
2398+
2399+ log_buf[0] = '\0';
2400+ opts.log_level = 0;
2401+ fd = bpf_prog_load(BPF_PROG_TYPE_SCHED_CLS, "tcx_prog", "GPL",
2402+ prog_insns, prog_insn_cnt, &opts);
2403+ ASSERT_STREQ(log_buf, "", "log_0");
2404+ ASSERT_GE(fd, 0, "prog_fd");
2405+ free(log_buf);
2406+ return fd;
2407+}
2408+
2409+static void test_tc_opts_max_target(int target, int flags, bool relative)
2410+{
2411+ int err, ifindex, i, prog_fd, last_fd = -1;
2412+ LIBBPF_OPTS(bpf_prog_attach_opts, opta);
2413+ const int max_progs = 63;
2414+
2415+ ASSERT_OK(system("ip link add dev tcx_opts1 type veth peer name tcx_opts2"), "add veth");
2416+ ifindex = if_nametoindex("tcx_opts1");
2417+ ASSERT_NEQ(ifindex, 0, "non_zero_ifindex");
2418+
2419+ assert_mprog_count_ifindex(ifindex, target, 0);
2420+
2421+ for (i = 0; i < max_progs; i++) {
2422+ prog_fd = generate_dummy_prog();
2423+ if (!ASSERT_GE(prog_fd, 0, "dummy_prog"))
2424+ goto cleanup;
2425+ err = bpf_prog_attach_opts(prog_fd, ifindex, target, &opta);
2426+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2427+ goto cleanup;
2428+ assert_mprog_count_ifindex(ifindex, target, i + 1);
2429+ if (i == max_progs - 1 && relative)
2430+ last_fd = prog_fd;
2431+ else
2432+ close(prog_fd);
2433+ }
2434+
2435+ prog_fd = generate_dummy_prog();
2436+ if (!ASSERT_GE(prog_fd, 0, "dummy_prog"))
2437+ goto cleanup;
2438+ opta.flags = flags;
2439+ if (last_fd > 0)
2440+ opta.relative_fd = last_fd;
2441+ err = bpf_prog_attach_opts(prog_fd, ifindex, target, &opta);
2442+ ASSERT_EQ(err, -ERANGE, "prog_64_attach");
2443+ assert_mprog_count_ifindex(ifindex, target, max_progs);
2444+ close(prog_fd);
2445+cleanup:
2446+ if (last_fd > 0)
2447+ close(last_fd);
2448+ ASSERT_OK(system("ip link del dev tcx_opts1"), "del veth");
2449+ ASSERT_EQ(if_nametoindex("tcx_opts1"), 0, "dev1_removed");
2450+ ASSERT_EQ(if_nametoindex("tcx_opts2"), 0, "dev2_removed");
2451+}
2452+
2453+void serial_test_tc_opts_max(void)
2454+{
2455+ test_tc_opts_max_target(BPF_TCX_INGRESS, 0, false);
2456+ test_tc_opts_max_target(BPF_TCX_EGRESS, 0, false);
2457+
2458+ test_tc_opts_max_target(BPF_TCX_INGRESS, BPF_F_BEFORE, false);
2459+ test_tc_opts_max_target(BPF_TCX_EGRESS, BPF_F_BEFORE, true);
2460+
2461+ test_tc_opts_max_target(BPF_TCX_INGRESS, BPF_F_AFTER, true);
2462+ test_tc_opts_max_target(BPF_TCX_EGRESS, BPF_F_AFTER, false);
2463+}
2464+
2465+static void test_tc_opts_query_target(int target)
2466+{
2467+ const size_t attr_size = offsetofend(union bpf_attr, query);
2468+ LIBBPF_OPTS(bpf_prog_attach_opts, opta);
2469+ LIBBPF_OPTS(bpf_prog_detach_opts, optd);
2470+ LIBBPF_OPTS(bpf_prog_query_opts, optq);
2471+ __u32 fd1, fd2, fd3, fd4, id1, id2, id3, id4;
2472+ struct test_tc_link *skel;
2473+ union bpf_attr attr;
2474+ __u32 prog_ids[5];
2475+ int err;
2476+
2477+ skel = test_tc_link__open_and_load();
2478+ if (!ASSERT_OK_PTR(skel, "skel_load"))
2479+ goto cleanup;
2480+
2481+ fd1 = bpf_program__fd(skel->progs.tc1);
2482+ fd2 = bpf_program__fd(skel->progs.tc2);
2483+ fd3 = bpf_program__fd(skel->progs.tc3);
2484+ fd4 = bpf_program__fd(skel->progs.tc4);
2485+
2486+ id1 = id_from_prog_fd(fd1);
2487+ id2 = id_from_prog_fd(fd2);
2488+ id3 = id_from_prog_fd(fd3);
2489+ id4 = id_from_prog_fd(fd4);
2490+
2491+ assert_mprog_count(target, 0);
2492+
2493+ LIBBPF_OPTS_RESET(opta,
2494+ .expected_revision = 1,
2495+ );
2496+
2497+ err = bpf_prog_attach_opts(fd1, loopback, target, &opta);
2498+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2499+ goto cleanup;
2500+
2501+ assert_mprog_count(target, 1);
2502+
2503+ LIBBPF_OPTS_RESET(opta,
2504+ .expected_revision = 2,
2505+ );
2506+
2507+ err = bpf_prog_attach_opts(fd2, loopback, target, &opta);
2508+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2509+ goto cleanup1;
2510+
2511+ assert_mprog_count(target, 2);
2512+
2513+ LIBBPF_OPTS_RESET(opta,
2514+ .expected_revision = 3,
2515+ );
2516+
2517+ err = bpf_prog_attach_opts(fd3, loopback, target, &opta);
2518+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2519+ goto cleanup2;
2520+
2521+ assert_mprog_count(target, 3);
2522+
2523+ LIBBPF_OPTS_RESET(opta,
2524+ .expected_revision = 4,
2525+ );
2526+
2527+ err = bpf_prog_attach_opts(fd4, loopback, target, &opta);
2528+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2529+ goto cleanup3;
2530+
2531+ assert_mprog_count(target, 4);
2532+
2533+ /* Test 1: Double query via libbpf API */
2534+ err = bpf_prog_query_opts(loopback, target, &optq);
2535+ if (!ASSERT_OK(err, "prog_query"))
2536+ goto cleanup4;
2537+
2538+ ASSERT_EQ(optq.count, 4, "count");
2539+ ASSERT_EQ(optq.revision, 5, "revision");
2540+ ASSERT_EQ(optq.prog_ids, NULL, "prog_ids");
2541+ ASSERT_EQ(optq.link_ids, NULL, "link_ids");
2542+
2543+ memset(prog_ids, 0, sizeof(prog_ids));
2544+ optq.prog_ids = prog_ids;
2545+
2546+ err = bpf_prog_query_opts(loopback, target, &optq);
2547+ if (!ASSERT_OK(err, "prog_query"))
2548+ goto cleanup4;
2549+
2550+ ASSERT_EQ(optq.count, 4, "count");
2551+ ASSERT_EQ(optq.revision, 5, "revision");
2552+ ASSERT_EQ(optq.prog_ids[0], id1, "prog_ids[0]");
2553+ ASSERT_EQ(optq.prog_ids[1], id2, "prog_ids[1]");
2554+ ASSERT_EQ(optq.prog_ids[2], id3, "prog_ids[2]");
2555+ ASSERT_EQ(optq.prog_ids[3], id4, "prog_ids[3]");
2556+ ASSERT_EQ(optq.prog_ids[4], 0, "prog_ids[4]");
2557+ ASSERT_EQ(optq.link_ids, NULL, "link_ids");
2558+
2559+ /* Test 2: Double query via bpf_attr & bpf(2) directly */
2560+ memset(&attr, 0, attr_size);
2561+ attr.query.target_ifindex = loopback;
2562+ attr.query.attach_type = target;
2563+
2564+ err = syscall(__NR_bpf, BPF_PROG_QUERY, &attr, attr_size);
2565+ if (!ASSERT_OK(err, "prog_query"))
2566+ goto cleanup4;
2567+
2568+ ASSERT_EQ(attr.query.count, 4, "count");
2569+ ASSERT_EQ(attr.query.revision, 5, "revision");
2570+ ASSERT_EQ(attr.query.query_flags, 0, "query_flags");
2571+ ASSERT_EQ(attr.query.attach_flags, 0, "attach_flags");
2572+ ASSERT_EQ(attr.query.target_ifindex, loopback, "target_ifindex");
2573+ ASSERT_EQ(attr.query.attach_type, target, "attach_type");
2574+ ASSERT_EQ(attr.query.prog_ids, 0, "prog_ids");
2575+ ASSERT_EQ(attr.query.prog_attach_flags, 0, "prog_attach_flags");
2576+ ASSERT_EQ(attr.query.link_ids, 0, "link_ids");
2577+ ASSERT_EQ(attr.query.link_attach_flags, 0, "link_attach_flags");
2578+
2579+ memset(prog_ids, 0, sizeof(prog_ids));
2580+ attr.query.prog_ids = ptr_to_u64(prog_ids);
2581+
2582+ err = syscall(__NR_bpf, BPF_PROG_QUERY, &attr, attr_size);
2583+ if (!ASSERT_OK(err, "prog_query"))
2584+ goto cleanup4;
2585+
2586+ ASSERT_EQ(attr.query.count, 4, "count");
2587+ ASSERT_EQ(attr.query.revision, 5, "revision");
2588+ ASSERT_EQ(attr.query.query_flags, 0, "query_flags");
2589+ ASSERT_EQ(attr.query.attach_flags, 0, "attach_flags");
2590+ ASSERT_EQ(attr.query.target_ifindex, loopback, "target_ifindex");
2591+ ASSERT_EQ(attr.query.attach_type, target, "attach_type");
2592+ ASSERT_EQ(attr.query.prog_ids, ptr_to_u64(prog_ids), "prog_ids");
2593+ ASSERT_EQ(prog_ids[0], id1, "prog_ids[0]");
2594+ ASSERT_EQ(prog_ids[1], id2, "prog_ids[1]");
2595+ ASSERT_EQ(prog_ids[2], id3, "prog_ids[2]");
2596+ ASSERT_EQ(prog_ids[3], id4, "prog_ids[3]");
2597+ ASSERT_EQ(prog_ids[4], 0, "prog_ids[4]");
2598+ ASSERT_EQ(attr.query.prog_attach_flags, 0, "prog_attach_flags");
2599+ ASSERT_EQ(attr.query.link_ids, 0, "link_ids");
2600+ ASSERT_EQ(attr.query.link_attach_flags, 0, "link_attach_flags");
2601+
2602+cleanup4:
2603+ err = bpf_prog_detach_opts(fd4, loopback, target, &optd);
2604+ ASSERT_OK(err, "prog_detach");
2605+ assert_mprog_count(target, 3);
2606+
2607+cleanup3:
2608+ err = bpf_prog_detach_opts(fd3, loopback, target, &optd);
2609+ ASSERT_OK(err, "prog_detach");
2610+ assert_mprog_count(target, 2);
2611+
2612+cleanup2:
2613+ err = bpf_prog_detach_opts(fd2, loopback, target, &optd);
2614+ ASSERT_OK(err, "prog_detach");
2615+ assert_mprog_count(target, 1);
2616+
2617+cleanup1:
2618+ err = bpf_prog_detach_opts(fd1, loopback, target, &optd);
2619+ ASSERT_OK(err, "prog_detach");
2620+ assert_mprog_count(target, 0);
2621+
2622+cleanup:
2623+ test_tc_link__destroy(skel);
2624+}
2625+
2626+void serial_test_tc_opts_query(void)
2627+{
2628+ test_tc_opts_query_target(BPF_TCX_INGRESS);
2629+ test_tc_opts_query_target(BPF_TCX_EGRESS);
2630+}
2631+
2632+static void test_tc_opts_query_attach_target(int target)
2633+{
2634+ LIBBPF_OPTS(bpf_prog_attach_opts, opta);
2635+ LIBBPF_OPTS(bpf_prog_detach_opts, optd);
2636+ LIBBPF_OPTS(bpf_prog_query_opts, optq);
2637+ struct test_tc_link *skel;
2638+ __u32 prog_ids[2];
2639+ __u32 fd1, id1;
2640+ int err;
2641+
2642+ skel = test_tc_link__open_and_load();
2643+ if (!ASSERT_OK_PTR(skel, "skel_load"))
2644+ goto cleanup;
2645+
2646+ fd1 = bpf_program__fd(skel->progs.tc1);
2647+ id1 = id_from_prog_fd(fd1);
2648+
2649+ err = bpf_prog_query_opts(loopback, target, &optq);
2650+ if (!ASSERT_OK(err, "prog_query"))
2651+ goto cleanup;
2652+
2653+ ASSERT_EQ(optq.count, 0, "count");
2654+ ASSERT_EQ(optq.revision, 1, "revision");
2655+
2656+ LIBBPF_OPTS_RESET(opta,
2657+ .expected_revision = optq.revision,
2658+ );
2659+
2660+ err = bpf_prog_attach_opts(fd1, loopback, target, &opta);
2661+ if (!ASSERT_EQ(err, 0, "prog_attach"))
2662+ goto cleanup;
2663+
2664+ memset(prog_ids, 0, sizeof(prog_ids));
2665+ optq.prog_ids = prog_ids;
2666+ optq.count = ARRAY_SIZE(prog_ids);
2667+
2668+ err = bpf_prog_query_opts(loopback, target, &optq);
2669+ if (!ASSERT_OK(err, "prog_query"))
2670+ goto cleanup1;
2671+
2672+ ASSERT_EQ(optq.count, 1, "count");
2673+ ASSERT_EQ(optq.revision, 2, "revision");
2674+ ASSERT_EQ(optq.prog_ids[0], id1, "prog_ids[0]");
2675+ ASSERT_EQ(optq.prog_ids[1], 0, "prog_ids[1]");
2676+
2677+cleanup1:
2678+ err = bpf_prog_detach_opts(fd1, loopback, target, &optd);
2679+ ASSERT_OK(err, "prog_detach");
2680+ assert_mprog_count(target, 0);
2681+cleanup:
2682+ test_tc_link__destroy(skel);
2683+}
2684+
2685+void serial_test_tc_opts_query_attach(void)
2686+{
2687+ test_tc_opts_query_attach_target(BPF_TCX_INGRESS);
2688+ test_tc_opts_query_attach_target(BPF_TCX_EGRESS);
2689+}
tools/testing/selftests/bpf/prog_tests/timer.c+4−2
@@ -2,6 +2,7 @@ · 1 unmodified line
22 /* Copyright (c) 2021 Facebook */
33 #include <test_progs.h>
44 #include "timer.skel.h"
5+#include "timer_failure.skel.h"
56
67 static int timer(struct timer *timer_skel)
78 {
@@ -49,10 +50,11 @@ void serial_test_timer(void) · 41 unmodified lines
4950
5051 timer_skel = timer__open_and_load();
5152 if (!ASSERT_OK_PTR(timer_skel, "timer_skel_load"))
52− goto cleanup;
53+ return;
5354
5455 err = timer(timer_skel);
5556 ASSERT_OK(err, "timer");
56−cleanup:
5757 timer__destroy(timer_skel);
58+
59+ RUN_TESTS(timer_failure);
5860 }
tools/testing/selftests/bpf/progs/bpf_cubic.c+3−0
@@ -490,6 +490,8 @@ static __always_inline void hystart_update(struct sock *sk, __u32 delay) · 489 unmodified lines
490490 }
491491 }
492492
493+int bpf_cubic_acked_called = 0;
494+
493495 void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk,
494496 const struct ack_sample *sample)
495497 {
@@ -497,6 +499,7 @@ void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk, · 1 unmodified line
497499 struct bictcp *ca = inet_csk_ca(sk);
498500 __u32 delay;
499501
502+ bpf_cubic_acked_called = 1;
500503 /* Some calls are for duplicates without timetamps */
501504 if (sample->rtt_us < 0)
502505 return;
tools/testing/selftests/bpf/progs/timer_failure.c+47−0
@@ -0,0 +1,47 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/* Copyright (c) 2023 Meta Platforms, Inc. and affiliates. */
3+
4+#include <linux/bpf.h>
5+#include <time.h>
6+#include <errno.h>
7+#include <bpf/bpf_helpers.h>
8+#include "bpf_misc.h"
9+#include "bpf_tcp_helpers.h"
10+
11+char _license[] SEC("license") = "GPL";
12+
13+struct elem {
14+ struct bpf_timer t;
15+};
16+
17+struct {
18+ __uint(type, BPF_MAP_TYPE_ARRAY);
19+ __uint(max_entries, 1);
20+ __type(key, int);
21+ __type(value, struct elem);
22+} timer_map SEC(".maps");
23+
24+static int timer_cb_ret1(void *map, int *key, struct bpf_timer *timer)
25+{
26+ if (bpf_get_smp_processor_id() % 2)
27+ return 1;
28+ else
29+ return 0;
30+}
31+
32+SEC("fentry/bpf_fentry_test1")
33+__failure __msg("should have been in (0x0; 0x0)")
34+int BPF_PROG2(test_ret_1, int, a)
35+{
36+ int key = 0;
37+ struct bpf_timer *timer;
38+
39+ timer = bpf_map_lookup_elem(&timer_map, &key);
40+ if (timer) {
41+ bpf_timer_init(timer, &timer_map, CLOCK_BOOTTIME);
42+ bpf_timer_set_callback(timer, timer_cb_ret1);
43+ bpf_timer_start(timer, 1000, 0);
44+ }
45+
46+ return 0;
47+}
tools/testing/selftests/netfilter/Makefile+3−2
@@ -6,13 +6,14 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \ · 5 unmodified lines
66 nft_concat_range.sh nft_conntrack_helper.sh \
77 nft_queue.sh nft_meta.sh nf_nat_edemux.sh \
88 ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \
9− conntrack_vrf.sh nft_synproxy.sh rpath.sh nft_audit.sh
9+ conntrack_vrf.sh nft_synproxy.sh rpath.sh nft_audit.sh \
10+ conntrack_sctp_collision.sh
1011
1112 HOSTPKG_CONFIG := pkg-config
1213
1314 CFLAGS += $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
1415 LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)
1516
16−TEST_GEN_FILES = nf-queue connect_close audit_logread
17+TEST_GEN_FILES = nf-queue connect_close audit_logread sctp_collision
1718
1819 include ../lib.mk
tools/testing/selftests/netfilter/conntrack_sctp_collision.sh+89−0
@@ -0,0 +1,89 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+#
4+# Testing For SCTP COLLISION SCENARIO as Below:
5+#
6+# 14:35:47.655279 IP CLIENT_IP.PORT > SERVER_IP.PORT: sctp (1) [INIT] [init tag: 2017837359]
7+# 14:35:48.353250 IP SERVER_IP.PORT > CLIENT_IP.PORT: sctp (1) [INIT] [init tag: 1187206187]
8+# 14:35:48.353275 IP CLIENT_IP.PORT > SERVER_IP.PORT: sctp (1) [INIT ACK] [init tag: 2017837359]
9+# 14:35:48.353283 IP SERVER_IP.PORT > CLIENT_IP.PORT: sctp (1) [COOKIE ECHO]
10+# 14:35:48.353977 IP CLIENT_IP.PORT > SERVER_IP.PORT: sctp (1) [COOKIE ACK]
11+# 14:35:48.855335 IP SERVER_IP.PORT > CLIENT_IP.PORT: sctp (1) [INIT ACK] [init tag: 164579970]
12+#
13+# TOPO: SERVER_NS (link0)<--->(link1) ROUTER_NS (link2)<--->(link3) CLIENT_NS
14+
15+CLIENT_NS=$(mktemp -u client-XXXXXXXX)
16+CLIENT_IP="198.51.200.1"
17+CLIENT_PORT=1234
18+
19+SERVER_NS=$(mktemp -u server-XXXXXXXX)
20+SERVER_IP="198.51.100.1"
21+SERVER_PORT=1234
22+
23+ROUTER_NS=$(mktemp -u router-XXXXXXXX)
24+CLIENT_GW="198.51.200.2"
25+SERVER_GW="198.51.100.2"
26+
27+# setup the topo
28+setup() {
29+ ip net add $CLIENT_NS
30+ ip net add $SERVER_NS
31+ ip net add $ROUTER_NS
32+ ip -n $SERVER_NS link add link0 type veth peer name link1 netns $ROUTER_NS
33+ ip -n $CLIENT_NS link add link3 type veth peer name link2 netns $ROUTER_NS
34+
35+ ip -n $SERVER_NS link set link0 up
36+ ip -n $SERVER_NS addr add $SERVER_IP/24 dev link0
37+ ip -n $SERVER_NS route add $CLIENT_IP dev link0 via $SERVER_GW
38+
39+ ip -n $ROUTER_NS link set link1 up
40+ ip -n $ROUTER_NS link set link2 up
41+ ip -n $ROUTER_NS addr add $SERVER_GW/24 dev link1
42+ ip -n $ROUTER_NS addr add $CLIENT_GW/24 dev link2
43+ ip net exec $ROUTER_NS sysctl -wq net.ipv4.ip_forward=1
44+
45+ ip -n $CLIENT_NS link set link3 up
46+ ip -n $CLIENT_NS addr add $CLIENT_IP/24 dev link3
47+ ip -n $CLIENT_NS route add $SERVER_IP dev link3 via $CLIENT_GW
48+
49+ # simulate the delay on OVS upcall by setting up a delay for INIT_ACK with
50+ # tc on $SERVER_NS side
51+ tc -n $SERVER_NS qdisc add dev link0 root handle 1: htb
52+ tc -n $SERVER_NS class add dev link0 parent 1: classid 1:1 htb rate 100mbit
53+ tc -n $SERVER_NS filter add dev link0 parent 1: protocol ip u32 match ip protocol 132 \
54+ 0xff match u8 2 0xff at 32 flowid 1:1
55+ tc -n $SERVER_NS qdisc add dev link0 parent 1:1 handle 10: netem delay 1200ms
56+
57+ # simulate the ctstate check on OVS nf_conntrack
58+ ip net exec $ROUTER_NS iptables -A FORWARD -m state --state INVALID,UNTRACKED -j DROP
59+ ip net exec $ROUTER_NS iptables -A INPUT -p sctp -j DROP
60+
61+ # use a smaller number for assoc's max_retrans to reproduce the issue
62+ modprobe sctp
63+ ip net exec $CLIENT_NS sysctl -wq net.sctp.association_max_retrans=3
64+}
65+
66+cleanup() {
67+ ip net exec $CLIENT_NS pkill sctp_collision 2>&1 >/dev/null
68+ ip net exec $SERVER_NS pkill sctp_collision 2>&1 >/dev/null
69+ ip net del "$CLIENT_NS"
70+ ip net del "$SERVER_NS"
71+ ip net del "$ROUTER_NS"
72+}
73+
74+do_test() {
75+ ip net exec $SERVER_NS ./sctp_collision server \
76+ $SERVER_IP $SERVER_PORT $CLIENT_IP $CLIENT_PORT &
77+ ip net exec $CLIENT_NS ./sctp_collision client \
78+ $CLIENT_IP $CLIENT_PORT $SERVER_IP $SERVER_PORT
79+}
80+
81+# NOTE: one way to work around the issue is set a smaller hb_interval
82+# ip net exec $CLIENT_NS sysctl -wq net.sctp.hb_interval=3500
83+
84+# run the test case
85+trap cleanup EXIT
86+setup && \
87+echo "Test for SCTP Collision in nf_conntrack:" && \
88+do_test && echo "PASS!"
89+exit $?
tools/testing/selftests/netfilter/nft_audit.sh+101−16
@@ -12,10 +12,11 @@ nft --version >/dev/null 2>&1 || { · 11 unmodified lines
1212 }
1313
1414 logfile=$(mktemp)
15+rulefile=$(mktemp)
1516 echo "logging into $logfile"
1617 ./audit_logread >"$logfile" &
1718 logread_pid=$!
18−trap 'kill $logread_pid; rm -f $logfile' EXIT
19+trap 'kill $logread_pid; rm -f $logfile $rulefile' EXIT
1920 exec 3<"$logfile"
2021
2122 do_test() { # (cmd, log)
@@ -26,12 +27,14 @@ do_test() { # (cmd, log) · 4 unmodified lines
2627 res=$(diff -a -u <(echo "$2") - <&3)
2728 [ $? -eq 0 ] && { echo "OK"; return; }
2829 echo "FAIL"
29− echo "$res"
30− ((RC++))
30+ grep -v '^\(---\|+++\|@@\)' <<< "$res"
31+ ((RC--))
3132 }
3233
3334 nft flush ruleset
3435
36+# adding tables, chains and rules
37+
3538 for table in t1 t2; do
3639 do_test "nft add table $table" \
3740 "table=$table family=2 entries=1 op=nft_register_table"
@@ -62,6 +65,48 @@ for table in t1 t2; do · 24 unmodified lines
6265 "table=$table family=2 entries=6 op=nft_register_rule"
6366 done
6467
68+for ((i = 0; i < 500; i++)); do
69+ echo "add rule t2 c3 counter accept comment \"rule $i\""
70+done >$rulefile
71+do_test "nft -f $rulefile" \
72+'table=t2 family=2 entries=500 op=nft_register_rule'
73+
74+# adding sets and elements
75+
76+settype='type inet_service; counter'
77+setelem='{ 22, 80, 443 }'
78+setblock="{ $settype; elements = $setelem; }"
79+do_test "nft add set t1 s $setblock" \
80+"table=t1 family=2 entries=4 op=nft_register_set"
81+
82+do_test "nft add set t1 s2 $setblock; add set t1 s3 { $settype; }" \
83+"table=t1 family=2 entries=5 op=nft_register_set"
84+
85+do_test "nft add element t1 s3 $setelem" \
86+"table=t1 family=2 entries=3 op=nft_register_setelem"
87+
88+# adding counters
89+
90+do_test 'nft add counter t1 c1' \
91+'table=t1 family=2 entries=1 op=nft_register_obj'
92+
93+do_test 'nft add counter t2 c1; add counter t2 c2' \
94+'table=t2 family=2 entries=2 op=nft_register_obj'
95+
96+# adding/updating quotas
97+
98+do_test 'nft add quota t1 q1 { 10 bytes }' \
99+'table=t1 family=2 entries=1 op=nft_register_obj'
100+
101+do_test 'nft add quota t2 q1 { 10 bytes }; add quota t2 q2 { 10 bytes }' \
102+'table=t2 family=2 entries=2 op=nft_register_obj'
103+
104+# changing the quota value triggers obj update path
105+do_test 'nft add quota t1 q1 { 20 bytes }' \
106+'table=t1 family=2 entries=1 op=nft_register_obj'
107+
108+# resetting rules
109+
65110 do_test 'nft reset rules t1 c2' \
66111 'table=t1 family=2 entries=3 op=nft_reset_rule'
67112
@@ -70,19 +115,6 @@ do_test 'nft reset rules table t1' \ · 2 unmodified lines
70115 table=t1 family=2 entries=3 op=nft_reset_rule
71116 table=t1 family=2 entries=3 op=nft_reset_rule'
72117
73−do_test 'nft reset rules' \
74−'table=t1 family=2 entries=3 op=nft_reset_rule
75−table=t1 family=2 entries=3 op=nft_reset_rule
76−table=t1 family=2 entries=3 op=nft_reset_rule
77−table=t2 family=2 entries=3 op=nft_reset_rule
78−table=t2 family=2 entries=3 op=nft_reset_rule
79−table=t2 family=2 entries=3 op=nft_reset_rule'
80−
81−for ((i = 0; i < 500; i++)); do
82− echo "add rule t2 c3 counter accept comment \"rule $i\""
83−done | do_test 'nft -f -' \
84−'table=t2 family=2 entries=500 op=nft_register_rule'
85−
86118 do_test 'nft reset rules t2 c3' \
87119 'table=t2 family=2 entries=189 op=nft_reset_rule
88120 table=t2 family=2 entries=188 op=nft_reset_rule
@@ -105,4 +137,57 @@ table=t2 family=2 entries=180 op=nft_reset_rule · 16 unmodified lines
105137 table=t2 family=2 entries=188 op=nft_reset_rule
106138 table=t2 family=2 entries=135 op=nft_reset_rule'
107139
140+# resetting sets and elements
141+
142+elem=(22 ,80 ,443)
143+relem=""
144+for i in {1..3}; do
145+ relem+="${elem[((i - 1))]}"
146+ do_test "nft reset element t1 s { $relem }" \
147+ "table=t1 family=2 entries=$i op=nft_reset_setelem"
148+done
149+
150+do_test 'nft reset set t1 s' \
151+'table=t1 family=2 entries=3 op=nft_reset_setelem'
152+
153+# deleting rules
154+
155+readarray -t handles < <(nft -a list chain t1 c1 | \
156+ sed -n 's/.*counter.* handle \(.*\)$/\1/p')
157+
158+do_test "nft delete rule t1 c1 handle ${handles[0]}" \
159+'table=t1 family=2 entries=1 op=nft_unregister_rule'
160+
161+cmd='delete rule t1 c1 handle'
162+do_test "nft $cmd ${handles[1]}; $cmd ${handles[2]}" \
163+'table=t1 family=2 entries=2 op=nft_unregister_rule'
164+
165+do_test 'nft flush chain t1 c2' \
166+'table=t1 family=2 entries=3 op=nft_unregister_rule'
167+
168+do_test 'nft flush table t2' \
169+'table=t2 family=2 entries=509 op=nft_unregister_rule'
170+
171+# deleting chains
172+
173+do_test 'nft delete chain t2 c2' \
174+'table=t2 family=2 entries=1 op=nft_unregister_chain'
175+
176+# deleting sets and elements
177+
178+do_test 'nft delete element t1 s { 22 }' \
179+'table=t1 family=2 entries=1 op=nft_unregister_setelem'
180+
181+do_test 'nft delete element t1 s { 80, 443 }' \
182+'table=t1 family=2 entries=2 op=nft_unregister_setelem'
183+
184+do_test 'nft flush set t1 s2' \
185+'table=t1 family=2 entries=3 op=nft_unregister_setelem'
186+
187+do_test 'nft delete set t1 s2' \
188+'table=t1 family=2 entries=1 op=nft_unregister_set'
189+
190+do_test 'nft delete set t1 s3' \
191+'table=t1 family=2 entries=1 op=nft_unregister_set'
192+
108193 exit $RC
tools/testing/selftests/netfilter/sctp_collision.c+99−0
@@ -0,0 +1,99 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#include <stdio.h>
4+#include <stdlib.h>
5+#include <string.h>
6+#include <unistd.h>
7+#include <arpa/inet.h>
8+
9+int main(int argc, char *argv[])
10+{
11+ struct sockaddr_in saddr = {}, daddr = {};
12+ int sd, ret, len = sizeof(daddr);
13+ struct timeval tv = {25, 0};
14+ char buf[] = "hello";
15+
16+ if (argc != 6 || (strcmp(argv[1], "server") && strcmp(argv[1], "client"))) {
17+ printf("%s <server|client> <LOCAL_IP> <LOCAL_PORT> <REMOTE_IP> <REMOTE_PORT>\n",
18+ argv[0]);
19+ return -1;
20+ }
21+
22+ sd = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP);
23+ if (sd < 0) {
24+ printf("Failed to create sd\n");
25+ return -1;
26+ }
27+
28+ saddr.sin_family = AF_INET;
29+ saddr.sin_addr.s_addr = inet_addr(argv[2]);
30+ saddr.sin_port = htons(atoi(argv[3]));
31+
32+ ret = bind(sd, (struct sockaddr *)&saddr, sizeof(saddr));
33+ if (ret < 0) {
34+ printf("Failed to bind to address\n");
35+ goto out;
36+ }
37+
38+ ret = listen(sd, 5);
39+ if (ret < 0) {
40+ printf("Failed to listen on port\n");
41+ goto out;
42+ }
43+
44+ daddr.sin_family = AF_INET;
45+ daddr.sin_addr.s_addr = inet_addr(argv[4]);
46+ daddr.sin_port = htons(atoi(argv[5]));
47+
48+ /* make test shorter than 25s */
49+ ret = setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
50+ if (ret < 0) {
51+ printf("Failed to setsockopt SO_RCVTIMEO\n");
52+ goto out;
53+ }
54+
55+ if (!strcmp(argv[1], "server")) {
56+ sleep(1); /* wait a bit for client's INIT */
57+ ret = connect(sd, (struct sockaddr *)&daddr, len);
58+ if (ret < 0) {
59+ printf("Failed to connect to peer\n");
60+ goto out;
61+ }
62+ ret = recvfrom(sd, buf, sizeof(buf), 0, (struct sockaddr *)&daddr, &len);
63+ if (ret < 0) {
64+ printf("Failed to recv msg %d\n", ret);
65+ goto out;
66+ }
67+ ret = sendto(sd, buf, strlen(buf) + 1, 0, (struct sockaddr *)&daddr, len);
68+ if (ret < 0) {
69+ printf("Failed to send msg %d\n", ret);
70+ goto out;
71+ }
72+ printf("Server: sent! %d\n", ret);
73+ }
74+
75+ if (!strcmp(argv[1], "client")) {
76+ usleep(300000); /* wait a bit for server's listening */
77+ ret = connect(sd, (struct sockaddr *)&daddr, len);
78+ if (ret < 0) {
79+ printf("Failed to connect to peer\n");
80+ goto out;
81+ }
82+ sleep(1); /* wait a bit for server's delayed INIT_ACK to reproduce the issue */
83+ ret = sendto(sd, buf, strlen(buf) + 1, 0, (struct sockaddr *)&daddr, len);
84+ if (ret < 0) {
85+ printf("Failed to send msg %d\n", ret);
86+ goto out;
87+ }
88+ ret = recvfrom(sd, buf, sizeof(buf), 0, (struct sockaddr *)&daddr, &len);
89+ if (ret < 0) {
90+ printf("Failed to recv msg %d\n", ret);
91+ goto out;
92+ }
93+ printf("Client: rcvd! %d\n", ret);
94+ }
95+ ret = 0;
96+out:
97+ close(sd);
98+ return ret;
99+}
tools/testing/selftests/riscv/mm/Makefile+3−3
@@ -5,11 +5,11 @@ · 4 unmodified lines
55 # Additional include paths needed by kselftest.h and local headers
66 CFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
77
8−TEST_GEN_FILES := testcases/mmap_default testcases/mmap_bottomup
8+TEST_GEN_FILES := mmap_default mmap_bottomup
99
10−TEST_PROGS := testcases/run_mmap.sh
10+TEST_PROGS := run_mmap.sh
1111
1212 include ../../lib.mk
1313
14−$(OUTPUT)/mm: testcases/mmap_default.c testcases/mmap_bottomup.c testcases/mmap_tests.h
14+$(OUTPUT)/mm: mmap_default.c mmap_bottomup.c mmap_tests.h
1515 $(CC) -o$@ $(CFLAGS) $(LDFLAGS) $^
tools/testing/selftests/riscv/mm/mmap_bottomup.crenamed from tools/testing/selftests/riscv/mm/testcases/mmap_bottomup.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 #include <sys/mman.h>
3−#include <testcases/mmap_test.h>
3+#include <mmap_test.h>
44
55 #include "../../kselftest_harness.h"
66
tools/testing/selftests/riscv/mm/mmap_default.crenamed from tools/testing/selftests/riscv/mm/testcases/mmap_default.c+1−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 #include <sys/mman.h>
3−#include <testcases/mmap_test.h>
3+#include <mmap_test.h>
44
55 #include "../../kselftest_harness.h"
66
tools/testing/selftests/riscv/mm/mmap_test.hrenamed from tools/testing/selftests/riscv/mm/testcases/mmap_test.h+0−0

File renamed without changes.

tools/testing/selftests/riscv/mm/run_mmap.shrenamed from tools/testing/selftests/riscv/mm/testcases/run_mmap.sh+0−0

File renamed without changes.

tools/tracing/rtla/src/timerlat_aa.c+26−6
@@ -159,6 +159,7 @@ static int timerlat_aa_irq_latency(struct timerlat_aa_data *taa_data, · 158 unmodified lines
159159 taa_data->thread_nmi_sum = 0;
160160 taa_data->thread_irq_sum = 0;
161161 taa_data->thread_softirq_sum = 0;
162+ taa_data->thread_thread_sum = 0;
162163 taa_data->thread_blocking_duration = 0;
163164 taa_data->timer_irq_start_time = 0;
164165 taa_data->timer_irq_duration = 0;
@@ -337,7 +338,23 @@ static int timerlat_aa_irq_handler(struct trace_seq *s, struct tep_record *recor · 172 unmodified lines
337338 taa_data->timer_irq_start_time = start;
338339 taa_data->timer_irq_duration = duration;
339340
340− taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start;
341+ /*
342+ * We are dealing with two different clock sources: the
343+ * external clock source that timerlat uses as a reference
344+ * and the clock used by the tracer. There are also two
345+ * moments: the time reading the clock and the timer in
346+ * which the event is placed in the buffer (the trace
347+ * event timestamp). If the processor is slow or there
348+ * is some hardware noise, the difference between the
349+ * timestamp and the external clock read can be longer
350+ * than the IRQ handler delay, resulting in a negative
351+ * time. If so, set IRQ start delay as 0. In the end,
352+ * it is less relevant than the noise.
353+ */
354+ if (expected_start < taa_data->timer_irq_start_time)
355+ taa_data->timer_irq_start_delay = taa_data->timer_irq_start_time - expected_start;
356+ else
357+ taa_data->timer_irq_start_delay = 0;
341358
342359 /*
343360 * not exit from idle.
@@ -528,7 +545,7 @@ static int timerlat_aa_kworker_start_handler(struct trace_seq *s, struct tep_rec · 184 unmodified lines
528545 static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu,
529546 int irq_thresh, int thread_thresh)
530547 {
531− unsigned long long exp_irq_ts;
548+ long long exp_irq_ts;
532549 int total;
533550 int irq;
534551
@@ -545,12 +562,15 @@ static void timerlat_thread_analysis(struct timerlat_aa_data *taa_data, int cpu, · 10 unmodified lines
545562
546563 /*
547564 * Expected IRQ arrival time using the trace clock as the base.
565+ *
566+ * TODO: Add a list of previous IRQ, and then run the list backwards.
548567 */
549568 exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay;
550−
551− if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration)
552− printf(" Previous IRQ interference: \t\t up to %9.2f us\n",
553− ns_to_usf(taa_data->prev_irq_duration));
569+ if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) {
570+ if (taa_data->prev_irq_timstamp < taa_data->timer_irq_start_time)
571+ printf(" Previous IRQ interference: \t\t up to %9.2f us\n",
572+ ns_to_usf(taa_data->prev_irq_duration));
573+ }
554574
555575 /*
556576 * The delay that the IRQ suffered before starting.
tools/tracing/rtla/src/timerlat_u.c+4−2
@@ -45,7 +45,7 @@ static int timerlat_u_main(int cpu, struct timerlat_u_params *params) · 44 unmodified lines
4545
4646 retval = sched_setaffinity(gettid(), sizeof(set), &set);
4747 if (retval == -1) {
48− err_msg("Error setting user thread affinity\n");
48+ debug_msg("Error setting user thread affinity %d, is the CPU online?\n", cpu);
4949 exit(1);
5050 }
5151
@@ -193,7 +193,9 @@ void *timerlat_u_dispatcher(void *data) · 141 unmodified lines
193193 procs_count--;
194194 }
195195 }
196− break;
196+
197+ if (!procs_count)
198+ break;
197199 }
198200
199201 sleep(1);

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