History

Merge 5.17-rc6 into usb-next

We need the USB fixes in here, and it resolves a merge conflict in: drivers/usb/dwc3/dwc3-pci.c

Greg Kroah-Hartman committed 4 years ago

Commit ca9400e2 parents f6a9a2d 7e57714509 files · +4152 −2585Browse files

Unified · Split

509 files
  1. .mailmap +3 −0
  2. Documentation/ABI/testing/sysfs-class-power +1 −0
  3. Documentation/core-api/dma-attributes.rst +8 −0
  4. Documentation/cpu-freq/cpu-drivers.rst +3 −0
  5. Documentation/devicetree/bindings/gpio/sifive,gpio.yaml +0 −1
  6. Documentation/devicetree/bindings/mfd/ti,j721e-system-controller.yaml +1 −1
  7. Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml +1 −1
  8. Documentation/devicetree/bindings/pwm/pwm-sifive.yaml +0 −1
  9. Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml +0 −1
  10. Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml +1 −0
  11. Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml +1 −1
  12. Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml +1 −1
  13. Documentation/tools/rtla/common_hist_options.rst +1 −1
  14. Documentation/tools/rtla/common_osnoise_description.rst +1 −1
  15. Documentation/tools/rtla/rtla-osnoise-hist.rst +1 −1
  16. Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst +2 −0
  17. Documentation/virt/kvm/api.rst +15 −1
  18. MAINTAINERS +26 −26
  19. Makefile +1 −1
  20. arch/arm64/include/asm/el2_setup.h +1 −1
  21. arch/arm64/kvm/vgic/vgic-mmio.c +2 −0
  22. arch/parisc/include/asm/bitops.h +8 −0
  23. arch/parisc/include/asm/uaccess.h +15 −14
  24. arch/parisc/kernel/unaligned.c +7 −7
  25. arch/parisc/lib/iomap.c +18 −0
  26. arch/parisc/mm/init.c +4 −5
  27. arch/powerpc/kernel/head_book3s_32.S +2 −2
  28. arch/powerpc/lib/sstep.c +2 −0
  29. arch/riscv/configs/nommu_k210_sdcard_defconfig +1 −1
  30. arch/riscv/kernel/Makefile +2 −0
  31. arch/riscv/kernel/entry.S +5 −5
  32. arch/riscv/kernel/sbi.c +47 −25
  33. arch/riscv/kernel/trace_irq.c +27 −0
  34. arch/riscv/kernel/trace_irq.h +11 −0
  35. arch/x86/include/asm/kvm_host.h +0 −1
  36. arch/x86/include/asm/msr-index.h +1 −0
  37. arch/x86/include/asm/svm.h +36 −0
  38. arch/x86/kernel/cpu/sgx/main.c +1 −9
  39. arch/x86/kernel/fpu/regset.c +4 −5
  40. arch/x86/kernel/fpu/xstate.c +4 −1
  41. arch/x86/kernel/kvm.c +6 −3
  42. arch/x86/kernel/ptrace.c +2 −2
  43. arch/x86/kvm/cpuid.c +4 −1
  44. arch/x86/kvm/lapic.c +6 −1
  45. arch/x86/kvm/mmu/mmu.c +12 −1
  46. arch/x86/kvm/pmu.c +4 −3
  47. arch/x86/kvm/svm/avic.c +23 −70
  48. arch/x86/kvm/svm/nested.c +14 −12
  49. arch/x86/kvm/svm/svm.c +89 −15
  50. arch/x86/kvm/svm/svm.h +3 −12
  51. arch/x86/kvm/vmx/vmx.c +1 −0
  52. arch/x86/kvm/x86.c +28 −6
  53. arch/x86/kvm/xen.c +67 −30
  54. block/bfq-iosched.c +2 −0
  55. block/blk-core.c +2 −8
  56. block/blk-map.c +1 −1
  57. block/blk-mq.c +4 −0
  58. block/elevator.c +0 −2
  59. block/fops.c +2 −0
  60. block/genhd.c +14 −0
  61. crypto/af_alg.c +0 −3
  62. drivers/acpi/processor_idle.c +5 −0
  63. drivers/acpi/tables.c +1 −1
  64. drivers/ata/pata_hpt37x.c +16 −2
  65. drivers/base/dd.c +5 −0
  66. drivers/base/regmap/regmap-irq.c +6 −14
  67. drivers/block/loop.c +7 −1
  68. drivers/block/mtip32xx/mtip32xx.c +1 −1
  69. drivers/block/rbd.c +1 −1
  70. drivers/block/xen-blkfront.c +1 −1
  71. drivers/clk/ingenic/jz4725b-cgu.c +1 −2
  72. drivers/clk/qcom/gcc-msm8994.c +9 −97
  73. drivers/cpufreq/cpufreq.c +4 −0
  74. drivers/cpufreq/qcom-cpufreq-hw.c +10 −1
  75. drivers/dma/at_xdmac.c +3 −1
  76. drivers/dma/ptdma/ptdma-dev.c +9 −8
  77. drivers/dma/sh/rcar-dmac.c +7 −2
  78. drivers/dma/sh/shdma-base.c +3 −1
  79. drivers/dma/stm32-dmamux.c +3 −1
  80. drivers/edac/edac_mc.c +1 −1
  81. drivers/gpio/gpio-rockchip.c +29 −27
  82. drivers/gpio/gpio-tegra186.c +10 −4
  83. drivers/gpio/gpiolib.c +10 −0
  84. drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +1 −1
  85. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 −0
  86. drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +1 −2
  87. drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +7 −2
  88. drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +8 −0
  89. drivers/gpu/drm/amd/amdgpu/soc15.c +6 −3
  90. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +9 −8
  91. drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c +2 −0
  92. drivers/gpu/drm/amd/display/dc/core/dc.c +5 −2
  93. drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 −4
  94. drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +52 −6
  95. drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.h +8 −0
  96. drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +2 −7
  97. drivers/gpu/drm/drm_atomic_uapi.c +8 −6
  98. drivers/gpu/drm/drm_edid.c +1 −1
  99. drivers/gpu/drm/drm_gem_cma_helper.c +1 −0
  100. drivers/gpu/drm/i915/Kconfig +1 −0
  101. drivers/gpu/drm/i915/display/intel_bw.c +16 −2
  102. drivers/gpu/drm/i915/display/intel_bw.h +4 −4
  103. drivers/gpu/drm/i915/display/intel_fbc.c +2 −1
  104. drivers/gpu/drm/i915/display/intel_opregion.c +15 −0
  105. drivers/gpu/drm/i915/display/intel_snps_phy.c +1 −1
  106. drivers/gpu/drm/i915/display/intel_tc.c +20 −6
  107. drivers/gpu/drm/i915/gem/i915_gem_ttm.c +2 −4
  108. drivers/gpu/drm/i915/gvt/gtt.c +2 −2
  109. drivers/gpu/drm/i915/intel_pm.c +13 −13
  110. drivers/gpu/drm/imx/dcss/Kconfig +1 −0
  111. drivers/gpu/drm/mediatek/mtk_dsi.c +84 −83
  112. drivers/gpu/drm/radeon/atombios_encoders.c +2 −1
  113. drivers/gpu/drm/radeon/radeon_uvd.c +4 −4
  114. drivers/gpu/drm/tegra/Kconfig +1 −0
  115. drivers/gpu/drm/tegra/dpaux.c +7 −0
  116. drivers/gpu/drm/tegra/falcon.c +1 −1
  117. drivers/gpu/drm/vc4/vc4_crtc.c +5 −3
  118. drivers/gpu/drm/vc4/vc4_hdmi.c +8 −0
  119. drivers/gpu/drm/vc4/vc4_hdmi.h +1 −0
  120. drivers/gpu/host1x/syncpt.c +10 −25
  121. drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +73 −3
  122. drivers/hid/amd-sfh-hid/amd_sfh_pcie.h +3 −1
  123. drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c +3 −1
  124. drivers/hid/hid-apple.c +8 −8
  125. drivers/hid/hid-elo.c +1 −0
  126. drivers/hid/hid-ids.h +1 −0
  127. drivers/hid/hid-quirks.c +1 −0
  128. drivers/hid/i2c-hid/i2c-hid-of-goodix.c +12 −16
  129. drivers/hv/hv_utils_transport.c +1 −1
  130. drivers/hv/vmbus_drv.c +6 −3
  131. drivers/hwmon/hwmon.c +8 −6
  132. drivers/hwmon/ntc_thermistor.c +1 −1
  133. drivers/hwmon/pmbus/pmbus_core.c +5 −0
  134. drivers/i2c/busses/Kconfig +3 −3
  135. drivers/i2c/busses/i2c-bcm2835.c +11 −0
  136. drivers/i2c/busses/i2c-brcmstb.c +1 −1
  137. drivers/i2c/busses/i2c-qcom-cci.c +11 −5
  138. drivers/iio/accel/bmc150-accel-core.c +4 −1
  139. drivers/iio/accel/fxls8962af-core.c +10 −2
  140. drivers/iio/accel/fxls8962af-i2c.c +1 −1
  141. drivers/iio/accel/fxls8962af-spi.c +1 −1
  142. drivers/iio/accel/fxls8962af.h +2 −1
  143. drivers/iio/accel/kxcjk-1013.c +4 −1
  144. drivers/iio/accel/mma9551.c +4 −1
  145. drivers/iio/accel/mma9553.c +4 −1
  146. drivers/iio/adc/ad7124.c +1 −1
  147. drivers/iio/adc/men_z188_adc.c +8 −1
  148. drivers/iio/adc/ti-tsc2046.c +2 −2
  149. drivers/iio/addac/ad74413r.c +8 −9
  150. drivers/iio/frequency/admv1013.c +1 −1
  151. drivers/iio/gyro/bmg160_core.c +4 −1
  152. drivers/iio/imu/adis16480.c +6 −1
  153. drivers/iio/imu/kmx61.c +4 −1
  154. drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +5 −1
  155. drivers/iio/magnetometer/bmc150_magn.c +3 −2
  156. drivers/infiniband/core/cma.c +24 −16
  157. drivers/infiniband/hw/qib/qib_sysfs.c +1 −1
  158. drivers/infiniband/ulp/rtrs/rtrs-clt.c +21 −18
  159. drivers/infiniband/ulp/srp/ib_srp.c +4 −2
  160. drivers/input/input.c +6 −0
  161. drivers/input/mouse/psmouse-smbus.c +10 −0
  162. drivers/input/touchscreen/zinitix.c +12 −0
  163. drivers/md/dm.c +1 −1
  164. drivers/mmc/core/block.c +14 −14
  165. drivers/mtd/devices/phram.c +8 −4
  166. drivers/mtd/mtdcore.c +2 −0
  167. drivers/mtd/nand/raw/Kconfig +2 −1
  168. drivers/mtd/nand/raw/brcmnand/brcmnand.c +1 −1
  169. drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2 −1
  170. drivers/mtd/nand/raw/ingenic/ingenic_ecc.c +6 −1
  171. drivers/mtd/nand/raw/qcom_nandc.c +6 −8
  172. drivers/mtd/parsers/qcomsmempart.c +23 −13
  173. drivers/net/bonding/bond_3ad.c +25 −5
  174. drivers/net/bonding/bond_main.c +2 −3
  175. drivers/net/dsa/Kconfig +1 −0
  176. drivers/net/dsa/lan9303-core.c +10 −3
  177. drivers/net/dsa/lantiq_gswip.c +1 −1
  178. drivers/net/dsa/microchip/ksz_common.c +23 −3
  179. drivers/net/dsa/mv88e6xxx/chip.c +7 −0
  180. drivers/net/ethernet/atheros/atl1c/atl1c_main.c +1 −1
  181. drivers/net/ethernet/broadcom/bgmac-platform.c +16 −7
  182. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +3 −0
  183. drivers/net/ethernet/broadcom/bnxt/bnxt.c +35 −12
  184. drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 −0
  185. drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +31 −8
  186. drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +13 −4
  187. drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +9 −3
  188. drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +1 −1
  189. drivers/net/ethernet/faraday/ftgmac100.c +129 −114
  190. drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +1 −1
  191. drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c +3 −1
  192. drivers/net/ethernet/ibm/ibmvnic.c +5 −1
  193. drivers/net/ethernet/intel/i40e/i40e_main.c +1 −11
  194. drivers/net/ethernet/intel/ice/ice.h +0 −1
  195. drivers/net/ethernet/intel/ice/ice_common.c +1 −1
  196. drivers/net/ethernet/intel/ice/ice_eswitch.c +1 −0
  197. drivers/net/ethernet/intel/ice/ice_lib.c +6 −0
  198. drivers/net/ethernet/intel/ice/ice_main.c +2 −0
  199. drivers/net/ethernet/intel/ice/ice_protocol_type.h +1 −0
  200. drivers/net/ethernet/intel/ice/ice_ptp.c +4 −1
  201. drivers/net/ethernet/intel/ice/ice_switch.c +3 −1
  202. drivers/net/ethernet/intel/ice/ice_tc_lib.c +2 −2
  203. drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +25 −17
  204. drivers/net/ethernet/marvell/mv643xx_eth.c +14 −10
  205. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +3 −3
  206. drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h +2 −0
  207. drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c +7 −0
  208. drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c +6 −0
  209. drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c +11 −0
  210. drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h +1 −0
  211. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +3 −0
  212. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c +13 −20
  213. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +1 −1
  214. drivers/net/ethernet/mellanox/mlx5/core/en_rep.h +8 −0
  215. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +2 −1
  216. drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +1 −0
  217. drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +3 −3
  218. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +12 −0
  219. drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +1 −1
  220. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +0 −4
  221. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +2 −0
  222. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +3 −0
  223. drivers/net/ethernet/mellanox/mlx5/core/main.c +3 −1
  224. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c +81 −39
  225. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c +4 −16
  226. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c +31 −1
  227. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +10 −0
  228. drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +26 −7
  229. drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h +5 −0
  230. drivers/net/ethernet/mscc/ocelot.c +5 −1
  231. drivers/net/ethernet/netronome/nfp/flower/cmsg.h +2 −0
  232. drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +2 −2
  233. drivers/net/ethernet/xilinx/ll_temac_main.c +2 −0
  234. drivers/net/hamradio/6pack.c +2 −2
  235. drivers/net/ieee802154/ca8210.c +2 −2
  236. drivers/net/mctp/mctp-serial.c +8 −1
  237. drivers/net/mdio/mdio-ipq4019.c +5 −1
  238. drivers/net/netdevsim/fib.c +2 −2
  239. drivers/net/phy/mediatek-ge.c +0 −3
  240. drivers/net/usb/cdc_ether.c +12 −0
  241. drivers/net/usb/cdc_mbim.c +5 −0
  242. drivers/net/usb/cdc_ncm.c +4 −4
  243. drivers/net/usb/sr9700.c +1 −1
  244. drivers/net/usb/zaurus.c +12 −0
  245. drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +4 −2
  246. drivers/net/wireless/intel/iwlwifi/Kconfig +0 −13
  247. drivers/net/wireless/intel/iwlwifi/fw/acpi.c +6 −5
  248. drivers/net/wireless/intel/iwlwifi/fw/api/commands.h +0 −5
  249. drivers/net/wireless/intel/iwlwifi/fw/api/filter.h +0 −88
  250. drivers/net/wireless/intel/iwlwifi/fw/api/rs.h +0 −1
  251. drivers/net/wireless/intel/iwlwifi/fw/file.h +0 −2
  252. drivers/net/wireless/intel/iwlwifi/fw/rs.c +18 −15
  253. drivers/net/wireless/intel/iwlwifi/iwl-csr.h +2 −1
  254. drivers/net/wireless/intel/iwlwifi/iwl-drv.c +2 −0
  255. drivers/net/wireless/intel/iwlwifi/mei/main.c +34 −11
  256. drivers/net/wireless/intel/iwlwifi/mei/net.c +1 −2
  257. drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +0 −203
  258. drivers/net/wireless/intel/iwlwifi/mvm/fw.c +1 −1
  259. drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +0 −240
  260. drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +1 −14
  261. drivers/net/wireless/intel/iwlwifi/mvm/ops.c +0 −1
  262. drivers/net/wireless/intel/iwlwifi/mvm/tx.c +1 −1
  263. drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c +1 −2
  264. drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 −2
  265. drivers/net/wireless/mac80211_hwsim.c +13 −0
  266. drivers/net/xen-netback/xenbus.c +5 −9
  267. drivers/nvme/host/core.c +9 −12
  268. drivers/nvme/host/multipath.c +1 −1
  269. drivers/nvme/host/tcp.c +49 −14
  270. drivers/nvmem/core.c +1 −1
  271. drivers/of/fdt.c +1 −1
  272. drivers/of/unittest.c +8 −8
  273. drivers/parisc/ccio-dma.c +2 −1
  274. drivers/parisc/sba_iommu.c +2 −1
  275. drivers/pci/controller/pci-hyperv.c +11 −2
  276. drivers/pci/controller/pci-mvebu.c +2 −1
  277. drivers/pci/controller/vmd.c +7 −7
  278. drivers/pci/quirks.c +9 −5
  279. drivers/pinctrl/intel/pinctrl-tigerlake.c +0 −1
  280. drivers/pinctrl/pinctrl-k210.c +2 −2
  281. drivers/pinctrl/pinctrl-starfive.c +1 −1
  282. drivers/platform/surface/surface3_power.c +10 −3
  283. drivers/platform/x86/amd-pmc.c +33 −9
  284. drivers/platform/x86/asus-wmi.c +1 −1
  285. drivers/platform/x86/intel/int3472/tps68470_board_data.c +2 −1
  286. drivers/platform/x86/thinkpad_acpi.c +1 −0
  287. drivers/power/supply/bq256xx_charger.c +3 −0
  288. drivers/power/supply/cw2015_battery.c +1 −1
  289. drivers/regulator/core.c +3 −10
  290. drivers/regulator/da9121-regulator.c +6 −10
  291. drivers/scsi/lpfc/lpfc.h +1 −0
  292. drivers/scsi/lpfc/lpfc_attr.c +3 −0
  293. drivers/scsi/lpfc/lpfc_els.c +19 −1
  294. drivers/scsi/lpfc/lpfc_nportdisc.c +3 −2
  295. drivers/scsi/qedi/qedi_fw.c +2 −4
  296. drivers/scsi/ufs/ufshcd.c +1 −1
  297. drivers/soc/mediatek/mtk-scpsys.c +4 −11
  298. drivers/spi/spi-rockchip.c +10 −3
  299. drivers/spi/spi-zynq-qspi.c +3 −0
  300. drivers/staging/fbtft/fb_st7789v.c +2 −0
  301. drivers/thermal/intel/int340x_thermal/int3400_thermal.c +4 −0
  302. drivers/tty/n_gsm.c +39 −22
  303. drivers/tty/n_tty.c +2 −4
  304. drivers/tty/serial/8250/8250_gsc.c +1 −1
  305. drivers/tty/serial/sc16is7xx.c +3 −0
  306. drivers/usb/dwc2/core.h +2 −0
  307. drivers/usb/dwc2/drd.c +4 −2
  308. drivers/usb/dwc3/dwc3-pci.c +17 −3
  309. drivers/usb/dwc3/gadget.c +2 −0
  310. drivers/usb/gadget/function/rndis.c +8 −0
  311. drivers/usb/gadget/function/rndis.h +1 −0
  312. drivers/usb/gadget/udc/udc-xilinx.c +6 −0
  313. drivers/usb/host/xhci.c +19 −9
  314. drivers/usb/serial/ch341.c +0 −1
  315. drivers/usb/serial/option.c +12 −0
  316. drivers/usb/typec/tipd/core.c +4 −3
  317. drivers/vhost/vsock.c +14 −7
  318. fs/btrfs/ctree.h +1 −1
  319. fs/btrfs/extent_map.c +2 −0
  320. fs/btrfs/extent_map.h +8 −0
  321. fs/btrfs/file.c +35 −62
  322. fs/btrfs/inode.c +2 −2
  323. fs/btrfs/ioctl.c +242 −19
  324. fs/btrfs/lzo.c +11 −0
  325. fs/btrfs/send.c +4 −0
  326. fs/btrfs/transaction.c +10 −2
  327. fs/cifs/cifsacl.c +6 −3
  328. fs/cifs/cifsfs.c +1 −0
  329. fs/cifs/fs_context.c +2 −2
  330. fs/cifs/sess.c +6 −5
  331. fs/cifs/xattr.c +2 −0
  332. fs/configfs/dir.c +14 −0
  333. fs/file_table.c +6 −2
  334. fs/io_uring.c +17 −7
  335. fs/namespace.c +30 −0
  336. fs/nfs/dir.c +2 −2
  337. fs/nfs/inode.c +3 −6
  338. fs/nfs/nfs4proc.c +1 −2
  339. fs/tracefs/inode.c +3 −2
  340. fs/xfs/xfs_super.c +5 −2
  341. include/linux/blkdev.h +2 −1
  342. include/linux/bpf.h +4 −5
  343. include/linux/cpufreq.h +3 −0
  344. include/linux/dma-mapping.h +8 −0
  345. include/linux/hyperv.h +1 −0
  346. include/linux/netdevice.h +1 −1
  347. include/linux/nvme-tcp.h +1 −0
  348. include/linux/nvmem-provider.h +3 −1
  349. include/linux/sched/task.h +2 −2
  350. include/linux/slab.h +1 −2
  351. include/linux/trace_events.h +12 −10
  352. include/net/addrconf.h +0 −2
  353. include/net/bond_3ad.h +1 −1
  354. include/net/checksum.h +29 −23
  355. include/net/dsa.h +1 −0
  356. include/net/ip6_fib.h +6 −4
  357. include/net/ipv6.h +4 −1
  358. include/net/netfilter/nf_tables.h +1 −1
  359. include/net/netfilter/nf_tables_offload.h +0 −2
  360. include/net/netns/ipv6.h +2 −1
  361. include/net/sock.h +2 −2
  362. include/uapi/linux/kvm.h +1 −0
  363. kernel/bpf/btf.c +3 −2
  364. kernel/bpf/helpers.c +2 −0
  365. kernel/bpf/syscall.c +3 −0
  366. kernel/cgroup/cgroup-v1.c +4 −2
  367. kernel/cgroup/cgroup.c +14 −0
  368. kernel/cgroup/cpuset.c +7 −5
  369. kernel/cred.c +2 −7
  370. kernel/dma/swiotlb.c +2 −1
  371. kernel/fork.c +20 −10
  372. kernel/locking/lockdep.c +2 −2
  373. kernel/module_decompress.c +2 −0
  374. kernel/sched/core.c +21 −13
  375. kernel/sys.c +14 −6
  376. kernel/trace/ftrace.c +0 −1
  377. kernel/trace/trace.c +6 −4
  378. kernel/trace/trace.h +0 −1
  379. kernel/trace/trace_eprobe.c +7 −9
  380. kernel/trace/trace_events_trigger.c +66 −7
  381. kernel/trace/trace_osnoise.c +32 −21
  382. kernel/trace/trace_probe.c +5 −5
  383. kernel/trace/trace_probe.h +0 −1
  384. kernel/trace/trace_selftest.c +2 −4
  385. kernel/ucount.c +2 −1
  386. lib/iov_iter.c +2 −0
  387. lib/test_kasan.c +4 −1
  388. mm/hugetlb.c +5 −6
  389. mm/memblock.c +8 −2
  390. mm/mmap.c +1 −0
  391. mm/mprotect.c +1 −1
  392. net/bridge/br_multicast.c +4 −0
  393. net/can/j1939/transport.c +1 −1
  394. net/core/drop_monitor.c +9 −2
  395. net/core/filter.c +3 −0
  396. net/core/net-sysfs.c +1 −1
  397. net/core/rtnetlink.c +4 −2
  398. net/core/skbuff.c +3 −3
  399. net/core/sock.c +2 −2
  400. net/dsa/dsa.c +1 −0
  401. net/dsa/dsa_priv.h +0 −1
  402. net/dsa/master.c +6 −1
  403. net/dsa/port.c +22 −7
  404. net/dsa/tag_lan9303.c +7 −14
  405. net/ipv4/af_inet.c +4 −1
  406. net/ipv4/fib_frontend.c +3 −0
  407. net/ipv4/fib_lookup.h +3 −4
  408. net/ipv4/fib_semantics.c +3 −3
  409. net/ipv4/fib_trie.c +13 −9
  410. net/ipv4/ip_output.c +1 −1
  411. net/ipv4/ping.c +8 −2
  412. net/ipv4/route.c +2 −2
  413. net/ipv4/udp_tunnel_nic.c +1 −1
  414. net/ipv6/addrconf.c +4 −2
  415. net/ipv6/ip6_flowlabel.c +3 −1
  416. net/ipv6/ip6_offload.c +2 −0
  417. net/ipv6/ip6_output.c +1 −1
  418. net/ipv6/mcast.c +1 −1
  419. net/ipv6/route.c +10 −9
  420. net/mac80211/mlme.c +21 −8
  421. net/mctp/route.c +6 −5
  422. net/mptcp/mib.c +2 −0
  423. net/mptcp/mib.h +2 −0
  424. net/mptcp/pm.c +6 −2
  425. net/mptcp/pm_netlink.c +24 −5
  426. net/netfilter/nf_tables_api.c +12 −4
  427. net/netfilter/nf_tables_offload.c +2 −1
  428. net/netfilter/nft_dup_netdev.c +6 −0
  429. net/netfilter/nft_fwd_netdev.c +6 −0
  430. net/netfilter/nft_immediate.c +11 −1
  431. net/netfilter/nft_limit.c +18 −0
  432. net/netfilter/nft_synproxy.c +3 −1
  433. net/netfilter/xt_socket.c +3 −1
  434. net/openvswitch/actions.c +38 −8
  435. net/sched/act_api.c +11 −4
  436. net/sched/act_ct.c +0 −5
  437. net/sched/cls_api.c +3 −3
  438. net/sched/sch_api.c +12 −10
  439. net/sched/sch_generic.c +16 −13
  440. net/smc/af_smc.c +7 −3
  441. net/smc/smc_pnet.c +21 −21
  442. net/smc/smc_pnet.h +1 −1
  443. net/socket.c +2 −2
  444. net/tipc/crypto.c +1 −1
  445. net/tipc/name_table.c +1 −1
  446. net/tipc/node.c +7 −6
  447. net/tipc/socket.c +1 −1
  448. net/vmw_vsock/af_vsock.c +1 −0
  449. net/wireless/core.c +4 −13
  450. security/selinux/ima.c +2 −2
  451. sound/core/memalloc.c +10 −5
  452. sound/pci/hda/hda_intel.c +4 −2
  453. sound/pci/hda/patch_realtek.c +25 −15
  454. sound/soc/amd/acp/acp-mach.h +0 −1
  455. sound/soc/amd/acp/acp-sof-mach.c +2 −2
  456. sound/soc/codecs/rt5668.c +7 −5
  457. sound/soc/codecs/rt5682.c +7 −5
  458. sound/soc/codecs/rt5682s.c +7 −5
  459. sound/soc/codecs/tas2770.c +6 −1
  460. sound/soc/codecs/wm_adsp.c +2 −1
  461. sound/soc/intel/skylake/skl.c +1 −0
  462. sound/soc/qcom/lpass-platform.c +4 −4
  463. sound/soc/soc-ops.c +31 −10
  464. sound/soc/sof/intel/hda.c +1 −0
  465. sound/usb/implicit.c +2 −2
  466. sound/usb/mixer.c +3 −6
  467. tools/arch/x86/include/asm/msr-index.h +1 −0
  468. tools/cgroup/memcg_slabinfo.py +15 −15
  469. tools/include/uapi/linux/kvm.h +1 −0
  470. tools/include/uapi/linux/perf_event.h +2 −0
  471. tools/lib/perf/include/internal/cpumap.h +1 −5
  472. tools/lib/perf/include/perf/cpumap.h +5 −0
  473. tools/lib/perf/libperf.map +1 −0
  474. tools/lib/perf/tests/test-cpumap.c +11 −0
  475. tools/lib/perf/tests/test-evlist.c +3 −2
  476. tools/lib/subcmd/subcmd-util.h +2 −9
  477. tools/perf/builtin-script.c +1 −1
  478. tools/perf/builtin-trace.c +18 −5
  479. tools/perf/tests/attr/README +2 −0
  480. tools/perf/tests/attr/test-record-graph-default +2 −0
  481. tools/perf/tests/attr/test-record-graph-default-aarch64 +9 −0
  482. tools/perf/tests/attr/test-record-graph-fp +2 −0
  483. tools/perf/tests/attr/test-record-graph-fp-aarch64 +9 −0
  484. tools/perf/tests/sigtrap.c +1 −14
  485. tools/perf/util/bpf-loader.c +2 −1
  486. tools/perf/util/cs-etm.c +7 −9
  487. tools/perf/util/data.c +3 −4
  488. tools/perf/util/evlist-hybrid.c +2 −2
  489. tools/testing/selftests/bpf/prog_tests/timer_crash.c +32 −0
  490. tools/testing/selftests/bpf/progs/test_sockmap_kern.h +18 −8
  491. tools/testing/selftests/bpf/progs/timer_crash.c +54 −0
  492. tools/testing/selftests/exec/Makefile +2 −2
  493. tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +1 −1
  494. tools/testing/selftests/kvm/Makefile +0 −1
  495. tools/testing/selftests/memfd/memfd_test.c +1 −0
  496. tools/testing/selftests/mount_setattr/mount_setattr_test.c +2 −2
  497. tools/testing/selftests/net/mptcp/diag.sh +37 −7
  498. tools/testing/selftests/net/mptcp/mptcp_join.sh +25 −7
  499. tools/testing/selftests/netfilter/Makefile +1 −1
  500. tools/testing/selftests/netfilter/nft_concat_range.sh +1 −1
  501. tools/testing/selftests/netfilter/nft_fib.sh +1 −0
  502. tools/testing/selftests/netfilter/nft_synproxy.sh +117 −0
  503. tools/testing/selftests/seccomp/Makefile +1 −1
  504. tools/testing/selftests/vm/map_fixed_noreplace.c +37 −12
  505. tools/tracing/rtla/src/osnoise.c +1 −1
  506. tools/tracing/rtla/src/osnoise_hist.c +5 −5
  507. tools/tracing/rtla/src/osnoise_top.c +1 −0
  508. tools/tracing/rtla/src/timerlat_hist.c +5 −5
  509. virt/kvm/kvm_main.c +1 −3
.mailmap+3−0
@@ -333,6 +333,9 @@ Rémi Denis-Courmont <rdenis@simphalempin.com> · 332 unmodified lines
333333 Ricardo Ribalda <ribalda@kernel.org> <ricardo@ribalda.com>
334334 Ricardo Ribalda <ribalda@kernel.org> Ricardo Ribalda Delgado <ribalda@kernel.org>
335335 Ricardo Ribalda <ribalda@kernel.org> <ricardo.ribalda@gmail.com>
336+Roman Gushchin <roman.gushchin@linux.dev> <guro@fb.com>
337+Roman Gushchin <roman.gushchin@linux.dev> <guroan@gmail.com>
338+Roman Gushchin <roman.gushchin@linux.dev> <klamm@yandex-team.ru>
336339 Ross Zwisler <zwisler@kernel.org> <ross.zwisler@linux.intel.com>
337340 Rudolf Marek <R.Marek@sh.cvut.cz>
338341 Rui Saraiva <rmps@joel.ist.utl.pt>
Documentation/ABI/testing/sysfs-class-power+1−0
@@ -468,6 +468,7 @@ Description: · 467 unmodified lines
468468 auto: Charge normally, respect thresholds
469469 inhibit-charge: Do not charge while AC is attached
470470 force-discharge: Force discharge while AC is attached
471+ ================ ====================================
471472
472473 What: /sys/class/power_supply/<supply_name>/technology
473474 Date: May 2007
Documentation/core-api/dma-attributes.rst+8−0
@@ -130,3 +130,11 @@ accesses to DMA buffers in both privileged "supervisor" and unprivileged · 129 unmodified lines
130130 subsystem that the buffer is fully accessible at the elevated privilege
131131 level (and ideally inaccessible or at least read-only at the
132132 lesser-privileged levels).
133+
134+DMA_ATTR_OVERWRITE
135+------------------
136+
137+This is a hint to the DMA-mapping subsystem that the device is expected to
138+overwrite the entire mapped size, thus the caller does not require any of the
139+previous buffer contents to be preserved. This allows bounce-buffering
140+implementations to optimise DMA_FROM_DEVICE transfers.
Documentation/cpu-freq/cpu-drivers.rst+3−0
@@ -75,6 +75,9 @@ And optionally · 74 unmodified lines
7575 .resume - A pointer to a per-policy resume function which is called
7676 with interrupts disabled and _before_ the governor is started again.
7777
78+ .ready - A pointer to a per-policy ready function which is called after
79+ the policy is fully initialized.
80+
7881 .attr - A pointer to a NULL-terminated list of "struct freq_attr" which
7982 allow to export values to sysfs.
8083
Documentation/devicetree/bindings/gpio/sifive,gpio.yaml+0−1
@@ -7,7 +7,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: SiFive GPIO controller
88
99 maintainers:
10− - Yash Shah <yash.shah@sifive.com>
1110 - Paul Walmsley <paul.walmsley@sifive.com>
1211
1312 properties:
Documentation/devicetree/bindings/mfd/ti,j721e-system-controller.yaml+1−1
@@ -20,7 +20,7 @@ description: | · 19 unmodified lines
2020
2121 maintainers:
2222 - Kishon Vijay Abraham I <kishon@ti.com>
23− - Roger Quadros <rogerq@ti.com
23+ - Roger Quadros <rogerq@kernel.org>
2424
2525 properties:
2626 compatible:
Documentation/devicetree/bindings/phy/ti,omap-usb2.yaml+1−1
@@ -8,7 +8,7 @@ title: OMAP USB2 PHY · 7 unmodified lines
88
99 maintainers:
1010 - Kishon Vijay Abraham I <kishon@ti.com>
11− - Roger Quadros <rogerq@ti.com>
11+ - Roger Quadros <rogerq@kernel.org>
1212
1313 properties:
1414 compatible:
Documentation/devicetree/bindings/pwm/pwm-sifive.yaml+0−1
@@ -8,7 +8,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 7 unmodified lines
88 title: SiFive PWM controller
99
1010 maintainers:
11− - Yash Shah <yash.shah@sifive.com>
1211 - Sagar Kadam <sagar.kadam@sifive.com>
1312 - Paul Walmsley <paul.walmsley@sifive.com>
1413
Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml+0−1
@@ -9,7 +9,6 @@ title: SiFive L2 Cache Controller · 8 unmodified lines
99
1010 maintainers:
1111 - Sagar Kadam <sagar.kadam@sifive.com>
12− - Yash Shah <yash.shah@sifive.com>
1312 - Paul Walmsley <paul.walmsley@sifive.com>
1413
1514 description:
Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml+1−0
@@ -8,6 +8,7 @@ title: Audio codec controlled by ChromeOS EC · 7 unmodified lines
88
99 maintainers:
1010 - Cheng-Yi Chiang <cychiang@chromium.org>
11+ - Tzung-Bi Shih <tzungbi@google.com>
1112
1213 description: |
1314 Google's ChromeOS EC codec is a digital mic codec provided by the
Documentation/devicetree/bindings/usb/ti,j721e-usb.yaml+1−1
@@ -7,7 +7,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#" · 6 unmodified lines
77 title: Bindings for the TI wrapper module for the Cadence USBSS-DRD controller
88
99 maintainers:
10− - Roger Quadros <rogerq@ti.com>
10+ - Roger Quadros <rogerq@kernel.org>
1111
1212 properties:
1313 compatible:
Documentation/devicetree/bindings/usb/ti,keystone-dwc3.yaml+1−1
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: TI Keystone Soc USB Controller
88
99 maintainers:
10− - Roger Quadros <rogerq@ti.com>
10+ - Roger Quadros <rogerq@kernel.org>
1111
1212 properties:
1313 compatible:
Documentation/tools/rtla/common_hist_options.rst+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 Set the histogram bucket size (default *1*).
44
5−**-e**, **--entries** *N*
5+**-E**, **--entries** *N*
66
77 Set the number of entries of the histogram (default 256).
88
Documentation/tools/rtla/common_osnoise_description.rst+1−1
@@ -1,7 +1,7 @@
11 The **rtla osnoise** tool is an interface for the *osnoise* tracer. The
22 *osnoise* tracer dispatches a kernel thread per-cpu. These threads read the
33 time in a loop while with preemption, softirq and IRQs enabled, thus
4−allowing all the sources of operating systme noise during its execution.
4+allowing all the sources of operating system noise during its execution.
55 The *osnoise*'s tracer threads take note of the delta between each time
66 read, along with an interference counter of all sources of interference.
77 At the end of each period, the *osnoise* tracer displays a summary of
Documentation/tools/rtla/rtla-osnoise-hist.rst+1−1
@@ -36,7 +36,7 @@ default). The reason for reducing the runtime is to avoid starving the · 35 unmodified lines
3636 **rtla** tool. The tool is also set to run for *one minute*. The output
3737 histogram is set to group outputs in buckets of *10us* and *25* entries::
3838
39− [root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -e 25
39+ [root@f34 ~/]# rtla osnoise hist -P F:1 -c 0-11 -r 900000 -d 1M -b 10 -E 25
4040 # RTLA osnoise histogram
4141 # Time unit is microseconds (us)
4242 # Duration: 0 00:01:00
Documentation/translations/zh_CN/cpu-freq/cpu-drivers.rst+2−0
@@ -84,6 +84,8 @@ CPUfreq核心层注册一个cpufreq_driver结构体。 · 83 unmodified lines
8484 .resume - 一个指向per-policy恢复函数的指针,该函数在关中断且在调节器再一次启动前被
8585 调用。
8686
87+ .ready - 一个指向per-policy准备函数的指针,该函数在策略完全初始化之后被调用。
88+
8789 .attr - 一个指向NULL结尾的"struct freq_attr"列表的指针,该列表允许导出值到
8890 sysfs。
8991
Documentation/virt/kvm/api.rst+15−1
@@ -1394,7 +1394,7 @@ documentation when it pops into existence). · 1393 unmodified lines
13941394 -------------------
13951395
13961396 :Capability: KVM_CAP_ENABLE_CAP
1397−:Architectures: mips, ppc, s390
1397+:Architectures: mips, ppc, s390, x86
13981398 :Type: vcpu ioctl
13991399 :Parameters: struct kvm_enable_cap (in)
14001400 :Returns: 0 on success; -1 on error
@@ -6997,6 +6997,20 @@ indicated by the fd to the VM this is called on. · 5596 unmodified lines
69976997 This is intended to support intra-host migration of VMs between userspace VMMs,
69986998 upgrading the VMM process without interrupting the guest.
69996999
7000+7.30 KVM_CAP_PPC_AIL_MODE_3
7001+-------------------------------
7002+
7003+:Capability: KVM_CAP_PPC_AIL_MODE_3
7004+:Architectures: ppc
7005+:Type: vm
7006+
7007+This capability indicates that the kernel supports the mode 3 setting for the
7008+"Address Translation Mode on Interrupt" aka "Alternate Interrupt Location"
7009+resource that is controlled with the H_SET_MODE hypercall.
7010+
7011+This capability allows a guest kernel to use a better-performance mode for
7012+handling interrupts and system calls.
7013+
70007014 8. Other capabilities.
70017015 ======================
70027016
MAINTAINERS+26−26
@@ -3139,11 +3139,9 @@ W: https://wireless.wiki.kernel.org/en/users/Drivers/ath5k · 3138 unmodified lines
31393139 F: drivers/net/wireless/ath/ath5k/
31403140
31413141 ATHEROS ATH6KL WIRELESS DRIVER
3142−M: Kalle Valo <kvalo@kernel.org>
31433142 L: linux-wireless@vger.kernel.org
3144−S: Supported
3143+S: Orphan
31453144 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath6kl
3146−T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
31473145 F: drivers/net/wireless/ath/ath6kl/
31483146
31493147 ATI_REMOTE2 DRIVER
@@ -4549,6 +4547,7 @@ F: drivers/platform/chrome/ · 1399 unmodified lines
45494547
45504548 CHROMEOS EC CODEC DRIVER
45514549 M: Cheng-Yi Chiang <cychiang@chromium.org>
4550+M: Tzung-Bi Shih <tzungbi@google.com>
45524551 R: Guenter Roeck <groeck@chromium.org>
45534552 S: Maintained
45544553 F: Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
@@ -4914,7 +4913,8 @@ F: kernel/cgroup/cpuset.c · 359 unmodified lines
49144913 CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)
49154914 M: Johannes Weiner <hannes@cmpxchg.org>
49164915 M: Michal Hocko <mhocko@kernel.org>
4917−M: Vladimir Davydov <vdavydov.dev@gmail.com>
4916+M: Roman Gushchin <roman.gushchin@linux.dev>
4917+M: Shakeel Butt <shakeelb@google.com>
49184918 L: cgroups@vger.kernel.org
49194919 L: linux-mm@kvack.org
49204920 S: Maintained
@@ -7012,12 +7012,6 @@ L: linux-edac@vger.kernel.org · 2091 unmodified lines
70127012 S: Maintained
70137013 F: drivers/edac/sb_edac.c
70147014
7015−EDAC-SIFIVE
7016−M: Yash Shah <yash.shah@sifive.com>
7017−L: linux-edac@vger.kernel.org
7018−S: Supported
7019−F: drivers/edac/sifive_edac.c
7020−
70217015 EDAC-SKYLAKE
70227016 M: Tony Luck <tony.luck@intel.com>
70237017 L: linux-edac@vger.kernel.org
@@ -7188,7 +7182,7 @@ F: drivers/net/can/usb/etas_es58x/ · 164 unmodified lines
71887182
71897183 ETHERNET BRIDGE
71907184 M: Roopa Prabhu <roopa@nvidia.com>
7191−M: Nikolay Aleksandrov <nikolay@nvidia.com>
7185+M: Nikolay Aleksandrov <razor@blackwall.org>
71927186 L: bridge@lists.linux-foundation.org (moderated for non-subscribers)
71937187 L: netdev@vger.kernel.org
71947188 S: Maintained
@@ -9264,6 +9258,15 @@ S: Maintained · 2069 unmodified lines
92649258 W: https://github.com/o2genum/ideapad-slidebar
92659259 F: drivers/input/misc/ideapad_slidebar.c
92669260
9261+IDMAPPED MOUNTS
9262+M: Christian Brauner <brauner@kernel.org>
9263+L: linux-fsdevel@vger.kernel.org
9264+S: Maintained
9265+T: git git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
9266+F: Documentation/filesystems/idmappings.rst
9267+F: tools/testing/selftests/mount_setattr/
9268+F: include/linux/mnt_idmapping.h
9269+
92679270 IDT VersaClock 5 CLOCK DRIVER
92689271 M: Luca Ceresoli <luca@lucaceresoli.net>
92699272 S: Maintained
@@ -15147,7 +15150,7 @@ M: Ingo Molnar <mingo@redhat.com> · 5877 unmodified lines
1514715150 M: Arnaldo Carvalho de Melo <acme@kernel.org>
1514815151 R: Mark Rutland <mark.rutland@arm.com>
1514915152 R: Alexander Shishkin <alexander.shishkin@linux.intel.com>
15150−R: Jiri Olsa <jolsa@redhat.com>
15153+R: Jiri Olsa <jolsa@kernel.org>
1515115154 R: Namhyung Kim <namhyung@kernel.org>
1515215155 L: linux-perf-users@vger.kernel.org
1515315156 L: linux-kernel@vger.kernel.org
@@ -15565,6 +15568,7 @@ M: Iurii Zaikin <yzaikin@google.com> · 411 unmodified lines
1556515568 L: linux-kernel@vger.kernel.org
1556615569 L: linux-fsdevel@vger.kernel.org
1556715570 S: Maintained
15571+T: git git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git sysctl-next
1556815572 F: fs/proc/proc_sysctl.c
1556915573 F: include/linux/sysctl.h
1557015574 F: kernel/sysctl-test.c
@@ -15920,6 +15924,7 @@ S: Supported · 349 unmodified lines
1592015924 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath10k
1592115925 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
1592215926 F: drivers/net/wireless/ath/ath10k/
15927+F: Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
1592315928
1592415929 QUALCOMM ATHEROS ATH11K WIRELESS DRIVER
1592515930 M: Kalle Valo <kvalo@kernel.org>
@@ -15927,11 +15932,12 @@ L: ath11k@lists.infradead.org · 1 unmodified line
1592715932 S: Supported
1592815933 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
1592915934 F: drivers/net/wireless/ath/ath11k/
15935+F: Documentation/devicetree/bindings/net/wireless/qcom,ath11k.txt
1593015936
1593115937 QUALCOMM ATHEROS ATH9K WIRELESS DRIVER
15932−M: ath9k-devel@qca.qualcomm.com
15938+M: Toke Høiland-Jørgensen <toke@toke.dk>
1593315939 L: linux-wireless@vger.kernel.org
15934−S: Supported
15940+S: Maintained
1593515941 W: https://wireless.wiki.kernel.org/en/users/Drivers/ath9k
1593615942 F: Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml
1593715943 F: drivers/net/wireless/ath/ath9k/
@@ -16006,14 +16012,6 @@ F: Documentation/devicetree/bindings/misc/qcom,fastrpc.txt · 68 unmodified lines
1600616012 F: drivers/misc/fastrpc.c
1600716013 F: include/uapi/misc/fastrpc.h
1600816014
16009−QUALCOMM GENERIC INTERFACE I2C DRIVER
16010−M: Akash Asthana <akashast@codeaurora.org>
16011−M: Mukesh Savaliya <msavaliy@codeaurora.org>
16012−L: linux-i2c@vger.kernel.org
16013−L: linux-arm-msm@vger.kernel.org
16014−S: Supported
16015−F: drivers/i2c/busses/i2c-qcom-geni.c
16016−
1601716015 QUALCOMM HEXAGON ARCHITECTURE
1601816016 M: Brian Cain <bcain@codeaurora.org>
1601916017 L: linux-hexagon@vger.kernel.org
@@ -16085,8 +16083,8 @@ F: Documentation/devicetree/bindings/mtd/qcom,nandc.yaml · 65 unmodified lines
1608516083 F: drivers/mtd/nand/raw/qcom_nandc.c
1608616084
1608716085 QUALCOMM RMNET DRIVER
16088−M: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
16089−M: Sean Tranchetti <stranche@codeaurora.org>
16086+M: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>
16087+M: Sean Tranchetti <quic_stranche@quicinc.com>
1609016088 L: netdev@vger.kernel.org
1609116089 S: Maintained
1609216090 F: Documentation/networking/device_drivers/cellular/qualcomm/rmnet.rst
@@ -16112,11 +16110,10 @@ F: Documentation/devicetree/bindings/media/*venus* · 19 unmodified lines
1611216110 F: drivers/media/platform/qcom/venus/
1611316111
1611416112 QUALCOMM WCN36XX WIRELESS DRIVER
16115−M: Kalle Valo <kvalo@kernel.org>
16113+M: Loic Poulain <loic.poulain@linaro.org>
1611616114 L: wcn36xx@lists.infradead.org
1611716115 S: Supported
1611816116 W: https://wireless.wiki.kernel.org/en/users/Drivers/wcn36xx
16119−T: git git://github.com/KrasnikovEugene/wcn36xx.git
1612016117 F: drivers/net/wireless/ath/wcn36xx/
1612116118
1612216119 QUANTENNA QTNFMAC WIRELESS DRIVER
@@ -16379,6 +16376,7 @@ F: drivers/watchdog/realtek_otto_wdt.c · 256 unmodified lines
1637916376
1638016377 REALTEK RTL83xx SMI DSA ROUTER CHIPS
1638116378 M: Linus Walleij <linus.walleij@linaro.org>
16379+M: Alvin Šipraga <alsi@bang-olufsen.dk>
1638216380 S: Maintained
1638316381 F: Documentation/devicetree/bindings/net/dsa/realtek-smi.txt
1638416382 F: drivers/net/dsa/realtek-smi*
@@ -17772,8 +17770,10 @@ M: David Rientjes <rientjes@google.com> · 1387 unmodified lines
1777217770 M: Joonsoo Kim <iamjoonsoo.kim@lge.com>
1777317771 M: Andrew Morton <akpm@linux-foundation.org>
1777417772 M: Vlastimil Babka <vbabka@suse.cz>
17773+R: Roman Gushchin <roman.gushchin@linux.dev>
1777517774 L: linux-mm@kvack.org
1777617775 S: Maintained
17776+T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git
1777717777 F: include/linux/sl?b*.h
1777817778 F: mm/sl?b*
1777917779
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 17
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc4
5+EXTRAVERSION = -rc6
66 NAME = Superb Owl
77
88 # *DOCUMENTATION*
arch/arm64/include/asm/el2_setup.h+1−1
@@ -106,7 +106,7 @@ · 105 unmodified lines
106106 msr_s SYS_ICC_SRE_EL2, x0
107107 isb // Make sure SRE is now set
108108 mrs_s x0, SYS_ICC_SRE_EL2 // Read SRE back,
109− tbz x0, #0, 1f // and check that it sticks
109+ tbz x0, #0, .Lskip_gicv3_\@ // and check that it sticks
110110 msr_s SYS_ICH_HCR_EL2, xzr // Reset ICC_HCR_EL2 to defaults
111111 .Lskip_gicv3_\@:
112112 .endm
arch/arm64/kvm/vgic/vgic-mmio.c+2−0
@@ -248,6 +248,8 @@ unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, · 247 unmodified lines
248248 IRQCHIP_STATE_PENDING,
249249 &val);
250250 WARN_RATELIMIT(err, "IRQ %d", irq->host_irq);
251+ } else if (vgic_irq_is_mapped_level(irq)) {
252+ val = vgic_get_phys_line_level(irq);
251253 } else {
252254 val = irq_is_pending(irq);
253255 }
arch/parisc/include/asm/bitops.h+8−0
@@ -12,6 +12,14 @@ · 11 unmodified lines
1212 #include <asm/barrier.h>
1313 #include <linux/atomic.h>
1414
15+/* compiler build environment sanity checks: */
16+#if !defined(CONFIG_64BIT) && defined(__LP64__)
17+#error "Please use 'ARCH=parisc' to build the 32-bit kernel."
18+#endif
19+#if defined(CONFIG_64BIT) && !defined(__LP64__)
20+#error "Please use 'ARCH=parisc64' to build the 64-bit kernel."
21+#endif
22+
1523 /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion
1624 * on use of volatile and __*_bit() (set/clear/change):
1725 * *_bit() want use of volatile.
arch/parisc/include/asm/uaccess.h+15−14
@@ -89,8 +89,8 @@ struct exception_table_entry { · 88 unmodified lines
8989 __asm__("1: " ldx " 0(" sr "%2),%0\n" \
9090 "9:\n" \
9191 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
92− : "=r"(__gu_val), "=r"(__gu_err) \
93− : "r"(ptr), "1"(__gu_err)); \
92+ : "=r"(__gu_val), "+r"(__gu_err) \
93+ : "r"(ptr)); \
9494 \
9595 (val) = (__force __typeof__(*(ptr))) __gu_val; \
9696 }
@@ -123,8 +123,8 @@ struct exception_table_entry { · 26 unmodified lines
123123 "9:\n" \
124124 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
125125 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
126− : "=&r"(__gu_tmp.l), "=r"(__gu_err) \
127− : "r"(ptr), "1"(__gu_err)); \
126+ : "=&r"(__gu_tmp.l), "+r"(__gu_err) \
127+ : "r"(ptr)); \
128128 \
129129 (val) = __gu_tmp.t; \
130130 }
@@ -135,13 +135,12 @@ struct exception_table_entry { · 4 unmodified lines
135135 #define __put_user_internal(sr, x, ptr) \
136136 ({ \
137137 ASM_EXCEPTIONTABLE_VAR(__pu_err); \
138− __typeof__(*(ptr)) __x = (__typeof__(*(ptr)))(x); \
139138 \
140139 switch (sizeof(*(ptr))) { \
141− case 1: __put_user_asm(sr, "stb", __x, ptr); break; \
142− case 2: __put_user_asm(sr, "sth", __x, ptr); break; \
143− case 4: __put_user_asm(sr, "stw", __x, ptr); break; \
144− case 8: STD_USER(sr, __x, ptr); break; \
140+ case 1: __put_user_asm(sr, "stb", x, ptr); break; \
141+ case 2: __put_user_asm(sr, "sth", x, ptr); break; \
142+ case 4: __put_user_asm(sr, "stw", x, ptr); break; \
143+ case 8: STD_USER(sr, x, ptr); break; \
145144 default: BUILD_BUG(); \
146145 } \
147146 \
@@ -150,7 +149,9 @@ struct exception_table_entry { · 2 unmodified lines
150149
151150 #define __put_user(x, ptr) \
152151 ({ \
153− __put_user_internal("%%sr3,", x, ptr); \
152+ __typeof__(&*(ptr)) __ptr = ptr; \
153+ __typeof__(*(__ptr)) __x = (__typeof__(*(__ptr)))(x); \
154+ __put_user_internal("%%sr3,", __x, __ptr); \
154155 })
155156
156157 #define __put_kernel_nofault(dst, src, type, err_label) \
@@ -180,8 +181,8 @@ struct exception_table_entry { · 23 unmodified lines
180181 "1: " stx " %2,0(" sr "%1)\n" \
181182 "9:\n" \
182183 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
183− : "=r"(__pu_err) \
184− : "r"(ptr), "r"(x), "0"(__pu_err))
184+ : "+r"(__pu_err) \
185+ : "r"(ptr), "r"(x))
185186
186187
187188 #if !defined(CONFIG_64BIT)
@@ -193,8 +194,8 @@ struct exception_table_entry { · 5 unmodified lines
193194 "9:\n" \
194195 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
195196 ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
196− : "=r"(__pu_err) \
197− : "r"(ptr), "r"(__val), "0"(__pu_err)); \
197+ : "+r"(__pu_err) \
198+ : "r"(ptr), "r"(__val)); \
198199 } while (0)
199200
200201 #endif /* !defined(CONFIG_64BIT) */
arch/parisc/kernel/unaligned.c+7−7
@@ -340,7 +340,7 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop) · 339 unmodified lines
340340 : "r" (val), "r" (regs->ior), "r" (regs->isr)
341341 : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER );
342342
343− return 0;
343+ return ret;
344344 }
345345 static int emulate_std(struct pt_regs *regs, int frreg, int flop)
346346 {
@@ -397,7 +397,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 50 unmodified lines
397397 __asm__ __volatile__ (
398398 " mtsp %4, %%sr1\n"
399399 " zdep %2, 29, 2, %%r19\n"
400−" dep %%r0, 31, 2, %2\n"
400+" dep %%r0, 31, 2, %3\n"
401401 " mtsar %%r19\n"
402402 " zvdepi -2, 32, %%r19\n"
403403 "1: ldw 0(%%sr1,%3),%%r20\n"
@@ -409,7 +409,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 5 unmodified lines
409409 " andcm %%r21, %%r19, %%r21\n"
410410 " or %1, %%r20, %1\n"
411411 " or %2, %%r21, %2\n"
412−"3: stw %1,0(%%sr1,%1)\n"
412+"3: stw %1,0(%%sr1,%3)\n"
413413 "4: stw %%r1,4(%%sr1,%3)\n"
414414 "5: stw %2,8(%%sr1,%3)\n"
415415 " copy %%r0, %0\n"
@@ -596,7 +596,6 @@ void handle_unaligned(struct pt_regs *regs) · 180 unmodified lines
596596 ret = ERR_NOTHANDLED; /* "undefined", but lets kill them. */
597597 break;
598598 }
599−#ifdef CONFIG_PA20
600599 switch (regs->iir & OPCODE2_MASK)
601600 {
602601 case OPCODE_FLDD_L:
@@ -607,22 +606,23 @@ void handle_unaligned(struct pt_regs *regs) · 4 unmodified lines
607606 flop=1;
608607 ret = emulate_std(regs, R2(regs->iir),1);
609608 break;
609+#ifdef CONFIG_PA20
610610 case OPCODE_LDD_L:
611611 ret = emulate_ldd(regs, R2(regs->iir),0);
612612 break;
613613 case OPCODE_STD_L:
614614 ret = emulate_std(regs, R2(regs->iir),0);
615615 break;
616− }
617616 #endif
617+ }
618618 switch (regs->iir & OPCODE3_MASK)
619619 {
620620 case OPCODE_FLDW_L:
621621 flop=1;
622− ret = emulate_ldw(regs, R2(regs->iir),0);
622+ ret = emulate_ldw(regs, R2(regs->iir), 1);
623623 break;
624624 case OPCODE_LDW_M:
625− ret = emulate_ldw(regs, R2(regs->iir),1);
625+ ret = emulate_ldw(regs, R2(regs->iir), 0);
626626 break;
627627
628628 case OPCODE_FSTW_L:
arch/parisc/lib/iomap.c+18−0
@@ -346,6 +346,16 @@ u64 ioread64be(const void __iomem *addr) · 345 unmodified lines
346346 return *((u64 *)addr);
347347 }
348348
349+u64 ioread64_lo_hi(const void __iomem *addr)
350+{
351+ u32 low, high;
352+
353+ low = ioread32(addr);
354+ high = ioread32(addr + sizeof(u32));
355+
356+ return low + ((u64)high << 32);
357+}
358+
349359 u64 ioread64_hi_lo(const void __iomem *addr)
350360 {
351361 u32 low, high;
@@ -419,6 +429,12 @@ void iowrite64be(u64 datum, void __iomem *addr) · 67 unmodified lines
419429 }
420430 }
421431
432+void iowrite64_lo_hi(u64 val, void __iomem *addr)
433+{
434+ iowrite32(val, addr);
435+ iowrite32(val >> 32, addr + sizeof(u32));
436+}
437+
422438 void iowrite64_hi_lo(u64 val, void __iomem *addr)
423439 {
424440 iowrite32(val >> 32, addr + sizeof(u32));
@@ -530,6 +546,7 @@ EXPORT_SYMBOL(ioread32); · 105 unmodified lines
530546 EXPORT_SYMBOL(ioread32be);
531547 EXPORT_SYMBOL(ioread64);
532548 EXPORT_SYMBOL(ioread64be);
549+EXPORT_SYMBOL(ioread64_lo_hi);
533550 EXPORT_SYMBOL(ioread64_hi_lo);
534551 EXPORT_SYMBOL(iowrite8);
535552 EXPORT_SYMBOL(iowrite16);
@@ -538,6 +555,7 @@ EXPORT_SYMBOL(iowrite32); · 2 unmodified lines
538555 EXPORT_SYMBOL(iowrite32be);
539556 EXPORT_SYMBOL(iowrite64);
540557 EXPORT_SYMBOL(iowrite64be);
558+EXPORT_SYMBOL(iowrite64_lo_hi);
541559 EXPORT_SYMBOL(iowrite64_hi_lo);
542560 EXPORT_SYMBOL(ioread8_rep);
543561 EXPORT_SYMBOL(ioread16_rep);
arch/parisc/mm/init.c+4−5
@@ -337,9 +337,9 @@ static void __init setup_bootmem(void) · 336 unmodified lines
337337
338338 static bool kernel_set_to_readonly;
339339
340−static void __init map_pages(unsigned long start_vaddr,
341− unsigned long start_paddr, unsigned long size,
342− pgprot_t pgprot, int force)
340+static void __ref map_pages(unsigned long start_vaddr,
341+ unsigned long start_paddr, unsigned long size,
342+ pgprot_t pgprot, int force)
343343 {
344344 pmd_t *pmd;
345345 pte_t *pg_table;
@@ -449,7 +449,7 @@ void __init set_kernel_text_rw(int enable_read_write) · 103 unmodified lines
449449 flush_tlb_all();
450450 }
451451
452−void __ref free_initmem(void)
452+void free_initmem(void)
453453 {
454454 unsigned long init_begin = (unsigned long)__init_begin;
455455 unsigned long init_end = (unsigned long)__init_end;
@@ -463,7 +463,6 @@ void __ref free_initmem(void) · 7 unmodified lines
463463 /* The init text pages are marked R-X. We have to
464464 * flush the icache and mark them RW-
465465 *
466− * This is tricky, because map_pages is in the init section.
467466 * Do a dummy remap of the data section first (the data
468467 * section is already PAGE_KERNEL) to pull in the TLB entries
469468 * for map_kernel */
arch/powerpc/kernel/head_book3s_32.S+2−2
@@ -421,14 +421,14 @@ InstructionTLBMiss: · 420 unmodified lines
421421 */
422422 /* Get PTE (linux-style) and check access */
423423 mfspr r3,SPRN_IMISS
424−#ifdef CONFIG_MODULES
424+#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
425425 lis r1, TASK_SIZE@h /* check if kernel address */
426426 cmplw 0,r1,r3
427427 #endif
428428 mfspr r2, SPRN_SDR1
429429 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | _PAGE_USER
430430 rlwinm r2, r2, 28, 0xfffff000
431−#ifdef CONFIG_MODULES
431+#if defined(CONFIG_MODULES) || defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_KFENCE)
432432 bgt- 112f
433433 lis r2, (swapper_pg_dir - PAGE_OFFSET)@ha /* if kernel address, use */
434434 li r1,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC
arch/powerpc/lib/sstep.c+2−0
@@ -3264,12 +3264,14 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op) · 3263 unmodified lines
32643264 case BARRIER_EIEIO:
32653265 eieio();
32663266 break;
3267+#ifdef CONFIG_PPC64
32673268 case BARRIER_LWSYNC:
32683269 asm volatile("lwsync" : : : "memory");
32693270 break;
32703271 case BARRIER_PTESYNC:
32713272 asm volatile("ptesync" : : : "memory");
32723273 break;
3274+#endif
32733275 }
32743276 break;
32753277
arch/riscv/configs/nommu_k210_sdcard_defconfig+1−1
@@ -23,7 +23,7 @@ CONFIG_SLOB=y · 22 unmodified lines
2323 CONFIG_SOC_CANAAN=y
2424 CONFIG_SMP=y
2525 CONFIG_NR_CPUS=2
26−CONFIG_CMDLINE="earlycon console=ttySIF0 rootdelay=2 root=/dev/mmcblk0p1 ro"
26+CONFIG_CMDLINE="earlycon console=ttySIF0 root=/dev/mmcblk0p1 rootwait ro"
2727 CONFIG_CMDLINE_FORCE=y
2828 # CONFIG_SECCOMP is not set
2929 # CONFIG_STACKPROTECTOR is not set
arch/riscv/kernel/Makefile+2−0
@@ -51,6 +51,8 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o · 50 unmodified lines
5151 obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
5252 obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
5353
54+obj-$(CONFIG_TRACE_IRQFLAGS) += trace_irq.o
55+
5456 obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o
5557 obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
5658 obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
arch/riscv/kernel/entry.S+5−5
@@ -108,7 +108,7 @@ _save_context: · 107 unmodified lines
108108 .option pop
109109
110110 #ifdef CONFIG_TRACE_IRQFLAGS
111− call trace_hardirqs_off
111+ call __trace_hardirqs_off
112112 #endif
113113
114114 #ifdef CONFIG_CONTEXT_TRACKING
@@ -143,7 +143,7 @@ skip_context_tracking: · 28 unmodified lines
143143 li t0, EXC_BREAKPOINT
144144 beq s4, t0, 1f
145145 #ifdef CONFIG_TRACE_IRQFLAGS
146− call trace_hardirqs_on
146+ call __trace_hardirqs_on
147147 #endif
148148 csrs CSR_STATUS, SR_IE
149149
@@ -234,7 +234,7 @@ ret_from_exception: · 84 unmodified lines
234234 REG_L s0, PT_STATUS(sp)
235235 csrc CSR_STATUS, SR_IE
236236 #ifdef CONFIG_TRACE_IRQFLAGS
237− call trace_hardirqs_off
237+ call __trace_hardirqs_off
238238 #endif
239239 #ifdef CONFIG_RISCV_M_MODE
240240 /* the MPP value is too large to be used as an immediate arg for addi */
@@ -270,10 +270,10 @@ restore_all: · 29 unmodified lines
270270 REG_L s1, PT_STATUS(sp)
271271 andi t0, s1, SR_PIE
272272 beqz t0, 1f
273− call trace_hardirqs_on
273+ call __trace_hardirqs_on
274274 j 2f
275275 1:
276− call trace_hardirqs_off
276+ call __trace_hardirqs_off
277277 2:
278278 #endif
279279 REG_L a0, PT_STATUS(sp)
arch/riscv/kernel/sbi.c+47−25
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 * Copyright (c) 2020 Western Digital Corporation or its affiliates.
66 */
77
8+#include <linux/bits.h>
89 #include <linux/init.h>
910 #include <linux/pm.h>
1011 #include <linux/reboot.h>
@@ -85,7 +86,7 @@ static unsigned long __sbi_v01_cpumask_to_hartmask(const struct cpumask *cpu_mas · 74 unmodified lines
8586 pr_warn("Unable to send any request to hartid > BITS_PER_LONG for SBI v0.1\n");
8687 break;
8788 }
88− hmask |= 1 << hartid;
89+ hmask |= BIT(hartid);
8990 }
9091
9192 return hmask;
@@ -160,7 +161,7 @@ static int __sbi_send_ipi_v01(const struct cpumask *cpu_mask) · 68 unmodified lines
160161 {
161162 unsigned long hart_mask;
162163
163− if (!cpu_mask)
164+ if (!cpu_mask || cpumask_empty(cpu_mask))
164165 cpu_mask = cpu_online_mask;
165166 hart_mask = __sbi_v01_cpumask_to_hartmask(cpu_mask);
166167
@@ -176,7 +177,7 @@ static int __sbi_rfence_v01(int fid, const struct cpumask *cpu_mask, · 9 unmodified lines
176177 int result = 0;
177178 unsigned long hart_mask;
178179
179− if (!cpu_mask)
180+ if (!cpu_mask || cpumask_empty(cpu_mask))
180181 cpu_mask = cpu_online_mask;
181182 hart_mask = __sbi_v01_cpumask_to_hartmask(cpu_mask);
182183
@@ -249,26 +250,37 @@ static void __sbi_set_timer_v02(uint64_t stime_value) · 66 unmodified lines
249250
250251 static int __sbi_send_ipi_v02(const struct cpumask *cpu_mask)
251252 {
252− unsigned long hartid, cpuid, hmask = 0, hbase = 0;
253+ unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
253254 struct sbiret ret = {0};
254255 int result;
255256
256− if (!cpu_mask)
257+ if (!cpu_mask || cpumask_empty(cpu_mask))
257258 cpu_mask = cpu_online_mask;
258259
259260 for_each_cpu(cpuid, cpu_mask) {
260261 hartid = cpuid_to_hartid_map(cpuid);
261− if (hmask && ((hbase + BITS_PER_LONG) <= hartid)) {
262− ret = sbi_ecall(SBI_EXT_IPI, SBI_EXT_IPI_SEND_IPI,
263− hmask, hbase, 0, 0, 0, 0);
264− if (ret.error)
265− goto ecall_failed;
266− hmask = 0;
267− hbase = 0;
262+ if (hmask) {
263+ if (hartid + BITS_PER_LONG <= htop ||
264+ hbase + BITS_PER_LONG <= hartid) {
265+ ret = sbi_ecall(SBI_EXT_IPI,
266+ SBI_EXT_IPI_SEND_IPI, hmask,
267+ hbase, 0, 0, 0, 0);
268+ if (ret.error)
269+ goto ecall_failed;
270+ hmask = 0;
271+ } else if (hartid < hbase) {
272+ /* shift the mask to fit lower hartid */
273+ hmask <<= hbase - hartid;
274+ hbase = hartid;
275+ }
268276 }
269− if (!hmask)
277+ if (!hmask) {
270278 hbase = hartid;
271− hmask |= 1UL << (hartid - hbase);
279+ htop = hartid;
280+ } else if (hartid > htop) {
281+ htop = hartid;
282+ }
283+ hmask |= BIT(hartid - hbase);
272284 }
273285
274286 if (hmask) {
@@ -344,25 +356,35 @@ static int __sbi_rfence_v02(int fid, const struct cpumask *cpu_mask, · 69 unmodified lines
344356 unsigned long start, unsigned long size,
345357 unsigned long arg4, unsigned long arg5)
346358 {
347− unsigned long hartid, cpuid, hmask = 0, hbase = 0;
359+ unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
348360 int result;
349361
350− if (!cpu_mask)
362+ if (!cpu_mask || cpumask_empty(cpu_mask))
351363 cpu_mask = cpu_online_mask;
352364
353365 for_each_cpu(cpuid, cpu_mask) {
354366 hartid = cpuid_to_hartid_map(cpuid);
355− if (hmask && ((hbase + BITS_PER_LONG) <= hartid)) {
356− result = __sbi_rfence_v02_call(fid, hmask, hbase,
357− start, size, arg4, arg5);
358− if (result)
359− return result;
360− hmask = 0;
361− hbase = 0;
367+ if (hmask) {
368+ if (hartid + BITS_PER_LONG <= htop ||
369+ hbase + BITS_PER_LONG <= hartid) {
370+ result = __sbi_rfence_v02_call(fid, hmask,
371+ hbase, start, size, arg4, arg5);
372+ if (result)
373+ return result;
374+ hmask = 0;
375+ } else if (hartid < hbase) {
376+ /* shift the mask to fit lower hartid */
377+ hmask <<= hbase - hartid;
378+ hbase = hartid;
379+ }
362380 }
363− if (!hmask)
381+ if (!hmask) {
364382 hbase = hartid;
365− hmask |= 1UL << (hartid - hbase);
383+ htop = hartid;
384+ } else if (hartid > htop) {
385+ htop = hartid;
386+ }
387+ hmask |= BIT(hartid - hbase);
366388 }
367389
368390 if (hmask) {
arch/riscv/kernel/trace_irq.c+27−0
@@ -0,0 +1,27 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com>
4+ */
5+
6+#include <linux/irqflags.h>
7+#include <linux/kprobes.h>
8+#include "trace_irq.h"
9+
10+/*
11+ * trace_hardirqs_on/off require the caller to setup frame pointer properly.
12+ * Otherwise, CALLER_ADDR1 might trigger an pagging exception in kernel.
13+ * Here we add one extra level so they can be safely called by low
14+ * level entry code which $fp is used for other purpose.
15+ */
16+
17+void __trace_hardirqs_on(void)
18+{
19+ trace_hardirqs_on();
20+}
21+NOKPROBE_SYMBOL(__trace_hardirqs_on);
22+
23+void __trace_hardirqs_off(void)
24+{
25+ trace_hardirqs_off();
26+}
27+NOKPROBE_SYMBOL(__trace_hardirqs_off);
arch/riscv/kernel/trace_irq.h+11−0
@@ -0,0 +1,11 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * Copyright (C) 2022 Changbin Du <changbin.du@gmail.com>
4+ */
5+#ifndef __TRACE_IRQ_H
6+#define __TRACE_IRQ_H
7+
8+void __trace_hardirqs_on(void);
9+void __trace_hardirqs_off(void);
10+
11+#endif /* __TRACE_IRQ_H */
arch/x86/include/asm/kvm_host.h+0−1
@@ -703,7 +703,6 @@ struct kvm_vcpu_arch { · 702 unmodified lines
703703 struct fpu_guest guest_fpu;
704704
705705 u64 xcr0;
706− u64 guest_supported_xcr0;
707706
708707 struct kvm_pio_request pio;
709708 void *pio_data;
arch/x86/include/asm/msr-index.h+1−0
@@ -476,6 +476,7 @@ · 475 unmodified lines
476476 #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c
477477 #define MSR_AMD64_IBSOPDATA4 0xc001103d
478478 #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
479+#define MSR_AMD64_SVM_AVIC_DOORBELL 0xc001011b
479480 #define MSR_AMD64_VM_PAGE_FLUSH 0xc001011e
480481 #define MSR_AMD64_SEV_ES_GHCB 0xc0010130
481482 #define MSR_AMD64_SEV 0xc0010131
arch/x86/include/asm/svm.h+36−0
@@ -220,6 +220,42 @@ struct __attribute__ ((__packed__)) vmcb_control_area { · 219 unmodified lines
220220 #define SVM_NESTED_CTL_SEV_ENABLE BIT(1)
221221 #define SVM_NESTED_CTL_SEV_ES_ENABLE BIT(2)
222222
223+
224+/* AVIC */
225+#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF)
226+#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31
227+#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31)
228+
229+#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL)
230+#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12)
231+#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62)
232+#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63)
233+#define AVIC_PHYSICAL_ID_TABLE_SIZE_MASK (0xFF)
234+
235+#define AVIC_DOORBELL_PHYSICAL_ID_MASK (0xFF)
236+
237+#define AVIC_UNACCEL_ACCESS_WRITE_MASK 1
238+#define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0
239+#define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF
240+
241+enum avic_ipi_failure_cause {
242+ AVIC_IPI_FAILURE_INVALID_INT_TYPE,
243+ AVIC_IPI_FAILURE_TARGET_NOT_RUNNING,
244+ AVIC_IPI_FAILURE_INVALID_TARGET,
245+ AVIC_IPI_FAILURE_INVALID_BACKING_PAGE,
246+};
247+
248+
249+/*
250+ * 0xff is broadcast, so the max index allowed for physical APIC ID
251+ * table is 0xfe. APIC IDs above 0xff are reserved.
252+ */
253+#define AVIC_MAX_PHYSICAL_ID_COUNT 0xff
254+
255+#define AVIC_HPA_MASK ~((0xFFFULL << 52) | 0xFFF)
256+#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL
257+
258+
223259 struct vmcb_seg {
224260 u16 selector;
225261 u16 attrib;
arch/x86/kernel/cpu/sgx/main.c+1−9
@@ -344,10 +344,8 @@ static void sgx_reclaim_pages(void) · 343 unmodified lines
344344 {
345345 struct sgx_epc_page *chunk[SGX_NR_TO_SCAN];
346346 struct sgx_backing backing[SGX_NR_TO_SCAN];
347− struct sgx_epc_section *section;
348347 struct sgx_encl_page *encl_page;
349348 struct sgx_epc_page *epc_page;
350− struct sgx_numa_node *node;
351349 pgoff_t page_index;
352350 int cnt = 0;
353351 int ret;
@@ -418,13 +416,7 @@ skip: · 64 unmodified lines
418416 kref_put(&encl_page->encl->refcount, sgx_encl_release);
419417 epc_page->flags &= ~SGX_EPC_PAGE_RECLAIMER_TRACKED;
420418
421− section = &sgx_epc_sections[epc_page->section];
422− node = section->node;
423−
424− spin_lock(&node->lock);
425− list_add_tail(&epc_page->list, &node->free_page_list);
426− spin_unlock(&node->lock);
427− atomic_long_inc(&sgx_nr_free_pages);
419+ sgx_free_epc_page(epc_page);
428420 }
429421 }
430422
arch/x86/kernel/fpu/regset.c+4−5
@@ -91,11 +91,9 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, · 90 unmodified lines
9191 const void *kbuf, const void __user *ubuf)
9292 {
9393 struct fpu *fpu = &target->thread.fpu;
94− struct user32_fxsr_struct newstate;
94+ struct fxregs_state newstate;
9595 int ret;
9696
97− BUILD_BUG_ON(sizeof(newstate) != sizeof(struct fxregs_state));
98−
9997 if (!cpu_feature_enabled(X86_FEATURE_FXSR))
10098 return -ENODEV;
10199
@@ -116,9 +114,10 @@ int xfpregs_set(struct task_struct *target, const struct user_regset *regset, · 14 unmodified lines
116114 /* Copy the state */
117115 memcpy(&fpu->fpstate->regs.fxsave, &newstate, sizeof(newstate));
118116
119− /* Clear xmm8..15 */
117+ /* Clear xmm8..15 for 32-bit callers */
120118 BUILD_BUG_ON(sizeof(fpu->__fpstate.regs.fxsave.xmm_space) != 16 * 16);
121− memset(&fpu->fpstate->regs.fxsave.xmm_space[8], 0, 8 * 16);
119+ if (in_ia32_syscall())
120+ memset(&fpu->fpstate->regs.fxsave.xmm_space[8*4], 0, 8 * 16);
122121
123122 /* Mark FP and SSE as in use when XSAVE is enabled */
124123 if (use_xsave())
arch/x86/kernel/fpu/xstate.c+4−1
@@ -1558,7 +1558,10 @@ static int fpstate_realloc(u64 xfeatures, unsigned int ksize, · 1557 unmodified lines
15581558 fpregs_restore_userregs();
15591559
15601560 newfps->xfeatures = curfps->xfeatures | xfeatures;
1561− newfps->user_xfeatures = curfps->user_xfeatures | xfeatures;
1561+
1562+ if (!guest_fpu)
1563+ newfps->user_xfeatures = curfps->user_xfeatures | xfeatures;
1564+
15621565 newfps->xfd = curfps->xfd & ~xfeatures;
15631566
15641567 /* Do the final updates within the locked region */
arch/x86/kernel/kvm.c+6−3
@@ -462,19 +462,22 @@ static bool pv_tlb_flush_supported(void) · 461 unmodified lines
462462 {
463463 return (kvm_para_has_feature(KVM_FEATURE_PV_TLB_FLUSH) &&
464464 !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
465− kvm_para_has_feature(KVM_FEATURE_STEAL_TIME));
465+ kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) &&
466+ (num_possible_cpus() != 1));
466467 }
467468
468469 static bool pv_ipi_supported(void)
469470 {
470− return kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI);
471+ return (kvm_para_has_feature(KVM_FEATURE_PV_SEND_IPI) &&
472+ (num_possible_cpus() != 1));
471473 }
472474
473475 static bool pv_sched_yield_supported(void)
474476 {
475477 return (kvm_para_has_feature(KVM_FEATURE_PV_SCHED_YIELD) &&
476478 !kvm_para_has_hint(KVM_HINTS_REALTIME) &&
477− kvm_para_has_feature(KVM_FEATURE_STEAL_TIME));
479+ kvm_para_has_feature(KVM_FEATURE_STEAL_TIME) &&
480+ (num_possible_cpus() != 1));
478481 }
479482
480483 #define KVM_IPI_CLUSTER_SIZE (2 * BITS_PER_LONG)
arch/x86/kernel/ptrace.c+2−2
@@ -1224,7 +1224,7 @@ static struct user_regset x86_64_regsets[] __ro_after_init = { · 1223 unmodified lines
12241224 },
12251225 [REGSET_FP] = {
12261226 .core_note_type = NT_PRFPREG,
1227− .n = sizeof(struct user_i387_struct) / sizeof(long),
1227+ .n = sizeof(struct fxregs_state) / sizeof(long),
12281228 .size = sizeof(long), .align = sizeof(long),
12291229 .active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set
12301230 },
@@ -1271,7 +1271,7 @@ static struct user_regset x86_32_regsets[] __ro_after_init = { · 40 unmodified lines
12711271 },
12721272 [REGSET_XFP] = {
12731273 .core_note_type = NT_PRXFPREG,
1274− .n = sizeof(struct user32_fxsr_struct) / sizeof(u32),
1274+ .n = sizeof(struct fxregs_state) / sizeof(u32),
12751275 .size = sizeof(u32), .align = sizeof(u32),
12761276 .active = regset_xregset_fpregs_active, .regset_get = xfpregs_get, .set = xfpregs_set
12771277 },
arch/x86/kvm/cpuid.c+4−1
@@ -282,6 +282,7 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 281 unmodified lines
282282 {
283283 struct kvm_lapic *apic = vcpu->arch.apic;
284284 struct kvm_cpuid_entry2 *best;
285+ u64 guest_supported_xcr0;
285286
286287 best = kvm_find_cpuid_entry(vcpu, 1, 0);
287288 if (best && apic) {
@@ -293,9 +294,11 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 5 unmodified lines
293294 kvm_apic_set_version(vcpu);
294295 }
295296
296− vcpu->arch.guest_supported_xcr0 =
297+ guest_supported_xcr0 =
297298 cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent);
298299
300+ vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0;
301+
299302 kvm_update_pv_runtime(vcpu);
300303
301304 vcpu->arch.maxphyaddr = cpuid_query_maxphyaddr(vcpu);
arch/x86/kvm/lapic.c+6−1
@@ -2306,7 +2306,12 @@ void kvm_apic_update_apicv(struct kvm_vcpu *vcpu) · 2305 unmodified lines
23062306 apic->irr_pending = true;
23072307 apic->isr_count = 1;
23082308 } else {
2309− apic->irr_pending = (apic_search_irr(apic) != -1);
2309+ /*
2310+ * Don't clear irr_pending, searching the IRR can race with
2311+ * updates from the CPU as APICv is still active from hardware's
2312+ * perspective. The flag will be cleared as appropriate when
2313+ * KVM injects the interrupt.
2314+ */
23102315 apic->isr_count = count_vectors(apic->regs + APIC_ISR);
23112316 }
23122317 }
arch/x86/kvm/mmu/mmu.c+12−1
@@ -3889,12 +3889,23 @@ static void shadow_page_table_clear_flood(struct kvm_vcpu *vcpu, gva_t addr) · 3888 unmodified lines
38893889 walk_shadow_page_lockless_end(vcpu);
38903890 }
38913891
3892+static u32 alloc_apf_token(struct kvm_vcpu *vcpu)
3893+{
3894+ /* make sure the token value is not 0 */
3895+ u32 id = vcpu->arch.apf.id;
3896+
3897+ if (id << 12 == 0)
3898+ vcpu->arch.apf.id = 1;
3899+
3900+ return (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
3901+}
3902+
38923903 static bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa,
38933904 gfn_t gfn)
38943905 {
38953906 struct kvm_arch_async_pf arch;
38963907
3897− arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id;
3908+ arch.token = alloc_apf_token(vcpu);
38983909 arch.gfn = gfn;
38993910 arch.direct_map = vcpu->arch.mmu->direct_map;
39003911 arch.cr3 = vcpu->arch.mmu->get_guest_pgd(vcpu);
arch/x86/kvm/pmu.c+4−3
@@ -95,7 +95,7 @@ static void kvm_perf_overflow(struct perf_event *perf_event, · 94 unmodified lines
9595 }
9696
9797 static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type,
98− unsigned config, bool exclude_user,
98+ u64 config, bool exclude_user,
9999 bool exclude_kernel, bool intr,
100100 bool in_tx, bool in_tx_cp)
101101 {
@@ -181,7 +181,8 @@ static int cmp_u64(const void *a, const void *b) · 79 unmodified lines
181181
182182 void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel)
183183 {
184− unsigned config, type = PERF_TYPE_RAW;
184+ u64 config;
185+ u32 type = PERF_TYPE_RAW;
185186 struct kvm *kvm = pmc->vcpu->kvm;
186187 struct kvm_pmu_event_filter *filter;
187188 bool allow_event = true;
@@ -220,7 +221,7 @@ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) · 32 unmodified lines
220221 }
221222
222223 if (type == PERF_TYPE_RAW)
223− config = eventsel & X86_RAW_EVENT_MASK;
224+ config = eventsel & AMD64_RAW_EVENT_MASK;
224225
225226 if (pmc->current_config == eventsel && pmc_resume_counter(pmc))
226227 return;
arch/x86/kvm/svm/avic.c+23−70
@@ -27,20 +27,6 @@ · 26 unmodified lines
2727 #include "irq.h"
2828 #include "svm.h"
2929
30−#define SVM_AVIC_DOORBELL 0xc001011b
31−
32−#define AVIC_HPA_MASK ~((0xFFFULL << 52) | 0xFFF)
33−
34−/*
35− * 0xff is broadcast, so the max index allowed for physical APIC ID
36− * table is 0xfe. APIC IDs above 0xff are reserved.
37− */
38−#define AVIC_MAX_PHYSICAL_ID_COUNT 255
39−
40−#define AVIC_UNACCEL_ACCESS_WRITE_MASK 1
41−#define AVIC_UNACCEL_ACCESS_OFFSET_MASK 0xFF0
42−#define AVIC_UNACCEL_ACCESS_VECTOR_MASK 0xFFFFFFFF
43−
4430 /* AVIC GATAG is encoded using VM and VCPU IDs */
4531 #define AVIC_VCPU_ID_BITS 8
4632 #define AVIC_VCPU_ID_MASK ((1 << AVIC_VCPU_ID_BITS) - 1)
@@ -73,12 +59,6 @@ struct amd_svm_iommu_ir { · 26 unmodified lines
7359 void *data; /* Storing pointer to struct amd_ir_data */
7460 };
7561
76−enum avic_ipi_failure_cause {
77− AVIC_IPI_FAILURE_INVALID_INT_TYPE,
78− AVIC_IPI_FAILURE_TARGET_NOT_RUNNING,
79− AVIC_IPI_FAILURE_INVALID_TARGET,
80− AVIC_IPI_FAILURE_INVALID_BACKING_PAGE,
81−};
8262
8363 /* Note:
8464 * This function is called from IOMMU driver to notify
@@ -289,6 +269,22 @@ static int avic_init_backing_page(struct kvm_vcpu *vcpu) · 204 unmodified lines
289269 return 0;
290270 }
291271
272+void avic_ring_doorbell(struct kvm_vcpu *vcpu)
273+{
274+ /*
275+ * Note, the vCPU could get migrated to a different pCPU at any point,
276+ * which could result in signalling the wrong/previous pCPU. But if
277+ * that happens the vCPU is guaranteed to do a VMRUN (after being
278+ * migrated) and thus will process pending interrupts, i.e. a doorbell
279+ * is not needed (and the spurious one is harmless).
280+ */
281+ int cpu = READ_ONCE(vcpu->cpu);
282+
283+ if (cpu != get_cpu())
284+ wrmsrl(MSR_AMD64_SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu));
285+ put_cpu();
286+}
287+
292288 static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source,
293289 u32 icrl, u32 icrh)
294290 {
@@ -304,8 +300,13 @@ static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source, · 9 unmodified lines
304300 kvm_for_each_vcpu(i, vcpu, kvm) {
305301 if (kvm_apic_match_dest(vcpu, source, icrl & APIC_SHORT_MASK,
306302 GET_APIC_DEST_FIELD(icrh),
307− icrl & APIC_DEST_MASK))
308− kvm_vcpu_wake_up(vcpu);
303+ icrl & APIC_DEST_MASK)) {
304+ vcpu->arch.apic->irr_pending = true;
305+ svm_complete_interrupt_delivery(vcpu,
306+ icrl & APIC_MODE_MASK,
307+ icrl & APIC_INT_LEVELTRIG,
308+ icrl & APIC_VECTOR_MASK);
309+ }
309310 }
310311 }
311312
@@ -345,8 +346,6 @@ int avic_incomplete_ipi_interception(struct kvm_vcpu *vcpu) · 33 unmodified lines
345346 avic_kick_target_vcpus(vcpu->kvm, apic, icrl, icrh);
346347 break;
347348 case AVIC_IPI_FAILURE_INVALID_TARGET:
348− WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n",
349− index, vcpu->vcpu_id, icrh, icrl);
350349 break;
351350 case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE:
352351 WARN_ONCE(1, "Invalid backing page\n");
@@ -669,52 +668,6 @@ void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) · 316 unmodified lines
669668 return;
670669 }
671670
672−int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec)
673−{
674− if (!vcpu->arch.apicv_active)
675− return -1;
676−
677− kvm_lapic_set_irr(vec, vcpu->arch.apic);
678−
679− /*
680− * Pairs with the smp_mb_*() after setting vcpu->guest_mode in
681− * vcpu_enter_guest() to ensure the write to the vIRR is ordered before
682− * the read of guest_mode, which guarantees that either VMRUN will see
683− * and process the new vIRR entry, or that the below code will signal
684− * the doorbell if the vCPU is already running in the guest.
685− */
686− smp_mb__after_atomic();
687−
688− /*
689− * Signal the doorbell to tell hardware to inject the IRQ if the vCPU
690− * is in the guest. If the vCPU is not in the guest, hardware will
691− * automatically process AVIC interrupts at VMRUN.
692− */
693− if (vcpu->mode == IN_GUEST_MODE) {
694− int cpu = READ_ONCE(vcpu->cpu);
695−
696− /*
697− * Note, the vCPU could get migrated to a different pCPU at any
698− * point, which could result in signalling the wrong/previous
699− * pCPU. But if that happens the vCPU is guaranteed to do a
700− * VMRUN (after being migrated) and thus will process pending
701− * interrupts, i.e. a doorbell is not needed (and the spurious
702− * one is harmless).
703− */
704− if (cpu != get_cpu())
705− wrmsrl(SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu));
706− put_cpu();
707− } else {
708− /*
709− * Wake the vCPU if it was blocking. KVM will then detect the
710− * pending IRQ when checking if the vCPU has a wake event.
711− */
712− kvm_vcpu_wake_up(vcpu);
713− }
714−
715− return 0;
716−}
717−
718671 bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu)
719672 {
720673 return false;
arch/x86/kvm/svm/nested.c+14−12
@@ -1457,18 +1457,6 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 1456 unmodified lines
14571457 !__nested_vmcb_check_save(vcpu, &save_cached))
14581458 goto out_free;
14591459
1460− /*
1461− * While the nested guest CR3 is already checked and set by
1462− * KVM_SET_SREGS, it was set when nested state was yet loaded,
1463− * thus MMU might not be initialized correctly.
1464− * Set it again to fix this.
1465− */
1466−
1467− ret = nested_svm_load_cr3(&svm->vcpu, vcpu->arch.cr3,
1468− nested_npt_enabled(svm), false);
1469− if (WARN_ON_ONCE(ret))
1470− goto out_free;
1471−
14721460
14731461 /*
14741462 * All checks done, we can enter guest mode. Userspace provides
@@ -1494,6 +1482,20 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, · 19 unmodified lines
14941482
14951483 svm_switch_vmcb(svm, &svm->nested.vmcb02);
14961484 nested_vmcb02_prepare_control(svm);
1485+
1486+ /*
1487+ * While the nested guest CR3 is already checked and set by
1488+ * KVM_SET_SREGS, it was set when nested state was yet loaded,
1489+ * thus MMU might not be initialized correctly.
1490+ * Set it again to fix this.
1491+ */
1492+
1493+ ret = nested_svm_load_cr3(&svm->vcpu, vcpu->arch.cr3,
1494+ nested_npt_enabled(svm), false);
1495+ if (WARN_ON_ONCE(ret))
1496+ goto out_free;
1497+
1498+
14971499 kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
14981500 ret = 0;
14991501 out_free:
arch/x86/kvm/svm/svm.c+89−15
@@ -1585,6 +1585,7 @@ void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 1584 unmodified lines
15851585 {
15861586 struct vcpu_svm *svm = to_svm(vcpu);
15871587 u64 hcr0 = cr0;
1588+ bool old_paging = is_paging(vcpu);
15881589
15891590 #ifdef CONFIG_X86_64
15901591 if (vcpu->arch.efer & EFER_LME && !vcpu->arch.guest_state_protected) {
@@ -1601,8 +1602,11 @@ void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) · 10 unmodified lines
16011602 #endif
16021603 vcpu->arch.cr0 = cr0;
16031604
1604− if (!npt_enabled)
1605+ if (!npt_enabled) {
16051606 hcr0 |= X86_CR0_PG | X86_CR0_WP;
1607+ if (old_paging != is_paging(vcpu))
1608+ svm_set_cr4(vcpu, kvm_read_cr4(vcpu));
1609+ }
16061610
16071611 /*
16081612 * re-enable caching here because the QEMU bios
@@ -1646,8 +1650,12 @@ void svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) · 37 unmodified lines
16461650 svm_flush_tlb(vcpu);
16471651
16481652 vcpu->arch.cr4 = cr4;
1649− if (!npt_enabled)
1653+ if (!npt_enabled) {
16501654 cr4 |= X86_CR4_PAE;
1655+
1656+ if (!is_paging(vcpu))
1657+ cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE);
1658+ }
16511659 cr4 |= host_cr4_mce;
16521660 to_svm(vcpu)->vmcb->save.cr4 = cr4;
16531661 vmcb_mark_dirty(to_svm(vcpu)->vmcb, VMCB_CR);
@@ -2685,8 +2693,23 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 1031 unmodified lines
26852693 u64 data = msr->data;
26862694 switch (ecx) {
26872695 case MSR_AMD64_TSC_RATIO:
2688− if (!msr->host_initiated && !svm->tsc_scaling_enabled)
2689− return 1;
2696+
2697+ if (!svm->tsc_scaling_enabled) {
2698+
2699+ if (!msr->host_initiated)
2700+ return 1;
2701+ /*
2702+ * In case TSC scaling is not enabled, always
2703+ * leave this MSR at the default value.
2704+ *
2705+ * Due to bug in qemu 6.2.0, it would try to set
2706+ * this msr to 0 if tsc scaling is not enabled.
2707+ * Ignore this value as well.
2708+ */
2709+ if (data != 0 && data != svm->tsc_ratio_msr)
2710+ return 1;
2711+ break;
2712+ }
26902713
26912714 if (data & TSC_RATIO_RSVD)
26922715 return 1;
@@ -3291,21 +3314,55 @@ static void svm_set_irq(struct kvm_vcpu *vcpu) · 598 unmodified lines
32913314 SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR;
32923315 }
32933316
3294−static void svm_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
3295− int trig_mode, int vector)
3317+void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode,
3318+ int trig_mode, int vector)
32963319 {
3297− struct kvm_vcpu *vcpu = apic->vcpu;
3320+ /*
3321+ * vcpu->arch.apicv_active must be read after vcpu->mode.
3322+ * Pairs with smp_store_release in vcpu_enter_guest.
3323+ */
3324+ bool in_guest_mode = (smp_load_acquire(&vcpu->mode) == IN_GUEST_MODE);
32983325
3299− if (svm_deliver_avic_intr(vcpu, vector)) {
3300− kvm_lapic_set_irr(vector, apic);
3326+ if (!READ_ONCE(vcpu->arch.apicv_active)) {
3327+ /* Process the interrupt via inject_pending_event */
33013328 kvm_make_request(KVM_REQ_EVENT, vcpu);
33023329 kvm_vcpu_kick(vcpu);
3330+ return;
3331+ }
3332+
3333+ trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode, trig_mode, vector);
3334+ if (in_guest_mode) {
3335+ /*
3336+ * Signal the doorbell to tell hardware to inject the IRQ. If
3337+ * the vCPU exits the guest before the doorbell chimes, hardware
3338+ * will automatically process AVIC interrupts at the next VMRUN.
3339+ */
3340+ avic_ring_doorbell(vcpu);
33033341 } else {
3304− trace_kvm_apicv_accept_irq(vcpu->vcpu_id, delivery_mode,
3305− trig_mode, vector);
3342+ /*
3343+ * Wake the vCPU if it was blocking. KVM will then detect the
3344+ * pending IRQ when checking if the vCPU has a wake event.
3345+ */
3346+ kvm_vcpu_wake_up(vcpu);
33063347 }
33073348 }
33083349
3350+static void svm_deliver_interrupt(struct kvm_lapic *apic, int delivery_mode,
3351+ int trig_mode, int vector)
3352+{
3353+ kvm_lapic_set_irr(vector, apic);
3354+
3355+ /*
3356+ * Pairs with the smp_mb_*() after setting vcpu->guest_mode in
3357+ * vcpu_enter_guest() to ensure the write to the vIRR is ordered before
3358+ * the read of guest_mode. This guarantees that either VMRUN will see
3359+ * and process the new vIRR entry, or that svm_complete_interrupt_delivery
3360+ * will signal the doorbell if the CPU has already entered the guest.
3361+ */
3362+ smp_mb__after_atomic();
3363+ svm_complete_interrupt_delivery(apic->vcpu, delivery_mode, trig_mode, vector);
3364+}
3365+
33093366 static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr)
33103367 {
33113368 struct vcpu_svm *svm = to_svm(vcpu);
@@ -3353,11 +3410,13 @@ static int svm_nmi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 41 unmodified lines
33533410 if (svm->nested.nested_run_pending)
33543411 return -EBUSY;
33553412
3413+ if (svm_nmi_blocked(vcpu))
3414+ return 0;
3415+
33563416 /* An NMI must not be injected into L2 if it's supposed to VM-Exit. */
33573417 if (for_injection && is_guest_mode(vcpu) && nested_exit_on_nmi(svm))
33583418 return -EBUSY;
3359−
3360− return !svm_nmi_blocked(vcpu);
3419+ return 1;
33613420 }
33623421
33633422 static bool svm_get_nmi_mask(struct kvm_vcpu *vcpu)
@@ -3409,9 +3468,13 @@ bool svm_interrupt_blocked(struct kvm_vcpu *vcpu) · 45 unmodified lines
34093468 static int svm_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection)
34103469 {
34113470 struct vcpu_svm *svm = to_svm(vcpu);
3471+
34123472 if (svm->nested.nested_run_pending)
34133473 return -EBUSY;
34143474
3475+ if (svm_interrupt_blocked(vcpu))
3476+ return 0;
3477+
34153478 /*
34163479 * An IRQ must not be injected into L2 if it's supposed to VM-Exit,
34173480 * e.g. if the IRQ arrived asynchronously after checking nested events.
@@ -3419,7 +3482,7 @@ static int svm_interrupt_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 1 unmodified line
34193482 if (for_injection && is_guest_mode(vcpu) && nested_exit_on_intr(svm))
34203483 return -EBUSY;
34213484
3422− return !svm_interrupt_blocked(vcpu);
3485+ return 1;
34233486 }
34243487
34253488 static void svm_enable_irq_window(struct kvm_vcpu *vcpu)
@@ -4150,11 +4213,14 @@ static int svm_smi_allowed(struct kvm_vcpu *vcpu, bool for_injection) · 724 unmodified lines
41504213 if (svm->nested.nested_run_pending)
41514214 return -EBUSY;
41524215
4216+ if (svm_smi_blocked(vcpu))
4217+ return 0;
4218+
41534219 /* An SMI must not be injected into L2 if it's supposed to VM-Exit. */
41544220 if (for_injection && is_guest_mode(vcpu) && nested_exit_on_smi(svm))
41554221 return -EBUSY;
41564222
4157− return !svm_smi_blocked(vcpu);
4223+ return 1;
41584224 }
41594225
41604226 static int svm_enter_smm(struct kvm_vcpu *vcpu, char *smstate)
@@ -4248,11 +4314,18 @@ static int svm_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 87 unmodified lines
42484314 * Enter the nested guest now
42494315 */
42504316
4317+ vmcb_mark_all_dirty(svm->vmcb01.ptr);
4318+
42514319 vmcb12 = map.hva;
42524320 nested_copy_vmcb_control_to_cache(svm, &vmcb12->control);
42534321 nested_copy_vmcb_save_to_cache(svm, &vmcb12->save);
42544322 ret = enter_svm_guest_mode(vcpu, vmcb12_gpa, vmcb12, false);
42554323
4324+ if (ret)
4325+ goto unmap_save;
4326+
4327+ svm->nested.nested_run_pending = 1;
4328+
42564329 unmap_save:
42574330 kvm_vcpu_unmap(vcpu, &map_save, true);
42584331 unmap_map:
@@ -4637,6 +4710,7 @@ static __init void svm_set_cpu_caps(void) · 378 unmodified lines
46374710 /* CPUID 0x80000001 and 0x8000000A (SVM features) */
46384711 if (nested) {
46394712 kvm_cpu_cap_set(X86_FEATURE_SVM);
4713+ kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN);
46404714
46414715 if (nrips)
46424716 kvm_cpu_cap_set(X86_FEATURE_NRIPS);
arch/x86/kvm/svm/svm.h+3−12
@@ -489,6 +489,8 @@ void svm_set_gif(struct vcpu_svm *svm, bool value); · 488 unmodified lines
489489 int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code);
490490 void set_msr_interception(struct kvm_vcpu *vcpu, u32 *msrpm, u32 msr,
491491 int read, int write);
492+void svm_complete_interrupt_delivery(struct kvm_vcpu *vcpu, int delivery_mode,
493+ int trig_mode, int vec);
492494
493495 /* nested.c */
494496
@@ -556,17 +558,6 @@ extern struct kvm_x86_nested_ops svm_nested_ops; · 61 unmodified lines
556558
557559 /* avic.c */
558560
559−#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF)
560−#define AVIC_LOGICAL_ID_ENTRY_VALID_BIT 31
561−#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31)
562−
563−#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL)
564−#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12)
565−#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62)
566−#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63)
567−
568−#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL
569−
570561 int avic_ga_log_notifier(u32 ga_tag);
571562 void avic_vm_destroy(struct kvm *kvm);
572563 int avic_vm_init(struct kvm *kvm);
@@ -583,12 +574,12 @@ bool svm_check_apicv_inhibit_reasons(ulong bit); · 10 unmodified lines
583574 void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap);
584575 void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr);
585576 void svm_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr);
586−int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec);
587577 bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu);
588578 int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq,
589579 uint32_t guest_irq, bool set);
590580 void avic_vcpu_blocking(struct kvm_vcpu *vcpu);
591581 void avic_vcpu_unblocking(struct kvm_vcpu *vcpu);
582+void avic_ring_doorbell(struct kvm_vcpu *vcpu);
592583
593584 /* sev.c */
594585
arch/x86/kvm/vmx/vmx.c+1−0
@@ -7659,6 +7659,7 @@ static int vmx_leave_smm(struct kvm_vcpu *vcpu, const char *smstate) · 7658 unmodified lines
76597659 if (ret)
76607660 return ret;
76617661
7662+ vmx->nested.nested_run_pending = 1;
76627663 vmx->nested.smm.guest_mode = false;
76637664 }
76647665 return 0;
arch/x86/kvm/x86.c+28−6
@@ -984,6 +984,18 @@ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu) · 983 unmodified lines
984984 }
985985 EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state);
986986
987+static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu)
988+{
989+ return vcpu->arch.guest_fpu.fpstate->user_xfeatures;
990+}
991+
992+#ifdef CONFIG_X86_64
993+static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu)
994+{
995+ return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC;
996+}
997+#endif
998+
987999 static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
9881000 {
9891001 u64 xcr0 = xcr;
@@ -1003,7 +1015,7 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr) · 13 unmodified lines
10031015 * saving. However, xcr0 bit 0 is always set, even if the
10041016 * emulated CPU does not support XSAVE (see kvm_vcpu_reset()).
10051017 */
1006− valid_bits = vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP;
1018+ valid_bits = kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP;
10071019 if (xcr0 & ~valid_bits)
10081020 return 1;
10091021
@@ -2351,10 +2363,12 @@ static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns) · 1341 unmodified lines
23512363 return tsc;
23522364 }
23532365
2366+#ifdef CONFIG_X86_64
23542367 static inline int gtod_is_based_on_tsc(int mode)
23552368 {
23562369 return mode == VDSO_CLOCKMODE_TSC || mode == VDSO_CLOCKMODE_HVCLOCK;
23572370 }
2371+#endif
23582372
23592373 static void kvm_track_tsc_matching(struct kvm_vcpu *vcpu)
23602374 {
@@ -3706,8 +3720,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 1345 unmodified lines
37063720 !guest_cpuid_has(vcpu, X86_FEATURE_XFD))
37073721 return 1;
37083722
3709− if (data & ~(XFEATURE_MASK_USER_DYNAMIC &
3710− vcpu->arch.guest_supported_xcr0))
3723+ if (data & ~kvm_guest_supported_xfd(vcpu))
37113724 return 1;
37123725
37133726 fpu_update_guest_xfd(&vcpu->arch.guest_fpu, data);
@@ -3717,8 +3730,7 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) · 3 unmodified lines
37173730 !guest_cpuid_has(vcpu, X86_FEATURE_XFD))
37183731 return 1;
37193732
3720− if (data & ~(XFEATURE_MASK_USER_DYNAMIC &
3721− vcpu->arch.guest_supported_xcr0))
3733+ if (data & ~kvm_guest_supported_xfd(vcpu))
37223734 return 1;
37233735
37243736 vcpu->arch.guest_fpu.xfd_err = data;
@@ -4233,6 +4245,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) · 508 unmodified lines
42334245 case KVM_CAP_EXIT_ON_EMULATION_FAILURE:
42344246 case KVM_CAP_VCPU_ATTRIBUTES:
42354247 case KVM_CAP_SYS_ATTRIBUTES:
4248+ case KVM_CAP_ENABLE_CAP:
42364249 r = 1;
42374250 break;
42384251 case KVM_CAP_EXIT_HYPERCALL:
@@ -8942,6 +8955,13 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr, · 4703 unmodified lines
89428955 if (clock_type != KVM_CLOCK_PAIRING_WALLCLOCK)
89438956 return -KVM_EOPNOTSUPP;
89448957
8958+ /*
8959+ * When tsc is in permanent catchup mode guests won't be able to use
8960+ * pvclock_read_retry loop to get consistent view of pvclock
8961+ */
8962+ if (vcpu->arch.tsc_always_catchup)
8963+ return -KVM_EOPNOTSUPP;
8964+
89458965 if (!kvm_get_walltime_and_clockread(&ts, &cycle))
89468966 return -KVM_EOPNOTSUPP;
89478967
@@ -9983,7 +10003,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 1035 unmodified lines
998310003 * result in virtual interrupt delivery.
998410004 */
998510005 local_irq_disable();
9986− vcpu->mode = IN_GUEST_MODE;
10006+
10007+ /* Store vcpu->apicv_active before vcpu->mode. */
10008+ smp_store_release(&vcpu->mode, IN_GUEST_MODE);
998710009
998810010 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
998910011
arch/x86/kvm/xen.c+67−30
@@ -133,32 +133,57 @@ static void kvm_xen_update_runstate(struct kvm_vcpu *v, int state) · 132 unmodified lines
133133 void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state)
134134 {
135135 struct kvm_vcpu_xen *vx = &v->arch.xen;
136+ struct gfn_to_hva_cache *ghc = &vx->runstate_cache;
137+ struct kvm_memslots *slots = kvm_memslots(v->kvm);
138+ bool atomic = (state == RUNSTATE_runnable);
136139 uint64_t state_entry_time;
137− unsigned int offset;
140+ int __user *user_state;
141+ uint64_t __user *user_times;
138142
139143 kvm_xen_update_runstate(v, state);
140144
141145 if (!vx->runstate_set)
142146 return;
143147
144− BUILD_BUG_ON(sizeof(struct compat_vcpu_runstate_info) != 0x2c);
148+ if (unlikely(slots->generation != ghc->generation || kvm_is_error_hva(ghc->hva)) &&
149+ kvm_gfn_to_hva_cache_init(v->kvm, ghc, ghc->gpa, ghc->len))
150+ return;
151+
152+ /* We made sure it fits in a single page */
153+ BUG_ON(!ghc->memslot);
154+
155+ if (atomic)
156+ pagefault_disable();
145157
146− offset = offsetof(struct compat_vcpu_runstate_info, state_entry_time);
147−#ifdef CONFIG_X86_64
148158 /*
149− * The only difference is alignment of uint64_t in 32-bit.
150− * So the first field 'state' is accessed directly using
151− * offsetof() (where its offset happens to be zero), while the
152− * remaining fields which are all uint64_t, start at 'offset'
153− * which we tweak here by adding 4.
159+ * The only difference between 32-bit and 64-bit versions of the
160+ * runstate struct us the alignment of uint64_t in 32-bit, which
161+ * means that the 64-bit version has an additional 4 bytes of
162+ * padding after the first field 'state'.
163+ *
164+ * So we use 'int __user *user_state' to point to the state field,
165+ * and 'uint64_t __user *user_times' for runstate_entry_time. So
166+ * the actual array of time[] in each state starts at user_times[1].
154167 */
168+ BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, state) != 0);
169+ BUILD_BUG_ON(offsetof(struct compat_vcpu_runstate_info, state) != 0);
170+ user_state = (int __user *)ghc->hva;
171+
172+ BUILD_BUG_ON(sizeof(struct compat_vcpu_runstate_info) != 0x2c);
173+
174+ user_times = (uint64_t __user *)(ghc->hva +
175+ offsetof(struct compat_vcpu_runstate_info,
176+ state_entry_time));
177+#ifdef CONFIG_X86_64
155178 BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, state_entry_time) !=
156179 offsetof(struct compat_vcpu_runstate_info, state_entry_time) + 4);
157180 BUILD_BUG_ON(offsetof(struct vcpu_runstate_info, time) !=
158181 offsetof(struct compat_vcpu_runstate_info, time) + 4);
159182
160183 if (v->kvm->arch.xen.long_mode)
161− offset = offsetof(struct vcpu_runstate_info, state_entry_time);
184+ user_times = (uint64_t __user *)(ghc->hva +
185+ offsetof(struct vcpu_runstate_info,
186+ state_entry_time));
162187 #endif
163188 /*
164189 * First write the updated state_entry_time at the appropriate
@@ -172,10 +197,8 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 7 unmodified lines
172197 BUILD_BUG_ON(sizeof_field(struct compat_vcpu_runstate_info, state_entry_time) !=
173198 sizeof(state_entry_time));
174199
175− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
176− &state_entry_time, offset,
177− sizeof(state_entry_time)))
178− return;
200+ if (__put_user(state_entry_time, user_times))
201+ goto out;
179202 smp_wmb();
180203
181204 /*
@@ -189,11 +212,8 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 7 unmodified lines
189212 BUILD_BUG_ON(sizeof_field(struct compat_vcpu_runstate_info, state) !=
190213 sizeof(vx->current_runstate));
191214
192− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
193− &vx->current_runstate,
194− offsetof(struct vcpu_runstate_info, state),
195− sizeof(vx->current_runstate)))
196− return;
215+ if (__put_user(vx->current_runstate, user_state))
216+ goto out;
197217
198218 /*
199219 * Write the actual runstate times immediately after the
@@ -208,24 +228,23 @@ void kvm_xen_update_runstate_guest(struct kvm_vcpu *v, int state) · 8 unmodified lines
208228 BUILD_BUG_ON(sizeof_field(struct vcpu_runstate_info, time) !=
209229 sizeof(vx->runstate_times));
210230
211− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
212− &vx->runstate_times[0],
213− offset + sizeof(u64),
214− sizeof(vx->runstate_times)))
215− return;
216−
231+ if (__copy_to_user(user_times + 1, vx->runstate_times, sizeof(vx->runstate_times)))
232+ goto out;
217233 smp_wmb();
218234
219235 /*
220236 * Finally, clear the XEN_RUNSTATE_UPDATE bit in the guest's
221237 * runstate_entry_time field.
222238 */
223−
224239 state_entry_time &= ~XEN_RUNSTATE_UPDATE;
225− if (kvm_write_guest_offset_cached(v->kvm, &v->arch.xen.runstate_cache,
226− &state_entry_time, offset,
227− sizeof(state_entry_time)))
228− return;
240+ __put_user(state_entry_time, user_times);
241+ smp_wmb();
242+
243+ out:
244+ mark_page_dirty_in_slot(v->kvm, ghc->memslot, ghc->gpa >> PAGE_SHIFT);
245+
246+ if (atomic)
247+ pagefault_enable();
229248 }
230249
231250 int __kvm_xen_has_interrupt(struct kvm_vcpu *v)
@@ -443,6 +462,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 211 unmodified lines
443462 break;
444463 }
445464
465+ /* It must fit within a single page */
466+ if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct vcpu_info) > PAGE_SIZE) {
467+ r = -EINVAL;
468+ break;
469+ }
470+
446471 r = kvm_gfn_to_hva_cache_init(vcpu->kvm,
447472 &vcpu->arch.xen.vcpu_info_cache,
448473 data->u.gpa,
@@ -460,6 +485,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 11 unmodified lines
460485 break;
461486 }
462487
488+ /* It must fit within a single page */
489+ if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct pvclock_vcpu_time_info) > PAGE_SIZE) {
490+ r = -EINVAL;
491+ break;
492+ }
493+
463494 r = kvm_gfn_to_hva_cache_init(vcpu->kvm,
464495 &vcpu->arch.xen.vcpu_time_info_cache,
465496 data->u.gpa,
@@ -481,6 +512,12 @@ int kvm_xen_vcpu_set_attr(struct kvm_vcpu *vcpu, struct kvm_xen_vcpu_attr *data) · 15 unmodified lines
481512 break;
482513 }
483514
515+ /* It must fit within a single page */
516+ if ((data->u.gpa & ~PAGE_MASK) + sizeof(struct vcpu_runstate_info) > PAGE_SIZE) {
517+ r = -EINVAL;
518+ break;
519+ }
520+
484521 r = kvm_gfn_to_hva_cache_init(vcpu->kvm,
485522 &vcpu->arch.xen.runstate_cache,
486523 data->u.gpa,
block/bfq-iosched.c+2−0
@@ -7018,6 +7018,8 @@ static void bfq_exit_queue(struct elevator_queue *e) · 7017 unmodified lines
70187018 spin_unlock_irq(&bfqd->lock);
70197019 #endif
70207020
7021+ wbt_enable_default(bfqd->queue);
7022+
70217023 kfree(bfqd);
70227024 }
70237025
block/blk-core.c+2−8
@@ -284,13 +284,6 @@ void blk_queue_start_drain(struct request_queue *q) · 283 unmodified lines
284284 wake_up_all(&q->mq_freeze_wq);
285285 }
286286
287−void blk_set_queue_dying(struct request_queue *q)
288−{
289− blk_queue_flag_set(QUEUE_FLAG_DYING, q);
290− blk_queue_start_drain(q);
291−}
292−EXPORT_SYMBOL_GPL(blk_set_queue_dying);
293−
294287 /**
295288 * blk_cleanup_queue - shutdown a request queue
296289 * @q: request queue to shutdown
@@ -308,7 +301,8 @@ void blk_cleanup_queue(struct request_queue *q) · 11 unmodified lines
308301 WARN_ON_ONCE(blk_queue_registered(q));
309302
310303 /* mark @q DYING, no new request or merges will be allowed afterwards */
311− blk_set_queue_dying(q);
304+ blk_queue_flag_set(QUEUE_FLAG_DYING, q);
305+ blk_queue_start_drain(q);
312306
313307 blk_queue_flag_set(QUEUE_FLAG_NOMERGES, q);
314308 blk_queue_flag_set(QUEUE_FLAG_NOXMERGES, q);
block/blk-map.c+1−1
@@ -446,7 +446,7 @@ static struct bio *bio_copy_kern(struct request_queue *q, void *data, · 445 unmodified lines
446446 if (bytes > len)
447447 bytes = len;
448448
449− page = alloc_page(GFP_NOIO | gfp_mask);
449+ page = alloc_page(GFP_NOIO | __GFP_ZERO | gfp_mask);
450450 if (!page)
451451 goto cleanup;
452452
block/blk-mq.c+4−0
@@ -736,6 +736,10 @@ static void blk_complete_request(struct request *req) · 735 unmodified lines
736736
737737 /* Completion has already been traced */
738738 bio_clear_flag(bio, BIO_TRACE_COMPLETION);
739+
740+ if (req_op(req) == REQ_OP_ZONE_APPEND)
741+ bio->bi_iter.bi_sector = req->__sector;
742+
739743 if (!is_flush)
740744 bio_endio(bio);
741745 bio = next;
block/elevator.c+0−2
@@ -525,8 +525,6 @@ void elv_unregister_queue(struct request_queue *q) · 524 unmodified lines
525525 kobject_del(&e->kobj);
526526
527527 e->registered = 0;
528− /* Re-enable throttling in case elevator disabled it */
529− wbt_enable_default(q);
530528 }
531529 }
532530
block/fops.c+2−0
@@ -289,6 +289,8 @@ static void blkdev_bio_end_io_async(struct bio *bio) · 288 unmodified lines
289289 struct kiocb *iocb = dio->iocb;
290290 ssize_t ret;
291291
292+ WRITE_ONCE(iocb->private, NULL);
293+
292294 if (likely(!bio->bi_status)) {
293295 ret = dio->size;
294296 iocb->ki_pos += ret;
block/genhd.c+14−0
@@ -548,6 +548,20 @@ out_free_ext_minor: · 547 unmodified lines
548548 }
549549 EXPORT_SYMBOL(device_add_disk);
550550
551+/**
552+ * blk_mark_disk_dead - mark a disk as dead
553+ * @disk: disk to mark as dead
554+ *
555+ * Mark as disk as dead (e.g. surprise removed) and don't accept any new I/O
556+ * to this disk.
557+ */
558+void blk_mark_disk_dead(struct gendisk *disk)
559+{
560+ set_bit(GD_DEAD, &disk->state);
561+ blk_queue_start_drain(disk->queue);
562+}
563+EXPORT_SYMBOL_GPL(blk_mark_disk_dead);
564+
551565 /**
552566 * del_gendisk - remove the gendisk
553567 * @disk: the struct gendisk to remove
crypto/af_alg.c+0−3
@@ -25,12 +25,9 @@ struct alg_type_list { · 24 unmodified lines
2525 struct list_head list;
2626 };
2727
28−static atomic_long_t alg_memory_allocated;
29−
3028 static struct proto alg_proto = {
3129 .name = "ALG",
3230 .owner = THIS_MODULE,
33− .memory_allocated = &alg_memory_allocated,
3431 .obj_size = sizeof(struct alg_sock),
3532 };
3633
drivers/acpi/processor_idle.c+5−0
@@ -96,6 +96,11 @@ static const struct dmi_system_id processor_power_dmi_table[] = { · 95 unmodified lines
9696 DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."),
9797 DMI_MATCH(DMI_PRODUCT_NAME,"L8400B series Notebook PC")},
9898 (void *)1},
99+ /* T40 can not handle C3 idle state */
100+ { set_max_cstate, "IBM ThinkPad T40", {
101+ DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
102+ DMI_MATCH(DMI_PRODUCT_NAME, "23737CU")},
103+ (void *)2},
99104 {},
100105 };
101106
drivers/acpi/tables.c+1−1
@@ -400,7 +400,7 @@ int __init_or_acpilib acpi_table_parse_entries_array( · 399 unmodified lines
400400
401401 acpi_get_table(id, instance, &table_header);
402402 if (!table_header) {
403− pr_warn("%4.4s not present\n", id);
403+ pr_debug("%4.4s not present\n", id);
404404 return -ENODEV;
405405 }
406406
drivers/ata/pata_hpt37x.c+16−2
@@ -919,6 +919,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 918 unmodified lines
919919 irqmask &= ~0x10;
920920 pci_write_config_byte(dev, 0x5a, irqmask);
921921
922+ /*
923+ * HPT371 chips physically have only one channel, the secondary one,
924+ * but the primary channel registers do exist! Go figure...
925+ * So, we manually disable the non-existing channel here
926+ * (if the BIOS hasn't done this already).
927+ */
928+ if (dev->device == PCI_DEVICE_ID_TTI_HPT371) {
929+ u8 mcr1;
930+
931+ pci_read_config_byte(dev, 0x50, &mcr1);
932+ mcr1 &= ~0x04;
933+ pci_write_config_byte(dev, 0x50, mcr1);
934+ }
935+
922936 /*
923937 * default to pci clock. make sure MA15/16 are set to output
924938 * to prevent drives having problems with 40-pin cables. Needed
@@ -950,14 +964,14 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) · 25 unmodified lines
950964
951965 if ((freq >> 12) != 0xABCDE) {
952966 int i;
953− u8 sr;
967+ u16 sr;
954968 u32 total = 0;
955969
956970 dev_warn(&dev->dev, "BIOS has not set timing clocks\n");
957971
958972 /* This is the process the HPT371 BIOS is reported to use */
959973 for (i = 0; i < 128; i++) {
960− pci_read_config_byte(dev, 0x78, &sr);
974+ pci_read_config_word(dev, 0x78, &sr);
961975 total += sr & 0x1FF;
962976 udelay(15);
963977 }
drivers/base/dd.c+5−0
@@ -629,6 +629,9 @@ re_probe: · 628 unmodified lines
629629 drv->remove(dev);
630630
631631 devres_release_all(dev);
632+ arch_teardown_dma_ops(dev);
633+ kfree(dev->dma_range_map);
634+ dev->dma_range_map = NULL;
632635 driver_sysfs_remove(dev);
633636 dev->driver = NULL;
634637 dev_set_drvdata(dev, NULL);
@@ -1209,6 +1212,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) · 574 unmodified lines
12091212
12101213 devres_release_all(dev);
12111214 arch_teardown_dma_ops(dev);
1215+ kfree(dev->dma_range_map);
1216+ dev->dma_range_map = NULL;
12121217 dev->driver = NULL;
12131218 dev_set_drvdata(dev, NULL);
12141219 if (dev->pm_domain && dev->pm_domain->dismiss)
drivers/base/regmap/regmap-irq.c+6−14
@@ -189,11 +189,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) · 188 unmodified lines
189189 ret = regmap_write(map, reg, d->mask_buf[i]);
190190 if (d->chip->clear_ack) {
191191 if (d->chip->ack_invert && !ret)
192− ret = regmap_write(map, reg,
193− d->mask_buf[i]);
192+ ret = regmap_write(map, reg, UINT_MAX);
194193 else if (!ret)
195− ret = regmap_write(map, reg,
196− ~d->mask_buf[i]);
194+ ret = regmap_write(map, reg, 0);
197195 }
198196 if (ret != 0)
199197 dev_err(d->map->dev, "Failed to ack 0x%x: %d\n",
@@ -556,11 +554,9 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) · 356 unmodified lines
556554 data->status_buf[i]);
557555 if (chip->clear_ack) {
558556 if (chip->ack_invert && !ret)
559− ret = regmap_write(map, reg,
560− data->status_buf[i]);
557+ ret = regmap_write(map, reg, UINT_MAX);
561558 else if (!ret)
562− ret = regmap_write(map, reg,
563− ~data->status_buf[i]);
559+ ret = regmap_write(map, reg, 0);
564560 }
565561 if (ret != 0)
566562 dev_err(map->dev, "Failed to ack 0x%x: %d\n",
@@ -817,13 +813,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, · 250 unmodified lines
817813 d->status_buf[i] & d->mask_buf[i]);
818814 if (chip->clear_ack) {
819815 if (chip->ack_invert && !ret)
820− ret = regmap_write(map, reg,
821− (d->status_buf[i] &
822− d->mask_buf[i]));
816+ ret = regmap_write(map, reg, UINT_MAX);
823817 else if (!ret)
824− ret = regmap_write(map, reg,
825− ~(d->status_buf[i] &
826− d->mask_buf[i]));
818+ ret = regmap_write(map, reg, 0);
827819 }
828820 if (ret != 0) {
829821 dev_err(map->dev, "Failed to ack 0x%x: %d\n",
drivers/block/loop.c+7−1
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 #include <linux/ioprio.h>
8080 #include <linux/blk-cgroup.h>
8181 #include <linux/sched/mm.h>
82+#include <linux/statfs.h>
8283
8384 #include "loop.h"
8485
@@ -774,8 +775,13 @@ static void loop_config_discard(struct loop_device *lo) · 689 unmodified lines
774775 granularity = 0;
775776
776777 } else {
778+ struct kstatfs sbuf;
779+
777780 max_discard_sectors = UINT_MAX >> 9;
778− granularity = inode->i_sb->s_blocksize;
781+ if (!vfs_statfs(&file->f_path, &sbuf))
782+ granularity = sbuf.f_bsize;
783+ else
784+ max_discard_sectors = 0;
779785 }
780786
781787 if (max_discard_sectors) {
drivers/block/mtip32xx/mtip32xx.c+1−1
@@ -4112,7 +4112,7 @@ static void mtip_pci_remove(struct pci_dev *pdev) · 4111 unmodified lines
41124112 "Completion workers still active!\n");
41134113 }
41144114
4115− blk_set_queue_dying(dd->queue);
4115+ blk_mark_disk_dead(dd->disk);
41164116 set_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag);
41174117
41184118 /* Clean up the block layer. */
drivers/block/rbd.c+1−1
@@ -7185,7 +7185,7 @@ static ssize_t do_rbd_remove(struct bus_type *bus, · 7184 unmodified lines
71857185 * IO to complete/fail.
71867186 */
71877187 blk_mq_freeze_queue(rbd_dev->disk->queue);
7188− blk_set_queue_dying(rbd_dev->disk->queue);
7188+ blk_mark_disk_dead(rbd_dev->disk);
71897189 }
71907190
71917191 del_gendisk(rbd_dev->disk);
drivers/block/xen-blkfront.c+1−1
@@ -2126,7 +2126,7 @@ static void blkfront_closing(struct blkfront_info *info) · 2125 unmodified lines
21262126
21272127 /* No more blkif_request(). */
21282128 blk_mq_stop_hw_queues(info->rq);
2129− blk_set_queue_dying(info->rq);
2129+ blk_mark_disk_dead(info->gd);
21302130 set_capacity(info->gd, 0);
21312131
21322132 for_each_rinfo(info, rinfo, i) {
drivers/clk/ingenic/jz4725b-cgu.c+1−2
@@ -139,11 +139,10 @@ static const struct ingenic_cgu_clk_info jz4725b_cgu_clocks[] = { · 138 unmodified lines
139139 },
140140
141141 [JZ4725B_CLK_I2S] = {
142− "i2s", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE,
142+ "i2s", CGU_CLK_MUX | CGU_CLK_DIV,
143143 .parents = { JZ4725B_CLK_EXT, JZ4725B_CLK_PLL_HALF, -1, -1 },
144144 .mux = { CGU_REG_CPCCR, 31, 1 },
145145 .div = { CGU_REG_I2SCDR, 0, 1, 9, -1, -1, -1 },
146− .gate = { CGU_REG_CLKGR, 6 },
147146 },
148147
149148 [JZ4725B_CLK_SPI] = {
drivers/clk/qcom/gcc-msm8994.c+9−97
@@ -108,42 +108,6 @@ static const struct clk_parent_data gcc_xo_gpll0_gpll4[] = { · 107 unmodified lines
108108 { .hw = &gpll4.clkr.hw },
109109 };
110110
111−static struct clk_rcg2 system_noc_clk_src = {
112− .cmd_rcgr = 0x0120,
113− .hid_width = 5,
114− .parent_map = gcc_xo_gpll0_map,
115− .clkr.hw.init = &(struct clk_init_data){
116− .name = "system_noc_clk_src",
117− .parent_data = gcc_xo_gpll0,
118− .num_parents = ARRAY_SIZE(gcc_xo_gpll0),
119− .ops = &clk_rcg2_ops,
120− },
121−};
122−
123−static struct clk_rcg2 config_noc_clk_src = {
124− .cmd_rcgr = 0x0150,
125− .hid_width = 5,
126− .parent_map = gcc_xo_gpll0_map,
127− .clkr.hw.init = &(struct clk_init_data){
128− .name = "config_noc_clk_src",
129− .parent_data = gcc_xo_gpll0,
130− .num_parents = ARRAY_SIZE(gcc_xo_gpll0),
131− .ops = &clk_rcg2_ops,
132− },
133−};
134−
135−static struct clk_rcg2 periph_noc_clk_src = {
136− .cmd_rcgr = 0x0190,
137− .hid_width = 5,
138− .parent_map = gcc_xo_gpll0_map,
139− .clkr.hw.init = &(struct clk_init_data){
140− .name = "periph_noc_clk_src",
141− .parent_data = gcc_xo_gpll0,
142− .num_parents = ARRAY_SIZE(gcc_xo_gpll0),
143− .ops = &clk_rcg2_ops,
144− },
145−};
146−
147111 static struct freq_tbl ftbl_ufs_axi_clk_src[] = {
148112 F(50000000, P_GPLL0, 12, 0, 0),
149113 F(100000000, P_GPLL0, 6, 0, 0),
@@ -1150,8 +1114,6 @@ static struct clk_branch gcc_blsp1_ahb_clk = { · 1000 unmodified lines
11501114 .enable_mask = BIT(17),
11511115 .hw.init = &(struct clk_init_data){
11521116 .name = "gcc_blsp1_ahb_clk",
1153− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1154− .num_parents = 1,
11551117 .ops = &clk_branch2_ops,
11561118 },
11571119 },
@@ -1435,8 +1397,6 @@ static struct clk_branch gcc_blsp2_ahb_clk = { · 277 unmodified lines
14351397 .enable_mask = BIT(15),
14361398 .hw.init = &(struct clk_init_data){
14371399 .name = "gcc_blsp2_ahb_clk",
1438− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1439− .num_parents = 1,
14401400 .ops = &clk_branch2_ops,
14411401 },
14421402 },
@@ -1764,8 +1724,6 @@ static struct clk_branch gcc_lpass_q6_axi_clk = { · 321 unmodified lines
17641724 .enable_mask = BIT(0),
17651725 .hw.init = &(struct clk_init_data){
17661726 .name = "gcc_lpass_q6_axi_clk",
1767− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1768− .num_parents = 1,
17691727 .ops = &clk_branch2_ops,
17701728 },
17711729 },
@@ -1778,8 +1736,6 @@ static struct clk_branch gcc_mss_q6_bimc_axi_clk = { · 6 unmodified lines
17781736 .enable_mask = BIT(0),
17791737 .hw.init = &(struct clk_init_data){
17801738 .name = "gcc_mss_q6_bimc_axi_clk",
1781− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1782− .num_parents = 1,
17831739 .ops = &clk_branch2_ops,
17841740 },
17851741 },
@@ -1807,9 +1763,6 @@ static struct clk_branch gcc_pcie_0_cfg_ahb_clk = { · 21 unmodified lines
18071763 .enable_mask = BIT(0),
18081764 .hw.init = &(struct clk_init_data){
18091765 .name = "gcc_pcie_0_cfg_ahb_clk",
1810− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
1811− .num_parents = 1,
1812− .flags = CLK_SET_RATE_PARENT,
18131766 .ops = &clk_branch2_ops,
18141767 },
18151768 },
@@ -1822,9 +1775,6 @@ static struct clk_branch gcc_pcie_0_mstr_axi_clk = { · 6 unmodified lines
18221775 .enable_mask = BIT(0),
18231776 .hw.init = &(struct clk_init_data){
18241777 .name = "gcc_pcie_0_mstr_axi_clk",
1825− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1826− .num_parents = 1,
1827− .flags = CLK_SET_RATE_PARENT,
18281778 .ops = &clk_branch2_ops,
18291779 },
18301780 },
@@ -1854,9 +1804,6 @@ static struct clk_branch gcc_pcie_0_slv_axi_clk = { · 23 unmodified lines
18541804 .enable_mask = BIT(0),
18551805 .hw.init = &(struct clk_init_data){
18561806 .name = "gcc_pcie_0_slv_axi_clk",
1857− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1858− .num_parents = 1,
1859− .flags = CLK_SET_RATE_PARENT,
18601807 .ops = &clk_branch2_ops,
18611808 },
18621809 },
@@ -1884,9 +1831,6 @@ static struct clk_branch gcc_pcie_1_cfg_ahb_clk = { · 21 unmodified lines
18841831 .enable_mask = BIT(0),
18851832 .hw.init = &(struct clk_init_data){
18861833 .name = "gcc_pcie_1_cfg_ahb_clk",
1887− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
1888− .num_parents = 1,
1889− .flags = CLK_SET_RATE_PARENT,
18901834 .ops = &clk_branch2_ops,
18911835 },
18921836 },
@@ -1899,9 +1843,6 @@ static struct clk_branch gcc_pcie_1_mstr_axi_clk = { · 6 unmodified lines
18991843 .enable_mask = BIT(0),
19001844 .hw.init = &(struct clk_init_data){
19011845 .name = "gcc_pcie_1_mstr_axi_clk",
1902− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1903− .num_parents = 1,
1904− .flags = CLK_SET_RATE_PARENT,
19051846 .ops = &clk_branch2_ops,
19061847 },
19071848 },
@@ -1930,9 +1871,6 @@ static struct clk_branch gcc_pcie_1_slv_axi_clk = { · 22 unmodified lines
19301871 .enable_mask = BIT(0),
19311872 .hw.init = &(struct clk_init_data){
19321873 .name = "gcc_pcie_1_slv_axi_clk",
1933− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
1934− .num_parents = 1,
1935− .flags = CLK_SET_RATE_PARENT,
19361874 .ops = &clk_branch2_ops,
19371875 },
19381876 },
@@ -1960,8 +1898,6 @@ static struct clk_branch gcc_pdm_ahb_clk = { · 21 unmodified lines
19601898 .enable_mask = BIT(0),
19611899 .hw.init = &(struct clk_init_data){
19621900 .name = "gcc_pdm_ahb_clk",
1963− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1964− .num_parents = 1,
19651901 .ops = &clk_branch2_ops,
19661902 },
19671903 },
@@ -1989,9 +1925,6 @@ static struct clk_branch gcc_sdcc1_ahb_clk = { · 21 unmodified lines
19891925 .enable_mask = BIT(0),
19901926 .hw.init = &(struct clk_init_data){
19911927 .name = "gcc_sdcc1_ahb_clk",
1992− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
1993− .num_parents = 1,
1994− .flags = CLK_SET_RATE_PARENT,
19951928 .ops = &clk_branch2_ops,
19961929 },
19971930 },
@@ -2004,9 +1937,6 @@ static struct clk_branch gcc_sdcc2_ahb_clk = { · 6 unmodified lines
20041937 .enable_mask = BIT(0),
20051938 .hw.init = &(struct clk_init_data){
20061939 .name = "gcc_sdcc2_ahb_clk",
2007− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2008− .num_parents = 1,
2009− .flags = CLK_SET_RATE_PARENT,
20101940 .ops = &clk_branch2_ops,
20111941 },
20121942 },
@@ -2034,9 +1964,6 @@ static struct clk_branch gcc_sdcc3_ahb_clk = { · 21 unmodified lines
20341964 .enable_mask = BIT(0),
20351965 .hw.init = &(struct clk_init_data){
20361966 .name = "gcc_sdcc3_ahb_clk",
2037− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2038− .num_parents = 1,
2039− .flags = CLK_SET_RATE_PARENT,
20401967 .ops = &clk_branch2_ops,
20411968 },
20421969 },
@@ -2064,9 +1991,6 @@ static struct clk_branch gcc_sdcc4_ahb_clk = { · 21 unmodified lines
20641991 .enable_mask = BIT(0),
20651992 .hw.init = &(struct clk_init_data){
20661993 .name = "gcc_sdcc4_ahb_clk",
2067− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2068− .num_parents = 1,
2069− .flags = CLK_SET_RATE_PARENT,
20701994 .ops = &clk_branch2_ops,
20711995 },
20721996 },
@@ -2124,8 +2048,6 @@ static struct clk_branch gcc_tsif_ahb_clk = { · 51 unmodified lines
21242048 .enable_mask = BIT(0),
21252049 .hw.init = &(struct clk_init_data){
21262050 .name = "gcc_tsif_ahb_clk",
2127− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2128− .num_parents = 1,
21292051 .ops = &clk_branch2_ops,
21302052 },
21312053 },
@@ -2153,8 +2075,6 @@ static struct clk_branch gcc_ufs_ahb_clk = { · 21 unmodified lines
21532075 .enable_mask = BIT(0),
21542076 .hw.init = &(struct clk_init_data){
21552077 .name = "gcc_ufs_ahb_clk",
2156− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
2157− .num_parents = 1,
21582078 .ops = &clk_branch2_ops,
21592079 },
21602080 },
@@ -2198,8 +2118,6 @@ static struct clk_branch gcc_ufs_rx_symbol_0_clk = { · 37 unmodified lines
21982118 .enable_mask = BIT(0),
21992119 .hw.init = &(struct clk_init_data){
22002120 .name = "gcc_ufs_rx_symbol_0_clk",
2201− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2202− .num_parents = 1,
22032121 .ops = &clk_branch2_ops,
22042122 },
22052123 },
@@ -2213,8 +2131,6 @@ static struct clk_branch gcc_ufs_rx_symbol_1_clk = { · 7 unmodified lines
22132131 .enable_mask = BIT(0),
22142132 .hw.init = &(struct clk_init_data){
22152133 .name = "gcc_ufs_rx_symbol_1_clk",
2216− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2217− .num_parents = 1,
22182134 .ops = &clk_branch2_ops,
22192135 },
22202136 },
@@ -2243,8 +2159,6 @@ static struct clk_branch gcc_ufs_tx_symbol_0_clk = { · 22 unmodified lines
22432159 .enable_mask = BIT(0),
22442160 .hw.init = &(struct clk_init_data){
22452161 .name = "gcc_ufs_tx_symbol_0_clk",
2246− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2247− .num_parents = 1,
22482162 .ops = &clk_branch2_ops,
22492163 },
22502164 },
@@ -2258,8 +2172,6 @@ static struct clk_branch gcc_ufs_tx_symbol_1_clk = { · 7 unmodified lines
22582172 .enable_mask = BIT(0),
22592173 .hw.init = &(struct clk_init_data){
22602174 .name = "gcc_ufs_tx_symbol_1_clk",
2261− .parent_hws = (const struct clk_hw *[]){ &system_noc_clk_src.clkr.hw },
2262− .num_parents = 1,
22632175 .ops = &clk_branch2_ops,
22642176 },
22652177 },
@@ -2364,8 +2276,6 @@ static struct clk_branch gcc_usb_hs_ahb_clk = { · 98 unmodified lines
23642276 .enable_mask = BIT(0),
23652277 .hw.init = &(struct clk_init_data){
23662278 .name = "gcc_usb_hs_ahb_clk",
2367− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2368− .num_parents = 1,
23692279 .ops = &clk_branch2_ops,
23702280 },
23712281 },
@@ -2488,8 +2398,6 @@ static struct clk_branch gcc_boot_rom_ahb_clk = { · 116 unmodified lines
24882398 .enable_mask = BIT(10),
24892399 .hw.init = &(struct clk_init_data){
24902400 .name = "gcc_boot_rom_ahb_clk",
2491− .parent_hws = (const struct clk_hw *[]){ &config_noc_clk_src.clkr.hw },
2492− .num_parents = 1,
24932401 .ops = &clk_branch2_ops,
24942402 },
24952403 },
@@ -2503,8 +2411,6 @@ static struct clk_branch gcc_prng_ahb_clk = { · 7 unmodified lines
25032411 .enable_mask = BIT(13),
25042412 .hw.init = &(struct clk_init_data){
25052413 .name = "gcc_prng_ahb_clk",
2506− .parent_hws = (const struct clk_hw *[]){ &periph_noc_clk_src.clkr.hw },
2507− .num_parents = 1,
25082414 .ops = &clk_branch2_ops,
25092415 },
25102416 },
@@ -2547,9 +2453,6 @@ static struct clk_regmap *gcc_msm8994_clocks[] = { · 36 unmodified lines
25472453 [GPLL0] = &gpll0.clkr,
25482454 [GPLL4_EARLY] = &gpll4_early.clkr,
25492455 [GPLL4] = &gpll4.clkr,
2550− [CONFIG_NOC_CLK_SRC] = &config_noc_clk_src.clkr,
2551− [PERIPH_NOC_CLK_SRC] = &periph_noc_clk_src.clkr,
2552− [SYSTEM_NOC_CLK_SRC] = &system_noc_clk_src.clkr,
25532456 [UFS_AXI_CLK_SRC] = &ufs_axi_clk_src.clkr,
25542457 [USB30_MASTER_CLK_SRC] = &usb30_master_clk_src.clkr,
25552458 [BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr,
@@ -2696,6 +2599,15 @@ static struct clk_regmap *gcc_msm8994_clocks[] = { · 140 unmodified lines
26962599 [USB_SS_PHY_LDO] = &usb_ss_phy_ldo.clkr,
26972600 [GCC_BOOT_ROM_AHB_CLK] = &gcc_boot_rom_ahb_clk.clkr,
26982601 [GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr,
2602+
2603+ /*
2604+ * The following clocks should NOT be managed by this driver, but they once were
2605+ * mistakengly added. Now they are only here to indicate that they are not defined
2606+ * on purpose, even though the names will stay in the header file (for ABI sanity).
2607+ */
2608+ [CONFIG_NOC_CLK_SRC] = NULL,
2609+ [PERIPH_NOC_CLK_SRC] = NULL,
2610+ [SYSTEM_NOC_CLK_SRC] = NULL,
26992611 };
27002612
27012613 static struct gdsc *gcc_msm8994_gdscs[] = {
drivers/cpufreq/cpufreq.c+4−0
@@ -1518,6 +1518,10 @@ static int cpufreq_online(unsigned int cpu) · 1517 unmodified lines
15181518
15191519 kobject_uevent(&policy->kobj, KOBJ_ADD);
15201520
1521+ /* Callback for handling stuff after policy is ready */
1522+ if (cpufreq_driver->ready)
1523+ cpufreq_driver->ready(policy);
1524+
15211525 if (cpufreq_thermal_control_enabled(cpufreq_driver))
15221526 policy->cdev = of_cpufreq_cooling_register(policy);
15231527
drivers/cpufreq/qcom-cpufreq-hw.c+10−1
@@ -388,7 +388,7 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index) · 387 unmodified lines
388388
389389 snprintf(data->irq_name, sizeof(data->irq_name), "dcvsh-irq-%u", policy->cpu);
390390 ret = request_threaded_irq(data->throttle_irq, NULL, qcom_lmh_dcvs_handle_irq,
391− IRQF_ONESHOT, data->irq_name, data);
391+ IRQF_ONESHOT | IRQF_NO_AUTOEN, data->irq_name, data);
392392 if (ret) {
393393 dev_err(&pdev->dev, "Error registering %s: %d\n", data->irq_name, ret);
394394 return 0;
@@ -542,6 +542,14 @@ static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy) · 147 unmodified lines
542542 return 0;
543543 }
544544
545+static void qcom_cpufreq_ready(struct cpufreq_policy *policy)
546+{
547+ struct qcom_cpufreq_data *data = policy->driver_data;
548+
549+ if (data->throttle_irq >= 0)
550+ enable_irq(data->throttle_irq);
551+}
552+
545553 static struct freq_attr *qcom_cpufreq_hw_attr[] = {
546554 &cpufreq_freq_attr_scaling_available_freqs,
547555 &cpufreq_freq_attr_scaling_boost_freqs,
@@ -561,6 +569,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { · 13 unmodified lines
561569 .fast_switch = qcom_cpufreq_hw_fast_switch,
562570 .name = "qcom-cpufreq-hw",
563571 .attr = qcom_cpufreq_hw_attr,
572+ .ready = qcom_cpufreq_ready,
564573 };
565574
566575 static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
drivers/dma/at_xdmac.c+3−1
@@ -1681,8 +1681,10 @@ static void at_xdmac_tasklet(struct tasklet_struct *t) · 1680 unmodified lines
16811681 __func__, atchan->irq_status);
16821682
16831683 if (!(atchan->irq_status & AT_XDMAC_CIS_LIS) &&
1684− !(atchan->irq_status & error_mask))
1684+ !(atchan->irq_status & error_mask)) {
1685+ spin_unlock_irq(&atchan->lock);
16851686 return;
1687+ }
16861688
16871689 if (atchan->irq_status & error_mask)
16881690 at_xdmac_handle_error(atchan);
drivers/dma/ptdma/ptdma-dev.c+9−8
@@ -207,7 +207,7 @@ int pt_core_init(struct pt_device *pt) · 206 unmodified lines
207207 if (!cmd_q->qbase) {
208208 dev_err(dev, "unable to allocate command queue\n");
209209 ret = -ENOMEM;
210− goto e_dma_alloc;
210+ goto e_destroy_pool;
211211 }
212212
213213 cmd_q->qidx = 0;
@@ -229,8 +229,10 @@ int pt_core_init(struct pt_device *pt) · 15 unmodified lines
229229
230230 /* Request an irq */
231231 ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, dev_name(pt->dev), pt);
232− if (ret)
233− goto e_pool;
232+ if (ret) {
233+ dev_err(dev, "unable to allocate an IRQ\n");
234+ goto e_free_dma;
235+ }
234236
235237 /* Update the device registers with queue information. */
236238 cmd_q->qcontrol &= ~CMD_Q_SIZE;
@@ -250,21 +252,20 @@ int pt_core_init(struct pt_device *pt) · 13 unmodified lines
250252 /* Register the DMA engine support */
251253 ret = pt_dmaengine_register(pt);
252254 if (ret)
253− goto e_dmaengine;
255+ goto e_free_irq;
254256
255257 /* Set up debugfs entries */
256258 ptdma_debugfs_setup(pt);
257259
258260 return 0;
259261
260−e_dmaengine:
262+e_free_irq:
261263 free_irq(pt->pt_irq, pt);
262264
263−e_dma_alloc:
265+e_free_dma:
264266 dma_free_coherent(dev, cmd_q->qsize, cmd_q->qbase, cmd_q->qbase_dma);
265267
266−e_pool:
267− dev_err(dev, "unable to allocate an IRQ\n");
268+e_destroy_pool:
268269 dma_pool_destroy(pt->cmd_q.dma_pool);
269270
270271 return ret;
drivers/dma/sh/rcar-dmac.c+7−2
@@ -1868,8 +1868,13 @@ static int rcar_dmac_probe(struct platform_device *pdev) · 1867 unmodified lines
18681868
18691869 dmac->dev = &pdev->dev;
18701870 platform_set_drvdata(pdev, dmac);
1871− dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872− dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1871+ ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872+ if (ret)
1873+ return ret;
1874+
1875+ ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1876+ if (ret)
1877+ return ret;
18731878
18741879 ret = rcar_dmac_parse_of(&pdev->dev, dmac);
18751880 if (ret < 0)
drivers/dma/sh/shdma-base.c+3−1
@@ -115,8 +115,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) · 114 unmodified lines
115115 ret = pm_runtime_get(schan->dev);
116116
117117 spin_unlock_irq(&schan->chan_lock);
118− if (ret < 0)
118+ if (ret < 0) {
119119 dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret);
120+ pm_runtime_put(schan->dev);
121+ }
120122
121123 pm_runtime_barrier(schan->dev);
122124
drivers/dma/stm32-dmamux.c+3−1
@@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev) · 291 unmodified lines
292292 ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
293293 &stm32_dmamux->dmarouter);
294294 if (ret)
295− goto err_clk;
295+ goto pm_disable;
296296
297297 return 0;
298298
299+pm_disable:
300+ pm_runtime_disable(&pdev->dev);
299301 err_clk:
300302 clk_disable_unprepare(stm32_dmamux->clk);
301303
drivers/edac/edac_mc.c+1−1
@@ -215,7 +215,7 @@ void *edac_align_ptr(void **p, unsigned int size, int n_elems) · 214 unmodified lines
215215 else
216216 return (char *)ptr;
217217
218− r = (unsigned long)p % align;
218+ r = (unsigned long)ptr % align;
219219
220220 if (r == 0)
221221 return (char *)ptr;
drivers/gpio/gpio-rockchip.c+29−27
@@ -410,10 +410,8 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) · 409 unmodified lines
410410 level = rockchip_gpio_readl(bank, bank->gpio_regs->int_type);
411411 polarity = rockchip_gpio_readl(bank, bank->gpio_regs->int_polarity);
412412
413− switch (type) {
414− case IRQ_TYPE_EDGE_BOTH:
413+ if (type == IRQ_TYPE_EDGE_BOTH) {
415414 if (bank->gpio_type == GPIO_TYPE_V2) {
416− bank->toggle_edge_mode &= ~mask;
417415 rockchip_gpio_writel_bit(bank, d->hwirq, 1,
418416 bank->gpio_regs->int_bothedge);
419417 goto out;
@@ -431,30 +429,34 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type) · 11 unmodified lines
431429 else
432430 polarity |= mask;
433431 }
434− break;
435− case IRQ_TYPE_EDGE_RISING:
436− bank->toggle_edge_mode &= ~mask;
437− level |= mask;
438− polarity |= mask;
439− break;
440− case IRQ_TYPE_EDGE_FALLING:
441− bank->toggle_edge_mode &= ~mask;
442− level |= mask;
443− polarity &= ~mask;
444− break;
445− case IRQ_TYPE_LEVEL_HIGH:
446− bank->toggle_edge_mode &= ~mask;
447− level &= ~mask;
448− polarity |= mask;
449− break;
450− case IRQ_TYPE_LEVEL_LOW:
451− bank->toggle_edge_mode &= ~mask;
452− level &= ~mask;
453− polarity &= ~mask;
454− break;
455− default:
456− ret = -EINVAL;
457− goto out;
432+ } else {
433+ if (bank->gpio_type == GPIO_TYPE_V2) {
434+ rockchip_gpio_writel_bit(bank, d->hwirq, 0,
435+ bank->gpio_regs->int_bothedge);
436+ } else {
437+ bank->toggle_edge_mode &= ~mask;
438+ }
439+ switch (type) {
440+ case IRQ_TYPE_EDGE_RISING:
441+ level |= mask;
442+ polarity |= mask;
443+ break;
444+ case IRQ_TYPE_EDGE_FALLING:
445+ level |= mask;
446+ polarity &= ~mask;
447+ break;
448+ case IRQ_TYPE_LEVEL_HIGH:
449+ level &= ~mask;
450+ polarity |= mask;
451+ break;
452+ case IRQ_TYPE_LEVEL_LOW:
453+ level &= ~mask;
454+ polarity &= ~mask;
455+ break;
456+ default:
457+ ret = -EINVAL;
458+ goto out;
459+ }
458460 }
459461
460462 rockchip_gpio_writel(bank, level, bank->gpio_regs->int_type);
drivers/gpio/gpio-tegra186.c+10−4
@@ -343,9 +343,12 @@ static int tegra186_gpio_of_xlate(struct gpio_chip *chip, · 342 unmodified lines
343343 return offset + pin;
344344 }
345345
346+#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio)
347+
346348 static void tegra186_irq_ack(struct irq_data *data)
347349 {
348− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
350+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
351+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
349352 void __iomem *base;
350353
351354 base = tegra186_gpio_get_base(gpio, data->hwirq);
@@ -357,7 +360,8 @@ static void tegra186_irq_ack(struct irq_data *data) · 5 unmodified lines
357360
358361 static void tegra186_irq_mask(struct irq_data *data)
359362 {
360− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
363+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
364+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
361365 void __iomem *base;
362366 u32 value;
363367
@@ -372,7 +376,8 @@ static void tegra186_irq_mask(struct irq_data *data) · 8 unmodified lines
372376
373377 static void tegra186_irq_unmask(struct irq_data *data)
374378 {
375− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
379+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
380+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
376381 void __iomem *base;
377382 u32 value;
378383
@@ -387,7 +392,8 @@ static void tegra186_irq_unmask(struct irq_data *data) · 8 unmodified lines
387392
388393 static int tegra186_irq_set_type(struct irq_data *data, unsigned int type)
389394 {
390− struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data);
395+ struct gpio_chip *gc = irq_data_get_irq_chip_data(data);
396+ struct tegra_gpio *gpio = to_tegra_gpio(gc);
391397 void __iomem *base;
392398 u32 value;
393399
drivers/gpio/gpiolib.c+10−0
@@ -3147,6 +3147,16 @@ int gpiod_to_irq(const struct gpio_desc *desc) · 3146 unmodified lines
31473147
31483148 return retirq;
31493149 }
3150+#ifdef CONFIG_GPIOLIB_IRQCHIP
3151+ if (gc->irq.chip) {
3152+ /*
3153+ * Avoid race condition with other code, which tries to lookup
3154+ * an IRQ before the irqchip has been properly registered,
3155+ * i.e. while gpiochip is still being brought up.
3156+ */
3157+ return -EPROBE_DEFER;
3158+ }
3159+#endif
31503160 return -ENXIO;
31513161 }
31523162 EXPORT_SYMBOL_GPL(gpiod_to_irq);
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c+1−1
@@ -1141,7 +1141,7 @@ int amdgpu_display_framebuffer_init(struct drm_device *dev, · 1140 unmodified lines
11411141 if (ret)
11421142 return ret;
11431143
1144− if (!dev->mode_config.allow_fb_modifiers) {
1144+ if (!dev->mode_config.allow_fb_modifiers && !adev->enable_virtual_display) {
11451145 drm_WARN_ONCE(dev, adev->family >= AMDGPU_FAMILY_AI,
11461146 "GFX9+ requires FB check based on format modifier\n");
11471147 ret = check_tiling_flags_gfx6(rfb);
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+3−0
@@ -2011,6 +2011,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev, · 2010 unmodified lines
20112011 return -ENODEV;
20122012 }
20132013
2014+ if (amdgpu_aspm == -1 && !pcie_aspm_enabled(pdev))
2015+ amdgpu_aspm = 0;
2016+
20142017 if (amdgpu_virtual_display ||
20152018 amdgpu_device_asic_has_dc_support(flags & AMD_ASIC_MASK))
20162019 supports_atomic = true;
drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c+1−2
@@ -391,7 +391,6 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev, · 390 unmodified lines
391391 int index)
392392 {
393393 struct drm_plane *plane;
394− uint64_t modifiers[] = {DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID};
395394 int ret;
396395
397396 plane = kzalloc(sizeof(*plane), GFP_KERNEL);
@@ -402,7 +401,7 @@ static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev, · 4 unmodified lines
402401 &amdgpu_vkms_plane_funcs,
403402 amdgpu_vkms_formats,
404403 ARRAY_SIZE(amdgpu_vkms_formats),
405− modifiers, type, NULL);
404+ NULL, type, NULL);
406405 if (ret) {
407406 kfree(plane);
408407 return ERR_PTR(ret);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c+7−2
@@ -768,11 +768,16 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm, · 767 unmodified lines
768768 * Check if all VM PDs/PTs are ready for updates
769769 *
770770 * Returns:
771− * True if eviction list is empty.
771+ * True if VM is not evicting.
772772 */
773773 bool amdgpu_vm_ready(struct amdgpu_vm *vm)
774774 {
775− return list_empty(&vm->evicted);
775+ bool ret;
776+
777+ amdgpu_vm_eviction_lock(vm);
778+ ret = !vm->evicting;
779+ amdgpu_vm_eviction_unlock(vm);
780+ return ret;
776781 }
777782
778783 /**
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c+8−0
@@ -2057,6 +2057,10 @@ static int sdma_v4_0_suspend(void *handle) · 2056 unmodified lines
20572057 {
20582058 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
20592059
2060+ /* SMU saves SDMA state for us */
2061+ if (adev->in_s0ix)
2062+ return 0;
2063+
20602064 return sdma_v4_0_hw_fini(adev);
20612065 }
20622066
@@ -2064,6 +2068,10 @@ static int sdma_v4_0_resume(void *handle) · 1 unmodified line
20642068 {
20652069 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
20662070
2071+ /* SMU restores SDMA state for us */
2072+ if (adev->in_s0ix)
2073+ return 0;
2074+
20672075 return sdma_v4_0_hw_init(adev);
20682076 }
20692077
drivers/gpu/drm/amd/amdgpu/soc15.c+6−3
@@ -619,8 +619,8 @@ soc15_asic_reset_method(struct amdgpu_device *adev) · 618 unmodified lines
619619 static int soc15_asic_reset(struct amdgpu_device *adev)
620620 {
621621 /* original raven doesn't have full asic reset */
622− if ((adev->apu_flags & AMD_APU_IS_RAVEN) &&
623− !(adev->apu_flags & AMD_APU_IS_RAVEN2))
622+ if ((adev->apu_flags & AMD_APU_IS_RAVEN) ||
623+ (adev->apu_flags & AMD_APU_IS_RAVEN2))
624624 return 0;
625625
626626 switch (soc15_asic_reset_method(adev)) {
@@ -1114,8 +1114,11 @@ static int soc15_common_early_init(void *handle) · 487 unmodified lines
11141114 AMD_CG_SUPPORT_SDMA_LS |
11151115 AMD_CG_SUPPORT_VCN_MGCG;
11161116
1117+ /*
1118+ * MMHUB PG needs to be disabled for Picasso for
1119+ * stability reasons.
1120+ */
11171121 adev->pg_flags = AMD_PG_SUPPORT_SDMA |
1118− AMD_PG_SUPPORT_MMHUB |
11191122 AMD_PG_SUPPORT_VCN;
11201123 } else {
11211124 adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG |
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+9−8
@@ -4256,6 +4256,9 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 4255 unmodified lines
42564256 }
42574257 #endif
42584258
4259+ /* Disable vblank IRQs aggressively for power-saving. */
4260+ adev_to_drm(adev)->vblank_disable_immediate = true;
4261+
42594262 /* loops over all connectors on the board */
42604263 for (i = 0; i < link_cnt; i++) {
42614264 struct dc_link *link = NULL;
@@ -4301,19 +4304,17 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) · 39 unmodified lines
43014304 update_connector_ext_caps(aconnector);
43024305 if (psr_feature_enabled)
43034306 amdgpu_dm_set_psr_caps(link);
4307+
4308+ /* TODO: Fix vblank control helpers to delay PSR entry to allow this when
4309+ * PSR is also supported.
4310+ */
4311+ if (link->psr_settings.psr_feature_enabled)
4312+ adev_to_drm(adev)->vblank_disable_immediate = false;
43044313 }
43054314
43064315
43074316 }
43084317
4309− /*
4310− * Disable vblank IRQs aggressively for power-saving.
4311− *
4312− * TODO: Fix vblank control helpers to delay PSR entry to allow this when PSR
4313− * is also supported.
4314− */
4315− adev_to_drm(adev)->vblank_disable_immediate = !psr_feature_enabled;
4316−
43174318 /* Software is initialized. Now we can register interrupt handlers. */
43184319 switch (adev->asic_type) {
43194320 #if defined(CONFIG_DRM_AMD_DC_SI)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn30/dcn30_clk_mgr.c+2−0
@@ -473,8 +473,10 @@ static void dcn3_get_memclk_states_from_smu(struct clk_mgr *clk_mgr_base) · 472 unmodified lines
473473 clk_mgr_base->bw_params->dc_mode_softmax_memclk = dcn30_smu_get_dc_mode_max_dpm_freq(clk_mgr, PPCLK_UCLK);
474474
475475 /* Refresh bounding box */
476+ DC_FP_START();
476477 clk_mgr_base->ctx->dc->res_pool->funcs->update_bw_bounding_box(
477478 clk_mgr->base.ctx->dc, clk_mgr_base->bw_params);
479+ DC_FP_END();
478480 }
479481
480482 static bool dcn3_is_smu_present(struct clk_mgr *clk_mgr_base)
drivers/gpu/drm/amd/display/dc/core/dc.c+5−2
@@ -985,10 +985,13 @@ static bool dc_construct(struct dc *dc, · 984 unmodified lines
985985 goto fail;
986986 #ifdef CONFIG_DRM_AMD_DC_DCN
987987 dc->clk_mgr->force_smu_not_present = init_params->force_smu_not_present;
988−#endif
989988
990− if (dc->res_pool->funcs->update_bw_bounding_box)
989+ if (dc->res_pool->funcs->update_bw_bounding_box) {
990+ DC_FP_START();
991991 dc->res_pool->funcs->update_bw_bounding_box(dc, dc->clk_mgr->bw_params);
992+ DC_FP_END();
993+ }
994+#endif
992995
993996 /* Creation of current_state must occur after dc->dml
994997 * is initialized in dc_create_resource_pool because
drivers/gpu/drm/amd/display/dc/core/dc_resource.c+0−4
@@ -1964,10 +1964,6 @@ enum dc_status dc_remove_stream_from_ctx( · 1963 unmodified lines
19641964 dc->res_pool,
19651965 del_pipe->stream_res.stream_enc,
19661966 false);
1967− /* Release link encoder from stream in new dc_state. */
1968− if (dc->res_pool->funcs->link_enc_unassign)
1969− dc->res_pool->funcs->link_enc_unassign(new_ctx, del_pipe->stream);
1970−
19711967 #if defined(CONFIG_DRM_AMD_DC_DCN)
19721968 if (is_dp_128b_132b_signal(del_pipe)) {
19731969 update_hpo_dp_stream_engine_usage(
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c+52−6
@@ -421,6 +421,36 @@ static int sienna_cichlid_store_powerplay_table(struct smu_context *smu) · 420 unmodified lines
421421 return 0;
422422 }
423423
424+static int sienna_cichlid_patch_pptable_quirk(struct smu_context *smu)
425+{
426+ struct amdgpu_device *adev = smu->adev;
427+ uint32_t *board_reserved;
428+ uint16_t *freq_table_gfx;
429+ uint32_t i;
430+
431+ /* Fix some OEM SKU specific stability issues */
432+ GET_PPTABLE_MEMBER(BoardReserved, &board_reserved);
433+ if ((adev->pdev->device == 0x73DF) &&
434+ (adev->pdev->revision == 0XC3) &&
435+ (adev->pdev->subsystem_device == 0x16C2) &&
436+ (adev->pdev->subsystem_vendor == 0x1043))
437+ board_reserved[0] = 1387;
438+
439+ GET_PPTABLE_MEMBER(FreqTableGfx, &freq_table_gfx);
440+ if ((adev->pdev->device == 0x73DF) &&
441+ (adev->pdev->revision == 0XC3) &&
442+ ((adev->pdev->subsystem_device == 0x16C2) ||
443+ (adev->pdev->subsystem_device == 0x133C)) &&
444+ (adev->pdev->subsystem_vendor == 0x1043)) {
445+ for (i = 0; i < NUM_GFXCLK_DPM_LEVELS; i++) {
446+ if (freq_table_gfx[i] > 2500)
447+ freq_table_gfx[i] = 2500;
448+ }
449+ }
450+
451+ return 0;
452+}
453+
424454 static int sienna_cichlid_setup_pptable(struct smu_context *smu)
425455 {
426456 int ret = 0;
@@ -441,7 +471,7 @@ static int sienna_cichlid_setup_pptable(struct smu_context *smu) · 14 unmodified lines
441471 if (ret)
442472 return ret;
443473
444− return ret;
474+ return sienna_cichlid_patch_pptable_quirk(smu);
445475 }
446476
447477 static int sienna_cichlid_tables_init(struct smu_context *smu)
@@ -1238,21 +1268,37 @@ static int sienna_cichlid_populate_umd_state_clk(struct smu_context *smu) · 790 unmodified lines
12381268 &dpm_context->dpm_tables.soc_table;
12391269 struct smu_umd_pstate_table *pstate_table =
12401270 &smu->pstate_table;
1271+ struct amdgpu_device *adev = smu->adev;
12411272
12421273 pstate_table->gfxclk_pstate.min = gfx_table->min;
12431274 pstate_table->gfxclk_pstate.peak = gfx_table->max;
1244− if (gfx_table->max >= SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK)
1245− pstate_table->gfxclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK;
12461275
12471276 pstate_table->uclk_pstate.min = mem_table->min;
12481277 pstate_table->uclk_pstate.peak = mem_table->max;
1249− if (mem_table->max >= SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK)
1250− pstate_table->uclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK;
12511278
12521279 pstate_table->socclk_pstate.min = soc_table->min;
12531280 pstate_table->socclk_pstate.peak = soc_table->max;
1254− if (soc_table->max >= SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK)
1281+
1282+ switch (adev->asic_type) {
1283+ case CHIP_SIENNA_CICHLID:
1284+ case CHIP_NAVY_FLOUNDER:
1285+ pstate_table->gfxclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_GFXCLK;
1286+ pstate_table->uclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK;
12551287 pstate_table->socclk_pstate.standard = SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK;
1288+ break;
1289+ case CHIP_DIMGREY_CAVEFISH:
1290+ pstate_table->gfxclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_GFXCLK;
1291+ pstate_table->uclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_MEMCLK;
1292+ pstate_table->socclk_pstate.standard = DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_SOCCLK;
1293+ break;
1294+ case CHIP_BEIGE_GOBY:
1295+ pstate_table->gfxclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_GFXCLK;
1296+ pstate_table->uclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_MEMCLK;
1297+ pstate_table->socclk_pstate.standard = BEIGE_GOBY_UMD_PSTATE_PROFILING_SOCCLK;
1298+ break;
1299+ default:
1300+ break;
1301+ }
12561302
12571303 return 0;
12581304 }
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.h+8−0
@@ -33,6 +33,14 @@ typedef enum { · 32 unmodified lines
3333 #define SIENNA_CICHLID_UMD_PSTATE_PROFILING_SOCCLK 960
3434 #define SIENNA_CICHLID_UMD_PSTATE_PROFILING_MEMCLK 1000
3535
36+#define DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_GFXCLK 1950
37+#define DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_SOCCLK 960
38+#define DIMGREY_CAVEFISH_UMD_PSTATE_PROFILING_MEMCLK 676
39+
40+#define BEIGE_GOBY_UMD_PSTATE_PROFILING_GFXCLK 2200
41+#define BEIGE_GOBY_UMD_PSTATE_PROFILING_SOCCLK 960
42+#define BEIGE_GOBY_UMD_PSTATE_PROFILING_MEMCLK 1000
43+
3644 extern void sienna_cichlid_set_ppt_funcs(struct smu_context *smu);
3745
3846 #endif
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c+2−7
@@ -282,14 +282,9 @@ static int yellow_carp_post_smu_init(struct smu_context *smu) · 281 unmodified lines
282282
283283 static int yellow_carp_mode_reset(struct smu_context *smu, int type)
284284 {
285− int ret = 0, index = 0;
286−
287− index = smu_cmn_to_asic_specific_index(smu, CMN2ASIC_MAPPING_MSG,
288− SMU_MSG_GfxDeviceDriverReset);
289− if (index < 0)
290− return index == -EACCES ? 0 : index;
285+ int ret = 0;
291286
292− ret = smu_cmn_send_smc_msg_with_param(smu, (uint16_t)index, type, NULL);
287+ ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_GfxDeviceDriverReset, type, NULL);
293288 if (ret)
294289 dev_err(smu->adev->dev, "Failed to mode reset!\n");
295290
drivers/gpu/drm/drm_atomic_uapi.c+8−6
@@ -76,15 +76,17 @@ int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state, · 75 unmodified lines
7676 state->mode_blob = NULL;
7777
7878 if (mode) {
79+ struct drm_property_blob *blob;
80+
7981 drm_mode_convert_to_umode(&umode, mode);
80− state->mode_blob =
81− drm_property_create_blob(state->crtc->dev,
82− sizeof(umode),
83− &umode);
84− if (IS_ERR(state->mode_blob))
85− return PTR_ERR(state->mode_blob);
82+ blob = drm_property_create_blob(crtc->dev,
83+ sizeof(umode), &umode);
84+ if (IS_ERR(blob))
85+ return PTR_ERR(blob);
8686
8787 drm_mode_copy(&state->mode, mode);
88+
89+ state->mode_blob = blob;
8890 state->enable = true;
8991 drm_dbg_atomic(crtc->dev,
9092 "Set [MODE:%s] for [CRTC:%d:%s] state %p\n",
drivers/gpu/drm/drm_edid.c+1−1
@@ -5345,6 +5345,7 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi · 5344 unmodified lines
53455345 if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
53465346 return quirks;
53475347
5348+ info->color_formats |= DRM_COLOR_FORMAT_RGB444;
53485349 drm_parse_cea_ext(connector, edid);
53495350
53505351 /*
@@ -5393,7 +5394,6 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi · 42 unmodified lines
53935394 DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n",
53945395 connector->name, info->bpc);
53955396
5396− info->color_formats |= DRM_COLOR_FORMAT_RGB444;
53975397 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444)
53985398 info->color_formats |= DRM_COLOR_FORMAT_YCRCB444;
53995399 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422)
drivers/gpu/drm/drm_gem_cma_helper.c+1−0
@@ -512,6 +512,7 @@ int drm_gem_cma_mmap(struct drm_gem_cma_object *cma_obj, struct vm_area_struct * · 511 unmodified lines
512512 */
513513 vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node);
514514 vma->vm_flags &= ~VM_PFNMAP;
515+ vma->vm_flags |= VM_DONTEXPAND;
515516
516517 if (cma_obj->map_noncoherent) {
517518 vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
drivers/gpu/drm/i915/Kconfig+1−0
@@ -101,6 +101,7 @@ config DRM_I915_USERPTR · 100 unmodified lines
101101 config DRM_I915_GVT
102102 bool "Enable Intel GVT-g graphics virtualization host support"
103103 depends on DRM_I915
104+ depends on X86
104105 depends on 64BIT
105106 default n
106107 help
drivers/gpu/drm/i915/display/intel_bw.c+16−2
@@ -825,6 +825,7 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 824 unmodified lines
825825 unsigned int max_bw_point = 0, max_bw = 0;
826826 unsigned int num_qgv_points = dev_priv->max_bw[0].num_qgv_points;
827827 unsigned int num_psf_gv_points = dev_priv->max_bw[0].num_psf_gv_points;
828+ bool changed = false;
828829 u32 mask = 0;
829830
830831 /* FIXME earlier gens need some checks too */
@@ -868,6 +869,8 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 37 unmodified lines
868869 new_bw_state->data_rate[crtc->pipe] = new_data_rate;
869870 new_bw_state->num_active_planes[crtc->pipe] = new_active_planes;
870871
872+ changed = true;
873+
871874 drm_dbg_kms(&dev_priv->drm,
872875 "pipe %c data rate %u num active planes %u\n",
873876 pipe_name(crtc->pipe),
@@ -875,7 +878,19 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 1 unmodified line
875878 new_bw_state->num_active_planes[crtc->pipe]);
876879 }
877880
878− if (!new_bw_state)
881+ old_bw_state = intel_atomic_get_old_bw_state(state);
882+ new_bw_state = intel_atomic_get_new_bw_state(state);
883+
884+ if (new_bw_state &&
885+ intel_can_enable_sagv(dev_priv, old_bw_state) !=
886+ intel_can_enable_sagv(dev_priv, new_bw_state))
887+ changed = true;
888+
889+ /*
890+ * If none of our inputs (data rates, number of active
891+ * planes, SAGV yes/no) changed then nothing to do here.
892+ */
893+ if (!changed)
879894 return 0;
880895
881896 ret = intel_atomic_lock_global_state(&new_bw_state->base);
@@ -961,7 +976,6 @@ int intel_bw_atomic_check(struct intel_atomic_state *state) · 79 unmodified lines
961976 */
962977 new_bw_state->qgv_points_mask = ~allowed_points & mask;
963978
964− old_bw_state = intel_atomic_get_old_bw_state(state);
965979 /*
966980 * If the actual mask had changed we need to make sure that
967981 * the commits are serialized(in case this is a nomodeset, nonblocking)
drivers/gpu/drm/i915/display/intel_bw.h+4−4
@@ -30,19 +30,19 @@ struct intel_bw_state { · 29 unmodified lines
3030 */
3131 u8 pipe_sagv_reject;
3232
33+ /* bitmask of active pipes */
34+ u8 active_pipes;
35+
3336 /*
3437 * Current QGV points mask, which restricts
3538 * some particular SAGV states, not to confuse
3639 * with pipe_sagv_mask.
3740 */
38− u8 qgv_points_mask;
41+ u16 qgv_points_mask;
3942
4043 unsigned int data_rate[I915_MAX_PIPES];
4144 u8 num_active_planes[I915_MAX_PIPES];
4245
43− /* bitmask of active pipes */
44− u8 active_pipes;
45−
4646 int min_cdclk;
4747 };
4848
drivers/gpu/drm/i915/display/intel_fbc.c+2−1
@@ -1115,7 +1115,8 @@ static int intel_fbc_check_plane(struct intel_atomic_state *state, · 1114 unmodified lines
11151115
11161116 /* Wa_22010751166: icl, ehl, tgl, dg1, rkl */
11171117 if (DISPLAY_VER(i915) >= 11 &&
1118− (plane_state->view.color_plane[0].y + drm_rect_height(&plane_state->uapi.src)) & 3) {
1118+ (plane_state->view.color_plane[0].y +
1119+ (drm_rect_height(&plane_state->uapi.src) >> 16)) & 3) {
11191120 plane_state->no_fbc_reason = "plane end Y offset misaligned";
11201121 return false;
11211122 }
drivers/gpu/drm/i915/display/intel_opregion.c+15−0
@@ -360,6 +360,21 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, · 359 unmodified lines
360360 port++;
361361 }
362362
363+ /*
364+ * The port numbering and mapping here is bizarre. The now-obsolete
365+ * swsci spec supports ports numbered [0..4]. Port E is handled as a
366+ * special case, but port F and beyond are not. The functionality is
367+ * supposed to be obsolete for new platforms. Just bail out if the port
368+ * number is out of bounds after mapping.
369+ */
370+ if (port > 4) {
371+ drm_dbg_kms(&dev_priv->drm,
372+ "[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n",
373+ intel_encoder->base.base.id, intel_encoder->base.name,
374+ port_name(intel_encoder->port), port);
375+ return -EINVAL;
376+ }
377+
363378 if (!enable)
364379 parm |= 4 << 8;
365380
drivers/gpu/drm/i915/display/intel_snps_phy.c+1−1
@@ -34,7 +34,7 @@ void intel_snps_phy_wait_for_calibration(struct drm_i915_private *dev_priv) · 33 unmodified lines
3434 if (intel_de_wait_for_clear(dev_priv, ICL_PHY_MISC(phy),
3535 DG2_PHY_DP_TX_ACK_MASK, 25))
3636 DRM_ERROR("SNPS PHY %c failed to calibrate after 25ms.\n",
37− phy);
37+ phy_name(phy));
3838 }
3939 }
4040
drivers/gpu/drm/i915/display/intel_tc.c+20−6
@@ -691,6 +691,8 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port) · 690 unmodified lines
691691 {
692692 struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
693693 struct intel_encoder *encoder = &dig_port->base;
694+ intel_wakeref_t tc_cold_wref;
695+ enum intel_display_power_domain domain;
694696 int active_links = 0;
695697
696698 mutex_lock(&dig_port->tc_lock);
@@ -702,12 +704,11 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port) · 5 unmodified lines
702704
703705 drm_WARN_ON(&i915->drm, dig_port->tc_mode != TC_PORT_DISCONNECTED);
704706 drm_WARN_ON(&i915->drm, dig_port->tc_lock_wakeref);
705− if (active_links) {
706− enum intel_display_power_domain domain;
707− intel_wakeref_t tc_cold_wref = tc_cold_block(dig_port, &domain);
708707
709− dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port);
708+ tc_cold_wref = tc_cold_block(dig_port, &domain);
710709
710+ dig_port->tc_mode = intel_tc_port_get_current_mode(dig_port);
711+ if (active_links) {
711712 if (!icl_tc_phy_is_connected(dig_port))
712713 drm_dbg_kms(&i915->drm,
713714 "Port %s: PHY disconnected with %d active link(s)\n",
@@ -716,10 +717,23 @@ void intel_tc_port_sanitize(struct intel_digital_port *dig_port) · 2 unmodified lines
716717
717718 dig_port->tc_lock_wakeref = tc_cold_block(dig_port,
718719 &dig_port->tc_lock_power_domain);
719−
720− tc_cold_unblock(dig_port, domain, tc_cold_wref);
720+ } else {
721+ /*
722+ * TBT-alt is the default mode in any case the PHY ownership is not
723+ * held (regardless of the sink's connected live state), so
724+ * we'll just switch to disconnected mode from it here without
725+ * a note.
726+ */
727+ if (dig_port->tc_mode != TC_PORT_TBT_ALT)
728+ drm_dbg_kms(&i915->drm,
729+ "Port %s: PHY left in %s mode on disabled port, disconnecting it\n",
730+ dig_port->tc_port_name,
731+ tc_port_mode_name(dig_port->tc_mode));
732+ icl_tc_phy_disconnect(dig_port);
721733 }
722734
735+ tc_cold_unblock(dig_port, domain, tc_cold_wref);
736+
723737 drm_dbg_kms(&i915->drm, "Port %s: sanitize mode (%s)\n",
724738 dig_port->tc_port_name,
725739 tc_port_mode_name(dig_port->tc_mode));
drivers/gpu/drm/i915/gem/i915_gem_ttm.c+2−4
@@ -842,11 +842,9 @@ void i915_ttm_adjust_lru(struct drm_i915_gem_object *obj) · 841 unmodified lines
842842 } else if (obj->mm.madv != I915_MADV_WILLNEED) {
843843 bo->priority = I915_TTM_PRIO_PURGE;
844844 } else if (!i915_gem_object_has_pages(obj)) {
845− if (bo->priority < I915_TTM_PRIO_HAS_PAGES)
846− bo->priority = I915_TTM_PRIO_HAS_PAGES;
845+ bo->priority = I915_TTM_PRIO_NO_PAGES;
847846 } else {
848− if (bo->priority > I915_TTM_PRIO_NO_PAGES)
849− bo->priority = I915_TTM_PRIO_NO_PAGES;
847+ bo->priority = I915_TTM_PRIO_HAS_PAGES;
850848 }
851849
852850 ttm_bo_move_to_lru_tail(bo, bo->resource, NULL);
drivers/gpu/drm/i915/gvt/gtt.c+2−2
@@ -1148,7 +1148,7 @@ static inline void ppgtt_generate_shadow_entry(struct intel_gvt_gtt_entry *se, · 1147 unmodified lines
11481148 ops->set_pfn(se, s->shadow_page.mfn);
11491149 }
11501150
1151−/**
1151+/*
11521152 * Check if can do 2M page
11531153 * @vgpu: target vgpu
11541154 * @entry: target pfn's gtt entry
@@ -2193,7 +2193,7 @@ static int emulate_ggtt_mmio_read(struct intel_vgpu *vgpu, · 1038 unmodified lines
21932193 }
21942194
21952195 /**
2196− * intel_vgpu_emulate_gtt_mmio_read - emulate GTT MMIO register read
2196+ * intel_vgpu_emulate_ggtt_mmio_read - emulate GTT MMIO register read
21972197 * @vgpu: a vGPU
21982198 * @off: register offset
21992199 * @p_data: data will be returned to guest
drivers/gpu/drm/i915/intel_pm.c+13−13
@@ -4029,6 +4029,17 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state) · 4028 unmodified lines
40294029 return ret;
40304030 }
40314031
4032+ if (intel_can_enable_sagv(dev_priv, new_bw_state) !=
4033+ intel_can_enable_sagv(dev_priv, old_bw_state)) {
4034+ ret = intel_atomic_serialize_global_state(&new_bw_state->base);
4035+ if (ret)
4036+ return ret;
4037+ } else if (new_bw_state->pipe_sagv_reject != old_bw_state->pipe_sagv_reject) {
4038+ ret = intel_atomic_lock_global_state(&new_bw_state->base);
4039+ if (ret)
4040+ return ret;
4041+ }
4042+
40324043 for_each_new_intel_crtc_in_state(state, crtc,
40334044 new_crtc_state, i) {
40344045 struct skl_pipe_wm *pipe_wm = &new_crtc_state->wm.skl.optimal;
@@ -4044,17 +4055,6 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state) · 9 unmodified lines
40444055 intel_can_enable_sagv(dev_priv, new_bw_state);
40454056 }
40464057
4047− if (intel_can_enable_sagv(dev_priv, new_bw_state) !=
4048− intel_can_enable_sagv(dev_priv, old_bw_state)) {
4049− ret = intel_atomic_serialize_global_state(&new_bw_state->base);
4050− if (ret)
4051− return ret;
4052− } else if (new_bw_state->pipe_sagv_reject != old_bw_state->pipe_sagv_reject) {
4053− ret = intel_atomic_lock_global_state(&new_bw_state->base);
4054− if (ret)
4055− return ret;
4056− }
4057−
40584058 return 0;
40594059 }
40604060
@@ -4853,7 +4853,7 @@ static bool check_mbus_joined(u8 active_pipes, · 792 unmodified lines
48534853 {
48544854 int i;
48554855
4856− for (i = 0; i < dbuf_slices[i].active_pipes; i++) {
4856+ for (i = 0; dbuf_slices[i].active_pipes != 0; i++) {
48574857 if (dbuf_slices[i].active_pipes == active_pipes)
48584858 return dbuf_slices[i].join_mbus;
48594859 }
@@ -4870,7 +4870,7 @@ static u8 compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool join_mbus, · 10 unmodified lines
48704870 {
48714871 int i;
48724872
4873− for (i = 0; i < dbuf_slices[i].active_pipes; i++) {
4873+ for (i = 0; dbuf_slices[i].active_pipes != 0; i++) {
48744874 if (dbuf_slices[i].active_pipes == active_pipes &&
48754875 dbuf_slices[i].join_mbus == join_mbus)
48764876 return dbuf_slices[i].dbuf_mask[pipe];
drivers/gpu/drm/imx/dcss/Kconfig+1−0
@@ -2,6 +2,7 @@ config DRM_IMX_DCSS · 1 unmodified line
22 tristate "i.MX8MQ DCSS"
33 select IMX_IRQSTEER
44 select DRM_KMS_HELPER
5+ select DRM_GEM_CMA_HELPER
56 select VIDEOMODE_HELPERS
67 depends on DRM && ARCH_MXC && ARM64
78 help
drivers/gpu/drm/mediatek/mtk_dsi.c+84−83
@@ -786,18 +786,101 @@ void mtk_dsi_ddp_stop(struct device *dev) · 785 unmodified lines
786786 mtk_dsi_poweroff(dsi);
787787 }
788788
789+static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
790+{
791+ int ret;
792+
793+ ret = drm_simple_encoder_init(drm, &dsi->encoder,
794+ DRM_MODE_ENCODER_DSI);
795+ if (ret) {
796+ DRM_ERROR("Failed to encoder init to drm\n");
797+ return ret;
798+ }
799+
800+ dsi->encoder.possible_crtcs = mtk_drm_find_possible_crtc_by_comp(drm, dsi->host.dev);
801+
802+ ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
803+ DRM_BRIDGE_ATTACH_NO_CONNECTOR);
804+ if (ret)
805+ goto err_cleanup_encoder;
806+
807+ dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
808+ if (IS_ERR(dsi->connector)) {
809+ DRM_ERROR("Unable to create bridge connector\n");
810+ ret = PTR_ERR(dsi->connector);
811+ goto err_cleanup_encoder;
812+ }
813+ drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
814+
815+ return 0;
816+
817+err_cleanup_encoder:
818+ drm_encoder_cleanup(&dsi->encoder);
819+ return ret;
820+}
821+
822+static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
823+{
824+ int ret;
825+ struct drm_device *drm = data;
826+ struct mtk_dsi *dsi = dev_get_drvdata(dev);
827+
828+ ret = mtk_dsi_encoder_init(drm, dsi);
829+ if (ret)
830+ return ret;
831+
832+ return device_reset_optional(dev);
833+}
834+
835+static void mtk_dsi_unbind(struct device *dev, struct device *master,
836+ void *data)
837+{
838+ struct mtk_dsi *dsi = dev_get_drvdata(dev);
839+
840+ drm_encoder_cleanup(&dsi->encoder);
841+}
842+
843+static const struct component_ops mtk_dsi_component_ops = {
844+ .bind = mtk_dsi_bind,
845+ .unbind = mtk_dsi_unbind,
846+};
847+
789848 static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
790849 struct mipi_dsi_device *device)
791850 {
792851 struct mtk_dsi *dsi = host_to_dsi(host);
852+ struct device *dev = host->dev;
853+ int ret;
793854
794855 dsi->lanes = device->lanes;
795856 dsi->format = device->format;
796857 dsi->mode_flags = device->mode_flags;
858+ dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
859+ if (IS_ERR(dsi->next_bridge))
860+ return PTR_ERR(dsi->next_bridge);
861+
862+ drm_bridge_add(&dsi->bridge);
863+
864+ ret = component_add(host->dev, &mtk_dsi_component_ops);
865+ if (ret) {
866+ DRM_ERROR("failed to add dsi_host component: %d\n", ret);
867+ drm_bridge_remove(&dsi->bridge);
868+ return ret;
869+ }
797870
798871 return 0;
799872 }
800873
874+static int mtk_dsi_host_detach(struct mipi_dsi_host *host,
875+ struct mipi_dsi_device *device)
876+{
877+ struct mtk_dsi *dsi = host_to_dsi(host);
878+
879+ component_del(host->dev, &mtk_dsi_component_ops);
880+ drm_bridge_remove(&dsi->bridge);
881+ return 0;
882+}
883+
801884 static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi)
802885 {
803886 int ret;
@@ -938,73 +1021,14 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, · 134 unmodified lines
9381021
9391022 static const struct mipi_dsi_host_ops mtk_dsi_ops = {
9401023 .attach = mtk_dsi_host_attach,
1024+ .detach = mtk_dsi_host_detach,
9411025 .transfer = mtk_dsi_host_transfer,
9421026 };
9431027
944−static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
945−{
946− int ret;
947−
948− ret = drm_simple_encoder_init(drm, &dsi->encoder,
949− DRM_MODE_ENCODER_DSI);
950− if (ret) {
951− DRM_ERROR("Failed to encoder init to drm\n");
952− return ret;
953− }
954−
955− dsi->encoder.possible_crtcs = mtk_drm_find_possible_crtc_by_comp(drm, dsi->host.dev);
956−
957− ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
958− DRM_BRIDGE_ATTACH_NO_CONNECTOR);
959− if (ret)
960− goto err_cleanup_encoder;
961−
962− dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder);
963− if (IS_ERR(dsi->connector)) {
964− DRM_ERROR("Unable to create bridge connector\n");
965− ret = PTR_ERR(dsi->connector);
966− goto err_cleanup_encoder;
967− }
968− drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
969−
970− return 0;
971−
972−err_cleanup_encoder:
973− drm_encoder_cleanup(&dsi->encoder);
974− return ret;
975−}
976−
977−static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
978−{
979− int ret;
980− struct drm_device *drm = data;
981− struct mtk_dsi *dsi = dev_get_drvdata(dev);
982−
983− ret = mtk_dsi_encoder_init(drm, dsi);
984− if (ret)
985− return ret;
986−
987− return device_reset_optional(dev);
988−}
989−
990−static void mtk_dsi_unbind(struct device *dev, struct device *master,
991− void *data)
992−{
993− struct mtk_dsi *dsi = dev_get_drvdata(dev);
994−
995− drm_encoder_cleanup(&dsi->encoder);
996−}
997−
998−static const struct component_ops mtk_dsi_component_ops = {
999− .bind = mtk_dsi_bind,
1000− .unbind = mtk_dsi_unbind,
1001−};
1002−
10031028 static int mtk_dsi_probe(struct platform_device *pdev)
10041029 {
10051030 struct mtk_dsi *dsi;
10061031 struct device *dev = &pdev->dev;
1007− struct drm_panel *panel;
10081032 struct resource *regs;
10091033 int irq_num;
10101034 int ret;
@@ -1021,19 +1045,6 @@ static int mtk_dsi_probe(struct platform_device *pdev) · 10 unmodified lines
10211045 return ret;
10221046 }
10231047
1024− ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
1025− &panel, &dsi->next_bridge);
1026− if (ret)
1027− goto err_unregister_host;
1028−
1029− if (panel) {
1030− dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
1031− if (IS_ERR(dsi->next_bridge)) {
1032− ret = PTR_ERR(dsi->next_bridge);
1033− goto err_unregister_host;
1034− }
1035− }
1036−
10371048 dsi->driver_data = of_device_get_match_data(dev);
10381049
10391050 dsi->engine_clk = devm_clk_get(dev, "engine");
@@ -1098,14 +1109,6 @@ static int mtk_dsi_probe(struct platform_device *pdev) · 58 unmodified lines
10981109 dsi->bridge.of_node = dev->of_node;
10991110 dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
11001111
1101− drm_bridge_add(&dsi->bridge);
1102−
1103− ret = component_add(&pdev->dev, &mtk_dsi_component_ops);
1104− if (ret) {
1105− dev_err(&pdev->dev, "failed to add component: %d\n", ret);
1106− goto err_unregister_host;
1107− }
1108−
11091112 return 0;
11101113
11111114 err_unregister_host:
@@ -1118,8 +1121,6 @@ static int mtk_dsi_remove(struct platform_device *pdev) · 6 unmodified lines
11181121 struct mtk_dsi *dsi = platform_get_drvdata(pdev);
11191122
11201123 mtk_output_dsi_disable(dsi);
1121− drm_bridge_remove(&dsi->bridge);
1122− component_del(&pdev->dev, &mtk_dsi_component_ops);
11231124 mipi_dsi_host_unregister(&dsi->host);
11241125
11251126 return 0;
drivers/gpu/drm/radeon/atombios_encoders.c+2−1
@@ -198,7 +198,8 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, · 197 unmodified lines
198198 * so don't register a backlight device
199199 */
200200 if ((rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) &&
201− (rdev->pdev->device == 0x6741))
201+ (rdev->pdev->device == 0x6741) &&
202+ !dmi_match(DMI_PRODUCT_NAME, "iMac12,1"))
202203 return;
203204
204205 if (!radeon_encoder->enc_priv)
drivers/gpu/drm/radeon/radeon_uvd.c+4−4
@@ -470,8 +470,8 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, · 469 unmodified lines
470470 int32_t *msg, msg_type, handle;
471471 unsigned img_size = 0;
472472 void *ptr;
473−
474− int i, r;
473+ long r;
474+ int i;
475475
476476 if (offset & 0x3F) {
477477 DRM_ERROR("UVD messages must be 64 byte aligned!\n");
@@ -481,13 +481,13 @@ static int radeon_uvd_cs_msg(struct radeon_cs_parser *p, struct radeon_bo *bo, · 3 unmodified lines
481481 r = dma_resv_wait_timeout(bo->tbo.base.resv, false, false,
482482 MAX_SCHEDULE_TIMEOUT);
483483 if (r <= 0) {
484− DRM_ERROR("Failed waiting for UVD message (%d)!\n", r);
484+ DRM_ERROR("Failed waiting for UVD message (%ld)!\n", r);
485485 return r ? r : -ETIME;
486486 }
487487
488488 r = radeon_bo_kmap(bo, &ptr);
489489 if (r) {
490− DRM_ERROR("Failed mapping the UVD message (%d)!\n", r);
490+ DRM_ERROR("Failed mapping the UVD message (%ld)!\n", r);
491491 return r;
492492 }
493493
drivers/gpu/drm/tegra/Kconfig+1−0
@@ -5,6 +5,7 @@ config DRM_TEGRA · 4 unmodified lines
55 depends on COMMON_CLK
66 depends on DRM
77 depends on OF
8+ select DRM_DP_AUX_BUS
89 select DRM_KMS_HELPER
910 select DRM_MIPI_DSI
1011 select DRM_PANEL
drivers/gpu/drm/tegra/dpaux.c+7−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/workqueue.h>
2020
2121 #include <drm/drm_dp_helper.h>
22+#include <drm/drm_dp_aux_bus.h>
2223 #include <drm/drm_panel.h>
2324
2425 #include "dp.h"
@@ -570,6 +571,12 @@ static int tegra_dpaux_probe(struct platform_device *pdev) · 545 unmodified lines
570571 list_add_tail(&dpaux->list, &dpaux_list);
571572 mutex_unlock(&dpaux_lock);
572573
574+ err = devm_of_dp_aux_populate_ep_devices(&dpaux->aux);
575+ if (err < 0) {
576+ dev_err(dpaux->dev, "failed to populate AUX bus: %d\n", err);
577+ return err;
578+ }
579+
573580 return 0;
574581 }
575582
drivers/gpu/drm/tegra/falcon.c+1−1
@@ -63,7 +63,7 @@ static void falcon_copy_firmware_image(struct falcon *falcon, · 62 unmodified lines
6363
6464 /* copy the whole thing taking into account endianness */
6565 for (i = 0; i < firmware->size / sizeof(u32); i++)
66− virt[i] = le32_to_cpu(((u32 *)firmware->data)[i]);
66+ virt[i] = le32_to_cpu(((__le32 *)firmware->data)[i]);
6767 }
6868
6969 static int falcon_parse_firmware_image(struct falcon *falcon)
drivers/gpu/drm/vc4/vc4_crtc.c+5−3
@@ -525,9 +525,11 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) · 524 unmodified lines
525525 if (ret)
526526 return ret;
527527
528− ret = pm_runtime_put(&vc4_hdmi->pdev->dev);
529− if (ret)
530− return ret;
528+ /*
529+ * post_crtc_powerdown will have called pm_runtime_put, so we
530+ * don't need it here otherwise we'll get the reference counting
531+ * wrong.
532+ */
531533
532534 return 0;
533535 }
drivers/gpu/drm/vc4/vc4_hdmi.c+8−0
@@ -1749,6 +1749,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) · 1748 unmodified lines
17491749 dev_err(dev, "Couldn't register the HDMI codec: %ld\n", PTR_ERR(codec_pdev));
17501750 return PTR_ERR(codec_pdev);
17511751 }
1752+ vc4_hdmi->audio.codec_pdev = codec_pdev;
17521753
17531754 dai_link->cpus = &vc4_hdmi->audio.cpu;
17541755 dai_link->codecs = &vc4_hdmi->audio.codec;
@@ -1788,6 +1789,12 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) · 33 unmodified lines
17881789
17891790 }
17901791
1792+static void vc4_hdmi_audio_exit(struct vc4_hdmi *vc4_hdmi)
1793+{
1794+ platform_device_unregister(vc4_hdmi->audio.codec_pdev);
1795+ vc4_hdmi->audio.codec_pdev = NULL;
1796+}
1797+
17911798 static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
17921799 {
17931800 struct vc4_hdmi *vc4_hdmi = priv;
@@ -2660,6 +2667,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, · 866 unmodified lines
26602667 kfree(vc4_hdmi->hdmi_regset.regs);
26612668 kfree(vc4_hdmi->hd_regset.regs);
26622669
2670+ vc4_hdmi_audio_exit(vc4_hdmi);
26632671 vc4_hdmi_cec_exit(vc4_hdmi);
26642672 vc4_hdmi_hotplug_exit(vc4_hdmi);
26652673 vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
drivers/gpu/drm/vc4/vc4_hdmi.h+1−0
@@ -116,6 +116,7 @@ struct vc4_hdmi_audio { · 115 unmodified lines
116116 struct snd_soc_dai_link_component platform;
117117 struct snd_dmaengine_dai_dma_data dma_data;
118118 struct hdmi_audio_infoframe infoframe;
119+ struct platform_device *codec_pdev;
119120 bool streaming;
120121 };
121122
drivers/gpu/host1x/syncpt.c+10−25
@@ -137,8 +137,15 @@ void host1x_syncpt_restore(struct host1x *host) · 136 unmodified lines
137137 struct host1x_syncpt *sp_base = host->syncpt;
138138 unsigned int i;
139139
140− for (i = 0; i < host1x_syncpt_nb_pts(host); i++)
140+ for (i = 0; i < host1x_syncpt_nb_pts(host); i++) {
141+ /*
142+ * Unassign syncpt from channels for purposes of Tegra186
143+ * syncpoint protection. This prevents any channel from
144+ * accessing it until it is reassigned.
145+ */
146+ host1x_hw_syncpt_assign_to_channel(host, sp_base + i, NULL);
141147 host1x_hw_syncpt_restore(host, sp_base + i);
148+ }
142149
143150 for (i = 0; i < host1x_syncpt_nb_bases(host); i++)
144151 host1x_hw_syncpt_restore_wait_base(host, sp_base + i);
@@ -227,27 +234,12 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, · 82 unmodified lines
227234 void *ref;
228235 struct host1x_waitlist *waiter;
229236 int err = 0, check_count = 0;
230− u32 val;
231237
232238 if (value)
233− *value = 0;
234−
235− /* first check cache */
236− if (host1x_syncpt_is_expired(sp, thresh)) {
237− if (value)
238− *value = host1x_syncpt_load(sp);
239+ *value = host1x_syncpt_load(sp);
239240
241+ if (host1x_syncpt_is_expired(sp, thresh))
240242 return 0;
241− }
242−
243− /* try to read from register */
244− val = host1x_hw_syncpt_load(sp->host, sp);
245− if (host1x_syncpt_is_expired(sp, thresh)) {
246− if (value)
247− *value = val;
248−
249− goto done;
250− }
251243
252244 if (!timeout) {
253245 err = -EAGAIN;
@@ -352,13 +344,6 @@ int host1x_syncpt_init(struct host1x *host) · 98 unmodified lines
352344 for (i = 0; i < host->info->nb_pts; i++) {
353345 syncpt[i].id = i;
354346 syncpt[i].host = host;
355−
356− /*
357− * Unassign syncpt from channels for purposes of Tegra186
358− * syncpoint protection. This prevents any channel from
359− * accessing it until it is reassigned.
360− */
361− host1x_hw_syncpt_assign_to_channel(host, &syncpt[i], NULL);
362347 }
363348
364349 for (i = 0; i < host->info->nb_bases; i++)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c+73−3
@@ -37,11 +37,11 @@ static int amd_sfh_wait_response_v2(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_ · 36 unmodified lines
3737 {
3838 union cmd_response cmd_resp;
3939
40− /* Get response with status within a max of 800 ms timeout */
40+ /* Get response with status within a max of 1600 ms timeout */
4141 if (!readl_poll_timeout(mp2->mmio + AMD_P2C_MSG(0), cmd_resp.resp,
4242 (cmd_resp.response_v2.response == sensor_sts &&
4343 cmd_resp.response_v2.status == 0 && (sid == 0xff ||
44− cmd_resp.response_v2.sensor_id == sid)), 500, 800000))
44+ cmd_resp.response_v2.sensor_id == sid)), 500, 1600000))
4545 return cmd_resp.response_v2.response;
4646
4747 return SENSOR_DISABLED;
@@ -53,6 +53,7 @@ static void amd_start_sensor_v2(struct amd_mp2_dev *privdata, struct amd_mp2_sen · 5 unmodified lines
5353
5454 cmd_base.ul = 0;
5555 cmd_base.cmd_v2.cmd_id = ENABLE_SENSOR;
56+ cmd_base.cmd_v2.intr_disable = 1;
5657 cmd_base.cmd_v2.period = info.period;
5758 cmd_base.cmd_v2.sensor_id = info.sensor_idx;
5859 cmd_base.cmd_v2.length = 16;
@@ -70,6 +71,7 @@ static void amd_stop_sensor_v2(struct amd_mp2_dev *privdata, u16 sensor_idx) · 11 unmodified lines
7071
7172 cmd_base.ul = 0;
7273 cmd_base.cmd_v2.cmd_id = DISABLE_SENSOR;
74+ cmd_base.cmd_v2.intr_disable = 1;
7375 cmd_base.cmd_v2.period = 0;
7476 cmd_base.cmd_v2.sensor_id = sensor_idx;
7577 cmd_base.cmd_v2.length = 16;
@@ -83,12 +85,51 @@ static void amd_stop_all_sensor_v2(struct amd_mp2_dev *privdata) · 7 unmodified lines
8385 union sfh_cmd_base cmd_base;
8486
8587 cmd_base.cmd_v2.cmd_id = STOP_ALL_SENSORS;
88+ cmd_base.cmd_v2.intr_disable = 1;
8689 cmd_base.cmd_v2.period = 0;
8790 cmd_base.cmd_v2.sensor_id = 0;
8891
8992 writel(cmd_base.ul, privdata->mmio + AMD_C2P_MSG0);
9093 }
9194
95+static void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata)
96+{
97+ if (readl(privdata->mmio + AMD_P2C_MSG(4))) {
98+ writel(0, privdata->mmio + AMD_P2C_MSG(4));
99+ writel(0xf, privdata->mmio + AMD_P2C_MSG(5));
100+ }
101+}
102+
103+static void amd_sfh_clear_intr(struct amd_mp2_dev *privdata)
104+{
105+ if (privdata->mp2_ops->clear_intr)
106+ privdata->mp2_ops->clear_intr(privdata);
107+}
108+
109+static irqreturn_t amd_sfh_irq_handler(int irq, void *data)
110+{
111+ amd_sfh_clear_intr(data);
112+
113+ return IRQ_HANDLED;
114+}
115+
116+static int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata)
117+{
118+ int rc;
119+
120+ pci_intx(privdata->pdev, true);
121+
122+ rc = devm_request_irq(&privdata->pdev->dev, privdata->pdev->irq,
123+ amd_sfh_irq_handler, 0, DRIVER_NAME, privdata);
124+ if (rc) {
125+ dev_err(&privdata->pdev->dev, "failed to request irq %d err=%d\n",
126+ privdata->pdev->irq, rc);
127+ return rc;
128+ }
129+
130+ return 0;
131+}
132+
92133 void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info)
93134 {
94135 union sfh_cmd_param cmd_param;
@@ -193,6 +234,8 @@ static void amd_mp2_pci_remove(void *privdata) · 98 unmodified lines
193234 struct amd_mp2_dev *mp2 = privdata;
194235 amd_sfh_hid_client_deinit(privdata);
195236 mp2->mp2_ops->stop_all(mp2);
237+ pci_intx(mp2->pdev, false);
238+ amd_sfh_clear_intr(mp2);
196239 }
197240
198241 static const struct amd_mp2_ops amd_sfh_ops_v2 = {
@@ -200,6 +243,8 @@ static const struct amd_mp2_ops amd_sfh_ops_v2 = { · 1 unmodified line
200243 .stop = amd_stop_sensor_v2,
201244 .stop_all = amd_stop_all_sensor_v2,
202245 .response = amd_sfh_wait_response_v2,
246+ .clear_intr = amd_sfh_clear_intr_v2,
247+ .init_intr = amd_sfh_irq_init_v2,
203248 };
204249
205250 static const struct amd_mp2_ops amd_sfh_ops = {
@@ -225,6 +270,14 @@ static void mp2_select_ops(struct amd_mp2_dev *privdata) · 19 unmodified lines
225270 }
226271 }
227272
273+static int amd_sfh_irq_init(struct amd_mp2_dev *privdata)
274+{
275+ if (privdata->mp2_ops->init_intr)
276+ return privdata->mp2_ops->init_intr(privdata);
277+
278+ return 0;
279+}
280+
228281 static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
229282 {
230283 struct amd_mp2_dev *privdata;
@@ -261,9 +314,20 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i · 30 unmodified lines
261314
262315 mp2_select_ops(privdata);
263316
317+ rc = amd_sfh_irq_init(privdata);
318+ if (rc) {
319+ dev_err(&pdev->dev, "amd_sfh_irq_init failed\n");
320+ return rc;
321+ }
322+
264323 rc = amd_sfh_hid_client_init(privdata);
265− if (rc)
324+ if (rc) {
325+ amd_sfh_clear_intr(privdata);
326+ dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n");
266327 return rc;
328+ }
329+
330+ amd_sfh_clear_intr(privdata);
267331
268332 return devm_add_action_or_reset(&pdev->dev, amd_mp2_pci_remove, privdata);
269333 }
@@ -290,6 +354,9 @@ static int __maybe_unused amd_mp2_pci_resume(struct device *dev) · 20 unmodified lines
290354 }
291355 }
292356
357+ schedule_delayed_work(&cl_data->work_buffer, msecs_to_jiffies(AMD_SFH_IDLE_LOOP));
358+ amd_sfh_clear_intr(mp2);
359+
293360 return 0;
294361 }
295362
@@ -312,6 +379,9 @@ static int __maybe_unused amd_mp2_pci_suspend(struct device *dev) · 16 unmodified lines
312379 }
313380 }
314381
382+ cancel_delayed_work_sync(&cl_data->work_buffer);
383+ amd_sfh_clear_intr(mp2);
384+
315385 return 0;
316386 }
317387
drivers/hid/amd-sfh-hid/amd_sfh_pcie.h+3−1
@@ -49,7 +49,7 @@ union sfh_cmd_base { · 48 unmodified lines
4949 } s;
5050 struct {
5151 u32 cmd_id : 4;
52− u32 intr_enable : 1;
52+ u32 intr_disable : 1;
5353 u32 rsvd1 : 3;
5454 u32 length : 7;
5555 u32 mem_type : 1;
@@ -141,5 +141,7 @@ struct amd_mp2_ops { · 85 unmodified lines
141141 void (*stop)(struct amd_mp2_dev *privdata, u16 sensor_idx);
142142 void (*stop_all)(struct amd_mp2_dev *privdata);
143143 int (*response)(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_sts);
144+ void (*clear_intr)(struct amd_mp2_dev *privdata);
145+ int (*init_intr)(struct amd_mp2_dev *privdata);
144146 };
145147 #endif
drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.c+3−1
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define HID_USAGE_SENSOR_STATE_READY_ENUM 0x02
2828 #define HID_USAGE_SENSOR_STATE_INITIALIZING_ENUM 0x05
2929 #define HID_USAGE_SENSOR_EVENT_DATA_UPDATED_ENUM 0x04
30+#define ILLUMINANCE_MASK GENMASK(14, 0)
3031
3132 int get_report_descriptor(int sensor_idx, u8 *rep_desc)
3233 {
@@ -246,7 +247,8 @@ u8 get_input_report(u8 current_index, int sensor_idx, int report_id, struct amd_ · 213 unmodified lines
246247 get_common_inputs(&als_input.common_property, report_id);
247248 /* For ALS ,V2 Platforms uses C2P_MSG5 register instead of DRAM access method */
248249 if (supported_input == V2_STATUS)
249− als_input.illuminance_value = (int)readl(privdata->mmio + AMD_C2P_MSG(5));
250+ als_input.illuminance_value =
251+ readl(privdata->mmio + AMD_C2P_MSG(5)) & ILLUMINANCE_MASK;
250252 else
251253 als_input.illuminance_value =
252254 (int)sensor_virt_addr[0] / AMD_SFH_FW_MULTIPLIER;
drivers/hid/hid-apple.c+8−8
@@ -691,49 +691,49 @@ static const struct hid_device_id apple_devices[] = { · 690 unmodified lines
691691 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ANSI),
692692 .driver_data = APPLE_HAS_FN },
693693 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_ISO),
694− .driver_data = APPLE_HAS_FN },
694+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
695695 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5_JIS),
696696 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
697697 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ANSI),
698698 .driver_data = APPLE_HAS_FN },
699699 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_ISO),
700− .driver_data = APPLE_HAS_FN },
700+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
701701 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6_JIS),
702702 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
703703 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI),
704704 .driver_data = APPLE_HAS_FN },
705705 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO),
706− .driver_data = APPLE_HAS_FN },
706+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
707707 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS),
708708 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
709709 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI),
710710 .driver_data = APPLE_HAS_FN },
711711 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO),
712− .driver_data = APPLE_HAS_FN },
712+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
713713 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS),
714714 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
715715 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
716716 .driver_data = APPLE_HAS_FN },
717717 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
718− .driver_data = APPLE_HAS_FN },
718+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
719719 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
720720 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
721721 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
722722 .driver_data = APPLE_HAS_FN },
723723 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
724− .driver_data = APPLE_HAS_FN },
724+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
725725 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
726726 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
727727 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
728728 .driver_data = APPLE_HAS_FN },
729729 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
730− .driver_data = APPLE_HAS_FN },
730+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
731731 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
732732 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
733733 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI),
734734 .driver_data = APPLE_HAS_FN },
735735 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO),
736− .driver_data = APPLE_HAS_FN },
736+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
737737 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS),
738738 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
739739 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
drivers/hid/hid-elo.c+1−0
@@ -262,6 +262,7 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id) · 261 unmodified lines
262262
263263 return 0;
264264 err_free:
265+ usb_put_dev(udev);
265266 kfree(priv);
266267 return ret;
267268 }
drivers/hid/hid-ids.h+1−0
@@ -1370,6 +1370,7 @@ · 1369 unmodified lines
13701370 #define USB_VENDOR_ID_UGTIZER 0x2179
13711371 #define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053
13721372 #define USB_DEVICE_ID_UGTIZER_TABLET_GT5040 0x0077
1373+#define USB_DEVICE_ID_UGTIZER_TABLET_WP5540 0x0004
13731374
13741375 #define USB_VENDOR_ID_VIEWSONIC 0x0543
13751376 #define USB_DEVICE_ID_VIEWSONIC_PD1011 0xe621
drivers/hid/hid-quirks.c+1−0
@@ -187,6 +187,7 @@ static const struct hid_device_id hid_quirks[] = { · 186 unmodified lines
187187 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET },
188188 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT },
189189 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT },
190+ { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_WP5540), HID_QUIRK_MULTI_INPUT },
190191 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH), HID_QUIRK_MULTI_INPUT },
191192 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH), HID_QUIRK_MULTI_INPUT },
192193 { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },
drivers/hid/i2c-hid/i2c-hid-of-goodix.c+12−16
@@ -27,7 +27,6 @@ struct i2c_hid_of_goodix { · 26 unmodified lines
2727
2828 struct regulator *vdd;
2929 struct notifier_block nb;
30− struct mutex regulator_mutex;
3130 struct gpio_desc *reset_gpio;
3231 const struct goodix_i2c_hid_timing_data *timings;
3332 };
@@ -67,8 +66,6 @@ static int ihid_goodix_vdd_notify(struct notifier_block *nb, · 33 unmodified lines
6766 container_of(nb, struct i2c_hid_of_goodix, nb);
6867 int ret = NOTIFY_OK;
6968
70− mutex_lock(&ihid_goodix->regulator_mutex);
71−
7269 switch (event) {
7370 case REGULATOR_EVENT_PRE_DISABLE:
7471 gpiod_set_value_cansleep(ihid_goodix->reset_gpio, 1);
@@ -87,8 +84,6 @@ static int ihid_goodix_vdd_notify(struct notifier_block *nb, · 12 unmodified lines
8784 break;
8885 }
8986
90− mutex_unlock(&ihid_goodix->regulator_mutex);
91−
9287 return ret;
9388 }
9489
@@ -102,8 +97,6 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client, · 7 unmodified lines
10297 if (!ihid_goodix)
10398 return -ENOMEM;
10499
105− mutex_init(&ihid_goodix->regulator_mutex);
106−
107100 ihid_goodix->ops.power_up = goodix_i2c_hid_power_up;
108101 ihid_goodix->ops.power_down = goodix_i2c_hid_power_down;
109102
@@ -130,25 +123,28 @@ static int i2c_hid_of_goodix_probe(struct i2c_client *client, · 20 unmodified lines
130123 * long. Holding the controller in reset apparently draws extra
131124 * power.
132125 */
133− mutex_lock(&ihid_goodix->regulator_mutex);
134126 ihid_goodix->nb.notifier_call = ihid_goodix_vdd_notify;
135127 ret = devm_regulator_register_notifier(ihid_goodix->vdd, &ihid_goodix->nb);
136− if (ret) {
137− mutex_unlock(&ihid_goodix->regulator_mutex);
128+ if (ret)
138129 return dev_err_probe(&client->dev, ret,
139130 "regulator notifier request failed\n");
140− }
141131
142132 /*
143133 * If someone else is holding the regulator on (or the regulator is
144134 * an always-on one) we might never be told to deassert reset. Do it
145− * now. Here we'll assume that someone else might have _just
146− * barely_ turned the regulator on so we'll do the full
147− * "post_power_delay" just in case.
135+ * now... and temporarily bump the regulator reference count just to
136+ * make sure it is impossible for this to race with our own notifier!
137+ * We also assume that someone else might have _just barely_ turned
138+ * the regulator on so we'll do the full "post_power_delay" just in
139+ * case.
148140 */
149− if (ihid_goodix->reset_gpio && regulator_is_enabled(ihid_goodix->vdd))
141+ if (ihid_goodix->reset_gpio && regulator_is_enabled(ihid_goodix->vdd)) {
142+ ret = regulator_enable(ihid_goodix->vdd);
143+ if (ret)
144+ return ret;
150145 goodix_i2c_hid_deassert_reset(ihid_goodix, true);
151− mutex_unlock(&ihid_goodix->regulator_mutex);
146+ regulator_disable(ihid_goodix->vdd);
147+ }
152148
153149 return i2c_hid_core_probe(client, &ihid_goodix->ops, 0x0001, 0);
154150 }
drivers/hv/hv_utils_transport.c+1−1
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 #include "hv_utils_transport.h"
1414
1515 static DEFINE_SPINLOCK(hvt_list_lock);
16−static struct list_head hvt_list = LIST_HEAD_INIT(hvt_list);
16+static LIST_HEAD(hvt_list);
1717
1818 static void hvt_reset(struct hvutil_transport *hvt)
1919 {
drivers/hv/vmbus_drv.c+6−3
@@ -2028,8 +2028,10 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) · 2027 unmodified lines
20282028 kobj->kset = dev->channels_kset;
20292029 ret = kobject_init_and_add(kobj, &vmbus_chan_ktype, NULL,
20302030 "%u", relid);
2031− if (ret)
2031+ if (ret) {
2032+ kobject_put(kobj);
20322033 return ret;
2034+ }
20332035
20342036 ret = sysfs_create_group(kobj, &vmbus_chan_group);
20352037
@@ -2038,6 +2040,7 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) · 2 unmodified lines
20382040 * The calling functions' error handling paths will cleanup the
20392041 * empty channel directory.
20402042 */
2043+ kobject_put(kobj);
20412044 dev_err(device, "Unable to set up channel sysfs files\n");
20422045 return ret;
20432046 }
@@ -2079,7 +2082,6 @@ struct hv_device *vmbus_device_create(const guid_t *type, · 35 unmodified lines
20792082 return child_device_obj;
20802083 }
20812084
2082−static u64 vmbus_dma_mask = DMA_BIT_MASK(64);
20832085 /*
20842086 * vmbus_device_register - Register the child device
20852087 */
@@ -2120,8 +2122,9 @@ int vmbus_device_register(struct hv_device *child_device_obj) · 34 unmodified lines
21202122 }
21212123 hv_debug_add_dev_dir(child_device_obj);
21222124
2123− child_device_obj->device.dma_mask = &vmbus_dma_mask;
21242125 child_device_obj->device.dma_parms = &child_device_obj->dma_parms;
2126+ child_device_obj->device.dma_mask = &child_device_obj->dma_mask;
2127+ dma_set_mask(&child_device_obj->device, DMA_BIT_MASK(64));
21252128 return 0;
21262129
21272130 err_kset_unregister:
drivers/hwmon/hwmon.c+8−6
@@ -214,12 +214,14 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index) · 213 unmodified lines
214214
215215 tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata,
216216 &hwmon_thermal_ops);
217− /*
218− * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV,
219− * so ignore that error but forward any other error.
220− */
221− if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV))
222− return PTR_ERR(tzd);
217+ if (IS_ERR(tzd)) {
218+ if (PTR_ERR(tzd) != -ENODEV)
219+ return PTR_ERR(tzd);
220+ dev_info(dev, "temp%d_input not attached to any thermal zone\n",
221+ index + 1);
222+ devm_kfree(dev, tdata);
223+ return 0;
224+ }
223225
224226 err = devm_add_action(dev, hwmon_thermal_remove_sensor, &tdata->node);
225227 if (err)
drivers/hwmon/ntc_thermistor.c+1−1
@@ -59,7 +59,7 @@ static const struct platform_device_id ntc_thermistor_id[] = { · 58 unmodified lines
5959 [NTC_NCP15XH103] = { "ncp15xh103", TYPE_NCPXXXH103 },
6060 [NTC_NCP18WB473] = { "ncp18wb473", TYPE_NCPXXWB473 },
6161 [NTC_NCP21WB473] = { "ncp21wb473", TYPE_NCPXXWB473 },
62− [NTC_SSG1404001221] = { "ssg1404-001221", TYPE_NCPXXWB473 },
62+ [NTC_SSG1404001221] = { "ssg1404_001221", TYPE_NCPXXWB473 },
6363 [NTC_LAST] = { },
6464 };
6565
drivers/hwmon/pmbus/pmbus_core.c+5−0
@@ -911,6 +911,11 @@ static int pmbus_get_boolean(struct i2c_client *client, struct pmbus_boolean *b, · 910 unmodified lines
911911 pmbus_update_sensor_data(client, s2);
912912
913913 regval = status & mask;
914+ if (regval) {
915+ ret = pmbus_write_byte_data(client, page, reg, regval);
916+ if (ret)
917+ goto unlock;
918+ }
914919 if (s1 && s2) {
915920 s64 v1, v2;
916921
drivers/i2c/busses/Kconfig+3−3
@@ -488,7 +488,7 @@ config I2C_BRCMSTB · 487 unmodified lines
488488
489489 config I2C_CADENCE
490490 tristate "Cadence I2C Controller"
491− depends on ARCH_ZYNQ || ARM64 || XTENSA
491+ depends on ARCH_ZYNQ || ARM64 || XTENSA || COMPILE_TEST
492492 help
493493 Say yes here to select Cadence I2C Host Controller. This controller is
494494 e.g. used by Xilinx Zynq.
@@ -680,7 +680,7 @@ config I2C_IMG · 185 unmodified lines
680680
681681 config I2C_IMX
682682 tristate "IMX I2C interface"
683− depends on ARCH_MXC || ARCH_LAYERSCAPE || COLDFIRE
683+ depends on ARCH_MXC || ARCH_LAYERSCAPE || COLDFIRE || COMPILE_TEST
684684 select I2C_SLAVE
685685 help
686686 Say Y here if you want to use the IIC bus controller on
@@ -935,7 +935,7 @@ config I2C_QCOM_GENI · 248 unmodified lines
935935
936936 config I2C_QUP
937937 tristate "Qualcomm QUP based I2C controller"
938− depends on ARCH_QCOM
938+ depends on ARCH_QCOM || COMPILE_TEST
939939 help
940940 If you say yes to this option, support will be included for the
941941 built-in I2C interface on the Qualcomm SoCs.
drivers/i2c/busses/i2c-bcm2835.c+11−0
@@ -23,6 +23,11 @@ · 22 unmodified lines
2323 #define BCM2835_I2C_FIFO 0x10
2424 #define BCM2835_I2C_DIV 0x14
2525 #define BCM2835_I2C_DEL 0x18
26+/*
27+ * 16-bit field for the number of SCL cycles to wait after rising SCL
28+ * before deciding the slave is not responding. 0 disables the
29+ * timeout detection.
30+ */
2631 #define BCM2835_I2C_CLKT 0x1c
2732
2833 #define BCM2835_I2C_C_READ BIT(0)
@@ -474,6 +479,12 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) · 445 unmodified lines
474479 adap->dev.of_node = pdev->dev.of_node;
475480 adap->quirks = of_device_get_match_data(&pdev->dev);
476481
482+ /*
483+ * Disable the hardware clock stretching timeout. SMBUS
484+ * specifies a limit for how long the device can stretch the
485+ * clock, but core I2C doesn't.
486+ */
487+ bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_CLKT, 0);
477488 bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0);
478489
479490 ret = i2c_add_adapter(adap);
drivers/i2c/busses/i2c-brcmstb.c+1−1
@@ -673,7 +673,7 @@ static int brcmstb_i2c_probe(struct platform_device *pdev) · 672 unmodified lines
673673
674674 /* set the data in/out register size for compatible SoCs */
675675 if (of_device_is_compatible(dev->device->of_node,
676− "brcmstb,brcmper-i2c"))
676+ "brcm,brcmper-i2c"))
677677 dev->data_regsz = sizeof(u8);
678678 else
679679 dev->data_regsz = sizeof(u32);
drivers/i2c/busses/i2c-qcom-cci.c+11−5
@@ -558,7 +558,7 @@ static int cci_probe(struct platform_device *pdev) · 557 unmodified lines
558558 cci->master[idx].adap.quirks = &cci->data->quirks;
559559 cci->master[idx].adap.algo = &cci_algo;
560560 cci->master[idx].adap.dev.parent = dev;
561− cci->master[idx].adap.dev.of_node = child;
561+ cci->master[idx].adap.dev.of_node = of_node_get(child);
562562 cci->master[idx].master = idx;
563563 cci->master[idx].cci = cci;
564564
@@ -643,8 +643,10 @@ static int cci_probe(struct platform_device *pdev) · 78 unmodified lines
643643 continue;
644644
645645 ret = i2c_add_adapter(&cci->master[i].adap);
646− if (ret < 0)
646+ if (ret < 0) {
647+ of_node_put(cci->master[i].adap.dev.of_node);
647648 goto error_i2c;
649+ }
648650 }
649651
650652 pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
@@ -655,9 +657,11 @@ static int cci_probe(struct platform_device *pdev) · 4 unmodified lines
655657 return 0;
656658
657659 error_i2c:
658− for (; i >= 0; i--) {
659− if (cci->master[i].cci)
660+ for (--i ; i >= 0; i--) {
661+ if (cci->master[i].cci) {
660662 i2c_del_adapter(&cci->master[i].adap);
663+ of_node_put(cci->master[i].adap.dev.of_node);
664+ }
661665 }
662666 error:
663667 disable_irq(cci->irq);
@@ -673,8 +677,10 @@ static int cci_remove(struct platform_device *pdev) · 9 unmodified lines
673677 int i;
674678
675679 for (i = 0; i < cci->data->num_masters; i++) {
676− if (cci->master[i].cci)
680+ if (cci->master[i].cci) {
677681 i2c_del_adapter(&cci->master[i].adap);
682+ of_node_put(cci->master[i].adap.dev.of_node);
683+ }
678684 cci_halt(cci, i);
679685 }
680686
drivers/iio/accel/bmc150-accel-core.c+4−1
@@ -1783,11 +1783,14 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, · 1782 unmodified lines
17831783 ret = iio_device_register(indio_dev);
17841784 if (ret < 0) {
17851785 dev_err(dev, "Unable to register iio device\n");
1786− goto err_trigger_unregister;
1786+ goto err_pm_cleanup;
17871787 }
17881788
17891789 return 0;
17901790
1791+err_pm_cleanup:
1792+ pm_runtime_dont_use_autosuspend(dev);
1793+ pm_runtime_disable(dev);
17911794 err_trigger_unregister:
17921795 bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1);
17931796 err_buffer_cleanup:
drivers/iio/accel/fxls8962af-core.c+10−2
@@ -173,12 +173,20 @@ struct fxls8962af_data { · 172 unmodified lines
173173 u16 upper_thres;
174174 };
175175
176−const struct regmap_config fxls8962af_regmap_conf = {
176+const struct regmap_config fxls8962af_i2c_regmap_conf = {
177177 .reg_bits = 8,
178178 .val_bits = 8,
179179 .max_register = FXLS8962AF_MAX_REG,
180180 };
181−EXPORT_SYMBOL_GPL(fxls8962af_regmap_conf);
181+EXPORT_SYMBOL_GPL(fxls8962af_i2c_regmap_conf);
182+
183+const struct regmap_config fxls8962af_spi_regmap_conf = {
184+ .reg_bits = 8,
185+ .pad_bits = 8,
186+ .val_bits = 8,
187+ .max_register = FXLS8962AF_MAX_REG,
188+};
189+EXPORT_SYMBOL_GPL(fxls8962af_spi_regmap_conf);
182190
183191 enum {
184192 fxls8962af_idx_x,
drivers/iio/accel/fxls8962af-i2c.c+1−1
@@ -18,7 +18,7 @@ static int fxls8962af_probe(struct i2c_client *client) · 17 unmodified lines
1818 {
1919 struct regmap *regmap;
2020
21− regmap = devm_regmap_init_i2c(client, &fxls8962af_regmap_conf);
21+ regmap = devm_regmap_init_i2c(client, &fxls8962af_i2c_regmap_conf);
2222 if (IS_ERR(regmap)) {
2323 dev_err(&client->dev, "Failed to initialize i2c regmap\n");
2424 return PTR_ERR(regmap);
drivers/iio/accel/fxls8962af-spi.c+1−1
@@ -18,7 +18,7 @@ static int fxls8962af_probe(struct spi_device *spi) · 17 unmodified lines
1818 {
1919 struct regmap *regmap;
2020
21− regmap = devm_regmap_init_spi(spi, &fxls8962af_regmap_conf);
21+ regmap = devm_regmap_init_spi(spi, &fxls8962af_spi_regmap_conf);
2222 if (IS_ERR(regmap)) {
2323 dev_err(&spi->dev, "Failed to initialize spi regmap\n");
2424 return PTR_ERR(regmap);
drivers/iio/accel/fxls8962af.h+2−1
@@ -17,6 +17,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq); · 16 unmodified lines
1717 int fxls8962af_core_remove(struct device *dev);
1818
1919 extern const struct dev_pm_ops fxls8962af_pm_ops;
20−extern const struct regmap_config fxls8962af_regmap_conf;
20+extern const struct regmap_config fxls8962af_i2c_regmap_conf;
21+extern const struct regmap_config fxls8962af_spi_regmap_conf;
2122
2223 #endif /* _FXLS8962AF_H_ */
drivers/iio/accel/kxcjk-1013.c+4−1
@@ -1590,11 +1590,14 @@ static int kxcjk1013_probe(struct i2c_client *client, · 1589 unmodified lines
15901590 ret = iio_device_register(indio_dev);
15911591 if (ret < 0) {
15921592 dev_err(&client->dev, "unable to register iio device\n");
1593− goto err_buffer_cleanup;
1593+ goto err_pm_cleanup;
15941594 }
15951595
15961596 return 0;
15971597
1598+err_pm_cleanup:
1599+ pm_runtime_dont_use_autosuspend(&client->dev);
1600+ pm_runtime_disable(&client->dev);
15981601 err_buffer_cleanup:
15991602 iio_triggered_buffer_cleanup(indio_dev);
16001603 err_trigger_unregister:
drivers/iio/accel/mma9551.c+4−1
@@ -495,11 +495,14 @@ static int mma9551_probe(struct i2c_client *client, · 494 unmodified lines
495495 ret = iio_device_register(indio_dev);
496496 if (ret < 0) {
497497 dev_err(&client->dev, "unable to register iio device\n");
498− goto out_poweroff;
498+ goto err_pm_cleanup;
499499 }
500500
501501 return 0;
502502
503+err_pm_cleanup:
504+ pm_runtime_dont_use_autosuspend(&client->dev);
505+ pm_runtime_disable(&client->dev);
503506 out_poweroff:
504507 mma9551_set_device_state(client, false);
505508
drivers/iio/accel/mma9553.c+4−1
@@ -1134,12 +1134,15 @@ static int mma9553_probe(struct i2c_client *client, · 1133 unmodified lines
11341134 ret = iio_device_register(indio_dev);
11351135 if (ret < 0) {
11361136 dev_err(&client->dev, "unable to register iio device\n");
1137− goto out_poweroff;
1137+ goto err_pm_cleanup;
11381138 }
11391139
11401140 dev_dbg(&indio_dev->dev, "Registered device %s\n", name);
11411141 return 0;
11421142
1143+err_pm_cleanup:
1144+ pm_runtime_dont_use_autosuspend(&client->dev);
1145+ pm_runtime_disable(&client->dev);
11431146 out_poweroff:
11441147 mma9551_set_device_state(client, false);
11451148 return ret;
drivers/iio/adc/ad7124.c+1−1
@@ -76,7 +76,7 @@ · 75 unmodified lines
7676 #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x)
7777 #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0)
7878 #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x)
79−#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6)
79+#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(6, 5)
8080 #define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x)
8181
8282 /* AD7124_FILTER_X */
drivers/iio/adc/men_z188_adc.c+8−1
@@ -103,6 +103,7 @@ static int men_z188_probe(struct mcb_device *dev, · 102 unmodified lines
103103 struct z188_adc *adc;
104104 struct iio_dev *indio_dev;
105105 struct resource *mem;
106+ int ret;
106107
107108 indio_dev = devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc));
108109 if (!indio_dev)
@@ -128,8 +129,14 @@ static int men_z188_probe(struct mcb_device *dev, · 19 unmodified lines
128129 adc->mem = mem;
129130 mcb_set_drvdata(dev, indio_dev);
130131
131− return iio_device_register(indio_dev);
132+ ret = iio_device_register(indio_dev);
133+ if (ret)
134+ goto err_unmap;
135+
136+ return 0;
132137
138+err_unmap:
139+ iounmap(adc->base);
133140 err:
134141 mcb_release_mem(mem);
135142 return -ENXIO;
drivers/iio/adc/ti-tsc2046.c+2−2
@@ -388,7 +388,7 @@ static int tsc2046_adc_update_scan_mode(struct iio_dev *indio_dev, · 387 unmodified lines
388388 mutex_lock(&priv->slock);
389389
390390 size = 0;
391− for_each_set_bit(ch_idx, active_scan_mask, indio_dev->num_channels) {
391+ for_each_set_bit(ch_idx, active_scan_mask, ARRAY_SIZE(priv->l)) {
392392 size += tsc2046_adc_group_set_layout(priv, group, ch_idx);
393393 tsc2046_adc_group_set_cmd(priv, group, ch_idx);
394394 group++;
@@ -548,7 +548,7 @@ static int tsc2046_adc_setup_spi_msg(struct tsc2046_adc_priv *priv) · 153 unmodified lines
548548 * enabled.
549549 */
550550 size = 0;
551− for (ch_idx = 0; ch_idx < priv->dcfg->num_channels; ch_idx++)
551+ for (ch_idx = 0; ch_idx < ARRAY_SIZE(priv->l); ch_idx++)
552552 size += tsc2046_adc_group_set_layout(priv, ch_idx, ch_idx);
553553
554554 priv->tx = devm_kzalloc(&priv->spi->dev, size, GFP_KERNEL);
drivers/iio/addac/ad74413r.c+8−9
@@ -134,7 +134,6 @@ struct ad74413r_state { · 133 unmodified lines
134134 #define AD74413R_CH_EN_MASK(x) BIT(x)
135135
136136 #define AD74413R_REG_DIN_COMP_OUT 0x25
137−#define AD74413R_DIN_COMP_OUT_SHIFT_X(x) x
138137
139138 #define AD74413R_REG_ADC_RESULT_X(x) (0x26 + (x))
140139 #define AD74413R_ADC_RESULT_MAX GENMASK(15, 0)
@@ -288,7 +287,7 @@ static void ad74413r_gpio_set_multiple(struct gpio_chip *chip, · 147 unmodified lines
288287 unsigned int offset = 0;
289288 int ret;
290289
291− for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
290+ for_each_set_bit_from(offset, mask, chip->ngpio) {
292291 unsigned int real_offset = st->gpo_gpio_offsets[offset];
293292
294293 ret = ad74413r_set_gpo_config(st, real_offset,
@@ -316,7 +315,7 @@ static int ad74413r_gpio_get(struct gpio_chip *chip, unsigned int offset) · 21 unmodified lines
316315 if (ret)
317316 return ret;
318317
319− status &= AD74413R_DIN_COMP_OUT_SHIFT_X(real_offset);
318+ status &= BIT(real_offset);
320319
321320 return status ? 1 : 0;
322321 }
@@ -334,11 +333,10 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip, · 11 unmodified lines
334333 if (ret)
335334 return ret;
336335
337− for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
336+ for_each_set_bit_from(offset, mask, chip->ngpio) {
338337 unsigned int real_offset = st->comp_gpio_offsets[offset];
339338
340− if (val & BIT(real_offset))
341− *bits |= offset;
339+ __assign_bit(offset, bits, val & BIT(real_offset));
342340 }
343341
344342 return ret;
@@ -840,7 +838,7 @@ static int ad74413r_update_scan_mode(struct iio_dev *indio_dev, · 495 unmodified lines
840838 {
841839 struct ad74413r_state *st = iio_priv(indio_dev);
842840 struct spi_transfer *xfer = st->adc_samples_xfer;
843− u8 *rx_buf = &st->adc_samples_buf.rx_buf[-1 * AD74413R_FRAME_SIZE];
841+ u8 *rx_buf = st->adc_samples_buf.rx_buf;
844842 u8 *tx_buf = st->adc_samples_tx_buf;
845843 unsigned int channel;
846844 int ret = -EINVAL;
@@ -894,9 +892,10 @@ static int ad74413r_update_scan_mode(struct iio_dev *indio_dev, · 47 unmodified lines
894892
895893 spi_message_add_tail(xfer, &st->adc_samples_msg);
896894
897− xfer++;
898895 tx_buf += AD74413R_FRAME_SIZE;
899− rx_buf += AD74413R_FRAME_SIZE;
896+ if (xfer != st->adc_samples_xfer)
897+ rx_buf += AD74413R_FRAME_SIZE;
898+ xfer++;
900899 }
901900
902901 xfer->rx_buf = rx_buf;
drivers/iio/frequency/admv1013.c+1−1
@@ -348,7 +348,7 @@ static int admv1013_update_mixer_vgate(struct admv1013_state *st) · 347 unmodified lines
348348
349349 vcm = regulator_get_voltage(st->reg);
350350
351− if (vcm >= 0 && vcm < 1800000)
351+ if (vcm < 1800000)
352352 mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;
353353 else if (vcm > 1800000 && vcm < 2600000)
354354 mixer_vgate = (2375 * vcm / 1000000 + 125) / 100;
drivers/iio/gyro/bmg160_core.c+4−1
@@ -1188,11 +1188,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq, · 1187 unmodified lines
11881188 ret = iio_device_register(indio_dev);
11891189 if (ret < 0) {
11901190 dev_err(dev, "unable to register iio device\n");
1191− goto err_buffer_cleanup;
1191+ goto err_pm_cleanup;
11921192 }
11931193
11941194 return 0;
11951195
1196+err_pm_cleanup:
1197+ pm_runtime_dont_use_autosuspend(dev);
1198+ pm_runtime_disable(dev);
11961199 err_buffer_cleanup:
11971200 iio_triggered_buffer_cleanup(indio_dev);
11981201 err_trigger_unregister:
drivers/iio/imu/adis16480.c+6−1
@@ -1403,6 +1403,7 @@ static int adis16480_probe(struct spi_device *spi) · 1402 unmodified lines
14031403 {
14041404 const struct spi_device_id *id = spi_get_device_id(spi);
14051405 const struct adis_data *adis16480_data;
1406+ irq_handler_t trigger_handler = NULL;
14061407 struct iio_dev *indio_dev;
14071408 struct adis16480 *st;
14081409 int ret;
@@ -1474,8 +1475,12 @@ static int adis16480_probe(struct spi_device *spi) · 65 unmodified lines
14741475 st->clk_freq = st->chip_info->int_clk;
14751476 }
14761477
1478+ /* Only use our trigger handler if burst mode is supported */
1479+ if (adis16480_data->burst_len)
1480+ trigger_handler = adis16480_trigger_handler;
1481+
14771482 ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev,
1478− adis16480_trigger_handler);
1483+ trigger_handler);
14791484 if (ret)
14801485 return ret;
14811486
drivers/iio/imu/kmx61.c+4−1
@@ -1385,7 +1385,7 @@ static int kmx61_probe(struct i2c_client *client, · 1384 unmodified lines
13851385 ret = iio_device_register(data->acc_indio_dev);
13861386 if (ret < 0) {
13871387 dev_err(&client->dev, "Failed to register acc iio device\n");
1388− goto err_buffer_cleanup_mag;
1388+ goto err_pm_cleanup;
13891389 }
13901390
13911391 ret = iio_device_register(data->mag_indio_dev);
@@ -1398,6 +1398,9 @@ static int kmx61_probe(struct i2c_client *client, · 6 unmodified lines
13981398
13991399 err_iio_unregister_acc:
14001400 iio_device_unregister(data->acc_indio_dev);
1401+err_pm_cleanup:
1402+ pm_runtime_dont_use_autosuspend(&client->dev);
1403+ pm_runtime_disable(&client->dev);
14011404 err_buffer_cleanup_mag:
14021405 if (client->irq > 0)
14031406 iio_triggered_buffer_cleanup(data->mag_indio_dev);
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c+5−1
@@ -1374,8 +1374,12 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor, · 1373 unmodified lines
13741374 if (err < 0)
13751375 return err;
13761376
1377+ /*
1378+ * we need to wait for sensor settling time before
1379+ * reading data in order to avoid corrupted samples
1380+ */
13771381 delay = 1000000000 / sensor->odr;
1378− usleep_range(delay, 2 * delay);
1382+ usleep_range(3 * delay, 4 * delay);
13791383
13801384 err = st_lsm6dsx_read_locked(hw, addr, &data, sizeof(data));
13811385 if (err < 0)
drivers/iio/magnetometer/bmc150_magn.c+3−2
@@ -962,13 +962,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap, · 961 unmodified lines
962962 ret = iio_device_register(indio_dev);
963963 if (ret < 0) {
964964 dev_err(dev, "unable to register iio device\n");
965− goto err_disable_runtime_pm;
965+ goto err_pm_cleanup;
966966 }
967967
968968 dev_dbg(dev, "Registered device %s\n", name);
969969 return 0;
970970
971−err_disable_runtime_pm:
971+err_pm_cleanup:
972+ pm_runtime_dont_use_autosuspend(dev);
972973 pm_runtime_disable(dev);
973974 err_buffer_cleanup:
974975 iio_triggered_buffer_cleanup(indio_dev);
drivers/infiniband/core/cma.c+24−16
@@ -3370,22 +3370,30 @@ err: · 3369 unmodified lines
33703370 static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
33713371 const struct sockaddr *dst_addr)
33723372 {
3373− if (!src_addr || !src_addr->sa_family) {
3374− src_addr = (struct sockaddr *) &id->route.addr.src_addr;
3375− src_addr->sa_family = dst_addr->sa_family;
3376− if (IS_ENABLED(CONFIG_IPV6) &&
3377− dst_addr->sa_family == AF_INET6) {
3378− struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *) src_addr;
3379− struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *) dst_addr;
3380− src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id;
3381− if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
3382− id->route.addr.dev_addr.bound_dev_if = dst_addr6->sin6_scope_id;
3383− } else if (dst_addr->sa_family == AF_IB) {
3384− ((struct sockaddr_ib *) src_addr)->sib_pkey =
3385− ((struct sockaddr_ib *) dst_addr)->sib_pkey;
3386− }
3387− }
3388− return rdma_bind_addr(id, src_addr);
3373+ struct sockaddr_storage zero_sock = {};
3374+
3375+ if (src_addr && src_addr->sa_family)
3376+ return rdma_bind_addr(id, src_addr);
3377+
3378+ /*
3379+ * When the src_addr is not specified, automatically supply an any addr
3380+ */
3381+ zero_sock.ss_family = dst_addr->sa_family;
3382+ if (IS_ENABLED(CONFIG_IPV6) && dst_addr->sa_family == AF_INET6) {
3383+ struct sockaddr_in6 *src_addr6 =
3384+ (struct sockaddr_in6 *)&zero_sock;
3385+ struct sockaddr_in6 *dst_addr6 =
3386+ (struct sockaddr_in6 *)dst_addr;
3387+
3388+ src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id;
3389+ if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
3390+ id->route.addr.dev_addr.bound_dev_if =
3391+ dst_addr6->sin6_scope_id;
3392+ } else if (dst_addr->sa_family == AF_IB) {
3393+ ((struct sockaddr_ib *)&zero_sock)->sib_pkey =
3394+ ((struct sockaddr_ib *)dst_addr)->sib_pkey;
3395+ }
3396+ return rdma_bind_addr(id, (struct sockaddr *)&zero_sock);
33893397 }
33903398
33913399 /*
drivers/infiniband/hw/qib/qib_sysfs.c+1−1
@@ -541,7 +541,7 @@ static struct attribute *port_diagc_attributes[] = { · 540 unmodified lines
541541 };
542542
543543 static const struct attribute_group port_diagc_group = {
544− .name = "linkcontrol",
544+ .name = "diag_counters",
545545 .attrs = port_diagc_attributes,
546546 };
547547
drivers/infiniband/ulp/rtrs/rtrs-clt.c+21−18
@@ -2682,6 +2682,8 @@ static void rtrs_clt_dev_release(struct device *dev) · 2681 unmodified lines
26822682 struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
26832683 dev);
26842684
2685+ mutex_destroy(&clt->paths_ev_mutex);
2686+ mutex_destroy(&clt->paths_mutex);
26852687 kfree(clt);
26862688 }
26872689
@@ -2711,6 +2713,8 @@ static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num, · 23 unmodified lines
27112713 return ERR_PTR(-ENOMEM);
27122714 }
27132715
2716+ clt->dev.class = rtrs_clt_dev_class;
2717+ clt->dev.release = rtrs_clt_dev_release;
27142718 uuid_gen(&clt->paths_uuid);
27152719 INIT_LIST_HEAD_RCU(&clt->paths_list);
27162720 clt->paths_num = paths_num;
@@ -2727,53 +2731,51 @@ static struct rtrs_clt_sess *alloc_clt(const char *sessname, size_t paths_num, · 10 unmodified lines
27272731 init_waitqueue_head(&clt->permits_wait);
27282732 mutex_init(&clt->paths_ev_mutex);
27292733 mutex_init(&clt->paths_mutex);
2734+ device_initialize(&clt->dev);
27302735
2731− clt->dev.class = rtrs_clt_dev_class;
2732− clt->dev.release = rtrs_clt_dev_release;
27332736 err = dev_set_name(&clt->dev, "%s", sessname);
27342737 if (err)
2735− goto err;
2738+ goto err_put;
2739+
27362740 /*
27372741 * Suppress user space notification until
27382742 * sysfs files are created
27392743 */
27402744 dev_set_uevent_suppress(&clt->dev, true);
2741− err = device_register(&clt->dev);
2742− if (err) {
2743− put_device(&clt->dev);
2744− goto err;
2745− }
2745+ err = device_add(&clt->dev);
2746+ if (err)
2747+ goto err_put;
27462748
27472749 clt->kobj_paths = kobject_create_and_add("paths", &clt->dev.kobj);
27482750 if (!clt->kobj_paths) {
27492751 err = -ENOMEM;
2750− goto err_dev;
2752+ goto err_del;
27512753 }
27522754 err = rtrs_clt_create_sysfs_root_files(clt);
27532755 if (err) {
27542756 kobject_del(clt->kobj_paths);
27552757 kobject_put(clt->kobj_paths);
2756− goto err_dev;
2758+ goto err_del;
27572759 }
27582760 dev_set_uevent_suppress(&clt->dev, false);
27592761 kobject_uevent(&clt->dev.kobj, KOBJ_ADD);
27602762
27612763 return clt;
2762−err_dev:
2763− device_unregister(&clt->dev);
2764−err:
2764+err_del:
2765+ device_del(&clt->dev);
2766+err_put:
27652767 free_percpu(clt->pcpu_path);
2766− kfree(clt);
2768+ put_device(&clt->dev);
27672769 return ERR_PTR(err);
27682770 }
27692771
27702772 static void free_clt(struct rtrs_clt_sess *clt)
27712773 {
2772− free_permits(clt);
27732774 free_percpu(clt->pcpu_path);
2774− mutex_destroy(&clt->paths_ev_mutex);
2775− mutex_destroy(&clt->paths_mutex);
2776− /* release callback will free clt in last put */
2775+
2776+ /*
2777+ * release callback will free clt and destroy mutexes in last put
2778+ */
27772779 device_unregister(&clt->dev);
27782780 }
27792781
@@ -2890,6 +2892,7 @@ void rtrs_clt_close(struct rtrs_clt_sess *clt) · 110 unmodified lines
28902892 rtrs_clt_destroy_path_files(clt_path, NULL);
28912893 kobject_put(&clt_path->kobj);
28922894 }
2895+ free_permits(clt);
28932896 free_clt(clt);
28942897 }
28952898 EXPORT_SYMBOL(rtrs_clt_close);
drivers/infiniband/ulp/srp/ib_srp.c+4−2
@@ -4047,9 +4047,11 @@ static void srp_remove_one(struct ib_device *device, void *client_data) · 4046 unmodified lines
40474047 spin_unlock(&host->target_lock);
40484048
40494049 /*
4050− * Wait for tl_err and target port removal tasks.
4050+ * srp_queue_remove_work() queues a call to
4051+ * srp_remove_target(). The latter function cancels
4052+ * target->tl_err_work so waiting for the remove works to
4053+ * finish is sufficient.
40514054 */
4052− flush_workqueue(system_long_wq);
40534055 flush_workqueue(srp_remove_wq);
40544056
40554057 kfree(host);
drivers/input/input.c+6−0
@@ -2285,6 +2285,12 @@ int input_register_device(struct input_dev *dev) · 2284 unmodified lines
22852285 /* KEY_RESERVED is not supposed to be transmitted to userspace. */
22862286 __clear_bit(KEY_RESERVED, dev->keybit);
22872287
2288+ /* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */
2289+ if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) {
2290+ __clear_bit(BTN_RIGHT, dev->keybit);
2291+ __clear_bit(BTN_MIDDLE, dev->keybit);
2292+ }
2293+
22882294 /* Make sure that bitmasks not mentioned in dev->evbit are clean. */
22892295 input_cleanse_bitmasks(dev);
22902296
drivers/input/mouse/psmouse-smbus.c+10−0
@@ -75,6 +75,8 @@ static void psmouse_smbus_detach_i2c_client(struct i2c_client *client) · 74 unmodified lines
7575 "Marking SMBus companion %s as gone\n",
7676 dev_name(&smbdev->client->dev));
7777 smbdev->dead = true;
78+ device_link_remove(&smbdev->client->dev,
79+ &smbdev->psmouse->ps2dev.serio->dev);
7880 serio_rescan(smbdev->psmouse->ps2dev.serio);
7981 } else {
8082 list_del(&smbdev->node);
@@ -174,6 +176,8 @@ static void psmouse_smbus_disconnect(struct psmouse *psmouse) · 93 unmodified lines
174176 kfree(smbdev);
175177 } else {
176178 smbdev->dead = true;
179+ device_link_remove(&smbdev->client->dev,
180+ &psmouse->ps2dev.serio->dev);
177181 psmouse_dbg(smbdev->psmouse,
178182 "posting removal request for SMBus companion %s\n",
179183 dev_name(&smbdev->client->dev));
@@ -270,6 +274,12 @@ int psmouse_smbus_init(struct psmouse *psmouse, · 90 unmodified lines
270274
271275 if (smbdev->client) {
272276 /* We have our companion device */
277+ if (!device_link_add(&smbdev->client->dev,
278+ &psmouse->ps2dev.serio->dev,
279+ DL_FLAG_STATELESS))
280+ psmouse_warn(psmouse,
281+ "failed to set up link with iSMBus companion %s\n",
282+ dev_name(&smbdev->client->dev));
273283 return 0;
274284 }
275285
drivers/input/touchscreen/zinitix.c+12−0
@@ -571,8 +571,20 @@ static SIMPLE_DEV_PM_OPS(zinitix_pm_ops, zinitix_suspend, zinitix_resume); · 570 unmodified lines
571571
572572 #ifdef CONFIG_OF
573573 static const struct of_device_id zinitix_of_match[] = {
574+ { .compatible = "zinitix,bt402" },
575+ { .compatible = "zinitix,bt403" },
576+ { .compatible = "zinitix,bt404" },
577+ { .compatible = "zinitix,bt412" },
578+ { .compatible = "zinitix,bt413" },
579+ { .compatible = "zinitix,bt431" },
580+ { .compatible = "zinitix,bt432" },
581+ { .compatible = "zinitix,bt531" },
574582 { .compatible = "zinitix,bt532" },
583+ { .compatible = "zinitix,bt538" },
575584 { .compatible = "zinitix,bt541" },
585+ { .compatible = "zinitix,bt548" },
586+ { .compatible = "zinitix,bt554" },
587+ { .compatible = "zinitix,at100" },
576588 { }
577589 };
578590 MODULE_DEVICE_TABLE(of, zinitix_of_match);
drivers/md/dm.c+1−1
@@ -2077,7 +2077,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait) · 2076 unmodified lines
20772077 set_bit(DMF_FREEING, &md->flags);
20782078 spin_unlock(&_minor_lock);
20792079
2080− blk_set_queue_dying(md->queue);
2080+ blk_mark_disk_dead(md->disk);
20812081
20822082 /*
20832083 * Take suspend_lock so that presuspend and postsuspend methods
drivers/mmc/core/block.c+14−14
@@ -1682,31 +1682,31 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req) · 1681 unmodified lines
16821682 struct mmc_card *card = mq->card;
16831683 struct mmc_host *host = card->host;
16841684 blk_status_t error = BLK_STS_OK;
1685− int retries = 0;
16861685
16871686 do {
16881687 u32 status;
16891688 int err;
1689+ int retries = 0;
16901690
1691− mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
1691+ while (retries++ <= MMC_READ_SINGLE_RETRIES) {
1692+ mmc_blk_rw_rq_prep(mqrq, card, 1, mq);
16921693
1693− mmc_wait_for_req(host, mrq);
1694+ mmc_wait_for_req(host, mrq);
16941695
1695− err = mmc_send_status(card, &status);
1696− if (err)
1697− goto error_exit;
1698−
1699− if (!mmc_host_is_spi(host) &&
1700− !mmc_ready_for_data(status)) {
1701− err = mmc_blk_fix_state(card, req);
1696+ err = mmc_send_status(card, &status);
17021697 if (err)
17031698 goto error_exit;
1704− }
17051699
1706− if (mrq->cmd->error && retries++ < MMC_READ_SINGLE_RETRIES)
1707− continue;
1700+ if (!mmc_host_is_spi(host) &&
1701+ !mmc_ready_for_data(status)) {
1702+ err = mmc_blk_fix_state(card, req);
1703+ if (err)
1704+ goto error_exit;
1705+ }
17081706
1709− retries = 0;
1707+ if (!mrq->cmd->error)
1708+ break;
1709+ }
17101710
17111711 if (mrq->cmd->error ||
17121712 mrq->data->error ||
drivers/mtd/devices/phram.c+8−4
@@ -264,16 +264,20 @@ static int phram_setup(const char *val) · 263 unmodified lines
264264 }
265265 }
266266
267− if (erasesize)
268− div_u64_rem(len, (uint32_t)erasesize, &rem);
269−
270267 if (len == 0 || erasesize == 0 || erasesize > len
271− || erasesize > UINT_MAX || rem) {
268+ || erasesize > UINT_MAX) {
272269 parse_err("illegal erasesize or len\n");
273270 ret = -EINVAL;
274271 goto error;
275272 }
276273
274+ div_u64_rem(len, (uint32_t)erasesize, &rem);
275+ if (rem) {
276+ parse_err("len is not multiple of erasesize\n");
277+ ret = -EINVAL;
278+ goto error;
279+ }
280+
277281 ret = register_device(name, start, len, (uint32_t)erasesize);
278282 if (ret)
279283 goto error;
drivers/mtd/mtdcore.c+2−0
@@ -546,6 +546,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd) · 545 unmodified lines
546546 config.stride = 1;
547547 config.read_only = true;
548548 config.root_only = true;
549+ config.ignore_wp = true;
549550 config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
550551 config.priv = mtd;
551552
@@ -833,6 +834,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd, · 281 unmodified lines
833834 config.owner = THIS_MODULE;
834835 config.type = NVMEM_TYPE_OTP;
835836 config.root_only = true;
837+ config.ignore_wp = true;
836838 config.reg_read = reg_read;
837839 config.size = size;
838840 config.of_node = np;
drivers/mtd/nand/raw/Kconfig+2−1
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2 · 41 unmodified lines
4242 tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
4343 depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
4444 depends on HAS_IOMEM
45− select OMAP_GPMC if ARCH_K3
45+ select MEMORY
46+ select OMAP_GPMC
4647 help
4748 Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
4849 and Keystone platforms.
drivers/mtd/nand/raw/brcmnand/brcmnand.c+1−1
@@ -2106,7 +2106,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, · 2105 unmodified lines
21062106 mtd->oobsize / trans,
21072107 host->hwcfg.sector_size_1k);
21082108
2109− if (!ret) {
2109+ if (ret != -EBADMSG) {
21102110 *err_addr = brcmnand_get_uncorrecc_addr(ctrl);
21112111
21122112 if (*err_addr)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c+2−1
@@ -2285,7 +2285,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, · 2284 unmodified lines
22852285 this->hw.must_apply_timings = false;
22862286 ret = gpmi_nfc_apply_timings(this);
22872287 if (ret)
2288− return ret;
2288+ goto out_pm;
22892289 }
22902290
22912291 dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs);
@@ -2414,6 +2414,7 @@ unmap: · 122 unmodified lines
24142414
24152415 this->bch = false;
24162416
2417+out_pm:
24172418 pm_runtime_mark_last_busy(this->dev);
24182419 pm_runtime_put_autosuspend(this->dev);
24192420
drivers/mtd/nand/raw/ingenic/ingenic_ecc.c+6−1
@@ -68,9 +68,14 @@ static struct ingenic_ecc *ingenic_ecc_get(struct device_node *np) · 67 unmodified lines
6868 struct ingenic_ecc *ecc;
6969
7070 pdev = of_find_device_by_node(np);
71− if (!pdev || !platform_get_drvdata(pdev))
71+ if (!pdev)
7272 return ERR_PTR(-EPROBE_DEFER);
7373
74+ if (!platform_get_drvdata(pdev)) {
75+ put_device(&pdev->dev);
76+ return ERR_PTR(-EPROBE_DEFER);
77+ }
78+
7479 ecc = platform_get_drvdata(pdev);
7580 clk_prepare_enable(ecc->clk);
7681
drivers/mtd/nand/raw/qcom_nandc.c+6−8
@@ -2,7 +2,6 @@ · 1 unmodified line
22 /*
33 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
44 */
5−
65 #include <linux/clk.h>
76 #include <linux/slab.h>
87 #include <linux/bitops.h>
@@ -3073,10 +3072,6 @@ static int qcom_nandc_probe(struct platform_device *pdev) · 3064 unmodified lines
30733072 if (dma_mapping_error(dev, nandc->base_dma))
30743073 return -ENXIO;
30753074
3076− ret = qcom_nandc_alloc(nandc);
3077− if (ret)
3078− goto err_nandc_alloc;
3079−
30803075 ret = clk_prepare_enable(nandc->core_clk);
30813076 if (ret)
30823077 goto err_core_clk;
@@ -3085,6 +3080,10 @@ static int qcom_nandc_probe(struct platform_device *pdev) · 2 unmodified lines
30853080 if (ret)
30863081 goto err_aon_clk;
30873082
3083+ ret = qcom_nandc_alloc(nandc);
3084+ if (ret)
3085+ goto err_nandc_alloc;
3086+
30883087 ret = qcom_nandc_setup(nandc);
30893088 if (ret)
30903089 goto err_setup;
@@ -3096,15 +3095,14 @@ static int qcom_nandc_probe(struct platform_device *pdev) · 5 unmodified lines
30963095 return 0;
30973096
30983097 err_setup:
3098+ qcom_nandc_unalloc(nandc);
3099+err_nandc_alloc:
30993100 clk_disable_unprepare(nandc->aon_clk);
31003101 err_aon_clk:
31013102 clk_disable_unprepare(nandc->core_clk);
31023103 err_core_clk:
3103− qcom_nandc_unalloc(nandc);
3104−err_nandc_alloc:
31053104 dma_unmap_resource(dev, res->start, resource_size(res),
31063105 DMA_BIDIRECTIONAL, 0);
3107−
31083106 return ret;
31093107 }
31103108
drivers/mtd/parsers/qcomsmempart.c+23−13
@@ -58,11 +58,11 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 57 unmodified lines
5858 const struct mtd_partition **pparts,
5959 struct mtd_part_parser_data *data)
6060 {
61+ size_t len = SMEM_FLASH_PTABLE_HDR_LEN;
62+ int ret, i, j, tmpparts, numparts = 0;
6163 struct smem_flash_pentry *pentry;
6264 struct smem_flash_ptable *ptable;
63− size_t len = SMEM_FLASH_PTABLE_HDR_LEN;
6465 struct mtd_partition *parts;
65− int ret, i, numparts;
6666 char *name, *c;
6767
6868 if (IS_ENABLED(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS)
@@ -75,7 +75,8 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 6 unmodified lines
7575 pr_debug("Parsing partition table info from SMEM\n");
7676 ptable = qcom_smem_get(SMEM_APPS, SMEM_AARM_PARTITION_TABLE, &len);
7777 if (IS_ERR(ptable)) {
78− pr_err("Error reading partition table header\n");
78+ if (PTR_ERR(ptable) != -EPROBE_DEFER)
79+ pr_err("Error reading partition table header\n");
7980 return PTR_ERR(ptable);
8081 }
8182
@@ -87,8 +88,8 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 5 unmodified lines
8788 }
8889
8990 /* Ensure that # of partitions is less than the max we have allocated */
90− numparts = le32_to_cpu(ptable->numparts);
91− if (numparts > SMEM_FLASH_PTABLE_MAX_PARTS_V4) {
91+ tmpparts = le32_to_cpu(ptable->numparts);
92+ if (tmpparts > SMEM_FLASH_PTABLE_MAX_PARTS_V4) {
9293 pr_err("Partition numbers exceed the max limit\n");
9394 return -EINVAL;
9495 }
@@ -116,11 +117,17 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 21 unmodified lines
116117 return PTR_ERR(ptable);
117118 }
118119
120+ for (i = 0; i < tmpparts; i++) {
121+ pentry = &ptable->pentry[i];
122+ if (pentry->name[0] != '\0')
123+ numparts++;
124+ }
125+
119126 parts = kcalloc(numparts, sizeof(*parts), GFP_KERNEL);
120127 if (!parts)
121128 return -ENOMEM;
122129
123− for (i = 0; i < numparts; i++) {
130+ for (i = 0, j = 0; i < tmpparts; i++) {
124131 pentry = &ptable->pentry[i];
125132 if (pentry->name[0] == '\0')
126133 continue;
@@ -135,24 +142,25 @@ static int parse_qcomsmem_part(struct mtd_info *mtd, · 8 unmodified lines
135142 for (c = name; *c != '\0'; c++)
136143 *c = tolower(*c);
137144
138− parts[i].name = name;
139− parts[i].offset = le32_to_cpu(pentry->offset) * mtd->erasesize;
140− parts[i].mask_flags = pentry->attr;
141− parts[i].size = le32_to_cpu(pentry->length) * mtd->erasesize;
145+ parts[j].name = name;
146+ parts[j].offset = le32_to_cpu(pentry->offset) * mtd->erasesize;
147+ parts[j].mask_flags = pentry->attr;
148+ parts[j].size = le32_to_cpu(pentry->length) * mtd->erasesize;
142149 pr_debug("%d: %s offs=0x%08x size=0x%08x attr:0x%08x\n",
143150 i, pentry->name, le32_to_cpu(pentry->offset),
144151 le32_to_cpu(pentry->length), pentry->attr);
152+ j++;
145153 }
146154
147155 pr_debug("SMEM partition table found: ver: %d len: %d\n",
148− le32_to_cpu(ptable->version), numparts);
156+ le32_to_cpu(ptable->version), tmpparts);
149157 *pparts = parts;
150158
151159 return numparts;
152160
153161 out_free_parts:
154− while (--i >= 0)
155− kfree(parts[i].name);
162+ while (--j >= 0)
163+ kfree(parts[j].name);
156164 kfree(parts);
157165 *pparts = NULL;
158166
@@ -166,6 +174,8 @@ static void parse_qcomsmem_cleanup(const struct mtd_partition *pparts, · 7 unmodified lines
166174
167175 for (i = 0; i < nr_parts; i++)
168176 kfree(pparts[i].name);
177+
178+ kfree(pparts);
169179 }
170180
171181 static const struct of_device_id qcomsmem_of_match_table[] = {
drivers/net/bonding/bond_3ad.c+25−5
@@ -225,7 +225,7 @@ static inline int __check_agg_selection_timer(struct port *port) · 224 unmodified lines
225225 if (bond == NULL)
226226 return 0;
227227
228− return BOND_AD_INFO(bond).agg_select_timer ? 1 : 0;
228+ return atomic_read(&BOND_AD_INFO(bond).agg_select_timer) ? 1 : 0;
229229 }
230230
231231 /**
@@ -1995,7 +1995,7 @@ static void ad_marker_response_received(struct bond_marker *marker, · 1763 unmodified lines
19951995 */
19961996 void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout)
19971997 {
1998− BOND_AD_INFO(bond).agg_select_timer = timeout;
1998+ atomic_set(&BOND_AD_INFO(bond).agg_select_timer, timeout);
19991999 }
20002000
20012001 /**
@@ -2278,6 +2278,28 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond) · 276 unmodified lines
22782278 spin_unlock_bh(&bond->mode_lock);
22792279 }
22802280
2281+/**
2282+ * bond_agg_timer_advance - advance agg_select_timer
2283+ * @bond: bonding structure
2284+ *
2285+ * Return true when agg_select_timer reaches 0.
2286+ */
2287+static bool bond_agg_timer_advance(struct bonding *bond)
2288+{
2289+ int val, nval;
2290+
2291+ while (1) {
2292+ val = atomic_read(&BOND_AD_INFO(bond).agg_select_timer);
2293+ if (!val)
2294+ return false;
2295+ nval = val - 1;
2296+ if (atomic_cmpxchg(&BOND_AD_INFO(bond).agg_select_timer,
2297+ val, nval) == val)
2298+ break;
2299+ }
2300+ return nval == 0;
2301+}
2302+
22812303 /**
22822304 * bond_3ad_state_machine_handler - handle state machines timeout
22832305 * @work: work context to fetch bonding struct to work on from
@@ -2313,9 +2335,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) · 29 unmodified lines
23132335 if (!bond_has_slaves(bond))
23142336 goto re_arm;
23152337
2316− /* check if agg_select_timer timer after initialize is timed out */
2317− if (BOND_AD_INFO(bond).agg_select_timer &&
2318− !(--BOND_AD_INFO(bond).agg_select_timer)) {
2338+ if (bond_agg_timer_advance(bond)) {
23192339 slave = bond_first_slave_rcu(bond);
23202340 port = slave ? &(SLAVE_AD_INFO(slave)->port) : NULL;
23212341
drivers/net/bonding/bond_main.c+2−3
@@ -2379,10 +2379,9 @@ static int __bond_release_one(struct net_device *bond_dev, · 2378 unmodified lines
23792379 bond_select_active_slave(bond);
23802380 }
23812381
2382− if (!bond_has_slaves(bond)) {
2383− bond_set_carrier(bond);
2382+ bond_set_carrier(bond);
2383+ if (!bond_has_slaves(bond))
23842384 eth_hw_addr_random(bond_dev);
2385− }
23862385
23872386 unblock_netpoll_tx();
23882387 synchronize_rcu();
drivers/net/dsa/Kconfig+1−0
@@ -82,6 +82,7 @@ config NET_DSA_REALTEK_SMI · 81 unmodified lines
8282
8383 config NET_DSA_SMSC_LAN9303
8484 tristate
85+ depends on VLAN_8021Q || VLAN_8021Q=n
8586 select NET_DSA_TAG_LAN9303
8687 select REGMAP
8788 help
drivers/net/dsa/lan9303-core.c+10−3
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/mii.h>
1111 #include <linux/phy.h>
1212 #include <linux/if_bridge.h>
13+#include <linux/if_vlan.h>
1314 #include <linux/etherdevice.h>
1415
1516 #include "lan9303.h"
@@ -1083,21 +1084,27 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port, · 1067 unmodified lines
10831084 static int lan9303_port_enable(struct dsa_switch *ds, int port,
10841085 struct phy_device *phy)
10851086 {
1087+ struct dsa_port *dp = dsa_to_port(ds, port);
10861088 struct lan9303 *chip = ds->priv;
10871089
1088− if (!dsa_is_user_port(ds, port))
1090+ if (!dsa_port_is_user(dp))
10891091 return 0;
10901092
1093+ vlan_vid_add(dp->cpu_dp->master, htons(ETH_P_8021Q), port);
1094+
10911095 return lan9303_enable_processing_port(chip, port);
10921096 }
10931097
10941098 static void lan9303_port_disable(struct dsa_switch *ds, int port)
10951099 {
1100+ struct dsa_port *dp = dsa_to_port(ds, port);
10961101 struct lan9303 *chip = ds->priv;
10971102
1098− if (!dsa_is_user_port(ds, port))
1103+ if (!dsa_port_is_user(dp))
10991104 return;
11001105
1106+ vlan_vid_del(dp->cpu_dp->master, htons(ETH_P_8021Q), port);
1107+
11011108 lan9303_disable_processing_port(chip, port);
11021109 lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
11031110 }
@@ -1310,7 +1317,7 @@ static int lan9303_probe_reset_gpio(struct lan9303 *chip, · 206 unmodified lines
13101317 struct device_node *np)
13111318 {
13121319 chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset",
1313− GPIOD_OUT_LOW);
1320+ GPIOD_OUT_HIGH);
13141321 if (IS_ERR(chip->reset_gpio))
13151322 return PTR_ERR(chip->reset_gpio);
13161323
drivers/net/dsa/lantiq_gswip.c+1−1
@@ -2176,8 +2176,8 @@ static int gswip_remove(struct platform_device *pdev) · 2175 unmodified lines
21762176
21772177 if (priv->ds->slave_mii_bus) {
21782178 mdiobus_unregister(priv->ds->slave_mii_bus);
2179− mdiobus_free(priv->ds->slave_mii_bus);
21802179 of_node_put(priv->ds->slave_mii_bus->dev.of_node);
2180+ mdiobus_free(priv->ds->slave_mii_bus);
21812181 }
21822182
21832183 for (i = 0; i < priv->num_gphy_fw; i++)
drivers/net/dsa/microchip/ksz_common.c+23−3
@@ -26,7 +26,7 @@ void ksz_update_port_member(struct ksz_device *dev, int port) · 25 unmodified lines
2626 struct dsa_switch *ds = dev->ds;
2727 u8 port_member = 0, cpu_port;
2828 const struct dsa_port *dp;
29− int i;
29+ int i, j;
3030
3131 if (!dsa_is_user_port(ds, port))
3232 return;
@@ -45,13 +45,33 @@ void ksz_update_port_member(struct ksz_device *dev, int port) · 12 unmodified lines
4545 continue;
4646 if (!dsa_port_bridge_same(dp, other_dp))
4747 continue;
48+ if (other_p->stp_state != BR_STATE_FORWARDING)
49+ continue;
4850
49− if (other_p->stp_state == BR_STATE_FORWARDING &&
50− p->stp_state == BR_STATE_FORWARDING) {
51+ if (p->stp_state == BR_STATE_FORWARDING) {
5152 val |= BIT(port);
5253 port_member |= BIT(i);
5354 }
5455
56+ /* Retain port [i]'s relationship to other ports than [port] */
57+ for (j = 0; j < ds->num_ports; j++) {
58+ const struct dsa_port *third_dp;
59+ struct ksz_port *third_p;
60+
61+ if (j == i)
62+ continue;
63+ if (j == port)
64+ continue;
65+ if (!dsa_is_user_port(ds, j))
66+ continue;
67+ third_p = &dev->ports[j];
68+ if (third_p->stp_state != BR_STATE_FORWARDING)
69+ continue;
70+ third_dp = dsa_to_port(ds, j);
71+ if (dsa_port_bridge_same(other_dp, third_dp))
72+ val |= BIT(j);
73+ }
74+
5575 dev->dev_ops->cfg_port_member(dev, i, val | cpu_port);
5676 }
5777
drivers/net/dsa/mv88e6xxx/chip.c+7−0
@@ -2284,6 +2284,13 @@ static int mv88e6xxx_port_vlan_del(struct dsa_switch *ds, int port, · 2283 unmodified lines
22842284 if (!mv88e6xxx_max_vid(chip))
22852285 return -EOPNOTSUPP;
22862286
2287+ /* The ATU removal procedure needs the FID to be mapped in the VTU,
2288+ * but FDB deletion runs concurrently with VLAN deletion. Flush the DSA
2289+ * switchdev workqueue to ensure that all FDB entries are deleted
2290+ * before we remove the VLAN.
2291+ */
2292+ dsa_flush_workqueue();
2293+
22872294 mv88e6xxx_reg_lock(chip);
22882295
22892296 err = mv88e6xxx_port_get_pvid(chip, port, &pvid);
drivers/net/ethernet/atheros/atl1c/atl1c_main.c+1−1
@@ -900,7 +900,7 @@ static void atl1c_clean_tx_ring(struct atl1c_adapter *adapter, · 899 unmodified lines
900900 atl1c_clean_buffer(pdev, buffer_info);
901901 }
902902
903− netdev_reset_queue(adapter->netdev);
903+ netdev_tx_reset_queue(netdev_get_tx_queue(adapter->netdev, queue));
904904
905905 /* Zero out Tx-buffers */
906906 memset(tpd_ring->desc, 0, sizeof(struct atl1c_tpd_desc) *
drivers/net/ethernet/broadcom/bgmac-platform.c+16−7
@@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_device *pdev) · 171 unmodified lines
172172 {
173173 struct device_node *np = pdev->dev.of_node;
174174 struct bgmac *bgmac;
175+ struct resource *regs;
175176 int ret;
176177
177178 bgmac = bgmac_alloc(&pdev->dev);
@@ -208,15 +209,23 @@ static int bgmac_probe(struct platform_device *pdev) · 30 unmodified lines
208209 if (IS_ERR(bgmac->plat.base))
209210 return PTR_ERR(bgmac->plat.base);
210211
211− bgmac->plat.idm_base = devm_platform_ioremap_resource_byname(pdev, "idm_base");
212− if (IS_ERR(bgmac->plat.idm_base))
213− return PTR_ERR(bgmac->plat.idm_base);
214− else
212+ /* The idm_base resource is optional for some platforms */
213+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
214+ if (regs) {
215+ bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
216+ if (IS_ERR(bgmac->plat.idm_base))
217+ return PTR_ERR(bgmac->plat.idm_base);
215218 bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
219+ }
216220
217− bgmac->plat.nicpm_base = devm_platform_ioremap_resource_byname(pdev, "nicpm_base");
218− if (IS_ERR(bgmac->plat.nicpm_base))
219− return PTR_ERR(bgmac->plat.nicpm_base);
221+ /* The nicpm_base resource is optional for some platforms */
222+ regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
223+ if (regs) {
224+ bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
225+ regs);
226+ if (IS_ERR(bgmac->plat.nicpm_base))
227+ return PTR_ERR(bgmac->plat.nicpm_base);
228+ }
220229
221230 bgmac->read = platform_bgmac_read;
222231 bgmac->write = platform_bgmac_write;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+3−0
@@ -100,6 +100,9 @@ MODULE_LICENSE("GPL"); · 99 unmodified lines
100100 MODULE_FIRMWARE(FW_FILE_NAME_E1);
101101 MODULE_FIRMWARE(FW_FILE_NAME_E1H);
102102 MODULE_FIRMWARE(FW_FILE_NAME_E2);
103+MODULE_FIRMWARE(FW_FILE_NAME_E1_V15);
104+MODULE_FIRMWARE(FW_FILE_NAME_E1H_V15);
105+MODULE_FIRMWARE(FW_FILE_NAME_E2_V15);
103106
104107 int bnx2x_num_queues;
105108 module_param_named(num_queues, bnx2x_num_queues, int, 0444);
drivers/net/ethernet/broadcom/bnxt/bnxt.c+35−12
@@ -4747,8 +4747,10 @@ static int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, u16 vnic_id) · 4746 unmodified lines
47474747 return rc;
47484748
47494749 req->vnic_id = cpu_to_le32(vnic->fw_vnic_id);
4750− req->num_mc_entries = cpu_to_le32(vnic->mc_list_count);
4751− req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping);
4750+ if (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST) {
4751+ req->num_mc_entries = cpu_to_le32(vnic->mc_list_count);
4752+ req->mc_tbl_addr = cpu_to_le64(vnic->mc_list_mapping);
4753+ }
47524754 req->mask = cpu_to_le32(vnic->rx_mask);
47534755 return hwrm_req_send_silent(bp, req);
47544756 }
@@ -7787,6 +7789,19 @@ static int bnxt_map_fw_health_regs(struct bnxt *bp) · 3032 unmodified lines
77877789 return 0;
77887790 }
77897791
7792+static void bnxt_remap_fw_health_regs(struct bnxt *bp)
7793+{
7794+ if (!bp->fw_health)
7795+ return;
7796+
7797+ if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) {
7798+ bp->fw_health->status_reliable = true;
7799+ bp->fw_health->resets_reliable = true;
7800+ } else {
7801+ bnxt_try_map_fw_health_reg(bp);
7802+ }
7803+}
7804+
77907805 static int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
77917806 {
77927807 struct bnxt_fw_health *fw_health = bp->fw_health;
@@ -8639,6 +8654,9 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 846 unmodified lines
86398654 vnic->uc_filter_count = 1;
86408655
86418656 vnic->rx_mask = 0;
8657+ if (test_bit(BNXT_STATE_HALF_OPEN, &bp->state))
8658+ goto skip_rx_mask;
8659+
86428660 if (bp->dev->flags & IFF_BROADCAST)
86438661 vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_BCAST;
86448662
@@ -8648,7 +8666,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 3 unmodified lines
86488666 if (bp->dev->flags & IFF_ALLMULTI) {
86498667 vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
86508668 vnic->mc_list_count = 0;
8651− } else {
8669+ } else if (bp->dev->flags & IFF_MULTICAST) {
86528670 u32 mask = 0;
86538671
86548672 bnxt_mc_list_updated(bp, &mask);
@@ -8659,6 +8677,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) · 4 unmodified lines
86598677 if (rc)
86608678 goto err_out;
86618679
8680+skip_rx_mask:
86628681 rc = bnxt_hwrm_set_coal(bp);
86638682 if (rc)
86648683 netdev_warn(bp->dev, "HWRM set coalescing failure rc: %x\n",
@@ -9850,8 +9869,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) · 1185 unmodified lines
98509869 resc_reinit = true;
98519870 if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE)
98529871 fw_reset = true;
9853− else if (bp->fw_health && !bp->fw_health->status_reliable)
9854− bnxt_try_map_fw_health_reg(bp);
9872+ else
9873+ bnxt_remap_fw_health_regs(bp);
98559874
98569875 if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) && !fw_reset) {
98579876 netdev_err(bp->dev, "RESET_DONE not set during FW reset.\n");
@@ -10330,13 +10349,15 @@ int bnxt_half_open_nic(struct bnxt *bp) · 472 unmodified lines
1033010349 goto half_open_err;
1033110350 }
1033210351
10333− rc = bnxt_alloc_mem(bp, false);
10352+ rc = bnxt_alloc_mem(bp, true);
1033410353 if (rc) {
1033510354 netdev_err(bp->dev, "bnxt_alloc_mem err: %x\n", rc);
1033610355 goto half_open_err;
1033710356 }
10338− rc = bnxt_init_nic(bp, false);
10357+ set_bit(BNXT_STATE_HALF_OPEN, &bp->state);
10358+ rc = bnxt_init_nic(bp, true);
1033910359 if (rc) {
10360+ clear_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1034010361 netdev_err(bp->dev, "bnxt_init_nic err: %x\n", rc);
1034110362 goto half_open_err;
1034210363 }
@@ -10344,7 +10365,7 @@ int bnxt_half_open_nic(struct bnxt *bp) · 1 unmodified line
1034410365
1034510366 half_open_err:
1034610367 bnxt_free_skbs(bp);
10347− bnxt_free_mem(bp, false);
10368+ bnxt_free_mem(bp, true);
1034810369 dev_close(bp->dev);
1034910370 return rc;
1035010371 }
@@ -10354,9 +10375,10 @@ half_open_err: · 3 unmodified lines
1035410375 */
1035510376 void bnxt_half_close_nic(struct bnxt *bp)
1035610377 {
10357− bnxt_hwrm_resource_free(bp, false, false);
10378+ bnxt_hwrm_resource_free(bp, false, true);
1035810379 bnxt_free_skbs(bp);
10359− bnxt_free_mem(bp, false);
10380+ bnxt_free_mem(bp, true);
10381+ clear_bit(BNXT_STATE_HALF_OPEN, &bp->state);
1036010382 }
1036110383
1036210384 void bnxt_reenable_sriov(struct bnxt *bp)
@@ -10772,7 +10794,7 @@ static void bnxt_set_rx_mode(struct net_device *dev) · 409 unmodified lines
1077210794 if (dev->flags & IFF_ALLMULTI) {
1077310795 mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
1077410796 vnic->mc_list_count = 0;
10775− } else {
10797+ } else if (dev->flags & IFF_MULTICAST) {
1077610798 mc_update = bnxt_mc_list_updated(bp, &mask);
1077710799 }
1077810800
@@ -10849,9 +10871,10 @@ skip_uc: · 70 unmodified lines
1084910871 !bnxt_promisc_ok(bp))
1085010872 vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
1085110873 rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0);
10852− if (rc && vnic->mc_list_count) {
10874+ if (rc && (vnic->rx_mask & CFA_L2_SET_RX_MASK_REQ_MASK_MCAST)) {
1085310875 netdev_info(bp->dev, "Failed setting MC filters rc: %d, turning on ALL_MCAST mode\n",
1085410876 rc);
10877+ vnic->rx_mask &= ~CFA_L2_SET_RX_MASK_REQ_MASK_MCAST;
1085510878 vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
1085610879 vnic->mc_list_count = 0;
1085710880 rc = bnxt_hwrm_cfa_l2_set_rx_mask(bp, 0);
drivers/net/ethernet/broadcom/bnxt/bnxt.h+1−0
@@ -1921,6 +1921,7 @@ struct bnxt { · 1920 unmodified lines
19211921 #define BNXT_STATE_RECOVER 12
19221922 #define BNXT_STATE_FW_NON_FATAL_COND 13
19231923 #define BNXT_STATE_FW_ACTIVATE_RESET 14
1924+#define BNXT_STATE_HALF_OPEN 15 /* For offline ethtool tests */
19241925
19251926 #define BNXT_NO_FW_ACCESS(bp) \
19261927 (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) || \
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c+31−8
@@ -367,6 +367,16 @@ bnxt_dl_livepatch_report_err(struct bnxt *bp, struct netlink_ext_ack *extack, · 366 unmodified lines
367367 }
368368 }
369369
370+/* Live patch status in NVM */
371+#define BNXT_LIVEPATCH_NOT_INSTALLED 0
372+#define BNXT_LIVEPATCH_INSTALLED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL
373+#define BNXT_LIVEPATCH_REMOVED FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE
374+#define BNXT_LIVEPATCH_MASK (FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL | \
375+ FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE)
376+#define BNXT_LIVEPATCH_ACTIVATED BNXT_LIVEPATCH_MASK
377+
378+#define BNXT_LIVEPATCH_STATE(flags) ((flags) & BNXT_LIVEPATCH_MASK)
379+
370380 static int
371381 bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack)
372382 {
@@ -374,8 +384,9 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 1 unmodified line
374384 struct hwrm_fw_livepatch_query_input *query_req;
375385 struct hwrm_fw_livepatch_output *patch_resp;
376386 struct hwrm_fw_livepatch_input *patch_req;
387+ u16 flags, live_patch_state;
388+ bool activated = false;
377389 u32 installed = 0;
378− u16 flags;
379390 u8 target;
380391 int rc;
381392
@@ -394,7 +405,6 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 12 unmodified lines
394405 hwrm_req_drop(bp, query_req);
395406 return rc;
396407 }
397− patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE;
398408 patch_req->loadtype = FW_LIVEPATCH_REQ_LOADTYPE_NVM_INSTALL;
399409 patch_resp = hwrm_req_hold(bp, patch_req);
400410
@@ -407,12 +417,20 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 6 unmodified lines
407417 }
408418
409419 flags = le16_to_cpu(query_resp->status_flags);
410− if (~flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_INSTALL)
420+ live_patch_state = BNXT_LIVEPATCH_STATE(flags);
421+
422+ if (live_patch_state == BNXT_LIVEPATCH_NOT_INSTALLED)
411423 continue;
412− if ((flags & FW_LIVEPATCH_QUERY_RESP_STATUS_FLAGS_ACTIVE) &&
413− !strncmp(query_resp->active_ver, query_resp->install_ver,
414− sizeof(query_resp->active_ver)))
424+
425+ if (live_patch_state == BNXT_LIVEPATCH_ACTIVATED) {
426+ activated = true;
415427 continue;
428+ }
429+
430+ if (live_patch_state == BNXT_LIVEPATCH_INSTALLED)
431+ patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_ACTIVATE;
432+ else if (live_patch_state == BNXT_LIVEPATCH_REMOVED)
433+ patch_req->opcode = FW_LIVEPATCH_REQ_OPCODE_DEACTIVATE;
416434
417435 patch_req->fw_target = target;
418436 rc = hwrm_req_send(bp, patch_req);
@@ -424,8 +442,13 @@ bnxt_dl_livepatch_activate(struct bnxt *bp, struct netlink_ext_ack *extack) · 5 unmodified lines
424442 }
425443
426444 if (!rc && !installed) {
427− NL_SET_ERR_MSG_MOD(extack, "No live patches found");
428− rc = -ENOENT;
445+ if (activated) {
446+ NL_SET_ERR_MSG_MOD(extack, "Live patch already activated");
447+ rc = -EEXIST;
448+ } else {
449+ NL_SET_ERR_MSG_MOD(extack, "No live patches found");
450+ rc = -ENOENT;
451+ }
429452 }
430453 hwrm_req_drop(bp, query_req);
431454 hwrm_req_drop(bp, patch_req);
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c+13−4
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include "bnxt_hsi.h"
2626 #include "bnxt.h"
2727 #include "bnxt_hwrm.h"
28+#include "bnxt_ulp.h"
2829 #include "bnxt_xdp.h"
2930 #include "bnxt_ptp.h"
3031 #include "bnxt_ethtool.h"
@@ -1969,6 +1970,9 @@ static int bnxt_get_fecparam(struct net_device *dev, · 1938 unmodified lines
19691970 case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_RS272_IEEE_ACTIVE:
19701971 fec->active_fec |= ETHTOOL_FEC_LLRS;
19711972 break;
1973+ case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_NONE_ACTIVE:
1974+ fec->active_fec |= ETHTOOL_FEC_OFF;
1975+ break;
19721976 }
19731977 return 0;
19741978 }
@@ -3454,7 +3458,7 @@ static int bnxt_run_loopback(struct bnxt *bp) · 1479 unmodified lines
34543458 if (!skb)
34553459 return -ENOMEM;
34563460 data = skb_put(skb, pkt_size);
3457− eth_broadcast_addr(data);
3461+ ether_addr_copy(&data[i], bp->dev->dev_addr);
34583462 i += ETH_ALEN;
34593463 ether_addr_copy(&data[i], bp->dev->dev_addr);
34603464 i += ETH_ALEN;
@@ -3548,9 +3552,12 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 87 unmodified lines
35483552 if (!offline) {
35493553 bnxt_run_fw_tests(bp, test_mask, &test_results);
35503554 } else {
3551− rc = bnxt_close_nic(bp, false, false);
3552− if (rc)
3555+ bnxt_ulp_stop(bp);
3556+ rc = bnxt_close_nic(bp, true, false);
3557+ if (rc) {
3558+ bnxt_ulp_start(bp, rc);
35533559 return;
3560+ }
35543561 bnxt_run_fw_tests(bp, test_mask, &test_results);
35553562
35563563 buf[BNXT_MACLPBK_TEST_IDX] = 1;
@@ -3560,6 +3567,7 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 3 unmodified lines
35603567 if (rc) {
35613568 bnxt_hwrm_mac_loopback(bp, false);
35623569 etest->flags |= ETH_TEST_FL_FAILED;
3570+ bnxt_ulp_start(bp, rc);
35633571 return;
35643572 }
35653573 if (bnxt_run_loopback(bp))
@@ -3585,7 +3593,8 @@ static void bnxt_self_test(struct net_device *dev, struct ethtool_test *etest, · 19 unmodified lines
35853593 }
35863594 bnxt_hwrm_phy_loopback(bp, false, false);
35873595 bnxt_half_close_nic(bp);
3588− rc = bnxt_open_nic(bp, false, true);
3596+ rc = bnxt_open_nic(bp, true, true);
3597+ bnxt_ulp_start(bp, rc);
35893598 }
35903599 if (rc || bnxt_test_irq(bp)) {
35913600 buf[BNXT_IRQ_TEST_IDX] = 1;
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c+9−3
@@ -644,17 +644,23 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) · 643 unmodified lines
644644
645645 /* Last byte of resp contains valid bit */
646646 valid = ((u8 *)ctx->resp) + len - 1;
647− for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; j++) {
647+ for (j = 0; j < HWRM_VALID_BIT_DELAY_USEC; ) {
648648 /* make sure we read from updated DMA memory */
649649 dma_rmb();
650650 if (*valid)
651651 break;
652− usleep_range(1, 5);
652+ if (j < 10) {
653+ udelay(1);
654+ j++;
655+ } else {
656+ usleep_range(20, 30);
657+ j += 20;
658+ }
653659 }
654660
655661 if (j >= HWRM_VALID_BIT_DELAY_USEC) {
656662 hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d v:%d\n",
657− hwrm_total_timeout(i), req_type,
663+ hwrm_total_timeout(i) + j, req_type,
658664 le16_to_cpu(ctx->req->seq_id), len, *valid);
659665 goto exit;
660666 }
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h+1−1
@@ -90,7 +90,7 @@ static inline unsigned int hwrm_total_timeout(unsigned int n) · 89 unmodified lines
9090 }
9191
9292
93−#define HWRM_VALID_BIT_DELAY_USEC 150
93+#define HWRM_VALID_BIT_DELAY_USEC 50000
9494
9595 static inline bool bnxt_cfa_hwrm_message(u16 req_type)
9696 {
drivers/net/ethernet/faraday/ftgmac100.c+129−114
@@ -989,117 +989,6 @@ static int ftgmac100_alloc_rx_buffers(struct ftgmac100 *priv) · 988 unmodified lines
989989 return 0;
990990 }
991991
992−static void ftgmac100_adjust_link(struct net_device *netdev)
993−{
994− struct ftgmac100 *priv = netdev_priv(netdev);
995− struct phy_device *phydev = netdev->phydev;
996− bool tx_pause, rx_pause;
997− int new_speed;
998−
999− /* We store "no link" as speed 0 */
1000− if (!phydev->link)
1001− new_speed = 0;
1002− else
1003− new_speed = phydev->speed;
1004−
1005− /* Grab pause settings from PHY if configured to do so */
1006− if (priv->aneg_pause) {
1007− rx_pause = tx_pause = phydev->pause;
1008− if (phydev->asym_pause)
1009− tx_pause = !rx_pause;
1010− } else {
1011− rx_pause = priv->rx_pause;
1012− tx_pause = priv->tx_pause;
1013− }
1014−
1015− /* Link hasn't changed, do nothing */
1016− if (phydev->speed == priv->cur_speed &&
1017− phydev->duplex == priv->cur_duplex &&
1018− rx_pause == priv->rx_pause &&
1019− tx_pause == priv->tx_pause)
1020− return;
1021−
1022− /* Print status if we have a link or we had one and just lost it,
1023− * don't print otherwise.
1024− */
1025− if (new_speed || priv->cur_speed)
1026− phy_print_status(phydev);
1027−
1028− priv->cur_speed = new_speed;
1029− priv->cur_duplex = phydev->duplex;
1030− priv->rx_pause = rx_pause;
1031− priv->tx_pause = tx_pause;
1032−
1033− /* Link is down, do nothing else */
1034− if (!new_speed)
1035− return;
1036−
1037− /* Disable all interrupts */
1038− iowrite32(0, priv->base + FTGMAC100_OFFSET_IER);
1039−
1040− /* Reset the adapter asynchronously */
1041− schedule_work(&priv->reset_task);
1042−}
1043−
1044−static int ftgmac100_mii_probe(struct net_device *netdev)
1045−{
1046− struct ftgmac100 *priv = netdev_priv(netdev);
1047− struct platform_device *pdev = to_platform_device(priv->dev);
1048− struct device_node *np = pdev->dev.of_node;
1049− struct phy_device *phydev;
1050− phy_interface_t phy_intf;
1051− int err;
1052−
1053− /* Default to RGMII. It's a gigabit part after all */
1054− err = of_get_phy_mode(np, &phy_intf);
1055− if (err)
1056− phy_intf = PHY_INTERFACE_MODE_RGMII;
1057−
1058− /* Aspeed only supports these. I don't know about other IP
1059− * block vendors so I'm going to just let them through for
1060− * now. Note that this is only a warning if for some obscure
1061− * reason the DT really means to lie about it or it's a newer
1062− * part we don't know about.
1063− *
1064− * On the Aspeed SoC there are additionally straps and SCU
1065− * control bits that could tell us what the interface is
1066− * (or allow us to configure it while the IP block is held
1067− * in reset). For now I chose to keep this driver away from
1068− * those SoC specific bits and assume the device-tree is
1069− * right and the SCU has been configured properly by pinmux
1070− * or the firmware.
1071− */
1072− if (priv->is_aspeed && !(phy_interface_mode_is_rgmii(phy_intf))) {
1073− netdev_warn(netdev,
1074− "Unsupported PHY mode %s !\n",
1075− phy_modes(phy_intf));
1076− }
1077−
1078− phydev = phy_find_first(priv->mii_bus);
1079− if (!phydev) {
1080− netdev_info(netdev, "%s: no PHY found\n", netdev->name);
1081− return -ENODEV;
1082− }
1083−
1084− phydev = phy_connect(netdev, phydev_name(phydev),
1085− &ftgmac100_adjust_link, phy_intf);
1086−
1087− if (IS_ERR(phydev)) {
1088− netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name);
1089− return PTR_ERR(phydev);
1090− }
1091−
1092− /* Indicate that we support PAUSE frames (see comment in
1093− * Documentation/networking/phy.rst)
1094− */
1095− phy_support_asym_pause(phydev);
1096−
1097− /* Display what we found */
1098− phy_attached_info(phydev);
1099−
1100− return 0;
1101−}
1102−
1103992 static int ftgmac100_mdiobus_read(struct mii_bus *bus, int phy_addr, int regnum)
1104993 {
1105994 struct net_device *netdev = bus->priv;
@@ -1410,10 +1299,8 @@ static int ftgmac100_init_all(struct ftgmac100 *priv, bool ignore_alloc_err) · 304 unmodified lines
14101299 return err;
14111300 }
14121301
1413−static void ftgmac100_reset_task(struct work_struct *work)
1302+static void ftgmac100_reset(struct ftgmac100 *priv)
14141303 {
1415− struct ftgmac100 *priv = container_of(work, struct ftgmac100,
1416− reset_task);
14171304 struct net_device *netdev = priv->netdev;
14181305 int err;
14191306
@@ -1459,6 +1346,134 @@ static void ftgmac100_reset_task(struct work_struct *work) · 39 unmodified lines
14591346 rtnl_unlock();
14601347 }
14611348
1349+static void ftgmac100_reset_task(struct work_struct *work)
1350+{
1351+ struct ftgmac100 *priv = container_of(work, struct ftgmac100,
1352+ reset_task);
1353+
1354+ ftgmac100_reset(priv);
1355+}
1356+
1357+static void ftgmac100_adjust_link(struct net_device *netdev)
1358+{
1359+ struct ftgmac100 *priv = netdev_priv(netdev);
1360+ struct phy_device *phydev = netdev->phydev;
1361+ bool tx_pause, rx_pause;
1362+ int new_speed;
1363+
1364+ /* We store "no link" as speed 0 */
1365+ if (!phydev->link)
1366+ new_speed = 0;
1367+ else
1368+ new_speed = phydev->speed;
1369+
1370+ /* Grab pause settings from PHY if configured to do so */
1371+ if (priv->aneg_pause) {
1372+ rx_pause = tx_pause = phydev->pause;
1373+ if (phydev->asym_pause)
1374+ tx_pause = !rx_pause;
1375+ } else {
1376+ rx_pause = priv->rx_pause;
1377+ tx_pause = priv->tx_pause;
1378+ }
1379+
1380+ /* Link hasn't changed, do nothing */
1381+ if (phydev->speed == priv->cur_speed &&
1382+ phydev->duplex == priv->cur_duplex &&
1383+ rx_pause == priv->rx_pause &&
1384+ tx_pause == priv->tx_pause)
1385+ return;
1386+
1387+ /* Print status if we have a link or we had one and just lost it,
1388+ * don't print otherwise.
1389+ */
1390+ if (new_speed || priv->cur_speed)
1391+ phy_print_status(phydev);
1392+
1393+ priv->cur_speed = new_speed;
1394+ priv->cur_duplex = phydev->duplex;
1395+ priv->rx_pause = rx_pause;
1396+ priv->tx_pause = tx_pause;
1397+
1398+ /* Link is down, do nothing else */
1399+ if (!new_speed)
1400+ return;
1401+
1402+ /* Disable all interrupts */
1403+ iowrite32(0, priv->base + FTGMAC100_OFFSET_IER);
1404+
1405+ /* Release phy lock to allow ftgmac100_reset to aquire it, keeping lock
1406+ * order consistent to prevent dead lock.
1407+ */
1408+ if (netdev->phydev)
1409+ mutex_unlock(&netdev->phydev->lock);
1410+
1411+ ftgmac100_reset(priv);
1412+
1413+ if (netdev->phydev)
1414+ mutex_lock(&netdev->phydev->lock);
1415+
1416+}
1417+
1418+static int ftgmac100_mii_probe(struct net_device *netdev)
1419+{
1420+ struct ftgmac100 *priv = netdev_priv(netdev);
1421+ struct platform_device *pdev = to_platform_device(priv->dev);
1422+ struct device_node *np = pdev->dev.of_node;
1423+ struct phy_device *phydev;
1424+ phy_interface_t phy_intf;
1425+ int err;
1426+
1427+ /* Default to RGMII. It's a gigabit part after all */
1428+ err = of_get_phy_mode(np, &phy_intf);
1429+ if (err)
1430+ phy_intf = PHY_INTERFACE_MODE_RGMII;
1431+
1432+ /* Aspeed only supports these. I don't know about other IP
1433+ * block vendors so I'm going to just let them through for
1434+ * now. Note that this is only a warning if for some obscure
1435+ * reason the DT really means to lie about it or it's a newer
1436+ * part we don't know about.
1437+ *
1438+ * On the Aspeed SoC there are additionally straps and SCU
1439+ * control bits that could tell us what the interface is
1440+ * (or allow us to configure it while the IP block is held
1441+ * in reset). For now I chose to keep this driver away from
1442+ * those SoC specific bits and assume the device-tree is
1443+ * right and the SCU has been configured properly by pinmux
1444+ * or the firmware.
1445+ */
1446+ if (priv->is_aspeed && !(phy_interface_mode_is_rgmii(phy_intf))) {
1447+ netdev_warn(netdev,
1448+ "Unsupported PHY mode %s !\n",
1449+ phy_modes(phy_intf));
1450+ }
1451+
1452+ phydev = phy_find_first(priv->mii_bus);
1453+ if (!phydev) {
1454+ netdev_info(netdev, "%s: no PHY found\n", netdev->name);
1455+ return -ENODEV;
1456+ }
1457+
1458+ phydev = phy_connect(netdev, phydev_name(phydev),
1459+ &ftgmac100_adjust_link, phy_intf);
1460+
1461+ if (IS_ERR(phydev)) {
1462+ netdev_err(netdev, "%s: Could not attach to PHY\n", netdev->name);
1463+ return PTR_ERR(phydev);
1464+ }
1465+
1466+ /* Indicate that we support PAUSE frames (see comment in
1467+ * Documentation/networking/phy.rst)
1468+ */
1469+ phy_support_asym_pause(phydev);
1470+
1471+ /* Display what we found */
1472+ phy_attached_info(phydev);
1473+
1474+ return 0;
1475+}
1476+
14621477 static int ftgmac100_open(struct net_device *netdev)
14631478 {
14641479 struct ftgmac100 *priv = netdev_priv(netdev);
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c+1−1
@@ -4338,7 +4338,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) · 4337 unmodified lines
43384338 }
43394339
43404340 INIT_WORK(&priv->tx_onestep_tstamp, dpaa2_eth_tx_onestep_tstamp);
4341−
4341+ mutex_init(&priv->onestep_tstamp_lock);
43424342 skb_queue_head_init(&priv->tx_skbs);
43434343
43444344 priv->rx_copybreak = DPAA2_ETH_DEFAULT_COPYBREAK;
drivers/net/ethernet/freescale/dpaa2/dpaa2-switch-flower.c+3−1
@@ -532,6 +532,7 @@ static int dpaa2_switch_flower_parse_mirror_key(struct flow_cls_offload *cls, · 531 unmodified lines
532532 struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
533533 struct flow_dissector *dissector = rule->match.dissector;
534534 struct netlink_ext_ack *extack = cls->common.extack;
535+ int ret = -EOPNOTSUPP;
535536
536537 if (dissector->used_keys &
537538 ~(BIT(FLOW_DISSECTOR_KEY_BASIC) |
@@ -561,9 +562,10 @@ static int dpaa2_switch_flower_parse_mirror_key(struct flow_cls_offload *cls, · 23 unmodified lines
561562 }
562563
563564 *vlan = (u16)match.key->vlan_id;
565+ ret = 0;
564566 }
565567
566− return 0;
568+ return ret;
567569 }
568570
569571 static int
drivers/net/ethernet/ibm/ibmvnic.c+5−1
@@ -5917,10 +5917,14 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr, · 5916 unmodified lines
59175917 be64_to_cpu(session_token));
59185918 rc = plpar_hcall_norets(H_VIOCTL, adapter->vdev->unit_address,
59195919 H_SESSION_ERR_DETECTED, session_token, 0, 0);
5920− if (rc)
5920+ if (rc) {
59215921 netdev_err(netdev,
59225922 "H_VIOCTL initiated failover failed, rc %ld\n",
59235923 rc);
5924+ goto last_resort;
5925+ }
5926+
5927+ return count;
59245928
59255929 last_resort:
59265930 netdev_dbg(netdev, "Trying to send CRQ_CMD, the last resort\n");
drivers/net/ethernet/intel/i40e/i40e_main.c+1−11
@@ -5372,15 +5372,7 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 5371 unmodified lines
53725372 /* There is no need to reset BW when mqprio mode is on. */
53735373 if (pf->flags & I40E_FLAG_TC_MQPRIO)
53745374 return 0;
5375−
5376− if (!vsi->mqprio_qopt.qopt.hw) {
5377− if (pf->flags & I40E_FLAG_DCB_ENABLED)
5378− goto skip_reset;
5379−
5380− if (IS_ENABLED(CONFIG_I40E_DCB) &&
5381− i40e_dcb_hw_get_num_tc(&pf->hw) == 1)
5382− goto skip_reset;
5383−
5375+ if (!vsi->mqprio_qopt.qopt.hw && !(pf->flags & I40E_FLAG_DCB_ENABLED)) {
53845376 ret = i40e_set_bw_limit(vsi, vsi->seid, 0);
53855377 if (ret)
53865378 dev_info(&pf->pdev->dev,
@@ -5388,8 +5380,6 @@ static int i40e_vsi_configure_bw_alloc(struct i40e_vsi *vsi, u8 enabled_tc, · 1 unmodified line
53885380 vsi->seid);
53895381 return ret;
53905382 }
5391−
5392−skip_reset:
53935383 memset(&bw_data, 0, sizeof(bw_data));
53945384 bw_data.tc_valid_bits = enabled_tc;
53955385 for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
drivers/net/ethernet/intel/ice/ice.h+0−1
@@ -280,7 +280,6 @@ enum ice_pf_state { · 279 unmodified lines
280280 ICE_VFLR_EVENT_PENDING,
281281 ICE_FLTR_OVERFLOW_PROMISC,
282282 ICE_VF_DIS,
283− ICE_VF_DEINIT_IN_PROGRESS,
284283 ICE_CFG_BUSY,
285284 ICE_SERVICE_SCHED,
286285 ICE_SERVICE_DIS,
drivers/net/ethernet/intel/ice/ice_common.c+1−1
@@ -3340,7 +3340,7 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg, · 3339 unmodified lines
33403340
33413341 if (fec == ICE_FEC_AUTO && ice_fw_supports_link_override(hw) &&
33423342 !ice_fw_supports_report_dflt_cfg(hw)) {
3343− struct ice_link_default_override_tlv tlv;
3343+ struct ice_link_default_override_tlv tlv = { 0 };
33443344
33453345 status = ice_get_link_default_override(&tlv, pi);
33463346 if (status)
drivers/net/ethernet/intel/ice/ice_eswitch.c+1−0
@@ -44,6 +44,7 @@ ice_eswitch_add_vf_mac_rule(struct ice_pf *pf, struct ice_vf *vf, const u8 *mac) · 43 unmodified lines
4444 ctrl_vsi->rxq_map[vf->vf_id];
4545 rule_info.flags_info.act |= ICE_SINGLE_ACT_LB_ENABLE;
4646 rule_info.flags_info.act_valid = true;
47+ rule_info.tun_type = ICE_SW_TUN_AND_NON_TUN;
4748
4849 err = ice_add_adv_rule(hw, list, lkups_cnt, &rule_info,
4950 vf->repr->mac_rule);
drivers/net/ethernet/intel/ice/ice_lib.c+6−0
@@ -1684,6 +1684,12 @@ static void ice_vsi_set_rss_flow_fld(struct ice_vsi *vsi) · 1683 unmodified lines
16841684 if (status)
16851685 dev_dbg(dev, "ice_add_rss_cfg failed for sctp6 flow, vsi = %d, error = %d\n",
16861686 vsi_num, status);
1687+
1688+ status = ice_add_rss_cfg(hw, vsi_handle, ICE_FLOW_HASH_ESP_SPI,
1689+ ICE_FLOW_SEG_HDR_ESP);
1690+ if (status)
1691+ dev_dbg(dev, "ice_add_rss_cfg failed for esp/spi flow, vsi = %d, error = %d\n",
1692+ vsi_num, status);
16871693 }
16881694
16891695 /**
drivers/net/ethernet/intel/ice/ice_main.c+2−0
@@ -1799,7 +1799,9 @@ static void ice_handle_mdd_event(struct ice_pf *pf) · 1798 unmodified lines
17991799 * reset, so print the event prior to reset.
18001800 */
18011801 ice_print_vf_rx_mdd_event(vf);
1802+ mutex_lock(&pf->vf[i].cfg_lock);
18021803 ice_reset_vf(&pf->vf[i], false);
1804+ mutex_unlock(&pf->vf[i].cfg_lock);
18031805 }
18041806 }
18051807 }
drivers/net/ethernet/intel/ice/ice_protocol_type.h+1−0
@@ -47,6 +47,7 @@ enum ice_protocol_type { · 46 unmodified lines
4747
4848 enum ice_sw_tunnel_type {
4949 ICE_NON_TUN = 0,
50+ ICE_SW_TUN_AND_NON_TUN,
5051 ICE_SW_TUN_VXLAN,
5152 ICE_SW_TUN_GENEVE,
5253 ICE_SW_TUN_NVGRE,
drivers/net/ethernet/intel/ice/ice_ptp.c+4−1
@@ -1533,9 +1533,12 @@ exit: · 1532 unmodified lines
15331533 static int ice_ptp_adjtime_nonatomic(struct ptp_clock_info *info, s64 delta)
15341534 {
15351535 struct timespec64 now, then;
1536+ int ret;
15361537
15371538 then = ns_to_timespec64(delta);
1538− ice_ptp_gettimex64(info, &now, NULL);
1539+ ret = ice_ptp_gettimex64(info, &now, NULL);
1540+ if (ret)
1541+ return ret;
15391542 now = timespec64_add(now, then);
15401543
15411544 return ice_ptp_settime64(info, (const struct timespec64 *)&now);
drivers/net/ethernet/intel/ice/ice_switch.c+3−1
@@ -4537,6 +4537,7 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, · 4536 unmodified lines
45374537 case ICE_SW_TUN_NVGRE:
45384538 prof_type = ICE_PROF_TUN_GRE;
45394539 break;
4540+ case ICE_SW_TUN_AND_NON_TUN:
45404541 default:
45414542 prof_type = ICE_PROF_ALL;
45424543 break;
@@ -5305,7 +5306,8 @@ ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, · 762 unmodified lines
53055306 if (status)
53065307 goto err_ice_add_adv_rule;
53075308
5308− if (rinfo->tun_type != ICE_NON_TUN) {
5309+ if (rinfo->tun_type != ICE_NON_TUN &&
5310+ rinfo->tun_type != ICE_SW_TUN_AND_NON_TUN) {
53095311 status = ice_fill_adv_packet_tun(hw, rinfo->tun_type,
53105312 s_rule->pdata.lkup_tx_rx.hdr,
53115313 pkt_offsets);
drivers/net/ethernet/intel/ice/ice_tc_lib.c+2−2
@@ -709,7 +709,7 @@ ice_tc_set_port(struct flow_match_ports match, · 708 unmodified lines
709709 fltr->flags |= ICE_TC_FLWR_FIELD_ENC_DEST_L4_PORT;
710710 else
711711 fltr->flags |= ICE_TC_FLWR_FIELD_DEST_L4_PORT;
712− fltr->flags |= ICE_TC_FLWR_FIELD_DEST_L4_PORT;
712+
713713 headers->l4_key.dst_port = match.key->dst;
714714 headers->l4_mask.dst_port = match.mask->dst;
715715 }
@@ -718,7 +718,7 @@ ice_tc_set_port(struct flow_match_ports match, · 2 unmodified lines
718718 fltr->flags |= ICE_TC_FLWR_FIELD_ENC_SRC_L4_PORT;
719719 else
720720 fltr->flags |= ICE_TC_FLWR_FIELD_SRC_L4_PORT;
721− fltr->flags |= ICE_TC_FLWR_FIELD_SRC_L4_PORT;
721+
722722 headers->l4_key.src_port = match.key->src;
723723 headers->l4_mask.src_port = match.mask->src;
724724 }
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+25−17
@@ -500,8 +500,6 @@ void ice_free_vfs(struct ice_pf *pf) · 499 unmodified lines
500500 struct ice_hw *hw = &pf->hw;
501501 unsigned int tmp, i;
502502
503− set_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state);
504−
505503 if (!pf->vf)
506504 return;
507505
@@ -519,22 +517,26 @@ void ice_free_vfs(struct ice_pf *pf) · 11 unmodified lines
519517 else
520518 dev_warn(dev, "VFs are assigned - not disabling SR-IOV\n");
521519
522− /* Avoid wait time by stopping all VFs at the same time */
523− ice_for_each_vf(pf, i)
524− ice_dis_vf_qs(&pf->vf[i]);
525−
526520 tmp = pf->num_alloc_vfs;
527521 pf->num_qps_per_vf = 0;
528522 pf->num_alloc_vfs = 0;
529523 for (i = 0; i < tmp; i++) {
530− if (test_bit(ICE_VF_STATE_INIT, pf->vf[i].vf_states)) {
524+ struct ice_vf *vf = &pf->vf[i];
525+
526+ mutex_lock(&vf->cfg_lock);
527+
528+ ice_dis_vf_qs(vf);
529+
530+ if (test_bit(ICE_VF_STATE_INIT, vf->vf_states)) {
531531 /* disable VF qp mappings and set VF disable state */
532− ice_dis_vf_mappings(&pf->vf[i]);
533− set_bit(ICE_VF_STATE_DIS, pf->vf[i].vf_states);
534− ice_free_vf_res(&pf->vf[i]);
532+ ice_dis_vf_mappings(vf);
533+ set_bit(ICE_VF_STATE_DIS, vf->vf_states);
534+ ice_free_vf_res(vf);
535535 }
536536
537− mutex_destroy(&pf->vf[i].cfg_lock);
537+ mutex_unlock(&vf->cfg_lock);
538+
539+ mutex_destroy(&vf->cfg_lock);
538540 }
539541
540542 if (ice_sriov_free_msix_res(pf))
@@ -570,7 +572,6 @@ void ice_free_vfs(struct ice_pf *pf) · 29 unmodified lines
570572 i);
571573
572574 clear_bit(ICE_VF_DIS, pf->state);
573− clear_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state);
574575 clear_bit(ICE_FLAG_SRIOV_ENA, pf->flags);
575576 }
576577
@@ -1498,6 +1499,8 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr) · 921 unmodified lines
14981499 ice_for_each_vf(pf, v) {
14991500 vf = &pf->vf[v];
15001501
1502+ mutex_lock(&vf->cfg_lock);
1503+
15011504 vf->driver_caps = 0;
15021505 ice_vc_set_default_allowlist(vf);
15031506
@@ -1512,6 +1515,8 @@ bool ice_reset_all_vfs(struct ice_pf *pf, bool is_vflr) · 8 unmodified lines
15121515 ice_vf_pre_vsi_rebuild(vf);
15131516 ice_vf_rebuild_vsi(vf);
15141517 ice_vf_post_vsi_rebuild(vf);
1518+
1519+ mutex_unlock(&vf->cfg_lock);
15151520 }
15161521
15171522 if (ice_is_eswitch_mode_switchdev(pf))
@@ -1562,6 +1567,8 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) · 44 unmodified lines
15621567 u32 reg;
15631568 int i;
15641569
1570+ lockdep_assert_held(&vf->cfg_lock);
1571+
15651572 dev = ice_pf_to_dev(pf);
15661573
15671574 if (test_bit(ICE_VF_RESETS_DISABLED, pf->state)) {
@@ -2061,9 +2068,12 @@ void ice_process_vflr_event(struct ice_pf *pf) · 493 unmodified lines
20612068 bit_idx = (hw->func_caps.vf_base_id + vf_id) % 32;
20622069 /* read GLGEN_VFLRSTAT register to find out the flr VFs */
20632070 reg = rd32(hw, GLGEN_VFLRSTAT(reg_idx));
2064− if (reg & BIT(bit_idx))
2071+ if (reg & BIT(bit_idx)) {
20652072 /* GLGEN_VFLRSTAT bit will be cleared in ice_reset_vf */
2073+ mutex_lock(&vf->cfg_lock);
20662074 ice_reset_vf(vf, true);
2075+ mutex_unlock(&vf->cfg_lock);
2076+ }
20672077 }
20682078 }
20692079
@@ -2140,7 +2150,9 @@ ice_vf_lan_overflow_event(struct ice_pf *pf, struct ice_rq_event_info *event) · 70 unmodified lines
21402150 if (!vf)
21412151 return;
21422152
2153+ mutex_lock(&vf->cfg_lock);
21432154 ice_vc_reset_vf(vf);
2155+ mutex_unlock(&vf->cfg_lock);
21442156 }
21452157
21462158 /**
@@ -4625,10 +4637,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct ice_rq_event_info *event) · 2478 unmodified lines
46254637 struct device *dev;
46264638 int err = 0;
46274639
4628− /* if de-init is underway, don't process messages from VF */
4629− if (test_bit(ICE_VF_DEINIT_IN_PROGRESS, pf->state))
4630− return;
4631−
46324640 dev = ice_pf_to_dev(pf);
46334641 if (ice_validate_vf_id(pf, vf_id)) {
46344642 err = -EINVAL;
drivers/net/ethernet/marvell/mv643xx_eth.c+14−10
@@ -2704,6 +2704,16 @@ MODULE_DEVICE_TABLE(of, mv643xx_eth_shared_ids); · 2703 unmodified lines
27042704
27052705 static struct platform_device *port_platdev[3];
27062706
2707+static void mv643xx_eth_shared_of_remove(void)
2708+{
2709+ int n;
2710+
2711+ for (n = 0; n < 3; n++) {
2712+ platform_device_del(port_platdev[n]);
2713+ port_platdev[n] = NULL;
2714+ }
2715+}
2716+
27072717 static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
27082718 struct device_node *pnp)
27092719 {
@@ -2740,7 +2750,9 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, · 30 unmodified lines
27402750 return -EINVAL;
27412751 }
27422752
2743− of_get_mac_address(pnp, ppd.mac_addr);
2753+ ret = of_get_mac_address(pnp, ppd.mac_addr);
2754+ if (ret)
2755+ return ret;
27442756
27452757 mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
27462758 mv643xx_eth_property(pnp, "tx-sram-addr", ppd.tx_sram_addr);
@@ -2804,21 +2816,13 @@ static int mv643xx_eth_shared_of_probe(struct platform_device *pdev) · 57 unmodified lines
28042816 ret = mv643xx_eth_shared_of_add_port(pdev, pnp);
28052817 if (ret) {
28062818 of_node_put(pnp);
2819+ mv643xx_eth_shared_of_remove();
28072820 return ret;
28082821 }
28092822 }
28102823 return 0;
28112824 }
28122825
2813−static void mv643xx_eth_shared_of_remove(void)
2814−{
2815− int n;
2816−
2817− for (n = 0; n < 3; n++) {
2818− platform_device_del(port_platdev[n]);
2819− port_platdev[n] = NULL;
2820− }
2821−}
28222826 #else
28232827 static inline int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
28242828 {
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+3−3
@@ -6870,6 +6870,9 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 6869 unmodified lines
68706870 dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
68716871 dev->dev.of_node = port_node;
68726872
6873+ port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
6874+ port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
6875+
68736876 if (!mvpp2_use_acpi_compat_mode(port_fwnode)) {
68746877 port->phylink_config.dev = &dev->dev;
68756878 port->phylink_config.type = PHYLINK_NETDEV;
@@ -6940,9 +6943,6 @@ static int mvpp2_port_probe(struct platform_device *pdev, · 64 unmodified lines
69406943 port->phylink_config.supported_interfaces);
69416944 }
69426945
6943− port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
6944− port->pcs_xlg.ops = &mvpp2_phylink_xlg_pcs_ops;
6945−
69466946 phylink = phylink_create(&port->phylink_config, port_fwnode,
69476947 phy_mode, &mvpp2_phylink_ops);
69486948 if (IS_ERR(phylink)) {
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/act.h+2−0
@@ -16,11 +16,13 @@ struct mlx5e_tc_act_parse_state { · 15 unmodified lines
1616 unsigned int num_actions;
1717 struct mlx5e_tc_flow *flow;
1818 struct netlink_ext_ack *extack;
19+ bool ct_clear;
1920 bool encap;
2021 bool decap;
2122 bool mpls_push;
2223 bool ptype_host;
2324 const struct ip_tunnel_info *tun_info;
25+ struct mlx5e_mpls_info mpls_info;
2426 struct pedit_headers_action hdrs[__PEDIT_CMD_MAX];
2527 int ifindexes[MLX5_MAX_FLOW_FWD_VPORTS];
2628 int if_count;
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/ct.c+7−0
@@ -27,8 +27,13 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state, · 26 unmodified lines
2727 struct mlx5e_priv *priv,
2828 struct mlx5_flow_attr *attr)
2929 {
30+ bool clear_action = act->ct.action & TCA_CT_ACT_CLEAR;
3031 int err;
3132
33+ /* It's redundant to do ct clear more than once. */
34+ if (clear_action && parse_state->ct_clear)
35+ return 0;
36+
3237 err = mlx5_tc_ct_parse_action(parse_state->ct_priv, attr,
3338 &attr->parse_attr->mod_hdr_acts,
3439 act, parse_state->extack);
@@ -40,6 +45,8 @@ tc_act_parse_ct(struct mlx5e_tc_act_parse_state *parse_state, · 5 unmodified lines
4045 if (mlx5e_is_eswitch_flow(parse_state->flow))
4146 attr->esw_attr->split_count = attr->esw_attr->out_count;
4247
48+ parse_state->ct_clear = clear_action;
49+
4350 return 0;
4451 }
4552
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c+6−0
@@ -177,6 +177,12 @@ parse_mirred_encap(struct mlx5e_tc_act_parse_state *parse_state, · 176 unmodified lines
177177 return -ENOMEM;
178178
179179 parse_state->encap = false;
180+
181+ if (parse_state->mpls_push) {
182+ memcpy(&parse_attr->mpls_info[esw_attr->out_count],
183+ &parse_state->mpls_info, sizeof(parse_state->mpls_info));
184+ parse_state->mpls_push = false;
185+ }
180186 esw_attr->dests[esw_attr->out_count].flags |= MLX5_ESW_DEST_ENCAP;
181187 esw_attr->out_count++;
182188 /* attr->dests[].rep is resolved when we handle encap */
drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mpls.c+11−0
@@ -22,6 +22,16 @@ tc_act_can_offload_mpls_push(struct mlx5e_tc_act_parse_state *parse_state, · 21 unmodified lines
2222 return true;
2323 }
2424
25+static void
26+copy_mpls_info(struct mlx5e_mpls_info *mpls_info,
27+ const struct flow_action_entry *act)
28+{
29+ mpls_info->label = act->mpls_push.label;
30+ mpls_info->tc = act->mpls_push.tc;
31+ mpls_info->bos = act->mpls_push.bos;
32+ mpls_info->ttl = act->mpls_push.ttl;
33+}
34+
2535 static int
2636 tc_act_parse_mpls_push(struct mlx5e_tc_act_parse_state *parse_state,
2737 const struct flow_action_entry *act,
@@ -29,6 +39,7 @@ tc_act_parse_mpls_push(struct mlx5e_tc_act_parse_state *parse_state, · 1 unmodified line
2939 struct mlx5_flow_attr *attr)
3040 {
3141 parse_state->mpls_push = true;
42+ copy_mpls_info(&parse_state->mpls_info, act);
3243
3344 return 0;
3445 }
drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h+1−0
@@ -35,6 +35,7 @@ enum { · 34 unmodified lines
3535
3636 struct mlx5e_tc_flow_parse_attr {
3737 const struct ip_tunnel_info *tun_info[MLX5_MAX_FLOW_FWD_VPORTS];
38+ struct mlx5e_mpls_info mpls_info[MLX5_MAX_FLOW_FWD_VPORTS];
3839 struct net_device *filter_dev;
3940 struct mlx5_flow_spec spec;
4041 struct mlx5e_tc_mod_hdr_acts mod_hdr_acts;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c+3−0
@@ -750,6 +750,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv, · 749 unmodified lines
750750 struct mlx5e_tc_flow_parse_attr *parse_attr;
751751 struct mlx5_flow_attr *attr = flow->attr;
752752 const struct ip_tunnel_info *tun_info;
753+ const struct mlx5e_mpls_info *mpls_info;
753754 unsigned long tbl_time_before = 0;
754755 struct mlx5e_encap_entry *e;
755756 struct mlx5e_encap_key key;
@@ -760,6 +761,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv, · 4 unmodified lines
760761
761762 parse_attr = attr->parse_attr;
762763 tun_info = parse_attr->tun_info[out_index];
764+ mpls_info = &parse_attr->mpls_info[out_index];
763765 family = ip_tunnel_info_af(tun_info);
764766 key.ip_tun_key = &tun_info->key;
765767 key.tc_tunnel = mlx5e_get_tc_tun(mirred_dev);
@@ -810,6 +812,7 @@ int mlx5e_attach_encap(struct mlx5e_priv *priv, · 44 unmodified lines
810812 goto out_err_init;
811813 }
812814 e->tun_info = tun_info;
815+ memcpy(&e->mpls_info, mpls_info, sizeof(*mpls_info));
813816 err = mlx5e_tc_tun_init_encap_attr(mirred_dev, priv, e, extack);
814817 if (err)
815818 goto out_err_init;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_mplsoudp.c+13−20
@@ -30,16 +30,15 @@ static int generate_ip_tun_hdr(char buf[], · 29 unmodified lines
3030 struct mlx5e_encap_entry *r)
3131 {
3232 const struct ip_tunnel_key *tun_key = &r->tun_info->key;
33+ const struct mlx5e_mpls_info *mpls_info = &r->mpls_info;
3334 struct udphdr *udp = (struct udphdr *)(buf);
3435 struct mpls_shim_hdr *mpls;
35− u32 tun_id;
3636
37− tun_id = be32_to_cpu(tunnel_id_to_key32(tun_key->tun_id));
3837 mpls = (struct mpls_shim_hdr *)(udp + 1);
3938 *ip_proto = IPPROTO_UDP;
4039
4140 udp->dest = tun_key->tp_dst;
42− *mpls = mpls_entry_encode(tun_id, tun_key->ttl, tun_key->tos, true);
41+ *mpls = mpls_entry_encode(mpls_info->label, mpls_info->ttl, mpls_info->tc, mpls_info->bos);
4342
4443 return 0;
4544 }
@@ -60,37 +59,31 @@ static int parse_tunnel(struct mlx5e_priv *priv, · 14 unmodified lines
6059 void *headers_v)
6160 {
6261 struct flow_rule *rule = flow_cls_offload_flow_rule(f);
63− struct flow_match_enc_keyid enc_keyid;
6462 struct flow_match_mpls match;
6563 void *misc2_c;
6664 void *misc2_v;
6765
68− misc2_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria,
69− misc_parameters_2);
70− misc2_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
71− misc_parameters_2);
72−
73− if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS))
74− return 0;
75−
76− if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID))
77− return 0;
78−
79− flow_rule_match_enc_keyid(rule, &enc_keyid);
80−
81− if (!enc_keyid.mask->keyid)
82− return 0;
83−
8466 if (!MLX5_CAP_ETH(priv->mdev, tunnel_stateless_mpls_over_udp) &&
8567 !(MLX5_CAP_GEN(priv->mdev, flex_parser_protocols) & MLX5_FLEX_PROTO_CW_MPLS_UDP))
8668 return -EOPNOTSUPP;
8769
70+ if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID))
71+ return -EOPNOTSUPP;
72+
73+ if (!flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_MPLS))
74+ return 0;
75+
8876 flow_rule_match_mpls(rule, &match);
8977
9078 /* Only support matching the first LSE */
9179 if (match.mask->used_lses != 1)
9280 return -EOPNOTSUPP;
9381
82+ misc2_c = MLX5_ADDR_OF(fte_match_param, spec->match_criteria,
83+ misc_parameters_2);
84+ misc2_v = MLX5_ADDR_OF(fte_match_param, spec->match_value,
85+ misc_parameters_2);
86+
9487 MLX5_SET(fte_match_set_misc2, misc2_c,
9588 outer_first_mpls_over_udp.mpls_label,
9689 match.mask->ls[0].mpls_label);
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+1−1
@@ -1792,7 +1792,7 @@ static int mlx5e_get_module_eeprom(struct net_device *netdev, · 1791 unmodified lines
17921792 if (size_read < 0) {
17931793 netdev_err(priv->netdev, "%s: mlx5_query_eeprom failed:0x%x\n",
17941794 __func__, size_read);
1795− return 0;
1795+ return size_read;
17961796 }
17971797
17981798 i += size_read;
drivers/net/ethernet/mellanox/mlx5/core/en_rep.h+8−0
@@ -183,6 +183,13 @@ struct mlx5e_decap_entry { · 182 unmodified lines
183183 struct rcu_head rcu;
184184 };
185185
186+struct mlx5e_mpls_info {
187+ u32 label;
188+ u8 tc;
189+ u8 bos;
190+ u8 ttl;
191+};
192+
186193 struct mlx5e_encap_entry {
187194 /* attached neigh hash entry */
188195 struct mlx5e_neigh_hash_entry *nhe;
@@ -196,6 +203,7 @@ struct mlx5e_encap_entry { · 7 unmodified lines
196203 struct list_head route_list;
197204 struct mlx5_pkt_reformat *pkt_reformat;
198205 const struct ip_tunnel_info *tun_info;
206+ struct mlx5e_mpls_info mpls_info;
199207 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
200208
201209 struct net_device *out_dev;
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+2−1
@@ -1349,7 +1349,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, · 1348 unmodified lines
13491349 }
13501350
13511351 /* True when explicitly set via priv flag, or XDP prog is loaded */
1352− if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state))
1352+ if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state) ||
1353+ get_cqe_tls_offload(cqe))
13531354 goto csum_unnecessary;
13541355
13551356 /* CQE csum doesn't cover padding octets in short ethernet
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c+1−0
@@ -334,6 +334,7 @@ void mlx5e_self_test(struct net_device *ndev, struct ethtool_test *etest, · 333 unmodified lines
334334 netdev_info(ndev, "\t[%d] %s start..\n", i, st.name);
335335 buf[count] = st.st_func(priv);
336336 netdev_info(ndev, "\t[%d] %s end: result(%lld)\n", i, st.name, buf[count]);
337+ count++;
337338 }
338339
339340 mutex_unlock(&priv->state_lock);
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c+3−3
@@ -1254,9 +1254,6 @@ static void fec_set_corrected_bits_total(struct mlx5e_priv *priv, · 1253 unmodified lines
12541254 u32 in[MLX5_ST_SZ_DW(ppcnt_reg)] = {};
12551255 int sz = MLX5_ST_SZ_BYTES(ppcnt_reg);
12561256
1257− if (!MLX5_CAP_PCAM_FEATURE(mdev, ppcnt_statistical_group))
1258− return;
1259−
12601257 MLX5_SET(ppcnt_reg, in, local_port, 1);
12611258 MLX5_SET(ppcnt_reg, in, grp, MLX5_PHYSICAL_LAYER_STATISTICAL_GROUP);
12621259 if (mlx5_core_access_reg(mdev, in, sz, ppcnt_phy_statistical,
@@ -1272,6 +1269,9 @@ static void fec_set_corrected_bits_total(struct mlx5e_priv *priv, · 9 unmodified lines
12721269 void mlx5e_stats_fec_get(struct mlx5e_priv *priv,
12731270 struct ethtool_fec_stats *fec_stats)
12741271 {
1272+ if (!MLX5_CAP_PCAM_FEATURE(priv->mdev, ppcnt_statistical_group))
1273+ return;
1274+
12751275 fec_set_corrected_bits_total(priv, fec_stats);
12761276 fec_set_block_stats(priv, fec_stats);
12771277 }
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+12−0
@@ -3204,6 +3204,18 @@ actions_match_supported(struct mlx5e_priv *priv, · 3203 unmodified lines
32043204 return false;
32053205 }
32063206
3207+ if (!(~actions &
3208+ (MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | MLX5_FLOW_CONTEXT_ACTION_DROP))) {
3209+ NL_SET_ERR_MSG_MOD(extack, "Rule cannot support forward+drop action");
3210+ return false;
3211+ }
3212+
3213+ if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
3214+ actions & MLX5_FLOW_CONTEXT_ACTION_DROP) {
3215+ NL_SET_ERR_MSG_MOD(extack, "Drop with modify header action is not supported");
3216+ return false;
3217+ }
3218+
32073219 if (actions & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR &&
32083220 !modify_header_match_supported(priv, &parse_attr->spec, flow_action,
32093221 actions, ct_flow, ct_clear, extack))
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c+1−1
@@ -697,7 +697,7 @@ void mlx5_esw_qos_vport_disable(struct mlx5_eswitch *esw, struct mlx5_vport *vpo · 696 unmodified lines
697697 }
698698
699699 int mlx5_esw_qos_set_vport_rate(struct mlx5_eswitch *esw, struct mlx5_vport *vport,
700− u32 min_rate, u32 max_rate)
700+ u32 max_rate, u32 min_rate)
701701 {
702702 int err;
703703
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+0−4
@@ -2838,10 +2838,6 @@ bool mlx5_esw_vport_match_metadata_supported(const struct mlx5_eswitch *esw) · 2837 unmodified lines
28382838 if (!MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source))
28392839 return false;
28402840
2841− if (mlx5_core_is_ecpf_esw_manager(esw->dev) ||
2842− mlx5_ecpf_vport_exists(esw->dev))
2843− return false;
2844−
28452841 return true;
28462842 }
28472843
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+2−0
@@ -2074,6 +2074,8 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 2073 unmodified lines
20742074 fte->node.del_hw_func = NULL;
20752075 up_write_ref_node(&fte->node, false);
20762076 tree_put_node(&fte->node, false);
2077+ } else {
2078+ up_write_ref_node(&fte->node, false);
20772079 }
20782080 kfree(handle);
20792081 }
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c+3−0
@@ -121,6 +121,9 @@ u32 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains) · 120 unmodified lines
121121
122122 u32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains)
123123 {
124+ if (!mlx5_chains_prios_supported(chains))
125+ return 1;
126+
124127 if (mlx5_chains_ignore_flow_level_supported(chains))
125128 return UINT_MAX;
126129
drivers/net/ethernet/mellanox/mlx5/core/main.c+3−1
@@ -526,7 +526,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) · 525 unmodified lines
526526
527527 /* Check log_max_qp from HCA caps to set in current profile */
528528 if (prof->log_max_qp == LOG_MAX_SUPPORTED_QPS) {
529− prof->log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
529+ prof->log_max_qp = min_t(u8, 17, MLX5_CAP_GEN_MAX(dev, log_max_qp));
530530 } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) {
531531 mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
532532 prof->log_max_qp,
@@ -1840,10 +1840,12 @@ static const struct pci_device_id mlx5_core_pci_table[] = { · 1307 unmodified lines
18401840 { PCI_VDEVICE(MELLANOX, 0x101e), MLX5_PCI_DEV_IS_VF}, /* ConnectX Family mlx5Gen Virtual Function */
18411841 { PCI_VDEVICE(MELLANOX, 0x101f) }, /* ConnectX-6 LX */
18421842 { PCI_VDEVICE(MELLANOX, 0x1021) }, /* ConnectX-7 */
1843+ { PCI_VDEVICE(MELLANOX, 0x1023) }, /* ConnectX-8 */
18431844 { PCI_VDEVICE(MELLANOX, 0xa2d2) }, /* BlueField integrated ConnectX-5 network controller */
18441845 { PCI_VDEVICE(MELLANOX, 0xa2d3), MLX5_PCI_DEV_IS_VF}, /* BlueField integrated ConnectX-5 network controller VF */
18451846 { PCI_VDEVICE(MELLANOX, 0xa2d6) }, /* BlueField-2 integrated ConnectX-6 Dx network controller */
18461847 { PCI_VDEVICE(MELLANOX, 0xa2dc) }, /* BlueField-3 integrated ConnectX-7 network controller */
1848+ { PCI_VDEVICE(MELLANOX, 0xa2df) }, /* BlueField-4 integrated ConnectX-8 network controller */
18471849 { 0, }
18481850 };
18491851
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_icm_pool.c+81−39
@@ -4,7 +4,6 @@ · 3 unmodified lines
44 #include "dr_types.h"
55
66 #define DR_ICM_MODIFY_HDR_ALIGN_BASE 64
7−#define DR_ICM_SYNC_THRESHOLD_POOL (64 * 1024 * 1024)
87
98 struct mlx5dr_icm_pool {
109 enum mlx5dr_icm_type icm_type;
@@ -136,37 +135,35 @@ static void dr_icm_pool_mr_destroy(struct mlx5dr_icm_mr *icm_mr) · 125 unmodified lines
136135 kvfree(icm_mr);
137136 }
138137
139−static int dr_icm_chunk_ste_init(struct mlx5dr_icm_chunk *chunk)
138+static int dr_icm_buddy_get_ste_size(struct mlx5dr_icm_buddy_mem *buddy)
140139 {
141− chunk->ste_arr = kvzalloc(chunk->num_of_entries *
142− sizeof(chunk->ste_arr[0]), GFP_KERNEL);
143− if (!chunk->ste_arr)
144− return -ENOMEM;
145−
146− chunk->hw_ste_arr = kvzalloc(chunk->num_of_entries *
147− DR_STE_SIZE_REDUCED, GFP_KERNEL);
148− if (!chunk->hw_ste_arr)
149− goto out_free_ste_arr;
150−
151− chunk->miss_list = kvmalloc(chunk->num_of_entries *
152− sizeof(chunk->miss_list[0]), GFP_KERNEL);
153− if (!chunk->miss_list)
154− goto out_free_hw_ste_arr;
140+ /* We support only one type of STE size, both for ConnectX-5 and later
141+ * devices. Once the support for match STE which has a larger tag is
142+ * added (32B instead of 16B), the STE size for devices later than
143+ * ConnectX-5 needs to account for that.
144+ */
145+ return DR_STE_SIZE_REDUCED;
146+}
155147
156− return 0;
148+static void dr_icm_chunk_ste_init(struct mlx5dr_icm_chunk *chunk, int offset)
149+{
150+ struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem;
151+ int index = offset / DR_STE_SIZE;
157152
158−out_free_hw_ste_arr:
159− kvfree(chunk->hw_ste_arr);
160−out_free_ste_arr:
161− kvfree(chunk->ste_arr);
162− return -ENOMEM;
153+ chunk->ste_arr = &buddy->ste_arr[index];
154+ chunk->miss_list = &buddy->miss_list[index];
155+ chunk->hw_ste_arr = buddy->hw_ste_arr +
156+ index * dr_icm_buddy_get_ste_size(buddy);
163157 }
164158
165159 static void dr_icm_chunk_ste_cleanup(struct mlx5dr_icm_chunk *chunk)
166160 {
167− kvfree(chunk->miss_list);
168− kvfree(chunk->hw_ste_arr);
169− kvfree(chunk->ste_arr);
161+ struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem;
162+
163+ memset(chunk->hw_ste_arr, 0,
164+ chunk->num_of_entries * dr_icm_buddy_get_ste_size(buddy));
165+ memset(chunk->ste_arr, 0,
166+ chunk->num_of_entries * sizeof(chunk->ste_arr[0]));
170167 }
171168
172169 static enum mlx5dr_icm_type
@@ -189,6 +186,44 @@ static void dr_icm_chunk_destroy(struct mlx5dr_icm_chunk *chunk, · 16 unmodified lines
189186 kvfree(chunk);
190187 }
191188
189+static int dr_icm_buddy_init_ste_cache(struct mlx5dr_icm_buddy_mem *buddy)
190+{
191+ int num_of_entries =
192+ mlx5dr_icm_pool_chunk_size_to_entries(buddy->pool->max_log_chunk_sz);
193+
194+ buddy->ste_arr = kvcalloc(num_of_entries,
195+ sizeof(struct mlx5dr_ste), GFP_KERNEL);
196+ if (!buddy->ste_arr)
197+ return -ENOMEM;
198+
199+ /* Preallocate full STE size on non-ConnectX-5 devices since
200+ * we need to support both full and reduced with the same cache.
201+ */
202+ buddy->hw_ste_arr = kvcalloc(num_of_entries,
203+ dr_icm_buddy_get_ste_size(buddy), GFP_KERNEL);
204+ if (!buddy->hw_ste_arr)
205+ goto free_ste_arr;
206+
207+ buddy->miss_list = kvmalloc(num_of_entries * sizeof(struct list_head), GFP_KERNEL);
208+ if (!buddy->miss_list)
209+ goto free_hw_ste_arr;
210+
211+ return 0;
212+
213+free_hw_ste_arr:
214+ kvfree(buddy->hw_ste_arr);
215+free_ste_arr:
216+ kvfree(buddy->ste_arr);
217+ return -ENOMEM;
218+}
219+
220+static void dr_icm_buddy_cleanup_ste_cache(struct mlx5dr_icm_buddy_mem *buddy)
221+{
222+ kvfree(buddy->ste_arr);
223+ kvfree(buddy->hw_ste_arr);
224+ kvfree(buddy->miss_list);
225+}
226+
192227 static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool)
193228 {
194229 struct mlx5dr_icm_buddy_mem *buddy;
@@ -208,11 +243,19 @@ static int dr_icm_buddy_create(struct mlx5dr_icm_pool *pool) · 13 unmodified lines
208243 buddy->icm_mr = icm_mr;
209244 buddy->pool = pool;
210245
246+ if (pool->icm_type == DR_ICM_TYPE_STE) {
247+ /* Reduce allocations by preallocating and reusing the STE structures */
248+ if (dr_icm_buddy_init_ste_cache(buddy))
249+ goto err_cleanup_buddy;
250+ }
251+
211252 /* add it to the -start- of the list in order to search in it first */
212253 list_add(&buddy->list_node, &pool->buddy_mem_list);
213254
214255 return 0;
215256
257+err_cleanup_buddy:
258+ mlx5dr_buddy_cleanup(buddy);
216259 err_free_buddy:
217260 kvfree(buddy);
218261 free_mr:
@@ -234,6 +277,9 @@ static void dr_icm_buddy_destroy(struct mlx5dr_icm_buddy_mem *buddy) · 15 unmodified lines
234277
235278 mlx5dr_buddy_cleanup(buddy);
236279
280+ if (buddy->pool->icm_type == DR_ICM_TYPE_STE)
281+ dr_icm_buddy_cleanup_ste_cache(buddy);
282+
237283 kvfree(buddy);
238284 }
239285
@@ -261,34 +307,30 @@ dr_icm_chunk_create(struct mlx5dr_icm_pool *pool, · 21 unmodified lines
261307 chunk->byte_size =
262308 mlx5dr_icm_pool_chunk_size_to_byte(chunk_size, pool->icm_type);
263309 chunk->seg = seg;
310+ chunk->buddy_mem = buddy_mem_pool;
264311
265− if (pool->icm_type == DR_ICM_TYPE_STE && dr_icm_chunk_ste_init(chunk)) {
266− mlx5dr_err(pool->dmn,
267− "Failed to init ste arrays (order: %d)\n",
268− chunk_size);
269− goto out_free_chunk;
270− }
312+ if (pool->icm_type == DR_ICM_TYPE_STE)
313+ dr_icm_chunk_ste_init(chunk, offset);
271314
272315 buddy_mem_pool->used_memory += chunk->byte_size;
273− chunk->buddy_mem = buddy_mem_pool;
274316 INIT_LIST_HEAD(&chunk->chunk_list);
275317
276318 /* chunk now is part of the used_list */
277319 list_add_tail(&chunk->chunk_list, &buddy_mem_pool->used_list);
278320
279321 return chunk;
280−
281−out_free_chunk:
282− kvfree(chunk);
283− return NULL;
284322 }
285323
286324 static bool dr_icm_pool_is_sync_required(struct mlx5dr_icm_pool *pool)
287325 {
288− if (pool->hot_memory_size > DR_ICM_SYNC_THRESHOLD_POOL)
289− return true;
326+ int allow_hot_size;
327+
328+ /* sync when hot memory reaches half of the pool size */
329+ allow_hot_size =
330+ mlx5dr_icm_pool_chunk_size_to_byte(pool->max_log_chunk_sz,
331+ pool->icm_type) / 2;
290332
291− return false;
333+ return pool->hot_memory_size > allow_hot_size;
292334 }
293335
294336 static int dr_icm_pool_sync_all_buddy_pools(struct mlx5dr_icm_pool *pool)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c+4−16
@@ -13,18 +13,6 @@ static bool dr_mask_is_dmac_set(struct mlx5dr_match_spec *spec) · 12 unmodified lines
1313 return (spec->dmac_47_16 || spec->dmac_15_0);
1414 }
1515
16−static bool dr_mask_is_src_addr_set(struct mlx5dr_match_spec *spec)
17−{
18− return (spec->src_ip_127_96 || spec->src_ip_95_64 ||
19− spec->src_ip_63_32 || spec->src_ip_31_0);
20−}
21−
22−static bool dr_mask_is_dst_addr_set(struct mlx5dr_match_spec *spec)
23−{
24− return (spec->dst_ip_127_96 || spec->dst_ip_95_64 ||
25− spec->dst_ip_63_32 || spec->dst_ip_31_0);
26−}
27−
2816 static bool dr_mask_is_l3_base_set(struct mlx5dr_match_spec *spec)
2917 {
3018 return (spec->ip_protocol || spec->frag || spec->tcp_flags ||
@@ -503,11 +491,11 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, · 472 unmodified lines
503491 &mask, inner, rx);
504492
505493 if (outer_ipv == DR_RULE_IPV6) {
506− if (dr_mask_is_dst_addr_set(&mask.outer))
494+ if (DR_MASK_IS_DST_IP_SET(&mask.outer))
507495 mlx5dr_ste_build_eth_l3_ipv6_dst(ste_ctx, &sb[idx++],
508496 &mask, inner, rx);
509497
510− if (dr_mask_is_src_addr_set(&mask.outer))
498+ if (DR_MASK_IS_SRC_IP_SET(&mask.outer))
511499 mlx5dr_ste_build_eth_l3_ipv6_src(ste_ctx, &sb[idx++],
512500 &mask, inner, rx);
513501
@@ -610,11 +598,11 @@ static int dr_matcher_set_ste_builders(struct mlx5dr_matcher *matcher, · 96 unmodified lines
610598 &mask, inner, rx);
611599
612600 if (inner_ipv == DR_RULE_IPV6) {
613− if (dr_mask_is_dst_addr_set(&mask.inner))
601+ if (DR_MASK_IS_DST_IP_SET(&mask.inner))
614602 mlx5dr_ste_build_eth_l3_ipv6_dst(ste_ctx, &sb[idx++],
615603 &mask, inner, rx);
616604
617− if (dr_mask_is_src_addr_set(&mask.inner))
605+ if (DR_MASK_IS_SRC_IP_SET(&mask.inner))
618606 mlx5dr_ste_build_eth_l3_ipv6_src(ste_ctx, &sb[idx++],
619607 &mask, inner, rx);
620608
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste.c+31−1
@@ -602,12 +602,34 @@ int mlx5dr_ste_set_action_decap_l3_list(struct mlx5dr_ste_ctx *ste_ctx, · 601 unmodified lines
602602 used_hw_action_num);
603603 }
604604
605+static int dr_ste_build_pre_check_spec(struct mlx5dr_domain *dmn,
606+ struct mlx5dr_match_spec *spec)
607+{
608+ if (spec->ip_version) {
609+ if (spec->ip_version != 0xf) {
610+ mlx5dr_err(dmn,
611+ "Partial ip_version mask with src/dst IP is not supported\n");
612+ return -EINVAL;
613+ }
614+ } else if (spec->ethertype != 0xffff &&
615+ (DR_MASK_IS_SRC_IP_SET(spec) || DR_MASK_IS_DST_IP_SET(spec))) {
616+ mlx5dr_err(dmn,
617+ "Partial/no ethertype mask with src/dst IP is not supported\n");
618+ return -EINVAL;
619+ }
620+
621+ return 0;
622+}
623+
605624 int mlx5dr_ste_build_pre_check(struct mlx5dr_domain *dmn,
606625 u8 match_criteria,
607626 struct mlx5dr_match_param *mask,
608627 struct mlx5dr_match_param *value)
609628 {
610− if (!value && (match_criteria & DR_MATCHER_CRITERIA_MISC)) {
629+ if (value)
630+ return 0;
631+
632+ if (match_criteria & DR_MATCHER_CRITERIA_MISC) {
611633 if (mask->misc.source_port && mask->misc.source_port != 0xffff) {
612634 mlx5dr_err(dmn,
613635 "Partial mask source_port is not supported\n");
@@ -621,6 +643,14 @@ int mlx5dr_ste_build_pre_check(struct mlx5dr_domain *dmn, · 7 unmodified lines
621643 }
622644 }
623645
646+ if ((match_criteria & DR_MATCHER_CRITERIA_OUTER) &&
647+ dr_ste_build_pre_check_spec(dmn, &mask->outer))
648+ return -EINVAL;
649+
650+ if ((match_criteria & DR_MATCHER_CRITERIA_INNER) &&
651+ dr_ste_build_pre_check_spec(dmn, &mask->inner))
652+ return -EINVAL;
653+
624654 return 0;
625655 }
626656
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h+10−0
@@ -798,6 +798,16 @@ struct mlx5dr_match_param { · 797 unmodified lines
798798 (_misc3)->icmpv4_code || \
799799 (_misc3)->icmpv4_header_data)
800800
801+#define DR_MASK_IS_SRC_IP_SET(_spec) ((_spec)->src_ip_127_96 || \
802+ (_spec)->src_ip_95_64 || \
803+ (_spec)->src_ip_63_32 || \
804+ (_spec)->src_ip_31_0)
805+
806+#define DR_MASK_IS_DST_IP_SET(_spec) ((_spec)->dst_ip_127_96 || \
807+ (_spec)->dst_ip_95_64 || \
808+ (_spec)->dst_ip_63_32 || \
809+ (_spec)->dst_ip_31_0)
810+
801811 struct mlx5dr_esw_caps {
802812 u64 drop_icm_address_rx;
803813 u64 drop_icm_address_tx;
drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c+26−7
@@ -233,7 +233,11 @@ static bool contain_vport_reformat_action(struct mlx5_flow_rule *dst) · 232 unmodified lines
233233 dst->dest_attr.vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID;
234234 }
235235
236−#define MLX5_FLOW_CONTEXT_ACTION_MAX 32
236+/* We want to support a rule with 32 destinations, which means we need to
237+ * account for 32 destinations plus usually a counter plus one more action
238+ * for a multi-destination flow table.
239+ */
240+#define MLX5_FLOW_CONTEXT_ACTION_MAX 34
237241 static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns,
238242 struct mlx5_flow_table *ft,
239243 struct mlx5_flow_group *group,
@@ -403,9 +407,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, · 163 unmodified lines
403407 enum mlx5_flow_destination_type type = dst->dest_attr.type;
404408 u32 id;
405409
406− if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX ||
407− num_term_actions >= MLX5_FLOW_CONTEXT_ACTION_MAX) {
408− err = -ENOSPC;
410+ if (fs_dr_num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX ||
411+ num_term_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
412+ err = -EOPNOTSUPP;
409413 goto free_actions;
410414 }
411415
@@ -478,8 +482,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, · 66 unmodified lines
478482 MLX5_FLOW_DESTINATION_TYPE_COUNTER)
479483 continue;
480484
481− if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
482− err = -ENOSPC;
485+ if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX ||
486+ fs_dr_num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
487+ err = -EOPNOTSUPP;
483488 goto free_actions;
484489 }
485490
@@ -499,14 +504,28 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, · 13 unmodified lines
499504 params.match_sz = match_sz;
500505 params.match_buf = (u64 *)fte->val;
501506 if (num_term_actions == 1) {
502− if (term_actions->reformat)
507+ if (term_actions->reformat) {
508+ if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
509+ err = -EOPNOTSUPP;
510+ goto free_actions;
511+ }
503512 actions[num_actions++] = term_actions->reformat;
513+ }
504514
515+ if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
516+ err = -EOPNOTSUPP;
517+ goto free_actions;
518+ }
505519 actions[num_actions++] = term_actions->dest;
506520 } else if (num_term_actions > 1) {
507521 bool ignore_flow_level =
508522 !!(fte->action.flags & FLOW_ACT_IGNORE_FLOW_LEVEL);
509523
524+ if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX ||
525+ fs_dr_num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) {
526+ err = -EOPNOTSUPP;
527+ goto free_actions;
528+ }
510529 tmp_action = mlx5dr_action_create_mult_dest_tbl(domain,
511530 term_actions,
512531 num_term_actions,
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h+5−0
@@ -160,6 +160,11 @@ struct mlx5dr_icm_buddy_mem { · 159 unmodified lines
160160 * sync_ste command sets them free.
161161 */
162162 struct list_head hot_list;
163+
164+ /* Memory optimisation */
165+ struct mlx5dr_ste *ste_arr;
166+ struct list_head *miss_list;
167+ u8 *hw_ste_arr;
163168 };
164169
165170 int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy,
drivers/net/ethernet/mscc/ocelot.c+5−1
@@ -549,14 +549,18 @@ EXPORT_SYMBOL(ocelot_vlan_add); · 548 unmodified lines
549549 int ocelot_vlan_del(struct ocelot *ocelot, int port, u16 vid)
550550 {
551551 struct ocelot_port *ocelot_port = ocelot->ports[port];
552+ bool del_pvid = false;
552553 int err;
553554
555+ if (ocelot_port->pvid_vlan && ocelot_port->pvid_vlan->vid == vid)
556+ del_pvid = true;
557+
554558 err = ocelot_vlan_member_del(ocelot, port, vid);
555559 if (err)
556560 return err;
557561
558562 /* Ingress */
559− if (ocelot_port->pvid_vlan && ocelot_port->pvid_vlan->vid == vid)
563+ if (del_pvid)
560564 ocelot_port_set_pvid(ocelot, port, NULL);
561565
562566 /* Egress */
drivers/net/ethernet/netronome/nfp/flower/cmsg.h+2−0
@@ -723,6 +723,8 @@ static inline bool nfp_fl_is_netdev_to_offload(struct net_device *netdev) · 722 unmodified lines
723723 return true;
724724 if (netif_is_gretap(netdev))
725725 return true;
726+ if (netif_is_ip6gretap(netdev))
727+ return true;
726728
727729 return false;
728730 }
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c+2−2
@@ -922,8 +922,8 @@ nfp_tunnel_add_shared_mac(struct nfp_app *app, struct net_device *netdev, · 921 unmodified lines
922922 int port, bool mod)
923923 {
924924 struct nfp_flower_priv *priv = app->priv;
925− int ida_idx = NFP_MAX_MAC_INDEX, err;
926925 struct nfp_tun_offloaded_mac *entry;
926+ int ida_idx = -1, err;
927927 u16 nfp_mac_idx = 0;
928928
929929 entry = nfp_tunnel_lookup_offloaded_macs(app, netdev->dev_addr);
@@ -997,7 +997,7 @@ err_remove_hash: · 67 unmodified lines
997997 err_free_entry:
998998 kfree(entry);
999999 err_free_ida:
1000− if (ida_idx != NFP_MAX_MAC_INDEX)
1000+ if (ida_idx != -1)
10011001 ida_simple_remove(&priv->tun.mac_off_ids, ida_idx);
10021002
10031003 return err;
drivers/net/ethernet/xilinx/ll_temac_main.c+2−0
@@ -1433,6 +1433,8 @@ static int temac_probe(struct platform_device *pdev) · 1432 unmodified lines
14331433 lp->indirect_lock = devm_kmalloc(&pdev->dev,
14341434 sizeof(*lp->indirect_lock),
14351435 GFP_KERNEL);
1436+ if (!lp->indirect_lock)
1437+ return -ENOMEM;
14361438 spin_lock_init(lp->indirect_lock);
14371439 }
14381440
drivers/net/hamradio/6pack.c+2−2
@@ -668,11 +668,11 @@ static void sixpack_close(struct tty_struct *tty) · 667 unmodified lines
668668 */
669669 netif_stop_queue(sp->dev);
670670
671+ unregister_netdev(sp->dev);
672+
671673 del_timer_sync(&sp->tx_t);
672674 del_timer_sync(&sp->resync_t);
673675
674− unregister_netdev(sp->dev);
675−
676676 /* Free all 6pack frame buffers after unreg. */
677677 kfree(sp->rbuff);
678678 kfree(sp->xbuff);
drivers/net/ieee802154/ca8210.c+2−2
@@ -2975,8 +2975,8 @@ static void ca8210_hw_setup(struct ieee802154_hw *ca8210_hw) · 2974 unmodified lines
29752975 ca8210_hw->phy->cca.opt = NL802154_CCA_OPT_ENERGY_CARRIER_AND;
29762976 ca8210_hw->phy->cca_ed_level = -9800;
29772977 ca8210_hw->phy->symbol_duration = 16;
2978− ca8210_hw->phy->lifs_period = 40;
2979− ca8210_hw->phy->sifs_period = 12;
2978+ ca8210_hw->phy->lifs_period = 40 * ca8210_hw->phy->symbol_duration;
2979+ ca8210_hw->phy->sifs_period = 12 * ca8210_hw->phy->symbol_duration;
29802980 ca8210_hw->flags =
29812981 IEEE802154_HW_AFILT |
29822982 IEEE802154_HW_OMIT_CKSUM |
drivers/net/mctp/mctp-serial.c+8−1
@@ -403,8 +403,16 @@ static void mctp_serial_tty_receive_buf(struct tty_struct *tty, · 402 unmodified lines
403403 mctp_serial_push(dev, c[i]);
404404 }
405405
406+static void mctp_serial_uninit(struct net_device *ndev)
407+{
408+ struct mctp_serial *dev = netdev_priv(ndev);
409+
410+ cancel_work_sync(&dev->tx_work);
411+}
412+
406413 static const struct net_device_ops mctp_serial_netdev_ops = {
407414 .ndo_start_xmit = mctp_serial_tx,
415+ .ndo_uninit = mctp_serial_uninit,
408416 };
409417
410418 static void mctp_serial_setup(struct net_device *ndev)
@@ -483,7 +491,6 @@ static void mctp_serial_close(struct tty_struct *tty) · 72 unmodified lines
483491 int idx = dev->idx;
484492
485493 unregister_netdev(dev->netdev);
486− cancel_work_sync(&dev->tx_work);
487494 ida_free(&mctp_serial_ida, idx);
488495 }
489496
drivers/net/mdio/mdio-ipq4019.c+5−1
@@ -200,7 +200,11 @@ static int ipq_mdio_reset(struct mii_bus *bus) · 199 unmodified lines
200200 if (ret)
201201 return ret;
202202
203− return clk_prepare_enable(priv->mdio_clk);
203+ ret = clk_prepare_enable(priv->mdio_clk);
204+ if (ret == 0)
205+ mdelay(10);
206+
207+ return ret;
204208 }
205209
206210 static int ipq4019_mdio_probe(struct platform_device *pdev)
drivers/net/netdevsim/fib.c+2−2
@@ -623,14 +623,14 @@ static int nsim_fib6_rt_append(struct nsim_fib_data *data, · 622 unmodified lines
623623 if (err)
624624 goto err_fib6_rt_nh_del;
625625
626− fib6_event->rt_arr[i]->trap = true;
626+ WRITE_ONCE(fib6_event->rt_arr[i]->trap, true);
627627 }
628628
629629 return 0;
630630
631631 err_fib6_rt_nh_del:
632632 for (i--; i >= 0; i--) {
633− fib6_event->rt_arr[i]->trap = false;
633+ WRITE_ONCE(fib6_event->rt_arr[i]->trap, false);
634634 nsim_fib6_rt_nh_del(fib6_rt, fib6_event->rt_arr[i]);
635635 }
636636 return err;
drivers/net/phy/mediatek-ge.c+0−3
@@ -55,9 +55,6 @@ static int mt7530_phy_config_init(struct phy_device *phydev) · 54 unmodified lines
5555
5656 static int mt7531_phy_config_init(struct phy_device *phydev)
5757 {
58− if (phydev->interface != PHY_INTERFACE_MODE_INTERNAL)
59− return -EINVAL;
60−
6158 mtk_gephy_config_init(phydev);
6259
6360 /* PHY link down power saving enable */
drivers/net/usb/cdc_ether.c+12−0
@@ -583,6 +583,11 @@ static const struct usb_device_id products[] = { · 582 unmodified lines
583583 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
584584 .bInterfaceProtocol = USB_CDC_PROTO_NONE
585585
586+#define ZAURUS_FAKE_INTERFACE \
587+ .bInterfaceClass = USB_CLASS_COMM, \
588+ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \
589+ .bInterfaceProtocol = USB_CDC_PROTO_NONE
590+
586591 /* SA-1100 based Sharp Zaurus ("collie"), or compatible;
587592 * wire-incompatible with true CDC Ethernet implementations.
588593 * (And, it seems, needlessly so...)
@@ -636,6 +641,13 @@ static const struct usb_device_id products[] = { · 47 unmodified lines
636641 .idProduct = 0x9032, /* SL-6000 */
637642 ZAURUS_MASTER_INTERFACE,
638643 .driver_info = 0,
644+}, {
645+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
646+ | USB_DEVICE_ID_MATCH_DEVICE,
647+ .idVendor = 0x04DD,
648+ .idProduct = 0x9032, /* SL-6000 */
649+ ZAURUS_FAKE_INTERFACE,
650+ .driver_info = 0,
639651 }, {
640652 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
641653 | USB_DEVICE_ID_MATCH_DEVICE,
drivers/net/usb/cdc_mbim.c+5−0
@@ -659,6 +659,11 @@ static const struct usb_device_id mbim_devs[] = { · 658 unmodified lines
659659 .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle,
660660 },
661661
662+ /* Telit FN990 */
663+ { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1071, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
664+ .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle,
665+ },
666+
662667 /* default entry */
663668 { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
664669 .driver_info = (unsigned long)&cdc_mbim_info_zlp,
drivers/net/usb/cdc_ncm.c+4−4
@@ -1715,10 +1715,10 @@ int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) · 1714 unmodified lines
17151715 {
17161716 struct sk_buff *skb;
17171717 struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
1718− int len;
1718+ unsigned int len;
17191719 int nframes;
17201720 int x;
1721− int offset;
1721+ unsigned int offset;
17221722 union {
17231723 struct usb_cdc_ncm_ndp16 *ndp16;
17241724 struct usb_cdc_ncm_ndp32 *ndp32;
@@ -1790,8 +1790,8 @@ next_ndp: · 65 unmodified lines
17901790 break;
17911791 }
17921792
1793− /* sanity checking */
1794− if (((offset + len) > skb_in->len) ||
1793+ /* sanity checking - watch out for integer wrap*/
1794+ if ((offset > skb_in->len) || (len > skb_in->len - offset) ||
17951795 (len > ctx->rx_max) || (len < ETH_HLEN)) {
17961796 netif_dbg(dev, rx_err, dev->net,
17971797 "invalid frame detected (ignored) offset[%u]=%u, length=%u, skb=%p\n",
drivers/net/usb/sr9700.c+1−1
@@ -413,7 +413,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 412 unmodified lines
413413 /* ignore the CRC length */
414414 len = (skb->data[1] | (skb->data[2] << 8)) - 4;
415415
416− if (len > ETH_FRAME_LEN)
416+ if (len > ETH_FRAME_LEN || len > skb->len)
417417 return 0;
418418
419419 /* the last packet of current skb */
drivers/net/usb/zaurus.c+12−0
@@ -256,6 +256,11 @@ static const struct usb_device_id products [] = { · 255 unmodified lines
256256 .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \
257257 .bInterfaceProtocol = USB_CDC_PROTO_NONE
258258
259+#define ZAURUS_FAKE_INTERFACE \
260+ .bInterfaceClass = USB_CLASS_COMM, \
261+ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \
262+ .bInterfaceProtocol = USB_CDC_PROTO_NONE
263+
259264 /* SA-1100 based Sharp Zaurus ("collie"), or compatible. */
260265 {
261266 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
@@ -313,6 +318,13 @@ static const struct usb_device_id products [] = { · 51 unmodified lines
313318 .idProduct = 0x9032, /* SL-6000 */
314319 ZAURUS_MASTER_INTERFACE,
315320 .driver_info = ZAURUS_PXA_INFO,
321+}, {
322+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
323+ | USB_DEVICE_ID_MATCH_DEVICE,
324+ .idVendor = 0x04DD,
325+ .idProduct = 0x9032, /* SL-6000 */
326+ ZAURUS_FAKE_INTERFACE,
327+ .driver_info = (unsigned long)&bogus_mdlm_info,
316328 }, {
317329 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO
318330 | USB_DEVICE_ID_MATCH_DEVICE,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c+4−2
@@ -693,7 +693,7 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, · 692 unmodified lines
693693 {
694694 struct brcmf_fw_item *first = &req->items[0];
695695 struct brcmf_fw *fwctx;
696− char *alt_path;
696+ char *alt_path = NULL;
697697 int ret;
698698
699699 brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
@@ -712,7 +712,9 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req, · 12 unmodified lines
712712 fwctx->done = fw_cb;
713713
714714 /* First try alternative board-specific path if any */
715− alt_path = brcm_alt_fw_path(first->path, fwctx->req->board_type);
715+ if (fwctx->req->board_type)
716+ alt_path = brcm_alt_fw_path(first->path,
717+ fwctx->req->board_type);
716718 if (alt_path) {
717719 ret = request_firmware_nowait(THIS_MODULE, true, alt_path,
718720 fwctx->dev, GFP_KERNEL, fwctx,
drivers/net/wireless/intel/iwlwifi/Kconfig+0−13
@@ -80,19 +80,6 @@ config IWLWIFI_OPMODE_MODULAR · 79 unmodified lines
8080 comment "WARNING: iwlwifi is useless without IWLDVM or IWLMVM"
8181 depends on IWLDVM=n && IWLMVM=n
8282
83−config IWLWIFI_BCAST_FILTERING
84− bool "Enable broadcast filtering"
85− depends on IWLMVM
86− help
87− Say Y here to enable default bcast filtering configuration.
88−
89− Enabling broadcast filtering will drop any incoming wireless
90− broadcast frames, except some very specific predefined
91− patterns (e.g. incoming arp requests).
92−
93− If unsure, don't enable this option, as some programs might
94− expect incoming broadcasts for their normal operations.
95−
9683 menu "Debugging Options"
9784
9885 config IWLWIFI_DEBUG
drivers/net/wireless/intel/iwlwifi/fw/acpi.c+6−5
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22 /*
33 * Copyright (C) 2017 Intel Deutschland GmbH
4− * Copyright (C) 2019-2021 Intel Corporation
4+ * Copyright (C) 2019-2022 Intel Corporation
55 */
66 #include <linux/uuid.h>
77 #include "iwl-drv.h"
@@ -888,10 +888,11 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt) · 880 unmodified lines
888888 * only one using version 36, so skip this version entirely.
889889 */
890890 return IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) >= 38 ||
891− IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 17 ||
892− (IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 29 &&
893− ((fwrt->trans->hw_rev & CSR_HW_REV_TYPE_MSK) ==
894− CSR_HW_REV_TYPE_7265D));
891+ (IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 17 &&
892+ fwrt->trans->hw_rev != CSR_HW_REV_TYPE_3160) ||
893+ (IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 29 &&
894+ ((fwrt->trans->hw_rev & CSR_HW_REV_TYPE_MSK) ==
895+ CSR_HW_REV_TYPE_7265D));
895896 }
896897 IWL_EXPORT_SYMBOL(iwl_sar_geo_support);
897898
drivers/net/wireless/intel/iwlwifi/fw/api/commands.h+0−5
@@ -501,11 +501,6 @@ enum iwl_legacy_cmds { · 500 unmodified lines
501501 */
502502 DEBUG_LOG_MSG = 0xf7,
503503
504− /**
505− * @BCAST_FILTER_CMD: &struct iwl_bcast_filter_cmd
506− */
507− BCAST_FILTER_CMD = 0xcf,
508−
509504 /**
510505 * @MCAST_FILTER_CMD: &struct iwl_mcast_filter_cmd
511506 */
drivers/net/wireless/intel/iwlwifi/fw/api/filter.h+0−88
@@ -36,92 +36,4 @@ struct iwl_mcast_filter_cmd { · 35 unmodified lines
3636 u8 addr_list[0];
3737 } __packed; /* MCAST_FILTERING_CMD_API_S_VER_1 */
3838
39−#define MAX_BCAST_FILTERS 8
40−#define MAX_BCAST_FILTER_ATTRS 2
41−
42−/**
43− * enum iwl_mvm_bcast_filter_attr_offset - written by fw for each Rx packet
44− * @BCAST_FILTER_OFFSET_PAYLOAD_START: offset is from payload start.
45− * @BCAST_FILTER_OFFSET_IP_END: offset is from ip header end (i.e.
46− * start of ip payload).
47− */
48−enum iwl_mvm_bcast_filter_attr_offset {
49− BCAST_FILTER_OFFSET_PAYLOAD_START = 0,
50− BCAST_FILTER_OFFSET_IP_END = 1,
51−};
52−
53−/**
54− * struct iwl_fw_bcast_filter_attr - broadcast filter attribute
55− * @offset_type: &enum iwl_mvm_bcast_filter_attr_offset.
56− * @offset: starting offset of this pattern.
57− * @reserved1: reserved
58− * @val: value to match - big endian (MSB is the first
59− * byte to match from offset pos).
60− * @mask: mask to match (big endian).
61− */
62−struct iwl_fw_bcast_filter_attr {
63− u8 offset_type;
64− u8 offset;
65− __le16 reserved1;
66− __be32 val;
67− __be32 mask;
68−} __packed; /* BCAST_FILTER_ATT_S_VER_1 */
69−
70−/**
71− * enum iwl_mvm_bcast_filter_frame_type - filter frame type
72− * @BCAST_FILTER_FRAME_TYPE_ALL: consider all frames.
73− * @BCAST_FILTER_FRAME_TYPE_IPV4: consider only ipv4 frames
74− */
75−enum iwl_mvm_bcast_filter_frame_type {
76− BCAST_FILTER_FRAME_TYPE_ALL = 0,
77− BCAST_FILTER_FRAME_TYPE_IPV4 = 1,
78−};
79−
80−/**
81− * struct iwl_fw_bcast_filter - broadcast filter
82− * @discard: discard frame (1) or let it pass (0).
83− * @frame_type: &enum iwl_mvm_bcast_filter_frame_type.
84− * @reserved1: reserved
85− * @num_attrs: number of valid attributes in this filter.
86− * @attrs: attributes of this filter. a filter is considered matched
87− * only when all its attributes are matched (i.e. AND relationship)
88− */
89−struct iwl_fw_bcast_filter {
90− u8 discard;
91− u8 frame_type;
92− u8 num_attrs;
93− u8 reserved1;
94− struct iwl_fw_bcast_filter_attr attrs[MAX_BCAST_FILTER_ATTRS];
95−} __packed; /* BCAST_FILTER_S_VER_1 */
96−
97−/**
98− * struct iwl_fw_bcast_mac - per-mac broadcast filtering configuration.
99− * @default_discard: default action for this mac (discard (1) / pass (0)).
100− * @reserved1: reserved
101− * @attached_filters: bitmap of relevant filters for this mac.
102− */
103−struct iwl_fw_bcast_mac {
104− u8 default_discard;
105− u8 reserved1;
106− __le16 attached_filters;
107−} __packed; /* BCAST_MAC_CONTEXT_S_VER_1 */
108−
109−/**
110− * struct iwl_bcast_filter_cmd - broadcast filtering configuration
111− * @disable: enable (0) / disable (1)
112− * @max_bcast_filters: max number of filters (MAX_BCAST_FILTERS)
113− * @max_macs: max number of macs (NUM_MAC_INDEX_DRIVER)
114− * @reserved1: reserved
115− * @filters: broadcast filters
116− * @macs: broadcast filtering configuration per-mac
117− */
118−struct iwl_bcast_filter_cmd {
119− u8 disable;
120− u8 max_bcast_filters;
121− u8 max_macs;
122− u8 reserved1;
123− struct iwl_fw_bcast_filter filters[MAX_BCAST_FILTERS];
124− struct iwl_fw_bcast_mac macs[NUM_MAC_INDEX_DRIVER];
125−} __packed; /* BCAST_FILTERING_HCMD_API_S_VER_1 */
126−
12739 #endif /* __iwl_fw_api_filter_h__ */
drivers/net/wireless/intel/iwlwifi/fw/api/rs.h+0−1
@@ -752,7 +752,6 @@ struct iwl_lq_cmd { · 751 unmodified lines
752752
753753 u8 iwl_fw_rate_idx_to_plcp(int idx);
754754 u32 iwl_new_rate_from_v1(u32 rate_v1);
755−u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags);
756755 const struct iwl_rate_mcs_info *iwl_rate_mcs(int idx);
757756 const char *iwl_rs_pretty_ant(u8 ant);
758757 const char *iwl_rs_pretty_bw(int bw);
drivers/net/wireless/intel/iwlwifi/fw/file.h+0−2
@@ -181,7 +181,6 @@ struct iwl_ucode_capa { · 180 unmodified lines
181181 * @IWL_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version)
182182 * @IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD
183183 * @IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD: P2P client supports uAPSD power save
184− * @IWL_UCODE_TLV_FLAGS_BCAST_FILTERING: uCode supports broadcast filtering.
185184 * @IWL_UCODE_TLV_FLAGS_EBS_SUPPORT: this uCode image supports EBS.
186185 */
187186 enum iwl_ucode_tlv_flag {
@@ -196,7 +195,6 @@ enum iwl_ucode_tlv_flag { · 8 unmodified lines
196195 IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT = BIT(24),
197196 IWL_UCODE_TLV_FLAGS_EBS_SUPPORT = BIT(25),
198197 IWL_UCODE_TLV_FLAGS_P2P_PS_UAPSD = BIT(26),
199− IWL_UCODE_TLV_FLAGS_BCAST_FILTERING = BIT(29),
200198 };
201199
202200 typedef unsigned int __bitwise iwl_ucode_tlv_api_t;
drivers/net/wireless/intel/iwlwifi/fw/rs.c+18−15
@@ -91,6 +91,20 @@ const char *iwl_rs_pretty_bw(int bw) · 90 unmodified lines
9191 }
9292 IWL_EXPORT_SYMBOL(iwl_rs_pretty_bw);
9393
94+static u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags)
95+{
96+ int rate = rate_n_flags & RATE_LEGACY_RATE_MSK_V1;
97+ int idx;
98+ bool ofdm = !(rate_n_flags & RATE_MCS_CCK_MSK_V1);
99+ int offset = ofdm ? IWL_FIRST_OFDM_RATE : 0;
100+ int last = ofdm ? IWL_RATE_COUNT_LEGACY : IWL_FIRST_OFDM_RATE;
101+
102+ for (idx = offset; idx < last; idx++)
103+ if (iwl_fw_rate_idx_to_plcp(idx) == rate)
104+ return idx - offset;
105+ return IWL_RATE_INVALID;
106+}
107+
94108 u32 iwl_new_rate_from_v1(u32 rate_v1)
95109 {
96110 u32 rate_v2 = 0;
@@ -144,7 +158,10 @@ u32 iwl_new_rate_from_v1(u32 rate_v1) · 47 unmodified lines
144158 } else {
145159 u32 legacy_rate = iwl_legacy_rate_to_fw_idx(rate_v1);
146160
147− WARN_ON(legacy_rate < 0);
161+ if (WARN_ON_ONCE(legacy_rate == IWL_RATE_INVALID))
162+ legacy_rate = (rate_v1 & RATE_MCS_CCK_MSK_V1) ?
163+ IWL_FIRST_CCK_RATE : IWL_FIRST_OFDM_RATE;
164+
148165 rate_v2 |= legacy_rate;
149166 if (!(rate_v1 & RATE_MCS_CCK_MSK_V1))
150167 rate_v2 |= RATE_MCS_LEGACY_OFDM_MSK;
@@ -172,20 +189,6 @@ u32 iwl_new_rate_from_v1(u32 rate_v1) · 21 unmodified lines
172189 }
173190 IWL_EXPORT_SYMBOL(iwl_new_rate_from_v1);
174191
175−u32 iwl_legacy_rate_to_fw_idx(u32 rate_n_flags)
176−{
177− int rate = rate_n_flags & RATE_LEGACY_RATE_MSK_V1;
178− int idx;
179− bool ofdm = !(rate_n_flags & RATE_MCS_CCK_MSK_V1);
180− int offset = ofdm ? IWL_FIRST_OFDM_RATE : 0;
181− int last = ofdm ? IWL_RATE_COUNT_LEGACY : IWL_FIRST_OFDM_RATE;
182−
183− for (idx = offset; idx < last; idx++)
184− if (iwl_fw_rate_idx_to_plcp(idx) == rate)
185− return idx - offset;
186− return -1;
187−}
188−
189192 int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate)
190193 {
191194 char *type;
drivers/net/wireless/intel/iwlwifi/iwl-csr.h+2−1
@@ -1,6 +1,6 @@
11 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22 /*
3− * Copyright (C) 2005-2014, 2018-2021 Intel Corporation
3+ * Copyright (C) 2005-2014, 2018-2022 Intel Corporation
44 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
55 * Copyright (C) 2016 Intel Deutschland GmbH
66 */
@@ -329,6 +329,7 @@ enum { · 322 unmodified lines
329329 #define CSR_HW_REV_TYPE_2x00 (0x0000100)
330330 #define CSR_HW_REV_TYPE_105 (0x0000110)
331331 #define CSR_HW_REV_TYPE_135 (0x0000120)
332+#define CSR_HW_REV_TYPE_3160 (0x0000164)
332333 #define CSR_HW_REV_TYPE_7265D (0x0000210)
333334 #define CSR_HW_REV_TYPE_NONE (0x00001F0)
334335 #define CSR_HW_REV_TYPE_QNJ (0x0000360)
drivers/net/wireless/intel/iwlwifi/iwl-drv.c+2−0
@@ -1707,6 +1707,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) · 1706 unmodified lines
17071707 out_unbind:
17081708 complete(&drv->request_firmware_complete);
17091709 device_release_driver(drv->trans->dev);
1710+ /* drv has just been freed by the release */
1711+ failure = false;
17101712 free:
17111713 if (failure)
17121714 iwl_dealloc_ucode(drv);
drivers/net/wireless/intel/iwlwifi/mei/main.c+34−11
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /*
3− * Copyright (C) 2021 Intel Corporation
3+ * Copyright (C) 2021-2022 Intel Corporation
44 */
55
66 #include <linux/etherdevice.h>
@@ -146,6 +146,7 @@ struct iwl_mei_filters { · 139 unmodified lines
146146 * @csme_taking_ownership: true when CSME is taking ownership. Used to remember
147147 * to send CSME_OWNERSHIP_CONFIRMED when the driver completes its down
148148 * flow.
149+ * @link_prot_state: true when we are in link protection PASSIVE
149150 * @csa_throttle_end_wk: used when &csa_throttled is true
150151 * @data_q_lock: protects the access to the data queues which are
151152 * accessed without the mutex.
@@ -165,6 +166,7 @@ struct iwl_mei { · 13 unmodified lines
165166 bool amt_enabled;
166167 bool csa_throttled;
167168 bool csme_taking_ownership;
169+ bool link_prot_state;
168170 struct delayed_work csa_throttle_end_wk;
169171 spinlock_t data_q_lock;
170172
@@ -229,8 +231,6 @@ static int iwl_mei_alloc_shared_mem(struct mei_cl_device *cldev) · 58 unmodified lines
229231 if (IS_ERR(mem->ctrl)) {
230232 int ret = PTR_ERR(mem->ctrl);
231233
232− dev_err(&cldev->dev, "Couldn't allocate the shared memory: %d\n",
233− ret);
234234 mem->ctrl = NULL;
235235
236236 return ret;
@@ -669,6 +669,8 @@ iwl_mei_handle_conn_status(struct mei_cl_device *cldev, · 432 unmodified lines
669669
670670 iwl_mei_cache.ops->me_conn_status(iwl_mei_cache.priv, &conn_info);
671671
672+ mei->link_prot_state = status->link_prot_state;
673+
672674 /*
673675 * Update the Rfkill state in case the host does not own the device:
674676 * if we are in Link Protection, ask to not touch the device, else,
@@ -1663,9 +1665,11 @@ int iwl_mei_register(void *priv, const struct iwl_mei_ops *ops) · 988 unmodified lines
16631665 mei_cldev_get_drvdata(iwl_mei_global_cldev);
16641666
16651667 /* we have already a SAP connection */
1666− if (iwl_mei_is_connected())
1668+ if (iwl_mei_is_connected()) {
16671669 iwl_mei_send_sap_msg(mei->cldev,
16681670 SAP_MSG_NOTIF_WIFIDR_UP);
1671+ ops->rfkill(priv, mei->link_prot_state);
1672+ }
16691673 }
16701674 ret = 0;
16711675
@@ -1784,6 +1788,8 @@ static void iwl_mei_dbgfs_unregister(struct iwl_mei *mei) {} · 112 unmodified lines
17841788
17851789 #endif /* CONFIG_DEBUG_FS */
17861790
1791+#define ALLOC_SHARED_MEM_RETRY_MAX_NUM 3
1792+
17871793 /*
17881794 * iwl_mei_probe - the probe function called by the mei bus enumeration
17891795 *
@@ -1795,6 +1801,7 @@ static void iwl_mei_dbgfs_unregister(struct iwl_mei *mei) {} · 5 unmodified lines
17951801 static int iwl_mei_probe(struct mei_cl_device *cldev,
17961802 const struct mei_cl_device_id *id)
17971803 {
1804+ int alloc_retry = ALLOC_SHARED_MEM_RETRY_MAX_NUM;
17981805 struct iwl_mei *mei;
17991806 int ret;
18001807
@@ -1812,15 +1819,31 @@ static int iwl_mei_probe(struct mei_cl_device *cldev, · 11 unmodified lines
18121819 mei_cldev_set_drvdata(cldev, mei);
18131820 mei->cldev = cldev;
18141821
1815− /*
1816− * The CSME firmware needs to boot the internal WLAN client. Wait here
1817− * so that the DMA map request will succeed.
1818− */
1819− msleep(20);
1822+ do {
1823+ ret = iwl_mei_alloc_shared_mem(cldev);
1824+ if (!ret)
1825+ break;
1826+ /*
1827+ * The CSME firmware needs to boot the internal WLAN client.
1828+ * This can take time in certain configurations (usually
1829+ * upon resume and when the whole CSME firmware is shut down
1830+ * during suspend).
1831+ *
1832+ * Wait a bit before retrying and hope we'll succeed next time.
1833+ */
18201834
1821− ret = iwl_mei_alloc_shared_mem(cldev);
1822− if (ret)
1835+ dev_dbg(&cldev->dev,
1836+ "Couldn't allocate the shared memory: %d, attempt %d / %d\n",
1837+ ret, alloc_retry, ALLOC_SHARED_MEM_RETRY_MAX_NUM);
1838+ msleep(100);
1839+ alloc_retry--;
1840+ } while (alloc_retry);
1841+
1842+ if (ret) {
1843+ dev_err(&cldev->dev, "Couldn't allocate the shared memory: %d\n",
1844+ ret);
18231845 goto free;
1846+ }
18241847
18251848 iwl_mei_init_shared_mem(mei);
18261849
drivers/net/wireless/intel/iwlwifi/mei/net.c+1−2
@@ -195,8 +195,7 @@ static bool iwl_mei_rx_filter_ipv4(struct sk_buff *skb, · 194 unmodified lines
195195 bool match;
196196
197197 if (!pskb_may_pull(skb, skb_network_offset(skb) + sizeof(*iphdr)) ||
198− !pskb_may_pull(skb, skb_network_offset(skb) +
199− sizeof(ip_hdrlen(skb) - sizeof(*iphdr))))
198+ !pskb_may_pull(skb, skb_network_offset(skb) + ip_hdrlen(skb)))
200199 return false;
201200
202201 iphdrlen = ip_hdrlen(skb);
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c+0−203
@@ -1369,189 +1369,6 @@ static ssize_t iwl_dbgfs_dbg_time_point_write(struct iwl_mvm *mvm, · 1368 unmodified lines
13691369 return count;
13701370 }
13711371
1372−#define ADD_TEXT(...) pos += scnprintf(buf + pos, bufsz - pos, __VA_ARGS__)
1373−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
1374−static ssize_t iwl_dbgfs_bcast_filters_read(struct file *file,
1375− char __user *user_buf,
1376− size_t count, loff_t *ppos)
1377−{
1378− struct iwl_mvm *mvm = file->private_data;
1379− struct iwl_bcast_filter_cmd cmd;
1380− const struct iwl_fw_bcast_filter *filter;
1381− char *buf;
1382− int bufsz = 1024;
1383− int i, j, pos = 0;
1384− ssize_t ret;
1385−
1386− buf = kzalloc(bufsz, GFP_KERNEL);
1387− if (!buf)
1388− return -ENOMEM;
1389−
1390− mutex_lock(&mvm->mutex);
1391− if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) {
1392− ADD_TEXT("None\n");
1393− mutex_unlock(&mvm->mutex);
1394− goto out;
1395− }
1396− mutex_unlock(&mvm->mutex);
1397−
1398− for (i = 0; cmd.filters[i].attrs[0].mask; i++) {
1399− filter = &cmd.filters[i];
1400−
1401− ADD_TEXT("Filter [%d]:\n", i);
1402− ADD_TEXT("\tDiscard=%d\n", filter->discard);
1403− ADD_TEXT("\tFrame Type: %s\n",
1404− filter->frame_type ? "IPv4" : "Generic");
1405−
1406− for (j = 0; j < ARRAY_SIZE(filter->attrs); j++) {
1407− const struct iwl_fw_bcast_filter_attr *attr;
1408−
1409− attr = &filter->attrs[j];
1410− if (!attr->mask)
1411− break;
1412−
1413− ADD_TEXT("\tAttr [%d]: offset=%d (from %s), mask=0x%x, value=0x%x reserved=0x%x\n",
1414− j, attr->offset,
1415− attr->offset_type ? "IP End" :
1416− "Payload Start",
1417− be32_to_cpu(attr->mask),
1418− be32_to_cpu(attr->val),
1419− le16_to_cpu(attr->reserved1));
1420− }
1421− }
1422−out:
1423− ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1424− kfree(buf);
1425− return ret;
1426−}
1427−
1428−static ssize_t iwl_dbgfs_bcast_filters_write(struct iwl_mvm *mvm, char *buf,
1429− size_t count, loff_t *ppos)
1430−{
1431− int pos, next_pos;
1432− struct iwl_fw_bcast_filter filter = {};
1433− struct iwl_bcast_filter_cmd cmd;
1434− u32 filter_id, attr_id, mask, value;
1435− int err = 0;
1436−
1437− if (sscanf(buf, "%d %hhi %hhi %n", &filter_id, &filter.discard,
1438− &filter.frame_type, &pos) != 3)
1439− return -EINVAL;
1440−
1441− if (filter_id >= ARRAY_SIZE(mvm->dbgfs_bcast_filtering.cmd.filters) ||
1442− filter.frame_type > BCAST_FILTER_FRAME_TYPE_IPV4)
1443− return -EINVAL;
1444−
1445− for (attr_id = 0; attr_id < ARRAY_SIZE(filter.attrs);
1446− attr_id++) {
1447− struct iwl_fw_bcast_filter_attr *attr =
1448− &filter.attrs[attr_id];
1449−
1450− if (pos >= count)
1451− break;
1452−
1453− if (sscanf(&buf[pos], "%hhi %hhi %i %i %n",
1454− &attr->offset, &attr->offset_type,
1455− &mask, &value, &next_pos) != 4)
1456− return -EINVAL;
1457−
1458− attr->mask = cpu_to_be32(mask);
1459− attr->val = cpu_to_be32(value);
1460− if (mask)
1461− filter.num_attrs++;
1462−
1463− pos += next_pos;
1464− }
1465−
1466− mutex_lock(&mvm->mutex);
1467− memcpy(&mvm->dbgfs_bcast_filtering.cmd.filters[filter_id],
1468− &filter, sizeof(filter));
1469−
1470− /* send updated bcast filtering configuration */
1471− if (iwl_mvm_firmware_running(mvm) &&
1472− mvm->dbgfs_bcast_filtering.override &&
1473− iwl_mvm_bcast_filter_build_cmd(mvm, &cmd))
1474− err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0,
1475− sizeof(cmd), &cmd);
1476− mutex_unlock(&mvm->mutex);
1477−
1478− return err ?: count;
1479−}
1480−
1481−static ssize_t iwl_dbgfs_bcast_filters_macs_read(struct file *file,
1482− char __user *user_buf,
1483− size_t count, loff_t *ppos)
1484−{
1485− struct iwl_mvm *mvm = file->private_data;
1486− struct iwl_bcast_filter_cmd cmd;
1487− char *buf;
1488− int bufsz = 1024;
1489− int i, pos = 0;
1490− ssize_t ret;
1491−
1492− buf = kzalloc(bufsz, GFP_KERNEL);
1493− if (!buf)
1494− return -ENOMEM;
1495−
1496− mutex_lock(&mvm->mutex);
1497− if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd)) {
1498− ADD_TEXT("None\n");
1499− mutex_unlock(&mvm->mutex);
1500− goto out;
1501− }
1502− mutex_unlock(&mvm->mutex);
1503−
1504− for (i = 0; i < ARRAY_SIZE(cmd.macs); i++) {
1505− const struct iwl_fw_bcast_mac *mac = &cmd.macs[i];
1506−
1507− ADD_TEXT("Mac [%d]: discard=%d attached_filters=0x%x\n",
1508− i, mac->default_discard, mac->attached_filters);
1509− }
1510−out:
1511− ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
1512− kfree(buf);
1513− return ret;
1514−}
1515−
1516−static ssize_t iwl_dbgfs_bcast_filters_macs_write(struct iwl_mvm *mvm,
1517− char *buf, size_t count,
1518− loff_t *ppos)
1519−{
1520− struct iwl_bcast_filter_cmd cmd;
1521− struct iwl_fw_bcast_mac mac = {};
1522− u32 mac_id, attached_filters;
1523− int err = 0;
1524−
1525− if (!mvm->bcast_filters)
1526− return -ENOENT;
1527−
1528− if (sscanf(buf, "%d %hhi %i", &mac_id, &mac.default_discard,
1529− &attached_filters) != 3)
1530− return -EINVAL;
1531−
1532− if (mac_id >= ARRAY_SIZE(cmd.macs) ||
1533− mac.default_discard > 1 ||
1534− attached_filters >= BIT(ARRAY_SIZE(cmd.filters)))
1535− return -EINVAL;
1536−
1537− mac.attached_filters = cpu_to_le16(attached_filters);
1538−
1539− mutex_lock(&mvm->mutex);
1540− memcpy(&mvm->dbgfs_bcast_filtering.cmd.macs[mac_id],
1541− &mac, sizeof(mac));
1542−
1543− /* send updated bcast filtering configuration */
1544− if (iwl_mvm_firmware_running(mvm) &&
1545− mvm->dbgfs_bcast_filtering.override &&
1546− iwl_mvm_bcast_filter_build_cmd(mvm, &cmd))
1547− err = iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0,
1548− sizeof(cmd), &cmd);
1549− mutex_unlock(&mvm->mutex);
1550−
1551− return err ?: count;
1552−}
1553−#endif
1554−
15551372 #define MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz) \
15561373 _MVM_DEBUGFS_WRITE_FILE_OPS(name, bufsz, struct iwl_mvm)
15571374 #define MVM_DEBUGFS_READ_WRITE_FILE_OPS(name, bufsz) \
@@ -1881,11 +1698,6 @@ MVM_DEBUGFS_WRITE_FILE_OPS(inject_beacon_ie_restore, 512); · 323 unmodified lines
18811698
18821699 MVM_DEBUGFS_READ_FILE_OPS(uapsd_noagg_bssids);
18831700
1884−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
1885−MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters, 256);
1886−MVM_DEBUGFS_READ_WRITE_FILE_OPS(bcast_filters_macs, 256);
1887−#endif
1888−
18891701 #ifdef CONFIG_ACPI
18901702 MVM_DEBUGFS_READ_FILE_OPS(sar_geo_profile);
18911703 #endif
@@ -2097,21 +1909,6 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) · 205 unmodified lines
20971909
20981910 MVM_DEBUGFS_ADD_FILE(uapsd_noagg_bssids, mvm->debugfs_dir, S_IRUSR);
20991911
2100−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
2101− if (mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING) {
2102− bcast_dir = debugfs_create_dir("bcast_filtering",
2103− mvm->debugfs_dir);
2104−
2105− debugfs_create_bool("override", 0600, bcast_dir,
2106− &mvm->dbgfs_bcast_filtering.override);
2107−
2108− MVM_DEBUGFS_ADD_FILE_ALIAS("filters", bcast_filters,
2109− bcast_dir, 0600);
2110− MVM_DEBUGFS_ADD_FILE_ALIAS("macs", bcast_filters_macs,
2111− bcast_dir, 0600);
2112− }
2113−#endif
2114−
21151912 #ifdef CONFIG_PM_SLEEP
21161913 MVM_DEBUGFS_ADD_FILE(d3_test, mvm->debugfs_dir, 0400);
21171914 debugfs_create_bool("d3_wake_sysassert", 0600, mvm->debugfs_dir,
drivers/net/wireless/intel/iwlwifi/mvm/fw.c+1−1
@@ -1741,7 +1741,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm) · 1740 unmodified lines
17411741 ret = iwl_mvm_sar_init(mvm);
17421742 if (ret == 0)
17431743 ret = iwl_mvm_sar_geo_init(mvm);
1744− else if (ret < 0)
1744+ if (ret < 0)
17451745 goto error;
17461746
17471747 ret = iwl_mvm_sgom_init(mvm);
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c+0−240
@@ -55,79 +55,6 @@ static const struct ieee80211_iface_combination iwl_mvm_iface_combinations[] = { · 54 unmodified lines
5555 },
5656 };
5757
58−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
59−/*
60− * Use the reserved field to indicate magic values.
61− * these values will only be used internally by the driver,
62− * and won't make it to the fw (reserved will be 0).
63− * BC_FILTER_MAGIC_IP - configure the val of this attribute to
64− * be the vif's ip address. in case there is not a single
65− * ip address (0, or more than 1), this attribute will
66− * be skipped.
67− * BC_FILTER_MAGIC_MAC - set the val of this attribute to
68− * the LSB bytes of the vif's mac address
69− */
70−enum {
71− BC_FILTER_MAGIC_NONE = 0,
72− BC_FILTER_MAGIC_IP,
73− BC_FILTER_MAGIC_MAC,
74−};
75−
76−static const struct iwl_fw_bcast_filter iwl_mvm_default_bcast_filters[] = {
77− {
78− /* arp */
79− .discard = 0,
80− .frame_type = BCAST_FILTER_FRAME_TYPE_ALL,
81− .attrs = {
82− {
83− /* frame type - arp, hw type - ethernet */
84− .offset_type =
85− BCAST_FILTER_OFFSET_PAYLOAD_START,
86− .offset = sizeof(rfc1042_header),
87− .val = cpu_to_be32(0x08060001),
88− .mask = cpu_to_be32(0xffffffff),
89− },
90− {
91− /* arp dest ip */
92− .offset_type =
93− BCAST_FILTER_OFFSET_PAYLOAD_START,
94− .offset = sizeof(rfc1042_header) + 2 +
95− sizeof(struct arphdr) +
96− ETH_ALEN + sizeof(__be32) +
97− ETH_ALEN,
98− .mask = cpu_to_be32(0xffffffff),
99− /* mark it as special field */
100− .reserved1 = cpu_to_le16(BC_FILTER_MAGIC_IP),
101− },
102− },
103− },
104− {
105− /* dhcp offer bcast */
106− .discard = 0,
107− .frame_type = BCAST_FILTER_FRAME_TYPE_IPV4,
108− .attrs = {
109− {
110− /* udp dest port - 68 (bootp client)*/
111− .offset_type = BCAST_FILTER_OFFSET_IP_END,
112− .offset = offsetof(struct udphdr, dest),
113− .val = cpu_to_be32(0x00440000),
114− .mask = cpu_to_be32(0xffff0000),
115− },
116− {
117− /* dhcp - lsb bytes of client hw address */
118− .offset_type = BCAST_FILTER_OFFSET_IP_END,
119− .offset = 38,
120− .mask = cpu_to_be32(0xffffffff),
121− /* mark it as special field */
122− .reserved1 = cpu_to_le16(BC_FILTER_MAGIC_MAC),
123− },
124− },
125− },
126− /* last filter must be empty */
127− {},
128−};
129−#endif
130−
13158 static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = {
13259 .max_peers = IWL_MVM_TOF_MAX_APS,
13360 .report_ap_tsf = 1,
@@ -693,11 +620,6 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) · 559 unmodified lines
693620 }
694621 #endif
695622
696−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
697− /* assign default bcast filtering configuration */
698− mvm->bcast_filters = iwl_mvm_default_bcast_filters;
699−#endif
700−
701623 ret = iwl_mvm_leds_init(mvm);
702624 if (ret)
703625 return ret;
@@ -1853,162 +1775,6 @@ static void iwl_mvm_config_iface_filter(struct ieee80211_hw *hw, · 1149 unmodified lines
18531775 mutex_unlock(&mvm->mutex);
18541776 }
18551777
1856−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
1857−struct iwl_bcast_iter_data {
1858− struct iwl_mvm *mvm;
1859− struct iwl_bcast_filter_cmd *cmd;
1860− u8 current_filter;
1861−};
1862−
1863−static void
1864−iwl_mvm_set_bcast_filter(struct ieee80211_vif *vif,
1865− const struct iwl_fw_bcast_filter *in_filter,
1866− struct iwl_fw_bcast_filter *out_filter)
1867−{
1868− struct iwl_fw_bcast_filter_attr *attr;
1869− int i;
1870−
1871− memcpy(out_filter, in_filter, sizeof(*out_filter));
1872−
1873− for (i = 0; i < ARRAY_SIZE(out_filter->attrs); i++) {
1874− attr = &out_filter->attrs[i];
1875−
1876− if (!attr->mask)
1877− break;
1878−
1879− switch (attr->reserved1) {
1880− case cpu_to_le16(BC_FILTER_MAGIC_IP):
1881− if (vif->bss_conf.arp_addr_cnt != 1) {
1882− attr->mask = 0;
1883− continue;
1884− }
1885−
1886− attr->val = vif->bss_conf.arp_addr_list[0];
1887− break;
1888− case cpu_to_le16(BC_FILTER_MAGIC_MAC):
1889− attr->val = *(__be32 *)&vif->addr[2];
1890− break;
1891− default:
1892− break;
1893− }
1894− attr->reserved1 = 0;
1895− out_filter->num_attrs++;
1896− }
1897−}
1898−
1899−static void iwl_mvm_bcast_filter_iterator(void *_data, u8 *mac,
1900− struct ieee80211_vif *vif)
1901−{
1902− struct iwl_bcast_iter_data *data = _data;
1903− struct iwl_mvm *mvm = data->mvm;
1904− struct iwl_bcast_filter_cmd *cmd = data->cmd;
1905− struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1906− struct iwl_fw_bcast_mac *bcast_mac;
1907− int i;
1908−
1909− if (WARN_ON(mvmvif->id >= ARRAY_SIZE(cmd->macs)))
1910− return;
1911−
1912− bcast_mac = &cmd->macs[mvmvif->id];
1913−
1914− /*
1915− * enable filtering only for associated stations, but not for P2P
1916− * Clients
1917− */
1918− if (vif->type != NL80211_IFTYPE_STATION || vif->p2p ||
1919− !vif->bss_conf.assoc)
1920− return;
1921−
1922− bcast_mac->default_discard = 1;
1923−
1924− /* copy all configured filters */
1925− for (i = 0; mvm->bcast_filters[i].attrs[0].mask; i++) {
1926− /*
1927− * Make sure we don't exceed our filters limit.
1928− * if there is still a valid filter to be configured,
1929− * be on the safe side and just allow bcast for this mac.
1930− */
1931− if (WARN_ON_ONCE(data->current_filter >=
1932− ARRAY_SIZE(cmd->filters))) {
1933− bcast_mac->default_discard = 0;
1934− bcast_mac->attached_filters = 0;
1935− break;
1936− }
1937−
1938− iwl_mvm_set_bcast_filter(vif,
1939− &mvm->bcast_filters[i],
1940− &cmd->filters[data->current_filter]);
1941−
1942− /* skip current filter if it contains no attributes */
1943− if (!cmd->filters[data->current_filter].num_attrs)
1944− continue;
1945−
1946− /* attach the filter to current mac */
1947− bcast_mac->attached_filters |=
1948− cpu_to_le16(BIT(data->current_filter));
1949−
1950− data->current_filter++;
1951− }
1952−}
1953−
1954−bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
1955− struct iwl_bcast_filter_cmd *cmd)
1956−{
1957− struct iwl_bcast_iter_data iter_data = {
1958− .mvm = mvm,
1959− .cmd = cmd,
1960− };
1961−
1962− if (IWL_MVM_FW_BCAST_FILTER_PASS_ALL)
1963− return false;
1964−
1965− memset(cmd, 0, sizeof(*cmd));
1966− cmd->max_bcast_filters = ARRAY_SIZE(cmd->filters);
1967− cmd->max_macs = ARRAY_SIZE(cmd->macs);
1968−
1969−#ifdef CONFIG_IWLWIFI_DEBUGFS
1970− /* use debugfs filters/macs if override is configured */
1971− if (mvm->dbgfs_bcast_filtering.override) {
1972− memcpy(cmd->filters, &mvm->dbgfs_bcast_filtering.cmd.filters,
1973− sizeof(cmd->filters));
1974− memcpy(cmd->macs, &mvm->dbgfs_bcast_filtering.cmd.macs,
1975− sizeof(cmd->macs));
1976− return true;
1977− }
1978−#endif
1979−
1980− /* if no filters are configured, do nothing */
1981− if (!mvm->bcast_filters)
1982− return false;
1983−
1984− /* configure and attach these filters for each associated sta vif */
1985− ieee80211_iterate_active_interfaces(
1986− mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
1987− iwl_mvm_bcast_filter_iterator, &iter_data);
1988−
1989− return true;
1990−}
1991−
1992−static int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm)
1993−{
1994− struct iwl_bcast_filter_cmd cmd;
1995−
1996− if (!(mvm->fw->ucode_capa.flags & IWL_UCODE_TLV_FLAGS_BCAST_FILTERING))
1997− return 0;
1998−
1999− if (!iwl_mvm_bcast_filter_build_cmd(mvm, &cmd))
2000− return 0;
2001−
2002− return iwl_mvm_send_cmd_pdu(mvm, BCAST_FILTER_CMD, 0,
2003− sizeof(cmd), &cmd);
2004−}
2005−#else
2006−static inline int iwl_mvm_configure_bcast_filter(struct iwl_mvm *mvm)
2007−{
2008− return 0;
2009−}
2010−#endif
2011−
20121778 static int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm,
20131779 struct ieee80211_vif *vif)
20141780 {
@@ -2520,7 +2286,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, · 505 unmodified lines
25202286 }
25212287
25222288 iwl_mvm_recalc_multicast(mvm);
2523− iwl_mvm_configure_bcast_filter(mvm);
25242289
25252290 /* reset rssi values */
25262291 mvmvif->bf_data.ave_beacon_signal = 0;
@@ -2570,11 +2335,6 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm, · 43 unmodified lines
25702335 }
25712336 }
25722337
2573− if (changes & BSS_CHANGED_ARP_FILTER) {
2574− IWL_DEBUG_MAC80211(mvm, "arp filter changed\n");
2575− iwl_mvm_configure_bcast_filter(mvm);
2576− }
2577−
25782338 if (changes & BSS_CHANGED_BANDWIDTH)
25792339 iwl_mvm_apply_fw_smps_request(vif);
25802340 }
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h+1−14
@@ -884,17 +884,6 @@ struct iwl_mvm { · 883 unmodified lines
884884 /* rx chain antennas set through debugfs for the scan command */
885885 u8 scan_rx_ant;
886886
887−#ifdef CONFIG_IWLWIFI_BCAST_FILTERING
888− /* broadcast filters to configure for each associated station */
889− const struct iwl_fw_bcast_filter *bcast_filters;
890−#ifdef CONFIG_IWLWIFI_DEBUGFS
891− struct {
892− bool override;
893− struct iwl_bcast_filter_cmd cmd;
894− } dbgfs_bcast_filtering;
895−#endif
896−#endif
897−
898887 /* Internal station */
899888 struct iwl_mvm_int_sta aux_sta;
900889 struct iwl_mvm_int_sta snif_sta;
@@ -1593,8 +1582,6 @@ int iwl_mvm_up(struct iwl_mvm *mvm); · 692 unmodified lines
15931582 int iwl_mvm_load_d3_fw(struct iwl_mvm *mvm);
15941583
15951584 int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm);
1596−bool iwl_mvm_bcast_filter_build_cmd(struct iwl_mvm *mvm,
1597− struct iwl_bcast_filter_cmd *cmd);
15981585
15991586 /*
16001587 * FW notifications / CMD responses handlers
@@ -2225,7 +2212,7 @@ static inline void iwl_mvm_mei_device_down(struct iwl_mvm *mvm) · 624 unmodified lines
22252212 static inline void iwl_mvm_mei_set_sw_rfkill_state(struct iwl_mvm *mvm)
22262213 {
22272214 bool sw_rfkill =
2228− mvm->hw_registered ? rfkill_blocked(mvm->hw->wiphy->rfkill) : false;
2215+ mvm->hw_registered ? rfkill_soft_blocked(mvm->hw->wiphy->rfkill) : false;
22292216
22302217 if (mvm->mei_registered)
22312218 iwl_mei_set_rfkill_state(iwl_mvm_is_radio_killed(mvm),
drivers/net/wireless/intel/iwlwifi/mvm/ops.c+0−1
@@ -469,7 +469,6 @@ static const struct iwl_hcmd_names iwl_mvm_legacy_names[] = { · 468 unmodified lines
469469 HCMD_NAME(MCC_CHUB_UPDATE_CMD),
470470 HCMD_NAME(MARKER_CMD),
471471 HCMD_NAME(BT_PROFILE_NOTIFICATION),
472− HCMD_NAME(BCAST_FILTER_CMD),
473472 HCMD_NAME(MCAST_FILTER_CMD),
474473 HCMD_NAME(REPLY_SF_CFG_CMD),
475474 HCMD_NAME(REPLY_BEACON_FILTERING_CMD),
drivers/net/wireless/intel/iwlwifi/mvm/tx.c+1−1
@@ -1427,7 +1427,7 @@ static void iwl_mvm_hwrate_to_tx_status(const struct iwl_fw *fw, · 1426 unmodified lines
14271427 struct ieee80211_tx_rate *r = &info->status.rates[0];
14281428
14291429 if (iwl_fw_lookup_notif_ver(fw, LONG_GROUP,
1430− TX_CMD, 0) > 6)
1430+ TX_CMD, 0) <= 6)
14311431 rate_n_flags = iwl_new_rate_from_v1(rate_n_flags);
14321432
14331433 info->status.antenna =
drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c+1−2
@@ -385,8 +385,7 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, · 384 unmodified lines
385385 /* This may fail if AMT took ownership of the device */
386386 if (iwl_pcie_prepare_card_hw(trans)) {
387387 IWL_WARN(trans, "Exit HW not ready\n");
388− ret = -EIO;
389− goto out;
388+ return -EIO;
390389 }
391390
392391 iwl_enable_rfkill_int(trans);
drivers/net/wireless/intel/iwlwifi/pcie/trans.c+1−2
@@ -1329,8 +1329,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, · 1328 unmodified lines
13291329 /* This may fail if AMT took ownership of the device */
13301330 if (iwl_pcie_prepare_card_hw(trans)) {
13311331 IWL_WARN(trans, "Exit HW not ready\n");
1332− ret = -EIO;
1333− goto out;
1332+ return -EIO;
13341333 }
13351334
13361335 iwl_enable_rfkill_int(trans);
drivers/net/wireless/mac80211_hwsim.c+13−0
@@ -2336,6 +2336,15 @@ static void hw_scan_work(struct work_struct *work) · 2335 unmodified lines
23362336 if (req->ie_len)
23372337 skb_put_data(probe, req->ie, req->ie_len);
23382338
2339+ if (!ieee80211_tx_prepare_skb(hwsim->hw,
2340+ hwsim->hw_scan_vif,
2341+ probe,
2342+ hwsim->tmp_chan->band,
2343+ NULL)) {
2344+ kfree_skb(probe);
2345+ continue;
2346+ }
2347+
23392348 local_bh_disable();
23402349 mac80211_hwsim_tx_frame(hwsim->hw, probe,
23412350 hwsim->tmp_chan);
@@ -3770,6 +3779,10 @@ static int hwsim_tx_info_frame_received_nl(struct sk_buff *skb_2, · 1428 unmodified lines
37703779 }
37713780 txi->flags |= IEEE80211_TX_STAT_ACK;
37723781 }
3782+
3783+ if (hwsim_flags & HWSIM_TX_CTL_NO_ACK)
3784+ txi->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
3785+
37733786 ieee80211_tx_status_irqsafe(data2->hw, skb);
37743787 return 0;
37753788 out:
drivers/net/xen-netback/xenbus.c+5−9
@@ -256,6 +256,7 @@ static void backend_disconnect(struct backend_info *be) · 255 unmodified lines
256256 unsigned int queue_index;
257257
258258 xen_unregister_watchers(vif);
259+ xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status");
259260 #ifdef CONFIG_DEBUG_FS
260261 xenvif_debugfs_delif(vif);
261262 #endif /* CONFIG_DEBUG_FS */
@@ -675,7 +676,6 @@ static void hotplug_status_changed(struct xenbus_watch *watch, · 413 unmodified lines
675676
676677 /* Not interested in this watch anymore. */
677678 unregister_hotplug_status_watch(be);
678− xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status");
679679 }
680680 kfree(str);
681681 }
@@ -824,15 +824,11 @@ static void connect(struct backend_info *be) · 142 unmodified lines
824824 xenvif_carrier_on(be->vif);
825825
826826 unregister_hotplug_status_watch(be);
827− if (xenbus_exists(XBT_NIL, dev->nodename, "hotplug-status")) {
828− err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch,
829− NULL, hotplug_status_changed,
830− "%s/%s", dev->nodename,
831− "hotplug-status");
832− if (err)
833− goto err;
827+ err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL,
828+ hotplug_status_changed,
829+ "%s/%s", dev->nodename, "hotplug-status");
830+ if (!err)
834831 be->have_hotplug_status_watch = 1;
835− }
836832
837833 netif_tx_wake_all_queues(be->vif->dev);
838834
drivers/nvme/host/core.c+9−12
@@ -1723,7 +1723,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ctrl, struct nvme_ns *ns, · 1722 unmodified lines
17231723 return 0;
17241724 }
17251725
1726−static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
1726+static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
17271727 {
17281728 struct nvme_ctrl *ctrl = ns->ctrl;
17291729
@@ -1739,7 +1739,8 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 9 unmodified lines
17391739
17401740 ns->features &= ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS);
17411741 if (!ns->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED))
1742− return 0;
1742+ return;
1743+
17431744 if (ctrl->ops->flags & NVME_F_FABRICS) {
17441745 /*
17451746 * The NVMe over Fabrics specification only supports metadata as
@@ -1747,7 +1748,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 1 unmodified line
17471748 * remap the separate metadata buffer from the block layer.
17481749 */
17491750 if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT)))
1750− return -EINVAL;
1751+ return;
17511752
17521753 ns->features |= NVME_NS_EXT_LBAS;
17531754
@@ -1774,8 +1775,6 @@ static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id) · 20 unmodified lines
17741775 else
17751776 ns->features |= NVME_NS_METADATA_SUPPORTED;
17761777 }
1777−
1778− return 0;
17791778 }
17801779
17811780 static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
@@ -1916,9 +1915,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · 134 unmodified lines
19161915 ns->lba_shift = id->lbaf[lbaf].ds;
19171916 nvme_set_queue_limits(ns->ctrl, ns->queue);
19181917
1919− ret = nvme_configure_metadata(ns, id);
1920− if (ret)
1921− goto out_unfreeze;
1918+ nvme_configure_metadata(ns, id);
19221919 nvme_set_chunk_sectors(ns, id);
19231920 nvme_update_disk_info(ns->disk, ns, id);
19241921
@@ -1934,7 +1931,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · 9 unmodified lines
19341931 if (blk_queue_is_zoned(ns->queue)) {
19351932 ret = nvme_revalidate_zones(ns);
19361933 if (ret && !nvme_first_scan(ns->disk))
1937− goto out;
1934+ return ret;
19381935 }
19391936
19401937 if (nvme_ns_head_multipath(ns->head)) {
@@ -1949,16 +1946,16 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_id_ns *id) · 8 unmodified lines
19491946 return 0;
19501947
19511948 out_unfreeze:
1952− blk_mq_unfreeze_queue(ns->disk->queue);
1953−out:
19541949 /*
19551950 * If probing fails due an unsupported feature, hide the block device,
19561951 * but still allow other access.
19571952 */
19581953 if (ret == -ENODEV) {
19591954 ns->disk->flags |= GENHD_FL_HIDDEN;
1955+ set_bit(NVME_NS_READY, &ns->flags);
19601956 ret = 0;
19611957 }
1958+ blk_mq_unfreeze_queue(ns->disk->queue);
19621959 return ret;
19631960 }
19641961
@@ -4574,7 +4571,7 @@ static void nvme_set_queue_dying(struct nvme_ns *ns) · 2609 unmodified lines
45744571 if (test_and_set_bit(NVME_NS_DEAD, &ns->flags))
45754572 return;
45764573
4577− blk_set_queue_dying(ns->queue);
4574+ blk_mark_disk_dead(ns->disk);
45784575 nvme_start_ns_queue(ns);
45794576
45804577 set_capacity_and_notify(ns->disk, 0);
drivers/nvme/host/multipath.c+1−1
@@ -848,7 +848,7 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head) · 847 unmodified lines
848848 {
849849 if (!head->disk)
850850 return;
851− blk_set_queue_dying(head->disk->queue);
851+ blk_mark_disk_dead(head->disk);
852852 /* make sure all pending bios are cleaned up */
853853 kblockd_schedule_work(&head->requeue_work);
854854 flush_work(&head->requeue_work);
drivers/nvme/host/tcp.c+49−14
@@ -44,6 +44,8 @@ struct nvme_tcp_request { · 43 unmodified lines
4444 u32 data_len;
4545 u32 pdu_len;
4646 u32 pdu_sent;
47+ u32 h2cdata_left;
48+ u32 h2cdata_offset;
4749 u16 ttag;
4850 __le16 status;
4951 struct list_head entry;
@@ -95,6 +97,7 @@ struct nvme_tcp_queue { · 45 unmodified lines
9597 struct nvme_tcp_request *request;
9698
9799 int queue_size;
100+ u32 maxh2cdata;
98101 size_t cmnd_capsule_len;
99102 struct nvme_tcp_ctrl *ctrl;
100103 unsigned long flags;
@@ -572,23 +575,26 @@ static int nvme_tcp_handle_comp(struct nvme_tcp_queue *queue, · 471 unmodified lines
572575 return ret;
573576 }
574577
575−static void nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req,
576− struct nvme_tcp_r2t_pdu *pdu)
578+static void nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req)
577579 {
578580 struct nvme_tcp_data_pdu *data = req->pdu;
579581 struct nvme_tcp_queue *queue = req->queue;
580582 struct request *rq = blk_mq_rq_from_pdu(req);
583+ u32 h2cdata_sent = req->pdu_len;
581584 u8 hdgst = nvme_tcp_hdgst_len(queue);
582585 u8 ddgst = nvme_tcp_ddgst_len(queue);
583586
584587 req->state = NVME_TCP_SEND_H2C_PDU;
585588 req->offset = 0;
586− req->pdu_len = le32_to_cpu(pdu->r2t_length);
589+ req->pdu_len = min(req->h2cdata_left, queue->maxh2cdata);
587590 req->pdu_sent = 0;
591+ req->h2cdata_left -= req->pdu_len;
592+ req->h2cdata_offset += h2cdata_sent;
588593
589594 memset(data, 0, sizeof(*data));
590595 data->hdr.type = nvme_tcp_h2c_data;
591− data->hdr.flags = NVME_TCP_F_DATA_LAST;
596+ if (!req->h2cdata_left)
597+ data->hdr.flags = NVME_TCP_F_DATA_LAST;
592598 if (queue->hdr_digest)
593599 data->hdr.flags |= NVME_TCP_F_HDGST;
594600 if (queue->data_digest)
@@ -597,9 +603,9 @@ static void nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req, · 2 unmodified lines
597603 data->hdr.pdo = data->hdr.hlen + hdgst;
598604 data->hdr.plen =
599605 cpu_to_le32(data->hdr.hlen + hdgst + req->pdu_len + ddgst);
600− data->ttag = pdu->ttag;
606+ data->ttag = req->ttag;
601607 data->command_id = nvme_cid(rq);
602− data->data_offset = pdu->r2t_offset;
608+ data->data_offset = cpu_to_le32(req->h2cdata_offset);
603609 data->data_length = cpu_to_le32(req->pdu_len);
604610 }
605611
@@ -609,6 +615,7 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, · 3 unmodified lines
609615 struct nvme_tcp_request *req;
610616 struct request *rq;
611617 u32 r2t_length = le32_to_cpu(pdu->r2t_length);
618+ u32 r2t_offset = le32_to_cpu(pdu->r2t_offset);
612619
613620 rq = nvme_find_rq(nvme_tcp_tagset(queue), pdu->command_id);
614621 if (!rq) {
@@ -633,14 +640,19 @@ static int nvme_tcp_handle_r2t(struct nvme_tcp_queue *queue, · 18 unmodified lines
633640 return -EPROTO;
634641 }
635642
636− if (unlikely(le32_to_cpu(pdu->r2t_offset) < req->data_sent)) {
643+ if (unlikely(r2t_offset < req->data_sent)) {
637644 dev_err(queue->ctrl->ctrl.device,
638645 "req %d unexpected r2t offset %u (expected %zu)\n",
639− rq->tag, le32_to_cpu(pdu->r2t_offset), req->data_sent);
646+ rq->tag, r2t_offset, req->data_sent);
640647 return -EPROTO;
641648 }
642649
643− nvme_tcp_setup_h2c_data_pdu(req, pdu);
650+ req->pdu_len = 0;
651+ req->h2cdata_left = r2t_length;
652+ req->h2cdata_offset = r2t_offset;
653+ req->ttag = pdu->ttag;
654+
655+ nvme_tcp_setup_h2c_data_pdu(req);
644656 nvme_tcp_queue_request(req, false, true);
645657
646658 return 0;
@@ -928,6 +940,7 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) · 281 unmodified lines
928940 {
929941 struct nvme_tcp_queue *queue = req->queue;
930942 int req_data_len = req->data_len;
943+ u32 h2cdata_left = req->h2cdata_left;
931944
932945 while (true) {
933946 struct page *page = nvme_tcp_req_cur_page(req);
@@ -972,7 +985,10 @@ static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) · 38 unmodified lines
972985 req->state = NVME_TCP_SEND_DDGST;
973986 req->offset = 0;
974987 } else {
975− nvme_tcp_done_send_req(queue);
988+ if (h2cdata_left)
989+ nvme_tcp_setup_h2c_data_pdu(req);
990+ else
991+ nvme_tcp_done_send_req(queue);
976992 }
977993 return 1;
978994 }
@@ -1030,9 +1046,14 @@ static int nvme_tcp_try_send_data_pdu(struct nvme_tcp_request *req) · 51 unmodified lines
10301046 if (queue->hdr_digest && !req->offset)
10311047 nvme_tcp_hdgst(queue->snd_hash, pdu, sizeof(*pdu));
10321048
1033− ret = kernel_sendpage(queue->sock, virt_to_page(pdu),
1034− offset_in_page(pdu) + req->offset, len,
1035− MSG_DONTWAIT | MSG_MORE | MSG_SENDPAGE_NOTLAST);
1049+ if (!req->h2cdata_left)
1050+ ret = kernel_sendpage(queue->sock, virt_to_page(pdu),
1051+ offset_in_page(pdu) + req->offset, len,
1052+ MSG_DONTWAIT | MSG_MORE | MSG_SENDPAGE_NOTLAST);
1053+ else
1054+ ret = sock_no_sendpage(queue->sock, virt_to_page(pdu),
1055+ offset_in_page(pdu) + req->offset, len,
1056+ MSG_DONTWAIT | MSG_MORE);
10361057 if (unlikely(ret <= 0))
10371058 return ret;
10381059
@@ -1052,6 +1073,7 @@ static int nvme_tcp_try_send_ddgst(struct nvme_tcp_request *req) · 13 unmodified lines
10521073 {
10531074 struct nvme_tcp_queue *queue = req->queue;
10541075 size_t offset = req->offset;
1076+ u32 h2cdata_left = req->h2cdata_left;
10551077 int ret;
10561078 struct msghdr msg = { .msg_flags = MSG_DONTWAIT };
10571079 struct kvec iov = {
@@ -1069,7 +1091,10 @@ static int nvme_tcp_try_send_ddgst(struct nvme_tcp_request *req) · 11 unmodified lines
10691091 return ret;
10701092
10711093 if (offset + ret == NVME_TCP_DIGEST_LENGTH) {
1072− nvme_tcp_done_send_req(queue);
1094+ if (h2cdata_left)
1095+ nvme_tcp_setup_h2c_data_pdu(req);
1096+ else
1097+ nvme_tcp_done_send_req(queue);
10731098 return 1;
10741099 }
10751100
@@ -1261,6 +1286,7 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) · 185 unmodified lines
12611286 struct msghdr msg = {};
12621287 struct kvec iov;
12631288 bool ctrl_hdgst, ctrl_ddgst;
1289+ u32 maxh2cdata;
12641290 int ret;
12651291
12661292 icreq = kzalloc(sizeof(*icreq), GFP_KERNEL);
@@ -1344,6 +1370,14 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) · 77 unmodified lines
13441370 goto free_icresp;
13451371 }
13461372
1373+ maxh2cdata = le32_to_cpu(icresp->maxdata);
1374+ if ((maxh2cdata % 4) || (maxh2cdata < NVME_TCP_MIN_MAXH2CDATA)) {
1375+ pr_err("queue %d: invalid maxh2cdata returned %u\n",
1376+ nvme_tcp_queue_id(queue), maxh2cdata);
1377+ goto free_icresp;
1378+ }
1379+ queue->maxh2cdata = maxh2cdata;
1380+
13471381 ret = 0;
13481382 free_icresp:
13491383 kfree(icresp);
@@ -2329,6 +2363,7 @@ static blk_status_t nvme_tcp_setup_cmd_pdu(struct nvme_ns *ns, · 979 unmodified lines
23292363 req->data_sent = 0;
23302364 req->pdu_len = 0;
23312365 req->pdu_sent = 0;
2366+ req->h2cdata_left = 0;
23322367 req->data_len = blk_rq_nr_phys_segments(rq) ?
23332368 blk_rq_payload_bytes(rq) : 0;
23342369 req->curr_bio = rq->bio;
drivers/nvmem/core.c+1−1
@@ -771,7 +771,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) · 770 unmodified lines
771771
772772 if (config->wp_gpio)
773773 nvmem->wp_gpio = config->wp_gpio;
774− else
774+ else if (!config->ignore_wp)
775775 nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
776776 GPIOD_OUT_HIGH);
777777 if (IS_ERR(nvmem->wp_gpio)) {
drivers/of/fdt.c+1−1
@@ -648,8 +648,8 @@ void __init early_init_fdt_scan_reserved_mem(void) · 647 unmodified lines
648648 }
649649
650650 fdt_scan_reserved_mem();
651− fdt_init_reserved_mem();
652651 fdt_reserve_elfcorehdr();
652+ fdt_init_reserved_mem();
653653 }
654654
655655 /**
drivers/of/unittest.c+8−8
@@ -513,24 +513,24 @@ static void __init of_unittest_parse_phandle_with_args(void) · 512 unmodified lines
513513 memset(&args, 0, sizeof(args));
514514
515515 EXPECT_BEGIN(KERN_INFO,
516− "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
516+ "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
517517
518518 rc = of_parse_phandle_with_args(np, "phandle-list-bad-args",
519519 "#phandle-cells", 1, &args);
520520
521521 EXPECT_END(KERN_INFO,
522− "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
522+ "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
523523
524524 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
525525
526526 EXPECT_BEGIN(KERN_INFO,
527− "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
527+ "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
528528
529529 rc = of_count_phandle_with_args(np, "phandle-list-bad-args",
530530 "#phandle-cells");
531531
532532 EXPECT_END(KERN_INFO,
533− "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
533+ "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
534534
535535 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
536536 }
@@ -670,12 +670,12 @@ static void __init of_unittest_parse_phandle_with_args_map(void) · 133 unmodified lines
670670 memset(&args, 0, sizeof(args));
671671
672672 EXPECT_BEGIN(KERN_INFO,
673− "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1");
673+ "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1");
674674
675675 rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args",
676676 "phandle", 1, &args);
677677 EXPECT_END(KERN_INFO,
678− "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1");
678+ "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1");
679679
680680 unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
681681 }
@@ -1257,12 +1257,12 @@ static void __init of_unittest_platform_populate(void) · 575 unmodified lines
12571257 unittest(pdev, "device 2 creation failed\n");
12581258
12591259 EXPECT_BEGIN(KERN_INFO,
1260− "platform testcase-data:testcase-device2: IRQ index 0 not found");
1260+ "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found");
12611261
12621262 irq = platform_get_irq(pdev, 0);
12631263
12641264 EXPECT_END(KERN_INFO,
1265− "platform testcase-data:testcase-device2: IRQ index 0 not found");
1265+ "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found");
12661266
12671267 unittest(irq < 0 && irq != -EPROBE_DEFER,
12681268 "device parsing error failed - %d\n", irq);
drivers/parisc/ccio-dma.c+2−1
@@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 1002 unmodified lines
10031003 ioc->usg_calls++;
10041004 #endif
10051005
1006− while(sg_dma_len(sglist) && nents--) {
1006+ while (nents && sg_dma_len(sglist)) {
10071007
10081008 #ifdef CCIO_COLLECT_STATS
10091009 ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT;
@@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 1 unmodified line
10111011 ccio_unmap_page(dev, sg_dma_address(sglist),
10121012 sg_dma_len(sglist), direction, 0);
10131013 ++sglist;
1014+ nents--;
10141015 }
10151016
10161017 DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
drivers/parisc/sba_iommu.c+2−1
@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 1046 unmodified lines
10471047 spin_unlock_irqrestore(&ioc->res_lock, flags);
10481048 #endif
10491049
1050− while (sg_dma_len(sglist) && nents--) {
1050+ while (nents && sg_dma_len(sglist)) {
10511051
10521052 sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist),
10531053 direction, 0);
@@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, · 2 unmodified lines
10561056 ioc->usingle_calls--; /* kluge since call is unmap_sg() */
10571057 #endif
10581058 ++sglist;
1059+ nents--;
10591060 }
10601061
10611062 DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents);
drivers/pci/controller/pci-hyperv.c+11−2
@@ -2155,8 +2155,17 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) · 2154 unmodified lines
21552155 if (!hv_dev)
21562156 continue;
21572157
2158− if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY)
2159− set_dev_node(&dev->dev, hv_dev->desc.virtual_numa_node);
2158+ if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY &&
2159+ hv_dev->desc.virtual_numa_node < num_possible_nodes())
2160+ /*
2161+ * The kernel may boot with some NUMA nodes offline
2162+ * (e.g. in a KDUMP kernel) or with NUMA disabled via
2163+ * "numa=off". In those cases, adjust the host provided
2164+ * NUMA node to a valid NUMA node used by the kernel.
2165+ */
2166+ set_dev_node(&dev->dev,
2167+ numa_map_to_online_node(
2168+ hv_dev->desc.virtual_numa_node));
21602169
21612170 put_pcichild(hv_dev);
21622171 }
drivers/pci/controller/pci-mvebu.c+2−1
@@ -1329,7 +1329,8 @@ static int mvebu_pcie_probe(struct platform_device *pdev) · 1328 unmodified lines
13291329 * indirectly via kernel emulated PCI bridge driver.
13301330 */
13311331 mvebu_pcie_setup_hw(port);
1332− mvebu_pcie_set_local_dev_nr(port, 0);
1332+ mvebu_pcie_set_local_dev_nr(port, 1);
1333+ mvebu_pcie_set_local_bus_nr(port, 0);
13331334 }
13341335
13351336 pcie->nports = i;
drivers/pci/controller/vmd.c+7−7
@@ -99,11 +99,13 @@ struct vmd_irq { · 98 unmodified lines
9999 * @srcu: SRCU struct for local synchronization.
100100 * @count: number of child IRQs assigned to this vector; used to track
101101 * sharing.
102+ * @virq: The underlying VMD Linux interrupt number
102103 */
103104 struct vmd_irq_list {
104105 struct list_head irq_list;
105106 struct srcu_struct srcu;
106107 unsigned int count;
108+ unsigned int virq;
107109 };
108110
109111 struct vmd_dev {
@@ -253,7 +255,6 @@ static int vmd_msi_init(struct irq_domain *domain, struct msi_domain_info *info, · 143 unmodified lines
253255 struct msi_desc *desc = arg->desc;
254256 struct vmd_dev *vmd = vmd_from_bus(msi_desc_to_pci_dev(desc)->bus);
255257 struct vmd_irq *vmdirq = kzalloc(sizeof(*vmdirq), GFP_KERNEL);
256− unsigned int index, vector;
257258
258259 if (!vmdirq)
259260 return -ENOMEM;
@@ -261,10 +262,8 @@ static int vmd_msi_init(struct irq_domain *domain, struct msi_domain_info *info, · 1 unmodified line
261262 INIT_LIST_HEAD(&vmdirq->node);
262263 vmdirq->irq = vmd_next_irq(vmd, desc);
263264 vmdirq->virq = virq;
264− index = index_from_irqs(vmd, vmdirq->irq);
265− vector = pci_irq_vector(vmd->dev, index);
266265
267− irq_domain_set_info(domain, virq, vector, info->chip, vmdirq,
266+ irq_domain_set_info(domain, virq, vmdirq->irq->virq, info->chip, vmdirq,
268267 handle_untracked_irq, vmd, NULL);
269268 return 0;
270269 }
@@ -685,7 +684,8 @@ static int vmd_alloc_irqs(struct vmd_dev *vmd) · 414 unmodified lines
685684 return err;
686685
687686 INIT_LIST_HEAD(&vmd->irqs[i].irq_list);
688− err = devm_request_irq(&dev->dev, pci_irq_vector(dev, i),
687+ vmd->irqs[i].virq = pci_irq_vector(dev, i);
688+ err = devm_request_irq(&dev->dev, vmd->irqs[i].virq,
689689 vmd_irq, IRQF_NO_THREAD,
690690 vmd->name, &vmd->irqs[i]);
691691 if (err)
@@ -969,7 +969,7 @@ static int vmd_suspend(struct device *dev) · 277 unmodified lines
969969 int i;
970970
971971 for (i = 0; i < vmd->msix_count; i++)
972− devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
972+ devm_free_irq(dev, vmd->irqs[i].virq, &vmd->irqs[i]);
973973
974974 return 0;
975975 }
@@ -981,7 +981,7 @@ static int vmd_resume(struct device *dev) · 5 unmodified lines
981981 int err, i;
982982
983983 for (i = 0; i < vmd->msix_count; i++) {
984− err = devm_request_irq(dev, pci_irq_vector(pdev, i),
984+ err = devm_request_irq(dev, vmd->irqs[i].virq,
985985 vmd_irq, IRQF_NO_THREAD,
986986 vmd->name, &vmd->irqs[i]);
987987 if (err)
drivers/pci/quirks.c+9−5
@@ -5344,11 +5344,6 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); · 5343 unmodified lines
53445344 */
53455345 static void quirk_amd_harvest_no_ats(struct pci_dev *pdev)
53465346 {
5347− if ((pdev->device == 0x7312 && pdev->revision != 0x00) ||
5348− (pdev->device == 0x7340 && pdev->revision != 0xc5) ||
5349− (pdev->device == 0x7341 && pdev->revision != 0x00))
5350− return;
5351−
53525347 if (pdev->device == 0x15d8) {
53535348 if (pdev->revision == 0xcf &&
53545349 pdev->subsystem_vendor == 0xea50 &&
@@ -5370,10 +5365,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4, quirk_amd_harvest_no_ats); · 15 unmodified lines
53705365 /* AMD Iceland dGPU */
53715366 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats);
53725367 /* AMD Navi10 dGPU */
5368+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7310, quirk_amd_harvest_no_ats);
53735369 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats);
5370+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7318, quirk_amd_harvest_no_ats);
5371+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7319, quirk_amd_harvest_no_ats);
5372+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731a, quirk_amd_harvest_no_ats);
5373+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731b, quirk_amd_harvest_no_ats);
5374+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731e, quirk_amd_harvest_no_ats);
5375+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x731f, quirk_amd_harvest_no_ats);
53745376 /* AMD Navi14 dGPU */
53755377 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats);
53765378 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats);
5379+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7347, quirk_amd_harvest_no_ats);
5380+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x734f, quirk_amd_harvest_no_ats);
53775381 /* AMD Raven platform iGPU */
53785382 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x15d8, quirk_amd_harvest_no_ats);
53795383 #endif /* CONFIG_PCI_ATS */
drivers/pinctrl/intel/pinctrl-tigerlake.c+0−1
@@ -749,7 +749,6 @@ static const struct acpi_device_id tgl_pinctrl_acpi_match[] = { · 748 unmodified lines
749749 { "INT34C5", (kernel_ulong_t)&tgllp_soc_data },
750750 { "INT34C6", (kernel_ulong_t)&tglh_soc_data },
751751 { "INTC1055", (kernel_ulong_t)&tgllp_soc_data },
752− { "INTC1057", (kernel_ulong_t)&tgllp_soc_data },
753752 { }
754753 };
755754 MODULE_DEVICE_TABLE(acpi, tgl_pinctrl_acpi_match);
drivers/pinctrl/pinctrl-k210.c+2−2
@@ -482,7 +482,7 @@ static int k210_pinconf_get_drive(unsigned int max_strength_ua) · 481 unmodified lines
482482 {
483483 int i;
484484
485− for (i = K210_PC_DRIVE_MAX; i; i--) {
485+ for (i = K210_PC_DRIVE_MAX; i >= 0; i--) {
486486 if (k210_pinconf_drive_strength[i] <= max_strength_ua)
487487 return i;
488488 }
@@ -527,7 +527,7 @@ static int k210_pinconf_set_param(struct pinctrl_dev *pctldev, · 38 unmodified lines
527527 case PIN_CONFIG_BIAS_PULL_UP:
528528 if (!arg)
529529 return -EINVAL;
530− val |= K210_PC_PD;
530+ val |= K210_PC_PU;
531531 break;
532532 case PIN_CONFIG_DRIVE_STRENGTH:
533533 arg *= 1000;
drivers/pinctrl/pinctrl-starfive.c+1−1
@@ -1164,6 +1164,7 @@ static int starfive_irq_set_type(struct irq_data *d, unsigned int trigger) · 1163 unmodified lines
11641164 }
11651165
11661166 static struct irq_chip starfive_irq_chip = {
1167+ .name = "StarFive GPIO",
11671168 .irq_ack = starfive_irq_ack,
11681169 .irq_mask = starfive_irq_mask,
11691170 .irq_mask_ack = starfive_irq_mask_ack,
@@ -1308,7 +1309,6 @@ static int starfive_probe(struct platform_device *pdev) · 138 unmodified lines
13081309 sfp->gc.ngpio = NR_GPIOS;
13091310
13101311 starfive_irq_chip.parent_device = dev;
1311− starfive_irq_chip.name = sfp->gc.label;
13121312
13131313 sfp->gc.irq.chip = &starfive_irq_chip;
13141314 sfp->gc.irq.parent_handler = starfive_gpio_irq_handler;
drivers/platform/surface/surface3_power.c+10−3
@@ -232,14 +232,21 @@ static int mshw0011_bix(struct mshw0011_data *cdata, struct bix *bix) · 231 unmodified lines
232232 }
233233 bix->last_full_charg_capacity = ret;
234234
235− /* get serial number */
235+ /*
236+ * Get serial number, on some devices (with unofficial replacement
237+ * battery?) reading any of the serial number range addresses gets
238+ * nacked in this case just leave the serial number empty.
239+ */
236240 ret = i2c_smbus_read_i2c_block_data(client, MSHW0011_BAT0_REG_SERIAL_NO,
237241 sizeof(buf), buf);
238− if (ret != sizeof(buf)) {
242+ if (ret == -EREMOTEIO) {
243+ /* no serial number available */
244+ } else if (ret != sizeof(buf)) {
239245 dev_err(&client->dev, "Error reading serial no: %d\n", ret);
240246 return ret;
247+ } else {
248+ snprintf(bix->serial, ARRAY_SIZE(bix->serial), "%3pE%6pE", buf + 7, buf);
241249 }
242− snprintf(bix->serial, ARRAY_SIZE(bix->serial), "%3pE%6pE", buf + 7, buf);
243250
244251 /* get cycle count */
245252 ret = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_CYCLE_CNT);
drivers/platform/x86/amd-pmc.c+33−9
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/module.h>
2222 #include <linux/pci.h>
2323 #include <linux/platform_device.h>
24+#include <linux/pm_qos.h>
2425 #include <linux/rtc.h>
2526 #include <linux/suspend.h>
2627 #include <linux/seq_file.h>
@@ -85,6 +86,9 @@ · 58 unmodified lines
8586 #define PMC_MSG_DELAY_MIN_US 50
8687 #define RESPONSE_REGISTER_LOOP_MAX 20000
8788
89+/* QoS request for letting CPUs in idle states, but not the deepest */
90+#define AMD_PMC_MAX_IDLE_STATE_LATENCY 3
91+
8892 #define SOC_SUBSYSTEM_IP_MAX 12
8993 #define DELAY_MIN_US 2000
9094 #define DELAY_MAX_US 3000
@@ -131,6 +135,7 @@ struct amd_pmc_dev { · 40 unmodified lines
131135 struct device *dev;
132136 struct pci_dev *rdev;
133137 struct mutex lock; /* generic mutex lock */
138+ struct pm_qos_request amd_pmc_pm_qos_req;
134139 #if IS_ENABLED(CONFIG_DEBUG_FS)
135140 struct dentry *dbgfs_dir;
136141 #endif /* CONFIG_DEBUG_FS */
@@ -521,6 +526,14 @@ static int amd_pmc_verify_czn_rtc(struct amd_pmc_dev *pdev, u32 *arg) · 384 unmodified lines
521526 rc = rtc_alarm_irq_enable(rtc_device, 0);
522527 dev_dbg(pdev->dev, "wakeup timer programmed for %lld seconds\n", duration);
523528
529+ /*
530+ * Prevent CPUs from getting into deep idle states while sending OS_HINT
531+ * which is otherwise generally safe to send when at least one of the CPUs
532+ * is not in deep idle states.
533+ */
534+ cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req, AMD_PMC_MAX_IDLE_STATE_LATENCY);
535+ wake_up_all_idle_cpus();
536+
524537 return rc;
525538 }
526539
@@ -538,24 +551,31 @@ static int __maybe_unused amd_pmc_suspend(struct device *dev) · 11 unmodified lines
538551 /* Activate CZN specific RTC functionality */
539552 if (pdev->cpu_id == AMD_CPU_ID_CZN) {
540553 rc = amd_pmc_verify_czn_rtc(pdev, &arg);
541− if (rc < 0)
542− return rc;
554+ if (rc)
555+ goto fail;
543556 }
544557
545558 /* Dump the IdleMask before we send hint to SMU */
546559 amd_pmc_idlemask_read(pdev, dev, NULL);
547560 msg = amd_pmc_get_os_hint(pdev);
548561 rc = amd_pmc_send_cmd(pdev, arg, NULL, msg, 0);
549− if (rc)
562+ if (rc) {
550563 dev_err(pdev->dev, "suspend failed\n");
564+ goto fail;
565+ }
551566
552567 if (enable_stb)
553568 rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF);
554− if (rc) {
569+ if (rc) {
555570 dev_err(pdev->dev, "error writing to STB\n");
556− return rc;
571+ goto fail;
557572 }
558573
574+ return 0;
575+fail:
576+ if (pdev->cpu_id == AMD_CPU_ID_CZN)
577+ cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req,
578+ PM_QOS_DEFAULT_VALUE);
559579 return rc;
560580 }
561581
@@ -579,12 +599,15 @@ static int __maybe_unused amd_pmc_resume(struct device *dev) · 17 unmodified lines
579599 /* Write data incremented by 1 to distinguish in stb_read */
580600 if (enable_stb)
581601 rc = amd_pmc_write_stb(pdev, AMD_PMC_STB_PREDEF + 1);
582− if (rc) {
602+ if (rc)
583603 dev_err(pdev->dev, "error writing to STB\n");
584− return rc;
585− }
586604
587− return 0;
605+ /* Restore the QoS request back to defaults if it was set */
606+ if (pdev->cpu_id == AMD_CPU_ID_CZN)
607+ cpu_latency_qos_update_request(&pdev->amd_pmc_pm_qos_req,
608+ PM_QOS_DEFAULT_VALUE);
609+
610+ return rc;
588611 }
589612
590613 static const struct dev_pm_ops amd_pmc_pm_ops = {
@@ -722,6 +745,7 @@ static int amd_pmc_probe(struct platform_device *pdev) · 131 unmodified lines
722745 amd_pmc_get_smu_version(dev);
723746 platform_set_drvdata(pdev, dev);
724747 amd_pmc_dbgfs_register(dev);
748+ cpu_latency_qos_add_request(&dev->amd_pmc_pm_qos_req, PM_QOS_DEFAULT_VALUE);
725749 return 0;
726750
727751 err_pci_dev_put:
drivers/platform/x86/asus-wmi.c+1−1
@@ -2223,7 +2223,7 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available, · 2222 unmodified lines
22232223
22242224 err = fan_curve_get_factory_default(asus, fan_dev);
22252225 if (err) {
2226− if (err == -ENODEV)
2226+ if (err == -ENODEV || err == -ENODATA)
22272227 return 0;
22282228 return err;
22292229 }
drivers/platform/x86/intel/int3472/tps68470_board_data.c+2−1
@@ -100,7 +100,8 @@ static struct gpiod_lookup_table surface_go_tps68470_gpios = { · 99 unmodified lines
100100 .dev_id = "i2c-INT347A:00",
101101 .table = {
102102 GPIO_LOOKUP("tps68470-gpio", 9, "reset", GPIO_ACTIVE_LOW),
103− GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW)
103+ GPIO_LOOKUP("tps68470-gpio", 7, "powerdown", GPIO_ACTIVE_LOW),
104+ { }
104105 }
105106 };
106107
drivers/platform/x86/thinkpad_acpi.c+1−0
@@ -8703,6 +8703,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 8702 unmodified lines
87038703 TPACPI_Q_LNV3('N', '4', '0', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (4nd gen) */
87048704 TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */
87058705 TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */
8706+ TPACPI_Q_LNV3('N', '3', '7', TPACPI_FAN_2CTL), /* T15g (2nd gen) */
87068707 TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */
87078708 };
87088709
drivers/power/supply/bq256xx_charger.c+3−0
@@ -1523,6 +1523,9 @@ static int bq256xx_hw_init(struct bq256xx_device *bq) · 1522 unmodified lines
15231523 BQ256XX_WDT_BIT_SHIFT);
15241524
15251525 ret = power_supply_get_battery_info(bq->charger, &bat_info);
1526+ if (ret == -ENOMEM)
1527+ return ret;
1528+
15261529 if (ret) {
15271530 dev_warn(bq->dev, "battery info missing, default values will be applied\n");
15281531
drivers/power/supply/cw2015_battery.c+1−1
@@ -689,7 +689,7 @@ static int cw_bat_probe(struct i2c_client *client) · 688 unmodified lines
689689 if (ret) {
690690 /* Allocate an empty battery */
691691 cw_bat->battery = devm_kzalloc(&client->dev,
692− sizeof(cw_bat->battery),
692+ sizeof(*cw_bat->battery),
693693 GFP_KERNEL);
694694 if (!cw_bat->battery)
695695 return -ENOMEM;
drivers/regulator/core.c+3−10
@@ -6014,9 +6014,8 @@ core_initcall(regulator_init); · 6013 unmodified lines
60146014 static int regulator_late_cleanup(struct device *dev, void *data)
60156015 {
60166016 struct regulator_dev *rdev = dev_to_rdev(dev);
6017− const struct regulator_ops *ops = rdev->desc->ops;
60186017 struct regulation_constraints *c = rdev->constraints;
6019− int enabled, ret;
6018+ int ret;
60206019
60216020 if (c && c->always_on)
60226021 return 0;
@@ -6029,14 +6028,8 @@ static int regulator_late_cleanup(struct device *dev, void *data) · 6 unmodified lines
60296028 if (rdev->use_count)
60306029 goto unlock;
60316030
6032− /* If we can't read the status assume it's always on. */
6033− if (ops->is_enabled)
6034− enabled = ops->is_enabled(rdev);
6035− else
6036− enabled = 1;
6037−
6038− /* But if reading the status failed, assume that it's off. */
6039− if (enabled <= 0)
6031+ /* If reading the status failed, assume that it's off. */
6032+ if (_regulator_is_enabled(rdev) <= 0)
60406033 goto unlock;
60416034
60426035 if (have_full_constraints()) {
drivers/regulator/da9121-regulator.c+6−10
@@ -87,16 +87,16 @@ static struct da9121_range da9121_3A_1phase_current = { · 86 unmodified lines
8787 };
8888
8989 static struct da9121_range da914x_40A_4phase_current = {
90− .val_min = 14000000,
91− .val_max = 80000000,
92− .val_stp = 2000000,
90+ .val_min = 26000000,
91+ .val_max = 78000000,
92+ .val_stp = 4000000,
9393 .reg_min = 1,
9494 .reg_max = 14,
9595 };
9696
9797 static struct da9121_range da914x_20A_2phase_current = {
98− .val_min = 7000000,
99− .val_max = 40000000,
98+ .val_min = 13000000,
99+ .val_max = 39000000,
100100 .val_stp = 2000000,
101101 .reg_min = 1,
102102 .reg_max = 14,
@@ -561,7 +561,7 @@ static const struct regulator_desc da9217_reg = { · 458 unmodified lines
561561 };
562562
563563 #define DA914X_MIN_MV 500
564−#define DA914X_MAX_MV 1000
564+#define DA914X_MAX_MV 1300
565565 #define DA914X_STEP_MV 10
566566 #define DA914X_MIN_SEL (DA914X_MIN_MV / DA914X_STEP_MV)
567567 #define DA914X_N_VOLTAGES (((DA914X_MAX_MV - DA914X_MIN_MV) / DA914X_STEP_MV) \
@@ -585,10 +585,6 @@ static const struct regulator_desc da9141_reg = { · 17 unmodified lines
585585 .vsel_mask = DA9121_MASK_BUCK_BUCKx_5_CHx_A_VOUT,
586586 .enable_reg = DA9121_REG_BUCK_BUCK1_0,
587587 .enable_mask = DA9121_MASK_BUCK_BUCKx_0_CHx_EN,
588− /* Default value of BUCK_BUCK1_0.CH1_SRC_DVC_UP */
589− .ramp_delay = 20000,
590− /* tBUCK_EN */
591− .enable_time = 20,
592588 };
593589
594590 static const struct regulator_desc da9142_reg = {
drivers/scsi/lpfc/lpfc.h+1−0
@@ -592,6 +592,7 @@ struct lpfc_vport { · 591 unmodified lines
592592 #define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */
593593 #define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */
594594 #define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/
595+#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */
595596 #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
596597 #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
597598 #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
drivers/scsi/lpfc/lpfc_attr.c+3−0
@@ -1315,6 +1315,9 @@ lpfc_issue_lip(struct Scsi_Host *shost) · 1314 unmodified lines
13151315 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK;
13161316 pmboxq->u.mb.mbxOwner = OWN_HOST;
13171317
1318+ if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME))
1319+ vport->fc_flag &= ~FC_PT2PT_NO_NVME;
1320+
13181321 mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2);
13191322
13201323 if ((mbxstatus == MBX_SUCCESS) &&
drivers/scsi/lpfc/lpfc_els.c+19−1
@@ -1072,7 +1072,8 @@ stop_rr_fcf_flogi: · 1071 unmodified lines
10721072
10731073 /* FLOGI failed, so there is no fabric */
10741074 spin_lock_irq(shost->host_lock);
1075− vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
1075+ vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP |
1076+ FC_PT2PT_NO_NVME);
10761077 spin_unlock_irq(shost->host_lock);
10771078
10781079 /* If private loop, then allow max outstanding els to be
@@ -4607,6 +4608,23 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 3528 unmodified lines
46074608 /* Added for Vendor specifc support
46084609 * Just keep retrying for these Rsn / Exp codes
46094610 */
4611+ if ((vport->fc_flag & FC_PT2PT) &&
4612+ cmd == ELS_CMD_NVMEPRLI) {
4613+ switch (stat.un.b.lsRjtRsnCode) {
4614+ case LSRJT_UNABLE_TPC:
4615+ case LSRJT_INVALID_CMD:
4616+ case LSRJT_LOGICAL_ERR:
4617+ case LSRJT_CMD_UNSUPPORTED:
4618+ lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS,
4619+ "0168 NVME PRLI LS_RJT "
4620+ "reason %x port doesn't "
4621+ "support NVME, disabling NVME\n",
4622+ stat.un.b.lsRjtRsnCode);
4623+ retry = 0;
4624+ vport->fc_flag |= FC_PT2PT_NO_NVME;
4625+ goto out_retry;
4626+ }
4627+ }
46104628 switch (stat.un.b.lsRjtRsnCode) {
46114629 case LSRJT_UNABLE_TPC:
46124630 /* The driver has a VALID PLOGI but the rport has
drivers/scsi/lpfc/lpfc_nportdisc.c+3−2
@@ -1961,8 +1961,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, · 1960 unmodified lines
19611961 * is configured try it.
19621962 */
19631963 ndlp->nlp_fc4_type |= NLP_FC4_FCP;
1964− if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) ||
1965− (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
1964+ if ((!(vport->fc_flag & FC_PT2PT_NO_NVME)) &&
1965+ (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH ||
1966+ vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) {
19661967 ndlp->nlp_fc4_type |= NLP_FC4_NVME;
19671968 /* We need to update the localport also */
19681969 lpfc_nvme_update_localport(vport);
drivers/scsi/qedi/qedi_fw.c+2−4
@@ -771,11 +771,10 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 770 unmodified lines
771771 qedi_cmd->list_tmf_work = NULL;
772772 }
773773 }
774+ spin_unlock_bh(&qedi_conn->tmf_work_lock);
774775
775− if (!found) {
776− spin_unlock_bh(&qedi_conn->tmf_work_lock);
776+ if (!found)
777777 goto check_cleanup_reqs;
778− }
779778
780779 QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_SCSI_TM,
781780 "TMF work, cqe->tid=0x%x, tmf flags=0x%x, cid=0x%x\n",
@@ -806,7 +805,6 @@ static void qedi_process_cmd_cleanup_resp(struct qedi_ctx *qedi, · 24 unmodified lines
806805 qedi_cmd->state = CLEANUP_RECV;
807806 unlock:
808807 spin_unlock_bh(&conn->session->back_lock);
809− spin_unlock_bh(&qedi_conn->tmf_work_lock);
810808 wake_up_interruptible(&qedi_conn->wait_queue);
811809 return;
812810
drivers/scsi/ufs/ufshcd.c+1−1
@@ -2681,7 +2681,7 @@ static int ufshcd_map_queues(struct Scsi_Host *shost) · 2680 unmodified lines
26812681 break;
26822682 case HCTX_TYPE_READ:
26832683 map->nr_queues = 0;
2684− break;
2684+ continue;
26852685 default:
26862686 WARN_ON_ONCE(true);
26872687 }
drivers/soc/mediatek/mtk-scpsys.c+4−11
@@ -411,17 +411,12 @@ out: · 410 unmodified lines
411411 return ret;
412412 }
413413
414−static int init_clks(struct platform_device *pdev, struct clk **clk)
414+static void init_clks(struct platform_device *pdev, struct clk **clk)
415415 {
416416 int i;
417417
418− for (i = CLK_NONE + 1; i < CLK_MAX; i++) {
418+ for (i = CLK_NONE + 1; i < CLK_MAX; i++)
419419 clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
420− if (IS_ERR(clk[i]))
421− return PTR_ERR(clk[i]);
422− }
423−
424− return 0;
425420 }
426421
427422 static struct scp *init_scp(struct platform_device *pdev,
@@ -431,7 +426,7 @@ static struct scp *init_scp(struct platform_device *pdev, · 3 unmodified lines
431426 {
432427 struct genpd_onecell_data *pd_data;
433428 struct resource *res;
434− int i, j, ret;
429+ int i, j;
435430 struct scp *scp;
436431 struct clk *clk[CLK_MAX];
437432
@@ -486,9 +481,7 @@ static struct scp *init_scp(struct platform_device *pdev, · 48 unmodified lines
486481
487482 pd_data->num_domains = num;
488483
489− ret = init_clks(pdev, clk);
490− if (ret)
491− return ERR_PTR(ret);
484+ init_clks(pdev, clk);
492485
493486 for (i = 0; i < num; i++) {
494487 struct scp_domain *scpd = &scp->domains[i];
drivers/spi/spi-rockchip.c+10−3
@@ -585,6 +585,12 @@ static int rockchip_spi_slave_abort(struct spi_controller *ctlr) · 584 unmodified lines
585585 {
586586 struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
587587
588+ if (atomic_read(&rs->state) & RXDMA)
589+ dmaengine_terminate_sync(ctlr->dma_rx);
590+ if (atomic_read(&rs->state) & TXDMA)
591+ dmaengine_terminate_sync(ctlr->dma_tx);
592+ atomic_set(&rs->state, 0);
593+ spi_enable_chip(rs, false);
588594 rs->slave_abort = true;
589595 spi_finalize_current_transfer(ctlr);
590596
@@ -654,7 +660,7 @@ static int rockchip_spi_probe(struct platform_device *pdev) · 63 unmodified lines
654660 struct spi_controller *ctlr;
655661 struct resource *mem;
656662 struct device_node *np = pdev->dev.of_node;
657− u32 rsd_nsecs;
663+ u32 rsd_nsecs, num_cs;
658664 bool slave_mode;
659665
660666 slave_mode = of_property_read_bool(np, "spi-slave");
@@ -764,8 +770,9 @@ static int rockchip_spi_probe(struct platform_device *pdev) · 103 unmodified lines
764770 * rk spi0 has two native cs, spi1..5 one cs only
765771 * if num-cs is missing in the dts, default to 1
766772 */
767− if (of_property_read_u16(np, "num-cs", &ctlr->num_chipselect))
768− ctlr->num_chipselect = 1;
773+ if (of_property_read_u32(np, "num-cs", &num_cs))
774+ num_cs = 1;
775+ ctlr->num_chipselect = num_cs;
769776 ctlr->use_gpio_descriptors = true;
770777 }
771778 ctlr->dev.of_node = pdev->dev.of_node;
drivers/spi/spi-zynq-qspi.c+3−0
@@ -570,6 +570,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, · 569 unmodified lines
570570
571571 if (op->dummy.nbytes) {
572572 tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL);
573+ if (!tmpbuf)
574+ return -ENOMEM;
575+
573576 memset(tmpbuf, 0xff, op->dummy.nbytes);
574577 reinit_completion(&xqspi->data_completion);
575578 xqspi->txbuf = tmpbuf;
drivers/staging/fbtft/fb_st7789v.c+2−0
@@ -144,6 +144,8 @@ static int init_display(struct fbtft_par *par) · 143 unmodified lines
144144 {
145145 int rc;
146146
147+ par->fbtftops.reset(par);
148+
147149 rc = init_tearing_effect_line(par);
148150 if (rc)
149151 return rc;
drivers/thermal/intel/int340x_thermal/int3400_thermal.c+4−0
@@ -404,6 +404,10 @@ static void int3400_notify(acpi_handle handle, · 403 unmodified lines
404404 thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event);
405405 thermal_prop[4] = NULL;
406406 kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop);
407+ kfree(thermal_prop[0]);
408+ kfree(thermal_prop[1]);
409+ kfree(thermal_prop[2]);
410+ kfree(thermal_prop[3]);
407411 }
408412
409413 static int int3400_thermal_get_temp(struct thermal_zone_device *thermal,
drivers/tty/n_gsm.c+39−22
@@ -439,7 +439,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) · 438 unmodified lines
439439 modembits |= MDM_RTR;
440440 if (dlci->modem_tx & TIOCM_RI)
441441 modembits |= MDM_IC;
442− if (dlci->modem_tx & TIOCM_CD)
442+ if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator)
443443 modembits |= MDM_DV;
444444 return modembits;
445445 }
@@ -448,7 +448,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) · 2 unmodified lines
448448 * gsm_print_packet - display a frame for debug
449449 * @hdr: header to print before decode
450450 * @addr: address EA from the frame
451− * @cr: C/R bit from the frame
451+ * @cr: C/R bit seen as initiator
452452 * @control: control including PF bit
453453 * @data: following data bytes
454454 * @dlen: length of data
@@ -548,7 +548,7 @@ static int gsm_stuff_frame(const u8 *input, u8 *output, int len) · 93 unmodified lines
548548 * gsm_send - send a control frame
549549 * @gsm: our GSM mux
550550 * @addr: address for control frame
551− * @cr: command/response bit
551+ * @cr: command/response bit seen as initiator
552552 * @control: control byte including PF bit
553553 *
554554 * Format up and transmit a control frame. These do not go via the
@@ -563,11 +563,15 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) · 8 unmodified lines
563563 int len;
564564 u8 cbuf[10];
565565 u8 ibuf[3];
566+ int ocr;
567+
568+ /* toggle C/R coding if not initiator */
569+ ocr = cr ^ (gsm->initiator ? 0 : 1);
566570
567571 switch (gsm->encoding) {
568572 case 0:
569573 cbuf[0] = GSM0_SOF;
570− cbuf[1] = (addr << 2) | (cr << 1) | EA;
574+ cbuf[1] = (addr << 2) | (ocr << 1) | EA;
571575 cbuf[2] = control;
572576 cbuf[3] = EA; /* Length of data = 0 */
573577 cbuf[4] = 0xFF - gsm_fcs_add_block(INIT_FCS, cbuf + 1, 3);
@@ -577,7 +581,7 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) · 3 unmodified lines
577581 case 1:
578582 case 2:
579583 /* Control frame + packing (but not frame stuffing) in mode 1 */
580− ibuf[0] = (addr << 2) | (cr << 1) | EA;
584+ ibuf[0] = (addr << 2) | (ocr << 1) | EA;
581585 ibuf[1] = control;
582586 ibuf[2] = 0xFF - gsm_fcs_add_block(INIT_FCS, ibuf, 2);
583587 /* Stuffing may double the size worst case */
@@ -611,7 +615,7 @@ static void gsm_send(struct gsm_mux *gsm, int addr, int cr, int control) · 27 unmodified lines
611615
612616 static inline void gsm_response(struct gsm_mux *gsm, int addr, int control)
613617 {
614− gsm_send(gsm, addr, 1, control);
618+ gsm_send(gsm, addr, 0, control);
615619 }
616620
617621 /**
@@ -1017,25 +1021,25 @@ static void gsm_control_reply(struct gsm_mux *gsm, int cmd, const u8 *data, · 399 unmodified lines
10171021 * @tty: virtual tty bound to the DLCI
10181022 * @dlci: DLCI to affect
10191023 * @modem: modem bits (full EA)
1020− * @clen: command length
1024+ * @slen: number of signal octets
10211025 *
10221026 * Used when a modem control message or line state inline in adaption
10231027 * layer 2 is processed. Sort out the local modem state and throttles
10241028 */
10251029
10261030 static void gsm_process_modem(struct tty_struct *tty, struct gsm_dlci *dlci,
1027− u32 modem, int clen)
1031+ u32 modem, int slen)
10281032 {
10291033 int mlines = 0;
10301034 u8 brk = 0;
10311035 int fc;
10321036
1033− /* The modem status command can either contain one octet (v.24 signals)
1034− or two octets (v.24 signals + break signals). The length field will
1035− either be 2 or 3 respectively. This is specified in section
1036− 5.4.6.3.7 of the 27.010 mux spec. */
1037+ /* The modem status command can either contain one octet (V.24 signals)
1038+ * or two octets (V.24 signals + break signals). This is specified in
1039+ * section 5.4.6.3.7 of the 07.10 mux spec.
1040+ */
10371041
1038− if (clen == 2)
1042+ if (slen == 1)
10391043 modem = modem & 0x7f;
10401044 else {
10411045 brk = modem & 0x7f;
@@ -1092,6 +1096,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen) · 50 unmodified lines
10921096 unsigned int brk = 0;
10931097 struct gsm_dlci *dlci;
10941098 int len = clen;
1099+ int slen;
10951100 const u8 *dp = data;
10961101 struct tty_struct *tty;
10971102
@@ -1111,6 +1116,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen) · 13 unmodified lines
11111116 return;
11121117 dlci = gsm->dlci[addr];
11131118
1119+ slen = len;
11141120 while (gsm_read_ea(&modem, *dp++) == 0) {
11151121 len--;
11161122 if (len == 0)
@@ -1127,7 +1133,7 @@ static void gsm_control_modem(struct gsm_mux *gsm, const u8 *data, int clen) · 10 unmodified lines
11271133 modem |= (brk & 0x7f);
11281134 }
11291135 tty = tty_port_tty_get(&dlci->port);
1130− gsm_process_modem(tty, dlci, modem, clen);
1136+ gsm_process_modem(tty, dlci, modem, slen);
11311137 if (tty) {
11321138 tty_wakeup(tty);
11331139 tty_kref_put(tty);
@@ -1451,6 +1457,9 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) · 317 unmodified lines
14511457 if (dlci->addr != 0) {
14521458 tty_port_tty_hangup(&dlci->port, false);
14531459 kfifo_reset(&dlci->fifo);
1460+ /* Ensure that gsmtty_open() can return. */
1461+ tty_port_set_initialized(&dlci->port, 0);
1462+ wake_up_interruptible(&dlci->port.open_wait);
14541463 } else
14551464 dlci->gsm->dead = true;
14561465 /* Unregister gsmtty driver,report gsmtty dev remove uevent for user */
@@ -1514,7 +1523,7 @@ static void gsm_dlci_t1(struct timer_list *t) · 57 unmodified lines
15141523 dlci->mode = DLCI_MODE_ADM;
15151524 gsm_dlci_open(dlci);
15161525 } else {
1517− gsm_dlci_close(dlci);
1526+ gsm_dlci_begin_close(dlci); /* prevent half open link */
15181527 }
15191528
15201529 break;
@@ -1593,6 +1602,7 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen) · 72 unmodified lines
15931602 struct tty_struct *tty;
15941603 unsigned int modem = 0;
15951604 int len = clen;
1605+ int slen = 0;
15961606
15971607 if (debug & 16)
15981608 pr_debug("%d bytes for tty\n", len);
@@ -1605,12 +1615,14 @@ static void gsm_dlci_data(struct gsm_dlci *dlci, const u8 *data, int clen) · 6 unmodified lines
16051615 case 2: /* Asynchronous serial with line state in each frame */
16061616 while (gsm_read_ea(&modem, *data++) == 0) {
16071617 len--;
1618+ slen++;
16081619 if (len == 0)
16091620 return;
16101621 }
1622+ slen++;
16111623 tty = tty_port_tty_get(port);
16121624 if (tty) {
1613− gsm_process_modem(tty, dlci, modem, clen);
1625+ gsm_process_modem(tty, dlci, modem, slen);
16141626 tty_kref_put(tty);
16151627 }
16161628 fallthrough;
@@ -1748,7 +1760,12 @@ static void gsm_dlci_release(struct gsm_dlci *dlci) · 131 unmodified lines
17481760 gsm_destroy_network(dlci);
17491761 mutex_unlock(&dlci->mutex);
17501762
1751− tty_hangup(tty);
1763+ /* We cannot use tty_hangup() because in tty_kref_put() the tty
1764+ * driver assumes that the hangup queue is free and reuses it to
1765+ * queue release_one_tty() -> NULL pointer panic in
1766+ * process_one_work().
1767+ */
1768+ tty_vhangup(tty);
17521769
17531770 tty_port_tty_set(&dlci->port, NULL);
17541771 tty_kref_put(tty);
@@ -1800,10 +1817,10 @@ static void gsm_queue(struct gsm_mux *gsm) · 45 unmodified lines
18001817 goto invalid;
18011818
18021819 cr = gsm->address & 1; /* C/R bit */
1820+ cr ^= gsm->initiator ? 0 : 1; /* Flip so 1 always means command */
18031821
18041822 gsm_print_packet("<--", address, cr, gsm->control, gsm->buf, gsm->len);
18051823
1806− cr ^= 1 - gsm->initiator; /* Flip so 1 always means command */
18071824 dlci = gsm->dlci[address];
18081825
18091826 switch (gsm->control) {
@@ -3234,9 +3251,9 @@ static void gsmtty_throttle(struct tty_struct *tty) · 1424 unmodified lines
32343251 if (dlci->state == DLCI_CLOSED)
32353252 return;
32363253 if (C_CRTSCTS(tty))
3237− dlci->modem_tx &= ~TIOCM_DTR;
3254+ dlci->modem_tx &= ~TIOCM_RTS;
32383255 dlci->throttled = true;
3239− /* Send an MSC with DTR cleared */
3256+ /* Send an MSC with RTS cleared */
32403257 gsmtty_modem_update(dlci, 0);
32413258 }
32423259
@@ -3246,9 +3263,9 @@ static void gsmtty_unthrottle(struct tty_struct *tty) · 3 unmodified lines
32463263 if (dlci->state == DLCI_CLOSED)
32473264 return;
32483265 if (C_CRTSCTS(tty))
3249− dlci->modem_tx |= TIOCM_DTR;
3266+ dlci->modem_tx |= TIOCM_RTS;
32503267 dlci->throttled = false;
3251− /* Send an MSC with DTR set */
3268+ /* Send an MSC with RTS set */
32523269 gsmtty_modem_update(dlci, 0);
32533270 }
32543271
drivers/tty/n_tty.c+2−4
@@ -1926,7 +1926,7 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty, · 1925 unmodified lines
19261926 return false;
19271927
19281928 canon_head = smp_load_acquire(&ldata->canon_head);
1929− n = min(*nr + 1, canon_head - ldata->read_tail);
1929+ n = min(*nr, canon_head - ldata->read_tail);
19301930
19311931 tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1);
19321932 size = min_t(size_t, tail + n, N_TTY_BUF_SIZE);
@@ -1948,10 +1948,8 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty, · 15 unmodified lines
19481948 n += N_TTY_BUF_SIZE;
19491949 c = n + found;
19501950
1951− if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) {
1952− c = min(*nr, c);
1951+ if (!found || read_buf(ldata, eol) != __DISABLED_CHAR)
19531952 n = c;
1954− }
19551953
19561954 n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n",
19571955 __func__, eol, found, n, c, tail, more);
drivers/tty/serial/8250/8250_gsc.c+1−1
@@ -26,7 +26,7 @@ static int __init serial_init_chip(struct parisc_device *dev) · 25 unmodified lines
2626 unsigned long address;
2727 int err;
2828
29−#ifdef CONFIG_64BIT
29+#if defined(CONFIG_64BIT) && defined(CONFIG_IOSAPIC)
3030 if (!dev->irq && (dev->id.sversion == 0xad))
3131 dev->irq = iosapic_serial_irq(dev);
3232 #endif
drivers/tty/serial/sc16is7xx.c+3−0
@@ -734,12 +734,15 @@ static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) · 733 unmodified lines
734734 static void sc16is7xx_tx_proc(struct kthread_work *ws)
735735 {
736736 struct uart_port *port = &(to_sc16is7xx_one(ws, tx_work)->port);
737+ struct sc16is7xx_port *s = dev_get_drvdata(port->dev);
737738
738739 if ((port->rs485.flags & SER_RS485_ENABLED) &&
739740 (port->rs485.delay_rts_before_send > 0))
740741 msleep(port->rs485.delay_rts_before_send);
741742
743+ mutex_lock(&s->efr_lock);
742744 sc16is7xx_handle_tx(port);
745+ mutex_unlock(&s->efr_lock);
743746 }
744747
745748 static void sc16is7xx_reconf_rs485(struct uart_port *port)
drivers/usb/dwc2/core.h+2−0
@@ -1418,6 +1418,7 @@ void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg); · 1417 unmodified lines
14181418 void dwc2_hsotg_disconnect(struct dwc2_hsotg *dwc2);
14191419 int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode);
14201420 #define dwc2_is_device_connected(hsotg) (hsotg->connected)
1421+#define dwc2_is_device_enabled(hsotg) (hsotg->enabled)
14211422 int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg);
14221423 int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup);
14231424 int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg);
@@ -1454,6 +1455,7 @@ static inline int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, · 30 unmodified lines
14541455 int testmode)
14551456 { return 0; }
14561457 #define dwc2_is_device_connected(hsotg) (0)
1458+#define dwc2_is_device_enabled(hsotg) (0)
14571459 static inline int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg)
14581460 { return 0; }
14591461 static inline int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg,
drivers/usb/dwc2/drd.c+4−2
@@ -130,8 +130,10 @@ static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role) · 129 unmodified lines
130130 already = dwc2_ovr_avalid(hsotg, true);
131131 } else if (role == USB_ROLE_DEVICE) {
132132 already = dwc2_ovr_bvalid(hsotg, true);
133− /* This clear DCTL.SFTDISCON bit */
134− dwc2_hsotg_core_connect(hsotg);
133+ if (dwc2_is_device_enabled(hsotg)) {
134+ /* This clear DCTL.SFTDISCON bit */
135+ dwc2_hsotg_core_connect(hsotg);
136+ }
135137 } else {
136138 if (dwc2_is_device_mode(hsotg)) {
137139 if (!dwc2_ovr_bvalid(hsotg, false))
drivers/usb/dwc3/dwc3-pci.c+17−3
@@ -43,6 +43,7 @@ · 42 unmodified lines
4343 #define PCI_DEVICE_ID_INTEL_ADLP 0x51ee
4444 #define PCI_DEVICE_ID_INTEL_ADLM 0x54ee
4545 #define PCI_DEVICE_ID_INTEL_ADLS 0x7ae1
46+#define PCI_DEVICE_ID_INTEL_RPLS 0x7a61
4647 #define PCI_DEVICE_ID_INTEL_TGL 0x9a15
4748 #define PCI_DEVICE_ID_AMD_MR 0x163a
4849
@@ -85,8 +86,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { · 36 unmodified lines
8586 static struct gpiod_lookup_table platform_bytcr_gpios = {
8687 .dev_id = "0000:00:16.0",
8788 .table = {
88− GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH),
89− GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH),
89+ GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH),
90+ GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH),
9091 {}
9192 },
9293 };
@@ -123,6 +124,12 @@ static const struct property_entry dwc3_pci_intel_phy_charger_detect_properties[ · 30 unmodified lines
123124 PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
124125 PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
125126 PROPERTY_ENTRY_BOOL("linux,phy_charger_detect"),
127+ {}
128+};
129+
130+static const struct property_entry dwc3_pci_intel_byt_properties[] = {
131+ PROPERTY_ENTRY_STRING("dr_mode", "peripheral"),
132+ PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"),
126133 PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
127134 {}
128135 };
@@ -173,6 +180,10 @@ static const struct software_node dwc3_pci_intel_phy_charger_detect_swnode = { · 44 unmodified lines
173180 .properties = dwc3_pci_intel_phy_charger_detect_properties,
174181 };
175182
183+static const struct software_node dwc3_pci_intel_byt_swnode = {
184+ .properties = dwc3_pci_intel_byt_properties,
185+};
186+
176187 static const struct software_node dwc3_pci_intel_mrfld_swnode = {
177188 .properties = dwc3_pci_mrfld_properties,
178189 };
@@ -373,7 +384,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 194 unmodified lines
373384 (kernel_ulong_t) &dwc3_pci_intel_swnode, },
374385
375386 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_BYT),
376− (kernel_ulong_t) &dwc3_pci_intel_swnode, },
387+ (kernel_ulong_t) &dwc3_pci_intel_byt_swnode, },
377388
378389 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
379390 (kernel_ulong_t) &dwc3_pci_intel_mrfld_swnode, },
@@ -438,6 +449,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = { · 58 unmodified lines
438449 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADLS),
439450 (kernel_ulong_t) &dwc3_pci_intel_swnode, },
440451
452+ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_RPLS),
453+ (kernel_ulong_t) &dwc3_pci_intel_swnode, },
454+
441455 { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL),
442456 (kernel_ulong_t) &dwc3_pci_intel_swnode, },
443457
drivers/usb/dwc3/gadget.c+2−0
@@ -4160,9 +4160,11 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt) · 4159 unmodified lines
41604160 unsigned long flags;
41614161 irqreturn_t ret = IRQ_NONE;
41624162
4163+ local_bh_disable();
41634164 spin_lock_irqsave(&dwc->lock, flags);
41644165 ret = dwc3_process_event_buf(evt);
41654166 spin_unlock_irqrestore(&dwc->lock, flags);
4167+ local_bh_enable();
41664168
41674169 return ret;
41684170 }
drivers/usb/gadget/function/rndis.c+8−0
@@ -922,6 +922,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v) · 921 unmodified lines
922922 params->resp_avail = resp_avail;
923923 params->v = v;
924924 INIT_LIST_HEAD(&params->resp_queue);
925+ spin_lock_init(&params->resp_lock);
925926 pr_debug("%s: configNr = %d\n", __func__, i);
926927
927928 return params;
@@ -1015,12 +1016,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf) · 87 unmodified lines
10151016 {
10161017 rndis_resp_t *r, *n;
10171018
1019+ spin_lock(&params->resp_lock);
10181020 list_for_each_entry_safe(r, n, &params->resp_queue, list) {
10191021 if (r->buf == buf) {
10201022 list_del(&r->list);
10211023 kfree(r);
10221024 }
10231025 }
1026+ spin_unlock(&params->resp_lock);
10241027 }
10251028 EXPORT_SYMBOL_GPL(rndis_free_response);
10261029
@@ -1030,14 +1033,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length) · 3 unmodified lines
10301033
10311034 if (!length) return NULL;
10321035
1036+ spin_lock(&params->resp_lock);
10331037 list_for_each_entry_safe(r, n, &params->resp_queue, list) {
10341038 if (!r->send) {
10351039 r->send = 1;
10361040 *length = r->length;
1041+ spin_unlock(&params->resp_lock);
10371042 return r->buf;
10381043 }
10391044 }
10401045
1046+ spin_unlock(&params->resp_lock);
10411047 return NULL;
10421048 }
10431049 EXPORT_SYMBOL_GPL(rndis_get_next_response);
@@ -1054,7 +1060,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length) · 10 unmodified lines
10541060 r->length = length;
10551061 r->send = 0;
10561062
1063+ spin_lock(&params->resp_lock);
10571064 list_add_tail(&r->list, &params->resp_queue);
1065+ spin_unlock(&params->resp_lock);
10581066 return r;
10591067 }
10601068
drivers/usb/gadget/function/rndis.h+1−0
@@ -174,6 +174,7 @@ typedef struct rndis_params { · 173 unmodified lines
174174 void (*resp_avail)(void *v);
175175 void *v;
176176 struct list_head resp_queue;
177+ spinlock_t resp_lock;
177178 } rndis_params;
178179
179180 /* RNDIS Message parser and other useless functions */
drivers/usb/gadget/udc/udc-xilinx.c+6−0
@@ -1615,6 +1615,8 @@ static void xudc_getstatus(struct xusb_udc *udc) · 1614 unmodified lines
16151615 break;
16161616 case USB_RECIP_ENDPOINT:
16171617 epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
1618+ if (epnum >= XUSB_MAX_ENDPOINTS)
1619+ goto stall;
16181620 target_ep = &udc->ep[epnum];
16191621 epcfgreg = udc->read_fn(udc->addr + target_ep->offset);
16201622 halt = epcfgreg & XUSB_EP_CFG_STALL_MASK;
@@ -1682,6 +1684,10 @@ static void xudc_set_clear_feature(struct xusb_udc *udc) · 61 unmodified lines
16821684 case USB_RECIP_ENDPOINT:
16831685 if (!udc->setup.wValue) {
16841686 endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK;
1687+ if (endpoint >= XUSB_MAX_ENDPOINTS) {
1688+ xudc_ep0_stall(udc);
1689+ return;
1690+ }
16851691 target_ep = &udc->ep[endpoint];
16861692 outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK;
16871693 outinbit = outinbit >> 7;
drivers/usb/host/xhci.c+19−9
@@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 1090 unmodified lines
10911091 int retval = 0;
10921092 bool comp_timer_running = false;
10931093 bool pending_portevent = false;
1094+ bool reinit_xhc = false;
10941095
10951096 if (!hcd->state)
10961097 return 0;
@@ -1107,10 +1108,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 10 unmodified lines
11071108 set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
11081109
11091110 spin_lock_irq(&xhci->lock);
1110− if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend)
1111− hibernated = true;
11121111
1113− if (!hibernated) {
1112+ if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend)
1113+ reinit_xhc = true;
1114+
1115+ if (!reinit_xhc) {
11141116 /*
11151117 * Some controllers might lose power during suspend, so wait
11161118 * for controller not ready bit to clear, just as in xHC init.
@@ -1143,12 +1145,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) · 26 unmodified lines
11431145 spin_unlock_irq(&xhci->lock);
11441146 return -ETIMEDOUT;
11451147 }
1146− temp = readl(&xhci->op_regs->status);
11471148 }
11481149
1149− /* If restore operation fails, re-initialize the HC during resume */
1150− if ((temp & STS_SRE) || hibernated) {
1150+ temp = readl(&xhci->op_regs->status);
11511151
1152+ /* re-initialize the HC on Restore Error, or Host Controller Error */
1153+ if (temp & (STS_SRE | STS_HCE)) {
1154+ reinit_xhc = true;
1155+ xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp);
1156+ }
1157+
1158+ if (reinit_xhc) {
11521159 if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
11531160 !(xhci_all_ports_seen_u0(xhci))) {
11541161 del_timer_sync(&xhci->comp_mode_recovery_timer);
@@ -1604,9 +1611,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag · 449 unmodified lines
16041611 struct urb_priv *urb_priv;
16051612 int num_tds;
16061613
1607− if (!urb || xhci_check_args(hcd, urb->dev, urb->ep,
1608− true, true, __func__) <= 0)
1614+ if (!urb)
16091615 return -EINVAL;
1616+ ret = xhci_check_args(hcd, urb->dev, urb->ep,
1617+ true, true, __func__);
1618+ if (ret <= 0)
1619+ return ret ? ret : -EINVAL;
16101620
16111621 slot_id = urb->dev->slot_id;
16121622 ep_index = xhci_get_endpoint_index(&urb->ep->desc);
@@ -3319,7 +3329,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, · 1706 unmodified lines
33193329 return -EINVAL;
33203330 ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__);
33213331 if (ret <= 0)
3322− return -EINVAL;
3332+ return ret ? ret : -EINVAL;
33233333 if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) {
33243334 xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion"
33253335 " descriptor for ep 0x%x does not support streams\n",
drivers/usb/serial/ch341.c+0−1
@@ -81,7 +81,6 @@ · 80 unmodified lines
8181 #define CH341_QUIRK_SIMULATE_BREAK BIT(1)
8282
8383 static const struct usb_device_id id_table[] = {
84− { USB_DEVICE(0x1a86, 0x5512) },
8584 { USB_DEVICE(0x1a86, 0x5523) },
8685 { USB_DEVICE(0x1a86, 0x7522) },
8786 { USB_DEVICE(0x1a86, 0x7523) },
drivers/usb/serial/option.c+12−0
@@ -198,6 +198,8 @@ static void option_instat_callback(struct urb *urb); · 197 unmodified lines
198198
199199 #define DELL_PRODUCT_5821E 0x81d7
200200 #define DELL_PRODUCT_5821E_ESIM 0x81e0
201+#define DELL_PRODUCT_5829E_ESIM 0x81e4
202+#define DELL_PRODUCT_5829E 0x81e6
201203
202204 #define KYOCERA_VENDOR_ID 0x0c88
203205 #define KYOCERA_PRODUCT_KPC650 0x17da
@@ -1063,6 +1065,10 @@ static const struct usb_device_id option_ids[] = { · 859 unmodified lines
10631065 .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
10641066 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM),
10651067 .driver_info = RSVD(0) | RSVD(1) | RSVD(6) },
1068+ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E),
1069+ .driver_info = RSVD(0) | RSVD(6) },
1070+ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM),
1071+ .driver_info = RSVD(0) | RSVD(6) },
10661072 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
10671073 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
10681074 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -1273,10 +1279,16 @@ static const struct usb_device_id option_ids[] = { · 204 unmodified lines
12731279 .driver_info = NCTRL(2) },
12741280 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */
12751281 .driver_info = NCTRL(2) },
1282+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE910R1 (RNDIS) */
1283+ .driver_info = NCTRL(2) },
1284+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */
1285+ .driver_info = NCTRL(2) },
12761286 { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */
12771287 .driver_info = NCTRL(0) | ZLP },
12781288 { USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */
12791289 .driver_info = NCTRL(0) | ZLP },
1290+ { USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing device */
1291+ .driver_info = NCTRL(0) | ZLP },
12801292 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
12811293 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff),
12821294 .driver_info = RSVD(1) },
drivers/usb/typec/tipd/core.c+4−3
@@ -761,12 +761,12 @@ static int tps6598x_probe(struct i2c_client *client) · 760 unmodified lines
761761
762762 ret = tps6598x_read32(tps, TPS_REG_STATUS, &status);
763763 if (ret < 0)
764− return ret;
764+ goto err_clear_mask;
765765 trace_tps6598x_status(status);
766766
767767 ret = tps6598x_read32(tps, TPS_REG_SYSTEM_CONF, &conf);
768768 if (ret < 0)
769− return ret;
769+ goto err_clear_mask;
770770
771771 /*
772772 * This fwnode has a "compatible" property, but is never populated as a
@@ -855,7 +855,8 @@ err_role_put: · 82 unmodified lines
855855 usb_role_switch_put(tps->role_sw);
856856 err_fwnode_put:
857857 fwnode_handle_put(fwnode);
858−
858+err_clear_mask:
859+ tps6598x_write64(tps, TPS_REG_INT_MASK1, 0);
859860 return ret;
860861 }
861862
drivers/vhost/vsock.c+14−7
@@ -629,16 +629,18 @@ err: · 628 unmodified lines
629629 return ret;
630630 }
631631
632−static int vhost_vsock_stop(struct vhost_vsock *vsock)
632+static int vhost_vsock_stop(struct vhost_vsock *vsock, bool check_owner)
633633 {
634634 size_t i;
635− int ret;
635+ int ret = 0;
636636
637637 mutex_lock(&vsock->dev.mutex);
638638
639− ret = vhost_dev_check_owner(&vsock->dev);
640− if (ret)
641− goto err;
639+ if (check_owner) {
640+ ret = vhost_dev_check_owner(&vsock->dev);
641+ if (ret)
642+ goto err;
643+ }
642644
643645 for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) {
644646 struct vhost_virtqueue *vq = &vsock->vqs[i];
@@ -753,7 +755,12 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file) · 108 unmodified lines
753755 * inefficient. Room for improvement here. */
754756 vsock_for_each_connected_socket(vhost_vsock_reset_orphans);
755757
756− vhost_vsock_stop(vsock);
758+ /* Don't check the owner, because we are in the release path, so we
759+ * need to stop the vsock device in any case.
760+ * vhost_vsock_stop() can not fail in this case, so we don't need to
761+ * check the return code.
762+ */
763+ vhost_vsock_stop(vsock, false);
757764 vhost_vsock_flush(vsock);
758765 vhost_dev_stop(&vsock->dev);
759766
@@ -868,7 +875,7 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl, · 108 unmodified lines
868875 if (start)
869876 return vhost_vsock_start(vsock);
870877 else
871− return vhost_vsock_stop(vsock);
878+ return vhost_vsock_stop(vsock, true);
872879 case VHOST_GET_FEATURES:
873880 features = VHOST_VSOCK_FEATURES;
874881 if (copy_to_user(argp, &features, sizeof(features)))
fs/btrfs/ctree.h+1−1
@@ -3291,7 +3291,7 @@ void btrfs_exclop_balance(struct btrfs_fs_info *fs_info, · 3290 unmodified lines
32913291 int __init btrfs_auto_defrag_init(void);
32923292 void __cold btrfs_auto_defrag_exit(void);
32933293 int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
3294− struct btrfs_inode *inode);
3294+ struct btrfs_inode *inode, u32 extent_thresh);
32953295 int btrfs_run_defrag_inodes(struct btrfs_fs_info *fs_info);
32963296 void btrfs_cleanup_defrag_inodes(struct btrfs_fs_info *fs_info);
32973297 int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
fs/btrfs/extent_map.c+2−0
@@ -261,6 +261,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) · 260 unmodified lines
261261 em->mod_len = (em->mod_len + em->mod_start) - merge->mod_start;
262262 em->mod_start = merge->mod_start;
263263 em->generation = max(em->generation, merge->generation);
264+ set_bit(EXTENT_FLAG_MERGED, &em->flags);
264265
265266 rb_erase_cached(&merge->rb_node, &tree->map);
266267 RB_CLEAR_NODE(&merge->rb_node);
@@ -278,6 +279,7 @@ static void try_merge_map(struct extent_map_tree *tree, struct extent_map *em) · 11 unmodified lines
278279 RB_CLEAR_NODE(&merge->rb_node);
279280 em->mod_len = (merge->mod_start + merge->mod_len) - em->mod_start;
280281 em->generation = max(em->generation, merge->generation);
282+ set_bit(EXTENT_FLAG_MERGED, &em->flags);
281283 free_extent_map(merge);
282284 }
283285 }
fs/btrfs/extent_map.h+8−0
@@ -25,6 +25,8 @@ enum { · 24 unmodified lines
2525 EXTENT_FLAG_FILLING,
2626 /* filesystem extent mapping type */
2727 EXTENT_FLAG_FS_MAPPING,
28+ /* This em is merged from two or more physically adjacent ems */
29+ EXTENT_FLAG_MERGED,
2830 };
2931
3032 struct extent_map {
@@ -40,6 +42,12 @@ struct extent_map { · 9 unmodified lines
4042 u64 ram_bytes;
4143 u64 block_start;
4244 u64 block_len;
45+
46+ /*
47+ * Generation of the extent map, for merged em it's the highest
48+ * generation of all merged ems.
49+ * For non-merged extents, it's from btrfs_file_extent_item::generation.
50+ */
4351 u64 generation;
4452 unsigned long flags;
4553 /* Used for chunk mappings, flag EXTENT_FLAG_FS_MAPPING must be set */
fs/btrfs/file.c+35−62
@@ -50,11 +50,14 @@ struct inode_defrag { · 49 unmodified lines
5050 /* root objectid */
5151 u64 root;
5252
53− /* last offset we were able to defrag */
54− u64 last_offset;
55−
56− /* if we've wrapped around back to zero once already */
57− int cycled;
53+ /*
54+ * The extent size threshold for autodefrag.
55+ *
56+ * This value is different for compressed/non-compressed extents,
57+ * thus needs to be passed from higher layer.
58+ * (aka, inode_should_defrag())
59+ */
60+ u32 extent_thresh;
5861 };
5962
6063 static int __compare_inode_defrag(struct inode_defrag *defrag1,
@@ -107,8 +110,8 @@ static int __btrfs_add_inode_defrag(struct btrfs_inode *inode, · 46 unmodified lines
107110 */
108111 if (defrag->transid < entry->transid)
109112 entry->transid = defrag->transid;
110− if (defrag->last_offset > entry->last_offset)
111− entry->last_offset = defrag->last_offset;
113+ entry->extent_thresh = min(defrag->extent_thresh,
114+ entry->extent_thresh);
112115 return -EEXIST;
113116 }
114117 }
@@ -134,7 +137,7 @@ static inline int __need_auto_defrag(struct btrfs_fs_info *fs_info) · 19 unmodified lines
134137 * enabled
135138 */
136139 int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans,
137− struct btrfs_inode *inode)
140+ struct btrfs_inode *inode, u32 extent_thresh)
138141 {
139142 struct btrfs_root *root = inode->root;
140143 struct btrfs_fs_info *fs_info = root->fs_info;
@@ -160,6 +163,7 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, · 19 unmodified lines
160163 defrag->ino = btrfs_ino(inode);
161164 defrag->transid = transid;
162165 defrag->root = root->root_key.objectid;
166+ defrag->extent_thresh = extent_thresh;
163167
164168 spin_lock(&fs_info->defrag_inodes_lock);
165169 if (!test_bit(BTRFS_INODE_IN_DEFRAG, &inode->runtime_flags)) {
@@ -178,34 +182,6 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans, · 12 unmodified lines
178182 return 0;
179183 }
180184
181−/*
182− * Requeue the defrag object. If there is a defrag object that points to
183− * the same inode in the tree, we will merge them together (by
184− * __btrfs_add_inode_defrag()) and free the one that we want to requeue.
185− */
186−static void btrfs_requeue_inode_defrag(struct btrfs_inode *inode,
187− struct inode_defrag *defrag)
188−{
189− struct btrfs_fs_info *fs_info = inode->root->fs_info;
190− int ret;
191−
192− if (!__need_auto_defrag(fs_info))
193− goto out;
194−
195− /*
196− * Here we don't check the IN_DEFRAG flag, because we need merge
197− * them together.
198− */
199− spin_lock(&fs_info->defrag_inodes_lock);
200− ret = __btrfs_add_inode_defrag(inode, defrag);
201− spin_unlock(&fs_info->defrag_inodes_lock);
202− if (ret)
203− goto out;
204− return;
205−out:
206− kmem_cache_free(btrfs_inode_defrag_cachep, defrag);
207−}
208−
209185 /*
210186 * pick the defragable inode that we want, if it doesn't exist, we will get
211187 * the next one.
@@ -278,8 +254,14 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info, · 66 unmodified lines
278254 struct btrfs_root *inode_root;
279255 struct inode *inode;
280256 struct btrfs_ioctl_defrag_range_args range;
281− int num_defrag;
282− int ret;
257+ int ret = 0;
258+ u64 cur = 0;
259+
260+again:
261+ if (test_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state))
262+ goto cleanup;
263+ if (!__need_auto_defrag(fs_info))
264+ goto cleanup;
283265
284266 /* get the inode */
285267 inode_root = btrfs_get_fs_root(fs_info, defrag->root, true);
@@ -295,39 +277,30 @@ static int __btrfs_run_defrag_inode(struct btrfs_fs_info *fs_info, · 9 unmodified lines
295277 goto cleanup;
296278 }
297279
280+ if (cur >= i_size_read(inode)) {
281+ iput(inode);
282+ goto cleanup;
283+ }
284+
298285 /* do a chunk of defrag */
299286 clear_bit(BTRFS_INODE_IN_DEFRAG, &BTRFS_I(inode)->runtime_flags);
300287 memset(&range, 0, sizeof(range));
301288 range.len = (u64)-1;
302− range.start = defrag->last_offset;
289+ range.start = cur;
290+ range.extent_thresh = defrag->extent_thresh;
303291
304292 sb_start_write(fs_info->sb);
305− num_defrag = btrfs_defrag_file(inode, NULL, &range, defrag->transid,
293+ ret = btrfs_defrag_file(inode, NULL, &range, defrag->transid,
306294 BTRFS_DEFRAG_BATCH);
307295 sb_end_write(fs_info->sb);
308− /*
309− * if we filled the whole defrag batch, there
310− * must be more work to do. Queue this defrag
311− * again
312− */
313− if (num_defrag == BTRFS_DEFRAG_BATCH) {
314− defrag->last_offset = range.start;
315− btrfs_requeue_inode_defrag(BTRFS_I(inode), defrag);
316− } else if (defrag->last_offset && !defrag->cycled) {
317− /*
318− * we didn't fill our defrag batch, but
319− * we didn't start at zero. Make sure we loop
320− * around to the start of the file.
321− */
322− defrag->last_offset = 0;
323− defrag->cycled = 1;
324− btrfs_requeue_inode_defrag(BTRFS_I(inode), defrag);
325− } else {
326− kmem_cache_free(btrfs_inode_defrag_cachep, defrag);
327− }
328−
329296 iput(inode);
330− return 0;
297+
298+ if (ret < 0)
299+ goto cleanup;
300+
301+ cur = max(cur + fs_info->sectorsize, range.start);
302+ goto again;
303+
331304 cleanup:
332305 kmem_cache_free(btrfs_inode_defrag_cachep, defrag);
333306 return ret;
fs/btrfs/inode.c+2−2
@@ -560,12 +560,12 @@ static inline int inode_need_compress(struct btrfs_inode *inode, u64 start, · 559 unmodified lines
560560 }
561561
562562 static inline void inode_should_defrag(struct btrfs_inode *inode,
563− u64 start, u64 end, u64 num_bytes, u64 small_write)
563+ u64 start, u64 end, u64 num_bytes, u32 small_write)
564564 {
565565 /* If this is a small write inside eof, kick off a defrag */
566566 if (num_bytes < small_write &&
567567 (start > 0 || end + 1 < inode->disk_i_size))
568− btrfs_add_inode_defrag(NULL, inode);
568+ btrfs_add_inode_defrag(NULL, inode, small_write);
569569 }
570570
571571 /*
fs/btrfs/ioctl.c+242−19
@@ -1012,8 +1012,155 @@ out: · 1011 unmodified lines
10121012 return ret;
10131013 }
10141014
1015+/*
1016+ * Defrag specific helper to get an extent map.
1017+ *
1018+ * Differences between this and btrfs_get_extent() are:
1019+ *
1020+ * - No extent_map will be added to inode->extent_tree
1021+ * To reduce memory usage in the long run.
1022+ *
1023+ * - Extra optimization to skip file extents older than @newer_than
1024+ * By using btrfs_search_forward() we can skip entire file ranges that
1025+ * have extents created in past transactions, because btrfs_search_forward()
1026+ * will not visit leaves and nodes with a generation smaller than given
1027+ * minimal generation threshold (@newer_than).
1028+ *
1029+ * Return valid em if we find a file extent matching the requirement.
1030+ * Return NULL if we can not find a file extent matching the requirement.
1031+ *
1032+ * Return ERR_PTR() for error.
1033+ */
1034+static struct extent_map *defrag_get_extent(struct btrfs_inode *inode,
1035+ u64 start, u64 newer_than)
1036+{
1037+ struct btrfs_root *root = inode->root;
1038+ struct btrfs_file_extent_item *fi;
1039+ struct btrfs_path path = { 0 };
1040+ struct extent_map *em;
1041+ struct btrfs_key key;
1042+ u64 ino = btrfs_ino(inode);
1043+ int ret;
1044+
1045+ em = alloc_extent_map();
1046+ if (!em) {
1047+ ret = -ENOMEM;
1048+ goto err;
1049+ }
1050+
1051+ key.objectid = ino;
1052+ key.type = BTRFS_EXTENT_DATA_KEY;
1053+ key.offset = start;
1054+
1055+ if (newer_than) {
1056+ ret = btrfs_search_forward(root, &key, &path, newer_than);
1057+ if (ret < 0)
1058+ goto err;
1059+ /* Can't find anything newer */
1060+ if (ret > 0)
1061+ goto not_found;
1062+ } else {
1063+ ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0);
1064+ if (ret < 0)
1065+ goto err;
1066+ }
1067+ if (path.slots[0] >= btrfs_header_nritems(path.nodes[0])) {
1068+ /*
1069+ * If btrfs_search_slot() makes path to point beyond nritems,
1070+ * we should not have an empty leaf, as this inode must at
1071+ * least have its INODE_ITEM.
1072+ */
1073+ ASSERT(btrfs_header_nritems(path.nodes[0]));
1074+ path.slots[0] = btrfs_header_nritems(path.nodes[0]) - 1;
1075+ }
1076+ btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]);
1077+ /* Perfect match, no need to go one slot back */
1078+ if (key.objectid == ino && key.type == BTRFS_EXTENT_DATA_KEY &&
1079+ key.offset == start)
1080+ goto iterate;
1081+
1082+ /* We didn't find a perfect match, needs to go one slot back */
1083+ if (path.slots[0] > 0) {
1084+ btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]);
1085+ if (key.objectid == ino && key.type == BTRFS_EXTENT_DATA_KEY)
1086+ path.slots[0]--;
1087+ }
1088+
1089+iterate:
1090+ /* Iterate through the path to find a file extent covering @start */
1091+ while (true) {
1092+ u64 extent_end;
1093+
1094+ if (path.slots[0] >= btrfs_header_nritems(path.nodes[0]))
1095+ goto next;
1096+
1097+ btrfs_item_key_to_cpu(path.nodes[0], &key, path.slots[0]);
1098+
1099+ /*
1100+ * We may go one slot back to INODE_REF/XATTR item, then
1101+ * need to go forward until we reach an EXTENT_DATA.
1102+ * But we should still has the correct ino as key.objectid.
1103+ */
1104+ if (WARN_ON(key.objectid < ino) || key.type < BTRFS_EXTENT_DATA_KEY)
1105+ goto next;
1106+
1107+ /* It's beyond our target range, definitely not extent found */
1108+ if (key.objectid > ino || key.type > BTRFS_EXTENT_DATA_KEY)
1109+ goto not_found;
1110+
1111+ /*
1112+ * | |<- File extent ->|
1113+ * \- start
1114+ *
1115+ * This means there is a hole between start and key.offset.
1116+ */
1117+ if (key.offset > start) {
1118+ em->start = start;
1119+ em->orig_start = start;
1120+ em->block_start = EXTENT_MAP_HOLE;
1121+ em->len = key.offset - start;
1122+ break;
1123+ }
1124+
1125+ fi = btrfs_item_ptr(path.nodes[0], path.slots[0],
1126+ struct btrfs_file_extent_item);
1127+ extent_end = btrfs_file_extent_end(&path);
1128+
1129+ /*
1130+ * |<- file extent ->| |
1131+ * \- start
1132+ *
1133+ * We haven't reached start, search next slot.
1134+ */
1135+ if (extent_end <= start)
1136+ goto next;
1137+
1138+ /* Now this extent covers @start, convert it to em */
1139+ btrfs_extent_item_to_extent_map(inode, &path, fi, false, em);
1140+ break;
1141+next:
1142+ ret = btrfs_next_item(root, &path);
1143+ if (ret < 0)
1144+ goto err;
1145+ if (ret > 0)
1146+ goto not_found;
1147+ }
1148+ btrfs_release_path(&path);
1149+ return em;
1150+
1151+not_found:
1152+ btrfs_release_path(&path);
1153+ free_extent_map(em);
1154+ return NULL;
1155+
1156+err:
1157+ btrfs_release_path(&path);
1158+ free_extent_map(em);
1159+ return ERR_PTR(ret);
1160+}
1161+
10151162 static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start,
1016− bool locked)
1163+ u64 newer_than, bool locked)
10171164 {
10181165 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
10191166 struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
@@ -1028,6 +1175,20 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, · 8 unmodified lines
10281175 em = lookup_extent_mapping(em_tree, start, sectorsize);
10291176 read_unlock(&em_tree->lock);
10301177
1178+ /*
1179+ * We can get a merged extent, in that case, we need to re-search
1180+ * tree to get the original em for defrag.
1181+ *
1182+ * If @newer_than is 0 or em::generation < newer_than, we can trust
1183+ * this em, as either we don't care about the generation, or the
1184+ * merged extent map will be rejected anyway.
1185+ */
1186+ if (em && test_bit(EXTENT_FLAG_MERGED, &em->flags) &&
1187+ newer_than && em->generation >= newer_than) {
1188+ free_extent_map(em);
1189+ em = NULL;
1190+ }
1191+
10311192 if (!em) {
10321193 struct extent_state *cached = NULL;
10331194 u64 end = start + sectorsize - 1;
@@ -1035,7 +1196,7 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, · 1 unmodified line
10351196 /* get the big lock and read metadata off disk */
10361197 if (!locked)
10371198 lock_extent_bits(io_tree, start, end, &cached);
1038− em = btrfs_get_extent(BTRFS_I(inode), NULL, 0, start, sectorsize);
1199+ em = defrag_get_extent(BTRFS_I(inode), start, newer_than);
10391200 if (!locked)
10401201 unlock_extent_cached(io_tree, start, end, &cached);
10411202
@@ -1046,23 +1207,42 @@ static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start, · 4 unmodified lines
10461207 return em;
10471208 }
10481209
1210+static u32 get_extent_max_capacity(const struct extent_map *em)
1211+{
1212+ if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
1213+ return BTRFS_MAX_COMPRESSED;
1214+ return BTRFS_MAX_EXTENT_SIZE;
1215+}
1216+
10491217 static bool defrag_check_next_extent(struct inode *inode, struct extent_map *em,
10501218 bool locked)
10511219 {
10521220 struct extent_map *next;
1053− bool ret = true;
1221+ bool ret = false;
10541222
10551223 /* this is the last extent */
10561224 if (em->start + em->len >= i_size_read(inode))
10571225 return false;
10581226
1059− next = defrag_lookup_extent(inode, em->start + em->len, locked);
1227+ /*
1228+ * We want to check if the next extent can be merged with the current
1229+ * one, which can be an extent created in a past generation, so we pass
1230+ * a minimum generation of 0 to defrag_lookup_extent().
1231+ */
1232+ next = defrag_lookup_extent(inode, em->start + em->len, 0, locked);
1233+ /* No more em or hole */
10601234 if (!next || next->block_start >= EXTENT_MAP_LAST_BYTE)
1061− ret = false;
1062− else if ((em->block_start + em->block_len == next->block_start) &&
1063− (em->block_len > SZ_128K && next->block_len > SZ_128K))
1064− ret = false;
1065−
1235+ goto out;
1236+ if (test_bit(EXTENT_FLAG_PREALLOC, &next->flags))
1237+ goto out;
1238+ /*
1239+ * If the next extent is at its max capacity, defragging current extent
1240+ * makes no sense, as the total number of extents won't change.
1241+ */
1242+ if (next->len >= get_extent_max_capacity(em))
1243+ goto out;
1244+ ret = true;
1245+out:
10661246 free_extent_map(next);
10671247 return ret;
10681248 }
@@ -1186,8 +1366,10 @@ struct defrag_target_range { · 117 unmodified lines
11861366 static int defrag_collect_targets(struct btrfs_inode *inode,
11871367 u64 start, u64 len, u32 extent_thresh,
11881368 u64 newer_than, bool do_compress,
1189− bool locked, struct list_head *target_list)
1369+ bool locked, struct list_head *target_list,
1370+ u64 *last_scanned_ret)
11901371 {
1372+ bool last_is_target = false;
11911373 u64 cur = start;
11921374 int ret = 0;
11931375
@@ -1197,7 +1379,9 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 3 unmodified lines
11971379 bool next_mergeable = true;
11981380 u64 range_len;
11991381
1200− em = defrag_lookup_extent(&inode->vfs_inode, cur, locked);
1382+ last_is_target = false;
1383+ em = defrag_lookup_extent(&inode->vfs_inode, cur,
1384+ newer_than, locked);
12011385 if (!em)
12021386 break;
12031387
@@ -1210,6 +1394,10 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 6 unmodified lines
12101394 if (em->generation < newer_than)
12111395 goto next;
12121396
1397+ /* This em is under writeback, no need to defrag */
1398+ if (em->generation == (u64)-1)
1399+ goto next;
1400+
12131401 /*
12141402 * Our start offset might be in the middle of an existing extent
12151403 * map, so take that into account.
@@ -1250,6 +1438,13 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 34 unmodified lines
12501438 if (range_len >= extent_thresh)
12511439 goto next;
12521440
1441+ /*
1442+ * Skip extents already at its max capacity, this is mostly for
1443+ * compressed extents, which max cap is only 128K.
1444+ */
1445+ if (em->len >= get_extent_max_capacity(em))
1446+ goto next;
1447+
12531448 next_mergeable = defrag_check_next_extent(&inode->vfs_inode, em,
12541449 locked);
12551450 if (!next_mergeable) {
@@ -1268,6 +1463,7 @@ static int defrag_collect_targets(struct btrfs_inode *inode, · 12 unmodified lines
12681463 }
12691464
12701465 add:
1466+ last_is_target = true;
12711467 range_len = min(extent_map_end(em), start + len) - cur;
12721468 /*
12731469 * This one is a good target, check if it can be merged into
@@ -1311,6 +1507,17 @@ next: · 37 unmodified lines
13111507 kfree(entry);
13121508 }
13131509 }
1510+ if (!ret && last_scanned_ret) {
1511+ /*
1512+ * If the last extent is not a target, the caller can skip to
1513+ * the end of that extent.
1514+ * Otherwise, we can only go the end of the specified range.
1515+ */
1516+ if (!last_is_target)
1517+ *last_scanned_ret = max(cur, *last_scanned_ret);
1518+ else
1519+ *last_scanned_ret = max(start + len, *last_scanned_ret);
1520+ }
13141521 return ret;
13151522 }
13161523
@@ -1369,7 +1576,8 @@ static int defrag_one_locked_target(struct btrfs_inode *inode, · 52 unmodified lines
13691576 }
13701577
13711578 static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len,
1372− u32 extent_thresh, u64 newer_than, bool do_compress)
1579+ u32 extent_thresh, u64 newer_than, bool do_compress,
1580+ u64 *last_scanned_ret)
13731581 {
13741582 struct extent_state *cached_state = NULL;
13751583 struct defrag_target_range *entry;
@@ -1415,7 +1623,7 @@ static int defrag_one_range(struct btrfs_inode *inode, u64 start, u32 len, · 39 unmodified lines
14151623 */
14161624 ret = defrag_collect_targets(inode, start, len, extent_thresh,
14171625 newer_than, do_compress, true,
1418− &target_list);
1626+ &target_list, last_scanned_ret);
14191627 if (ret < 0)
14201628 goto unlock_extent;
14211629
@@ -1450,7 +1658,8 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 28 unmodified lines
14501658 u64 start, u32 len, u32 extent_thresh,
14511659 u64 newer_than, bool do_compress,
14521660 unsigned long *sectors_defragged,
1453− unsigned long max_sectors)
1661+ unsigned long max_sectors,
1662+ u64 *last_scanned_ret)
14541663 {
14551664 const u32 sectorsize = inode->root->fs_info->sectorsize;
14561665 struct defrag_target_range *entry;
@@ -1461,7 +1670,7 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 4 unmodified lines
14611670 BUILD_BUG_ON(!IS_ALIGNED(CLUSTER_SIZE, PAGE_SIZE));
14621671 ret = defrag_collect_targets(inode, start, len, extent_thresh,
14631672 newer_than, do_compress, false,
1464− &target_list);
1673+ &target_list, NULL);
14651674 if (ret < 0)
14661675 goto out;
14671676
@@ -1478,6 +1687,15 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 10 unmodified lines
14781687 range_len = min_t(u32, range_len,
14791688 (max_sectors - *sectors_defragged) * sectorsize);
14801689
1690+ /*
1691+ * If defrag_one_range() has updated last_scanned_ret,
1692+ * our range may already be invalid (e.g. hole punched).
1693+ * Skip if our range is before last_scanned_ret, as there is
1694+ * no need to defrag the range anymore.
1695+ */
1696+ if (entry->start + range_len <= *last_scanned_ret)
1697+ continue;
1698+
14811699 if (ra)
14821700 page_cache_sync_readahead(inode->vfs_inode.i_mapping,
14831701 ra, NULL, entry->start >> PAGE_SHIFT,
@@ -1490,7 +1708,8 @@ static int defrag_one_cluster(struct btrfs_inode *inode, · 6 unmodified lines
14901708 * accounting.
14911709 */
14921710 ret = defrag_one_range(inode, entry->start, range_len,
1493− extent_thresh, newer_than, do_compress);
1711+ extent_thresh, newer_than, do_compress,
1712+ last_scanned_ret);
14941713 if (ret < 0)
14951714 break;
14961715 *sectors_defragged += range_len >>
@@ -1501,6 +1720,8 @@ out: · 4 unmodified lines
15011720 list_del_init(&entry->list);
15021721 kfree(entry);
15031722 }
1723+ if (ret >= 0)
1724+ *last_scanned_ret = max(*last_scanned_ret, start + len);
15041725 return ret;
15051726 }
15061727
@@ -1586,6 +1807,7 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, · 79 unmodified lines
15861807
15871808 while (cur < last_byte) {
15881809 const unsigned long prev_sectors_defragged = sectors_defragged;
1810+ u64 last_scanned = cur;
15891811 u64 cluster_end;
15901812
15911813 /* The cluster size 256K should always be page aligned */
@@ -1615,8 +1837,8 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, · 23 unmodified lines
16151837 BTRFS_I(inode)->defrag_compress = compress_type;
16161838 ret = defrag_one_cluster(BTRFS_I(inode), ra, cur,
16171839 cluster_end + 1 - cur, extent_thresh,
1618− newer_than, do_compress,
1619− &sectors_defragged, max_to_defrag);
1840+ newer_than, do_compress, &sectors_defragged,
1841+ max_to_defrag, &last_scanned);
16201842
16211843 if (sectors_defragged > prev_sectors_defragged)
16221844 balance_dirty_pages_ratelimited(inode->i_mapping);
@@ -1624,11 +1846,12 @@ int btrfs_defrag_file(struct inode *inode, struct file_ra_state *ra, · 1 unmodified line
16241846 btrfs_inode_unlock(inode, 0);
16251847 if (ret < 0)
16261848 break;
1627− cur = cluster_end + 1;
1849+ cur = max(cluster_end + 1, last_scanned);
16281850 if (ret > 0) {
16291851 ret = 0;
16301852 break;
16311853 }
1854+ cond_resched();
16321855 }
16331856
16341857 if (ra_allocated)
fs/btrfs/lzo.c+11−0
@@ -380,6 +380,17 @@ int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb) · 379 unmodified lines
380380 kunmap(cur_page);
381381 cur_in += LZO_LEN;
382382
383+ if (seg_len > lzo1x_worst_compress(PAGE_SIZE)) {
384+ /*
385+ * seg_len shouldn't be larger than we have allocated
386+ * for workspace->cbuf
387+ */
388+ btrfs_err(fs_info, "unexpectedly large lzo segment len %u",
389+ seg_len);
390+ ret = -EIO;
391+ goto out;
392+ }
393+
383394 /* Copy the compressed segment payload into workspace */
384395 copy_compressed_segment(cb, workspace->cbuf, seg_len, &cur_in);
385396
fs/btrfs/send.c+4−0
@@ -4999,6 +4999,10 @@ static int put_file_data(struct send_ctx *sctx, u64 offset, u32 len) · 4998 unmodified lines
49994999 lock_page(page);
50005000 if (!PageUptodate(page)) {
50015001 unlock_page(page);
5002+ btrfs_err(fs_info,
5003+ "send: IO error at offset %llu for inode %llu root %llu",
5004+ page_offset(page), sctx->cur_ino,
5005+ sctx->send_root->root_key.objectid);
50025006 put_page(page);
50035007 ret = -EIO;
50045008 break;
fs/btrfs/transaction.c+10−2
@@ -1981,16 +1981,24 @@ static void btrfs_cleanup_pending_block_groups(struct btrfs_trans_handle *trans) · 1980 unmodified lines
19811981 static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info)
19821982 {
19831983 /*
1984− * We use writeback_inodes_sb here because if we used
1984+ * We use try_to_writeback_inodes_sb() here because if we used
19851985 * btrfs_start_delalloc_roots we would deadlock with fs freeze.
19861986 * Currently are holding the fs freeze lock, if we do an async flush
19871987 * we'll do btrfs_join_transaction() and deadlock because we need to
19881988 * wait for the fs freeze lock. Using the direct flushing we benefit
19891989 * from already being in a transaction and our join_transaction doesn't
19901990 * have to re-take the fs freeze lock.
1991+ *
1992+ * Note that try_to_writeback_inodes_sb() will only trigger writeback
1993+ * if it can read lock sb->s_umount. It will always be able to lock it,
1994+ * except when the filesystem is being unmounted or being frozen, but in
1995+ * those cases sync_filesystem() is called, which results in calling
1996+ * writeback_inodes_sb() while holding a write lock on sb->s_umount.
1997+ * Note that we don't call writeback_inodes_sb() directly, because it
1998+ * will emit a warning if sb->s_umount is not locked.
19911999 */
19922000 if (btrfs_test_opt(fs_info, FLUSHONCOMMIT))
1993− writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC);
2001+ try_to_writeback_inodes_sb(fs_info->sb, WB_REASON_SYNC);
19942002 return 0;
19952003 }
19962004
fs/cifs/cifsacl.c+6−3
@@ -949,6 +949,9 @@ static void populate_new_aces(char *nacl_base, · 948 unmodified lines
949949 pnntace = (struct cifs_ace *) (nacl_base + nsize);
950950 nsize += setup_special_mode_ACE(pnntace, nmode);
951951 num_aces++;
952+ pnntace = (struct cifs_ace *) (nacl_base + nsize);
953+ nsize += setup_authusers_ACE(pnntace);
954+ num_aces++;
952955 goto set_size;
953956 }
954957
@@ -1297,7 +1300,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, · 342 unmodified lines
12971300
12981301 if (uid_valid(uid)) { /* chown */
12991302 uid_t id;
1300− nowner_sid_ptr = kmalloc(sizeof(struct cifs_sid),
1303+ nowner_sid_ptr = kzalloc(sizeof(struct cifs_sid),
13011304 GFP_KERNEL);
13021305 if (!nowner_sid_ptr) {
13031306 rc = -ENOMEM;
@@ -1326,7 +1329,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, · 22 unmodified lines
13261329 }
13271330 if (gid_valid(gid)) { /* chgrp */
13281331 gid_t id;
1329− ngroup_sid_ptr = kmalloc(sizeof(struct cifs_sid),
1332+ ngroup_sid_ptr = kzalloc(sizeof(struct cifs_sid),
13301333 GFP_KERNEL);
13311334 if (!ngroup_sid_ptr) {
13321335 rc = -ENOMEM;
@@ -1613,7 +1616,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode, · 280 unmodified lines
16131616 nsecdesclen = secdesclen;
16141617 if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */
16151618 if (mode_from_sid)
1616− nsecdesclen += sizeof(struct cifs_ace);
1619+ nsecdesclen += 2 * sizeof(struct cifs_ace);
16171620 else /* cifsacl */
16181621 nsecdesclen += 5 * sizeof(struct cifs_ace);
16191622 } else { /* chown */
fs/cifs/cifsfs.c+1−0
@@ -919,6 +919,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, · 918 unmodified lines
919919
920920 out_super:
921921 deactivate_locked_super(sb);
922+ return root;
922923 out:
923924 if (cifs_sb) {
924925 kfree(cifs_sb->prepath);
fs/cifs/fs_context.c+2−2
@@ -149,7 +149,7 @@ const struct fs_parameter_spec smb3_fs_parameters[] = { · 148 unmodified lines
149149 fsparam_u32("echo_interval", Opt_echo_interval),
150150 fsparam_u32("max_credits", Opt_max_credits),
151151 fsparam_u32("handletimeout", Opt_handletimeout),
152− fsparam_u32("snapshot", Opt_snapshot),
152+ fsparam_u64("snapshot", Opt_snapshot),
153153 fsparam_u32("max_channels", Opt_max_channels),
154154
155155 /* Mount options which take string value */
@@ -1078,7 +1078,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, · 922 unmodified lines
10781078 ctx->echo_interval = result.uint_32;
10791079 break;
10801080 case Opt_snapshot:
1081− ctx->snapshot_time = result.uint_32;
1081+ ctx->snapshot_time = result.uint_64;
10821082 break;
10831083 case Opt_max_credits:
10841084 if (result.uint_32 < 20 || result.uint_32 > 60000) {
fs/cifs/sess.c+6−5
@@ -127,11 +127,6 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) · 126 unmodified lines
127127 struct cifs_server_iface *ifaces = NULL;
128128 size_t iface_count;
129129
130− if (ses->server->dialect < SMB30_PROT_ID) {
131− cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n");
132− return 0;
133− }
134−
135130 spin_lock(&ses->chan_lock);
136131
137132 new_chan_count = old_chan_count = ses->chan_count;
@@ -145,6 +140,12 @@ int cifs_try_adding_channels(struct cifs_sb_info *cifs_sb, struct cifs_ses *ses) · 7 unmodified lines
145140 return 0;
146141 }
147142
143+ if (ses->server->dialect < SMB30_PROT_ID) {
144+ spin_unlock(&ses->chan_lock);
145+ cifs_dbg(VFS, "multichannel is not supported on this protocol version, use 3.0 or above\n");
146+ return 0;
147+ }
148+
148149 if (!(ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) {
149150 ses->chan_max = 1;
150151 spin_unlock(&ses->chan_lock);
fs/cifs/xattr.c+2−0
@@ -175,11 +175,13 @@ static int cifs_xattr_set(const struct xattr_handler *handler, · 174 unmodified lines
175175 switch (handler->flags) {
176176 case XATTR_CIFS_NTSD_FULL:
177177 aclflags = (CIFS_ACL_OWNER |
178+ CIFS_ACL_GROUP |
178179 CIFS_ACL_DACL |
179180 CIFS_ACL_SACL);
180181 break;
181182 case XATTR_CIFS_NTSD:
182183 aclflags = (CIFS_ACL_OWNER |
184+ CIFS_ACL_GROUP |
183185 CIFS_ACL_DACL);
184186 break;
185187 case XATTR_CIFS_ACL:
fs/configfs/dir.c+14−0
@@ -34,6 +34,14 @@ · 33 unmodified lines
3434 */
3535 DEFINE_SPINLOCK(configfs_dirent_lock);
3636
37+/*
38+ * All of link_obj/unlink_obj/link_group/unlink_group require that
39+ * subsys->su_mutex is held.
40+ * But parent configfs_subsystem is NULL when config_item is root.
41+ * Use this mutex when config_item is root.
42+ */
43+static DEFINE_MUTEX(configfs_subsystem_mutex);
44+
3745 static void configfs_d_iput(struct dentry * dentry,
3846 struct inode * inode)
3947 {
@@ -1859,7 +1867,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) · 1819 unmodified lines
18591867 group->cg_item.ci_name = group->cg_item.ci_namebuf;
18601868
18611869 sd = root->d_fsdata;
1870+ mutex_lock(&configfs_subsystem_mutex);
18621871 link_group(to_config_group(sd->s_element), group);
1872+ mutex_unlock(&configfs_subsystem_mutex);
18631873
18641874 inode_lock_nested(d_inode(root), I_MUTEX_PARENT);
18651875
@@ -1884,7 +1894,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) · 18 unmodified lines
18841894 inode_unlock(d_inode(root));
18851895
18861896 if (err) {
1897+ mutex_lock(&configfs_subsystem_mutex);
18871898 unlink_group(group);
1899+ mutex_unlock(&configfs_subsystem_mutex);
18881900 configfs_release_fs();
18891901 }
18901902 put_fragment(frag);
@@ -1931,7 +1943,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) · 40 unmodified lines
19311943
19321944 dput(dentry);
19331945
1946+ mutex_lock(&configfs_subsystem_mutex);
19341947 unlink_group(group);
1948+ mutex_unlock(&configfs_subsystem_mutex);
19351949 configfs_release_fs();
19361950 }
19371951
fs/file_table.c+6−2
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/task_work.h>
2828 #include <linux/ima.h>
2929 #include <linux/swap.h>
30+#include <linux/kmemleak.h>
3031
3132 #include <linux/atomic.h>
3233
@@ -119,8 +120,11 @@ static struct ctl_table fs_stat_sysctls[] = { · 86 unmodified lines
119120 static int __init init_fs_stat_sysctls(void)
120121 {
121122 register_sysctl_init("fs", fs_stat_sysctls);
122− if (IS_ENABLED(CONFIG_BINFMT_MISC))
123− register_sysctl_mount_point("fs/binfmt_misc");
123+ if (IS_ENABLED(CONFIG_BINFMT_MISC)) {
124+ struct ctl_table_header *hdr;
125+ hdr = register_sysctl_mount_point("fs/binfmt_misc");
126+ kmemleak_not_leak(hdr);
127+ }
124128 return 0;
125129 }
126130 fs_initcall(init_fs_stat_sysctls);
fs/io_uring.c+17−7
@@ -4567,6 +4567,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) · 4566 unmodified lines
45674567 } else {
45684568 list_add_tail(&buf->list, &(*head)->list);
45694569 }
4570+ cond_resched();
45704571 }
45714572
45724573 return i ? i : -ENOMEM;
@@ -7693,7 +7694,7 @@ static int io_run_task_work_sig(void) · 3120 unmodified lines
76937694 /* when returns >0, the caller should retry */
76947695 static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx,
76957696 struct io_wait_queue *iowq,
7696− signed long *timeout)
7697+ ktime_t timeout)
76977698 {
76987699 int ret;
76997700
@@ -7705,8 +7706,9 @@ static inline int io_cqring_wait_schedule(struct io_ring_ctx *ctx, · 5 unmodified lines
77057706 if (test_bit(0, &ctx->check_cq_overflow))
77067707 return 1;
77077708
7708− *timeout = schedule_timeout(*timeout);
7709− return !*timeout ? -ETIME : 1;
7709+ if (!schedule_hrtimeout(&timeout, HRTIMER_MODE_ABS))
7710+ return -ETIME;
7711+ return 1;
77107712 }
77117713
77127714 /*
@@ -7719,7 +7721,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 6 unmodified lines
77197721 {
77207722 struct io_wait_queue iowq;
77217723 struct io_rings *rings = ctx->rings;
7722− signed long timeout = MAX_SCHEDULE_TIMEOUT;
7724+ ktime_t timeout = KTIME_MAX;
77237725 int ret;
77247726
77257727 do {
@@ -7735,7 +7737,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 9 unmodified lines
77357737
77367738 if (get_timespec64(&ts, uts))
77377739 return -EFAULT;
7738− timeout = timespec64_to_jiffies(&ts);
7740+ timeout = ktime_add_ns(timespec64_to_ktime(ts), ktime_get_ns());
77397741 }
77407742
77417743 if (sig) {
@@ -7767,7 +7769,7 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, · 25 unmodified lines
77677769 }
77687770 prepare_to_wait_exclusive(&ctx->cq_wait, &iowq.wq,
77697771 TASK_INTERRUPTIBLE);
7770− ret = io_cqring_wait_schedule(ctx, &iowq, &timeout);
7772+ ret = io_cqring_wait_schedule(ctx, &iowq, timeout);
77717773 finish_wait(&ctx->cq_wait, &iowq.wq);
77727774 cond_resched();
77737775 } while (ret > 0);
@@ -7924,7 +7926,15 @@ static __cold int io_rsrc_ref_quiesce(struct io_rsrc_data *data, · 150 unmodified lines
79247926 ret = wait_for_completion_interruptible(&data->done);
79257927 if (!ret) {
79267928 mutex_lock(&ctx->uring_lock);
7927− break;
7929+ if (atomic_read(&data->refs) > 0) {
7930+ /*
7931+ * it has been revived by another thread while
7932+ * we were unlocked
7933+ */
7934+ mutex_unlock(&ctx->uring_lock);
7935+ } else {
7936+ break;
7937+ }
79287938 }
79297939
79307940 atomic_inc(&data->refs);
fs/namespace.c+30−0
@@ -469,6 +469,24 @@ void mnt_drop_write_file(struct file *file) · 468 unmodified lines
469469 }
470470 EXPORT_SYMBOL(mnt_drop_write_file);
471471
472+/**
473+ * mnt_hold_writers - prevent write access to the given mount
474+ * @mnt: mnt to prevent write access to
475+ *
476+ * Prevents write access to @mnt if there are no active writers for @mnt.
477+ * This function needs to be called and return successfully before changing
478+ * properties of @mnt that need to remain stable for callers with write access
479+ * to @mnt.
480+ *
481+ * After this functions has been called successfully callers must pair it with
482+ * a call to mnt_unhold_writers() in order to stop preventing write access to
483+ * @mnt.
484+ *
485+ * Context: This function expects lock_mount_hash() to be held serializing
486+ * setting MNT_WRITE_HOLD.
487+ * Return: On success 0 is returned.
488+ * On error, -EBUSY is returned.
489+ */
472490 static inline int mnt_hold_writers(struct mount *mnt)
473491 {
474492 mnt->mnt.mnt_flags |= MNT_WRITE_HOLD;
@@ -500,6 +518,18 @@ static inline int mnt_hold_writers(struct mount *mnt) · 25 unmodified lines
500518 return 0;
501519 }
502520
521+/**
522+ * mnt_unhold_writers - stop preventing write access to the given mount
523+ * @mnt: mnt to stop preventing write access to
524+ *
525+ * Stop preventing write access to @mnt allowing callers to gain write access
526+ * to @mnt again.
527+ *
528+ * This function can only be called after a successful call to
529+ * mnt_hold_writers().
530+ *
531+ * Context: This function expects lock_mount_hash() to be held.
532+ */
503533 static inline void mnt_unhold_writers(struct mount *mnt)
504534 {
505535 /*
fs/nfs/dir.c+2−2
@@ -2010,14 +2010,14 @@ no_open: · 2009 unmodified lines
20102010 if (!res) {
20112011 inode = d_inode(dentry);
20122012 if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
2013− !S_ISDIR(inode->i_mode))
2013+ !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
20142014 res = ERR_PTR(-ENOTDIR);
20152015 else if (inode && S_ISREG(inode->i_mode))
20162016 res = ERR_PTR(-EOPENSTALE);
20172017 } else if (!IS_ERR(res)) {
20182018 inode = d_inode(res);
20192019 if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
2020− !S_ISDIR(inode->i_mode)) {
2020+ !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
20212021 dput(res);
20222022 res = ERR_PTR(-ENOTDIR);
20232023 } else if (inode && S_ISREG(inode->i_mode)) {
fs/nfs/inode.c+3−6
@@ -853,12 +853,9 @@ int nfs_getattr(struct user_namespace *mnt_userns, const struct path *path, · 852 unmodified lines
853853 }
854854
855855 /* Flush out writes to the server in order to update c/mtime. */
856− if ((request_mask & (STATX_CTIME|STATX_MTIME)) &&
857− S_ISREG(inode->i_mode)) {
858− err = filemap_write_and_wait(inode->i_mapping);
859− if (err)
860− goto out;
861− }
856+ if ((request_mask & (STATX_CTIME | STATX_MTIME)) &&
857+ S_ISREG(inode->i_mode))
858+ filemap_write_and_wait(inode->i_mapping);
862859
863860 /*
864861 * We may force a getattr if the user cares about atime.
fs/nfs/nfs4proc.c+1−2
@@ -1229,8 +1229,7 @@ nfs4_update_changeattr_locked(struct inode *inode, · 1228 unmodified lines
12291229 NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL |
12301230 NFS_INO_INVALID_SIZE | NFS_INO_INVALID_OTHER |
12311231 NFS_INO_INVALID_BLOCKS | NFS_INO_INVALID_NLINK |
1232− NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR |
1233− NFS_INO_REVAL_PAGECACHE;
1232+ NFS_INO_INVALID_MODE | NFS_INO_INVALID_XATTR;
12341233 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
12351234 }
12361235 nfsi->attrtimeo_timestamp = jiffies;
fs/tracefs/inode.c+3−2
@@ -264,7 +264,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) · 263 unmodified lines
264264 if (!gid_valid(gid))
265265 return -EINVAL;
266266 opts->gid = gid;
267− set_gid(tracefs_mount->mnt_root, gid);
268267 break;
269268 case Opt_mode:
270269 if (match_octal(&args[0], &option))
@@ -291,7 +290,9 @@ static int tracefs_apply_options(struct super_block *sb) · 20 unmodified lines
291290 inode->i_mode |= opts->mode;
292291
293292 inode->i_uid = opts->uid;
294− inode->i_gid = opts->gid;
293+
294+ /* Set all the group ids to the mount option */
295+ set_gid(sb->s_root, opts->gid);
295296
296297 return 0;
297298 }
fs/xfs/xfs_super.c+5−2
@@ -1753,6 +1753,11 @@ xfs_remount_ro( · 1752 unmodified lines
17531753 };
17541754 int error;
17551755
1756+ /* Flush all the dirty data to disk. */
1757+ error = sync_filesystem(mp->m_super);
1758+ if (error)
1759+ return error;
1760+
17561761 /*
17571762 * Cancel background eofb scanning so it cannot race with the final
17581763 * log force+buftarg wait and deadlock the remount.
@@ -1831,8 +1836,6 @@ xfs_fs_reconfigure( · 72 unmodified lines
18311836 if (error)
18321837 return error;
18331838
1834− sync_filesystem(mp->m_super);
1835−
18361839 /* inode32 -> inode64 */
18371840 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) {
18381841 mp->m_features &= ~XFS_FEAT_SMALL_INUMS;
include/linux/blkdev.h+2−1
@@ -748,7 +748,8 @@ extern bool blk_queue_can_use_dma_map_merging(struct request_queue *q, · 747 unmodified lines
748748
749749 bool __must_check blk_get_queue(struct request_queue *);
750750 extern void blk_put_queue(struct request_queue *);
751−extern void blk_set_queue_dying(struct request_queue *);
751+
752+void blk_mark_disk_dead(struct gendisk *disk);
752753
753754 #ifdef CONFIG_BLOCK
754755 /*
include/linux/bpf.h+4−5
@@ -209,11 +209,9 @@ static inline bool map_value_has_timer(const struct bpf_map *map) · 208 unmodified lines
209209 static inline void check_and_init_map_value(struct bpf_map *map, void *dst)
210210 {
211211 if (unlikely(map_value_has_spin_lock(map)))
212− *(struct bpf_spin_lock *)(dst + map->spin_lock_off) =
213− (struct bpf_spin_lock){};
212+ memset(dst + map->spin_lock_off, 0, sizeof(struct bpf_spin_lock));
214213 if (unlikely(map_value_has_timer(map)))
215− *(struct bpf_timer *)(dst + map->timer_off) =
216− (struct bpf_timer){};
214+ memset(dst + map->timer_off, 0, sizeof(struct bpf_timer));
217215 }
218216
219217 /* copy everything but bpf_spin_lock and bpf_timer. There could be one of each. */
@@ -224,7 +222,8 @@ static inline void copy_map_value(struct bpf_map *map, void *dst, void *src) · 4 unmodified lines
224222 if (unlikely(map_value_has_spin_lock(map))) {
225223 s_off = map->spin_lock_off;
226224 s_sz = sizeof(struct bpf_spin_lock);
227− } else if (unlikely(map_value_has_timer(map))) {
225+ }
226+ if (unlikely(map_value_has_timer(map))) {
228227 t_off = map->timer_off;
229228 t_sz = sizeof(struct bpf_timer);
230229 }
include/linux/cpufreq.h+3−0
@@ -382,6 +382,9 @@ struct cpufreq_driver { · 381 unmodified lines
382382 int (*suspend)(struct cpufreq_policy *policy);
383383 int (*resume)(struct cpufreq_policy *policy);
384384
385+ /* Will be called after the driver is fully initialized */
386+ void (*ready)(struct cpufreq_policy *policy);
387+
385388 struct freq_attr **attr;
386389
387390 /* platform specific boost support code */
include/linux/dma-mapping.h+8−0
@@ -61,6 +61,14 @@ · 60 unmodified lines
6161 */
6262 #define DMA_ATTR_PRIVILEGED (1UL << 9)
6363
64+/*
65+ * This is a hint to the DMA-mapping subsystem that the device is expected
66+ * to overwrite the entire mapped size, thus the caller does not require any
67+ * of the previous buffer contents to be preserved. This allows
68+ * bounce-buffering implementations to optimise DMA_FROM_DEVICE transfers.
69+ */
70+#define DMA_ATTR_OVERWRITE (1UL << 10)
71+
6472 /*
6573 * A dma_addr_t can hold any valid DMA or bus address for the platform. It can
6674 * be given to a device to use as a DMA source or target. It is specific to a
include/linux/hyperv.h+1−0
@@ -1262,6 +1262,7 @@ struct hv_device { · 1261 unmodified lines
12621262 struct vmbus_channel *channel;
12631263 struct kset *channels_kset;
12641264 struct device_dma_parameters dma_parms;
1265+ u64 dma_mask;
12651266
12661267 /* place holder to keep track of the dir for hv device in debugfs */
12671268 struct dentry *debug_dir;
include/linux/netdevice.h+1−1
@@ -2158,7 +2158,7 @@ struct net_device { · 2157 unmodified lines
21582158 struct netdev_queue *_tx ____cacheline_aligned_in_smp;
21592159 unsigned int num_tx_queues;
21602160 unsigned int real_num_tx_queues;
2161− struct Qdisc *qdisc;
2161+ struct Qdisc __rcu *qdisc;
21622162 unsigned int tx_queue_len;
21632163 spinlock_t tx_global_lock;
21642164
include/linux/nvme-tcp.h+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #define NVME_TCP_DISC_PORT 8009
1313 #define NVME_TCP_ADMIN_CCSZ SZ_8K
1414 #define NVME_TCP_DIGEST_LENGTH 4
15+#define NVME_TCP_MIN_MAXH2CDATA 4096
1516
1617 enum nvme_tcp_pfv {
1718 NVME_TCP_PFV_1_0 = 0x0,
include/linux/nvmem-provider.h+3−1
@@ -70,7 +70,8 @@ struct nvmem_keepout { · 69 unmodified lines
7070 * @word_size: Minimum read/write access granularity.
7171 * @stride: Minimum read/write access stride.
7272 * @priv: User context passed to read/write callbacks.
73− * @wp-gpio: Write protect pin
73+ * @wp-gpio: Write protect pin
74+ * @ignore_wp: Write Protect pin is managed by the provider.
7475 *
7576 * Note: A default "nvmem<id>" name will be assigned to the device if
7677 * no name is specified in its configuration. In such case "<id>" is
@@ -92,6 +93,7 @@ struct nvmem_config { · 15 unmodified lines
9293 enum nvmem_type type;
9394 bool read_only;
9495 bool root_only;
96+ bool ignore_wp;
9597 struct device_node *of_node;
9698 bool no_of_node;
9799 nvmem_reg_read_t reg_read;
include/linux/sched/task.h+2−2
@@ -54,8 +54,8 @@ extern asmlinkage void schedule_tail(struct task_struct *prev); · 53 unmodified lines
5454 extern void init_idle(struct task_struct *idle, int cpu);
5555
5656 extern int sched_fork(unsigned long clone_flags, struct task_struct *p);
57−extern void sched_post_fork(struct task_struct *p,
58− struct kernel_clone_args *kargs);
57+extern void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs);
58+extern void sched_post_fork(struct task_struct *p);
5959 extern void sched_dead(struct task_struct *p);
6060
6161 void __noreturn do_task_dead(void);
include/linux/slab.h+1−2
@@ -660,8 +660,7 @@ static inline __alloc_size(1, 2) void *kcalloc(size_t n, size_t size, gfp_t flag · 659 unmodified lines
660660 * allocator where we care about the real place the memory allocation
661661 * request comes from.
662662 */
663−extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller)
664− __alloc_size(1);
663+extern void *__kmalloc_track_caller(size_t size, gfp_t flags, unsigned long caller);
665664 #define kmalloc_track_caller(size, flags) \
666665 __kmalloc_track_caller(size, flags, _RET_IP_)
667666
include/linux/trace_events.h+12−10
@@ -699,6 +699,8 @@ event_triggers_post_call(struct trace_event_file *file, · 698 unmodified lines
699699
700700 bool trace_event_ignore_this_pid(struct trace_event_file *trace_file);
701701
702+bool __trace_trigger_soft_disabled(struct trace_event_file *file);
703+
702704 /**
703705 * trace_trigger_soft_disabled - do triggers and test if soft disabled
704706 * @file: The file pointer of the event to test
@@ -708,20 +710,20 @@ bool trace_event_ignore_this_pid(struct trace_event_file *trace_file); · 3 unmodified lines
708710 * triggers that require testing the fields, it will return true,
709711 * otherwise false.
710712 */
711−static inline bool
713+static __always_inline bool
712714 trace_trigger_soft_disabled(struct trace_event_file *file)
713715 {
714716 unsigned long eflags = file->flags;
715717
716− if (!(eflags & EVENT_FILE_FL_TRIGGER_COND)) {
717− if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
718− event_triggers_call(file, NULL, NULL, NULL);
719− if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
720− return true;
721− if (eflags & EVENT_FILE_FL_PID_FILTER)
722− return trace_event_ignore_this_pid(file);
723− }
724− return false;
718+ if (likely(!(eflags & (EVENT_FILE_FL_TRIGGER_MODE |
719+ EVENT_FILE_FL_SOFT_DISABLED |
720+ EVENT_FILE_FL_PID_FILTER))))
721+ return false;
722+
723+ if (likely(eflags & EVENT_FILE_FL_TRIGGER_COND))
724+ return false;
725+
726+ return __trace_trigger_soft_disabled(file);
725727 }
726728
727729 #ifdef CONFIG_BPF_EVENTS
include/net/addrconf.h+0−2
@@ -109,8 +109,6 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, · 108 unmodified lines
109109 int ipv6_dev_get_saddr(struct net *net, const struct net_device *dev,
110110 const struct in6_addr *daddr, unsigned int srcprefs,
111111 struct in6_addr *saddr);
112−int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
113− u32 banned_flags);
114112 int ipv6_get_lladdr(struct net_device *dev, struct in6_addr *addr,
115113 u32 banned_flags);
116114 bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
include/net/bond_3ad.h+1−1
@@ -262,7 +262,7 @@ struct ad_system { · 261 unmodified lines
262262 struct ad_bond_info {
263263 struct ad_system system; /* 802.3ad system structure */
264264 struct bond_3ad_stats stats;
265− u32 agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */
265+ atomic_t agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */
266266 u16 aggregator_identifier;
267267 };
268268
include/net/checksum.h+29−23
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 #include <asm/checksum.h>
2323
2424 #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
25−static inline
25+static __always_inline
2626 __wsum csum_and_copy_from_user (const void __user *src, void *dst,
2727 int len)
2828 {
@@ -33,7 +33,7 @@ __wsum csum_and_copy_from_user (const void __user *src, void *dst, · 4 unmodified lines
3333 #endif
3434
3535 #ifndef HAVE_CSUM_COPY_USER
36−static __inline__ __wsum csum_and_copy_to_user
36+static __always_inline __wsum csum_and_copy_to_user
3737 (const void *src, void __user *dst, int len)
3838 {
3939 __wsum sum = csum_partial(src, len, ~0U);
@@ -45,7 +45,7 @@ static __inline__ __wsum csum_and_copy_to_user · 5 unmodified lines
4545 #endif
4646
4747 #ifndef _HAVE_ARCH_CSUM_AND_COPY
48−static inline __wsum
48+static __always_inline __wsum
4949 csum_partial_copy_nocheck(const void *src, void *dst, int len)
5050 {
5151 memcpy(dst, src, len);
@@ -54,7 +54,7 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len) · 2 unmodified lines
5454 #endif
5555
5656 #ifndef HAVE_ARCH_CSUM_ADD
57−static inline __wsum csum_add(__wsum csum, __wsum addend)
57+static __always_inline __wsum csum_add(__wsum csum, __wsum addend)
5858 {
5959 u32 res = (__force u32)csum;
6060 res += (__force u32)addend;
@@ -62,12 +62,12 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) · 1 unmodified line
6262 }
6363 #endif
6464
65−static inline __wsum csum_sub(__wsum csum, __wsum addend)
65+static __always_inline __wsum csum_sub(__wsum csum, __wsum addend)
6666 {
6767 return csum_add(csum, ~addend);
6868 }
6969
70−static inline __sum16 csum16_add(__sum16 csum, __be16 addend)
70+static __always_inline __sum16 csum16_add(__sum16 csum, __be16 addend)
7171 {
7272 u16 res = (__force u16)csum;
7373
@@ -75,12 +75,12 @@ static inline __sum16 csum16_add(__sum16 csum, __be16 addend) · 1 unmodified line
7575 return (__force __sum16)(res + (res < (__force u16)addend));
7676 }
7777
78−static inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
78+static __always_inline __sum16 csum16_sub(__sum16 csum, __be16 addend)
7979 {
8080 return csum16_add(csum, ~addend);
8181 }
8282
83−static inline __wsum csum_shift(__wsum sum, int offset)
83+static __always_inline __wsum csum_shift(__wsum sum, int offset)
8484 {
8585 /* rotate sum to align it with a 16b boundary */
8686 if (offset & 1)
@@ -88,42 +88,43 @@ static inline __wsum csum_shift(__wsum sum, int offset) · 1 unmodified line
8888 return sum;
8989 }
9090
91−static inline __wsum
91+static __always_inline __wsum
9292 csum_block_add(__wsum csum, __wsum csum2, int offset)
9393 {
9494 return csum_add(csum, csum_shift(csum2, offset));
9595 }
9696
97−static inline __wsum
97+static __always_inline __wsum
9898 csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
9999 {
100100 return csum_block_add(csum, csum2, offset);
101101 }
102102
103−static inline __wsum
103+static __always_inline __wsum
104104 csum_block_sub(__wsum csum, __wsum csum2, int offset)
105105 {
106106 return csum_block_add(csum, ~csum2, offset);
107107 }
108108
109−static inline __wsum csum_unfold(__sum16 n)
109+static __always_inline __wsum csum_unfold(__sum16 n)
110110 {
111111 return (__force __wsum)n;
112112 }
113113
114−static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
114+static __always_inline
115+__wsum csum_partial_ext(const void *buff, int len, __wsum sum)
115116 {
116117 return csum_partial(buff, len, sum);
117118 }
118119
119120 #define CSUM_MANGLED_0 ((__force __sum16)0xffff)
120121
121−static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
122+static __always_inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
122123 {
123124 *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum)));
124125 }
125126
126−static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
127+static __always_inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
127128 {
128129 __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from);
129130
@@ -136,11 +137,16 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) · 6 unmodified lines
136137 * m : old value of a 16bit field
137138 * m' : new value of a 16bit field
138139 */
139−static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
140+static __always_inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new)
140141 {
141142 *sum = ~csum16_add(csum16_sub(~(*sum), old), new);
142143 }
143144
145+static inline void csum_replace(__wsum *csum, __wsum old, __wsum new)
146+{
147+ *csum = csum_add(csum_sub(*csum, old), new);
148+}
149+
144150 struct sk_buff;
145151 void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
146152 __be32 from, __be32 to, bool pseudohdr);
@@ -150,16 +156,16 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, · 3 unmodified lines
150156 void inet_proto_csum_replace_by_diff(__sum16 *sum, struct sk_buff *skb,
151157 __wsum diff, bool pseudohdr);
152158
153−static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
154− __be16 from, __be16 to,
155− bool pseudohdr)
159+static __always_inline
160+void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb,
161+ __be16 from, __be16 to, bool pseudohdr)
156162 {
157163 inet_proto_csum_replace4(sum, skb, (__force __be32)from,
158164 (__force __be32)to, pseudohdr);
159165 }
160166
161−static inline __wsum remcsum_adjust(void *ptr, __wsum csum,
162− int start, int offset)
167+static __always_inline __wsum remcsum_adjust(void *ptr, __wsum csum,
168+ int start, int offset)
163169 {
164170 __sum16 *psum = (__sum16 *)(ptr + offset);
165171 __wsum delta;
@@ -175,12 +181,12 @@ static inline __wsum remcsum_adjust(void *ptr, __wsum csum, · 9 unmodified lines
175181 return delta;
176182 }
177183
178−static inline void remcsum_unadjust(__sum16 *psum, __wsum delta)
184+static __always_inline void remcsum_unadjust(__sum16 *psum, __wsum delta)
179185 {
180186 *psum = csum_fold(csum_sub(delta, (__force __wsum)*psum));
181187 }
182188
183−static inline __wsum wsum_negate(__wsum val)
189+static __always_inline __wsum wsum_negate(__wsum val)
184190 {
185191 return (__force __wsum)-((__force u32)val);
186192 }
include/net/dsa.h+1−0
@@ -1187,6 +1187,7 @@ void dsa_unregister_switch(struct dsa_switch *ds); · 1186 unmodified lines
11871187 int dsa_register_switch(struct dsa_switch *ds);
11881188 void dsa_switch_shutdown(struct dsa_switch *ds);
11891189 struct dsa_switch *dsa_switch_find(int tree_index, int sw_index);
1190+void dsa_flush_workqueue(void);
11901191 #ifdef CONFIG_PM_SLEEP
11911192 int dsa_switch_suspend(struct dsa_switch *ds);
11921193 int dsa_switch_resume(struct dsa_switch *ds);
include/net/ip6_fib.h+6−4
@@ -190,14 +190,16 @@ struct fib6_info { · 189 unmodified lines
190190 u32 fib6_metric;
191191 u8 fib6_protocol;
192192 u8 fib6_type;
193+
194+ u8 offload;
195+ u8 trap;
196+ u8 offload_failed;
197+
193198 u8 should_flush:1,
194199 dst_nocount:1,
195200 dst_nopolicy:1,
196201 fib6_destroying:1,
197− offload:1,
198− trap:1,
199− offload_failed:1,
200− unused:1;
202+ unused:4;
201203
202204 struct rcu_head rcu;
203205 struct nexthop *nh;
include/net/ipv6.h+4−1
@@ -393,17 +393,20 @@ static inline void txopt_put(struct ipv6_txoptions *opt) · 392 unmodified lines
393393 kfree_rcu(opt, rcu);
394394 }
395395
396+#if IS_ENABLED(CONFIG_IPV6)
396397 struct ip6_flowlabel *__fl6_sock_lookup(struct sock *sk, __be32 label);
397398
398399 extern struct static_key_false_deferred ipv6_flowlabel_exclusive;
399400 static inline struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk,
400401 __be32 label)
401402 {
402− if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key))
403+ if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key) &&
404+ READ_ONCE(sock_net(sk)->ipv6.flowlabel_has_excl))
403405 return __fl6_sock_lookup(sk, label) ? : ERR_PTR(-ENOENT);
404406
405407 return NULL;
406408 }
409+#endif
407410
408411 struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
409412 struct ip6_flowlabel *fl,
include/net/netfilter/nf_tables.h+1−1
@@ -905,9 +905,9 @@ struct nft_expr_ops { · 904 unmodified lines
905905 int (*offload)(struct nft_offload_ctx *ctx,
906906 struct nft_flow_rule *flow,
907907 const struct nft_expr *expr);
908+ bool (*offload_action)(const struct nft_expr *expr);
908909 void (*offload_stats)(struct nft_expr *expr,
909910 const struct flow_stats *stats);
910− u32 offload_flags;
911911 const struct nft_expr_type *type;
912912 void *data;
913913 };
include/net/netfilter/nf_tables_offload.h+0−2
@@ -67,8 +67,6 @@ struct nft_flow_rule { · 66 unmodified lines
6767 struct flow_rule *rule;
6868 };
6969
70−#define NFT_OFFLOAD_F_ACTION (1 << 0)
71−
7270 void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow,
7371 enum flow_dissector_key_id addr_type);
7472
include/net/netns/ipv6.h+2−1
@@ -77,9 +77,10 @@ struct netns_ipv6 { · 76 unmodified lines
7777 spinlock_t fib6_gc_lock;
7878 unsigned int ip6_rt_gc_expire;
7979 unsigned long ip6_rt_last_gc;
80+ unsigned char flowlabel_has_excl;
8081 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
81− unsigned int fib6_rules_require_fldissect;
8282 bool fib6_has_custom_rules;
83+ unsigned int fib6_rules_require_fldissect;
8384 #ifdef CONFIG_IPV6_SUBTREES
8485 unsigned int fib6_routes_require_src;
8586 #endif
include/net/sock.h+2−2
@@ -507,7 +507,7 @@ struct sock { · 506 unmodified lines
507507 #endif
508508 u16 sk_tsflags;
509509 u8 sk_shutdown;
510− u32 sk_tskey;
510+ atomic_t sk_tskey;
511511 atomic_t sk_zckey;
512512
513513 u8 sk_clockid;
@@ -2667,7 +2667,7 @@ static inline void _sock_tx_timestamp(struct sock *sk, __u16 tsflags, · 2153 unmodified lines
26672667 __sock_tx_timestamp(tsflags, tx_flags);
26682668 if (tsflags & SOF_TIMESTAMPING_OPT_ID && tskey &&
26692669 tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK)
2670− *tskey = sk->sk_tskey++;
2670+ *tskey = atomic_inc_return(&sk->sk_tskey) - 1;
26712671 }
26722672 if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS)))
26732673 *tx_flags |= SKBTX_WIFI_STATUS;
include/uapi/linux/kvm.h+1−0
@@ -1134,6 +1134,7 @@ struct kvm_ppc_resize_hpt { · 1133 unmodified lines
11341134 #define KVM_CAP_VM_GPA_BITS 207
11351135 #define KVM_CAP_XSAVE2 208
11361136 #define KVM_CAP_SYS_ATTRIBUTES 209
1137+#define KVM_CAP_PPC_AIL_MODE_3 210
11371138
11381139 #ifdef KVM_CAP_IRQ_ROUTING
11391140
kernel/bpf/btf.c+3−2
@@ -5688,7 +5688,8 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, · 5687 unmodified lines
56885688 }
56895689 if (check_ptr_off_reg(env, reg, regno))
56905690 return -EINVAL;
5691− } else if (is_kfunc && (reg->type == PTR_TO_BTF_ID || reg2btf_ids[reg->type])) {
5691+ } else if (is_kfunc && (reg->type == PTR_TO_BTF_ID ||
5692+ (reg2btf_ids[base_type(reg->type)] && !type_flag(reg->type)))) {
56925693 const struct btf_type *reg_ref_t;
56935694 const struct btf *reg_btf;
56945695 const char *reg_ref_tname;
@@ -5706,7 +5707,7 @@ static int btf_check_func_arg_match(struct bpf_verifier_env *env, · 11 unmodified lines
57065707 reg_ref_id = reg->btf_id;
57075708 } else {
57085709 reg_btf = btf_vmlinux;
5709− reg_ref_id = *reg2btf_ids[reg->type];
5710+ reg_ref_id = *reg2btf_ids[base_type(reg->type)];
57105711 }
57115712
57125713 reg_ref_t = btf_type_skip_modifiers(reg_btf, reg_ref_id,
kernel/bpf/helpers.c+2−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
33 */
44 #include <linux/bpf.h>
5+#include <linux/btf.h>
56 #include <linux/bpf-cgroup.h>
67 #include <linux/rcupdate.h>
78 #include <linux/random.h>
@@ -1075,6 +1076,7 @@ static enum hrtimer_restart bpf_timer_cb(struct hrtimer *hrtimer) · 1067 unmodified lines
10751076 void *key;
10761077 u32 idx;
10771078
1079+ BTF_TYPE_EMIT(struct bpf_timer);
10781080 callback_fn = rcu_dereference_check(t->callback_fn, rcu_read_lock_bh_held());
10791081 if (!callback_fn)
10801082 goto out;
kernel/bpf/syscall.c+3−0
@@ -1355,6 +1355,7 @@ int generic_map_delete_batch(struct bpf_map *map, · 1354 unmodified lines
13551355 maybe_wait_bpf_programs(map);
13561356 if (err)
13571357 break;
1358+ cond_resched();
13581359 }
13591360 if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp)))
13601361 err = -EFAULT;
@@ -1412,6 +1413,7 @@ int generic_map_update_batch(struct bpf_map *map, · 51 unmodified lines
14121413
14131414 if (err)
14141415 break;
1416+ cond_resched();
14151417 }
14161418
14171419 if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp)))
@@ -1509,6 +1511,7 @@ int generic_map_lookup_batch(struct bpf_map *map, · 91 unmodified lines
15091511 swap(prev_key, key);
15101512 retry = MAP_LOOKUP_RETRIES;
15111513 cp++;
1514+ cond_resched();
15121515 }
15131516
15141517 if (err == -EFAULT)
kernel/cgroup/cgroup-v1.c+4−2
@@ -546,6 +546,7 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 545 unmodified lines
546546 char *buf, size_t nbytes, loff_t off)
547547 {
548548 struct cgroup *cgrp;
549+ struct cgroup_file_ctx *ctx;
549550
550551 BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
551552
@@ -553,8 +554,9 @@ static ssize_t cgroup_release_agent_write(struct kernfs_open_file *of, · 1 unmodified line
553554 * Release agent gets called with all capabilities,
554555 * require capabilities to set release agent.
555556 */
556− if ((of->file->f_cred->user_ns != &init_user_ns) ||
557− !capable(CAP_SYS_ADMIN))
557+ ctx = of->priv;
558+ if ((ctx->ns->user_ns != &init_user_ns) ||
559+ !file_ns_capable(of->file, &init_user_ns, CAP_SYS_ADMIN))
558560 return -EPERM;
559561
560562 cgrp = cgroup_kn_lock_live(of->kn, false);
kernel/cgroup/cgroup.c+14−0
@@ -6166,6 +6166,20 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs) · 6165 unmodified lines
61666166 if (ret)
61676167 goto err;
61686168
6169+ /*
6170+ * Spawning a task directly into a cgroup works by passing a file
6171+ * descriptor to the target cgroup directory. This can even be an O_PATH
6172+ * file descriptor. But it can never be a cgroup.procs file descriptor.
6173+ * This was done on purpose so spawning into a cgroup could be
6174+ * conceptualized as an atomic
6175+ *
6176+ * fd = openat(dfd_cgroup, "cgroup.procs", ...);
6177+ * write(fd, <child-pid>, ...);
6178+ *
6179+ * sequence, i.e. it's a shorthand for the caller opening and writing
6180+ * cgroup.procs of the cgroup indicated by @dfd_cgroup. This allows us
6181+ * to always use the caller's credentials.
6182+ */
61696183 ret = cgroup_attach_permissions(cset->dfl_cgrp, dst_cgrp, sb,
61706184 !(kargs->flags & CLONE_THREAD),
61716185 current->nsproxy->cgroup_ns);
kernel/cgroup/cpuset.c+7−5
@@ -2289,6 +2289,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) · 2288 unmodified lines
22892289 cgroup_taskset_first(tset, &css);
22902290 cs = css_cs(css);
22912291
2292+ cpus_read_lock();
22922293 percpu_down_write(&cpuset_rwsem);
22932294
22942295 guarantee_online_mems(cs, &cpuset_attach_nodemask_to);
@@ -2342,6 +2343,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) · 47 unmodified lines
23422343 wake_up(&cpuset_attach_wq);
23432344
23442345 percpu_up_write(&cpuset_rwsem);
2346+ cpus_read_unlock();
23452347 }
23462348
23472349 /* The various types of files and directories in a cpuset file system */
@@ -3522,8 +3524,8 @@ static struct cpuset *nearest_hardwall_ancestor(struct cpuset *cs) · 1174 unmodified lines
35223524 return cs;
35233525 }
35243526
3525−/**
3526− * cpuset_node_allowed - Can we allocate on a memory node?
3527+/*
3528+ * __cpuset_node_allowed - Can we allocate on a memory node?
35273529 * @node: is this an allowed node?
35283530 * @gfp_mask: memory allocation flags
35293531 *
@@ -3694,8 +3696,8 @@ void cpuset_print_current_mems_allowed(void) · 164 unmodified lines
36943696
36953697 int cpuset_memory_pressure_enabled __read_mostly;
36963698
3697−/**
3698− * cpuset_memory_pressure_bump - keep stats of per-cpuset reclaims.
3699+/*
3700+ * __cpuset_memory_pressure_bump - keep stats of per-cpuset reclaims.
36993701 *
37003702 * Keep a running average of the rate of synchronous (direct)
37013703 * page reclaim efforts initiated by tasks in each cpuset.
@@ -3710,7 +3712,7 @@ int cpuset_memory_pressure_enabled __read_mostly; · 8 unmodified lines
37103712 * "memory_pressure". Value displayed is an integer
37113713 * representing the recent rate of entry into the synchronous
37123714 * (direct) page reclaim by any task attached to the cpuset.
3713− **/
3715+ */
37143716
37153717 void __cpuset_memory_pressure_bump(void)
37163718 {
kernel/cred.c+2−7
@@ -665,21 +665,16 @@ EXPORT_SYMBOL(cred_fscmp); · 664 unmodified lines
665665
666666 int set_cred_ucounts(struct cred *new)
667667 {
668− struct task_struct *task = current;
669− const struct cred *old = task->real_cred;
670668 struct ucounts *new_ucounts, *old_ucounts = new->ucounts;
671669
672− if (new->user == old->user && new->user_ns == old->user_ns)
673− return 0;
674−
675670 /*
676671 * This optimization is needed because alloc_ucounts() uses locks
677672 * for table lookups.
678673 */
679− if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->euid))
674+ if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->uid))
680675 return 0;
681676
682− if (!(new_ucounts = alloc_ucounts(new->user_ns, new->euid)))
677+ if (!(new_ucounts = alloc_ucounts(new->user_ns, new->uid)))
683678 return -EAGAIN;
684679
685680 new->ucounts = new_ucounts;
kernel/dma/swiotlb.c+2−1
@@ -628,7 +628,8 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, phys_addr_t orig_addr, · 627 unmodified lines
628628 mem->slots[index + i].orig_addr = slot_addr(orig_addr, i);
629629 tlb_addr = slot_addr(mem->start, index) + offset;
630630 if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) &&
631− (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL))
631+ (!(attrs & DMA_ATTR_OVERWRITE) || dir == DMA_TO_DEVICE ||
632+ dir == DMA_BIDIRECTIONAL))
632633 swiotlb_bounce(dev, tlb_addr, mapping_size, DMA_TO_DEVICE);
633634 return tlb_addr;
634635 }
kernel/fork.c+20−10
@@ -2021,18 +2021,18 @@ static __latent_entropy struct task_struct *copy_process( · 2020 unmodified lines
20212021 #ifdef CONFIG_PROVE_LOCKING
20222022 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
20232023 #endif
2024+ retval = copy_creds(p, clone_flags);
2025+ if (retval < 0)
2026+ goto bad_fork_free;
2027+
20242028 retval = -EAGAIN;
20252029 if (is_ucounts_overlimit(task_ucounts(p), UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC))) {
20262030 if (p->real_cred->user != INIT_USER &&
20272031 !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN))
2028− goto bad_fork_free;
2032+ goto bad_fork_cleanup_count;
20292033 }
20302034 current->flags &= ~PF_NPROC_EXCEEDED;
20312035
2032− retval = copy_creds(p, clone_flags);
2033− if (retval < 0)
2034− goto bad_fork_free;
2035−
20362036 /*
20372037 * If multiple threads are within copy_process(), then this check
20382038 * triggers too late. This doesn't hurt, the check is only there
@@ -2266,6 +2266,17 @@ static __latent_entropy struct task_struct *copy_process( · 227 unmodified lines
22662266 if (retval)
22672267 goto bad_fork_put_pidfd;
22682268
2269+ /*
2270+ * Now that the cgroups are pinned, re-clone the parent cgroup and put
2271+ * the new task on the correct runqueue. All this *before* the task
2272+ * becomes visible.
2273+ *
2274+ * This isn't part of ->can_fork() because while the re-cloning is
2275+ * cgroup specific, it unconditionally needs to place the task on a
2276+ * runqueue.
2277+ */
2278+ sched_cgroup_fork(p, args);
2279+
22692280 /*
22702281 * From this point on we must avoid any synchronous user-space
22712282 * communication until we take the tasklist-lock. In particular, we do
@@ -2323,10 +2334,6 @@ static __latent_entropy struct task_struct *copy_process( · 51 unmodified lines
23232334 goto bad_fork_cancel_cgroup;
23242335 }
23252336
2326− /* past the last point of failure */
2327− if (pidfile)
2328− fd_install(pidfd, pidfile);
2329−
23302337 init_task_pid_links(p);
23312338 if (likely(p->pid)) {
23322339 ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
@@ -2375,8 +2382,11 @@ static __latent_entropy struct task_struct *copy_process( · 42 unmodified lines
23752382 syscall_tracepoint_update(p);
23762383 write_unlock_irq(&tasklist_lock);
23772384
2385+ if (pidfile)
2386+ fd_install(pidfd, pidfile);
2387+
23782388 proc_fork_connector(p);
2379− sched_post_fork(p, args);
2389+ sched_post_fork(p);
23802390 cgroup_post_fork(p, args);
23812391 perf_event_fork(p);
23822392
kernel/locking/lockdep.c+2−2
@@ -3462,7 +3462,7 @@ struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i) · 3461 unmodified lines
34623462 u16 chain_hlock = chain_hlocks[chain->base + i];
34633463 unsigned int class_idx = chain_hlock_class_idx(chain_hlock);
34643464
3465− return lock_classes + class_idx - 1;
3465+ return lock_classes + class_idx;
34663466 }
34673467
34683468 /*
@@ -3530,7 +3530,7 @@ static void print_chain_keys_chain(struct lock_chain *chain) · 61 unmodified lines
35303530 hlock_id = chain_hlocks[chain->base + i];
35313531 chain_key = print_chain_key_iteration(hlock_id, chain_key);
35323532
3533− print_lock_name(lock_classes + chain_hlock_class_idx(hlock_id) - 1);
3533+ print_lock_name(lock_classes + chain_hlock_class_idx(hlock_id));
35343534 printk("\n");
35353535 }
35363536 }
kernel/module_decompress.c+2−0
@@ -250,6 +250,7 @@ void module_decompress_cleanup(struct load_info *info) · 249 unmodified lines
250250 info->max_pages = info->used_pages = 0;
251251 }
252252
253+#ifdef CONFIG_SYSFS
253254 static ssize_t compression_show(struct kobject *kobj,
254255 struct kobj_attribute *attr, char *buf)
255256 {
@@ -269,3 +270,4 @@ static int __init module_decompress_sysfs_init(void) · 13 unmodified lines
269270 return 0;
270271 }
271272 late_initcall(module_decompress_sysfs_init);
273+#endif
kernel/sched/core.c+21−13
@@ -1214,9 +1214,8 @@ int tg_nop(struct task_group *tg, void *data) · 1213 unmodified lines
12141214 }
12151215 #endif
12161216
1217−static void set_load_weight(struct task_struct *p)
1217+static void set_load_weight(struct task_struct *p, bool update_load)
12181218 {
1219− bool update_load = !(READ_ONCE(p->__state) & TASK_NEW);
12201219 int prio = p->static_prio - MAX_RT_PRIO;
12211220 struct load_weight *load = &p->se.load;
12221221
@@ -4407,7 +4406,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) · 3184 unmodified lines
44074406 p->static_prio = NICE_TO_PRIO(0);
44084407
44094408 p->prio = p->normal_prio = p->static_prio;
4410− set_load_weight(p);
4409+ set_load_weight(p, false);
44114410
44124411 /*
44134412 * We don't need the reset flag anymore after the fork. It has
@@ -4425,6 +4424,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) · 11 unmodified lines
44254424
44264425 init_entity_runnable_average(&p->se);
44274426
4427+
44284428 #ifdef CONFIG_SCHED_INFO
44294429 if (likely(sched_info_on()))
44304430 memset(&p->sched_info, 0, sizeof(p->sched_info));
@@ -4440,18 +4440,23 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) · 9 unmodified lines
44404440 return 0;
44414441 }
44424442
4443−void sched_post_fork(struct task_struct *p, struct kernel_clone_args *kargs)
4443+void sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs)
44444444 {
44454445 unsigned long flags;
4446−#ifdef CONFIG_CGROUP_SCHED
4447− struct task_group *tg;
4448−#endif
44494446
4447+ /*
4448+ * Because we're not yet on the pid-hash, p->pi_lock isn't strictly
4449+ * required yet, but lockdep gets upset if rules are violated.
4450+ */
44504451 raw_spin_lock_irqsave(&p->pi_lock, flags);
44514452 #ifdef CONFIG_CGROUP_SCHED
4452− tg = container_of(kargs->cset->subsys[cpu_cgrp_id],
4453− struct task_group, css);
4454− p->sched_task_group = autogroup_task_group(p, tg);
4453+ if (1) {
4454+ struct task_group *tg;
4455+ tg = container_of(kargs->cset->subsys[cpu_cgrp_id],
4456+ struct task_group, css);
4457+ tg = autogroup_task_group(p, tg);
4458+ p->sched_task_group = tg;
4459+ }
44554460 #endif
44564461 rseq_migrate(p);
44574462 /*
@@ -4462,7 +4467,10 @@ void sched_post_fork(struct task_struct *p, struct kernel_clone_args *kargs) · 4 unmodified lines
44624467 if (p->sched_class->task_fork)
44634468 p->sched_class->task_fork(p);
44644469 raw_spin_unlock_irqrestore(&p->pi_lock, flags);
4470+}
44654471
4472+void sched_post_fork(struct task_struct *p)
4473+{
44664474 uclamp_post_fork(p);
44674475 }
44684476
@@ -6922,7 +6930,7 @@ void set_user_nice(struct task_struct *p, long nice) · 2453 unmodified lines
69226930 put_prev_task(rq, p);
69236931
69246932 p->static_prio = NICE_TO_PRIO(nice);
6925− set_load_weight(p);
6933+ set_load_weight(p, true);
69266934 old_prio = p->prio;
69276935 p->prio = effective_prio(p);
69286936
@@ -7213,7 +7221,7 @@ static void __setscheduler_params(struct task_struct *p, · 284 unmodified lines
72137221 */
72147222 p->rt_priority = attr->sched_priority;
72157223 p->normal_prio = normal_prio(p);
7216− set_load_weight(p);
7224+ set_load_weight(p, true);
72177225 }
72187226
72197227 /*
@@ -9446,7 +9454,7 @@ void __init sched_init(void) · 2226 unmodified lines
94469454 #endif
94479455 }
94489456
9449− set_load_weight(&init_task);
9457+ set_load_weight(&init_task, false);
94509458
94519459 /*
94529460 * The boot idle thread does lazy MMU switching as well:
kernel/sys.c+14−6
@@ -472,6 +472,16 @@ static int set_user(struct cred *new) · 471 unmodified lines
472472 if (!new_user)
473473 return -EAGAIN;
474474
475+ free_uid(new->user);
476+ new->user = new_user;
477+ return 0;
478+}
479+
480+static void flag_nproc_exceeded(struct cred *new)
481+{
482+ if (new->ucounts == current_ucounts())
483+ return;
484+
475485 /*
476486 * We don't fail in case of NPROC limit excess here because too many
477487 * poorly written programs don't check set*uid() return code, assuming
@@ -480,15 +490,10 @@ static int set_user(struct cred *new) · 2 unmodified lines
480490 * failure to the execve() stage.
481491 */
482492 if (is_ucounts_overlimit(new->ucounts, UCOUNT_RLIMIT_NPROC, rlimit(RLIMIT_NPROC)) &&
483− new_user != INIT_USER &&
484− !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN))
493+ new->user != INIT_USER)
485494 current->flags |= PF_NPROC_EXCEEDED;
486495 else
487496 current->flags &= ~PF_NPROC_EXCEEDED;
488−
489− free_uid(new->user);
490− new->user = new_user;
491− return 0;
492497 }
493498
494499 /*
@@ -563,6 +568,7 @@ long __sys_setreuid(uid_t ruid, uid_t euid) · 68 unmodified lines
563568 if (retval < 0)
564569 goto error;
565570
571+ flag_nproc_exceeded(new);
566572 return commit_creds(new);
567573
568574 error:
@@ -625,6 +631,7 @@ long __sys_setuid(uid_t uid) · 56 unmodified lines
625631 if (retval < 0)
626632 goto error;
627633
634+ flag_nproc_exceeded(new);
628635 return commit_creds(new);
629636
630637 error:
@@ -704,6 +711,7 @@ long __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid) · 73 unmodified lines
704711 if (retval < 0)
705712 goto error;
706713
714+ flag_nproc_exceeded(new);
707715 return commit_creds(new);
708716
709717 error:
kernel/trace/ftrace.c+0−1
@@ -7191,7 +7191,6 @@ static int __init ftrace_nodyn_init(void) · 7190 unmodified lines
71917191 core_initcall(ftrace_nodyn_init);
71927192
71937193 static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; }
7194−static inline void ftrace_startup_enable(int command) { }
71957194 static inline void ftrace_startup_all(int command) { }
71967195
71977196 # define ftrace_startup_sysctl() do { } while (0)
kernel/trace/trace.c+6−4
@@ -1474,10 +1474,12 @@ static int __init set_buf_size(char *str) · 1473 unmodified lines
14741474 if (!str)
14751475 return 0;
14761476 buf_size = memparse(str, &str);
1477− /* nr_entries can not be zero */
1478− if (buf_size == 0)
1479− return 0;
1480− trace_buf_size = buf_size;
1477+ /*
1478+ * nr_entries can not be zero and the startup
1479+ * tests require some buffer space. Therefore
1480+ * ensure we have at least 4096 bytes of buffer.
1481+ */
1482+ trace_buf_size = max(4096UL, buf_size);
14811483 return 1;
14821484 }
14831485 __setup("trace_buf_size=", set_buf_size);
kernel/trace/trace.h+0−1
@@ -136,7 +136,6 @@ struct kprobe_trace_entry_head { · 135 unmodified lines
136136
137137 struct eprobe_trace_entry_head {
138138 struct trace_entry ent;
139− unsigned int type;
140139 };
141140
142141 struct kretprobe_trace_entry_head {
kernel/trace/trace_eprobe.c+7−9
@@ -242,7 +242,6 @@ static int trace_eprobe_tp_arg_update(struct trace_eprobe *ep, int i) · 241 unmodified lines
242242
243243 static int eprobe_event_define_fields(struct trace_event_call *event_call)
244244 {
245− int ret;
246245 struct eprobe_trace_entry_head field;
247246 struct trace_probe *tp;
248247
@@ -250,8 +249,6 @@ static int eprobe_event_define_fields(struct trace_event_call *event_call) · 1 unmodified line
250249 if (WARN_ON_ONCE(!tp))
251250 return -ENOENT;
252251
253− DEFINE_FIELD(unsigned int, type, FIELD_STRING_TYPE, 0);
254−
255252 return traceprobe_define_arg_fields(event_call, sizeof(field), tp);
256253 }
257254
@@ -270,7 +267,9 @@ print_eprobe_event(struct trace_iterator *iter, int flags, · 12 unmodified lines
270267 struct trace_event_call *pevent;
271268 struct trace_event *probed_event;
272269 struct trace_seq *s = &iter->seq;
270+ struct trace_eprobe *ep;
273271 struct trace_probe *tp;
272+ unsigned int type;
274273
275274 field = (struct eprobe_trace_entry_head *)iter->ent;
276275 tp = trace_probe_primary_from_call(
@@ -278,15 +277,18 @@ print_eprobe_event(struct trace_iterator *iter, int flags, · 1 unmodified line
278277 if (WARN_ON_ONCE(!tp))
279278 goto out;
280279
280+ ep = container_of(tp, struct trace_eprobe, tp);
281+ type = ep->event->event.type;
282+
281283 trace_seq_printf(s, "%s: (", trace_probe_name(tp));
282284
283− probed_event = ftrace_find_event(field->type);
285+ probed_event = ftrace_find_event(type);
284286 if (probed_event) {
285287 pevent = container_of(probed_event, struct trace_event_call, event);
286288 trace_seq_printf(s, "%s.%s", pevent->class->system,
287289 trace_event_name(pevent));
288290 } else {
289− trace_seq_printf(s, "%u", field->type);
291+ trace_seq_printf(s, "%u", type);
290292 }
291293
292294 trace_seq_putc(s, ')');
@@ -498,10 +500,6 @@ __eprobe_trace_func(struct eprobe_data *edata, void *rec) · 205 unmodified lines
498500 return;
499501
500502 entry = fbuffer.entry = ring_buffer_event_data(fbuffer.event);
501− if (edata->ep->event)
502− entry->type = edata->ep->event->event.type;
503− else
504− entry->type = 0;
505503 store_trace_args(&entry[1], &edata->ep->tp, rec, sizeof(*entry), dsize);
506504
507505 trace_event_buffer_commit(&fbuffer);
kernel/trace/trace_events_trigger.c+66−7
@@ -84,6 +84,20 @@ event_triggers_call(struct trace_event_file *file, · 83 unmodified lines
8484 }
8585 EXPORT_SYMBOL_GPL(event_triggers_call);
8686
87+bool __trace_trigger_soft_disabled(struct trace_event_file *file)
88+{
89+ unsigned long eflags = file->flags;
90+
91+ if (eflags & EVENT_FILE_FL_TRIGGER_MODE)
92+ event_triggers_call(file, NULL, NULL, NULL);
93+ if (eflags & EVENT_FILE_FL_SOFT_DISABLED)
94+ return true;
95+ if (eflags & EVENT_FILE_FL_PID_FILTER)
96+ return trace_event_ignore_this_pid(file);
97+ return false;
98+}
99+EXPORT_SYMBOL_GPL(__trace_trigger_soft_disabled);
100+
87101 /**
88102 * event_triggers_post_call - Call 'post_triggers' for a trace event
89103 * @file: The trace_event_file associated with the event
@@ -1295,6 +1309,16 @@ traceon_trigger(struct event_trigger_data *data, · 1205 unmodified lines
12951309 struct trace_buffer *buffer, void *rec,
12961310 struct ring_buffer_event *event)
12971311 {
1312+ struct trace_event_file *file = data->private_data;
1313+
1314+ if (file) {
1315+ if (tracer_tracing_is_on(file->tr))
1316+ return;
1317+
1318+ tracer_tracing_on(file->tr);
1319+ return;
1320+ }
1321+
12981322 if (tracing_is_on())
12991323 return;
13001324
@@ -1306,8 +1330,15 @@ traceon_count_trigger(struct event_trigger_data *data, · 5 unmodified lines
13061330 struct trace_buffer *buffer, void *rec,
13071331 struct ring_buffer_event *event)
13081332 {
1309− if (tracing_is_on())
1310− return;
1333+ struct trace_event_file *file = data->private_data;
1334+
1335+ if (file) {
1336+ if (tracer_tracing_is_on(file->tr))
1337+ return;
1338+ } else {
1339+ if (tracing_is_on())
1340+ return;
1341+ }
13111342
13121343 if (!data->count)
13131344 return;
@@ -1315,7 +1346,10 @@ traceon_count_trigger(struct event_trigger_data *data, · 1 unmodified line
13151346 if (data->count != -1)
13161347 (data->count)--;
13171348
1318− tracing_on();
1349+ if (file)
1350+ tracer_tracing_on(file->tr);
1351+ else
1352+ tracing_on();
13191353 }
13201354
13211355 static void
@@ -1323,6 +1357,16 @@ traceoff_trigger(struct event_trigger_data *data, · 1 unmodified line
13231357 struct trace_buffer *buffer, void *rec,
13241358 struct ring_buffer_event *event)
13251359 {
1360+ struct trace_event_file *file = data->private_data;
1361+
1362+ if (file) {
1363+ if (!tracer_tracing_is_on(file->tr))
1364+ return;
1365+
1366+ tracer_tracing_off(file->tr);
1367+ return;
1368+ }
1369+
13261370 if (!tracing_is_on())
13271371 return;
13281372
@@ -1334,8 +1378,15 @@ traceoff_count_trigger(struct event_trigger_data *data, · 5 unmodified lines
13341378 struct trace_buffer *buffer, void *rec,
13351379 struct ring_buffer_event *event)
13361380 {
1337− if (!tracing_is_on())
1338− return;
1381+ struct trace_event_file *file = data->private_data;
1382+
1383+ if (file) {
1384+ if (!tracer_tracing_is_on(file->tr))
1385+ return;
1386+ } else {
1387+ if (!tracing_is_on())
1388+ return;
1389+ }
13391390
13401391 if (!data->count)
13411392 return;
@@ -1343,7 +1394,10 @@ traceoff_count_trigger(struct event_trigger_data *data, · 1 unmodified line
13431394 if (data->count != -1)
13441395 (data->count)--;
13451396
1346− tracing_off();
1397+ if (file)
1398+ tracer_tracing_off(file->tr);
1399+ else
1400+ tracing_off();
13471401 }
13481402
13491403 static int
@@ -1540,7 +1594,12 @@ stacktrace_trigger(struct event_trigger_data *data, · 190 unmodified lines
15401594 struct trace_buffer *buffer, void *rec,
15411595 struct ring_buffer_event *event)
15421596 {
1543− trace_dump_stack(STACK_SKIP);
1597+ struct trace_event_file *file = data->private_data;
1598+
1599+ if (file)
1600+ __trace_stack(file->tr, tracing_gen_ctx(), STACK_SKIP);
1601+ else
1602+ trace_dump_stack(STACK_SKIP);
15441603 }
15451604
15461605 static void
kernel/trace/trace_osnoise.c+32−21
@@ -1436,6 +1436,37 @@ out: · 1435 unmodified lines
14361436 static struct cpumask osnoise_cpumask;
14371437 static struct cpumask save_cpumask;
14381438
1439+/*
1440+ * osnoise_sleep - sleep until the next period
1441+ */
1442+static void osnoise_sleep(void)
1443+{
1444+ u64 interval;
1445+ ktime_t wake_time;
1446+
1447+ mutex_lock(&interface_lock);
1448+ interval = osnoise_data.sample_period - osnoise_data.sample_runtime;
1449+ mutex_unlock(&interface_lock);
1450+
1451+ /*
1452+ * differently from hwlat_detector, the osnoise tracer can run
1453+ * without a pause because preemption is on.
1454+ */
1455+ if (!interval) {
1456+ /* Let synchronize_rcu_tasks() make progress */
1457+ cond_resched_tasks_rcu_qs();
1458+ return;
1459+ }
1460+
1461+ wake_time = ktime_add_us(ktime_get(), interval);
1462+ __set_current_state(TASK_INTERRUPTIBLE);
1463+
1464+ while (schedule_hrtimeout_range(&wake_time, 0, HRTIMER_MODE_ABS)) {
1465+ if (kthread_should_stop())
1466+ break;
1467+ }
1468+}
1469+
14391470 /*
14401471 * osnoise_main - The osnoise detection kernel thread
14411472 *
@@ -1444,30 +1475,10 @@ static struct cpumask save_cpumask; · 2 unmodified lines
14441475 */
14451476 static int osnoise_main(void *data)
14461477 {
1447− u64 interval;
14481478
14491479 while (!kthread_should_stop()) {
1450−
14511480 run_osnoise();
1452−
1453− mutex_lock(&interface_lock);
1454− interval = osnoise_data.sample_period - osnoise_data.sample_runtime;
1455− mutex_unlock(&interface_lock);
1456−
1457− do_div(interval, USEC_PER_MSEC);
1458−
1459− /*
1460− * differently from hwlat_detector, the osnoise tracer can run
1461− * without a pause because preemption is on.
1462− */
1463− if (interval < 1) {
1464− /* Let synchronize_rcu_tasks() make progress */
1465− cond_resched_tasks_rcu_qs();
1466− continue;
1467− }
1468−
1469− if (msleep_interruptible(interval))
1470− break;
1481+ osnoise_sleep();
14711482 }
14721483
14731484 return 0;
kernel/trace/trace_probe.c+5−5
@@ -871,15 +871,15 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len, · 870 unmodified lines
871871 switch (ptype) {
872872 case PROBE_PRINT_NORMAL:
873873 fmt = "(%lx)";
874− arg = "REC->" FIELD_STRING_IP;
874+ arg = ", REC->" FIELD_STRING_IP;
875875 break;
876876 case PROBE_PRINT_RETURN:
877877 fmt = "(%lx <- %lx)";
878− arg = "REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
878+ arg = ", REC->" FIELD_STRING_FUNC ", REC->" FIELD_STRING_RETIP;
879879 break;
880880 case PROBE_PRINT_EVENT:
881− fmt = "(%u)";
882− arg = "REC->" FIELD_STRING_TYPE;
881+ fmt = "";
882+ arg = "";
883883 break;
884884 default:
885885 WARN_ON_ONCE(1);
@@ -903,7 +903,7 @@ static int __set_print_fmt(struct trace_probe *tp, char *buf, int len, · 17 unmodified lines
903903 parg->type->fmt);
904904 }
905905
906− pos += snprintf(buf + pos, LEN_OR_ZERO, "\", %s", arg);
906+ pos += snprintf(buf + pos, LEN_OR_ZERO, "\"%s", arg);
907907
908908 for (i = 0; i < tp->nr_args; i++) {
909909 parg = tp->args + i;
kernel/trace/trace_probe.h+0−1
@@ -38,7 +38,6 @@ · 37 unmodified lines
3838 #define FIELD_STRING_IP "__probe_ip"
3939 #define FIELD_STRING_RETIP "__probe_ret_ip"
4040 #define FIELD_STRING_FUNC "__probe_func"
41−#define FIELD_STRING_TYPE "__probe_type"
4241
4342 #undef DEFINE_FIELD
4443 #define DEFINE_FIELD(type, item, name, is_signed) \
kernel/trace/trace_selftest.c+2−4
@@ -784,9 +784,7 @@ static struct fgraph_ops fgraph_ops __initdata = { · 783 unmodified lines
784784 .retfunc = &trace_graph_return,
785785 };
786786
787−#if defined(CONFIG_DYNAMIC_FTRACE) && \
788− defined(CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS)
789−#define TEST_DIRECT_TRAMP
787+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
790788 noinline __noclone static void trace_direct_tramp(void) { }
791789 #endif
792790
@@ -849,7 +847,7 @@ trace_selftest_startup_function_graph(struct tracer *trace, · 56 unmodified lines
849847 goto out;
850848 }
851849
852−#ifdef TEST_DIRECT_TRAMP
850+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS
853851 tracing_reset_online_cpus(&tr->array_buffer);
854852 set_graph_array(tr);
855853
kernel/ucount.c+2−1
@@ -350,7 +350,8 @@ bool is_ucounts_overlimit(struct ucounts *ucounts, enum ucount_type type, unsign · 349 unmodified lines
350350 if (rlimit > LONG_MAX)
351351 max = LONG_MAX;
352352 for (iter = ucounts; iter; iter = iter->ns->ucounts) {
353− if (get_ucounts_value(iter, type) > max)
353+ long val = get_ucounts_value(iter, type);
354+ if (val < 0 || val > max)
354355 return true;
355356 max = READ_ONCE(iter->ns->ucount_max[type]);
356357 }
lib/iov_iter.c+2−0
@@ -414,6 +414,7 @@ static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t by · 413 unmodified lines
414414 return 0;
415415
416416 buf->ops = &page_cache_pipe_buf_ops;
417+ buf->flags = 0;
417418 get_page(page);
418419 buf->page = page;
419420 buf->offset = offset;
@@ -577,6 +578,7 @@ static size_t push_pipe(struct iov_iter *i, size_t size, · 157 unmodified lines
577578 break;
578579
579580 buf->ops = &default_pipe_buf_ops;
581+ buf->flags = 0;
580582 buf->page = page;
581583 buf->offset = 0;
582584 buf->len = min_t(ssize_t, left, PAGE_SIZE);
lib/test_kasan.c+4−1
@@ -869,11 +869,14 @@ static void kmem_cache_invalid_free(struct kunit *test) · 868 unmodified lines
869869 kmem_cache_destroy(cache);
870870 }
871871
872+static void empty_cache_ctor(void *object) { }
873+
872874 static void kmem_cache_double_destroy(struct kunit *test)
873875 {
874876 struct kmem_cache *cache;
875877
876− cache = kmem_cache_create("test_cache", 200, 0, 0, NULL);
878+ /* Provide a constructor to prevent cache merging. */
879+ cache = kmem_cache_create("test_cache", 200, 0, 0, empty_cache_ctor);
877880 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, cache);
878881 kmem_cache_destroy(cache);
879882 KUNIT_EXPECT_KASAN_FAIL(test, kmem_cache_destroy(cache));
mm/hugetlb.c+5−6
@@ -4159,10 +4159,10 @@ static int __init hugepages_setup(char *s) · 4158 unmodified lines
41594159 pr_warn("HugeTLB: architecture can't support node specific alloc, ignoring!\n");
41604160 return 0;
41614161 }
4162+ if (tmp >= nr_online_nodes)
4163+ goto invalid;
41624164 node = tmp;
41634165 p += count + 1;
4164− if (node < 0 || node >= nr_online_nodes)
4165− goto invalid;
41664166 /* Parse hugepages */
41674167 if (sscanf(p, "%lu%n", &tmp, &count) != 1)
41684168 goto invalid;
@@ -4851,14 +4851,13 @@ again: · 682 unmodified lines
48514851 }
48524852
48534853 static void move_huge_pte(struct vm_area_struct *vma, unsigned long old_addr,
4854− unsigned long new_addr, pte_t *src_pte)
4854+ unsigned long new_addr, pte_t *src_pte, pte_t *dst_pte)
48554855 {
48564856 struct hstate *h = hstate_vma(vma);
48574857 struct mm_struct *mm = vma->vm_mm;
4858− pte_t *dst_pte, pte;
48594858 spinlock_t *src_ptl, *dst_ptl;
4859+ pte_t pte;
48604860
4861− dst_pte = huge_pte_offset(mm, new_addr, huge_page_size(h));
48624861 dst_ptl = huge_pte_lock(h, mm, dst_pte);
48634862 src_ptl = huge_pte_lockptr(h, mm, src_pte);
48644863
@@ -4917,7 +4916,7 @@ int move_hugetlb_page_tables(struct vm_area_struct *vma, · 52 unmodified lines
49174916 if (!dst_pte)
49184917 break;
49194918
4920− move_huge_pte(vma, old_addr, new_addr, src_pte);
4919+ move_huge_pte(vma, old_addr, new_addr, src_pte, dst_pte);
49214920 }
49224921 flush_tlb_range(vma, old_end - len, old_end);
49234922 mmu_notifier_invalidate_range_end(&range);
mm/memblock.c+8−2
@@ -366,14 +366,20 @@ void __init memblock_discard(void) · 365 unmodified lines
366366 addr = __pa(memblock.reserved.regions);
367367 size = PAGE_ALIGN(sizeof(struct memblock_region) *
368368 memblock.reserved.max);
369− memblock_free_late(addr, size);
369+ if (memblock_reserved_in_slab)
370+ kfree(memblock.reserved.regions);
371+ else
372+ memblock_free_late(addr, size);
370373 }
371374
372375 if (memblock.memory.regions != memblock_memory_init_regions) {
373376 addr = __pa(memblock.memory.regions);
374377 size = PAGE_ALIGN(sizeof(struct memblock_region) *
375378 memblock.memory.max);
376− memblock_free_late(addr, size);
379+ if (memblock_memory_in_slab)
380+ kfree(memblock.memory.regions);
381+ else
382+ memblock_free_late(addr, size);
377383 }
378384
379385 memblock_memory = NULL;
mm/mmap.c+1−0
@@ -3186,6 +3186,7 @@ void exit_mmap(struct mm_struct *mm) · 3185 unmodified lines
31863186 vma = remove_vma(vma);
31873187 cond_resched();
31883188 }
3189+ mm->mmap = NULL;
31893190 mmap_write_unlock(mm);
31903191 vm_unacct_memory(nr_accounted);
31913192 }
mm/mprotect.c+1−1
@@ -94,7 +94,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 93 unmodified lines
9494
9595 /* Also skip shared copy-on-write pages */
9696 if (is_cow_mapping(vma->vm_flags) &&
97− page_mapcount(page) != 1)
97+ page_count(page) != 1)
9898 continue;
9999
100100 /*
net/bridge/br_multicast.c+4−0
@@ -82,6 +82,9 @@ static void br_multicast_find_del_pg(struct net_bridge *br, · 81 unmodified lines
8282 struct net_bridge_port_group *pg);
8383 static void __br_multicast_stop(struct net_bridge_mcast *brmctx);
8484
85+static int br_mc_disabled_update(struct net_device *dev, bool value,
86+ struct netlink_ext_ack *extack);
87+
8588 static struct net_bridge_port_group *
8689 br_sg_port_find(struct net_bridge *br,
8790 struct net_bridge_port_group_sg_key *sg_p)
@@ -1156,6 +1159,7 @@ struct net_bridge_mdb_entry *br_multicast_new_group(struct net_bridge *br, · 1068 unmodified lines
11561159 return mp;
11571160
11581161 if (atomic_read(&br->mdb_hash_tbl.nelems) >= br->hash_max) {
1162+ br_mc_disabled_update(br->dev, false, NULL);
11591163 br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false);
11601164 return ERR_PTR(-E2BIG);
11611165 }
net/can/j1939/transport.c+1−1
@@ -2006,7 +2006,7 @@ struct j1939_session *j1939_tp_send(struct j1939_priv *priv, · 2005 unmodified lines
20062006 /* set the end-packet for broadcast */
20072007 session->pkt.last = session->pkt.total;
20082008
2009− skcb->tskey = session->sk->sk_tskey++;
2009+ skcb->tskey = atomic_inc_return(&session->sk->sk_tskey) - 1;
20102010 session->tskey = skcb->tskey;
20112011
20122012 return session;
net/core/drop_monitor.c+9−2
@@ -283,13 +283,17 @@ static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi, · 282 unmodified lines
283283
284284 rcu_read_lock();
285285 list_for_each_entry_rcu(new_stat, &hw_stats_list, list) {
286+ struct net_device *dev;
287+
286288 /*
287289 * only add a note to our monitor buffer if:
288290 * 1) this is the dev we received on
289291 * 2) its after the last_rx delta
290292 * 3) our rx_dropped count has gone up
291293 */
292− if ((new_stat->dev == napi->dev) &&
294+ /* Paired with WRITE_ONCE() in dropmon_net_event() */
295+ dev = READ_ONCE(new_stat->dev);
296+ if ((dev == napi->dev) &&
293297 (time_after(jiffies, new_stat->last_rx + dm_hw_check_delta)) &&
294298 (napi->dev->stats.rx_dropped != new_stat->last_drop_val)) {
295299 trace_drop_common(NULL, NULL);
@@ -1576,7 +1580,10 @@ static int dropmon_net_event(struct notifier_block *ev_block, · 1280 unmodified lines
15761580 mutex_lock(&net_dm_mutex);
15771581 list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) {
15781582 if (new_stat->dev == dev) {
1579− new_stat->dev = NULL;
1583+
1584+ /* Paired with READ_ONCE() in trace_napi_poll_hit() */
1585+ WRITE_ONCE(new_stat->dev, NULL);
1586+
15801587 if (trace_state == TRACE_OFF) {
15811588 list_del_rcu(&new_stat->list);
15821589 kfree_rcu(new_stat, rcu);
net/core/filter.c+3−0
@@ -2710,6 +2710,9 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, · 2709 unmodified lines
27102710 if (unlikely(flags))
27112711 return -EINVAL;
27122712
2713+ if (unlikely(len == 0))
2714+ return 0;
2715+
27132716 /* First find the starting scatterlist element */
27142717 i = msg->sg.start;
27152718 do {
net/core/net-sysfs.c+1−1
@@ -213,7 +213,7 @@ static ssize_t speed_show(struct device *dev, · 212 unmodified lines
213213 if (!rtnl_trylock())
214214 return restart_syscall();
215215
216− if (netif_running(netdev)) {
216+ if (netif_running(netdev) && netif_device_present(netdev)) {
217217 struct ethtool_link_ksettings cmd;
218218
219219 if (!__ethtool_get_link_ksettings(netdev, &cmd))
net/core/rtnetlink.c+4−2
@@ -1699,6 +1699,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, · 1698 unmodified lines
16991699 {
17001700 struct ifinfomsg *ifm;
17011701 struct nlmsghdr *nlh;
1702+ struct Qdisc *qdisc;
17021703
17031704 ASSERT_RTNL();
17041705 nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags);
@@ -1716,6 +1717,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, · 11 unmodified lines
17161717 if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid))
17171718 goto nla_put_failure;
17181719
1720+ qdisc = rtnl_dereference(dev->qdisc);
17191721 if (nla_put_string(skb, IFLA_IFNAME, dev->name) ||
17201722 nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) ||
17211723 nla_put_u8(skb, IFLA_OPERSTATE,
@@ -1735,8 +1737,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, · 13 unmodified lines
17351737 #endif
17361738 put_master_ifindex(skb, dev) ||
17371739 nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) ||
1738− (dev->qdisc &&
1739− nla_put_string(skb, IFLA_QDISC, dev->qdisc->ops->id)) ||
1740+ (qdisc &&
1741+ nla_put_string(skb, IFLA_QDISC, qdisc->ops->id)) ||
17401742 nla_put_ifalias(skb, dev) ||
17411743 nla_put_u32(skb, IFLA_CARRIER_CHANGES,
17421744 atomic_read(&dev->carrier_up_count) +
net/core/skbuff.c+3−3
@@ -2276,7 +2276,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) · 2275 unmodified lines
22762276 /* Free pulled out fragments. */
22772277 while ((list = skb_shinfo(skb)->frag_list) != insp) {
22782278 skb_shinfo(skb)->frag_list = list->next;
2279− kfree_skb(list);
2279+ consume_skb(list);
22802280 }
22812281 /* And insert new clone at head. */
22822282 if (clone) {
@@ -4730,7 +4730,7 @@ static void __skb_complete_tx_timestamp(struct sk_buff *skb, · 2447 unmodified lines
47304730 if (sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID) {
47314731 serr->ee.ee_data = skb_shinfo(skb)->tskey;
47324732 if (sk_is_tcp(sk))
4733− serr->ee.ee_data -= sk->sk_tskey;
4733+ serr->ee.ee_data -= atomic_read(&sk->sk_tskey);
47344734 }
47354735
47364736 err = sock_queue_err_skb(sk, skb);
@@ -6105,7 +6105,7 @@ static int pskb_carve_frag_list(struct sk_buff *skb, · 1368 unmodified lines
61056105 /* Free pulled out fragments. */
61066106 while ((list = shinfo->frag_list) != insp) {
61076107 shinfo->frag_list = list->next;
6108− kfree_skb(list);
6108+ consume_skb(list);
61096109 }
61106110 /* And insert new clone at head. */
61116111 if (clone) {
net/core/sock.c+2−2
@@ -879,9 +879,9 @@ int sock_set_timestamping(struct sock *sk, int optname, · 878 unmodified lines
879879 if ((1 << sk->sk_state) &
880880 (TCPF_CLOSE | TCPF_LISTEN))
881881 return -EINVAL;
882− sk->sk_tskey = tcp_sk(sk)->snd_una;
882+ atomic_set(&sk->sk_tskey, tcp_sk(sk)->snd_una);
883883 } else {
884− sk->sk_tskey = 0;
884+ atomic_set(&sk->sk_tskey, 0);
885885 }
886886 }
887887
net/dsa/dsa.c+1−0
@@ -349,6 +349,7 @@ void dsa_flush_workqueue(void) · 348 unmodified lines
349349 {
350350 flush_workqueue(dsa_owq);
351351 }
352+EXPORT_SYMBOL_GPL(dsa_flush_workqueue);
352353
353354 int dsa_devlink_param_get(struct devlink *dl, u32 id,
354355 struct devlink_param_gset_ctx *ctx)
net/dsa/dsa_priv.h+0−1
@@ -147,7 +147,6 @@ void dsa_tag_driver_put(const struct dsa_device_ops *ops); · 146 unmodified lines
147147 const struct dsa_device_ops *dsa_find_tagger_by_name(const char *buf);
148148
149149 bool dsa_schedule_work(struct work_struct *work);
150−void dsa_flush_workqueue(void);
151150 const char *dsa_tag_protocol_to_str(const struct dsa_device_ops *ops);
152151
153152 static inline int dsa_tag_protocol_overhead(const struct dsa_device_ops *ops)
net/dsa/master.c+6−1
@@ -260,11 +260,16 @@ static void dsa_netdev_ops_set(struct net_device *dev, · 259 unmodified lines
260260 dev->dsa_ptr->netdev_ops = ops;
261261 }
262262
263+/* Keep the master always promiscuous if the tagging protocol requires that
264+ * (garbles MAC DA) or if it doesn't support unicast filtering, case in which
265+ * it would revert to promiscuous mode as soon as we call dev_uc_add() on it
266+ * anyway.
267+ */
263268 static void dsa_master_set_promiscuity(struct net_device *dev, int inc)
264269 {
265270 const struct dsa_device_ops *ops = dev->dsa_ptr->tag_ops;
266271
267− if (!ops->promisc_on_master)
272+ if ((dev->priv_flags & IFF_UNICAST_FLT) && !ops->promisc_on_master)
268273 return;
269274
270275 ASSERT_RTNL();
net/dsa/port.c+22−7
@@ -395,10 +395,17 @@ void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br) · 394 unmodified lines
395395 .tree_index = dp->ds->dst->index,
396396 .sw_index = dp->ds->index,
397397 .port = dp->index,
398− .bridge = *dp->bridge,
399398 };
400399 int err;
401400
401+ /* If the port could not be offloaded to begin with, then
402+ * there is nothing to do.
403+ */
404+ if (!dp->bridge)
405+ return;
406+
407+ info.bridge = *dp->bridge;
408+
402409 /* Here the port is already unbridged. Reflect the current configuration
403410 * so that drivers can program their chips accordingly.
404411 */
@@ -781,9 +788,15 @@ int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr, · 376 unmodified lines
781788 struct dsa_port *cpu_dp = dp->cpu_dp;
782789 int err;
783790
784− err = dev_uc_add(cpu_dp->master, addr);
785− if (err)
786− return err;
791+ /* Avoid a call to __dev_set_promiscuity() on the master, which
792+ * requires rtnl_lock(), since we can't guarantee that is held here,
793+ * and we can't take it either.
794+ */
795+ if (cpu_dp->master->priv_flags & IFF_UNICAST_FLT) {
796+ err = dev_uc_add(cpu_dp->master, addr);
797+ if (err)
798+ return err;
799+ }
787800
788801 return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_ADD, &info);
789802 }
@@ -800,9 +813,11 @@ int dsa_port_host_fdb_del(struct dsa_port *dp, const unsigned char *addr, · 10 unmodified lines
800813 struct dsa_port *cpu_dp = dp->cpu_dp;
801814 int err;
802815
803− err = dev_uc_del(cpu_dp->master, addr);
804− if (err)
805− return err;
816+ if (cpu_dp->master->priv_flags & IFF_UNICAST_FLT) {
817+ err = dev_uc_del(cpu_dp->master, addr);
818+ if (err)
819+ return err;
820+ }
806821
807822 return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_DEL, &info);
808823 }
net/dsa/tag_lan9303.c+7−14
@@ -77,7 +77,6 @@ static struct sk_buff *lan9303_xmit(struct sk_buff *skb, struct net_device *dev) · 76 unmodified lines
7777
7878 static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev)
7979 {
80− __be16 *lan9303_tag;
8180 u16 lan9303_tag1;
8281 unsigned int source_port;
8382
@@ -87,14 +86,15 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev) · 3 unmodified lines
8786 return NULL;
8887 }
8988
90− lan9303_tag = dsa_etype_header_pos_rx(skb);
91−
92− if (lan9303_tag[0] != htons(ETH_P_8021Q)) {
93− dev_warn_ratelimited(&dev->dev, "Dropping packet due to invalid VLAN marker\n");
94− return NULL;
89+ if (skb_vlan_tag_present(skb)) {
90+ lan9303_tag1 = skb_vlan_tag_get(skb);
91+ __vlan_hwaccel_clear_tag(skb);
92+ } else {
93+ skb_push_rcsum(skb, ETH_HLEN);
94+ __skb_vlan_pop(skb, &lan9303_tag1);
95+ skb_pull_rcsum(skb, ETH_HLEN);
9596 }
9697
97− lan9303_tag1 = ntohs(lan9303_tag[1]);
9898 source_port = lan9303_tag1 & 0x3;
9999
100100 skb->dev = dsa_master_find_slave(dev, 0, source_port);
@@ -103,13 +103,6 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev) · 2 unmodified lines
103103 return NULL;
104104 }
105105
106− /* remove the special VLAN tag between the MAC addresses
107− * and the current ethertype field.
108− */
109− skb_pull_rcsum(skb, 2 + 2);
110−
111− dsa_strip_etype_header(skb, LAN9303_TAG_LEN);
112−
113106 if (!(lan9303_tag1 & LAN9303_TAG_RX_TRAPPED_TO_CPU))
114107 dsa_default_offload_fwd_mark(skb);
115108
net/ipv4/af_inet.c+4−1
@@ -1376,8 +1376,11 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, · 1375 unmodified lines
13761376 }
13771377
13781378 ops = rcu_dereference(inet_offloads[proto]);
1379− if (likely(ops && ops->callbacks.gso_segment))
1379+ if (likely(ops && ops->callbacks.gso_segment)) {
13801380 segs = ops->callbacks.gso_segment(skb, features);
1381+ if (!segs)
1382+ skb->network_header = skb_mac_header(skb) + nhoff - skb->head;
1383+ }
13811384
13821385 if (IS_ERR_OR_NULL(segs))
13831386 goto out;
net/ipv4/fib_frontend.c+3−0
@@ -436,6 +436,9 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, · 435 unmodified lines
436436 if (net->ipv4.fib_has_custom_local_routes ||
437437 fib4_has_custom_rules(net))
438438 goto full_check;
439+ /* Within the same container, it is regarded as a martian source,
440+ * and the same host but different containers are not.
441+ */
439442 if (inet_lookup_ifaddr_rcu(net, src))
440443 return -EINVAL;
441444
net/ipv4/fib_lookup.h+3−4
@@ -16,10 +16,9 @@ struct fib_alias { · 15 unmodified lines
1616 u8 fa_slen;
1717 u32 tb_id;
1818 s16 fa_default;
19− u8 offload:1,
20− trap:1,
21− offload_failed:1,
22− unused:5;
19+ u8 offload;
20+ u8 trap;
21+ u8 offload_failed;
2322 struct rcu_head rcu;
2423 };
2524
net/ipv4/fib_semantics.c+3−3
@@ -525,9 +525,9 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa, · 524 unmodified lines
525525 fri.dst_len = dst_len;
526526 fri.tos = fa->fa_tos;
527527 fri.type = fa->fa_type;
528− fri.offload = fa->offload;
529− fri.trap = fa->trap;
530− fri.offload_failed = fa->offload_failed;
528+ fri.offload = READ_ONCE(fa->offload);
529+ fri.trap = READ_ONCE(fa->trap);
530+ fri.offload_failed = READ_ONCE(fa->offload_failed);
531531 err = fib_dump_info(skb, info->portid, seq, event, &fri, nlm_flags);
532532 if (err < 0) {
533533 /* -EMSGSIZE implies BUG in fib_nlmsg_size() */
net/ipv4/fib_trie.c+13−9
@@ -1047,19 +1047,23 @@ void fib_alias_hw_flags_set(struct net *net, const struct fib_rt_info *fri) · 1046 unmodified lines
10471047 if (!fa_match)
10481048 goto out;
10491049
1050− if (fa_match->offload == fri->offload && fa_match->trap == fri->trap &&
1051− fa_match->offload_failed == fri->offload_failed)
1050+ /* These are paired with the WRITE_ONCE() happening in this function.
1051+ * The reason is that we are only protected by RCU at this point.
1052+ */
1053+ if (READ_ONCE(fa_match->offload) == fri->offload &&
1054+ READ_ONCE(fa_match->trap) == fri->trap &&
1055+ READ_ONCE(fa_match->offload_failed) == fri->offload_failed)
10521056 goto out;
10531057
1054− fa_match->offload = fri->offload;
1055− fa_match->trap = fri->trap;
1058+ WRITE_ONCE(fa_match->offload, fri->offload);
1059+ WRITE_ONCE(fa_match->trap, fri->trap);
10561060
10571061 /* 2 means send notifications only if offload_failed was changed. */
10581062 if (net->ipv4.sysctl_fib_notify_on_flag_change == 2 &&
1059− fa_match->offload_failed == fri->offload_failed)
1063+ READ_ONCE(fa_match->offload_failed) == fri->offload_failed)
10601064 goto out;
10611065
1062− fa_match->offload_failed = fri->offload_failed;
1066+ WRITE_ONCE(fa_match->offload_failed, fri->offload_failed);
10631067
10641068 if (!net->ipv4.sysctl_fib_notify_on_flag_change)
10651069 goto out;
@@ -2297,9 +2301,9 @@ static int fn_trie_dump_leaf(struct key_vector *l, struct fib_table *tb, · 1231 unmodified lines
22972301 fri.dst_len = KEYLENGTH - fa->fa_slen;
22982302 fri.tos = fa->fa_tos;
22992303 fri.type = fa->fa_type;
2300− fri.offload = fa->offload;
2301− fri.trap = fa->trap;
2302− fri.offload_failed = fa->offload_failed;
2304+ fri.offload = READ_ONCE(fa->offload);
2305+ fri.trap = READ_ONCE(fa->trap);
2306+ fri.offload_failed = READ_ONCE(fa->offload_failed);
23032307 err = fib_dump_info(skb,
23042308 NETLINK_CB(cb->skb).portid,
23052309 cb->nlh->nlmsg_seq,
net/ipv4/ip_output.c+1−1
@@ -991,7 +991,7 @@ static int __ip_append_data(struct sock *sk, · 990 unmodified lines
991991
992992 if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP &&
993993 sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
994− tskey = sk->sk_tskey++;
994+ tskey = atomic_inc_return(&sk->sk_tskey) - 1;
995995
996996 hh_len = LL_RESERVED_SPACE(rt->dst.dev);
997997
net/ipv4/ping.c+8−2
@@ -172,16 +172,22 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) · 171 unmodified lines
172172 struct sock *sk = NULL;
173173 struct inet_sock *isk;
174174 struct hlist_nulls_node *hnode;
175− int dif = skb->dev->ifindex;
175+ int dif, sdif;
176176
177177 if (skb->protocol == htons(ETH_P_IP)) {
178+ dif = inet_iif(skb);
179+ sdif = inet_sdif(skb);
178180 pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n",
179181 (int)ident, &ip_hdr(skb)->daddr, dif);
180182 #if IS_ENABLED(CONFIG_IPV6)
181183 } else if (skb->protocol == htons(ETH_P_IPV6)) {
184+ dif = inet6_iif(skb);
185+ sdif = inet6_sdif(skb);
182186 pr_debug("try to find: num = %d, daddr = %pI6c, dif = %d\n",
183187 (int)ident, &ipv6_hdr(skb)->daddr, dif);
184188 #endif
189+ } else {
190+ return NULL;
185191 }
186192
187193 read_lock_bh(&ping_table.lock);
@@ -221,7 +227,7 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) · 33 unmodified lines
221227 }
222228
223229 if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif &&
224− sk->sk_bound_dev_if != inet_sdif(skb))
230+ sk->sk_bound_dev_if != sdif)
225231 continue;
226232
227233 sock_hold(sk);
net/ipv4/route.c+2−2
@@ -3395,8 +3395,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, · 3394 unmodified lines
33953395 fa->fa_tos == fri.tos &&
33963396 fa->fa_info == res.fi &&
33973397 fa->fa_type == fri.type) {
3398− fri.offload = fa->offload;
3399− fri.trap = fa->trap;
3398+ fri.offload = READ_ONCE(fa->offload);
3399+ fri.trap = READ_ONCE(fa->trap);
34003400 break;
34013401 }
34023402 }
net/ipv4/udp_tunnel_nic.c+1−1
@@ -846,7 +846,7 @@ udp_tunnel_nic_unregister(struct net_device *dev, struct udp_tunnel_nic *utn) · 845 unmodified lines
846846 list_for_each_entry(node, &info->shared->devices, list)
847847 if (node->dev == dev)
848848 break;
849− if (node->dev != dev)
849+ if (list_entry_is_head(node, &info->shared->devices, list))
850850 return;
851851
852852 list_del(&node->list);
net/ipv6/addrconf.c+4−2
@@ -1839,8 +1839,8 @@ out: · 1838 unmodified lines
18391839 }
18401840 EXPORT_SYMBOL(ipv6_dev_get_saddr);
18411841
1842−int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
1843− u32 banned_flags)
1842+static int __ipv6_get_lladdr(struct inet6_dev *idev, struct in6_addr *addr,
1843+ u32 banned_flags)
18441844 {
18451845 struct inet6_ifaddr *ifp;
18461846 int err = -EADDRNOTAVAIL;
@@ -4998,6 +4998,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, · 3151 unmodified lines
49984998 nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
49994999 goto error;
50005000
5001+ spin_lock_bh(&ifa->lock);
50015002 if (!((ifa->flags&IFA_F_PERMANENT) &&
50025003 (ifa->prefered_lft == INFINITY_LIFE_TIME))) {
50035004 preferred = ifa->prefered_lft;
@@ -5019,6 +5020,7 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, · 15 unmodified lines
50195020 preferred = INFINITY_LIFE_TIME;
50205021 valid = INFINITY_LIFE_TIME;
50215022 }
5023+ spin_unlock_bh(&ifa->lock);
50225024
50235025 if (!ipv6_addr_any(&ifa->peer_addr)) {
50245026 if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 ||
net/ipv6/ip6_flowlabel.c+3−1
@@ -450,8 +450,10 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, · 449 unmodified lines
450450 err = -EINVAL;
451451 goto done;
452452 }
453− if (fl_shared_exclusive(fl) || fl->opt)
453+ if (fl_shared_exclusive(fl) || fl->opt) {
454+ WRITE_ONCE(sock_net(sk)->ipv6.flowlabel_has_excl, 1);
454455 static_branch_deferred_inc(&ipv6_flowlabel_exclusive);
456+ }
455457 return fl;
456458
457459 done:
net/ipv6/ip6_offload.c+2−0
@@ -114,6 +114,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, · 113 unmodified lines
114114 if (likely(ops && ops->callbacks.gso_segment)) {
115115 skb_reset_transport_header(skb);
116116 segs = ops->callbacks.gso_segment(skb, features);
117+ if (!segs)
118+ skb->network_header = skb_mac_header(skb) + nhoff - skb->head;
117119 }
118120
119121 if (IS_ERR_OR_NULL(segs))
net/ipv6/ip6_output.c+1−1
@@ -1465,7 +1465,7 @@ static int __ip6_append_data(struct sock *sk, · 1464 unmodified lines
14651465
14661466 if (cork->tx_flags & SKBTX_ANY_SW_TSTAMP &&
14671467 sk->sk_tsflags & SOF_TIMESTAMPING_OPT_ID)
1468− tskey = sk->sk_tskey++;
1468+ tskey = atomic_inc_return(&sk->sk_tskey) - 1;
14691469
14701470 hh_len = LL_RESERVED_SPACE(rt->dst.dev);
14711471
net/ipv6/mcast.c+1−1
@@ -1759,7 +1759,7 @@ static struct sk_buff *mld_newpack(struct inet6_dev *idev, unsigned int mtu) · 1758 unmodified lines
17591759 skb_reserve(skb, hlen);
17601760 skb_tailroom_reserve(skb, mtu, tlen);
17611761
1762− if (__ipv6_get_lladdr(idev, &addr_buf, IFA_F_TENTATIVE)) {
1762+ if (ipv6_get_lladdr(dev, &addr_buf, IFA_F_TENTATIVE)) {
17631763 /* <draft-ietf-magma-mld-source-05.txt>:
17641764 * use unspecified address as the source address
17651765 * when a valid link-local address is not available.
net/ipv6/route.c+10−9
@@ -5753,11 +5753,11 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb, · 5752 unmodified lines
57535753 }
57545754
57555755 if (!dst) {
5756− if (rt->offload)
5756+ if (READ_ONCE(rt->offload))
57575757 rtm->rtm_flags |= RTM_F_OFFLOAD;
5758− if (rt->trap)
5758+ if (READ_ONCE(rt->trap))
57595759 rtm->rtm_flags |= RTM_F_TRAP;
5760− if (rt->offload_failed)
5760+ if (READ_ONCE(rt->offload_failed))
57615761 rtm->rtm_flags |= RTM_F_OFFLOAD_FAILED;
57625762 }
57635763
@@ -6215,19 +6215,20 @@ void fib6_info_hw_flags_set(struct net *net, struct fib6_info *f6i, · 451 unmodified lines
62156215 struct sk_buff *skb;
62166216 int err;
62176217
6218− if (f6i->offload == offload && f6i->trap == trap &&
6219− f6i->offload_failed == offload_failed)
6218+ if (READ_ONCE(f6i->offload) == offload &&
6219+ READ_ONCE(f6i->trap) == trap &&
6220+ READ_ONCE(f6i->offload_failed) == offload_failed)
62206221 return;
62216222
6222− f6i->offload = offload;
6223− f6i->trap = trap;
6223+ WRITE_ONCE(f6i->offload, offload);
6224+ WRITE_ONCE(f6i->trap, trap);
62246225
62256226 /* 2 means send notifications only if offload_failed was changed. */
62266227 if (net->ipv6.sysctl.fib_notify_on_flag_change == 2 &&
6227− f6i->offload_failed == offload_failed)
6228+ READ_ONCE(f6i->offload_failed) == offload_failed)
62286229 return;
62296230
6230− f6i->offload_failed = offload_failed;
6231+ WRITE_ONCE(f6i->offload_failed, offload_failed);
62316232
62326233 if (!rcu_access_pointer(f6i->fib6_node))
62336234 /* The route was removed from the tree, do not send
net/mac80211/mlme.c+21−8
@@ -666,7 +666,7 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, · 665 unmodified lines
666666 ieee80211_ie_build_he_6ghz_cap(sdata, skb);
667667 }
668668
669−static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
669+static int ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
670670 {
671671 struct ieee80211_local *local = sdata->local;
672672 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
@@ -686,6 +686,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 13 unmodified lines
686686 enum nl80211_iftype iftype = ieee80211_vif_type_p2p(&sdata->vif);
687687 const struct ieee80211_sband_iftype_data *iftd;
688688 struct ieee80211_prep_tx_info info = {};
689+ int ret;
689690
690691 /* we know it's writable, cast away the const */
691692 if (assoc_data->ie_len)
@@ -699,7 +700,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 7 unmodified lines
699700 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
700701 if (WARN_ON(!chanctx_conf)) {
701702 rcu_read_unlock();
702− return;
703+ return -EINVAL;
703704 }
704705 chan = chanctx_conf->def.chan;
705706 rcu_read_unlock();
@@ -750,7 +751,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) · 44 unmodified lines
750751 (iftd ? iftd->vendor_elems.len : 0),
751752 GFP_KERNEL);
752753 if (!skb)
753− return;
754+ return -ENOMEM;
754755
755756 skb_reserve(skb, local->hw.extra_tx_headroom);
756757
@@ -1031,15 +1032,22 @@ skip_rates: · 274 unmodified lines
10311032 skb_put_data(skb, assoc_data->ie + offset, noffset - offset);
10321033 }
10331034
1034− if (assoc_data->fils_kek_len &&
1035− fils_encrypt_assoc_req(skb, assoc_data) < 0) {
1036− dev_kfree_skb(skb);
1037− return;
1035+ if (assoc_data->fils_kek_len) {
1036+ ret = fils_encrypt_assoc_req(skb, assoc_data);
1037+ if (ret < 0) {
1038+ dev_kfree_skb(skb);
1039+ return ret;
1040+ }
10381041 }
10391042
10401043 pos = skb_tail_pointer(skb);
10411044 kfree(ifmgd->assoc_req_ies);
10421045 ifmgd->assoc_req_ies = kmemdup(ie_start, pos - ie_start, GFP_ATOMIC);
1046+ if (!ifmgd->assoc_req_ies) {
1047+ dev_kfree_skb(skb);
1048+ return -ENOMEM;
1049+ }
1050+
10431051 ifmgd->assoc_req_ies_len = pos - ie_start;
10441052
10451053 drv_mgd_prepare_tx(local, sdata, &info);
@@ -1049,6 +1057,8 @@ skip_rates: · 3 unmodified lines
10491057 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS |
10501058 IEEE80211_TX_INTFL_MLME_CONN_TX;
10511059 ieee80211_tx_skb(sdata, skb);
1060+
1061+ return 0;
10521062 }
10531063
10541064 void ieee80211_send_pspoll(struct ieee80211_local *local,
@@ -4497,6 +4507,7 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) · 3442 unmodified lines
44974507 {
44984508 struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data;
44994509 struct ieee80211_local *local = sdata->local;
4510+ int ret;
45004511
45014512 sdata_assert_lock(sdata);
45024513
@@ -4517,7 +4528,9 @@ static int ieee80211_do_assoc(struct ieee80211_sub_if_data *sdata) · 14 unmodified lines
45174528 sdata_info(sdata, "associate with %pM (try %d/%d)\n",
45184529 assoc_data->bss->bssid, assoc_data->tries,
45194530 IEEE80211_ASSOC_MAX_TRIES);
4520− ieee80211_send_assoc(sdata);
4531+ ret = ieee80211_send_assoc(sdata);
4532+ if (ret)
4533+ return ret;
45214534
45224535 if (!ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) {
45234536 assoc_data->timeout = jiffies + IEEE80211_ASSOC_TIMEOUT;
net/mctp/route.c+6−5
@@ -412,13 +412,14 @@ static int mctp_route_input(struct mctp_route *route, struct sk_buff *skb) · 411 unmodified lines
412412 * this function.
413413 */
414414 rc = mctp_key_add(key, msk);
415− if (rc)
415+ if (rc) {
416416 kfree(key);
417+ } else {
418+ trace_mctp_key_acquire(key);
417419
418− trace_mctp_key_acquire(key);
419−
420− /* we don't need to release key->lock on exit */
421− mctp_key_unref(key);
420+ /* we don't need to release key->lock on exit */
421+ mctp_key_unref(key);
422+ }
422423 key = NULL;
423424
424425 } else {
net/mptcp/mib.c+2−0
@@ -35,12 +35,14 @@ static const struct snmp_mib mptcp_snmp_list[] = { · 34 unmodified lines
3535 SNMP_MIB_ITEM("AddAddr", MPTCP_MIB_ADDADDR),
3636 SNMP_MIB_ITEM("EchoAdd", MPTCP_MIB_ECHOADD),
3737 SNMP_MIB_ITEM("PortAdd", MPTCP_MIB_PORTADD),
38+ SNMP_MIB_ITEM("AddAddrDrop", MPTCP_MIB_ADDADDRDROP),
3839 SNMP_MIB_ITEM("MPJoinPortSynRx", MPTCP_MIB_JOINPORTSYNRX),
3940 SNMP_MIB_ITEM("MPJoinPortSynAckRx", MPTCP_MIB_JOINPORTSYNACKRX),
4041 SNMP_MIB_ITEM("MPJoinPortAckRx", MPTCP_MIB_JOINPORTACKRX),
4142 SNMP_MIB_ITEM("MismatchPortSynRx", MPTCP_MIB_MISMATCHPORTSYNRX),
4243 SNMP_MIB_ITEM("MismatchPortAckRx", MPTCP_MIB_MISMATCHPORTACKRX),
4344 SNMP_MIB_ITEM("RmAddr", MPTCP_MIB_RMADDR),
45+ SNMP_MIB_ITEM("RmAddrDrop", MPTCP_MIB_RMADDRDROP),
4446 SNMP_MIB_ITEM("RmSubflow", MPTCP_MIB_RMSUBFLOW),
4547 SNMP_MIB_ITEM("MPPrioTx", MPTCP_MIB_MPPRIOTX),
4648 SNMP_MIB_ITEM("MPPrioRx", MPTCP_MIB_MPPRIORX),
net/mptcp/mib.h+2−0
@@ -28,12 +28,14 @@ enum linux_mptcp_mib_field { · 27 unmodified lines
2828 MPTCP_MIB_ADDADDR, /* Received ADD_ADDR with echo-flag=0 */
2929 MPTCP_MIB_ECHOADD, /* Received ADD_ADDR with echo-flag=1 */
3030 MPTCP_MIB_PORTADD, /* Received ADD_ADDR with a port-number */
31+ MPTCP_MIB_ADDADDRDROP, /* Dropped incoming ADD_ADDR */
3132 MPTCP_MIB_JOINPORTSYNRX, /* Received a SYN MP_JOIN with a different port-number */
3233 MPTCP_MIB_JOINPORTSYNACKRX, /* Received a SYNACK MP_JOIN with a different port-number */
3334 MPTCP_MIB_JOINPORTACKRX, /* Received an ACK MP_JOIN with a different port-number */
3435 MPTCP_MIB_MISMATCHPORTSYNRX, /* Received a SYN MP_JOIN with a mismatched port-number */
3536 MPTCP_MIB_MISMATCHPORTACKRX, /* Received an ACK MP_JOIN with a mismatched port-number */
3637 MPTCP_MIB_RMADDR, /* Received RM_ADDR */
38+ MPTCP_MIB_RMADDRDROP, /* Dropped incoming RM_ADDR */
3739 MPTCP_MIB_RMSUBFLOW, /* Remove a subflow */
3840 MPTCP_MIB_MPPRIOTX, /* Transmit a MP_PRIO */
3941 MPTCP_MIB_MPPRIORX, /* Received a MP_PRIO */
net/mptcp/pm.c+6−2
@@ -213,6 +213,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk, · 212 unmodified lines
213213 mptcp_pm_add_addr_send_ack(msk);
214214 } else if (mptcp_pm_schedule_work(msk, MPTCP_PM_ADD_ADDR_RECEIVED)) {
215215 pm->remote = *addr;
216+ } else {
217+ __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_ADDADDRDROP);
216218 }
217219
218220 spin_unlock_bh(&pm->lock);
@@ -253,8 +255,10 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, · 34 unmodified lines
253255 mptcp_event_addr_removed(msk, rm_list->ids[i]);
254256
255257 spin_lock_bh(&pm->lock);
256− mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED);
257− pm->rm_list_rx = *rm_list;
258+ if (mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED))
259+ pm->rm_list_rx = *rm_list;
260+ else
261+ __MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_RMADDRDROP);
258262 spin_unlock_bh(&pm->lock);
259263 }
260264
net/mptcp/pm_netlink.c+24−5
@@ -546,6 +546,16 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk) · 545 unmodified lines
546546 if (msk->pm.add_addr_signaled < add_addr_signal_max) {
547547 local = select_signal_address(pernet, msk);
548548
549+ /* due to racing events on both ends we can reach here while
550+ * previous add address is still running: if we invoke now
551+ * mptcp_pm_announce_addr(), that will fail and the
552+ * corresponding id will be marked as used.
553+ * Instead let the PM machinery reschedule us when the
554+ * current address announce will be completed.
555+ */
556+ if (msk->pm.addr_signal & BIT(MPTCP_ADD_ADDR_SIGNAL))
557+ return;
558+
549559 if (local) {
550560 if (mptcp_pm_alloc_anno_list(msk, local)) {
551561 __clear_bit(local->addr.id, msk->pm.id_avail_bitmap);
@@ -650,6 +660,7 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · 98 unmodified lines
650660 unsigned int add_addr_accept_max;
651661 struct mptcp_addr_info remote;
652662 unsigned int subflows_max;
663+ bool reset_port = false;
653664 int i, nr;
654665
655666 add_addr_accept_max = mptcp_pm_get_add_addr_accept_max(msk);
@@ -659,15 +670,19 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · 3 unmodified lines
659670 msk->pm.add_addr_accepted, add_addr_accept_max,
660671 msk->pm.remote.family);
661672
662− if (lookup_subflow_by_daddr(&msk->conn_list, &msk->pm.remote))
673+ remote = msk->pm.remote;
674+ if (lookup_subflow_by_daddr(&msk->conn_list, &remote))
663675 goto add_addr_echo;
664676
677+ /* pick id 0 port, if none is provided the remote address */
678+ if (!remote.port) {
679+ reset_port = true;
680+ remote.port = sk->sk_dport;
681+ }
682+
665683 /* connect to the specified remote address, using whatever
666684 * local address the routing configuration will pick.
667685 */
668− remote = msk->pm.remote;
669− if (!remote.port)
670− remote.port = sk->sk_dport;
671686 nr = fill_local_addresses_vec(msk, addrs);
672687
673688 msk->pm.add_addr_accepted++;
@@ -680,8 +695,12 @@ static void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) · 6 unmodified lines
680695 __mptcp_subflow_connect(sk, &addrs[i], &remote);
681696 spin_lock_bh(&msk->pm.lock);
682697
698+ /* be sure to echo exactly the received address */
699+ if (reset_port)
700+ remote.port = 0;
701+
683702 add_addr_echo:
684− mptcp_pm_announce_addr(msk, &msk->pm.remote, true);
703+ mptcp_pm_announce_addr(msk, &remote, true);
685704 mptcp_pm_nl_addr_send_ack(msk);
686705 }
687706
net/netfilter/nf_tables_api.c+12−4
@@ -6551,12 +6551,15 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, · 6550 unmodified lines
65516551 {
65526552 struct nft_object *newobj;
65536553 struct nft_trans *trans;
6554− int err;
6554+ int err = -ENOMEM;
6555+
6556+ if (!try_module_get(type->owner))
6557+ return -ENOENT;
65556558
65566559 trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
65576560 sizeof(struct nft_trans_obj));
65586561 if (!trans)
6559− return -ENOMEM;
6562+ goto err_trans;
65606563
65616564 newobj = nft_obj_init(ctx, type, attr);
65626565 if (IS_ERR(newobj)) {
@@ -6573,6 +6576,8 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, · 10 unmodified lines
65736576
65746577 err_free_trans:
65756578 kfree(trans);
6579+err_trans:
6580+ module_put(type->owner);
65766581 return err;
65776582 }
65786583
@@ -8185,7 +8190,7 @@ static void nft_obj_commit_update(struct nft_trans *trans) · 1606 unmodified lines
81858190 if (obj->ops->update)
81868191 obj->ops->update(obj, newobj);
81878192
8188− kfree(newobj);
8193+ nft_obj_destroy(&trans->ctx, newobj);
81898194 }
81908195
81918196 static void nft_commit_release(struct nft_trans *trans)
@@ -8976,7 +8981,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) · 784 unmodified lines
89768981 break;
89778982 case NFT_MSG_NEWOBJ:
89788983 if (nft_trans_obj_update(trans)) {
8979− kfree(nft_trans_obj_newobj(trans));
8984+ nft_obj_destroy(&trans->ctx, nft_trans_obj_newobj(trans));
89808985 nft_trans_destroy(trans);
89818986 } else {
89828987 trans->ctx.table->use--;
@@ -9636,10 +9641,13 @@ EXPORT_SYMBOL_GPL(__nft_release_basechain); · 653 unmodified lines
96369641
96379642 static void __nft_release_hook(struct net *net, struct nft_table *table)
96389643 {
9644+ struct nft_flowtable *flowtable;
96399645 struct nft_chain *chain;
96409646
96419647 list_for_each_entry(chain, &table->chains, list)
96429648 nf_tables_unregister_hook(net, table, chain);
9649+ list_for_each_entry(flowtable, &table->flowtables, list)
9650+ nft_unregister_flowtable_net_hooks(net, &flowtable->hook_list);
96439651 }
96449652
96459653 static void __nft_release_hooks(struct net *net)
net/netfilter/nf_tables_offload.c+2−1
@@ -94,7 +94,8 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net, · 93 unmodified lines
9494
9595 expr = nft_expr_first(rule);
9696 while (nft_expr_more(rule, expr)) {
97− if (expr->ops->offload_flags & NFT_OFFLOAD_F_ACTION)
97+ if (expr->ops->offload_action &&
98+ expr->ops->offload_action(expr))
9899 num_actions++;
99100
100101 expr = nft_expr_next(expr);
net/netfilter/nft_dup_netdev.c+6−0
@@ -67,6 +67,11 @@ static int nft_dup_netdev_offload(struct nft_offload_ctx *ctx, · 66 unmodified lines
6767 return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_MIRRED, oif);
6868 }
6969
70+static bool nft_dup_netdev_offload_action(const struct nft_expr *expr)
71+{
72+ return true;
73+}
74+
7075 static struct nft_expr_type nft_dup_netdev_type;
7176 static const struct nft_expr_ops nft_dup_netdev_ops = {
7277 .type = &nft_dup_netdev_type,
@@ -75,6 +80,7 @@ static const struct nft_expr_ops nft_dup_netdev_ops = { · 2 unmodified lines
7580 .init = nft_dup_netdev_init,
7681 .dump = nft_dup_netdev_dump,
7782 .offload = nft_dup_netdev_offload,
83+ .offload_action = nft_dup_netdev_offload_action,
7884 };
7985
8086 static struct nft_expr_type nft_dup_netdev_type __read_mostly = {
net/netfilter/nft_fwd_netdev.c+6−0
@@ -79,6 +79,11 @@ static int nft_fwd_netdev_offload(struct nft_offload_ctx *ctx, · 78 unmodified lines
7979 return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_REDIRECT, oif);
8080 }
8181
82+static bool nft_fwd_netdev_offload_action(const struct nft_expr *expr)
83+{
84+ return true;
85+}
86+
8287 struct nft_fwd_neigh {
8388 u8 sreg_dev;
8489 u8 sreg_addr;
@@ -222,6 +227,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = { · 137 unmodified lines
222227 .dump = nft_fwd_netdev_dump,
223228 .validate = nft_fwd_validate,
224229 .offload = nft_fwd_netdev_offload,
230+ .offload_action = nft_fwd_netdev_offload_action,
225231 };
226232
227233 static const struct nft_expr_ops *
net/netfilter/nft_immediate.c+11−1
@@ -213,6 +213,16 @@ static int nft_immediate_offload(struct nft_offload_ctx *ctx, · 212 unmodified lines
213213 return 0;
214214 }
215215
216+static bool nft_immediate_offload_action(const struct nft_expr *expr)
217+{
218+ const struct nft_immediate_expr *priv = nft_expr_priv(expr);
219+
220+ if (priv->dreg == NFT_REG_VERDICT)
221+ return true;
222+
223+ return false;
224+}
225+
216226 static const struct nft_expr_ops nft_imm_ops = {
217227 .type = &nft_imm_type,
218228 .size = NFT_EXPR_SIZE(sizeof(struct nft_immediate_expr)),
@@ -224,7 +234,7 @@ static const struct nft_expr_ops nft_imm_ops = { · 5 unmodified lines
224234 .dump = nft_immediate_dump,
225235 .validate = nft_immediate_validate,
226236 .offload = nft_immediate_offload,
227− .offload_flags = NFT_OFFLOAD_F_ACTION,
237+ .offload_action = nft_immediate_offload_action,
228238 };
229239
230240 struct nft_expr_type nft_imm_type __read_mostly = {
net/netfilter/nft_limit.c+18−0
@@ -340,11 +340,20 @@ static int nft_limit_obj_pkts_dump(struct sk_buff *skb, · 339 unmodified lines
340340 return nft_limit_dump(skb, &priv->limit, NFT_LIMIT_PKTS);
341341 }
342342
343+static void nft_limit_obj_pkts_destroy(const struct nft_ctx *ctx,
344+ struct nft_object *obj)
345+{
346+ struct nft_limit_priv_pkts *priv = nft_obj_data(obj);
347+
348+ nft_limit_destroy(ctx, &priv->limit);
349+}
350+
343351 static struct nft_object_type nft_limit_obj_type;
344352 static const struct nft_object_ops nft_limit_obj_pkts_ops = {
345353 .type = &nft_limit_obj_type,
346354 .size = NFT_EXPR_SIZE(sizeof(struct nft_limit_priv_pkts)),
347355 .init = nft_limit_obj_pkts_init,
356+ .destroy = nft_limit_obj_pkts_destroy,
348357 .eval = nft_limit_obj_pkts_eval,
349358 .dump = nft_limit_obj_pkts_dump,
350359 };
@@ -378,11 +387,20 @@ static int nft_limit_obj_bytes_dump(struct sk_buff *skb, · 27 unmodified lines
378387 return nft_limit_dump(skb, priv, NFT_LIMIT_PKT_BYTES);
379388 }
380389
390+static void nft_limit_obj_bytes_destroy(const struct nft_ctx *ctx,
391+ struct nft_object *obj)
392+{
393+ struct nft_limit_priv *priv = nft_obj_data(obj);
394+
395+ nft_limit_destroy(ctx, priv);
396+}
397+
381398 static struct nft_object_type nft_limit_obj_type;
382399 static const struct nft_object_ops nft_limit_obj_bytes_ops = {
383400 .type = &nft_limit_obj_type,
384401 .size = sizeof(struct nft_limit_priv),
385402 .init = nft_limit_obj_bytes_init,
403+ .destroy = nft_limit_obj_bytes_destroy,
386404 .eval = nft_limit_obj_bytes_eval,
387405 .dump = nft_limit_obj_bytes_dump,
388406 };
net/netfilter/nft_synproxy.c+3−1
@@ -191,8 +191,10 @@ static int nft_synproxy_do_init(const struct nft_ctx *ctx, · 190 unmodified lines
191191 if (err)
192192 goto nf_ct_failure;
193193 err = nf_synproxy_ipv6_init(snet, ctx->net);
194− if (err)
194+ if (err) {
195+ nf_synproxy_ipv4_fini(snet, ctx->net);
195196 goto nf_ct_failure;
197+ }
196198 break;
197199 }
198200
net/netfilter/xt_socket.c+3−1
@@ -220,8 +220,10 @@ static void socket_mt_destroy(const struct xt_mtdtor_param *par) · 219 unmodified lines
220220 {
221221 if (par->family == NFPROTO_IPV4)
222222 nf_defrag_ipv4_disable(par->net);
223+#if IS_ENABLED(CONFIG_IP6_NF_IPTABLES)
223224 else if (par->family == NFPROTO_IPV6)
224− nf_defrag_ipv4_disable(par->net);
225+ nf_defrag_ipv6_disable(par->net);
226+#endif
225227 }
226228
227229 static struct xt_match socket_mt_reg[] __read_mostly = {
net/openvswitch/actions.c+38−8
@@ -423,12 +423,43 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto, · 422 unmodified lines
423423 memcpy(addr, new_addr, sizeof(__be32[4]));
424424 }
425425
426−static void set_ipv6_fl(struct ipv6hdr *nh, u32 fl, u32 mask)
426+static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask)
427427 {
428+ u8 old_ipv6_tclass = ipv6_get_dsfield(nh);
429+
430+ ipv6_tclass = OVS_MASKED(old_ipv6_tclass, ipv6_tclass, mask);
431+
432+ if (skb->ip_summed == CHECKSUM_COMPLETE)
433+ csum_replace(&skb->csum, (__force __wsum)(old_ipv6_tclass << 12),
434+ (__force __wsum)(ipv6_tclass << 12));
435+
436+ ipv6_change_dsfield(nh, ~mask, ipv6_tclass);
437+}
438+
439+static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask)
440+{
441+ u32 ofl;
442+
443+ ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2];
444+ fl = OVS_MASKED(ofl, fl, mask);
445+
428446 /* Bits 21-24 are always unmasked, so this retains their values. */
429− OVS_SET_MASKED(nh->flow_lbl[0], (u8)(fl >> 16), (u8)(mask >> 16));
430− OVS_SET_MASKED(nh->flow_lbl[1], (u8)(fl >> 8), (u8)(mask >> 8));
431− OVS_SET_MASKED(nh->flow_lbl[2], (u8)fl, (u8)mask);
447+ nh->flow_lbl[0] = (u8)(fl >> 16);
448+ nh->flow_lbl[1] = (u8)(fl >> 8);
449+ nh->flow_lbl[2] = (u8)fl;
450+
451+ if (skb->ip_summed == CHECKSUM_COMPLETE)
452+ csum_replace(&skb->csum, (__force __wsum)htonl(ofl), (__force __wsum)htonl(fl));
453+}
454+
455+static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask)
456+{
457+ new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask);
458+
459+ if (skb->ip_summed == CHECKSUM_COMPLETE)
460+ csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8),
461+ (__force __wsum)(new_ttl << 8));
462+ nh->hop_limit = new_ttl;
432463 }
433464
434465 static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl,
@@ -546,18 +577,17 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key, · 111 unmodified lines
546577 }
547578 }
548579 if (mask->ipv6_tclass) {
549− ipv6_change_dsfield(nh, ~mask->ipv6_tclass, key->ipv6_tclass);
580+ set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass);
550581 flow_key->ip.tos = ipv6_get_dsfield(nh);
551582 }
552583 if (mask->ipv6_label) {
553− set_ipv6_fl(nh, ntohl(key->ipv6_label),
584+ set_ipv6_fl(skb, nh, ntohl(key->ipv6_label),
554585 ntohl(mask->ipv6_label));
555586 flow_key->ipv6.label =
556587 *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL);
557588 }
558589 if (mask->ipv6_hlimit) {
559− OVS_SET_MASKED(nh->hop_limit, key->ipv6_hlimit,
560− mask->ipv6_hlimit);
590+ set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit);
561591 flow_key->ip.ttl = nh->hop_limit;
562592 }
563593 return 0;
net/sched/act_api.c+11−4
@@ -274,7 +274,7 @@ static int tcf_action_offload_add_ex(struct tc_action *action, · 273 unmodified lines
274274 err = tc_setup_action(&fl_action->action, actions);
275275 if (err) {
276276 NL_SET_ERR_MSG_MOD(extack,
277− "Failed to setup tc actions for offload\n");
277+ "Failed to setup tc actions for offload");
278278 goto fl_err;
279279 }
280280
@@ -1037,6 +1037,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, · 756 unmodified lines
10371037 restart_act_graph:
10381038 for (i = 0; i < nr_actions; i++) {
10391039 const struct tc_action *a = actions[i];
1040+ int repeat_ttl;
10401041
10411042 if (jmp_prgcnt > 0) {
10421043 jmp_prgcnt -= 1;
@@ -1045,11 +1046,17 @@ restart_act_graph: · 2 unmodified lines
10451046
10461047 if (tc_act_skip_sw(a->tcfa_flags))
10471048 continue;
1049+
1050+ repeat_ttl = 32;
10481051 repeat:
10491052 ret = a->ops->act(skb, a, res);
1050− if (ret == TC_ACT_REPEAT)
1051− goto repeat; /* we need a ttl - JHS */
1052−
1053+ if (unlikely(ret == TC_ACT_REPEAT)) {
1054+ if (--repeat_ttl != 0)
1055+ goto repeat;
1056+ /* suspicious opcode, stop pipeline */
1057+ net_warn_ratelimited("TC_ACT_REPEAT abuse ?\n");
1058+ return TC_ACT_OK;
1059+ }
10531060 if (TC_ACT_EXT_CMP(ret, TC_ACT_JUMP)) {
10541061 jmp_prgcnt = ret & TCA_ACT_MAX_PRIO_MASK;
10551062 if (!jmp_prgcnt || (jmp_prgcnt > nr_actions)) {
net/sched/act_ct.c+0−5
@@ -533,11 +533,6 @@ static bool tcf_ct_flow_table_lookup(struct tcf_ct_params *p, · 532 unmodified lines
533533 struct nf_conn *ct;
534534 u8 dir;
535535
536− /* Previously seen or loopback */
537− ct = nf_ct_get(skb, &ctinfo);
538− if ((ct && !nf_ct_is_template(ct)) || ctinfo == IP_CT_UNTRACKED)
539− return false;
540−
541536 switch (family) {
542537 case NFPROTO_IPV4:
543538 if (!tcf_ct_flow_table_fill_tuple_ipv4(skb, &tuple, &tcph))
net/sched/cls_api.c+3−3
@@ -1044,7 +1044,7 @@ static int __tcf_qdisc_find(struct net *net, struct Qdisc **q, · 1043 unmodified lines
10441044
10451045 /* Find qdisc */
10461046 if (!*parent) {
1047− *q = dev->qdisc;
1047+ *q = rcu_dereference(dev->qdisc);
10481048 *parent = (*q)->handle;
10491049 } else {
10501050 *q = qdisc_lookup_rcu(dev, TC_H_MAJ(*parent));
@@ -2587,7 +2587,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) · 1536 unmodified lines
25872587
25882588 parent = tcm->tcm_parent;
25892589 if (!parent)
2590− q = dev->qdisc;
2590+ q = rtnl_dereference(dev->qdisc);
25912591 else
25922592 q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent));
25932593 if (!q)
@@ -2962,7 +2962,7 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) · 368 unmodified lines
29622962 return skb->len;
29632963
29642964 if (!tcm->tcm_parent)
2965− q = dev->qdisc;
2965+ q = rtnl_dereference(dev->qdisc);
29662966 else
29672967 q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent));
29682968
net/sched/sch_api.c+12−10
@@ -301,7 +301,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) · 300 unmodified lines
301301
302302 if (!handle)
303303 return NULL;
304− q = qdisc_match_from_root(dev->qdisc, handle);
304+ q = qdisc_match_from_root(rtnl_dereference(dev->qdisc), handle);
305305 if (q)
306306 goto out;
307307
@@ -320,7 +320,7 @@ struct Qdisc *qdisc_lookup_rcu(struct net_device *dev, u32 handle) · 12 unmodified lines
320320
321321 if (!handle)
322322 return NULL;
323− q = qdisc_match_from_root(dev->qdisc, handle);
323+ q = qdisc_match_from_root(rcu_dereference(dev->qdisc), handle);
324324 if (q)
325325 goto out;
326326
@@ -1082,10 +1082,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, · 755 unmodified lines
10821082 skip:
10831083 if (!ingress) {
10841084 notify_and_destroy(net, skb, n, classid,
1085− dev->qdisc, new);
1085+ rtnl_dereference(dev->qdisc), new);
10861086 if (new && !new->ops->attach)
10871087 qdisc_refcount_inc(new);
1088− dev->qdisc = new ? : &noop_qdisc;
1088+ rcu_assign_pointer(dev->qdisc, new ? : &noop_qdisc);
10891089
10901090 if (new && new->ops->attach)
10911091 new->ops->attach(new);
@@ -1451,7 +1451,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, · 359 unmodified lines
14511451 q = dev_ingress_queue(dev)->qdisc_sleeping;
14521452 }
14531453 } else {
1454− q = dev->qdisc;
1454+ q = rtnl_dereference(dev->qdisc);
14551455 }
14561456 if (!q) {
14571457 NL_SET_ERR_MSG(extack, "Cannot find specified qdisc on specified device");
@@ -1540,7 +1540,7 @@ replay: · 82 unmodified lines
15401540 q = dev_ingress_queue(dev)->qdisc_sleeping;
15411541 }
15421542 } else {
1543− q = dev->qdisc;
1543+ q = rtnl_dereference(dev->qdisc);
15441544 }
15451545
15461546 /* It may be default qdisc, ignore it */
@@ -1762,7 +1762,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) · 215 unmodified lines
17621762 s_q_idx = 0;
17631763 q_idx = 0;
17641764
1765− if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx,
1765+ if (tc_dump_qdisc_root(rtnl_dereference(dev->qdisc),
1766+ skb, cb, &q_idx, s_q_idx,
17661767 true, tca[TCA_DUMP_INVISIBLE]) < 0)
17671768 goto done;
17681769
@@ -2033,7 +2034,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, · 264 unmodified lines
20332034 } else if (qid1) {
20342035 qid = qid1;
20352036 } else if (qid == 0)
2036− qid = dev->qdisc->handle;
2037+ qid = rtnl_dereference(dev->qdisc)->handle;
20372038
20382039 /* Now qid is genuine qdisc handle consistent
20392040 * both with parent and child.
@@ -2044,7 +2045,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, · 4 unmodified lines
20442045 portid = TC_H_MAKE(qid, portid);
20452046 } else {
20462047 if (qid == 0)
2047− qid = dev->qdisc->handle;
2048+ qid = rtnl_dereference(dev->qdisc)->handle;
20482049 }
20492050
20502051 /* OK. Locate qdisc */
@@ -2205,7 +2206,8 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) · 154 unmodified lines
22052206 s_t = cb->args[0];
22062207 t = 0;
22072208
2208− if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t, true) < 0)
2209+ if (tc_dump_tclass_root(rtnl_dereference(dev->qdisc),
2210+ skb, tcm, cb, &t, s_t, true) < 0)
22092211 goto done;
22102212
22112213 dev_queue = dev_ingress_queue(dev);
net/sched/sch_generic.c+16−13
@@ -1164,30 +1164,33 @@ static void attach_default_qdiscs(struct net_device *dev) · 1163 unmodified lines
11641164 if (!netif_is_multiqueue(dev) ||
11651165 dev->priv_flags & IFF_NO_QUEUE) {
11661166 netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
1167− dev->qdisc = txq->qdisc_sleeping;
1168− qdisc_refcount_inc(dev->qdisc);
1167+ qdisc = txq->qdisc_sleeping;
1168+ rcu_assign_pointer(dev->qdisc, qdisc);
1169+ qdisc_refcount_inc(qdisc);
11691170 } else {
11701171 qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT, NULL);
11711172 if (qdisc) {
1172− dev->qdisc = qdisc;
1173+ rcu_assign_pointer(dev->qdisc, qdisc);
11731174 qdisc->ops->attach(qdisc);
11741175 }
11751176 }
1177+ qdisc = rtnl_dereference(dev->qdisc);
11761178
11771179 /* Detect default qdisc setup/init failed and fallback to "noqueue" */
1178− if (dev->qdisc == &noop_qdisc) {
1180+ if (qdisc == &noop_qdisc) {
11791181 netdev_warn(dev, "default qdisc (%s) fail, fallback to %s\n",
11801182 default_qdisc_ops->id, noqueue_qdisc_ops.id);
11811183 dev->priv_flags |= IFF_NO_QUEUE;
11821184 netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL);
1183− dev->qdisc = txq->qdisc_sleeping;
1184− qdisc_refcount_inc(dev->qdisc);
1185+ qdisc = txq->qdisc_sleeping;
1186+ rcu_assign_pointer(dev->qdisc, qdisc);
1187+ qdisc_refcount_inc(qdisc);
11851188 dev->priv_flags ^= IFF_NO_QUEUE;
11861189 }
11871190
11881191 #ifdef CONFIG_NET_SCHED
1189− if (dev->qdisc != &noop_qdisc)
1190− qdisc_hash_add(dev->qdisc, false);
1192+ if (qdisc != &noop_qdisc)
1193+ qdisc_hash_add(qdisc, false);
11911194 #endif
11921195 }
11931196
@@ -1217,7 +1220,7 @@ void dev_activate(struct net_device *dev) · 23 unmodified lines
12171220 * and noqueue_qdisc for virtual interfaces
12181221 */
12191222
1220− if (dev->qdisc == &noop_qdisc)
1223+ if (rtnl_dereference(dev->qdisc) == &noop_qdisc)
12211224 attach_default_qdiscs(dev);
12221225
12231226 if (!netif_carrier_ok(dev))
@@ -1383,7 +1386,7 @@ static int qdisc_change_tx_queue_len(struct net_device *dev, · 159 unmodified lines
13831386 void dev_qdisc_change_real_num_tx(struct net_device *dev,
13841387 unsigned int new_real_tx)
13851388 {
1386− struct Qdisc *qdisc = dev->qdisc;
1389+ struct Qdisc *qdisc = rtnl_dereference(dev->qdisc);
13871390
13881391 if (qdisc->ops->change_real_num_tx)
13891392 qdisc->ops->change_real_num_tx(qdisc, new_real_tx);
@@ -1447,7 +1450,7 @@ static void dev_init_scheduler_queue(struct net_device *dev, · 57 unmodified lines
14471450
14481451 void dev_init_scheduler(struct net_device *dev)
14491452 {
1450− dev->qdisc = &noop_qdisc;
1453+ rcu_assign_pointer(dev->qdisc, &noop_qdisc);
14511454 netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc);
14521455 if (dev_ingress_queue(dev))
14531456 dev_init_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc);
@@ -1475,8 +1478,8 @@ void dev_shutdown(struct net_device *dev) · 21 unmodified lines
14751478 netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc);
14761479 if (dev_ingress_queue(dev))
14771480 shutdown_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc);
1478− qdisc_put(dev->qdisc);
1479− dev->qdisc = &noop_qdisc;
1481+ qdisc_put(rtnl_dereference(dev->qdisc));
1482+ rcu_assign_pointer(dev->qdisc, &noop_qdisc);
14801483
14811484 WARN_ON(timer_pending(&dev->watchdog_timer));
14821485 }
net/smc/af_smc.c+7−3
@@ -667,14 +667,17 @@ static void smc_fback_error_report(struct sock *clcsk) · 666 unmodified lines
667667 static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code)
668668 {
669669 struct sock *clcsk;
670+ int rc = 0;
670671
671672 mutex_lock(&smc->clcsock_release_lock);
672673 if (!smc->clcsock) {
673− mutex_unlock(&smc->clcsock_release_lock);
674− return -EBADF;
674+ rc = -EBADF;
675+ goto out;
675676 }
676677 clcsk = smc->clcsock->sk;
677678
679+ if (smc->use_fallback)
680+ goto out;
678681 smc->use_fallback = true;
679682 smc->fallback_rsn = reason_code;
680683 smc_stat_fallback(smc);
@@ -702,8 +705,9 @@ static int smc_switch_to_fallback(struct smc_sock *smc, int reason_code) · 21 unmodified lines
702705 smc->clcsock->sk->sk_user_data =
703706 (void *)((uintptr_t)smc | SK_USER_DATA_NOCOPY);
704707 }
708+out:
705709 mutex_unlock(&smc->clcsock_release_lock);
706− return 0;
710+ return rc;
707711 }
708712
709713 /* fall back during connect */
net/smc/smc_pnet.c+21−21
@@ -113,7 +113,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name) · 112 unmodified lines
113113 pnettable = &sn->pnettable;
114114
115115 /* remove table entry */
116− write_lock(&pnettable->lock);
116+ mutex_lock(&pnettable->lock);
117117 list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist,
118118 list) {
119119 if (!pnet_name ||
@@ -131,7 +131,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name) · 11 unmodified lines
131131 rc = 0;
132132 }
133133 }
134− write_unlock(&pnettable->lock);
134+ mutex_unlock(&pnettable->lock);
135135
136136 /* if this is not the initial namespace, stop here */
137137 if (net != &init_net)
@@ -192,7 +192,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev) · 54 unmodified lines
192192 sn = net_generic(net, smc_net_id);
193193 pnettable = &sn->pnettable;
194194
195− write_lock(&pnettable->lock);
195+ mutex_lock(&pnettable->lock);
196196 list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) {
197197 if (pnetelem->type == SMC_PNET_ETH && !pnetelem->ndev &&
198198 !strncmp(pnetelem->eth_name, ndev->name, IFNAMSIZ)) {
@@ -206,7 +206,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev) · 7 unmodified lines
206206 break;
207207 }
208208 }
209− write_unlock(&pnettable->lock);
209+ mutex_unlock(&pnettable->lock);
210210 return rc;
211211 }
212212
@@ -224,7 +224,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev) · 11 unmodified lines
224224 sn = net_generic(net, smc_net_id);
225225 pnettable = &sn->pnettable;
226226
227− write_lock(&pnettable->lock);
227+ mutex_lock(&pnettable->lock);
228228 list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) {
229229 if (pnetelem->type == SMC_PNET_ETH && pnetelem->ndev == ndev) {
230230 dev_put_track(pnetelem->ndev, &pnetelem->dev_tracker);
@@ -237,7 +237,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev) · 6 unmodified lines
237237 break;
238238 }
239239 }
240− write_unlock(&pnettable->lock);
240+ mutex_unlock(&pnettable->lock);
241241 return rc;
242242 }
243243
@@ -370,7 +370,7 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, · 126 unmodified lines
370370 strncpy(new_pe->eth_name, eth_name, IFNAMSIZ);
371371 rc = -EEXIST;
372372 new_netdev = true;
373− write_lock(&pnettable->lock);
373+ mutex_lock(&pnettable->lock);
374374 list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) {
375375 if (tmp_pe->type == SMC_PNET_ETH &&
376376 !strncmp(tmp_pe->eth_name, eth_name, IFNAMSIZ)) {
@@ -385,9 +385,9 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, · 8 unmodified lines
385385 GFP_ATOMIC);
386386 }
387387 list_add_tail(&new_pe->list, &pnettable->pnetlist);
388− write_unlock(&pnettable->lock);
388+ mutex_unlock(&pnettable->lock);
389389 } else {
390− write_unlock(&pnettable->lock);
390+ mutex_unlock(&pnettable->lock);
391391 kfree(new_pe);
392392 goto out_put;
393393 }
@@ -448,7 +448,7 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name, · 54 unmodified lines
448448 new_pe->ib_port = ib_port;
449449
450450 new_ibdev = true;
451− write_lock(&pnettable->lock);
451+ mutex_lock(&pnettable->lock);
452452 list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) {
453453 if (tmp_pe->type == SMC_PNET_IB &&
454454 !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX)) {
@@ -458,9 +458,9 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name, · 3 unmodified lines
458458 }
459459 if (new_ibdev) {
460460 list_add_tail(&new_pe->list, &pnettable->pnetlist);
461− write_unlock(&pnettable->lock);
461+ mutex_unlock(&pnettable->lock);
462462 } else {
463− write_unlock(&pnettable->lock);
463+ mutex_unlock(&pnettable->lock);
464464 kfree(new_pe);
465465 }
466466 return (new_ibdev) ? 0 : -EEXIST;
@@ -605,7 +605,7 @@ static int _smc_pnet_dump(struct net *net, struct sk_buff *skb, u32 portid, · 138 unmodified lines
605605 pnettable = &sn->pnettable;
606606
607607 /* dump pnettable entries */
608− read_lock(&pnettable->lock);
608+ mutex_lock(&pnettable->lock);
609609 list_for_each_entry(pnetelem, &pnettable->pnetlist, list) {
610610 if (pnetid && !smc_pnet_match(pnetelem->pnet_name, pnetid))
611611 continue;
@@ -620,7 +620,7 @@ static int _smc_pnet_dump(struct net *net, struct sk_buff *skb, u32 portid, · 8 unmodified lines
620620 break;
621621 }
622622 }
623− read_unlock(&pnettable->lock);
623+ mutex_unlock(&pnettable->lock);
624624 return idx;
625625 }
626626
@@ -864,7 +864,7 @@ int smc_pnet_net_init(struct net *net) · 237 unmodified lines
864864 struct smc_pnetids_ndev *pnetids_ndev = &sn->pnetids_ndev;
865865
866866 INIT_LIST_HEAD(&pnettable->pnetlist);
867− rwlock_init(&pnettable->lock);
867+ mutex_init(&pnettable->lock);
868868 INIT_LIST_HEAD(&pnetids_ndev->list);
869869 rwlock_init(&pnetids_ndev->lock);
870870
@@ -944,7 +944,7 @@ static int smc_pnet_find_ndev_pnetid_by_table(struct net_device *ndev, · 73 unmodified lines
944944 sn = net_generic(net, smc_net_id);
945945 pnettable = &sn->pnettable;
946946
947− read_lock(&pnettable->lock);
947+ mutex_lock(&pnettable->lock);
948948 list_for_each_entry(pnetelem, &pnettable->pnetlist, list) {
949949 if (pnetelem->type == SMC_PNET_ETH && ndev == pnetelem->ndev) {
950950 /* get pnetid of netdev device */
@@ -953,7 +953,7 @@ static int smc_pnet_find_ndev_pnetid_by_table(struct net_device *ndev, · 2 unmodified lines
953953 break;
954954 }
955955 }
956− read_unlock(&pnettable->lock);
956+ mutex_unlock(&pnettable->lock);
957957 return rc;
958958 }
959959
@@ -1156,7 +1156,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port) · 196 unmodified lines
11561156 sn = net_generic(&init_net, smc_net_id);
11571157 pnettable = &sn->pnettable;
11581158
1159− read_lock(&pnettable->lock);
1159+ mutex_lock(&pnettable->lock);
11601160 list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) {
11611161 if (tmp_pe->type == SMC_PNET_IB &&
11621162 !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX) &&
@@ -1166,7 +1166,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port) · 3 unmodified lines
11661166 break;
11671167 }
11681168 }
1169− read_unlock(&pnettable->lock);
1169+ mutex_unlock(&pnettable->lock);
11701170
11711171 return rc;
11721172 }
@@ -1185,7 +1185,7 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev) · 12 unmodified lines
11851185 sn = net_generic(&init_net, smc_net_id);
11861186 pnettable = &sn->pnettable;
11871187
1188− read_lock(&pnettable->lock);
1188+ mutex_lock(&pnettable->lock);
11891189 list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) {
11901190 if (tmp_pe->type == SMC_PNET_IB &&
11911191 !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX)) {
@@ -1194,7 +1194,7 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev) · 2 unmodified lines
11941194 break;
11951195 }
11961196 }
1197− read_unlock(&pnettable->lock);
1197+ mutex_unlock(&pnettable->lock);
11981198
11991199 return rc;
12001200 }
net/smc/smc_pnet.h+1−1
@@ -29,7 +29,7 @@ struct smc_link_group; · 28 unmodified lines
2929 * @pnetlist: List of PNETIDs
3030 */
3131 struct smc_pnettable {
32− rwlock_t lock;
32+ struct mutex lock;
3333 struct list_head pnetlist;
3434 };
3535
net/socket.c+2−2
@@ -3448,7 +3448,7 @@ EXPORT_SYMBOL(kernel_connect); · 3447 unmodified lines
34483448 * @addr: address holder
34493449 *
34503450 * Fills the @addr pointer with the address which the socket is bound.
3451− * Returns 0 or an error code.
3451+ * Returns the length of the address in bytes or an error code.
34523452 */
34533453
34543454 int kernel_getsockname(struct socket *sock, struct sockaddr *addr)
@@ -3463,7 +3463,7 @@ EXPORT_SYMBOL(kernel_getsockname); · 8 unmodified lines
34633463 * @addr: address holder
34643464 *
34653465 * Fills the @addr pointer with the address which the socket is connected.
3466− * Returns 0 or an error code.
3466+ * Returns the length of the address in bytes or an error code.
34673467 */
34683468
34693469 int kernel_getpeername(struct socket *sock, struct sockaddr *addr)
net/tipc/crypto.c+1−1
@@ -2276,7 +2276,7 @@ static bool tipc_crypto_key_rcv(struct tipc_crypto *rx, struct tipc_msg *hdr) · 2275 unmodified lines
22762276 struct tipc_crypto *tx = tipc_net(rx->net)->crypto_tx;
22772277 struct tipc_aead_key *skey = NULL;
22782278 u16 key_gen = msg_key_gen(hdr);
2279− u16 size = msg_data_sz(hdr);
2279+ u32 size = msg_data_sz(hdr);
22802280 u8 *data = msg_data(hdr);
22812281 unsigned int keylen;
22822282
net/tipc/name_table.c+1−1
@@ -967,7 +967,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg, · 966 unmodified lines
967967 list_for_each_entry(p, &sr->all_publ, all_publ)
968968 if (p->key == *last_key)
969969 break;
970− if (p->key != *last_key)
970+ if (list_entry_is_head(p, &sr->all_publ, all_publ))
971971 return -EPIPE;
972972 } else {
973973 p = list_first_entry(&sr->all_publ,
net/tipc/node.c+7−6
@@ -403,7 +403,7 @@ static void tipc_node_write_unlock(struct tipc_node *n) · 402 unmodified lines
403403 u32 flags = n->action_flags;
404404 struct list_head *publ_list;
405405 struct tipc_uaddr ua;
406− u32 bearer_id;
406+ u32 bearer_id, node;
407407
408408 if (likely(!flags)) {
409409 write_unlock_bh(&n->lock);
@@ -413,7 +413,8 @@ static void tipc_node_write_unlock(struct tipc_node *n) · 3 unmodified lines
413413 tipc_uaddr(&ua, TIPC_SERVICE_RANGE, TIPC_NODE_SCOPE,
414414 TIPC_LINK_STATE, n->addr, n->addr);
415415 sk.ref = n->link_id;
416− sk.node = n->addr;
416+ sk.node = tipc_own_addr(net);
417+ node = n->addr;
417418 bearer_id = n->link_id & 0xffff;
418419 publ_list = &n->publ_list;
419420
@@ -423,17 +424,17 @@ static void tipc_node_write_unlock(struct tipc_node *n) · 3 unmodified lines
423424 write_unlock_bh(&n->lock);
424425
425426 if (flags & TIPC_NOTIFY_NODE_DOWN)
426− tipc_publ_notify(net, publ_list, sk.node, n->capabilities);
427+ tipc_publ_notify(net, publ_list, node, n->capabilities);
427428
428429 if (flags & TIPC_NOTIFY_NODE_UP)
429− tipc_named_node_up(net, sk.node, n->capabilities);
430+ tipc_named_node_up(net, node, n->capabilities);
430431
431432 if (flags & TIPC_NOTIFY_LINK_UP) {
432− tipc_mon_peer_up(net, sk.node, bearer_id);
433+ tipc_mon_peer_up(net, node, bearer_id);
433434 tipc_nametbl_publish(net, &ua, &sk, sk.ref);
434435 }
435436 if (flags & TIPC_NOTIFY_LINK_DOWN) {
436− tipc_mon_peer_down(net, sk.node, bearer_id);
437+ tipc_mon_peer_down(net, node, bearer_id);
437438 tipc_nametbl_withdraw(net, &ua, &sk, sk.ref);
438439 }
439440 }
net/tipc/socket.c+1−1
@@ -3749,7 +3749,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb, · 3748 unmodified lines
37493749 if (p->key == *last_publ)
37503750 break;
37513751 }
3752− if (p->key != *last_publ) {
3752+ if (list_entry_is_head(p, &tsk->publications, binding_sock)) {
37533753 /* We never set seq or call nl_dump_check_consistent()
37543754 * this means that setting prev_seq here will cause the
37553755 * consistence check to fail in the netlink callback
net/vmw_vsock/af_vsock.c+1−0
@@ -1401,6 +1401,7 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr, · 1400 unmodified lines
14011401 sk->sk_state = sk->sk_state == TCP_ESTABLISHED ? TCP_CLOSING : TCP_CLOSE;
14021402 sock->state = SS_UNCONNECTED;
14031403 vsock_transport_cancel_pkt(vsk);
1404+ vsock_remove_connected(vsk);
14041405 goto out_wait;
14051406 } else if (timeout == 0) {
14061407 err = -ETIMEDOUT;
net/wireless/core.c+4−13
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
66 * Copyright 2013-2014 Intel Mobile Communications GmbH
77 * Copyright 2015-2017 Intel Deutschland GmbH
8− * Copyright (C) 2018-2021 Intel Corporation
8+ * Copyright (C) 2018-2022 Intel Corporation
99 */
1010
1111 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -332,29 +332,20 @@ static void cfg80211_event_work(struct work_struct *work) · 320 unmodified lines
332332 void cfg80211_destroy_ifaces(struct cfg80211_registered_device *rdev)
333333 {
334334 struct wireless_dev *wdev, *tmp;
335− bool found = false;
336335
337336 ASSERT_RTNL();
338337
339− list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
338+ list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) {
340339 if (wdev->nl_owner_dead) {
341340 if (wdev->netdev)
342341 dev_close(wdev->netdev);
343− found = true;
344− }
345− }
346−
347− if (!found)
348− return;
349342
350− wiphy_lock(&rdev->wiphy);
351− list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) {
352− if (wdev->nl_owner_dead) {
343+ wiphy_lock(&rdev->wiphy);
353344 cfg80211_leave(rdev, wdev);
354345 rdev_del_virtual_intf(rdev, wdev);
346+ wiphy_unlock(&rdev->wiphy);
355347 }
356348 }
357− wiphy_unlock(&rdev->wiphy);
358349 }
359350
360351 static void cfg80211_destroy_iface_wk(struct work_struct *work)
security/selinux/ima.c+2−2
@@ -77,7 +77,7 @@ void selinux_ima_measure_state_locked(struct selinux_state *state) · 76 unmodified lines
7777 size_t policy_len;
7878 int rc = 0;
7979
80− WARN_ON(!mutex_is_locked(&state->policy_mutex));
80+ lockdep_assert_held(&state->policy_mutex);
8181
8282 state_str = selinux_ima_collect_state(state);
8383 if (!state_str) {
@@ -117,7 +117,7 @@ void selinux_ima_measure_state_locked(struct selinux_state *state) · 33 unmodified lines
117117 */
118118 void selinux_ima_measure_state(struct selinux_state *state)
119119 {
120− WARN_ON(mutex_is_locked(&state->policy_mutex));
120+ lockdep_assert_not_held(&state->policy_mutex);
121121
122122 mutex_lock(&state->policy_mutex);
123123 selinux_ima_measure_state_locked(state);
sound/core/memalloc.c+10−5
@@ -511,7 +511,8 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size) · 510 unmodified lines
511511 DEFAULT_GFP, 0);
512512 if (!sgt)
513513 return NULL;
514− dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir);
514+ dmab->dev.need_sync = dma_need_sync(dmab->dev.dev,
515+ sg_dma_address(sgt->sgl));
515516 p = dma_vmap_noncontiguous(dmab->dev.dev, size, sgt);
516517 if (p)
517518 dmab->private_data = sgt;
@@ -540,9 +541,9 @@ static void snd_dma_noncontig_sync(struct snd_dma_buffer *dmab, · 22 unmodified lines
540541 if (mode == SNDRV_DMA_SYNC_CPU) {
541542 if (dmab->dev.dir == DMA_TO_DEVICE)
542543 return;
544+ invalidate_kernel_vmap_range(dmab->area, dmab->bytes);
543545 dma_sync_sgtable_for_cpu(dmab->dev.dev, dmab->private_data,
544546 dmab->dev.dir);
545− invalidate_kernel_vmap_range(dmab->area, dmab->bytes);
546547 } else {
547548 if (dmab->dev.dir == DMA_FROM_DEVICE)
548549 return;
@@ -671,9 +672,13 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = { · 122 unmodified lines
671672 */
672673 static void *snd_dma_noncoherent_alloc(struct snd_dma_buffer *dmab, size_t size)
673674 {
674− dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->dev.dir);
675− return dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
676− dmab->dev.dir, DEFAULT_GFP);
675+ void *p;
676+
677+ p = dma_alloc_noncoherent(dmab->dev.dev, size, &dmab->addr,
678+ dmab->dev.dir, DEFAULT_GFP);
679+ if (p)
680+ dmab->dev.need_sync = dma_need_sync(dmab->dev.dev, dmab->addr);
681+ return p;
677682 }
678683
679684 static void snd_dma_noncoherent_free(struct snd_dma_buffer *dmab)
sound/pci/hda/hda_intel.c+4−2
@@ -1615,6 +1615,7 @@ static const struct snd_pci_quirk probe_mask_list[] = { · 1614 unmodified lines
16151615 /* forced codec slots */
16161616 SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103),
16171617 SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103),
1618+ SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105),
16181619 /* WinFast VP200 H (Teradici) user reported broken communication */
16191620 SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101),
16201621 {}
@@ -1798,8 +1799,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 177 unmodified lines
17981799
17991800 assign_position_fix(chip, check_position_fix(chip, position_fix[dev]));
18001801
1801− check_probe_mask(chip, dev);
1802−
18031802 if (single_cmd < 0) /* allow fallback to single_cmd at errors */
18041803 chip->fallback_to_single_cmd = 1;
18051804 else /* explicitly set to single_cmd or not */
@@ -1825,6 +1824,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, · 19 unmodified lines
18251824 chip->bus.core.needs_damn_long_delay = 1;
18261825 }
18271826
1827+ check_probe_mask(chip, dev);
1828+
18281829 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
18291830 if (err < 0) {
18301831 dev_err(card->dev, "Error creating device [card]!\n");
@@ -1940,6 +1941,7 @@ static int azx_first_init(struct azx *chip) · 109 unmodified lines
19401941 dma_bits = 32;
19411942 if (dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(dma_bits)))
19421943 dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32));
1944+ dma_set_max_seg_size(&pci->dev, UINT_MAX);
19431945
19441946 /* read number of streams from GCAP register instead of using
19451947 * hardcoded value
sound/pci/hda/patch_realtek.c+25−15
@@ -138,6 +138,22 @@ struct alc_spec { · 137 unmodified lines
138138 * COEF access helper functions
139139 */
140140
141+static void coef_mutex_lock(struct hda_codec *codec)
142+{
143+ struct alc_spec *spec = codec->spec;
144+
145+ snd_hda_power_up_pm(codec);
146+ mutex_lock(&spec->coef_mutex);
147+}
148+
149+static void coef_mutex_unlock(struct hda_codec *codec)
150+{
151+ struct alc_spec *spec = codec->spec;
152+
153+ mutex_unlock(&spec->coef_mutex);
154+ snd_hda_power_down_pm(codec);
155+}
156+
141157 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
142158 unsigned int coef_idx)
143159 {
@@ -151,12 +167,11 @@ static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 7 unmodified lines
151167 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
152168 unsigned int coef_idx)
153169 {
154− struct alc_spec *spec = codec->spec;
155170 unsigned int val;
156171
157− mutex_lock(&spec->coef_mutex);
172+ coef_mutex_lock(codec);
158173 val = __alc_read_coefex_idx(codec, nid, coef_idx);
159− mutex_unlock(&spec->coef_mutex);
174+ coef_mutex_unlock(codec);
160175 return val;
161176 }
162177
@@ -173,11 +188,9 @@ static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 10 unmodified lines
173188 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
174189 unsigned int coef_idx, unsigned int coef_val)
175190 {
176− struct alc_spec *spec = codec->spec;
177−
178− mutex_lock(&spec->coef_mutex);
191+ coef_mutex_lock(codec);
179192 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
180− mutex_unlock(&spec->coef_mutex);
193+ coef_mutex_unlock(codec);
181194 }
182195
183196 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
@@ -198,11 +211,9 @@ static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, · 14 unmodified lines
198211 unsigned int coef_idx, unsigned int mask,
199212 unsigned int bits_set)
200213 {
201− struct alc_spec *spec = codec->spec;
202−
203− mutex_lock(&spec->coef_mutex);
214+ coef_mutex_lock(codec);
204215 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
205− mutex_unlock(&spec->coef_mutex);
216+ coef_mutex_unlock(codec);
206217 }
207218
208219 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
@@ -235,9 +246,7 @@ struct coef_fw { · 26 unmodified lines
235246 static void alc_process_coef_fw(struct hda_codec *codec,
236247 const struct coef_fw *fw)
237248 {
238− struct alc_spec *spec = codec->spec;
239−
240− mutex_lock(&spec->coef_mutex);
249+ coef_mutex_lock(codec);
241250 for (; fw->nid; fw++) {
242251 if (fw->mask == (unsigned short)-1)
243252 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
@@ -245,7 +254,7 @@ static void alc_process_coef_fw(struct hda_codec *codec, · 1 unmodified line
245254 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
246255 fw->mask, fw->val);
247256 }
248− mutex_unlock(&spec->coef_mutex);
257+ coef_mutex_unlock(codec);
249258 }
250259
251260 /*
@@ -9170,6 +9179,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 8918 unmodified lines
91709179 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
91719180 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
91729181 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9182+ SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
91739183 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
91749184 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
91759185 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
sound/soc/amd/acp/acp-mach.h+0−1
@@ -21,7 +21,6 @@ · 20 unmodified lines
2121 #include <linux/gpio/consumer.h>
2222
2323 #define EN_SPKR_GPIO_GB 0x11F
24−#define EN_SPKR_GPIO_NK 0x146
2524 #define EN_SPKR_GPIO_NONE -EINVAL
2625
2726 enum be_id {
sound/soc/amd/acp/acp-sof-mach.c+2−2
@@ -37,7 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = { · 36 unmodified lines
3737 .hs_codec_id = RT5682,
3838 .amp_codec_id = MAX98360A,
3939 .dmic_codec_id = DMIC,
40− .gpio_spkr_en = EN_SPKR_GPIO_NK,
40+ .gpio_spkr_en = EN_SPKR_GPIO_NONE,
4141 };
4242
4343 static struct acp_card_drvdata sof_rt5682s_max_data = {
@@ -47,7 +47,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { · 3 unmodified lines
4747 .hs_codec_id = RT5682S,
4848 .amp_codec_id = MAX98360A,
4949 .dmic_codec_id = DMIC,
50− .gpio_spkr_en = EN_SPKR_GPIO_NK,
50+ .gpio_spkr_en = EN_SPKR_GPIO_NONE,
5151 };
5252
5353 static const struct snd_kcontrol_new acp_controls[] = {
sound/soc/codecs/rt5668.c+7−5
@@ -1022,11 +1022,13 @@ static void rt5668_jack_detect_handler(struct work_struct *work) · 1021 unmodified lines
10221022 container_of(work, struct rt5668_priv, jack_detect_work.work);
10231023 int val, btn_type;
10241024
1025− while (!rt5668->component)
1026− usleep_range(10000, 15000);
1027−
1028− while (!rt5668->component->card->instantiated)
1029− usleep_range(10000, 15000);
1025+ if (!rt5668->component || !rt5668->component->card ||
1026+ !rt5668->component->card->instantiated) {
1027+ /* card not yet ready, try later */
1028+ mod_delayed_work(system_power_efficient_wq,
1029+ &rt5668->jack_detect_work, msecs_to_jiffies(15));
1030+ return;
1031+ }
10301032
10311033 mutex_lock(&rt5668->calibrate_mutex);
10321034
sound/soc/codecs/rt5682.c+7−5
@@ -1092,11 +1092,13 @@ void rt5682_jack_detect_handler(struct work_struct *work) · 1091 unmodified lines
10921092 struct snd_soc_dapm_context *dapm;
10931093 int val, btn_type;
10941094
1095− while (!rt5682->component)
1096− usleep_range(10000, 15000);
1097−
1098− while (!rt5682->component->card->instantiated)
1099− usleep_range(10000, 15000);
1095+ if (!rt5682->component || !rt5682->component->card ||
1096+ !rt5682->component->card->instantiated) {
1097+ /* card not yet ready, try later */
1098+ mod_delayed_work(system_power_efficient_wq,
1099+ &rt5682->jack_detect_work, msecs_to_jiffies(15));
1100+ return;
1101+ }
11001102
11011103 dapm = snd_soc_component_get_dapm(rt5682->component);
11021104
sound/soc/codecs/rt5682s.c+7−5
@@ -824,11 +824,13 @@ static void rt5682s_jack_detect_handler(struct work_struct *work) · 823 unmodified lines
824824 container_of(work, struct rt5682s_priv, jack_detect_work.work);
825825 int val, btn_type;
826826
827− while (!rt5682s->component)
828− usleep_range(10000, 15000);
829−
830− while (!rt5682s->component->card->instantiated)
831− usleep_range(10000, 15000);
827+ if (!rt5682s->component || !rt5682s->component->card ||
828+ !rt5682s->component->card->instantiated) {
829+ /* card not yet ready, try later */
830+ mod_delayed_work(system_power_efficient_wq,
831+ &rt5682s->jack_detect_work, msecs_to_jiffies(15));
832+ return;
833+ }
832834
833835 mutex_lock(&rt5682s->jdet_mutex);
834836 mutex_lock(&rt5682s->calibrate_mutex);
sound/soc/codecs/tas2770.c+6−1
@@ -38,10 +38,12 @@ static void tas2770_reset(struct tas2770_priv *tas2770) · 37 unmodified lines
3838 gpiod_set_value_cansleep(tas2770->reset_gpio, 0);
3939 msleep(20);
4040 gpiod_set_value_cansleep(tas2770->reset_gpio, 1);
41+ usleep_range(1000, 2000);
4142 }
4243
4344 snd_soc_component_write(tas2770->component, TAS2770_SW_RST,
4445 TAS2770_RST);
46+ usleep_range(1000, 2000);
4547 }
4648
4749 static int tas2770_set_bias_level(struct snd_soc_component *component,
@@ -110,6 +112,7 @@ static int tas2770_codec_resume(struct snd_soc_component *component) · 62 unmodified lines
110112
111113 if (tas2770->sdz_gpio) {
112114 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
115+ usleep_range(1000, 2000);
113116 } else {
114117 ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL,
115118 TAS2770_PWR_CTRL_MASK,
@@ -510,8 +513,10 @@ static int tas2770_codec_probe(struct snd_soc_component *component) · 394 unmodified lines
510513
511514 tas2770->component = component;
512515
513− if (tas2770->sdz_gpio)
516+ if (tas2770->sdz_gpio) {
514517 gpiod_set_value_cansleep(tas2770->sdz_gpio, 1);
518+ usleep_range(1000, 2000);
519+ }
515520
516521 tas2770_reset(tas2770);
517522
sound/soc/codecs/wm_adsp.c+2−1
@@ -1441,7 +1441,8 @@ static int wm_adsp_buffer_parse_coeff(struct cs_dsp_coeff_ctl *cs_ctl) · 1440 unmodified lines
14411441 int ret, i;
14421442
14431443 for (i = 0; i < 5; ++i) {
1444− ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1, sizeof(coeff_v1));
1444+ ret = cs_dsp_coeff_read_ctrl(cs_ctl, 0, &coeff_v1,
1445+ min(cs_ctl->len, sizeof(coeff_v1)));
14451446 if (ret < 0)
14461447 return ret;
14471448
sound/soc/intel/skylake/skl.c+1−0
@@ -952,6 +952,7 @@ static int skl_first_init(struct hdac_bus *bus) · 951 unmodified lines
952952 /* allow 64bit DMA address if supported by H/W */
953953 if (dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(64)))
954954 dma_set_mask_and_coherent(bus->dev, DMA_BIT_MASK(32));
955+ dma_set_max_seg_size(bus->dev, UINT_MAX);
955956
956957 /* initialize streams */
957958 snd_hdac_ext_stream_init_all
sound/soc/qcom/lpass-platform.c+4−4
@@ -524,7 +524,7 @@ static int lpass_platform_pcmops_trigger(struct snd_soc_component *component, · 523 unmodified lines
524524 return -EINVAL;
525525 }
526526
527− ret = regmap_update_bits(map, reg_irqclr, val_irqclr, val_irqclr);
527+ ret = regmap_write_bits(map, reg_irqclr, val_irqclr, val_irqclr);
528528 if (ret) {
529529 dev_err(soc_runtime->dev, "error writing to irqclear reg: %d\n", ret);
530530 return ret;
@@ -665,7 +665,7 @@ static irqreturn_t lpass_dma_interrupt_handler( · 134 unmodified lines
665665 return -EINVAL;
666666 }
667667 if (interrupts & LPAIF_IRQ_PER(chan)) {
668− rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val));
668+ rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_PER(chan) | val));
669669 if (rv) {
670670 dev_err(soc_runtime->dev,
671671 "error writing to irqclear reg: %d\n", rv);
@@ -676,7 +676,7 @@ static irqreturn_t lpass_dma_interrupt_handler( · 4 unmodified lines
676676 }
677677
678678 if (interrupts & LPAIF_IRQ_XRUN(chan)) {
679− rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_XRUN(chan) | val));
679+ rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_XRUN(chan) | val));
680680 if (rv) {
681681 dev_err(soc_runtime->dev,
682682 "error writing to irqclear reg: %d\n", rv);
@@ -688,7 +688,7 @@ static irqreturn_t lpass_dma_interrupt_handler( · 5 unmodified lines
688688 }
689689
690690 if (interrupts & LPAIF_IRQ_ERR(chan)) {
691− rv = regmap_update_bits(map, reg, mask, (LPAIF_IRQ_ERR(chan) | val));
691+ rv = regmap_write_bits(map, reg, mask, (LPAIF_IRQ_ERR(chan) | val));
692692 if (rv) {
693693 dev_err(soc_runtime->dev,
694694 "error writing to irqclear reg: %d\n", rv);
sound/soc/soc-ops.c+31−10
@@ -308,7 +308,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, · 307 unmodified lines
308308 unsigned int sign_bit = mc->sign_bit;
309309 unsigned int mask = (1 << fls(max)) - 1;
310310 unsigned int invert = mc->invert;
311− int err;
311+ int err, ret;
312312 bool type_2r = false;
313313 unsigned int val2 = 0;
314314 unsigned int val, val_mask;
@@ -350,12 +350,18 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, · 35 unmodified lines
350350 err = snd_soc_component_update_bits(component, reg, val_mask, val);
351351 if (err < 0)
352352 return err;
353+ ret = err;
353354
354− if (type_2r)
355+ if (type_2r) {
355356 err = snd_soc_component_update_bits(component, reg2, val_mask,
356− val2);
357+ val2);
358+ /* Don't discard any error code or drop change flag */
359+ if (ret == 0 || err < 0) {
360+ ret = err;
361+ }
362+ }
357363
358− return err;
364+ return ret;
359365 }
360366 EXPORT_SYMBOL_GPL(snd_soc_put_volsw);
361367
@@ -421,6 +427,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 59 unmodified lines
421427 int min = mc->min;
422428 unsigned int mask = (1U << (fls(min + max) - 1)) - 1;
423429 int err = 0;
430+ int ret;
424431 unsigned int val, val_mask;
425432
426433 if (ucontrol->value.integer.value[0] < 0)
@@ -437,6 +444,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 10 unmodified lines
437444 err = snd_soc_component_update_bits(component, reg, val_mask, val);
438445 if (err < 0)
439446 return err;
447+ ret = err;
440448
441449 if (snd_soc_volsw_is_stereo(mc)) {
442450 unsigned int val2;
@@ -447,6 +455,11 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 4 unmodified lines
447455
448456 err = snd_soc_component_update_bits(component, reg2, val_mask,
449457 val2);
458+
459+ /* Don't discard any error code or drop change flag */
460+ if (ret == 0 || err < 0) {
461+ ret = err;
462+ }
450463 }
451464 return err;
452465 }
@@ -506,7 +519,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 53 unmodified lines
506519 unsigned int mask = (1 << fls(max)) - 1;
507520 unsigned int invert = mc->invert;
508521 unsigned int val, val_mask;
509− int ret;
522+ int err, ret;
510523
511524 if (invert)
512525 val = (max - ucontrol->value.integer.value[0]) & mask;
@@ -515,9 +528,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 2 unmodified lines
515528 val_mask = mask << shift;
516529 val = val << shift;
517530
518− ret = snd_soc_component_update_bits(component, reg, val_mask, val);
519− if (ret < 0)
520− return ret;
531+ err = snd_soc_component_update_bits(component, reg, val_mask, val);
532+ if (err < 0)
533+ return err;
534+ ret = err;
521535
522536 if (snd_soc_volsw_is_stereo(mc)) {
523537 if (invert)
@@ -527,8 +541,12 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, · 3 unmodified lines
527541 val_mask = mask << shift;
528542 val = val << shift;
529543
530− ret = snd_soc_component_update_bits(component, rreg, val_mask,
544+ err = snd_soc_component_update_bits(component, rreg, val_mask,
531545 val);
546+ /* Don't discard any error code or drop change flag */
547+ if (ret == 0 || err < 0) {
548+ ret = err;
549+ }
532550 }
533551
534552 return ret;
@@ -877,6 +895,7 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, · 342 unmodified lines
877895 unsigned long mask = (1UL<<mc->nbits)-1;
878896 long max = mc->max;
879897 long val = ucontrol->value.integer.value[0];
898+ int ret = 0;
880899 unsigned int i;
881900
882901 if (val < mc->min || val > mc->max)
@@ -891,9 +910,11 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, · 8 unmodified lines
891910 regmask, regval);
892911 if (err < 0)
893912 return err;
913+ if (err > 0)
914+ ret = err;
894915 }
895916
896− return 0;
917+ return ret;
897918 }
898919 EXPORT_SYMBOL_GPL(snd_soc_put_xr_sx);
899920
sound/soc/sof/intel/hda.c+1−0
@@ -956,6 +956,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev) · 955 unmodified lines
956956 dev_dbg(sdev->dev, "DMA mask is 32 bit\n");
957957 dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(32));
958958 }
959+ dma_set_max_seg_size(&pci->dev, UINT_MAX);
959960
960961 /* init streams */
961962 ret = hda_dsp_stream_init(sdev);
sound/usb/implicit.c+2−2
@@ -47,13 +47,13 @@ struct snd_usb_implicit_fb_match { · 46 unmodified lines
4747 static const struct snd_usb_implicit_fb_match playback_implicit_fb_quirks[] = {
4848 /* Generic matching */
4949 IMPLICIT_FB_GENERIC_DEV(0x0499, 0x1509), /* Steinberg UR22 */
50− IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2080), /* M-Audio FastTrack Ultra */
51− IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2081), /* M-Audio FastTrack Ultra */
5250 IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2030), /* M-Audio Fast Track C400 */
5351 IMPLICIT_FB_GENERIC_DEV(0x0763, 0x2031), /* M-Audio Fast Track C600 */
5452
5553 /* Fixed EP */
5654 /* FIXME: check the availability of generic matching */
55+ IMPLICIT_FB_FIXED_DEV(0x0763, 0x2080, 0x81, 2), /* M-Audio FastTrack Ultra */
56+ IMPLICIT_FB_FIXED_DEV(0x0763, 0x2081, 0x81, 2), /* M-Audio FastTrack Ultra */
5757 IMPLICIT_FB_FIXED_DEV(0x2466, 0x8010, 0x81, 2), /* Fractal Audio Axe-Fx III */
5858 IMPLICIT_FB_FIXED_DEV(0x31e9, 0x0001, 0x81, 2), /* Solid State Logic SSL2 */
5959 IMPLICIT_FB_FIXED_DEV(0x31e9, 0x0002, 0x81, 2), /* Solid State Logic SSL2+ */
sound/usb/mixer.c+3−6
@@ -3678,17 +3678,14 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list) · 3677 unmodified lines
36783678 err = snd_usb_set_cur_mix_value(cval, c + 1, idx,
36793679 cval->cache_val[idx]);
36803680 if (err < 0)
3681− return err;
3681+ break;
36823682 }
36833683 idx++;
36843684 }
36853685 } else {
36863686 /* master */
3687− if (cval->cached) {
3688− err = snd_usb_set_cur_mix_value(cval, 0, 0, *cval->cache_val);
3689− if (err < 0)
3690− return err;
3691− }
3687+ if (cval->cached)
3688+ snd_usb_set_cur_mix_value(cval, 0, 0, *cval->cache_val);
36923689 }
36933690
36943691 return 0;
tools/arch/x86/include/asm/msr-index.h+1−0
@@ -476,6 +476,7 @@ · 475 unmodified lines
476476 #define MSR_AMD64_ICIBSEXTDCTL 0xc001103c
477477 #define MSR_AMD64_IBSOPDATA4 0xc001103d
478478 #define MSR_AMD64_IBS_REG_COUNT_MAX 8 /* includes MSR_AMD64_IBSBRTARGET */
479+#define MSR_AMD64_SVM_AVIC_DOORBELL 0xc001011b
479480 #define MSR_AMD64_VM_PAGE_FLUSH 0xc001011e
480481 #define MSR_AMD64_SEV_ES_GHCB 0xc0010130
481482 #define MSR_AMD64_SEV 0xc0010131
tools/cgroup/memcg_slabinfo.py+15−15
@@ -11,7 +11,7 @@ from drgn.helpers.linux import list_for_each_entry, list_empty · 10 unmodified lines
1111 from drgn.helpers.linux import for_each_page
1212 from drgn.helpers.linux.cpumask import for_each_online_cpu
1313 from drgn.helpers.linux.percpu import per_cpu_ptr
14−from drgn import container_of, FaultError, Object
14+from drgn import container_of, FaultError, Object, cast
1515
1616
1717 DESC = """
@@ -69,15 +69,15 @@ def oo_objects(s): · 51 unmodified lines
6969
7070
7171 def count_partial(n, fn):
72− nr_pages = 0
73− for page in list_for_each_entry('struct page', n.partial.address_of_(),
74− 'lru'):
75− nr_pages += fn(page)
76− return nr_pages
72+ nr_objs = 0
73+ for slab in list_for_each_entry('struct slab', n.partial.address_of_(),
74+ 'slab_list'):
75+ nr_objs += fn(slab)
76+ return nr_objs
7777
7878
79−def count_free(page):
80− return page.objects - page.inuse
79+def count_free(slab):
80+ return slab.objects - slab.inuse
8181
8282
8383 def slub_get_slabinfo(s, cfg):
@@ -145,14 +145,14 @@ def detect_kernel_config(): · 61 unmodified lines
145145 return cfg
146146
147147
148−def for_each_slab_page(prog):
148+def for_each_slab(prog):
149149 PGSlab = 1 << prog.constant('PG_slab')
150150 PGHead = 1 << prog.constant('PG_head')
151151
152152 for page in for_each_page(prog):
153153 try:
154154 if page.flags.value_() & PGSlab:
155− yield page
155+ yield cast('struct slab *', page)
156156 except FaultError:
157157 pass
158158
@@ -190,13 +190,13 @@ def main(): · 31 unmodified lines
190190 'list'):
191191 obj_cgroups.add(ptr.value_())
192192
193− # look over all slab pages, belonging to non-root memcgs
194− # and look for objects belonging to the given memory cgroup
195− for page in for_each_slab_page(prog):
196− objcg_vec_raw = page.memcg_data.value_()
193+ # look over all slab folios and look for objects belonging
194+ # to the given memory cgroup
195+ for slab in for_each_slab(prog):
196+ objcg_vec_raw = slab.memcg_data.value_()
197197 if objcg_vec_raw == 0:
198198 continue
199− cache = page.slab_cache
199+ cache = slab.slab_cache
200200 if not cache:
201201 continue
202202 addr = cache.value_()
tools/include/uapi/linux/kvm.h+1−0
@@ -1134,6 +1134,7 @@ struct kvm_ppc_resize_hpt { · 1133 unmodified lines
11341134 #define KVM_CAP_VM_GPA_BITS 207
11351135 #define KVM_CAP_XSAVE2 208
11361136 #define KVM_CAP_SYS_ATTRIBUTES 209
1137+#define KVM_CAP_PPC_AIL_MODE_3 210
11371138
11381139 #ifdef KVM_CAP_IRQ_ROUTING
11391140
tools/include/uapi/linux/perf_event.h+2−0
@@ -465,6 +465,8 @@ struct perf_event_attr { · 464 unmodified lines
465465 /*
466466 * User provided data if sigtrap=1, passed back to user via
467467 * siginfo_t::si_perf_data, e.g. to permit user to identify the event.
468+ * Note, siginfo_t::si_perf_data is long-sized, and sig_data will be
469+ * truncated accordingly on 32 bit architectures.
468470 */
469471 __u64 sig_data;
470472 };
tools/lib/perf/include/internal/cpumap.h+1−5
@@ -3,11 +3,7 @@ · 2 unmodified lines
33 #define __LIBPERF_INTERNAL_CPUMAP_H
44
55 #include <linux/refcount.h>
6−
7−/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */
8−struct perf_cpu {
9− int cpu;
10−};
6+#include <perf/cpumap.h>
117
128 /**
139 * A sized, reference counted, sorted array of integers representing CPU
tools/lib/perf/include/perf/cpumap.h+5−0
@@ -7,6 +7,11 @@ · 6 unmodified lines
77 #include <stdio.h>
88 #include <stdbool.h>
99
10+/** A wrapper around a CPU to avoid confusion with the perf_cpu_map's map's indices. */
11+struct perf_cpu {
12+ int cpu;
13+};
14+
1015 LIBPERF_API struct perf_cpu_map *perf_cpu_map__dummy_new(void);
1116 LIBPERF_API struct perf_cpu_map *perf_cpu_map__default_new(void);
1217 LIBPERF_API struct perf_cpu_map *perf_cpu_map__new(const char *cpu_list);
tools/lib/perf/libperf.map+1−0
@@ -2,6 +2,7 @@ LIBPERF_0.0.1 { · 1 unmodified line
22 global:
33 libperf_init;
44 perf_cpu_map__dummy_new;
5+ perf_cpu_map__default_new;
56 perf_cpu_map__get;
67 perf_cpu_map__put;
78 perf_cpu_map__new;
tools/lib/perf/tests/test-cpumap.c+11−0
@@ -14,6 +14,8 @@ static int libperf_print(enum libperf_print_level level, · 13 unmodified lines
1414 int test_cpumap(int argc, char **argv)
1515 {
1616 struct perf_cpu_map *cpus;
17+ struct perf_cpu cpu;
18+ int idx;
1719
1820 __T_START;
1921
@@ -27,6 +29,15 @@ int test_cpumap(int argc, char **argv) · 7 unmodified lines
2729 perf_cpu_map__put(cpus);
2830 perf_cpu_map__put(cpus);
2931
32+ cpus = perf_cpu_map__default_new();
33+ if (!cpus)
34+ return -1;
35+
36+ perf_cpu_map__for_each_cpu(cpu, idx, cpus)
37+ __T("wrong cpu number", cpu.cpu != -1);
38+
39+ perf_cpu_map__put(cpus);
40+
3041 __T_END;
3142 return tests_failed == 0 ? 0 : -1;
3243 }
tools/lib/perf/tests/test-evlist.c+3−2
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #define _GNU_SOURCE // needed for sched.h to get sched_[gs]etaffinity and CPU_(ZERO,SET)
3+#include <inttypes.h>
34 #include <sched.h>
45 #include <stdio.h>
56 #include <stdarg.h>
@@ -526,12 +527,12 @@ static int test_stat_multiplexing(void) · 520 unmodified lines
526527
527528 min = counts[0].val;
528529 for (i = 0; i < EVENT_NUM; i++) {
529− __T_VERBOSE("Event %2d -- Raw count = %lu, run = %lu, enable = %lu\n",
530+ __T_VERBOSE("Event %2d -- Raw count = %" PRIu64 ", run = %" PRIu64 ", enable = %" PRIu64 "\n",
530531 i, counts[i].val, counts[i].run, counts[i].ena);
531532
532533 perf_counts_values__scale(&counts[i], true, &scaled);
533534 if (scaled == 1) {
534− __T_VERBOSE("\t Scaled count = %lu (%.2lf%%, %lu/%lu)\n",
535+ __T_VERBOSE("\t Scaled count = %" PRIu64 " (%.2lf%%, %" PRIu64 "/%" PRIu64 ")\n",
535536 counts[i].val,
536537 (double)counts[i].run / (double)counts[i].ena * 100.0,
537538 counts[i].run, counts[i].ena);
tools/lib/subcmd/subcmd-util.h+2−9
@@ -50,15 +50,8 @@ static NORETURN inline void die(const char *err, ...) · 49 unmodified lines
5050 static inline void *xrealloc(void *ptr, size_t size)
5151 {
5252 void *ret = realloc(ptr, size);
53− if (!ret && !size)
54− ret = realloc(ptr, 1);
55− if (!ret) {
56− ret = realloc(ptr, size);
57− if (!ret && !size)
58− ret = realloc(ptr, 1);
59− if (!ret)
60− die("Out of memory, realloc failed");
61− }
53+ if (!ret)
54+ die("Out of memory, realloc failed");
6255 return ret;
6356 }
6457
tools/perf/builtin-script.c+1−1
@@ -463,7 +463,7 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) · 462 unmodified lines
463463 return -EINVAL;
464464
465465 if (PRINT_FIELD(WEIGHT) &&
466− evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT))
466+ evsel__do_check_stype(evsel, PERF_SAMPLE_WEIGHT_TYPE, "WEIGHT", PERF_OUTPUT_WEIGHT, allow_user_set))
467467 return -EINVAL;
468468
469469 if (PRINT_FIELD(SYM) &&
tools/perf/builtin-trace.c+18−5
@@ -1536,13 +1536,20 @@ static size_t trace__fprintf_tstamp(struct trace *trace, u64 tstamp, FILE *fp) · 1535 unmodified lines
15361536 return fprintf(fp, " ? ");
15371537 }
15381538
1539+static pid_t workload_pid = -1;
15391540 static bool done = false;
15401541 static bool interrupted = false;
15411542
1542−static void sig_handler(int sig)
1543+static void sighandler_interrupt(int sig __maybe_unused)
15431544 {
1544− done = true;
1545− interrupted = sig == SIGINT;
1545+ done = interrupted = true;
1546+}
1547+
1548+static void sighandler_chld(int sig __maybe_unused, siginfo_t *info,
1549+ void *context __maybe_unused)
1550+{
1551+ if (info->si_pid == workload_pid)
1552+ done = true;
15461553 }
15471554
15481555 static size_t trace__fprintf_comm_tid(struct trace *trace, struct thread *thread, FILE *fp)
@@ -3938,7 +3945,6 @@ static int trace__run(struct trace *trace, int argc, const char **argv) · 2389 unmodified lines
39383945 bool draining = false;
39393946
39403947 trace->live = true;
3941− signal(SIGCHLD, sig_handler);
39423948
39433949 if (!trace->raw_augmented_syscalls) {
39443950 if (trace->trace_syscalls && trace__add_syscall_newtp(trace))
@@ -4018,6 +4024,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv) · 73 unmodified lines
40184024 fprintf(trace->output, "Couldn't run the workload!\n");
40194025 goto out_delete_evlist;
40204026 }
4027+ workload_pid = evlist->workload.pid;
40214028 }
40224029
40234030 err = evlist__open(evlist);
@@ -4887,10 +4894,16 @@ int cmd_trace(int argc, const char **argv) · 863 unmodified lines
48874894 const char * const trace_subcommands[] = { "record", NULL };
48884895 int err = -1;
48894896 char bf[BUFSIZ];
4897+ struct sigaction sigchld_act;
48904898
48914899 signal(SIGSEGV, sighandler_dump_stack);
48924900 signal(SIGFPE, sighandler_dump_stack);
4893− signal(SIGINT, sig_handler);
4901+ signal(SIGINT, sighandler_interrupt);
4902+
4903+ memset(&sigchld_act, 0, sizeof(sigchld_act));
4904+ sigchld_act.sa_flags = SA_SIGINFO;
4905+ sigchld_act.sa_sigaction = sighandler_chld;
4906+ sigaction(SIGCHLD, &sigchld_act, NULL);
48944907
48954908 trace.evlist = evlist__new();
48964909 trace.sctbl = syscalltbl__new();
tools/perf/tests/attr/README+2−0
@@ -45,8 +45,10 @@ Following tests are defined (with perf commands): · 44 unmodified lines
4545 perf record -d kill (test-record-data)
4646 perf record -F 100 kill (test-record-freq)
4747 perf record -g kill (test-record-graph-default)
48+ perf record -g kill (test-record-graph-default-aarch64)
4849 perf record --call-graph dwarf kill (test-record-graph-dwarf)
4950 perf record --call-graph fp kill (test-record-graph-fp)
51+ perf record --call-graph fp kill (test-record-graph-fp-aarch64)
5052 perf record --group -e cycles,instructions kill (test-record-group)
5153 perf record -e '{cycles,instructions}' kill (test-record-group1)
5254 perf record -e '{cycles/period=1/,instructions/period=2/}:S' kill (test-record-group2)
tools/perf/tests/attr/test-record-graph-default+2−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 command = record
33 args = --no-bpf-event -g kill >/dev/null 2>&1
44 ret = 1
5+# arm64 enables registers in the default mode (fp)
6+arch = !aarch64
57
68 [event:base-record]
79 sample_type=295
tools/perf/tests/attr/test-record-graph-default-aarch64+9−0
@@ -0,0 +1,9 @@
1+[config]
2+command = record
3+args = --no-bpf-event -g kill >/dev/null 2>&1
4+ret = 1
5+arch = aarch64
6+
7+[event:base-record]
8+sample_type=4391
9+sample_regs_user=1073741824
tools/perf/tests/attr/test-record-graph-fp+2−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 command = record
33 args = --no-bpf-event --call-graph fp kill >/dev/null 2>&1
44 ret = 1
5+# arm64 enables registers in fp mode
6+arch = !aarch64
57
68 [event:base-record]
79 sample_type=295
tools/perf/tests/attr/test-record-graph-fp-aarch64+9−0
@@ -0,0 +1,9 @@
1+[config]
2+command = record
3+args = --no-bpf-event --call-graph fp kill >/dev/null 2>&1
4+ret = 1
5+arch = aarch64
6+
7+[event:base-record]
8+sample_type=4391
9+sample_regs_user=1073741824
tools/perf/tests/sigtrap.c+1−14
@@ -22,19 +22,6 @@ · 21 unmodified lines
2222 #include "tests.h"
2323 #include "../perf-sys.h"
2424
25−/*
26− * PowerPC and S390 do not support creation of instruction breakpoints using the
27− * perf_event interface.
28− *
29− * Just disable the test for these architectures until these issues are
30− * resolved.
31− */
32−#if defined(__powerpc__) || defined(__s390x__)
33−#define BP_ACCOUNT_IS_SUPPORTED 0
34−#else
35−#define BP_ACCOUNT_IS_SUPPORTED 1
36−#endif
37−
3825 #define NUM_THREADS 5
3926
4027 static struct {
@@ -135,7 +122,7 @@ static int test__sigtrap(struct test_suite *test __maybe_unused, int subtest __m · 94 unmodified lines
135122 char sbuf[STRERR_BUFSIZE];
136123 int i, fd, ret = TEST_FAIL;
137124
138− if (!BP_ACCOUNT_IS_SUPPORTED) {
125+ if (!BP_SIGNAL_IS_SUPPORTED) {
139126 pr_debug("Test not supported on this architecture");
140127 return TEST_SKIP;
141128 }
tools/perf/util/bpf-loader.c+2−1
@@ -1220,9 +1220,10 @@ bpf__obj_config_map(struct bpf_object *obj, · 1219 unmodified lines
12201220 pr_debug("ERROR: Invalid map config option '%s'\n", map_opt);
12211221 err = -BPF_LOADER_ERRNO__OBJCONF_MAP_OPT;
12221222 out:
1223− free(map_name);
12241223 if (!err)
12251224 *key_scan_pos += strlen(map_opt);
1225+
1226+ free(map_name);
12261227 return err;
12271228 }
12281229
tools/perf/util/cs-etm.c+7−9
@@ -50,8 +50,6 @@ struct cs_etm_auxtrace { · 49 unmodified lines
5050 u8 timeless_decoding;
5151 u8 snapshot_mode;
5252 u8 data_queued;
53− u8 sample_branches;
54− u8 sample_instructions;
5553
5654 int num_cpu;
5755 u64 latest_kernel_timestamp;
@@ -410,8 +408,8 @@ static void cs_etm__packet_swap(struct cs_etm_auxtrace *etm, · 352 unmodified lines
410408 {
411409 struct cs_etm_packet *tmp;
412410
413− if (etm->sample_branches || etm->synth_opts.last_branch ||
414− etm->sample_instructions) {
411+ if (etm->synth_opts.branches || etm->synth_opts.last_branch ||
412+ etm->synth_opts.instructions) {
415413 /*
416414 * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for
417415 * the next incoming packet.
@@ -1365,7 +1363,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · 947 unmodified lines
13651363 err = cs_etm__synth_event(session, &attr, id);
13661364 if (err)
13671365 return err;
1368− etm->sample_branches = true;
13691366 etm->branches_sample_type = attr.sample_type;
13701367 etm->branches_id = id;
13711368 id += 1;
@@ -1389,7 +1386,6 @@ static int cs_etm__synth_events(struct cs_etm_auxtrace *etm, · 17 unmodified lines
13891386 err = cs_etm__synth_event(session, &attr, id);
13901387 if (err)
13911388 return err;
1392− etm->sample_instructions = true;
13931389 etm->instructions_sample_type = attr.sample_type;
13941390 etm->instructions_id = id;
13951391 id += 1;
@@ -1420,7 +1416,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, · 24 unmodified lines
14201416 tidq->prev_packet->last_instr_taken_branch)
14211417 cs_etm__update_last_branch_rb(etmq, tidq);
14221418
1423− if (etm->sample_instructions &&
1419+ if (etm->synth_opts.instructions &&
14241420 tidq->period_instructions >= etm->instructions_sample_period) {
14251421 /*
14261422 * Emit instruction sample periodically
@@ -1503,7 +1499,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq, · 76 unmodified lines
15031499 }
15041500 }
15051501
1506− if (etm->sample_branches) {
1502+ if (etm->synth_opts.branches) {
15071503 bool generate_sample = false;
15081504
15091505 /* Generate sample for tracing on packet */
@@ -1557,6 +1553,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, · 47 unmodified lines
15571553 goto swap_packet;
15581554
15591555 if (etmq->etm->synth_opts.last_branch &&
1556+ etmq->etm->synth_opts.instructions &&
15601557 tidq->prev_packet->sample_type == CS_ETM_RANGE) {
15611558 u64 addr;
15621559
@@ -1582,7 +1579,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq, · 19 unmodified lines
15821579
15831580 }
15841581
1585− if (etm->sample_branches &&
1582+ if (etm->synth_opts.branches &&
15861583 tidq->prev_packet->sample_type == CS_ETM_RANGE) {
15871584 err = cs_etm__synth_branch_sample(etmq, tidq);
15881585 if (err)
@@ -1614,6 +1611,7 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq, · 25 unmodified lines
16141611 * the trace.
16151612 */
16161613 if (etmq->etm->synth_opts.last_branch &&
1614+ etmq->etm->synth_opts.instructions &&
16171615 tidq->prev_packet->sample_type == CS_ETM_RANGE) {
16181616 u64 addr;
16191617
tools/perf/util/data.c+3−4
@@ -44,10 +44,6 @@ int perf_data__create_dir(struct perf_data *data, int nr) · 43 unmodified lines
4444 if (!files)
4545 return -ENOMEM;
4646
47− data->dir.version = PERF_DIR_VERSION;
48− data->dir.files = files;
49− data->dir.nr = nr;
50−
5147 for (i = 0; i < nr; i++) {
5248 struct perf_data_file *file = &files[i];
5349
@@ -62,6 +58,9 @@ int perf_data__create_dir(struct perf_data *data, int nr) · 8 unmodified lines
6258 file->fd = ret;
6359 }
6460
61+ data->dir.version = PERF_DIR_VERSION;
62+ data->dir.files = files;
63+ data->dir.nr = nr;
6564 return 0;
6665
6766 out_err:
tools/perf/util/evlist-hybrid.c+2−2
@@ -154,8 +154,8 @@ int evlist__fix_hybrid_cpus(struct evlist *evlist, const char *cpu_list) · 153 unmodified lines
154154 perf_cpu_map__put(matched_cpus);
155155 perf_cpu_map__put(unmatched_cpus);
156156 }
157−
158− ret = (unmatched_count == events_nr) ? -1 : 0;
157+ if (events_nr)
158+ ret = (unmatched_count == events_nr) ? -1 : 0;
159159 out:
160160 perf_cpu_map__put(cpus);
161161 return ret;
tools/testing/selftests/bpf/prog_tests/timer_crash.c+32−0
@@ -0,0 +1,32 @@
1+// SPDX-License-Identifier: GPL-2.0
2+#include <test_progs.h>
3+#include "timer_crash.skel.h"
4+
5+enum {
6+ MODE_ARRAY,
7+ MODE_HASH,
8+};
9+
10+static void test_timer_crash_mode(int mode)
11+{
12+ struct timer_crash *skel;
13+
14+ skel = timer_crash__open_and_load();
15+ if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load"))
16+ return;
17+ skel->bss->pid = getpid();
18+ skel->bss->crash_map = mode;
19+ if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach"))
20+ goto end;
21+ usleep(1);
22+end:
23+ timer_crash__destroy(skel);
24+}
25+
26+void test_timer_crash(void)
27+{
28+ if (test__start_subtest("array"))
29+ test_timer_crash_mode(MODE_ARRAY);
30+ if (test__start_subtest("hash"))
31+ test_timer_crash_mode(MODE_HASH);
32+}
tools/testing/selftests/bpf/progs/test_sockmap_kern.h+18−8
@@ -235,7 +235,7 @@ SEC("sk_msg1") · 234 unmodified lines
235235 int bpf_prog4(struct sk_msg_md *msg)
236236 {
237237 int *bytes, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5;
238− int *start, *end, *start_push, *end_push, *start_pop, *pop;
238+ int *start, *end, *start_push, *end_push, *start_pop, *pop, err = 0;
239239
240240 bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero);
241241 if (bytes)
@@ -249,8 +249,11 @@ int bpf_prog4(struct sk_msg_md *msg) · 7 unmodified lines
249249 bpf_msg_pull_data(msg, *start, *end, 0);
250250 start_push = bpf_map_lookup_elem(&sock_bytes, &two);
251251 end_push = bpf_map_lookup_elem(&sock_bytes, &three);
252− if (start_push && end_push)
253− bpf_msg_push_data(msg, *start_push, *end_push, 0);
252+ if (start_push && end_push) {
253+ err = bpf_msg_push_data(msg, *start_push, *end_push, 0);
254+ if (err)
255+ return SK_DROP;
256+ }
254257 start_pop = bpf_map_lookup_elem(&sock_bytes, &four);
255258 pop = bpf_map_lookup_elem(&sock_bytes, &five);
256259 if (start_pop && pop)
@@ -263,6 +266,7 @@ int bpf_prog6(struct sk_msg_md *msg) · 6 unmodified lines
263266 {
264267 int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, key = 0;
265268 int *bytes, *start, *end, *start_push, *end_push, *start_pop, *pop, *f;
269+ int err = 0;
266270 __u64 flags = 0;
267271
268272 bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero);
@@ -279,8 +283,11 @@ int bpf_prog6(struct sk_msg_md *msg) · 10 unmodified lines
279283
280284 start_push = bpf_map_lookup_elem(&sock_bytes, &two);
281285 end_push = bpf_map_lookup_elem(&sock_bytes, &three);
282− if (start_push && end_push)
283− bpf_msg_push_data(msg, *start_push, *end_push, 0);
286+ if (start_push && end_push) {
287+ err = bpf_msg_push_data(msg, *start_push, *end_push, 0);
288+ if (err)
289+ return SK_DROP;
290+ }
284291
285292 start_pop = bpf_map_lookup_elem(&sock_bytes, &four);
286293 pop = bpf_map_lookup_elem(&sock_bytes, &five);
@@ -338,7 +345,7 @@ SEC("sk_msg5") · 51 unmodified lines
338345 int bpf_prog10(struct sk_msg_md *msg)
339346 {
340347 int *bytes, *start, *end, *start_push, *end_push, *start_pop, *pop;
341− int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5;
348+ int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, err = 0;
342349
343350 bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero);
344351 if (bytes)
@@ -352,8 +359,11 @@ int bpf_prog10(struct sk_msg_md *msg) · 7 unmodified lines
352359 bpf_msg_pull_data(msg, *start, *end, 0);
353360 start_push = bpf_map_lookup_elem(&sock_bytes, &two);
354361 end_push = bpf_map_lookup_elem(&sock_bytes, &three);
355− if (start_push && end_push)
356− bpf_msg_push_data(msg, *start_push, *end_push, 0);
362+ if (start_push && end_push) {
363+ err = bpf_msg_push_data(msg, *start_push, *end_push, 0);
364+ if (err)
365+ return SK_PASS;
366+ }
357367 start_pop = bpf_map_lookup_elem(&sock_bytes, &four);
358368 pop = bpf_map_lookup_elem(&sock_bytes, &five);
359369 if (start_pop && pop)
tools/testing/selftests/bpf/progs/timer_crash.c+54−0
@@ -0,0 +1,54 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#include <vmlinux.h>
4+#include <bpf/bpf_tracing.h>
5+#include <bpf/bpf_helpers.h>
6+
7+struct map_elem {
8+ struct bpf_timer timer;
9+ struct bpf_spin_lock lock;
10+};
11+
12+struct {
13+ __uint(type, BPF_MAP_TYPE_ARRAY);
14+ __uint(max_entries, 1);
15+ __type(key, int);
16+ __type(value, struct map_elem);
17+} amap SEC(".maps");
18+
19+struct {
20+ __uint(type, BPF_MAP_TYPE_HASH);
21+ __uint(max_entries, 1);
22+ __type(key, int);
23+ __type(value, struct map_elem);
24+} hmap SEC(".maps");
25+
26+int pid = 0;
27+int crash_map = 0; /* 0 for amap, 1 for hmap */
28+
29+SEC("fentry/do_nanosleep")
30+int sys_enter(void *ctx)
31+{
32+ struct map_elem *e, value = {};
33+ void *map = crash_map ? (void *)&hmap : (void *)&amap;
34+
35+ if (bpf_get_current_task_btf()->tgid != pid)
36+ return 0;
37+
38+ *(void **)&value = (void *)0xdeadcaf3;
39+
40+ bpf_map_update_elem(map, &(int){0}, &value, 0);
41+ /* For array map, doing bpf_map_update_elem will do a
42+ * check_and_free_timer_in_array, which will trigger the crash if timer
43+ * pointer was overwritten, for hmap we need to use bpf_timer_cancel.
44+ */
45+ if (crash_map == 1) {
46+ e = bpf_map_lookup_elem(map, &(int){0});
47+ if (!e)
48+ return 0;
49+ bpf_timer_cancel(&e->timer);
50+ }
51+ return 0;
52+}
53+
54+char _license[] SEC("license") = "GPL";
tools/testing/selftests/exec/Makefile+2−2
@@ -3,8 +3,8 @@ CFLAGS = -Wall · 2 unmodified lines
33 CFLAGS += -Wno-nonnull
44 CFLAGS += -D_GNU_SOURCE
55
6−TEST_PROGS := binfmt_script non-regular
7−TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
6+TEST_PROGS := binfmt_script
7+TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
88 TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
99 # Makefile is a run-time dependency, since it's accessed by the execveat test
1010 TEST_FILES := Makefile
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc+1−1
@@ -19,7 +19,7 @@ fail() { # mesg · 18 unmodified lines
1919
2020 FILTER=set_ftrace_filter
2121 FUNC1="schedule"
22−FUNC2="do_softirq"
22+FUNC2="scheduler_tick"
2323
2424 ALL_FUNCS="#### all functions enabled ####"
2525
tools/testing/selftests/kvm/Makefile+0−1
@@ -82,7 +82,6 @@ TEST_GEN_PROGS_x86_64 += x86_64/tsc_msrs_test · 81 unmodified lines
8282 TEST_GEN_PROGS_x86_64 += x86_64/vmx_pmu_msrs_test
8383 TEST_GEN_PROGS_x86_64 += x86_64/xen_shinfo_test
8484 TEST_GEN_PROGS_x86_64 += x86_64/xen_vmcall_test
85−TEST_GEN_PROGS_x86_64 += x86_64/vmx_pi_mmio_test
8685 TEST_GEN_PROGS_x86_64 += x86_64/sev_migrate_tests
8786 TEST_GEN_PROGS_x86_64 += x86_64/amx_test
8887 TEST_GEN_PROGS_x86_64 += access_tracking_perf_test
tools/testing/selftests/memfd/memfd_test.c+1−0
@@ -455,6 +455,7 @@ static void mfd_fail_write(int fd) · 454 unmodified lines
455455 printf("mmap()+mprotect() didn't fail as expected\n");
456456 abort();
457457 }
458+ munmap(p, mfd_def_size);
458459 }
459460
460461 /* verify PUNCH_HOLE fails */
tools/testing/selftests/mount_setattr/mount_setattr_test.c+2−2
@@ -1236,7 +1236,7 @@ static int get_userns_fd(unsigned long nsid, unsigned long hostid, unsigned long · 1235 unmodified lines
12361236 }
12371237
12381238 /**
1239− * Validate that an attached mount in our mount namespace can be idmapped.
1239+ * Validate that an attached mount in our mount namespace cannot be idmapped.
12401240 * (The kernel enforces that the mount's mount namespace and the caller's mount
12411241 * namespace match.)
12421242 */
@@ -1259,7 +1259,7 @@ TEST_F(mount_setattr_idmapped, attached_mount_inside_current_mount_namespace) · 16 unmodified lines
12591259
12601260 attr.userns_fd = get_userns_fd(0, 10000, 10000);
12611261 ASSERT_GE(attr.userns_fd, 0);
1262− ASSERT_EQ(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
1262+ ASSERT_NE(sys_mount_setattr(open_tree_fd, "", AT_EMPTY_PATH, &attr, sizeof(attr)), 0);
12631263 ASSERT_EQ(close(attr.userns_fd), 0);
12641264 ASSERT_EQ(close(open_tree_fd), 0);
12651265 }
tools/testing/selftests/net/mptcp/diag.sh+37−7
@@ -71,6 +71,36 @@ chk_msk_remote_key_nr() · 70 unmodified lines
7171 __chk_nr "grep -c remote_key" $*
7272 }
7373
74+# $1: ns, $2: port
75+wait_local_port_listen()
76+{
77+ local listener_ns="${1}"
78+ local port="${2}"
79+
80+ local port_hex i
81+
82+ port_hex="$(printf "%04X" "${port}")"
83+ for i in $(seq 10); do
84+ ip netns exec "${listener_ns}" cat /proc/net/tcp | \
85+ awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" &&
86+ break
87+ sleep 0.1
88+ done
89+}
90+
91+wait_connected()
92+{
93+ local listener_ns="${1}"
94+ local port="${2}"
95+
96+ local port_hex i
97+
98+ port_hex="$(printf "%04X" "${port}")"
99+ for i in $(seq 10); do
100+ ip netns exec ${listener_ns} grep -q " 0100007F:${port_hex} " /proc/net/tcp && break
101+ sleep 0.1
102+ done
103+}
74104
75105 trap cleanup EXIT
76106 ip netns add $ns
@@ -81,15 +111,15 @@ echo "a" | \ · 4 unmodified lines
81111 ip netns exec $ns \
82112 ./mptcp_connect -p 10000 -l -t ${timeout_poll} \
83113 0.0.0.0 >/dev/null &
84−sleep 0.1
114+wait_local_port_listen $ns 10000
85115 chk_msk_nr 0 "no msk on netns creation"
86116
87117 echo "b" | \
88118 timeout ${timeout_test} \
89119 ip netns exec $ns \
90− ./mptcp_connect -p 10000 -j -t ${timeout_poll} \
120+ ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} \
91121 127.0.0.1 >/dev/null &
92−sleep 0.1
122+wait_connected $ns 10000
93123 chk_msk_nr 2 "after MPC handshake "
94124 chk_msk_remote_key_nr 2 "....chk remote_key"
95125 chk_msk_fallback_nr 0 "....chk no fallback"
@@ -101,13 +131,13 @@ echo "a" | \ · 5 unmodified lines
101131 ip netns exec $ns \
102132 ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \
103133 0.0.0.0 >/dev/null &
104−sleep 0.1
134+wait_local_port_listen $ns 10001
105135 echo "b" | \
106136 timeout ${timeout_test} \
107137 ip netns exec $ns \
108− ./mptcp_connect -p 10001 -j -t ${timeout_poll} \
138+ ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} \
109139 127.0.0.1 >/dev/null &
110−sleep 0.1
140+wait_connected $ns 10001
111141 chk_msk_fallback_nr 1 "check fallback"
112142 flush_pids
113143
@@ -119,7 +149,7 @@ for I in `seq 1 $NR_CLIENTS`; do · 5 unmodified lines
119149 ./mptcp_connect -p $((I+10001)) -l -w 10 \
120150 -t ${timeout_poll} 0.0.0.0 >/dev/null &
121151 done
122−sleep 0.1
152+wait_local_port_listen $ns $((NR_CLIENTS + 10001))
123153
124154 for I in `seq 1 $NR_CLIENTS`; do
125155 echo "b" | \
tools/testing/selftests/net/mptcp/mptcp_join.sh+25−7
@@ -660,6 +660,7 @@ chk_join_nr() · 659 unmodified lines
660660 local ack_nr=$4
661661 local count
662662 local dump_stats
663+ local with_cookie
663664
664665 printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn"
665666 count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'`
@@ -673,12 +674,20 @@ chk_join_nr() · 7 unmodified lines
673674 fi
674675
675676 echo -n " - synack"
677+ with_cookie=`ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies`
676678 count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | awk '{print $2}'`
677679 [ -z "$count" ] && count=0
678680 if [ "$count" != "$syn_ack_nr" ]; then
679− echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr"
680− ret=1
681− dump_stats=1
681+ # simult connections exceeding the limit with cookie enabled could go up to
682+ # synack validation as the conn limit can be enforced reliably only after
683+ # the subflow creation
684+ if [ "$with_cookie" = 2 ] && [ "$count" -gt "$syn_ack_nr" ] && [ "$count" -le "$syn_nr" ]; then
685+ echo -n "[ ok ]"
686+ else
687+ echo "[fail] got $count JOIN[s] synack expected $syn_ack_nr"
688+ ret=1
689+ dump_stats=1
690+ fi
682691 else
683692 echo -n "[ ok ]"
684693 fi
@@ -752,11 +761,17 @@ chk_add_nr() · 67 unmodified lines
752761 local mis_ack_nr=${8:-0}
753762 local count
754763 local dump_stats
764+ local timeout
765+
766+ timeout=`ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout`
755767
756768 printf "%-39s %s" " " "add"
757− count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'`
769+ count=`ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAddAddr | awk '{print $2}'`
758770 [ -z "$count" ] && count=0
759− if [ "$count" != "$add_nr" ]; then
771+
772+ # if the test configured a short timeout tolerate greater then expected
773+ # add addrs options, due to retransmissions
774+ if [ "$count" != "$add_nr" ] && [ "$timeout" -gt 1 -o "$count" -lt "$add_nr" ]; then
760775 echo "[fail] got $count ADD_ADDR[s] expected $add_nr"
761776 ret=1
762777 dump_stats=1
@@ -961,7 +976,7 @@ wait_for_tw() · 198 unmodified lines
961976 local ns=$1
962977
963978 while [ $time -lt $timeout_ms ]; do
964− local cnt=$(ip netns exec $ns ss -t state time-wait |wc -l)
979+ local cnt=$(ip netns exec $ns nstat -as TcpAttemptFails | grep TcpAttemptFails | awk '{print $2}')
965980
966981 [ "$cnt" = 1 ] && return 1
967982 time=$((time + 100))
@@ -1158,7 +1173,10 @@ signal_address_tests() · 190 unmodified lines
11581173 ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags signal
11591174 ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags signal
11601175 ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags signal
1161− run_tests $ns1 $ns2 10.0.1.1
1176+
1177+ # the peer could possibly miss some addr notification, allow retransmission
1178+ ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
1179+ run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
11621180 chk_join_nr "signal addresses race test" 3 3 3
11631181
11641182 # the server will not signal the address terminating
tools/testing/selftests/netfilter/Makefile+1−1
@@ -6,7 +6,7 @@ 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
9+ conntrack_vrf.sh nft_synproxy.sh
1010
1111 LDLIBS = -lmnl
1212 TEST_GEN_FILES = nf-queue
tools/testing/selftests/netfilter/nft_concat_range.sh+1−1
@@ -1601,4 +1601,4 @@ for name in ${TESTS}; do · 1600 unmodified lines
16011601 done
16021602 done
16031603
1604−[ ${passed} -eq 0 ] && exit ${KSELFTEST_SKIP}
1604+[ ${passed} -eq 0 ] && exit ${KSELFTEST_SKIP} || exit 0
tools/testing/selftests/netfilter/nft_fib.sh+1−0
@@ -174,6 +174,7 @@ test_ping() { · 173 unmodified lines
174174 ip netns exec ${nsrouter} sysctl net.ipv6.conf.all.forwarding=1 > /dev/null
175175 ip netns exec ${nsrouter} sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null
176176 ip netns exec ${nsrouter} sysctl net.ipv4.conf.veth1.forwarding=1 > /dev/null
177+ip netns exec ${nsrouter} sysctl net.ipv4.conf.veth0.rp_filter=0 > /dev/null
177178
178179 sleep 3
179180
tools/testing/selftests/netfilter/nft_synproxy.sh+117−0
@@ -0,0 +1,117 @@
1+#!/bin/bash
2+# SPDX-License-Identifier: GPL-2.0
3+#
4+
5+# Kselftest framework requirement - SKIP code is 4.
6+ksft_skip=4
7+ret=0
8+
9+rnd=$(mktemp -u XXXXXXXX)
10+nsr="nsr-$rnd" # synproxy machine
11+ns1="ns1-$rnd" # iperf client
12+ns2="ns2-$rnd" # iperf server
13+
14+checktool (){
15+ if ! $1 > /dev/null 2>&1; then
16+ echo "SKIP: Could not $2"
17+ exit $ksft_skip
18+ fi
19+}
20+
21+checktool "nft --version" "run test without nft tool"
22+checktool "ip -Version" "run test without ip tool"
23+checktool "iperf3 --version" "run test without iperf3"
24+checktool "ip netns add $nsr" "create net namespace"
25+
26+modprobe -q nf_conntrack
27+
28+ip netns add $ns1
29+ip netns add $ns2
30+
31+cleanup() {
32+ ip netns pids $ns1 | xargs kill 2>/dev/null
33+ ip netns pids $ns2 | xargs kill 2>/dev/null
34+ ip netns del $ns1
35+ ip netns del $ns2
36+
37+ ip netns del $nsr
38+}
39+
40+trap cleanup EXIT
41+
42+ip link add veth0 netns $nsr type veth peer name eth0 netns $ns1
43+ip link add veth1 netns $nsr type veth peer name eth0 netns $ns2
44+
45+for dev in lo veth0 veth1; do
46+ip -net $nsr link set $dev up
47+done
48+
49+ip -net $nsr addr add 10.0.1.1/24 dev veth0
50+ip -net $nsr addr add 10.0.2.1/24 dev veth1
51+
52+ip netns exec $nsr sysctl -q net.ipv4.conf.veth0.forwarding=1
53+ip netns exec $nsr sysctl -q net.ipv4.conf.veth1.forwarding=1
54+ip netns exec $nsr sysctl -q net.netfilter.nf_conntrack_tcp_loose=0
55+
56+for n in $ns1 $ns2; do
57+ ip -net $n link set lo up
58+ ip -net $n link set eth0 up
59+done
60+ip -net $ns1 addr add 10.0.1.99/24 dev eth0
61+ip -net $ns2 addr add 10.0.2.99/24 dev eth0
62+ip -net $ns1 route add default via 10.0.1.1
63+ip -net $ns2 route add default via 10.0.2.1
64+
65+# test basic connectivity
66+if ! ip netns exec $ns1 ping -c 1 -q 10.0.2.99 > /dev/null; then
67+ echo "ERROR: $ns1 cannot reach $ns2" 1>&2
68+ exit 1
69+fi
70+
71+if ! ip netns exec $ns2 ping -c 1 -q 10.0.1.99 > /dev/null; then
72+ echo "ERROR: $ns2 cannot reach $ns1" 1>&2
73+ exit 1
74+fi
75+
76+ip netns exec $ns2 iperf3 -s > /dev/null 2>&1 &
77+# ip netns exec $nsr tcpdump -vvv -n -i veth1 tcp | head -n 10 &
78+
79+sleep 1
80+
81+ip netns exec $nsr nft -f - <<EOF
82+table inet filter {
83+ chain prerouting {
84+ type filter hook prerouting priority -300; policy accept;
85+ meta iif veth0 tcp flags syn counter notrack
86+ }
87+
88+ chain forward {
89+ type filter hook forward priority 0; policy accept;
90+
91+ ct state new,established counter accept
92+
93+ meta iif veth0 meta l4proto tcp ct state untracked,invalid synproxy mss 1460 sack-perm timestamp
94+
95+ ct state invalid counter drop
96+
97+ # make ns2 unreachable w.o. tcp synproxy
98+ tcp flags syn counter drop
99+ }
100+}
101+EOF
102+if [ $? -ne 0 ]; then
103+ echo "SKIP: Cannot add nft synproxy"
104+ exit $ksft_skip
105+fi
106+
107+ip netns exec $ns1 timeout 5 iperf3 -c 10.0.2.99 -n $((1 * 1024 * 1024)) > /dev/null
108+
109+if [ $? -ne 0 ]; then
110+ echo "FAIL: iperf3 returned an error" 1>&2
111+ ret=$?
112+ ip netns exec $nsr nft list ruleset
113+else
114+ echo "PASS: synproxy connection successful"
115+fi
116+
117+exit $ret
tools/testing/selftests/seccomp/Makefile+1−1
@@ -1,5 +1,5 @@
11 # SPDX-License-Identifier: GPL-2.0
2−CFLAGS += -Wl,-no-as-needed -Wall
2+CFLAGS += -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/
33 LDFLAGS += -lpthread
44
55 TEST_GEN_PROGS := seccomp_bpf seccomp_benchmark
tools/testing/selftests/vm/map_fixed_noreplace.c+37−12
@@ -17,9 +17,6 @@ · 16 unmodified lines
1717 #define MAP_FIXED_NOREPLACE 0x100000
1818 #endif
1919
20−#define BASE_ADDRESS (256ul * 1024 * 1024)
21−
22−
2320 static void dump_maps(void)
2421 {
2522 char cmd[32];
@@ -28,18 +25,46 @@ static void dump_maps(void) · 2 unmodified lines
2825 system(cmd);
2926 }
3027
28+static unsigned long find_base_addr(unsigned long size)
29+{
30+ void *addr;
31+ unsigned long flags;
32+
33+ flags = MAP_PRIVATE | MAP_ANONYMOUS;
34+ addr = mmap(NULL, size, PROT_NONE, flags, -1, 0);
35+ if (addr == MAP_FAILED) {
36+ printf("Error: couldn't map the space we need for the test\n");
37+ return 0;
38+ }
39+
40+ if (munmap(addr, size) != 0) {
41+ printf("Error: couldn't map the space we need for the test\n");
42+ return 0;
43+ }
44+ return (unsigned long)addr;
45+}
46+
3147 int main(void)
3248 {
49+ unsigned long base_addr;
3350 unsigned long flags, addr, size, page_size;
3451 char *p;
3552
3653 page_size = sysconf(_SC_PAGE_SIZE);
3754
55+ //let's find a base addr that is free before we start the tests
56+ size = 5 * page_size;
57+ base_addr = find_base_addr(size);
58+ if (!base_addr) {
59+ printf("Error: couldn't map the space we need for the test\n");
60+ return 1;
61+ }
62+
3863 flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE;
3964
4065 // Check we can map all the areas we need below
4166 errno = 0;
42− addr = BASE_ADDRESS;
67+ addr = base_addr;
4368 size = 5 * page_size;
4469 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
4570
@@ -60,7 +85,7 @@ int main(void) · 14 unmodified lines
6085 printf("unmap() successful\n");
6186
6287 errno = 0;
63− addr = BASE_ADDRESS + page_size;
88+ addr = base_addr + page_size;
6489 size = 3 * page_size;
6590 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
6691 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -80,7 +105,7 @@ int main(void) · 13 unmodified lines
80105 * +4 | free | new
81106 */
82107 errno = 0;
83− addr = BASE_ADDRESS;
108+ addr = base_addr;
84109 size = 5 * page_size;
85110 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
86111 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -101,7 +126,7 @@ int main(void) · 14 unmodified lines
101126 * +4 | free |
102127 */
103128 errno = 0;
104− addr = BASE_ADDRESS + (2 * page_size);
129+ addr = base_addr + (2 * page_size);
105130 size = page_size;
106131 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
107132 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -121,7 +146,7 @@ int main(void) · 13 unmodified lines
121146 * +4 | free | new
122147 */
123148 errno = 0;
124− addr = BASE_ADDRESS + (3 * page_size);
149+ addr = base_addr + (3 * page_size);
125150 size = 2 * page_size;
126151 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
127152 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -141,7 +166,7 @@ int main(void) · 13 unmodified lines
141166 * +4 | free |
142167 */
143168 errno = 0;
144− addr = BASE_ADDRESS;
169+ addr = base_addr;
145170 size = 2 * page_size;
146171 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
147172 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -161,7 +186,7 @@ int main(void) · 13 unmodified lines
161186 * +4 | free |
162187 */
163188 errno = 0;
164− addr = BASE_ADDRESS;
189+ addr = base_addr;
165190 size = page_size;
166191 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
167192 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -181,7 +206,7 @@ int main(void) · 13 unmodified lines
181206 * +4 | free | new
182207 */
183208 errno = 0;
184− addr = BASE_ADDRESS + (4 * page_size);
209+ addr = base_addr + (4 * page_size);
185210 size = page_size;
186211 p = mmap((void *)addr, size, PROT_NONE, flags, -1, 0);
187212 printf("mmap() @ 0x%lx-0x%lx p=%p result=%m\n", addr, addr + size, p);
@@ -192,7 +217,7 @@ int main(void) · 4 unmodified lines
192217 return 1;
193218 }
194219
195− addr = BASE_ADDRESS;
220+ addr = base_addr;
196221 size = 5 * page_size;
197222 if (munmap((void *)addr, size) != 0) {
198223 dump_maps();
tools/tracing/rtla/src/osnoise.c+1−1
@@ -810,7 +810,7 @@ struct osnoise_tool *osnoise_init_trace_tool(char *tracer) · 809 unmodified lines
810810
811811 retval = enable_tracer_by_name(trace->trace.inst, tracer);
812812 if (retval) {
813− err_msg("Could not enable osnoiser tracer for tracing\n");
813+ err_msg("Could not enable %s tracer for tracing\n", tracer);
814814 goto out_err;
815815 }
816816
tools/tracing/rtla/src/osnoise_hist.c+5−5
@@ -426,7 +426,7 @@ static void osnoise_hist_usage(char *usage) · 425 unmodified lines
426426 static const char * const msg[] = {
427427 "",
428428 " usage: rtla osnoise hist [-h] [-D] [-d s] [-p us] [-r us] [-s us] [-S us] [-t[=file]] \\",
429− " [-c cpu-list] [-P priority] [-b N] [-e N] [--no-header] [--no-summary] \\",
429+ " [-c cpu-list] [-P priority] [-b N] [-E N] [--no-header] [--no-summary] \\",
430430 " [--no-index] [--with-zeros]",
431431 "",
432432 " -h/--help: print this menu",
@@ -439,7 +439,7 @@ static void osnoise_hist_usage(char *usage) · 6 unmodified lines
439439 " -D/--debug: print debug info",
440440 " -t/--trace[=file]: save the stopped trace to [file|osnoise_trace.txt]",
441441 " -b/--bucket-size N: set the histogram bucket size (default 1)",
442− " -e/--entries N: set the number of entries of the histogram (default 256)",
442+ " -E/--entries N: set the number of entries of the histogram (default 256)",
443443 " --no-header: do not print header",
444444 " --no-summary: do not print summary",
445445 " --no-index: do not print index",
@@ -486,7 +486,7 @@ static struct osnoise_hist_params · 40 unmodified lines
486486 while (1) {
487487 static struct option long_options[] = {
488488 {"bucket-size", required_argument, 0, 'b'},
489− {"entries", required_argument, 0, 'e'},
489+ {"entries", required_argument, 0, 'E'},
490490 {"cpus", required_argument, 0, 'c'},
491491 {"debug", no_argument, 0, 'D'},
492492 {"duration", required_argument, 0, 'd'},
@@ -507,7 +507,7 @@ static struct osnoise_hist_params · 14 unmodified lines
507507 /* getopt_long stores the option index here. */
508508 int option_index = 0;
509509
510− c = getopt_long(argc, argv, "c:b:d:e:Dhp:P:r:s:S:t::0123",
510+ c = getopt_long(argc, argv, "c:b:d:E:Dhp:P:r:s:S:t::0123",
511511 long_options, &option_index);
512512
513513 /* detect the end of the options. */
@@ -534,7 +534,7 @@ static struct osnoise_hist_params · 20 unmodified lines
534534 if (!params->duration)
535535 osnoise_hist_usage("Invalid -D duration\n");
536536 break;
537− case 'e':
537+ case 'E':
538538 params->entries = get_llong_from_str(optarg);
539539 if ((params->entries < 10) || (params->entries > 9999999))
540540 osnoise_hist_usage("Entries must be > 10 and < 9999999\n");
tools/tracing/rtla/src/osnoise_top.c+1−0
@@ -573,6 +573,7 @@ out_top: · 572 unmodified lines
573573 osnoise_free_top(tool->data);
574574 osnoise_destroy_tool(record);
575575 osnoise_destroy_tool(tool);
576+ free(params);
576577 out_exit:
577578 exit(return_value);
578579 }
tools/tracing/rtla/src/timerlat_hist.c+5−5
@@ -429,7 +429,7 @@ static void timerlat_hist_usage(char *usage) · 428 unmodified lines
429429 char *msg[] = {
430430 "",
431431 " usage: [rtla] timerlat hist [-h] [-q] [-d s] [-D] [-n] [-p us] [-i us] [-T us] [-s us] [-t[=file]] \\",
432− " [-c cpu-list] [-P priority] [-e N] [-b N] [--no-irq] [--no-thread] [--no-header] [--no-summary] \\",
432+ " [-c cpu-list] [-P priority] [-E N] [-b N] [--no-irq] [--no-thread] [--no-header] [--no-summary] \\",
433433 " [--no-index] [--with-zeros]",
434434 "",
435435 " -h/--help: print this menu",
@@ -443,7 +443,7 @@ static void timerlat_hist_usage(char *usage) · 7 unmodified lines
443443 " -T/--trace[=file]: save the stopped trace to [file|timerlat_trace.txt]",
444444 " -n/--nano: display data in nanoseconds",
445445 " -b/--bucket-size N: set the histogram bucket size (default 1)",
446− " -e/--entries N: set the number of entries of the histogram (default 256)",
446+ " -E/--entries N: set the number of entries of the histogram (default 256)",
447447 " --no-irq: ignore IRQ latencies",
448448 " --no-thread: ignore thread latencies",
449449 " --no-header: do not print header",
@@ -494,7 +494,7 @@ static struct timerlat_hist_params · 44 unmodified lines
494494 {"cpus", required_argument, 0, 'c'},
495495 {"bucket-size", required_argument, 0, 'b'},
496496 {"debug", no_argument, 0, 'D'},
497− {"entries", required_argument, 0, 'e'},
497+ {"entries", required_argument, 0, 'E'},
498498 {"duration", required_argument, 0, 'd'},
499499 {"help", no_argument, 0, 'h'},
500500 {"irq", required_argument, 0, 'i'},
@@ -516,7 +516,7 @@ static struct timerlat_hist_params · 15 unmodified lines
516516 /* getopt_long stores the option index here. */
517517 int option_index = 0;
518518
519− c = getopt_long(argc, argv, "c:b:d:e:Dhi:np:P:s:t::T:012345",
519+ c = getopt_long(argc, argv, "c:b:d:E:Dhi:np:P:s:t::T:012345",
520520 long_options, &option_index);
521521
522522 /* detect the end of the options. */
@@ -543,7 +543,7 @@ static struct timerlat_hist_params · 20 unmodified lines
543543 if (!params->duration)
544544 timerlat_hist_usage("Invalid -D duration\n");
545545 break;
546− case 'e':
546+ case 'E':
547547 params->entries = get_llong_from_str(optarg);
548548 if ((params->entries < 10) || (params->entries > 9999999))
549549 timerlat_hist_usage("Entries must be > 10 and < 9999999\n");
virt/kvm/kvm_main.c+1−3
@@ -5528,9 +5528,7 @@ static int kvm_suspend(void) · 5527 unmodified lines
55285528 static void kvm_resume(void)
55295529 {
55305530 if (kvm_usage_count) {
5531−#ifdef CONFIG_LOCKDEP
5532− WARN_ON(lockdep_is_held(&kvm_count_lock));
5533−#endif
5531+ lockdep_assert_not_held(&kvm_count_lock);
55345532 hardware_enable_nolock(NULL);
55355533 }
55365534 }

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