History

Merge tag 'v5.13-rc6' into char-misc-next

We need the fixes in here as well.

Greg Kroah-Hartman committed 5 years ago

Commit db4e54a2 parents eab61fb 009c9aa520 files · +4146 −2040Browse files

Unified · Split

520 files
  1. .clang-format +11 −2
  2. .mailmap +3 −0
  3. Documentation/devicetree/bindings/connector/usb-connector.yaml +15 −0
  4. Documentation/devicetree/bindings/hwmon/ti,ads7828.yaml +1 −1
  5. Documentation/devicetree/bindings/media/renesas,drif.yaml +1 −3
  6. Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml +2 −2
  7. Documentation/virt/kvm/mmu.rst +2 −2
  8. MAINTAINERS +16 −5
  9. Makefile +1 −1
  10. arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +5 −1
  11. arch/arm/boot/dts/imx6q-dhcom-som.dtsi +12 −0
  12. arch/arm/boot/dts/imx6qdl-emcon-avari.dtsi +1 −1
  13. arch/arm/boot/dts/imx7d-meerkat96.dts +1 −1
  14. arch/arm/boot/dts/imx7d-pico.dtsi +1 −1
  15. arch/arm/include/asm/cpuidle.h +3 −2
  16. arch/arm/mach-imx/pm-imx27.c +1 −0
  17. arch/arm/mach-omap1/board-ams-delta.c +0 −14
  18. arch/arm/mach-omap1/board-h2.c +3 −1
  19. arch/arm/mach-omap1/pm.c +7 −3
  20. arch/arm/mach-omap2/board-n8x0.c +1 −1
  21. arch/arm64/Kconfig.platforms +1 −0
  22. arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts +2 −1
  23. arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts +2 −3
  24. arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +2 −2
  25. arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts +5 −5
  26. arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi +7 −16
  27. arch/arm64/boot/dts/ti/k3-am64-main.dtsi +6 −5
  28. arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi +2 −1
  29. arch/arm64/boot/dts/ti/k3-am65-main.dtsi +6 −4
  30. arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi +2 −2
  31. arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi +7 −6
  32. arch/arm64/boot/dts/ti/k3-am654-base-board.dts +0 −31
  33. arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +6 −2
  34. arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi +4 −3
  35. arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +6 −4
  36. arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi +6 −5
  37. arch/mips/mm/cache.c +14 −16
  38. arch/powerpc/include/asm/pte-walk.h +29 −0
  39. arch/powerpc/kernel/eeh.c +1 −22
  40. arch/powerpc/kernel/io-workarounds.c +3 −13
  41. arch/powerpc/kernel/iommu.c +5 −6
  42. arch/powerpc/kernel/kprobes.c +2 −2
  43. arch/powerpc/kvm/book3s_hv.c +0 −1
  44. arch/powerpc/kvm/book3s_hv_rm_mmu.c +2 −13
  45. arch/powerpc/kvm/book3s_hv_rmhandlers.S +7 −0
  46. arch/riscv/Kconfig +9 −9
  47. arch/riscv/Makefile +9 −0
  48. arch/riscv/boot/dts/microchip/Makefile +1 −0
  49. arch/riscv/boot/dts/sifive/Makefile +1 −0
  50. arch/riscv/errata/sifive/Makefile +1 −1
  51. arch/riscv/include/asm/alternative-macros.h +2 −2
  52. arch/riscv/kernel/setup.c +2 −2
  53. arch/riscv/kernel/traps.c +9 −4
  54. arch/riscv/kernel/vmlinux-xip.lds.S +14 −1
  55. arch/riscv/mm/init.c +6 −2
  56. arch/x86/Makefile +3 −2
  57. arch/x86/events/intel/uncore_snbep.c +6 −3
  58. arch/x86/include/asm/apic.h +1 −0
  59. arch/x86/include/asm/disabled-features.h +2 −5
  60. arch/x86/include/asm/fpu/api.h +1 −5
  61. arch/x86/include/asm/fpu/internal.h +0 −7
  62. arch/x86/include/asm/thermal.h +3 −1
  63. arch/x86/kernel/alternative.c +46 −18
  64. arch/x86/kernel/apic/apic.c +1 −0
  65. arch/x86/kernel/apic/vector.c +20 −0
  66. arch/x86/kernel/cpu/perfctr-watchdog.c +2 −2
  67. arch/x86/kernel/fpu/xstate.c +0 −57
  68. arch/x86/kernel/setup.c +30 −14
  69. arch/x86/kvm/lapic.c +11 −6
  70. arch/x86/kvm/mmu/paging_tmpl.h +9 −5
  71. arch/x86/kvm/svm/sev.c +2 −4
  72. arch/x86/kvm/trace.h +3 −3
  73. arch/x86/kvm/x86.c +17 −2
  74. arch/x86/mm/fault.c +2 −2
  75. arch/x86/mm/mem_encrypt_identity.c +6 −5
  76. arch/x86/platform/efi/quirks.c +12 −0
  77. arch/x86/realmode/init.c +8 −6
  78. crypto/async_tx/async_xor.c +2 −1
  79. drivers/acpi/acpica/utdelete.c +8 −0
  80. drivers/acpi/bus.c +8 −19
  81. drivers/acpi/sleep.c +1 −3
  82. drivers/base/memory.c +3 −3
  83. drivers/block/loop.c +7 −18
  84. drivers/block/loop.h +1 −0
  85. drivers/bluetooth/btusb.c +23 −2
  86. drivers/bus/mhi/pci_generic.c +38 −4
  87. drivers/bus/ti-sysc.c +54 −6
  88. drivers/dma/idxd/init.c +2 −2
  89. drivers/firmware/efi/cper.c +1 −3
  90. drivers/firmware/efi/fdtparams.c +3 −0
  91. drivers/firmware/efi/libstub/file.c +1 −1
  92. drivers/firmware/efi/memattr.c +0 −5
  93. drivers/gpio/gpio-wcd934x.c +1 −1
  94. drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 −16
  95. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 −1
  96. drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +2 −2
  97. drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +23 −19
  98. drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 −2
  99. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +1 −0
  100. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +21 −5
  101. drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +2 −1
  102. drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +2 −1
  103. drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +1 −0
  104. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +19 −11
  105. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +1 −1
  106. drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +1 −0
  107. drivers/gpu/drm/drm_auth.c +2 −1
  108. drivers/gpu/drm/drm_ioctl.c +5 −4
  109. drivers/gpu/drm/i915/Kconfig +0 −1
  110. drivers/gpu/drm/i915/gem/i915_gem_mman.c +5 −4
  111. drivers/gpu/drm/i915/i915_drv.h +3 −0
  112. drivers/gpu/drm/i915/i915_mm.c +44 −0
  113. drivers/gpu/drm/i915/selftests/i915_request.c +2 −2
  114. drivers/gpu/drm/mcde/mcde_dsi.c +1 −1
  115. drivers/gpu/drm/msm/adreno/a6xx_gpu.c +114 −41
  116. drivers/gpu/drm/msm/adreno/a6xx_gpu.h +1 −1
  117. drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +1 −0
  118. drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +1 −0
  119. drivers/gpu/drm/msm/msm_gem.c +7 −0
  120. drivers/gpu/drm/radeon/radeon_uvd.c +2 −2
  121. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +27 −4
  122. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +3 −2
  123. drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +36 −5
  124. drivers/gpu/drm/tegra/drm.h +1 −1
  125. drivers/gpu/drm/tegra/hub.c +1 −1
  126. drivers/gpu/drm/tegra/sor.c +42 −28
  127. drivers/gpu/drm/ttm/ttm_bo.c +4 −1
  128. drivers/gpu/drm/ttm/ttm_device.c +1 −7
  129. drivers/gpu/drm/vc4/vc4_kms.c +1 −1
  130. drivers/gpu/host1x/bus.c +24 −6
  131. drivers/hid/Kconfig +17 −2
  132. drivers/hid/Makefile +1 −0
  133. drivers/hid/amd-sfh-hid/amd_sfh_client.c +10 −9
  134. drivers/hid/amd-sfh-hid/amd_sfh_hid.c +0 −3
  135. drivers/hid/hid-a4tech.c +2 −0
  136. drivers/hid/hid-asus.c +20 −12
  137. drivers/hid/hid-core.c +3 −1
  138. drivers/hid/hid-debug.c +3 −0
  139. drivers/hid/hid-ft260.c +16 −13
  140. drivers/hid/hid-gt683r.c +1 −0
  141. drivers/hid/hid-ids.h +7 −2
  142. drivers/hid/hid-input.c +3 −0
  143. drivers/hid/hid-logitech-hidpp.c +1 −0
  144. drivers/hid/hid-magicmouse.c +5 −2
  145. drivers/hid/hid-multitouch.c +37 −9
  146. drivers/hid/hid-quirks.c +4 −0
  147. drivers/hid/hid-semitek.c +40 −0
  148. drivers/hid/hid-sensor-custom.c +5 −3
  149. drivers/hid/hid-sensor-hub.c +9 −4
  150. drivers/hid/hid-thrustmaster.c +1 −1
  151. drivers/hid/i2c-hid/i2c-hid-core.c +10 −3
  152. drivers/hid/intel-ish-hid/ipc/hw-ish.h +2 −0
  153. drivers/hid/intel-ish-hid/ipc/pci-ish.c +2 −0
  154. drivers/hid/surface-hid/surface_hid_core.c +3 −3
  155. drivers/hid/usbhid/hid-core.c +1 −1
  156. drivers/hid/usbhid/hid-pidff.c +1 −0
  157. drivers/hwmon/corsair-psu.c +14 −0
  158. drivers/hwmon/dell-smm-hwmon.c +2 −2
  159. drivers/hwmon/pmbus/fsp-3y.c +25 −7
  160. drivers/hwmon/pmbus/isl68137.c +2 −2
  161. drivers/hwmon/pmbus/q54sj108a2.c +1 −1
  162. drivers/hwmon/scpi-hwmon.c +9 −0
  163. drivers/hwmon/tps23861.c +15 −2
  164. drivers/i2c/busses/i2c-altera.c +4 −5
  165. drivers/i2c/busses/i2c-qcom-geni.c +20 −1
  166. drivers/i2c/busses/i2c-tegra-bpmp.c +2 −2
  167. drivers/infiniband/core/uverbs_cmd.c +5 −0
  168. drivers/infiniband/hw/mlx4/main.c +1 −7
  169. drivers/infiniband/hw/mlx5/cq.c +4 −5
  170. drivers/infiniband/hw/mlx5/doorbell.c +6 −1
  171. drivers/infiniband/hw/mlx5/fs.c +8 −3
  172. drivers/infiniband/hw/mlx5/mr.c +2 −2
  173. drivers/infiniband/ulp/ipoib/ipoib_netlink.c +1 −0
  174. drivers/md/bcache/bcache.h +0 −1
  175. drivers/md/bcache/request.c +7 −13
  176. drivers/md/bcache/stats.c +0 −14
  177. drivers/md/bcache/stats.h +0 −1
  178. drivers/md/bcache/sysfs.c +0 −4
  179. drivers/misc/cardreader/rtl8411.c +1 −0
  180. drivers/misc/cardreader/rts5209.c +1 −0
  181. drivers/misc/cardreader/rts5227.c +2 −0
  182. drivers/misc/cardreader/rts5228.c +1 −0
  183. drivers/misc/cardreader/rts5229.c +1 −0
  184. drivers/misc/cardreader/rts5249.c +3 −0
  185. drivers/misc/cardreader/rts5260.c +1 −0
  186. drivers/misc/cardreader/rts5261.c +1 −0
  187. drivers/misc/cardreader/rtsx_pcr.c +31 −13
  188. drivers/mmc/host/renesas_sdhi_core.c +7 −2
  189. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +0 −2
  190. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +2 −2
  191. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +5 −9
  192. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c +6 −3
  193. drivers/net/ethernet/chelsio/cxgb4/sge.c +6 −0
  194. drivers/net/ethernet/intel/i40e/i40e_txrx.c +6 −1
  195. drivers/net/ethernet/intel/i40e/i40e_xsk.c +6 −2
  196. drivers/net/ethernet/intel/ice/ice.h +5 −3
  197. drivers/net/ethernet/intel/ice/ice_ethtool.c +6 −45
  198. drivers/net/ethernet/intel/ice/ice_hw_autogen.h +1 −0
  199. drivers/net/ethernet/intel/ice/ice_lib.c +12 −0
  200. drivers/net/ethernet/intel/ice/ice_txrx.c +13 −4
  201. drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +13 −6
  202. drivers/net/ethernet/intel/ice/ice_xsk.c +9 −2
  203. drivers/net/ethernet/intel/igb/igb.h +1 −1
  204. drivers/net/ethernet/intel/igb/igb_main.c +32 −23
  205. drivers/net/ethernet/intel/igb/igb_ptp.c +10 −13
  206. drivers/net/ethernet/intel/igc/igc_main.c +5 −6
  207. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 −8
  208. drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +8 −6
  209. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +3 −0
  210. drivers/net/ethernet/mellanox/mlx4/fw.c +3 −0
  211. drivers/net/ethernet/mellanox/mlx4/fw.h +1 −0
  212. drivers/net/ethernet/mellanox/mlx4/main.c +6 −0
  213. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +10 −2
  214. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +62 −15
  215. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +9 −0
  216. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +2 −1
  217. drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +3 −0
  218. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +1 −1
  219. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h +5 −0
  220. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c +2 −1
  221. drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 −0
  222. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 −3
  223. drivers/net/ieee802154/mrf24j40.c +2 −2
  224. drivers/net/virtio_net.c +8 −12
  225. drivers/net/wireguard/Makefile +1 −2
  226. drivers/net/wireguard/allowedips.c +99 −90
  227. drivers/net/wireguard/allowedips.h +7 −7
  228. drivers/net/wireguard/main.c +16 −1
  229. drivers/net/wireguard/peer.c +20 −7
  230. drivers/net/wireguard/peer.h +3 −0
  231. drivers/net/wireguard/selftest/allowedips.c +79 −86
  232. drivers/net/wireguard/socket.c +1 −1
  233. drivers/net/wireless/mediatek/mt76/mac80211.c +26 −0
  234. drivers/net/wireless/mediatek/mt76/mt7615/init.c +0 −1
  235. drivers/net/wireless/mediatek/mt76/mt7615/mac.c +3 −2
  236. drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c +12 −7
  237. drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c +0 −3
  238. drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +4 −0
  239. drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +77 −4
  240. drivers/net/wireless/mediatek/mt76/mt7921/init.c +2 −2
  241. drivers/net/wireless/mediatek/mt76/mt7921/mac.c +3 −2
  242. drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 −2
  243. drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +10 −7
  244. drivers/net/xen-netback/interface.c +6 −0
  245. drivers/nvme/host/rdma.c +3 −2
  246. drivers/nvme/target/core.c +16 −17
  247. drivers/nvme/target/loop.c +8 −3
  248. drivers/pci/of.c +7 −0
  249. drivers/pci/probe.c +2 −1
  250. drivers/phy/broadcom/phy-brcm-usb-init.h +2 −2
  251. drivers/phy/cadence/phy-cadence-sierra.c +1 −0
  252. drivers/phy/mediatek/phy-mtk-tphy.c +2 −0
  253. drivers/phy/microchip/sparx5_serdes.c +4 −0
  254. drivers/phy/ralink/phy-mt7621-pci.c +1 −1
  255. drivers/phy/ti/phy-j721e-wiz.c +1 −0
  256. drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +2 −2
  257. drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c +2 −2
  258. drivers/pinctrl/aspeed/pinctrl-aspeed.c +2 −1
  259. drivers/pinctrl/aspeed/pinmux-aspeed.c +2 −1
  260. drivers/pinctrl/qcom/Kconfig +1 −1
  261. drivers/pinctrl/qcom/pinctrl-sdx55.c +9 −9
  262. drivers/pinctrl/ralink/pinctrl-rt2880.c +1 −1
  263. drivers/platform/mellanox/mlxreg-hotplug.c +2 −2
  264. drivers/platform/surface/aggregator/controller.c +1 −1
  265. drivers/platform/surface/surface_aggregator_registry.c +5 −2
  266. drivers/platform/surface/surface_dtx.c +1 −0
  267. drivers/platform/x86/thinkpad_acpi.c +1 −0
  268. drivers/regulator/Kconfig +1 −1
  269. drivers/regulator/atc260x-regulator.c +10 −9
  270. drivers/regulator/bd718x7-regulator.c +1 −1
  271. drivers/regulator/core.c +6 −0
  272. drivers/regulator/cros-ec-regulator.c +2 −1
  273. drivers/regulator/da9121-regulator.c +7 −3
  274. drivers/regulator/fan53555.c +1 −2
  275. drivers/regulator/fan53880.c +3 −0
  276. drivers/regulator/fixed.c +6 −1
  277. drivers/regulator/helpers.c +1 −1
  278. drivers/regulator/hi6421v600-regulator.c +2 −2
  279. drivers/regulator/hi655x-regulator.c +1 −1
  280. drivers/regulator/max77620-regulator.c +11 −6
  281. drivers/regulator/mt6315-regulator.c +1 −1
  282. drivers/regulator/rt4801-regulator.c +2 −2
  283. drivers/regulator/rtmv20-regulator.c +42 −2
  284. drivers/regulator/scmi-regulator.c +1 −1
  285. drivers/scsi/hosts.c +26 −21
  286. drivers/scsi/lpfc/lpfc_sli.c +1 −3
  287. drivers/scsi/qedf/qedf_main.c +9 −11
  288. drivers/scsi/scsi_devinfo.c +1 −0
  289. drivers/scsi/ufs/ufs-mediatek.c +14 −1
  290. drivers/soc/amlogic/meson-clk-measure.c +1 −3
  291. drivers/spi/spi-bcm2835.c +8 −2
  292. drivers/spi/spi-bitbang.c +14 −4
  293. drivers/spi/spi-fsl-spi.c +4 −0
  294. drivers/spi/spi-omap-uwire.c +8 −1
  295. drivers/spi/spi-omap2-mcspi.c +20 −13
  296. drivers/spi/spi-pxa2xx.c +8 −1
  297. drivers/spi/spi-stm32-qspi.c +4 −1
  298. drivers/spi/spi-zynq-qspi.c +4 −3
  299. drivers/staging/ralink-gdma/ralink-gdma.c +0 −2
  300. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +1 −1
  301. drivers/target/target_core_transport.c +1 −3
  302. drivers/tee/optee/call.c +4 −2
  303. drivers/tee/optee/optee_msg.h +4 −2
  304. drivers/thermal/intel/therm_throt.c +11 −4
  305. drivers/tty/serial/8250/8250_exar.c +5 −1
  306. drivers/usb/cdns3/cdns3-gadget.c +3 −5
  307. drivers/usb/cdns3/cdnsp-ring.c +4 −3
  308. drivers/usb/dwc3/core.c +0 −6
  309. drivers/usb/dwc3/debug.h +3 −0
  310. drivers/usb/dwc3/debugfs.c +2 −19
  311. drivers/usb/dwc3/dwc3-meson-g12a.c +10 −3
  312. drivers/usb/dwc3/ep0.c +3 −0
  313. drivers/usb/dwc3/gadget.c +12 −6
  314. drivers/usb/gadget/config.c +8 −0
  315. drivers/usb/gadget/function/f_ecm.c +1 −1
  316. drivers/usb/gadget/function/f_eem.c +3 −3
  317. drivers/usb/gadget/function/f_fs.c +3 −0
  318. drivers/usb/gadget/function/f_hid.c +2 −1
  319. drivers/usb/gadget/function/f_loopback.c +1 −1
  320. drivers/usb/gadget/function/f_ncm.c +5 −5
  321. drivers/usb/gadget/function/f_printer.c +2 −1
  322. drivers/usb/gadget/function/f_rndis.c +1 −1
  323. drivers/usb/gadget/function/f_serial.c +1 −1
  324. drivers/usb/gadget/function/f_sourcesink.c +2 −1
  325. drivers/usb/gadget/function/f_subset.c +1 −1
  326. drivers/usb/gadget/function/f_tcm.c +2 −1
  327. drivers/usb/host/xhci-pci.c +6 −1
  328. drivers/usb/host/xhci.h +1 −0
  329. drivers/usb/misc/brcmstb-usb-pinmap.c +2 −0
  330. drivers/usb/musb/musb_core.c +1 −2
  331. drivers/usb/serial/cp210x.c +78 −6
  332. drivers/usb/serial/ftdi_sio.c +1 −0
  333. drivers/usb/serial/ftdi_sio_ids.h +1 −0
  334. drivers/usb/serial/omninet.c +5 −3
  335. drivers/usb/serial/quatech2.c +3 −3
  336. drivers/usb/typec/mux.c +1 −1
  337. drivers/usb/typec/mux/intel_pmc_mux.c +11 −4
  338. drivers/usb/typec/tcpm/tcpm.c +77 −46
  339. drivers/usb/typec/tcpm/wcove.c +1 −1
  340. drivers/usb/typec/ucsi/ucsi.c +1 −0
  341. drivers/vfio/pci/Kconfig +1 −0
  342. drivers/vfio/pci/vfio_pci_config.c +1 −1
  343. drivers/vfio/platform/vfio_platform_common.c +1 −1
  344. drivers/vfio/vfio_iommu_type1.c +1 −1
  345. drivers/video/fbdev/core/fb_defio.c +35 −0
  346. drivers/video/fbdev/core/fbmem.c +4 −0
  347. fs/afs/write.c +1 −1
  348. fs/btrfs/compression.c +12 −5
  349. fs/btrfs/disk-io.c +18 −8
  350. fs/btrfs/extent-tree.c +1 −1
  351. fs/btrfs/file-item.c +81 −27
  352. fs/btrfs/file.c +2 −2
  353. fs/btrfs/inode.c +18 −1
  354. fs/btrfs/reflink.c +22 −16
  355. fs/btrfs/tree-log.c +29 −8
  356. fs/btrfs/zoned.c +18 −5
  357. fs/coredump.c +1 −1
  358. fs/debugfs/file.c +1 −1
  359. fs/ext4/extents.c +23 −20
  360. fs/ext4/fast_commit.c +90 −80
  361. fs/ext4/fast_commit.h +0 −19
  362. fs/ext4/ialloc.c +4 −2
  363. fs/ext4/mballoc.c +1 −1
  364. fs/ext4/namei.c +4 −2
  365. fs/ext4/super.c +9 −2
  366. fs/ext4/sysfs.c +4 −0
  367. fs/gfs2/file.c +4 −1
  368. fs/gfs2/glock.c +24 −4
  369. fs/gfs2/glops.c +1 −1
  370. fs/gfs2/log.c +3 −3
  371. fs/gfs2/log.h +1 −0
  372. fs/gfs2/lops.c +6 −1
  373. fs/gfs2/lops.h +1 −0
  374. fs/gfs2/util.c +1 −0
  375. fs/io_uring.c +30 −13
  376. fs/nfs/client.c +1 −1
  377. fs/nfs/nfs4_fs.h +1 −0
  378. fs/nfs/nfs4client.c +1 −1
  379. fs/nfs/nfs4proc.c +30 −7
  380. fs/nfs/nfstrace.h +0 −4
  381. fs/notify/fanotify/fanotify_user.c +24 −6
  382. fs/notify/fdinfo.c +1 −1
  383. fs/ocfs2/file.c +50 −5
  384. fs/proc/base.c +8 −1
  385. include/asm-generic/vmlinux.lds.h +1 −0
  386. include/dt-bindings/usb/pd.h +76 −13
  387. include/linux/avf/virtchnl.h +1 −0
  388. include/linux/compiler_attributes.h +1 −0
  389. include/linux/entry-kvm.h +2 −1
  390. include/linux/fanotify.h +4 −0
  391. include/linux/fb.h +3 −0
  392. include/linux/hid.h +1 −2
  393. include/linux/host1x.h +24 −6
  394. include/linux/kvm_host.h +9 −1
  395. include/linux/mfd/rohm-bd70528.h +1 −3
  396. include/linux/mfd/rohm-bd71828.h +5 −5
  397. include/linux/mlx4/device.h +1 −0
  398. include/linux/mlx5/mlx5_ifc.h +2 −0
  399. include/linux/mm_types.h +20 −7
  400. include/linux/pci.h +2 −0
  401. include/linux/pgtable.h +8 −0
  402. include/linux/platform_data/ti-sysc.h +1 −0
  403. include/linux/rtsx_pci.h +2 −0
  404. include/linux/sched.h +8 −0
  405. include/linux/tick.h +7 −0
  406. include/linux/usb/pd.h +1 −1
  407. include/linux/usb/pd_ext_sdb.h +0 −4
  408. include/net/caif/caif_dev.h +1 −1
  409. include/net/caif/cfcnfg.h +1 −1
  410. include/net/caif/cfserl.h +1 −0
  411. include/net/netfilter/nf_tables.h +0 −6
  412. include/net/tls.h +9 −1
  413. include/uapi/linux/input-event-codes.h +1 −0
  414. include/uapi/linux/io_uring.h +10 −9
  415. include/uapi/linux/virtio_ids.h +1 −1
  416. init/main.c +1 −1
  417. kernel/bpf/helpers.c +5 −2
  418. kernel/cgroup/cgroup-v1.c +4 −0
  419. kernel/entry/common.c +3 −2
  420. kernel/events/core.c +2 −0
  421. kernel/irq_work.c +0 −3
  422. kernel/sched/debug.c +2 −1
  423. kernel/sched/fair.c +17 −11
  424. kernel/sched/pelt.h +1 −10
  425. kernel/time/tick-sched.c +1 −0
  426. kernel/trace/bpf_trace.c +12 −20
  427. kernel/trace/ftrace.c +7 −1
  428. kernel/trace/trace.c +1 −1
  429. lib/crc64.c +1 −1
  430. mm/debug_vm_pgtable.c +2 −2
  431. mm/hugetlb.c +13 −3
  432. mm/kasan/init.c +2 −2
  433. mm/kfence/core.c +3 −3
  434. mm/memory.c +4 −0
  435. mm/page_alloc.c +2 −0
  436. net/bluetooth/hci_core.c +6 −1
  437. net/bluetooth/hci_sock.c +2 −2
  438. net/caif/caif_dev.c +9 −4
  439. net/caif/caif_usb.c +13 −1
  440. net/caif/cfcnfg.c +11 −5
  441. net/caif/cfserl.c +5 −0
  442. net/compat.c +1 −1
  443. net/core/devlink.c +2 −2
  444. net/core/fib_rules.c +1 −1
  445. net/core/rtnetlink.c +3 −1
  446. net/core/sock.c +12 −4
  447. net/dsa/tag_8021q.c +1 −1
  448. net/ieee802154/nl-mac.c +6 −4
  449. net/ieee802154/nl-phy.c +3 −1
  450. net/ieee802154/nl802154.c +5 −4
  451. net/ipv4/ipconfig.c +8 −5
  452. net/ipv6/route.c +6 −2
  453. net/ipv6/sit.c +3 −0
  454. net/kcm/kcmsock.c +5 −0
  455. net/mptcp/protocol.c +15 −1
  456. net/mptcp/subflow.c +40 −39
  457. net/netfilter/ipvs/ip_vs_ctl.c +1 −1
  458. net/netfilter/nf_conntrack_proto.c +1 −1
  459. net/netfilter/nf_tables_api.c +57 −27
  460. net/netfilter/nfnetlink_cthelper.c +6 −2
  461. net/netfilter/nft_ct.c +1 −1
  462. net/nfc/llcp_sock.c +2 −0
  463. net/sched/act_ct.c +4 −6
  464. net/sched/sch_htb.c +4 −4
  465. net/tls/tls_device.c +49 −11
  466. net/tls/tls_device_fallback.c +7 −0
  467. net/tls/tls_main.c +1 −0
  468. net/x25/af_x25.c +1 −1
  469. samples/vfio-mdev/mdpy-fb.c +9 −4
  470. scripts/Makefile.modfinal +1 −1
  471. scripts/link-vmlinux.sh +1 −1
  472. sound/core/control_led.c +26 −7
  473. sound/core/seq/seq_timer.c +9 −1
  474. sound/core/timer.c +2 −1
  475. sound/firewire/amdtp-stream.c +1 −1
  476. sound/hda/intel-dsp-config.c +4 −0
  477. sound/pci/hda/hda_codec.c +5 −0
  478. sound/pci/hda/hda_generic.c +1 −0
  479. sound/pci/hda/hda_intel.c +3 −0
  480. sound/pci/hda/patch_cirrus.c +3 −4
  481. sound/pci/hda/patch_realtek.c +17 −0
  482. sound/soc/codecs/rt5659.c +21 −5
  483. sound/soc/codecs/rt5682-sdw.c +2 −1
  484. sound/soc/codecs/tas2562.h +7 −7
  485. sound/soc/fsl/fsl-asoc-card.c +1 −0
  486. sound/soc/qcom/lpass-cpu.c +79 −0
  487. sound/soc/qcom/lpass.h +4 −0
  488. sound/soc/soc-core.c +2 −0
  489. sound/soc/soc-topology.c +3 −3
  490. sound/soc/sof/pm.c +1 −0
  491. tools/arch/mips/include/uapi/asm/perf_regs.h +40 −0
  492. tools/arch/x86/include/asm/disabled-features.h +2 −5
  493. tools/bootconfig/include/linux/bootconfig.h +4 −0
  494. tools/bootconfig/main.c +1 −0
  495. tools/objtool/arch/x86/decode.c +4 −0
  496. tools/objtool/elf.c +24 −1
  497. tools/perf/Makefile.config +0 −1
  498. tools/perf/builtin-record.c +6 −0
  499. tools/perf/check-headers.sh +1 −0
  500. tools/perf/tests/attr/base-record +1 −1
  501. tools/perf/util/bpf_counter.c +4 −2
  502. tools/perf/util/dwarf-aux.c +6 −2
  503. tools/perf/util/env.c +1 −0
  504. tools/perf/util/evsel.c +1 −0
  505. tools/perf/util/evsel.h +2 −2
  506. tools/perf/util/perf_api_probe.c +10 −0
  507. tools/perf/util/perf_api_probe.h +1 −0
  508. tools/perf/util/probe-finder.c +3 −0
  509. tools/perf/util/session.c +1 −0
  510. tools/perf/util/stat-display.c +3 −5
  511. tools/perf/util/symbol-elf.c +1 −0
  512. tools/testing/selftests/kvm/include/kvm_util.h +6 −4
  513. tools/testing/selftests/kvm/kvm_page_table_test.c +1 −1
  514. tools/testing/selftests/kvm/lib/kvm_util.c +43 −9
  515. tools/testing/selftests/kvm/lib/perf_test_util.c +1 −1
  516. tools/testing/selftests/kvm/memslot_perf_test.c +1 −1
  517. tools/testing/selftests/net/mptcp/mptcp_connect.sh +9 −4
  518. tools/testing/selftests/proc/.gitignore +1 −0
  519. tools/testing/selftests/wireguard/netns.sh +1 −0
  520. tools/testing/selftests/wireguard/qemu/kernel.config +0 −1
.clang-format+11−2
@@ -109,8 +109,8 @@ ForEachMacros: · 108 unmodified lines
109109 - 'css_for_each_child'
110110 - 'css_for_each_descendant_post'
111111 - 'css_for_each_descendant_pre'
112− - 'cxl_for_each_cmd'
113112 - 'device_for_each_child_node'
113+ - 'displayid_iter_for_each'
114114 - 'dma_fence_chain_for_each'
115115 - 'do_for_each_ftrace_op'
116116 - 'drm_atomic_crtc_for_each_plane'
@@ -136,6 +136,7 @@ ForEachMacros: · 19 unmodified lines
136136 - 'drm_mm_for_each_node_in_range'
137137 - 'drm_mm_for_each_node_safe'
138138 - 'flow_action_for_each'
139+ - 'for_each_acpi_dev_match'
139140 - 'for_each_active_dev_scope'
140141 - 'for_each_active_drhd_unit'
141142 - 'for_each_active_iommu'
@@ -171,7 +172,6 @@ ForEachMacros: · 29 unmodified lines
171172 - 'for_each_dapm_widgets'
172173 - 'for_each_dev_addr'
173174 - 'for_each_dev_scope'
174− - 'for_each_displayid_db'
175175 - 'for_each_dma_cap_mask'
176176 - 'for_each_dpcm_be'
177177 - 'for_each_dpcm_be_rollback'
@@ -179,6 +179,7 @@ ForEachMacros: · 1 unmodified line
179179 - 'for_each_dpcm_fe'
180180 - 'for_each_drhd_unit'
181181 - 'for_each_dss_dev'
182+ - 'for_each_dtpm_table'
182183 - 'for_each_efi_memory_desc'
183184 - 'for_each_efi_memory_desc_in_map'
184185 - 'for_each_element'
@@ -215,6 +216,7 @@ ForEachMacros: · 30 unmodified lines
215216 - 'for_each_migratetype_order'
216217 - 'for_each_msi_entry'
217218 - 'for_each_msi_entry_safe'
219+ - 'for_each_msi_vector'
218220 - 'for_each_net'
219221 - 'for_each_net_continue_reverse'
220222 - 'for_each_netdev'
@@ -270,6 +272,12 @@ ForEachMacros: · 49 unmodified lines
270272 - 'for_each_prime_number_from'
271273 - 'for_each_process'
272274 - 'for_each_process_thread'
275+ - 'for_each_prop_codec_conf'
276+ - 'for_each_prop_dai_codec'
277+ - 'for_each_prop_dai_cpu'
278+ - 'for_each_prop_dlc_codecs'
279+ - 'for_each_prop_dlc_cpus'
280+ - 'for_each_prop_dlc_platforms'
273281 - 'for_each_property_of_node'
274282 - 'for_each_registered_fb'
275283 - 'for_each_requested_gpio'
@@ -430,6 +438,7 @@ ForEachMacros: · 154 unmodified lines
430438 - 'queue_for_each_hw_ctx'
431439 - 'radix_tree_for_each_slot'
432440 - 'radix_tree_for_each_tagged'
441+ - 'rb_for_each'
433442 - 'rbtree_postorder_for_each_entry_safe'
434443 - 'rdma_for_each_block'
435444 - 'rdma_for_each_port'
.mailmap+3−0
@@ -243,6 +243,9 @@ Maxime Ripard <mripard@kernel.org> <maxime.ripard@free-electrons.com> · 242 unmodified lines
243243 Mayuresh Janorkar <mayur@ti.com>
244244 Michael Buesch <m@bues.ch>
245245 Michel Dänzer <michel@tungstengraphics.com>
246+Michel Lespinasse <michel@lespinasse.org>
247+Michel Lespinasse <michel@lespinasse.org> <walken@google.com>
248+Michel Lespinasse <michel@lespinasse.org> <walken@zoy.org>
246249 Miguel Ojeda <ojeda@kernel.org> <miguel.ojeda.sandonis@gmail.com>
247250 Mike Rapoport <rppt@kernel.org> <mike@compulab.co.il>
248251 Mike Rapoport <rppt@kernel.org> <mike.rapoport@gmail.com>
Documentation/devicetree/bindings/connector/usb-connector.yaml+15−0
@@ -149,6 +149,17 @@ properties: · 148 unmodified lines
149149 maxItems: 6
150150 $ref: /schemas/types.yaml#/definitions/uint32-array
151151
152+ sink-vdos-v1:
153+ description: An array of u32 with each entry, a Vendor Defined Message Object (VDO),
154+ providing additional information corresponding to the product, the detailed bit
155+ definitions and the order of each VDO can be found in
156+ "USB Power Delivery Specification Revision 2.0, Version 1.3" chapter 6.4.4.3.1 Discover
157+ Identity. User can specify the VDO array via VDO_IDH/_CERT/_PRODUCT/_CABLE/_AMA defined in
158+ dt-bindings/usb/pd.h.
159+ minItems: 3
160+ maxItems: 6
161+ $ref: /schemas/types.yaml#/definitions/uint32-array
162+
152163 op-sink-microwatt:
153164 description: Sink required operating power in microwatt, if source can't
154165 offer the power, Capability Mismatch is set. Required for power sink and
@@ -207,6 +218,10 @@ properties: · 52 unmodified lines
207218 SNK_READY for non-pd link.
208219 type: boolean
209220
221+dependencies:
222+ sink-vdos-v1: [ 'sink-vdos' ]
223+ sink-vdos: [ 'sink-vdos-v1' ]
224+
210225 required:
211226 - compatible
212227
Documentation/devicetree/bindings/hwmon/ti,ads7828.yaml+1−1
@@ -49,7 +49,7 @@ examples: · 48 unmodified lines
4949 #size-cells = <0>;
5050
5151 adc@48 {
52− comatible = "ti,ads7828";
52+ compatible = "ti,ads7828";
5353 reg = <0x48>;
5454 vref-supply = <&vref>;
5555 ti,differential-input;
Documentation/devicetree/bindings/media/renesas,drif.yaml+1−3
@@ -67,9 +67,7 @@ properties: · 66 unmodified lines
6767 maxItems: 1
6868
6969 clock-names:
70− maxItems: 1
71− items:
72− - const: fck
70+ const: fck
7371
7472 resets:
7573 maxItems: 1
Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml+2−2
@@ -57,7 +57,7 @@ patternProperties: · 56 unmodified lines
5757 rate
5858
5959 sound-dai:
60− $ref: /schemas/types.yaml#/definitions/phandle
60+ $ref: /schemas/types.yaml#/definitions/phandle-array
6161 description: phandle of the CPU DAI
6262
6363 patternProperties:
@@ -71,7 +71,7 @@ patternProperties: · 7 unmodified lines
7171
7272 properties:
7373 sound-dai:
74− $ref: /schemas/types.yaml#/definitions/phandle
74+ $ref: /schemas/types.yaml#/definitions/phandle-array
7575 description: phandle of the codec DAI
7676
7777 required:
Documentation/virt/kvm/mmu.rst+2−2
@@ -171,8 +171,8 @@ Shadow pages contain the following information: · 170 unmodified lines
171171 shadow pages) so role.quadrant takes values in the range 0..3. Each
172172 quadrant maps 1GB virtual address space.
173173 role.access:
174− Inherited guest access permissions in the form uwx. Note execute
175− permission is positive, not negative.
174+ Inherited guest access permissions from the parent ptes in the form uwx.
175+ Note execute permission is positive, not negative.
176176 role.invalid:
177177 The page is invalid and should not be used. It is a root page that is
178178 currently pinned (by a cpu hardware register pointing to it); once it is
MAINTAINERS+16−5
@@ -3877,6 +3877,7 @@ L: linux-btrfs@vger.kernel.org · 3876 unmodified lines
38773877 S: Maintained
38783878 W: http://btrfs.wiki.kernel.org/
38793879 Q: http://patchwork.kernel.org/project/linux-btrfs/list/
3880+C: irc://irc.libera.chat/btrfs
38803881 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
38813882 F: Documentation/filesystems/btrfs.rst
38823883 F: fs/btrfs/
@@ -6945,6 +6946,7 @@ F: net/core/failover.c · 3062 unmodified lines
69456946 FANOTIFY
69466947 M: Jan Kara <jack@suse.cz>
69476948 R: Amir Goldstein <amir73il@gmail.com>
6949+R: Matthew Bobrowski <repnop@google.com>
69486950 L: linux-fsdevel@vger.kernel.org
69496951 S: Maintained
69506952 F: fs/notify/fanotify/
@@ -12903,7 +12905,7 @@ F: net/ipv4/nexthop.c · 5952 unmodified lines
1290312905
1290412906 NFC SUBSYSTEM
1290512907 M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
12906−L: linux-nfc@lists.01.org (moderated for non-subscribers)
12908+L: linux-nfc@lists.01.org (subscribers-only)
1290712909 L: netdev@vger.kernel.org
1290812910 S: Maintained
1290912911 F: Documentation/devicetree/bindings/net/nfc/
@@ -12916,7 +12918,7 @@ F: net/nfc/ · 6 unmodified lines
1291612918 NFC VIRTUAL NCI DEVICE DRIVER
1291712919 M: Bongsu Jeon <bongsu.jeon@samsung.com>
1291812920 L: netdev@vger.kernel.org
12919−L: linux-nfc@lists.01.org (moderated for non-subscribers)
12921+L: linux-nfc@lists.01.org (subscribers-only)
1292012922 S: Supported
1292112923 F: drivers/nfc/virtual_ncidev.c
1292212924 F: tools/testing/selftests/nci/
@@ -13214,7 +13216,7 @@ F: sound/soc/codecs/tfa9879* · 291 unmodified lines
1321413216
1321513217 NXP-NCI NFC DRIVER
1321613218 R: Charles Gorand <charles.gorand@effinnov.com>
13217−L: linux-nfc@lists.01.org (moderated for non-subscribers)
13219+L: linux-nfc@lists.01.org (subscribers-only)
1321813220 S: Supported
1321913221 F: drivers/nfc/nxp-nci
1322013222
@@ -14117,6 +14119,7 @@ F: drivers/pci/controller/pci-v3-semi.c · 896 unmodified lines
1411714119 PCI ENDPOINT SUBSYSTEM
1411814120 M: Kishon Vijay Abraham I <kishon@ti.com>
1411914121 M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
14122+R: Krzysztof Wilczyński <kw@linux.com>
1412014123 L: linux-pci@vger.kernel.org
1412114124 S: Supported
1412214125 F: Documentation/PCI/endpoint/*
@@ -14165,6 +14168,7 @@ F: drivers/pci/controller/pci-xgene-msi.c · 42 unmodified lines
1416514168 PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
1416614169 M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
1416714170 R: Rob Herring <robh@kernel.org>
14171+R: Krzysztof Wilczyński <kw@linux.com>
1416814172 L: linux-pci@vger.kernel.org
1416914173 S: Supported
1417014174 Q: http://patchwork.ozlabs.org/project/linux-pci/list/
@@ -16143,7 +16147,7 @@ F: include/media/drv-intf/s3c_camif.h · 1972 unmodified lines
1614316147 SAMSUNG S3FWRN5 NFC DRIVER
1614416148 M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
1614516149 M: Krzysztof Opasiak <k.opasiak@samsung.com>
16146−L: linux-nfc@lists.01.org (moderated for non-subscribers)
16150+L: linux-nfc@lists.01.org (subscribers-only)
1614716151 S: Maintained
1614816152 F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml
1614916153 F: drivers/nfc/s3fwrn5
@@ -18333,7 +18337,7 @@ F: sound/soc/codecs/tas571x* · 2183 unmodified lines
1833318337 TI TRF7970A NFC DRIVER
1833418338 M: Mark Greer <mgreer@animalcreek.com>
1833518339 L: linux-wireless@vger.kernel.org
18336−L: linux-nfc@lists.01.org (moderated for non-subscribers)
18340+L: linux-nfc@lists.01.org (subscribers-only)
1833718341 S: Supported
1833818342 F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
1833918343 F: drivers/nfc/trf7970a.c
@@ -18869,6 +18873,13 @@ S: Maintained · 529 unmodified lines
1886918873 F: drivers/usb/host/isp116x*
1887018874 F: include/linux/usb/isp116x.h
1887118875
18876+USB ISP1760 DRIVER
18877+M: Rui Miguel Silva <rui.silva@linaro.org>
18878+L: linux-usb@vger.kernel.org
18879+S: Maintained
18880+F: drivers/usb/isp1760/*
18881+F: Documentation/devicetree/bindings/usb/nxp,isp1760.yaml
18882+
1887218883 USB LAN78XX ETHERNET DRIVER
1887318884 M: Woojung Huh <woojung.huh@microchip.com>
1887418885 M: UNGLinuxDriver@microchip.com
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 13
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc4
5+EXTRAVERSION = -rc6
66 NAME = Frozen Wasteland
77
88 # *DOCUMENTATION*
arch/arm/boot/dts/imx6dl-yapp4-common.dtsi+5−1
@@ -105,9 +105,13 @@ · 104 unmodified lines
105105 phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>;
106106 phy-reset-duration = <20>;
107107 phy-supply = <&sw2_reg>;
108− phy-handle = <&ethphy0>;
109108 status = "okay";
110109
110+ fixed-link {
111+ speed = <1000>;
112+ full-duplex;
113+ };
114+
111115 mdio {
112116 #address-cells = <1>;
113117 #size-cells = <0>;
arch/arm/boot/dts/imx6q-dhcom-som.dtsi+12−0
@@ -406,6 +406,18 @@ · 405 unmodified lines
406406 vin-supply = <&sw1_reg>;
407407 };
408408
409+&reg_pu {
410+ vin-supply = <&sw1_reg>;
411+};
412+
413+&reg_vdd1p1 {
414+ vin-supply = <&sw2_reg>;
415+};
416+
417+&reg_vdd2p5 {
418+ vin-supply = <&sw2_reg>;
419+};
420+
409421 &uart1 {
410422 pinctrl-names = "default";
411423 pinctrl-0 = <&pinctrl_uart1>;
arch/arm/boot/dts/imx6qdl-emcon-avari.dtsi+1−1
@@ -126,7 +126,7 @@ · 125 unmodified lines
126126 compatible = "nxp,pca8574";
127127 reg = <0x3a>;
128128 gpio-controller;
129− #gpio-cells = <1>;
129+ #gpio-cells = <2>;
130130 };
131131 };
132132
arch/arm/boot/dts/imx7d-meerkat96.dts+1−1
@@ -193,7 +193,7 @@ · 192 unmodified lines
193193 pinctrl-names = "default";
194194 pinctrl-0 = <&pinctrl_usdhc1>;
195195 keep-power-in-suspend;
196− tuning-step = <2>;
196+ fsl,tuning-step = <2>;
197197 vmmc-supply = <&reg_3p3v>;
198198 no-1-8-v;
199199 broken-cd;
arch/arm/boot/dts/imx7d-pico.dtsi+1−1
@@ -351,7 +351,7 @@ · 350 unmodified lines
351351 pinctrl-2 = <&pinctrl_usdhc1_200mhz>;
352352 cd-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
353353 bus-width = <4>;
354− tuning-step = <2>;
354+ fsl,tuning-step = <2>;
355355 vmmc-supply = <&reg_3p3v>;
356356 wakeup-source;
357357 no-1-8-v;
arch/arm/include/asm/cpuidle.h+3−2
@@ -7,9 +7,11 @@ · 6 unmodified lines
77 #ifdef CONFIG_CPU_IDLE
88 extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
99 struct cpuidle_driver *drv, int index);
10+#define __cpuidle_method_section __used __section("__cpuidle_method_of_table")
1011 #else
1112 static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
1213 struct cpuidle_driver *drv, int index) { return -ENODEV; }
14+#define __cpuidle_method_section __maybe_unused /* drop silently */
1315 #endif
1416
1517 /* Common ARM WFI state */
@@ -42,8 +44,7 @@ struct of_cpuidle_method { · 26 unmodified lines
4244
4345 #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops) \
4446 static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
45− __used __section("__cpuidle_method_of_table") \
46− = { .method = _method, .ops = _ops }
47+ __cpuidle_method_section = { .method = _method, .ops = _ops }
4748
4849 extern int arm_cpuidle_suspend(int index);
4950
arch/arm/mach-imx/pm-imx27.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/suspend.h>
1313 #include <linux/io.h>
1414
15+#include "common.h"
1516 #include "hardware.h"
1617
1718 static int mx27_suspend_enter(suspend_state_t state)
arch/arm/mach-omap1/board-ams-delta.c+0−14
@@ -458,20 +458,6 @@ static struct gpiod_lookup_table leds_gpio_table = { · 457 unmodified lines
458458
459459 #ifdef CONFIG_LEDS_TRIGGERS
460460 DEFINE_LED_TRIGGER(ams_delta_camera_led_trigger);
461−
462−static int ams_delta_camera_power(struct device *dev, int power)
463−{
464− /*
465− * turn on camera LED
466− */
467− if (power)
468− led_trigger_event(ams_delta_camera_led_trigger, LED_FULL);
469− else
470− led_trigger_event(ams_delta_camera_led_trigger, LED_OFF);
471− return 0;
472−}
473−#else
474−#define ams_delta_camera_power NULL
475461 #endif
476462
477463 static struct platform_device ams_delta_audio_device = {
arch/arm/mach-omap1/board-h2.c+3−1
@@ -320,7 +320,7 @@ static int tps_setup(struct i2c_client *client, void *context) · 319 unmodified lines
320320 {
321321 if (!IS_BUILTIN(CONFIG_TPS65010))
322322 return -ENOSYS;
323−
323+
324324 tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V |
325325 TPS_LDO1_ENABLE | TPS_VLDO1_3_0V);
326326
@@ -394,6 +394,8 @@ static void __init h2_init(void) · 67 unmodified lines
394394 BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
395395 gpio_direction_input(H2_NAND_RB_GPIO_PIN);
396396
397+ gpiod_add_lookup_table(&isp1301_gpiod_table);
398+
397399 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
398400 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
399401
arch/arm/mach-omap1/pm.c+7−3
@@ -655,9 +655,13 @@ static int __init omap_pm_init(void) · 654 unmodified lines
655655 irq = INT_7XX_WAKE_UP_REQ;
656656 else if (cpu_is_omap16xx())
657657 irq = INT_1610_WAKE_UP_REQ;
658− if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup",
659− NULL))
660− pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
658+ else
659+ irq = -1;
660+
661+ if (irq >= 0) {
662+ if (request_irq(irq, omap_wakeup_interrupt, 0, "peripheral wakeup", NULL))
663+ pr_err("Failed to request irq %d (peripheral wakeup)\n", irq);
664+ }
661665
662666 /* Program new power ramp-up time
663667 * (0 for most boards since we don't lower voltage when in deep sleep)
arch/arm/mach-omap2/board-n8x0.c+1−1
@@ -322,6 +322,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, int slot) · 321 unmodified lines
322322
323323 static void n8x0_mmc_callback(void *data, u8 card_mask)
324324 {
325+#ifdef CONFIG_MMC_OMAP
325326 int bit, *openp, index;
326327
327328 if (board_is_n800()) {
@@ -339,7 +340,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) · 11 unmodified lines
339340 else
340341 *openp = 0;
341342
342−#ifdef CONFIG_MMC_OMAP
343343 omap_mmc_notify_cover_event(mmc_device, index, *openp);
344344 #else
345345 pr_warn("MMC: notify cover event not available\n");
arch/arm64/Kconfig.platforms+1−0
@@ -165,6 +165,7 @@ config ARCH_MEDIATEK · 164 unmodified lines
165165
166166 config ARCH_MESON
167167 bool "Amlogic Platforms"
168+ select COMMON_CLK
168169 select MESON_IRQ_GPIO
169170 help
170171 This enables support for the arm64 based Amlogic SoCs
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts+2−1
@@ -46,7 +46,8 @@ · 45 unmodified lines
4646 eee-broken-100tx;
4747 qca,clk-out-frequency = <125000000>;
4848 qca,clk-out-strength = <AR803X_STRENGTH_FULL>;
49− vddio-supply = <&vddh>;
49+ qca,keep-pll-enabled;
50+ vddio-supply = <&vddio>;
5051
5152 vddio: vddio-regulator {
5253 regulator-name = "VDDIO";
arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts+2−3
@@ -31,11 +31,10 @@ · 30 unmodified lines
3131 reg = <0x4>;
3232 eee-broken-1000t;
3333 eee-broken-100tx;
34−
3534 qca,clk-out-frequency = <125000000>;
3635 qca,clk-out-strength = <AR803X_STRENGTH_FULL>;
37−
38− vddio-supply = <&vddh>;
36+ qca,keep-pll-enabled;
37+ vddio-supply = <&vddio>;
3938
4039 vddio: vddio-regulator {
4140 regulator-name = "VDDIO";
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi+2−2
@@ -197,8 +197,8 @@ · 196 unmodified lines
197197 ddr: memory-controller@1080000 {
198198 compatible = "fsl,qoriq-memory-controller";
199199 reg = <0x0 0x1080000 0x0 0x1000>;
200− interrupts = <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>;
201− big-endian;
200+ interrupts = <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
201+ little-endian;
202202 };
203203
204204 dcfg: syscon@1e00000 {
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts+5−5
@@ -88,11 +88,11 @@ · 87 unmodified lines
8888 pinctrl-0 = <&pinctrl_codec2>;
8989 reg = <0x18>;
9090 #sound-dai-cells = <0>;
91− HPVDD-supply = <&reg_3p3v>;
92− SPRVDD-supply = <&reg_3p3v>;
93− SPLVDD-supply = <&reg_3p3v>;
94− AVDD-supply = <&reg_3p3v>;
95− IOVDD-supply = <&reg_3p3v>;
91+ HPVDD-supply = <&reg_gen_3p3>;
92+ SPRVDD-supply = <&reg_gen_3p3>;
93+ SPLVDD-supply = <&reg_gen_3p3>;
94+ AVDD-supply = <&reg_gen_3p3>;
95+ IOVDD-supply = <&reg_gen_3p3>;
9696 DVDD-supply = <&vgen4_reg>;
9797 reset-gpios = <&gpio3 4 GPIO_ACTIVE_HIGH>;
9898 };
arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi+7−16
@@ -45,8 +45,8 @@ · 44 unmodified lines
4545 reg_12p0_main: regulator-12p0-main {
4646 compatible = "regulator-fixed";
4747 regulator-name = "12V_MAIN";
48− regulator-min-microvolt = <5000000>;
49− regulator-max-microvolt = <5000000>;
48+ regulator-min-microvolt = <12000000>;
49+ regulator-max-microvolt = <12000000>;
5050 regulator-always-on;
5151 };
5252
@@ -77,15 +77,6 @@ · 24 unmodified lines
7777 regulator-always-on;
7878 };
7979
80− reg_3p3v: regulator-3p3v {
81− compatible = "regulator-fixed";
82− vin-supply = <&reg_3p3_main>;
83− regulator-name = "GEN_3V3";
84− regulator-min-microvolt = <3300000>;
85− regulator-max-microvolt = <3300000>;
86− regulator-always-on;
87− };
88−
8980 reg_usdhc2_vmmc: regulator-vsd-3v3 {
9081 pinctrl-names = "default";
9182 pinctrl-0 = <&pinctrl_reg_usdhc2>;
@@ -415,11 +406,11 @@ · 323 unmodified lines
415406 pinctrl-0 = <&pinctrl_codec1>;
416407 reg = <0x18>;
417408 #sound-dai-cells = <0>;
418− HPVDD-supply = <&reg_3p3v>;
419− SPRVDD-supply = <&reg_3p3v>;
420− SPLVDD-supply = <&reg_3p3v>;
421− AVDD-supply = <&reg_3p3v>;
422− IOVDD-supply = <&reg_3p3v>;
409+ HPVDD-supply = <&reg_gen_3p3>;
410+ SPRVDD-supply = <&reg_gen_3p3>;
411+ SPLVDD-supply = <&reg_gen_3p3>;
412+ AVDD-supply = <&reg_gen_3p3>;
413+ IOVDD-supply = <&reg_gen_3p3>;
423414 DVDD-supply = <&vgen4_reg>;
424415 reset-gpios = <&gpio3 3 GPIO_ACTIVE_LOW>;
425416 };
arch/arm64/boot/dts/ti/k3-am64-main.dtsi+6−5
@@ -42,12 +42,12 @@ · 41 unmodified lines
4242 };
4343 };
4444
45− dmss: dmss {
45+ dmss: bus@48000000 {
4646 compatible = "simple-mfd";
4747 #address-cells = <2>;
4848 #size-cells = <2>;
4949 dma-ranges;
50− ranges;
50+ ranges = <0x00 0x48000000 0x00 0x48000000 0x00 0x06400000>;
5151
5252 ti,sci-dev-id = <25>;
5353
@@ -134,7 +134,7 @@ · 80 unmodified lines
134134 };
135135 };
136136
137− dmsc: dmsc@44043000 {
137+ dmsc: system-controller@44043000 {
138138 compatible = "ti,k2g-sci";
139139 ti,host-id = <12>;
140140 mbox-names = "rx", "tx";
@@ -148,7 +148,7 @@ · 7 unmodified lines
148148 #power-domain-cells = <2>;
149149 };
150150
151− k3_clks: clocks {
151+ k3_clks: clock-controller {
152152 compatible = "ti,k2g-sci-clk";
153153 #clock-cells = <2>;
154154 };
@@ -373,8 +373,9 @@ · 218 unmodified lines
373373 clocks = <&k3_clks 145 0>;
374374 };
375375
376− main_gpio_intr: interrupt-controller0 {
376+ main_gpio_intr: interrupt-controller@a00000 {
377377 compatible = "ti,sci-intr";
378+ reg = <0x00 0x00a00000 0x00 0x800>;
378379 ti,intr-trigger-type = <1>;
379380 interrupt-controller;
380381 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi+2−1
@@ -74,8 +74,9 @@ · 73 unmodified lines
7474 clocks = <&k3_clks 148 0>;
7575 };
7676
77− mcu_gpio_intr: interrupt-controller1 {
77+ mcu_gpio_intr: interrupt-controller@4210000 {
7878 compatible = "ti,sci-intr";
79+ reg = <0x00 0x04210000 0x00 0x200>;
7980 ti,intr-trigger-type = <1>;
8081 interrupt-controller;
8182 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-am65-main.dtsi+6−4
@@ -433,8 +433,9 @@ · 432 unmodified lines
433433 #phy-cells = <0>;
434434 };
435435
436− intr_main_gpio: interrupt-controller0 {
436+ intr_main_gpio: interrupt-controller@a00000 {
437437 compatible = "ti,sci-intr";
438+ reg = <0x0 0x00a00000 0x0 0x400>;
438439 ti,intr-trigger-type = <1>;
439440 interrupt-controller;
440441 interrupt-parent = <&gic500>;
@@ -444,18 +445,19 @@ · 3 unmodified lines
444445 ti,interrupt-ranges = <0 392 32>;
445446 };
446447
447− main-navss {
448+ main_navss: bus@30800000 {
448449 compatible = "simple-mfd";
449450 #address-cells = <2>;
450451 #size-cells = <2>;
451− ranges;
452+ ranges = <0x0 0x30800000 0x0 0x30800000 0x0 0xbc00000>;
452453 dma-coherent;
453454 dma-ranges;
454455
455456 ti,sci-dev-id = <118>;
456457
457− intr_main_navss: interrupt-controller1 {
458+ intr_main_navss: interrupt-controller@310e0000 {
458459 compatible = "ti,sci-intr";
460+ reg = <0x0 0x310e0000 0x0 0x2000>;
459461 ti,intr-trigger-type = <4>;
460462 interrupt-controller;
461463 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi+2−2
@@ -116,11 +116,11 @@ · 115 unmodified lines
116116 };
117117 };
118118
119− mcu-navss {
119+ mcu_navss: bus@28380000 {
120120 compatible = "simple-mfd";
121121 #address-cells = <2>;
122122 #size-cells = <2>;
123− ranges;
123+ ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>;
124124 dma-coherent;
125125 dma-ranges;
126126
arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi+7−6
@@ -6,24 +6,24 @@ · 5 unmodified lines
66 */
77
88 &cbass_wakeup {
9− dmsc: dmsc {
9+ dmsc: system-controller@44083000 {
1010 compatible = "ti,am654-sci";
1111 ti,host-id = <12>;
12− #address-cells = <1>;
13− #size-cells = <1>;
14− ranges;
1512
1613 mbox-names = "rx", "tx";
1714
1815 mboxes= <&secure_proxy_main 11>,
1916 <&secure_proxy_main 13>;
2017
18+ reg-names = "debug_messages";
19+ reg = <0x44083000 0x1000>;
20+
2121 k3_pds: power-controller {
2222 compatible = "ti,sci-pm-domain";
2323 #power-domain-cells = <2>;
2424 };
2525
26− k3_clks: clocks {
26+ k3_clks: clock-controller {
2727 compatible = "ti,k2g-sci-clk";
2828 #clock-cells = <2>;
2929 };
@@ -69,8 +69,9 @@ · 39 unmodified lines
6969 power-domains = <&k3_pds 115 TI_SCI_PD_EXCLUSIVE>;
7070 };
7171
72− intr_wkup_gpio: interrupt-controller2 {
72+ intr_wkup_gpio: interrupt-controller@42200000 {
7373 compatible = "ti,sci-intr";
74+ reg = <0x42200000 0x200>;
7475 ti,intr-trigger-type = <1>;
7576 interrupt-controller;
7677 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-am654-base-board.dts+0−31
@@ -85,12 +85,6 @@ · 84 unmodified lines
8585 gpios = <&wkup_gpio0 27 GPIO_ACTIVE_LOW>;
8686 };
8787 };
88−
89− clk_ov5640_fixed: clock {
90− compatible = "fixed-clock";
91− #clock-cells = <0>;
92− clock-frequency = <24000000>;
93− };
9488 };
9589
9690 &wkup_pmx0 {
@@ -287,23 +281,6 @@ · 190 unmodified lines
287281 pinctrl-names = "default";
288282 pinctrl-0 = <&main_i2c1_pins_default>;
289283 clock-frequency = <400000>;
290−
291− ov5640: camera@3c {
292− compatible = "ovti,ov5640";
293− reg = <0x3c>;
294−
295− clocks = <&clk_ov5640_fixed>;
296− clock-names = "xclk";
297−
298− port {
299− csi2_cam0: endpoint {
300− remote-endpoint = <&csi2_phy0>;
301− clock-lanes = <0>;
302− data-lanes = <1 2>;
303− };
304− };
305− };
306−
307284 };
308285
309286 &main_i2c2 {
@@ -496,14 +473,6 @@ · 186 unmodified lines
496473 };
497474 };
498475
499−&csi2_0 {
500− csi2_phy0: endpoint {
501− remote-endpoint = <&csi2_cam0>;
502− clock-lanes = <0>;
503− data-lanes = <1 2>;
504− };
505−};
506−
507476 &mcu_cpsw {
508477 pinctrl-names = "default";
509478 pinctrl-0 = <&mcu_cpsw_pins_default &mcu_mdio_pins_default>;
arch/arm64/boot/dts/ti/k3-j7200-main.dtsi+6−2
@@ -68,8 +68,9 @@ · 67 unmodified lines
6868 };
6969 };
7070
71− main_gpio_intr: interrupt-controller0 {
71+ main_gpio_intr: interrupt-controller@a00000 {
7272 compatible = "ti,sci-intr";
73+ reg = <0x00 0x00a00000 0x00 0x800>;
7374 ti,intr-trigger-type = <1>;
7475 interrupt-controller;
7576 interrupt-parent = <&gic500>;
@@ -85,9 +86,12 @@ · 9 unmodified lines
8586 #size-cells = <2>;
8687 ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
8788 ti,sci-dev-id = <199>;
89+ dma-coherent;
90+ dma-ranges;
8891
89− main_navss_intr: interrupt-controller1 {
92+ main_navss_intr: interrupt-controller@310e0000 {
9093 compatible = "ti,sci-intr";
94+ reg = <0x00 0x310e0000 0x00 0x4000>;
9195 ti,intr-trigger-type = <4>;
9296 interrupt-controller;
9397 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi+4−3
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 */
77
88 &cbass_mcu_wakeup {
9− dmsc: dmsc@44083000 {
9+ dmsc: system-controller@44083000 {
1010 compatible = "ti,k2g-sci";
1111 ti,host-id = <12>;
1212
@@ -23,7 +23,7 @@ · 10 unmodified lines
2323 #power-domain-cells = <2>;
2424 };
2525
26− k3_clks: clocks {
26+ k3_clks: clock-controller {
2727 compatible = "ti,k2g-sci-clk";
2828 #clock-cells = <2>;
2929 };
@@ -96,8 +96,9 @@ · 66 unmodified lines
9696 clock-names = "fclk";
9797 };
9898
99− wkup_gpio_intr: interrupt-controller2 {
99+ wkup_gpio_intr: interrupt-controller@42200000 {
100100 compatible = "ti,sci-intr";
101+ reg = <0x00 0x42200000 0x00 0x400>;
101102 ti,intr-trigger-type = <1>;
102103 interrupt-controller;
103104 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi+6−4
@@ -76,8 +76,9 @@ · 75 unmodified lines
7676 };
7777 };
7878
79− main_gpio_intr: interrupt-controller0 {
79+ main_gpio_intr: interrupt-controller@a00000 {
8080 compatible = "ti,sci-intr";
81+ reg = <0x00 0x00a00000 0x00 0x800>;
8182 ti,intr-trigger-type = <1>;
8283 interrupt-controller;
8384 interrupt-parent = <&gic500>;
@@ -87,18 +88,19 @@ · 3 unmodified lines
8788 ti,interrupt-ranges = <8 392 56>;
8889 };
8990
90− main-navss {
91+ main_navss: bus@30000000 {
9192 compatible = "simple-mfd";
9293 #address-cells = <2>;
9394 #size-cells = <2>;
94− ranges;
95+ ranges = <0x00 0x30000000 0x00 0x30000000 0x00 0x0c400000>;
9596 dma-coherent;
9697 dma-ranges;
9798
9899 ti,sci-dev-id = <199>;
99100
100− main_navss_intr: interrupt-controller1 {
101+ main_navss_intr: interrupt-controller@310e0000 {
101102 compatible = "ti,sci-intr";
103+ reg = <0x0 0x310e0000 0x0 0x4000>;
102104 ti,intr-trigger-type = <4>;
103105 interrupt-controller;
104106 interrupt-parent = <&gic500>;
arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi+6−5
@@ -6,7 +6,7 @@ · 5 unmodified lines
66 */
77
88 &cbass_mcu_wakeup {
9− dmsc: dmsc@44083000 {
9+ dmsc: system-controller@44083000 {
1010 compatible = "ti,k2g-sci";
1111 ti,host-id = <12>;
1212
@@ -23,7 +23,7 @@ · 10 unmodified lines
2323 #power-domain-cells = <2>;
2424 };
2525
26− k3_clks: clocks {
26+ k3_clks: clock-controller {
2727 compatible = "ti,k2g-sci-clk";
2828 #clock-cells = <2>;
2929 };
@@ -96,8 +96,9 @@ · 66 unmodified lines
9696 clock-names = "fclk";
9797 };
9898
99− wkup_gpio_intr: interrupt-controller2 {
99+ wkup_gpio_intr: interrupt-controller@42200000 {
100100 compatible = "ti,sci-intr";
101+ reg = <0x00 0x42200000 0x00 0x400>;
101102 ti,intr-trigger-type = <1>;
102103 interrupt-controller;
103104 interrupt-parent = <&gic500>;
@@ -249,11 +250,11 @@ · 145 unmodified lines
249250 };
250251 };
251252
252− mcu-navss {
253+ mcu_navss: bus@28380000 {
253254 compatible = "simple-mfd";
254255 #address-cells = <2>;
255256 #size-cells = <2>;
256− ranges;
257+ ranges = <0x00 0x28380000 0x00 0x28380000 0x00 0x03880000>;
257258 dma-coherent;
258259 dma-ranges;
259260
arch/mips/mm/cache.c+14−16
@@ -158,31 +158,29 @@ unsigned long _page_cachable_default; · 157 unmodified lines
158158 EXPORT_SYMBOL(_page_cachable_default);
159159
160160 #define PM(p) __pgprot(_page_cachable_default | (p))
161−#define PVA(p) PM(_PAGE_VALID | _PAGE_ACCESSED | (p))
162161
163162 static inline void setup_protection_map(void)
164163 {
165164 protection_map[0] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
166− protection_map[1] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC);
167− protection_map[2] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
168− protection_map[3] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC);
169− protection_map[4] = PVA(_PAGE_PRESENT);
170− protection_map[5] = PVA(_PAGE_PRESENT);
171− protection_map[6] = PVA(_PAGE_PRESENT);
172− protection_map[7] = PVA(_PAGE_PRESENT);
165+ protection_map[1] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
166+ protection_map[2] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
167+ protection_map[3] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
168+ protection_map[4] = PM(_PAGE_PRESENT);
169+ protection_map[5] = PM(_PAGE_PRESENT);
170+ protection_map[6] = PM(_PAGE_PRESENT);
171+ protection_map[7] = PM(_PAGE_PRESENT);
173172
174173 protection_map[8] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_NO_READ);
175− protection_map[9] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC);
176− protection_map[10] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE |
174+ protection_map[9] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC);
175+ protection_map[10] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE |
177176 _PAGE_NO_READ);
178− protection_map[11] = PVA(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
179− protection_map[12] = PVA(_PAGE_PRESENT);
180− protection_map[13] = PVA(_PAGE_PRESENT);
181− protection_map[14] = PVA(_PAGE_PRESENT);
182− protection_map[15] = PVA(_PAGE_PRESENT);
177+ protection_map[11] = PM(_PAGE_PRESENT | _PAGE_NO_EXEC | _PAGE_WRITE);
178+ protection_map[12] = PM(_PAGE_PRESENT);
179+ protection_map[13] = PM(_PAGE_PRESENT);
180+ protection_map[14] = PM(_PAGE_PRESENT | _PAGE_WRITE);
181+ protection_map[15] = PM(_PAGE_PRESENT | _PAGE_WRITE);
183182 }
184183
185−#undef _PVA
186184 #undef PM
187185
188186 void cpu_cache_init(void)
arch/powerpc/include/asm/pte-walk.h+29−0
@@ -31,6 +31,35 @@ static inline pte_t *find_init_mm_pte(unsigned long ea, unsigned *hshift) · 30 unmodified lines
3131 pgd_t *pgdir = init_mm.pgd;
3232 return __find_linux_pte(pgdir, ea, NULL, hshift);
3333 }
34+
35+/*
36+ * Convert a kernel vmap virtual address (vmalloc or ioremap space) to a
37+ * physical address, without taking locks. This can be used in real-mode.
38+ */
39+static inline phys_addr_t ppc_find_vmap_phys(unsigned long addr)
40+{
41+ pte_t *ptep;
42+ phys_addr_t pa;
43+ int hugepage_shift;
44+
45+ /*
46+ * init_mm does not free page tables, and does not do THP. It may
47+ * have huge pages from huge vmalloc / ioremap etc.
48+ */
49+ ptep = find_init_mm_pte(addr, &hugepage_shift);
50+ if (WARN_ON(!ptep))
51+ return 0;
52+
53+ pa = PFN_PHYS(pte_pfn(*ptep));
54+
55+ if (!hugepage_shift)
56+ hugepage_shift = PAGE_SHIFT;
57+
58+ pa |= addr & ((1ul << hugepage_shift) - 1);
59+
60+ return pa;
61+}
62+
3463 /*
3564 * This is what we should always use. Any other lockless page table lookup needs
3665 * careful audit against THP split.
arch/powerpc/kernel/eeh.c+1−22
@@ -346,28 +346,7 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity) · 345 unmodified lines
346346 */
347347 static inline unsigned long eeh_token_to_phys(unsigned long token)
348348 {
349− pte_t *ptep;
350− unsigned long pa;
351− int hugepage_shift;
352−
353− /*
354− * We won't find hugepages here(this is iomem). Hence we are not
355− * worried about _PAGE_SPLITTING/collapse. Also we will not hit
356− * page table free, because of init_mm.
357− */
358− ptep = find_init_mm_pte(token, &hugepage_shift);
359− if (!ptep)
360− return token;
361−
362− pa = pte_pfn(*ptep);
363−
364− /* On radix we can do hugepage mappings for io, so handle that */
365− if (!hugepage_shift)
366− hugepage_shift = PAGE_SHIFT;
367−
368− pa <<= PAGE_SHIFT;
369− pa |= token & ((1ul << hugepage_shift) - 1);
370− return pa;
349+ return ppc_find_vmap_phys(token);
371350 }
372351
373352 /*
arch/powerpc/kernel/io-workarounds.c+3−13
@@ -55,7 +55,6 @@ static struct iowa_bus *iowa_pci_find(unsigned long vaddr, unsigned long paddr) · 54 unmodified lines
5555 #ifdef CONFIG_PPC_INDIRECT_MMIO
5656 struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr)
5757 {
58− unsigned hugepage_shift;
5958 struct iowa_bus *bus;
6059 int token;
6160
@@ -65,22 +64,13 @@ struct iowa_bus *iowa_mem_find_bus(const PCI_IO_ADDR addr) · 3 unmodified lines
6564 bus = &iowa_busses[token - 1];
6665 else {
6766 unsigned long vaddr, paddr;
68− pte_t *ptep;
6967
7068 vaddr = (unsigned long)PCI_FIX_ADDR(addr);
7169 if (vaddr < PHB_IO_BASE || vaddr >= PHB_IO_END)
7270 return NULL;
73− /*
74− * We won't find huge pages here (iomem). Also can't hit
75− * a page table free due to init_mm
76− */
77− ptep = find_init_mm_pte(vaddr, &hugepage_shift);
78− if (ptep == NULL)
79− paddr = 0;
80− else {
81− WARN_ON(hugepage_shift);
82− paddr = pte_pfn(*ptep) << PAGE_SHIFT;
83− }
71+
72+ paddr = ppc_find_vmap_phys(vaddr);
73+
8474 bus = iowa_pci_find(vaddr, paddr);
8575
8676 if (bus == NULL)
arch/powerpc/kernel/iommu.c+5−6
@@ -898,7 +898,6 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, · 897 unmodified lines
898898 unsigned int order;
899899 unsigned int nio_pages, io_order;
900900 struct page *page;
901− size_t size_io = size;
902901
903902 size = PAGE_ALIGN(size);
904903 order = get_order(size);
@@ -925,9 +924,8 @@ void *iommu_alloc_coherent(struct device *dev, struct iommu_table *tbl, · 20 unmodified lines
925924 memset(ret, 0, size);
926925
927926 /* Set up tces to cover the allocated range */
928− size_io = IOMMU_PAGE_ALIGN(size_io, tbl);
929− nio_pages = size_io >> tbl->it_page_shift;
930− io_order = get_iommu_order(size_io, tbl);
927+ nio_pages = size >> tbl->it_page_shift;
928+ io_order = get_iommu_order(size, tbl);
931929 mapping = iommu_alloc(dev, tbl, ret, nio_pages, DMA_BIDIRECTIONAL,
932930 mask >> tbl->it_page_shift, io_order, 0);
933931 if (mapping == DMA_MAPPING_ERROR) {
@@ -942,9 +940,10 @@ void iommu_free_coherent(struct iommu_table *tbl, size_t size, · 8 unmodified lines
942940 void *vaddr, dma_addr_t dma_handle)
943941 {
944942 if (tbl) {
945− size_t size_io = IOMMU_PAGE_ALIGN(size, tbl);
946− unsigned int nio_pages = size_io >> tbl->it_page_shift;
943+ unsigned int nio_pages;
947944
945+ size = PAGE_ALIGN(size);
946+ nio_pages = size >> tbl->it_page_shift;
948947 iommu_free(tbl, dma_handle, nio_pages);
949948 size = PAGE_ALIGN(size);
950949 free_pages((unsigned long)vaddr, get_order(size));
arch/powerpc/kernel/kprobes.c+2−2
@@ -108,7 +108,6 @@ int arch_prepare_kprobe(struct kprobe *p) · 107 unmodified lines
108108 int ret = 0;
109109 struct kprobe *prev;
110110 struct ppc_inst insn = ppc_inst_read((struct ppc_inst *)p->addr);
111− struct ppc_inst prefix = ppc_inst_read((struct ppc_inst *)(p->addr - 1));
112111
113112 if ((unsigned long)p->addr & 0x03) {
114113 printk("Attempt to register kprobe at an unaligned address\n");
@@ -116,7 +115,8 @@ int arch_prepare_kprobe(struct kprobe *p) · 1 unmodified line
116115 } else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
117116 printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
118117 ret = -EINVAL;
119− } else if (ppc_inst_prefixed(prefix)) {
118+ } else if ((unsigned long)p->addr & ~PAGE_MASK &&
119+ ppc_inst_prefixed(ppc_inst_read((struct ppc_inst *)(p->addr - 1)))) {
120120 printk("Cannot register a kprobe on the second word of prefixed instruction\n");
121121 ret = -EINVAL;
122122 }
arch/powerpc/kvm/book3s_hv.c+0−1
@@ -4455,7 +4455,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu) · 4454 unmodified lines
44554455 mtspr(SPRN_EBBRR, ebb_regs[1]);
44564456 mtspr(SPRN_BESCR, ebb_regs[2]);
44574457 mtspr(SPRN_TAR, user_tar);
4458− mtspr(SPRN_FSCR, current->thread.fscr);
44594458 }
44604459 mtspr(SPRN_VRSAVE, user_vrsave);
44614460
arch/powerpc/kvm/book3s_hv_rm_mmu.c+2−13
@@ -23,20 +23,9 @@ · 22 unmodified lines
2323 #include <asm/pte-walk.h>
2424
2525 /* Translate address of a vmalloc'd thing to a linear map address */
26−static void *real_vmalloc_addr(void *x)
26+static void *real_vmalloc_addr(void *addr)
2727 {
28− unsigned long addr = (unsigned long) x;
29− pte_t *p;
30− /*
31− * assume we don't have huge pages in vmalloc space...
32− * So don't worry about THP collapse/split. Called
33− * Only in realmode with MSR_EE = 0, hence won't need irq_save/restore.
34− */
35− p = find_init_mm_pte(addr, NULL);
36− if (!p || !pte_present(*p))
37− return NULL;
38− addr = (pte_pfn(*p) << PAGE_SHIFT) | (addr & ~PAGE_MASK);
39− return __va(addr);
28+ return __va(ppc_find_vmap_phys((unsigned long)addr));
4029 }
4130
4231 /* Return 1 if we need to do a global tlbie, 0 if we can use tlbiel */
arch/powerpc/kvm/book3s_hv_rmhandlers.S+7−0
@@ -59,6 +59,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_300) · 58 unmodified lines
5959 #define STACK_SLOT_UAMOR (SFS-88)
6060 #define STACK_SLOT_DAWR1 (SFS-96)
6161 #define STACK_SLOT_DAWRX1 (SFS-104)
62+#define STACK_SLOT_FSCR (SFS-112)
6263 /* the following is used by the P9 short path */
6364 #define STACK_SLOT_NVGPRS (SFS-152) /* 18 gprs */
6465
@@ -686,6 +687,8 @@ BEGIN_FTR_SECTION · 621 unmodified lines
686687 std r6, STACK_SLOT_DAWR0(r1)
687688 std r7, STACK_SLOT_DAWRX0(r1)
688689 std r8, STACK_SLOT_IAMR(r1)
690+ mfspr r5, SPRN_FSCR
691+ std r5, STACK_SLOT_FSCR(r1)
689692 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
690693 BEGIN_FTR_SECTION
691694 mfspr r6, SPRN_DAWR1
@@ -1663,6 +1666,10 @@ FTR_SECTION_ELSE · 971 unmodified lines
16631666 ld r7, STACK_SLOT_HFSCR(r1)
16641667 mtspr SPRN_HFSCR, r7
16651668 ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_300)
1669+BEGIN_FTR_SECTION
1670+ ld r5, STACK_SLOT_FSCR(r1)
1671+ mtspr SPRN_FSCR, r5
1672+END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S)
16661673 /*
16671674 * Restore various registers to 0, where non-zero values
16681675 * set by the guest could disrupt the host.
arch/riscv/Kconfig+9−9
@@ -61,11 +61,11 @@ config RISCV · 60 unmodified lines
6161 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
6262 select HANDLE_DOMAIN_IRQ
6363 select HAVE_ARCH_AUDITSYSCALL
64− select HAVE_ARCH_JUMP_LABEL
65− select HAVE_ARCH_JUMP_LABEL_RELATIVE
64+ select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL
65+ select HAVE_ARCH_JUMP_LABEL_RELATIVE if !XIP_KERNEL
6666 select HAVE_ARCH_KASAN if MMU && 64BIT
6767 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
68− select HAVE_ARCH_KGDB
68+ select HAVE_ARCH_KGDB if !XIP_KERNEL
6969 select HAVE_ARCH_KGDB_QXFER_PKT
7070 select HAVE_ARCH_MMAP_RND_BITS if MMU
7171 select HAVE_ARCH_SECCOMP_FILTER
@@ -80,9 +80,9 @@ config RISCV · 8 unmodified lines
8080 select HAVE_GCC_PLUGINS
8181 select HAVE_GENERIC_VDSO if MMU && 64BIT
8282 select HAVE_IRQ_TIME_ACCOUNTING
83− select HAVE_KPROBES
84− select HAVE_KPROBES_ON_FTRACE
85− select HAVE_KRETPROBES
83+ select HAVE_KPROBES if !XIP_KERNEL
84+ select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
85+ select HAVE_KRETPROBES if !XIP_KERNEL
8686 select HAVE_PCI
8787 select HAVE_PERF_EVENTS
8888 select HAVE_PERF_REGS
@@ -231,11 +231,11 @@ config ARCH_RV64I · 142 unmodified lines
231231 bool "RV64I"
232232 select 64BIT
233233 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
234− select HAVE_DYNAMIC_FTRACE if MMU && $(cc-option,-fpatchable-function-entry=8)
234+ select HAVE_DYNAMIC_FTRACE if !XIP_KERNEL && MMU && $(cc-option,-fpatchable-function-entry=8)
235235 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
236− select HAVE_FTRACE_MCOUNT_RECORD
236+ select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
237237 select HAVE_FUNCTION_GRAPH_TRACER
238− select HAVE_FUNCTION_TRACER
238+ select HAVE_FUNCTION_TRACER if !XIP_KERNEL
239239 select SWIOTLB if MMU
240240
241241 endchoice
arch/riscv/Makefile+9−0
@@ -38,6 +38,15 @@ else · 37 unmodified lines
3838 KBUILD_LDFLAGS += -melf32lriscv
3939 endif
4040
41+ifeq ($(CONFIG_LD_IS_LLD),y)
42+ KBUILD_CFLAGS += -mno-relax
43+ KBUILD_AFLAGS += -mno-relax
44+ifneq ($(LLVM_IAS),1)
45+ KBUILD_CFLAGS += -Wa,-mno-relax
46+ KBUILD_AFLAGS += -Wa,-mno-relax
47+endif
48+endif
49+
4150 # ISA string setting
4251 riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
4352 riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
arch/riscv/boot/dts/microchip/Makefile+1−0
@@ -1,2 +1,3 @@
11 # SPDX-License-Identifier: GPL-2.0
22 dtb-$(CONFIG_SOC_MICROCHIP_POLARFIRE) += microchip-mpfs-icicle-kit.dtb
3+obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/riscv/boot/dts/sifive/Makefile+1−0
@@ -1,3 +1,4 @@
11 # SPDX-License-Identifier: GPL-2.0
22 dtb-$(CONFIG_SOC_SIFIVE) += hifive-unleashed-a00.dtb \
33 hifive-unmatched-a00.dtb
4+obj-$(CONFIG_BUILTIN_DTB) += $(addsuffix .o, $(dtb-y))
arch/riscv/errata/sifive/Makefile+1−1
@@ -1,2 +1,2 @@
1−obj-y += errata_cip_453.o
1+obj-$(CONFIG_ERRATA_SIFIVE_CIP_453) += errata_cip_453.o
22 obj-y += errata.o
arch/riscv/include/asm/alternative-macros.h+2−2
@@ -51,7 +51,7 @@ · 50 unmodified lines
5151 REG_ASM " " newlen "\n" \
5252 ".word " errata_id "\n"
5353
54−#define ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c) \
54+#define ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c) \
5555 ".if " __stringify(enable) " == 1\n" \
5656 ".pushsection .alternative, \"a\"\n" \
5757 ALT_ENTRY("886b", "888f", __stringify(vendor_id), __stringify(errata_id), "889f - 888f") \
@@ -69,7 +69,7 @@ · 11 unmodified lines
6969 "886 :\n" \
7070 old_c "\n" \
7171 "887 :\n" \
72− ALT_NEW_CONSTENT(vendor_id, errata_id, enable, new_c)
72+ ALT_NEW_CONTENT(vendor_id, errata_id, enable, new_c)
7373
7474 #define _ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, CONFIG_k) \
7575 __ALTERNATIVE_CFG(old_c, new_c, vendor_id, errata_id, IS_ENABLED(CONFIG_k))
arch/riscv/kernel/setup.c+2−2
@@ -231,13 +231,13 @@ static void __init init_resources(void) · 230 unmodified lines
231231
232232 /* Clean-up any unused pre-allocated resources */
233233 mem_res_sz = (num_resources - res_idx + 1) * sizeof(*mem_res);
234− memblock_free((phys_addr_t) mem_res, mem_res_sz);
234+ memblock_free(__pa(mem_res), mem_res_sz);
235235 return;
236236
237237 error:
238238 /* Better an empty resource tree than an inconsistent one */
239239 release_child_resources(&iomem_resource);
240− memblock_free((phys_addr_t) mem_res, mem_res_sz);
240+ memblock_free(__pa(mem_res), mem_res_sz);
241241 }
242242
243243
arch/riscv/kernel/traps.c+9−4
@@ -86,8 +86,13 @@ static void do_trap_error(struct pt_regs *regs, int signo, int code, · 85 unmodified lines
8686 }
8787 }
8888
89+#if defined (CONFIG_XIP_KERNEL) && defined (CONFIG_RISCV_ERRATA_ALTERNATIVE)
90+#define __trap_section __section(".xip.traps")
91+#else
92+#define __trap_section
93+#endif
8994 #define DO_ERROR_INFO(name, signo, code, str) \
90−asmlinkage __visible void name(struct pt_regs *regs) \
95+asmlinkage __visible __trap_section void name(struct pt_regs *regs) \
9196 { \
9297 do_trap_error(regs, signo, code, regs->epc, "Oops - " str); \
9398 }
@@ -111,7 +116,7 @@ DO_ERROR_INFO(do_trap_store_misaligned, · 17 unmodified lines
111116 int handle_misaligned_load(struct pt_regs *regs);
112117 int handle_misaligned_store(struct pt_regs *regs);
113118
114−asmlinkage void do_trap_load_misaligned(struct pt_regs *regs)
119+asmlinkage void __trap_section do_trap_load_misaligned(struct pt_regs *regs)
115120 {
116121 if (!handle_misaligned_load(regs))
117122 return;
@@ -119,7 +124,7 @@ asmlinkage void do_trap_load_misaligned(struct pt_regs *regs) · 1 unmodified line
119124 "Oops - load address misaligned");
120125 }
121126
122−asmlinkage void do_trap_store_misaligned(struct pt_regs *regs)
127+asmlinkage void __trap_section do_trap_store_misaligned(struct pt_regs *regs)
123128 {
124129 if (!handle_misaligned_store(regs))
125130 return;
@@ -146,7 +151,7 @@ static inline unsigned long get_break_insn_length(unsigned long pc) · 20 unmodified lines
146151 return GET_INSN_LENGTH(insn);
147152 }
148153
149−asmlinkage __visible void do_trap_break(struct pt_regs *regs)
154+asmlinkage __visible __trap_section void do_trap_break(struct pt_regs *regs)
150155 {
151156 #ifdef CONFIG_KPROBES
152157 if (kprobe_single_step_handler(regs))
arch/riscv/kernel/vmlinux-xip.lds.S+14−1
@@ -99,9 +99,22 @@ SECTIONS · 98 unmodified lines
9999 }
100100 PERCPU_SECTION(L1_CACHE_BYTES)
101101
102− . = ALIGN(PAGE_SIZE);
102+ . = ALIGN(8);
103+ .alternative : {
104+ __alt_start = .;
105+ *(.alternative)
106+ __alt_end = .;
107+ }
103108 __init_end = .;
104109
110+ . = ALIGN(16);
111+ .xip.traps : {
112+ __xip_traps_start = .;
113+ *(.xip.traps)
114+ __xip_traps_end = .;
115+ }
116+
117+ . = ALIGN(PAGE_SIZE);
105118 .sdata : {
106119 __global_pointer$ = . + 0x800;
107120 *(.sdata*)
arch/riscv/mm/init.c+6−2
@@ -746,14 +746,18 @@ void __init protect_kernel_text_data(void) · 745 unmodified lines
746746 unsigned long init_data_start = (unsigned long)__init_data_begin;
747747 unsigned long rodata_start = (unsigned long)__start_rodata;
748748 unsigned long data_start = (unsigned long)_data;
749− unsigned long max_low = (unsigned long)(__va(PFN_PHYS(max_low_pfn)));
749+#if defined(CONFIG_64BIT) && defined(CONFIG_MMU)
750+ unsigned long end_va = kernel_virt_addr + load_sz;
751+#else
752+ unsigned long end_va = (unsigned long)(__va(PFN_PHYS(max_low_pfn)));
753+#endif
750754
751755 set_memory_ro(text_start, (init_text_start - text_start) >> PAGE_SHIFT);
752756 set_memory_ro(init_text_start, (init_data_start - init_text_start) >> PAGE_SHIFT);
753757 set_memory_nx(init_data_start, (rodata_start - init_data_start) >> PAGE_SHIFT);
754758 /* rodata section is marked readonly in mark_rodata_ro */
755759 set_memory_nx(rodata_start, (data_start - rodata_start) >> PAGE_SHIFT);
756− set_memory_nx(data_start, (max_low - data_start) >> PAGE_SHIFT);
760+ set_memory_nx(data_start, (end_va - data_start) >> PAGE_SHIFT);
757761 }
758762
759763 void mark_rodata_ro(void)
arch/x86/Makefile+3−2
@@ -200,8 +200,9 @@ endif · 199 unmodified lines
200200 KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
201201
202202 ifdef CONFIG_LTO_CLANG
203−KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \
204− -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
203+ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
204+KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8)
205+endif
205206 endif
206207
207208 ifdef CONFIG_X86_NEED_RELOCS
arch/x86/events/intel/uncore_snbep.c+6−3
@@ -1406,6 +1406,8 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool · 1405 unmodified lines
14061406 die_id = i;
14071407 else
14081408 die_id = topology_phys_to_logical_pkg(i);
1409+ if (die_id < 0)
1410+ die_id = -ENODEV;
14091411 map->pbus_to_dieid[bus] = die_id;
14101412 break;
14111413 }
@@ -1452,14 +1454,14 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool · 40 unmodified lines
14521454 i = -1;
14531455 if (reverse) {
14541456 for (bus = 255; bus >= 0; bus--) {
1455− if (map->pbus_to_dieid[bus] >= 0)
1457+ if (map->pbus_to_dieid[bus] != -1)
14561458 i = map->pbus_to_dieid[bus];
14571459 else
14581460 map->pbus_to_dieid[bus] = i;
14591461 }
14601462 } else {
14611463 for (bus = 0; bus <= 255; bus++) {
1462− if (map->pbus_to_dieid[bus] >= 0)
1464+ if (map->pbus_to_dieid[bus] != -1)
14631465 i = map->pbus_to_dieid[bus];
14641466 else
14651467 map->pbus_to_dieid[bus] = i;
@@ -5097,9 +5099,10 @@ static struct intel_uncore_type icx_uncore_m2m = { · 3631 unmodified lines
50975099 .perf_ctr = SNR_M2M_PCI_PMON_CTR0,
50985100 .event_ctl = SNR_M2M_PCI_PMON_CTL0,
50995101 .event_mask = SNBEP_PMON_RAW_EVENT_MASK,
5102+ .event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
51005103 .box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
51015104 .ops = &snr_m2m_uncore_pci_ops,
5102− .format_group = &skx_uncore_format_group,
5105+ .format_group = &snr_m2m_uncore_format_group,
51035106 };
51045107
51055108 static struct attribute *icx_upi_uncore_formats_attr[] = {
arch/x86/include/asm/apic.h+1−0
@@ -174,6 +174,7 @@ static inline int apic_is_clustered_box(void) · 173 unmodified lines
174174 extern int setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask);
175175 extern void lapic_assign_system_vectors(void);
176176 extern void lapic_assign_legacy_vector(unsigned int isairq, bool replace);
177+extern void lapic_update_legacy_vectors(void);
177178 extern void lapic_online(void);
178179 extern void lapic_offline(void);
179180 extern bool apic_needs_pit(void);
arch/x86/include/asm/disabled-features.h+2−5
@@ -56,11 +56,8 @@ · 55 unmodified lines
5656 # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
5757 #endif
5858
59−#ifdef CONFIG_IOMMU_SUPPORT
60−# define DISABLE_ENQCMD 0
61−#else
62−# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
63−#endif
59+/* Force disable because it's broken beyond repair */
60+#define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
6461
6562 #ifdef CONFIG_X86_SGX
6663 # define DISABLE_SGX 0
arch/x86/include/asm/fpu/api.h+1−5
@@ -106,10 +106,6 @@ extern int cpu_has_xfeatures(u64 xfeatures_mask, const char **feature_name); · 105 unmodified lines
106106 */
107107 #define PASID_DISABLED 0
108108
109−#ifdef CONFIG_IOMMU_SUPPORT
110−/* Update current's PASID MSR/state by mm's PASID. */
111−void update_pasid(void);
112−#else
113109 static inline void update_pasid(void) { }
114−#endif
110+
115111 #endif /* _ASM_X86_FPU_API_H */
arch/x86/include/asm/fpu/internal.h+0−7
@@ -584,13 +584,6 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) · 583 unmodified lines
584584 pkru_val = pk->pkru;
585585 }
586586 __write_pkru(pkru_val);
587−
588− /*
589− * Expensive PASID MSR write will be avoided in update_pasid() because
590− * TIF_NEED_FPU_LOAD was set. And the PASID state won't be updated
591− * unless it's different from mm->pasid to reduce overhead.
592− */
593− update_pasid();
594587 }
595588
596589 #endif /* _ASM_X86_FPU_INTERNAL_H */
arch/x86/include/asm/thermal.h+3−1
@@ -3,11 +3,13 @@ · 2 unmodified lines
33 #define _ASM_X86_THERMAL_H
44
55 #ifdef CONFIG_X86_THERMAL_VECTOR
6+void therm_lvt_init(void);
67 void intel_init_thermal(struct cpuinfo_x86 *c);
78 bool x86_thermal_enabled(void);
89 void intel_thermal_interrupt(void);
910 #else
10−static inline void intel_init_thermal(struct cpuinfo_x86 *c) { }
11+static inline void therm_lvt_init(void) { }
12+static inline void intel_init_thermal(struct cpuinfo_x86 *c) { }
1113 #endif
1214
1315 #endif /* _ASM_X86_THERMAL_H */
arch/x86/kernel/alternative.c+46−18
@@ -182,42 +182,70 @@ done: · 181 unmodified lines
182182 n_dspl, (unsigned long)orig_insn + n_dspl + repl_len);
183183 }
184184
185+/*
186+ * optimize_nops_range() - Optimize a sequence of single byte NOPs (0x90)
187+ *
188+ * @instr: instruction byte stream
189+ * @instrlen: length of the above
190+ * @off: offset within @instr where the first NOP has been detected
191+ *
192+ * Return: number of NOPs found (and replaced).
193+ */
194+static __always_inline int optimize_nops_range(u8 *instr, u8 instrlen, int off)
195+{
196+ unsigned long flags;
197+ int i = off, nnops;
198+
199+ while (i < instrlen) {
200+ if (instr[i] != 0x90)
201+ break;
202+
203+ i++;
204+ }
205+
206+ nnops = i - off;
207+
208+ if (nnops <= 1)
209+ return nnops;
210+
211+ local_irq_save(flags);
212+ add_nops(instr + off, nnops);
213+ local_irq_restore(flags);
214+
215+ DUMP_BYTES(instr, instrlen, "%px: [%d:%d) optimized NOPs: ", instr, off, i);
216+
217+ return nnops;
218+}
219+
185220 /*
186221 * "noinline" to cause control flow change and thus invalidate I$ and
187222 * cause refetch after modification.
188223 */
189224 static void __init_or_module noinline optimize_nops(struct alt_instr *a, u8 *instr)
190225 {
191− unsigned long flags;
192226 struct insn insn;
193− int nop, i = 0;
227+ int i = 0;
194228
195229 /*
196− * Jump over the non-NOP insns, the remaining bytes must be single-byte
197− * NOPs, optimize them.
230+ * Jump over the non-NOP insns and optimize single-byte NOPs into bigger
231+ * ones.
198232 */
199233 for (;;) {
200234 if (insn_decode_kernel(&insn, &instr[i]))
201235 return;
202236
237+ /*
238+ * See if this and any potentially following NOPs can be
239+ * optimized.
240+ */
203241 if (insn.length == 1 && insn.opcode.bytes[0] == 0x90)
204− break;
205−
206− if ((i += insn.length) >= a->instrlen)
207− return;
208− }
242+ i += optimize_nops_range(instr, a->instrlen, i);
243+ else
244+ i += insn.length;
209245
210− for (nop = i; i < a->instrlen; i++) {
211− if (WARN_ONCE(instr[i] != 0x90, "Not a NOP at 0x%px\n", &instr[i]))
246+ if (i >= a->instrlen)
212247 return;
213248 }
214−
215− local_irq_save(flags);
216− add_nops(instr + nop, i - nop);
217− local_irq_restore(flags);
218−
219− DUMP_BYTES(instr, a->instrlen, "%px: [%d:%d) optimized NOPs: ",
220− instr, nop, a->instrlen);
221249 }
222250
223251 /*
arch/x86/kernel/apic/apic.c+1−0
@@ -2604,6 +2604,7 @@ static void __init apic_bsp_setup(bool upmode) · 2603 unmodified lines
26042604 end_local_APIC_setup();
26052605 irq_remap_enable_fault_handling();
26062606 setup_IO_APIC();
2607+ lapic_update_legacy_vectors();
26072608 }
26082609
26092610 #ifdef CONFIG_UP_LATE_INIT
arch/x86/kernel/apic/vector.c+20−0
@@ -738,6 +738,26 @@ void lapic_assign_legacy_vector(unsigned int irq, bool replace) · 737 unmodified lines
738738 irq_matrix_assign_system(vector_matrix, ISA_IRQ_VECTOR(irq), replace);
739739 }
740740
741+void __init lapic_update_legacy_vectors(void)
742+{
743+ unsigned int i;
744+
745+ if (IS_ENABLED(CONFIG_X86_IO_APIC) && nr_ioapics > 0)
746+ return;
747+
748+ /*
749+ * If the IO/APIC is disabled via config, kernel command line or
750+ * lack of enumeration then all legacy interrupts are routed
751+ * through the PIC. Make sure that they are marked as legacy
752+ * vectors. PIC_CASCADE_IRQ has already been marked in
753+ * lapic_assign_system_vectors().
754+ */
755+ for (i = 0; i < nr_legacy_irqs(); i++) {
756+ if (i != PIC_CASCADE_IR)
757+ lapic_assign_legacy_vector(i, true);
758+ }
759+}
760+
741761 void __init lapic_assign_system_vectors(void)
742762 {
743763 unsigned int i, vector = 0;
arch/x86/kernel/cpu/perfctr-watchdog.c+2−2
@@ -63,7 +63,7 @@ static inline unsigned int nmi_perfctr_msr_to_bit(unsigned int msr) · 62 unmodified lines
6363 case 15:
6464 return msr - MSR_P4_BPU_PERFCTR0;
6565 }
66− fallthrough;
66+ break;
6767 case X86_VENDOR_ZHAOXIN:
6868 case X86_VENDOR_CENTAUR:
6969 return msr - MSR_ARCH_PERFMON_PERFCTR0;
@@ -96,7 +96,7 @@ static inline unsigned int nmi_evntsel_msr_to_bit(unsigned int msr) · 26 unmodified lines
9696 case 15:
9797 return msr - MSR_P4_BSU_ESCR0;
9898 }
99− fallthrough;
99+ break;
100100 case X86_VENDOR_ZHAOXIN:
101101 case X86_VENDOR_CENTAUR:
102102 return msr - MSR_ARCH_PERFMON_EVENTSEL0;
arch/x86/kernel/fpu/xstate.c+0−57
@@ -1402,60 +1402,3 @@ int proc_pid_arch_status(struct seq_file *m, struct pid_namespace *ns, · 1401 unmodified lines
14021402 return 0;
14031403 }
14041404 #endif /* CONFIG_PROC_PID_ARCH_STATUS */
1405−
1406−#ifdef CONFIG_IOMMU_SUPPORT
1407−void update_pasid(void)
1408−{
1409− u64 pasid_state;
1410− u32 pasid;
1411−
1412− if (!cpu_feature_enabled(X86_FEATURE_ENQCMD))
1413− return;
1414−
1415− if (!current->mm)
1416− return;
1417−
1418− pasid = READ_ONCE(current->mm->pasid);
1419− /* Set the valid bit in the PASID MSR/state only for valid pasid. */
1420− pasid_state = pasid == PASID_DISABLED ?
1421− pasid : pasid | MSR_IA32_PASID_VALID;
1422−
1423− /*
1424− * No need to hold fregs_lock() since the task's fpstate won't
1425− * be changed by others (e.g. ptrace) while the task is being
1426− * switched to or is in IPI.
1427− */
1428− if (!test_thread_flag(TIF_NEED_FPU_LOAD)) {
1429− /* The MSR is active and can be directly updated. */
1430− wrmsrl(MSR_IA32_PASID, pasid_state);
1431− } else {
1432− struct fpu *fpu = &current->thread.fpu;
1433− struct ia32_pasid_state *ppasid_state;
1434− struct xregs_state *xsave;
1435−
1436− /*
1437− * The CPU's xstate registers are not currently active. Just
1438− * update the PASID state in the memory buffer here. The
1439− * PASID MSR will be loaded when returning to user mode.
1440− */
1441− xsave = &fpu->state.xsave;
1442− xsave->header.xfeatures |= XFEATURE_MASK_PASID;
1443− ppasid_state = get_xsave_addr(xsave, XFEATURE_PASID);
1444− /*
1445− * Since XFEATURE_MASK_PASID is set in xfeatures, ppasid_state
1446− * won't be NULL and no need to check its value.
1447− *
1448− * Only update the task's PASID state when it's different
1449− * from the mm's pasid.
1450− */
1451− if (ppasid_state->pasid != pasid_state) {
1452− /*
1453− * Invalid fpregs so that state restoring will pick up
1454− * the PASID state.
1455− */
1456− __fpu_invalidate_fpregs_state(fpu);
1457− ppasid_state->pasid = pasid_state;
1458− }
1459− }
1460−}
1461−#endif /* CONFIG_IOMMU_SUPPORT */
arch/x86/kernel/setup.c+30−14
@@ -44,6 +44,7 @@ · 43 unmodified lines
4444 #include <asm/pci-direct.h>
4545 #include <asm/prom.h>
4646 #include <asm/proto.h>
47+#include <asm/thermal.h>
4748 #include <asm/unwind.h>
4849 #include <asm/vsyscall.h>
4950 #include <linux/vmalloc.h>
@@ -637,11 +638,11 @@ static void __init trim_snb_memory(void) · 587 unmodified lines
637638 * them from accessing certain memory ranges, namely anything below
638639 * 1M and in the pages listed in bad_pages[] above.
639640 *
640− * To avoid these pages being ever accessed by SNB gfx devices
641− * reserve all memory below the 1 MB mark and bad_pages that have
642− * not already been reserved at boot time.
641+ * To avoid these pages being ever accessed by SNB gfx devices reserve
642+ * bad_pages that have not already been reserved at boot time.
643+ * All memory below the 1 MB mark is anyway reserved later during
644+ * setup_arch(), so there is no need to reserve it here.
643645 */
644− memblock_reserve(0, 1<<20);
645646
646647 for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
647648 if (memblock_reserve(bad_pages[i], PAGE_SIZE))
@@ -733,14 +734,14 @@ static void __init early_reserve_memory(void) · 85 unmodified lines
733734 * The first 4Kb of memory is a BIOS owned area, but generally it is
734735 * not listed as such in the E820 table.
735736 *
736− * Reserve the first memory page and typically some additional
737− * memory (64KiB by default) since some BIOSes are known to corrupt
738− * low memory. See the Kconfig help text for X86_RESERVE_LOW.
737+ * Reserve the first 64K of memory since some BIOSes are known to
738+ * corrupt low memory. After the real mode trampoline is allocated the
739+ * rest of the memory below 640k is reserved.
739740 *
740741 * In addition, make sure page 0 is always reserved because on
741742 * systems with L1TF its contents can be leaked to user processes.
742743 */
743− memblock_reserve(0, ALIGN(reserve_low, PAGE_SIZE));
744+ memblock_reserve(0, SZ_64K);
744745
745746 early_reserve_initrd();
746747
@@ -751,6 +752,7 @@ static void __init early_reserve_memory(void) · 4 unmodified lines
751752
752753 reserve_ibft_region();
753754 reserve_bios_regions();
755+ trim_snb_memory();
754756 }
755757
756758 /*
@@ -1081,14 +1083,20 @@ void __init setup_arch(char **cmdline_p) · 324 unmodified lines
10811083 (max_pfn_mapped<<PAGE_SHIFT) - 1);
10821084 #endif
10831085
1084− reserve_real_mode();
1085−
10861086 /*
1087− * Reserving memory causing GPU hangs on Sandy Bridge integrated
1088− * graphics devices should be done after we allocated memory under
1089− * 1M for the real mode trampoline.
1087+ * Find free memory for the real mode trampoline and place it
1088+ * there.
1089+ * If there is not enough free memory under 1M, on EFI-enabled
1090+ * systems there will be additional attempt to reclaim the memory
1091+ * for the real mode trampoline at efi_free_boot_services().
1092+ *
1093+ * Unconditionally reserve the entire first 1M of RAM because
1094+ * BIOSes are know to corrupt low memory and several
1095+ * hundred kilobytes are not worth complex detection what memory gets
1096+ * clobbered. Moreover, on machines with SandyBridge graphics or in
1097+ * setups that use crashkernel the entire 1M is reserved anyway.
10901098 */
1091− trim_snb_memory();
1099+ reserve_real_mode();
10921100
10931101 init_mem_mapping();
10941102
@@ -1226,6 +1234,14 @@ void __init setup_arch(char **cmdline_p) · 131 unmodified lines
12261234
12271235 x86_init.timers.wallclock_init();
12281236
1237+ /*
1238+ * This needs to run before setup_local_APIC() which soft-disables the
1239+ * local APIC temporarily and that masks the thermal LVT interrupt,
1240+ * leading to softlockups on machines which have configured SMI
1241+ * interrupt delivery.
1242+ */
1243+ therm_lvt_init();
1244+
12291245 mcheck_init();
12301246
12311247 register_refined_jiffies(CLOCK_TICK_RATE);
arch/x86/kvm/lapic.c+11−6
@@ -1494,6 +1494,15 @@ static void limit_periodic_timer_frequency(struct kvm_lapic *apic) · 1493 unmodified lines
14941494
14951495 static void cancel_hv_timer(struct kvm_lapic *apic);
14961496
1497+static void cancel_apic_timer(struct kvm_lapic *apic)
1498+{
1499+ hrtimer_cancel(&apic->lapic_timer.timer);
1500+ preempt_disable();
1501+ if (apic->lapic_timer.hv_timer_in_use)
1502+ cancel_hv_timer(apic);
1503+ preempt_enable();
1504+}
1505+
14971506 static void apic_update_lvtt(struct kvm_lapic *apic)
14981507 {
14991508 u32 timer_mode = kvm_lapic_get_reg(apic, APIC_LVTT) &
@@ -1502,11 +1511,7 @@ static void apic_update_lvtt(struct kvm_lapic *apic) · 2 unmodified lines
15021511 if (apic->lapic_timer.timer_mode != timer_mode) {
15031512 if (apic_lvtt_tscdeadline(apic) != (timer_mode ==
15041513 APIC_LVT_TIMER_TSCDEADLINE)) {
1505− hrtimer_cancel(&apic->lapic_timer.timer);
1506− preempt_disable();
1507− if (apic->lapic_timer.hv_timer_in_use)
1508− cancel_hv_timer(apic);
1509− preempt_enable();
1514+ cancel_apic_timer(apic);
15101515 kvm_lapic_set_reg(apic, APIC_TMICT, 0);
15111516 apic->lapic_timer.period = 0;
15121517 apic->lapic_timer.tscdeadline = 0;
@@ -2092,7 +2097,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 579 unmodified lines
20922097 if (apic_lvtt_tscdeadline(apic))
20932098 break;
20942099
2095− hrtimer_cancel(&apic->lapic_timer.timer);
2100+ cancel_apic_timer(apic);
20962101 kvm_lapic_set_reg(apic, APIC_TMICT, val);
20972102 start_apic_timer(apic);
20982103 break;
arch/x86/kvm/mmu/paging_tmpl.h+9−5
@@ -90,8 +90,8 @@ struct guest_walker { · 89 unmodified lines
9090 gpa_t pte_gpa[PT_MAX_FULL_LEVELS];
9191 pt_element_t __user *ptep_user[PT_MAX_FULL_LEVELS];
9292 bool pte_writable[PT_MAX_FULL_LEVELS];
93− unsigned pt_access;
94− unsigned pte_access;
93+ unsigned int pt_access[PT_MAX_FULL_LEVELS];
94+ unsigned int pte_access;
9595 gfn_t gfn;
9696 struct x86_exception fault;
9797 };
@@ -418,13 +418,15 @@ retry_walk: · 320 unmodified lines
418418 }
419419
420420 walker->ptes[walker->level - 1] = pte;
421+
422+ /* Convert to ACC_*_MASK flags for struct guest_walker. */
423+ walker->pt_access[walker->level - 1] = FNAME(gpte_access)(pt_access ^ walk_nx_mask);
421424 } while (!is_last_gpte(mmu, walker->level, pte));
422425
423426 pte_pkey = FNAME(gpte_pkeys)(vcpu, pte);
424427 accessed_dirty = have_ad ? pte_access & PT_GUEST_ACCESSED_MASK : 0;
425428
426429 /* Convert to ACC_*_MASK flags for struct guest_walker. */
427− walker->pt_access = FNAME(gpte_access)(pt_access ^ walk_nx_mask);
428430 walker->pte_access = FNAME(gpte_access)(pte_access ^ walk_nx_mask);
429431 errcode = permission_fault(vcpu, mmu, walker->pte_access, pte_pkey, access);
430432 if (unlikely(errcode))
@@ -463,7 +465,8 @@ retry_walk: · 32 unmodified lines
463465 }
464466
465467 pgprintk("%s: pte %llx pte_access %x pt_access %x\n",
466− __func__, (u64)pte, walker->pte_access, walker->pt_access);
468+ __func__, (u64)pte, walker->pte_access,
469+ walker->pt_access[walker->level - 1]);
467470 return 1;
468471
469472 error:
@@ -643,7 +646,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr, · 173 unmodified lines
643646 bool huge_page_disallowed = exec && nx_huge_page_workaround_enabled;
644647 struct kvm_mmu_page *sp = NULL;
645648 struct kvm_shadow_walk_iterator it;
646− unsigned direct_access, access = gw->pt_access;
649+ unsigned int direct_access, access;
647650 int top_level, level, req_level, ret;
648651 gfn_t base_gfn = gw->gfn;
649652
@@ -675,6 +678,7 @@ static int FNAME(fetch)(struct kvm_vcpu *vcpu, gpa_t addr, · 25 unmodified lines
675678 sp = NULL;
676679 if (!is_shadow_present_pte(*it.sptep)) {
677680 table_gfn = gw->table_gfn[it.level - 2];
681+ access = gw->pt_access[it.level - 2];
678682 sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1,
679683 false, access);
680684 }
arch/x86/kvm/svm/sev.c+2−4
@@ -1103,10 +1103,9 @@ __sev_send_start_query_session_length(struct kvm *kvm, struct kvm_sev_cmd *argp, · 1102 unmodified lines
11031103 struct sev_data_send_start data;
11041104 int ret;
11051105
1106+ memset(&data, 0, sizeof(data));
11061107 data.handle = sev->handle;
11071108 ret = sev_issue_cmd(kvm, SEV_CMD_SEND_START, &data, &argp->error);
1108− if (ret < 0)
1109− return ret;
11101109
11111110 params->session_len = data.session_len;
11121111 if (copy_to_user((void __user *)(uintptr_t)argp->data, params,
@@ -1215,10 +1214,9 @@ __sev_send_update_data_query_lengths(struct kvm *kvm, struct kvm_sev_cmd *argp, · 102 unmodified lines
12151214 struct sev_data_send_update_data data;
12161215 int ret;
12171216
1217+ memset(&data, 0, sizeof(data));
12181218 data.handle = sev->handle;
12191219 ret = sev_issue_cmd(kvm, SEV_CMD_SEND_UPDATE_DATA, &data, &argp->error);
1220− if (ret < 0)
1221− return ret;
12221220
12231221 params->hdr_len = data.hdr_len;
12241222 params->trans_len = data.trans_len;
arch/x86/kvm/trace.h+3−3
@@ -1550,16 +1550,16 @@ TRACE_EVENT(kvm_nested_vmenter_failed, · 1549 unmodified lines
15501550 TP_ARGS(msg, err),
15511551
15521552 TP_STRUCT__entry(
1553− __field(const char *, msg)
1553+ __string(msg, msg)
15541554 __field(u32, err)
15551555 ),
15561556
15571557 TP_fast_assign(
1558− __entry->msg = msg;
1558+ __assign_str(msg, msg);
15591559 __entry->err = err;
15601560 ),
15611561
1562− TP_printk("%s%s", __entry->msg, !__entry->err ? "" :
1562+ TP_printk("%s%s", __get_str(msg), !__entry->err ? "" :
15631563 __print_symbolic(__entry->err, VMX_VMENTER_INSTRUCTION_ERRORS))
15641564 );
15651565
arch/x86/kvm/x86.c+17−2
@@ -3072,6 +3072,19 @@ static void kvm_vcpu_flush_tlb_all(struct kvm_vcpu *vcpu) · 3071 unmodified lines
30723072 static void kvm_vcpu_flush_tlb_guest(struct kvm_vcpu *vcpu)
30733073 {
30743074 ++vcpu->stat.tlb_flush;
3075+
3076+ if (!tdp_enabled) {
3077+ /*
3078+ * A TLB flush on behalf of the guest is equivalent to
3079+ * INVPCID(all), toggling CR4.PGE, etc., which requires
3080+ * a forced sync of the shadow page tables. Unload the
3081+ * entire MMU here and the subsequent load will sync the
3082+ * shadow page tables, and also flush the TLB.
3083+ */
3084+ kvm_mmu_unload(vcpu);
3085+ return;
3086+ }
3087+
30753088 static_call(kvm_x86_tlb_flush_guest)(vcpu);
30763089 }
30773090
@@ -3101,9 +3114,11 @@ static void record_steal_time(struct kvm_vcpu *vcpu) · 23 unmodified lines
31013114 * expensive IPIs.
31023115 */
31033116 if (guest_pv_has(vcpu, KVM_FEATURE_PV_TLB_FLUSH)) {
3117+ u8 st_preempted = xchg(&st->preempted, 0);
3118+
31043119 trace_kvm_pv_tlb_flush(vcpu->vcpu_id,
3105− st->preempted & KVM_VCPU_FLUSH_TLB);
3106− if (xchg(&st->preempted, 0) & KVM_VCPU_FLUSH_TLB)
3120+ st_preempted & KVM_VCPU_FLUSH_TLB);
3121+ if (st_preempted & KVM_VCPU_FLUSH_TLB)
31073122 kvm_vcpu_flush_tlb_guest(vcpu);
31083123 } else {
31093124 st->preempted = 0;
arch/x86/mm/fault.c+2−2
@@ -836,8 +836,8 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code, · 835 unmodified lines
836836
837837 if (si_code == SEGV_PKUERR)
838838 force_sig_pkuerr((void __user *)address, pkey);
839−
840− force_sig_fault(SIGSEGV, si_code, (void __user *)address);
839+ else
840+ force_sig_fault(SIGSEGV, si_code, (void __user *)address);
841841
842842 local_irq_disable();
843843 }
arch/x86/mm/mem_encrypt_identity.c+6−5
@@ -504,10 +504,6 @@ void __init sme_enable(struct boot_params *bp) · 503 unmodified lines
504504 #define AMD_SME_BIT BIT(0)
505505 #define AMD_SEV_BIT BIT(1)
506506
507− /* Check the SEV MSR whether SEV or SME is enabled */
508− sev_status = __rdmsr(MSR_AMD64_SEV);
509− feature_mask = (sev_status & MSR_AMD64_SEV_ENABLED) ? AMD_SEV_BIT : AMD_SME_BIT;
510−
511507 /*
512508 * Check for the SME/SEV feature:
513509 * CPUID Fn8000_001F[EAX]
@@ -519,11 +515,16 @@ void __init sme_enable(struct boot_params *bp) · 5 unmodified lines
519515 eax = 0x8000001f;
520516 ecx = 0;
521517 native_cpuid(&eax, &ebx, &ecx, &edx);
522− if (!(eax & feature_mask))
518+ /* Check whether SEV or SME is supported */
519+ if (!(eax & (AMD_SEV_BIT | AMD_SME_BIT)))
523520 return;
524521
525522 me_mask = 1UL << (ebx & 0x3f);
526523
524+ /* Check the SEV MSR whether SEV or SME is enabled */
525+ sev_status = __rdmsr(MSR_AMD64_SEV);
526+ feature_mask = (sev_status & MSR_AMD64_SEV_ENABLED) ? AMD_SEV_BIT : AMD_SME_BIT;
527+
527528 /* Check if memory encryption is enabled */
528529 if (feature_mask == AMD_SME_BIT) {
529530 /*
arch/x86/platform/efi/quirks.c+12−0
@@ -450,6 +450,18 @@ void __init efi_free_boot_services(void) · 449 unmodified lines
450450 size -= rm_size;
451451 }
452452
453+ /*
454+ * Don't free memory under 1M for two reasons:
455+ * - BIOS might clobber it
456+ * - Crash kernel needs it to be reserved
457+ */
458+ if (start + size < SZ_1M)
459+ continue;
460+ if (start < SZ_1M) {
461+ size -= (SZ_1M - start);
462+ start = SZ_1M;
463+ }
464+
453465 memblock_free_late(start, size);
454466 }
455467
arch/x86/realmode/init.c+8−6
@@ -29,14 +29,16 @@ void __init reserve_real_mode(void) · 28 unmodified lines
2929
3030 /* Has to be under 1M so we can execute real-mode AP code. */
3131 mem = memblock_find_in_range(0, 1<<20, size, PAGE_SIZE);
32− if (!mem) {
32+ if (!mem)
3333 pr_info("No sub-1M memory is available for the trampoline\n");
34− return;
35− }
34+ else
35+ set_real_mode_mem(mem);
3636
37− memblock_reserve(mem, size);
38− set_real_mode_mem(mem);
39− crash_reserve_low_1M();
37+ /*
38+ * Unconditionally reserve the entire fisrt 1M, see comment in
39+ * setup_arch().
40+ */
41+ memblock_reserve(0, SZ_1M);
4042 }
4143
4244 static void sme_sev_setup_real_mode(struct trampoline_header *th)
crypto/async_tx/async_xor.c+2−1
@@ -233,7 +233,8 @@ async_xor_offs(struct page *dest, unsigned int offset, · 232 unmodified lines
233233 if (submit->flags & ASYNC_TX_XOR_DROP_DST) {
234234 src_cnt--;
235235 src_list++;
236− src_offs++;
236+ if (src_offs)
237+ src_offs++;
237238 }
238239
239240 /* wait for any prerequisite operations */
drivers/acpi/acpica/utdelete.c+8−0
@@ -285,6 +285,14 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) · 284 unmodified lines
285285 }
286286 break;
287287
288+ case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
289+
290+ ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS,
291+ "***** Address handler %p\n", object));
292+
293+ acpi_os_delete_mutex(object->address_space.context_mutex);
294+ break;
295+
288296 default:
289297
290298 break;
drivers/acpi/bus.c+8−19
@@ -330,32 +330,21 @@ static void acpi_bus_osc_negotiate_platform_control(void) · 329 unmodified lines
330330 if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
331331 return;
332332
333− capbuf_ret = context.ret.pointer;
334− if (context.ret.length <= OSC_SUPPORT_DWORD) {
335− kfree(context.ret.pointer);
336− return;
337− }
333+ kfree(context.ret.pointer);
338334
339− /*
340− * Now run _OSC again with query flag clear and with the caps
341− * supported by both the OS and the platform.
342− */
335+ /* Now run _OSC again with query flag clear */
343336 capbuf[OSC_QUERY_DWORD] = 0;
344− capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD];
345− kfree(context.ret.pointer);
346337
347338 if (ACPI_FAILURE(acpi_run_osc(handle, &context)))
348339 return;
349340
350341 capbuf_ret = context.ret.pointer;
351− if (context.ret.length > OSC_SUPPORT_DWORD) {
352− osc_sb_apei_support_acked =
353− capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
354− osc_pc_lpi_support_confirmed =
355− capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
356− osc_sb_native_usb4_support_confirmed =
357− capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
358− }
342+ osc_sb_apei_support_acked =
343+ capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_APEI_SUPPORT;
344+ osc_pc_lpi_support_confirmed =
345+ capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT;
346+ osc_sb_native_usb4_support_confirmed =
347+ capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT;
359348
360349 kfree(context.ret.pointer);
361350 }
drivers/acpi/sleep.c+1−3
@@ -1009,10 +1009,8 @@ static void acpi_sleep_hibernate_setup(void) · 1008 unmodified lines
10091009 return;
10101010
10111011 acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs);
1012− if (facs) {
1012+ if (facs)
10131013 s4_hardware_signature = facs->hardware_signature;
1014− acpi_put_table((struct acpi_table_header *)facs);
1015− }
10161014 }
10171015 #else /* !CONFIG_HIBERNATION */
10181016 static inline void acpi_sleep_hibernate_setup(void) {}
drivers/base/memory.c+3−3
@@ -218,14 +218,14 @@ static int memory_block_offline(struct memory_block *mem) · 217 unmodified lines
218218 struct zone *zone;
219219 int ret;
220220
221− zone = page_zone(pfn_to_page(start_pfn));
222−
223221 /*
224222 * Unaccount before offlining, such that unpopulated zone and kthreads
225223 * can properly be torn down in offline_pages().
226224 */
227− if (nr_vmemmap_pages)
225+ if (nr_vmemmap_pages) {
226+ zone = page_zone(pfn_to_page(start_pfn));
228227 adjust_present_page_count(zone, -nr_vmemmap_pages);
228+ }
229229
230230 ret = offline_pages(start_pfn + nr_vmemmap_pages,
231231 nr_pages - nr_vmemmap_pages);
drivers/block/loop.c+7−18
@@ -1879,29 +1879,18 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode, · 1878 unmodified lines
18791879
18801880 static int lo_open(struct block_device *bdev, fmode_t mode)
18811881 {
1882− struct loop_device *lo;
1882+ struct loop_device *lo = bdev->bd_disk->private_data;
18831883 int err;
18841884
1885− /*
1886− * take loop_ctl_mutex to protect lo pointer from race with
1887− * loop_control_ioctl(LOOP_CTL_REMOVE), however, to reduce contention
1888− * release it prior to updating lo->lo_refcnt.
1889− */
1890− err = mutex_lock_killable(&loop_ctl_mutex);
1891− if (err)
1892− return err;
1893− lo = bdev->bd_disk->private_data;
1894− if (!lo) {
1895− mutex_unlock(&loop_ctl_mutex);
1896− return -ENXIO;
1897− }
18981885 err = mutex_lock_killable(&lo->lo_mutex);
1899− mutex_unlock(&loop_ctl_mutex);
19001886 if (err)
19011887 return err;
1902− atomic_inc(&lo->lo_refcnt);
1888+ if (lo->lo_state == Lo_deleting)
1889+ err = -ENXIO;
1890+ else
1891+ atomic_inc(&lo->lo_refcnt);
19031892 mutex_unlock(&lo->lo_mutex);
1904− return 0;
1893+ return err;
19051894 }
19061895
19071896 static void lo_release(struct gendisk *disk, fmode_t mode)
@@ -2285,7 +2274,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd, · 377 unmodified lines
22852274 mutex_unlock(&lo->lo_mutex);
22862275 break;
22872276 }
2288− lo->lo_disk->private_data = NULL;
2277+ lo->lo_state = Lo_deleting;
22892278 mutex_unlock(&lo->lo_mutex);
22902279 idr_remove(&loop_index_idr, lo->lo_number);
22912280 loop_remove(lo);
drivers/block/loop.h+1−0
@@ -22,6 +22,7 @@ enum { · 21 unmodified lines
2222 Lo_unbound,
2323 Lo_bound,
2424 Lo_rundown,
25+ Lo_deleting,
2526 };
2627
2728 struct loop_func_table;
drivers/bluetooth/btusb.c+23−2
@@ -388,6 +388,8 @@ static const struct usb_device_id blacklist_table[] = { · 387 unmodified lines
388388 /* Realtek 8822CE Bluetooth devices */
389389 { USB_DEVICE(0x0bda, 0xb00c), .driver_info = BTUSB_REALTEK |
390390 BTUSB_WIDEBAND_SPEECH },
391+ { USB_DEVICE(0x0bda, 0xc822), .driver_info = BTUSB_REALTEK |
392+ BTUSB_WIDEBAND_SPEECH },
391393
392394 /* Realtek 8852AE Bluetooth devices */
393395 { USB_DEVICE(0x0bda, 0xc852), .driver_info = BTUSB_REALTEK |
@@ -2527,10 +2529,17 @@ static int btusb_intel_download_firmware_newgen(struct hci_dev *hdev, · 2133 unmodified lines
25272529 }
25282530
25292531 btusb_setup_intel_newgen_get_fw_name(ver, fwname, sizeof(fwname), "sfi");
2530− err = request_firmware(&fw, fwname, &hdev->dev);
2532+ err = firmware_request_nowarn(&fw, fwname, &hdev->dev);
25312533 if (err < 0) {
2534+ if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) {
2535+ /* Firmware has already been loaded */
2536+ set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
2537+ return 0;
2538+ }
2539+
25322540 bt_dev_err(hdev, "Failed to load Intel firmware file %s (%d)",
25332541 fwname, err);
2542+
25342543 return err;
25352544 }
25362545
@@ -2680,12 +2689,24 @@ download: · 143 unmodified lines
26802689 err = btusb_setup_intel_new_get_fw_name(ver, params, fwname,
26812690 sizeof(fwname), "sfi");
26822691 if (err < 0) {
2692+ if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) {
2693+ /* Firmware has already been loaded */
2694+ set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
2695+ return 0;
2696+ }
2697+
26832698 bt_dev_err(hdev, "Unsupported Intel firmware naming");
26842699 return -EINVAL;
26852700 }
26862701
2687− err = request_firmware(&fw, fwname, &hdev->dev);
2702+ err = firmware_request_nowarn(&fw, fwname, &hdev->dev);
26882703 if (err < 0) {
2704+ if (!test_bit(BTUSB_BOOTLOADER, &data->flags)) {
2705+ /* Firmware has already been loaded */
2706+ set_bit(BTUSB_FIRMWARE_LOADED, &data->flags);
2707+ return 0;
2708+ }
2709+
26892710 bt_dev_err(hdev, "Failed to load Intel firmware file %s (%d)",
26902711 fwname, err);
26912712 return err;
drivers/bus/mhi/pci_generic.c+38−4
@@ -311,8 +311,8 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = { · 310 unmodified lines
311311 MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 1),
312312 MHI_CHANNEL_CONFIG_UL(12, "MBIM", 32, 0),
313313 MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0),
314− MHI_CHANNEL_CONFIG_UL(32, "AT", 32, 0),
315− MHI_CHANNEL_CONFIG_DL(33, "AT", 32, 0),
314+ MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0),
315+ MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0),
316316 MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2),
317317 MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
318318 };
@@ -708,7 +708,7 @@ static void mhi_pci_remove(struct pci_dev *pdev) · 389 unmodified lines
708708 struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev);
709709 struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl;
710710
711− del_timer(&mhi_pdev->health_check_timer);
711+ del_timer_sync(&mhi_pdev->health_check_timer);
712712 cancel_work_sync(&mhi_pdev->recovery_work);
713713
714714 if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) {
@@ -935,9 +935,43 @@ static int __maybe_unused mhi_pci_resume(struct device *dev) · 220 unmodified lines
935935 return ret;
936936 }
937937
938+static int __maybe_unused mhi_pci_freeze(struct device *dev)
939+{
940+ struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev);
941+ struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl;
942+
943+ /* We want to stop all operations, hibernation does not guarantee that
944+ * device will be in the same state as before freezing, especially if
945+ * the intermediate restore kernel reinitializes MHI device with new
946+ * context.
947+ */
948+ if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) {
949+ mhi_power_down(mhi_cntrl, false);
950+ mhi_unprepare_after_power_down(mhi_cntrl);
951+ }
952+
953+ return 0;
954+}
955+
956+static int __maybe_unused mhi_pci_restore(struct device *dev)
957+{
958+ struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev);
959+
960+ /* Reinitialize the device */
961+ queue_work(system_long_wq, &mhi_pdev->recovery_work);
962+
963+ return 0;
964+}
965+
938966 static const struct dev_pm_ops mhi_pci_pm_ops = {
939967 SET_RUNTIME_PM_OPS(mhi_pci_runtime_suspend, mhi_pci_runtime_resume, NULL)
940− SET_SYSTEM_SLEEP_PM_OPS(mhi_pci_suspend, mhi_pci_resume)
968+#ifdef CONFIG_PM_SLEEP
969+ .suspend = mhi_pci_suspend,
970+ .resume = mhi_pci_resume,
971+ .freeze = mhi_pci_freeze,
972+ .thaw = mhi_pci_restore,
973+ .restore = mhi_pci_restore,
974+#endif
941975 };
942976
943977 static struct pci_driver mhi_pci_driver = {
drivers/bus/ti-sysc.c+54−6
@@ -1334,6 +1334,34 @@ err_allow_idle: · 1333 unmodified lines
13341334 return error;
13351335 }
13361336
1337+static int sysc_reinit_module(struct sysc *ddata, bool leave_enabled)
1338+{
1339+ struct device *dev = ddata->dev;
1340+ int error;
1341+
1342+ /* Disable target module if it is enabled */
1343+ if (ddata->enabled) {
1344+ error = sysc_runtime_suspend(dev);
1345+ if (error)
1346+ dev_warn(dev, "reinit suspend failed: %i\n", error);
1347+ }
1348+
1349+ /* Enable target module */
1350+ error = sysc_runtime_resume(dev);
1351+ if (error)
1352+ dev_warn(dev, "reinit resume failed: %i\n", error);
1353+
1354+ if (leave_enabled)
1355+ return error;
1356+
1357+ /* Disable target module if no leave_enabled was set */
1358+ error = sysc_runtime_suspend(dev);
1359+ if (error)
1360+ dev_warn(dev, "reinit suspend failed: %i\n", error);
1361+
1362+ return error;
1363+}
1364+
13371365 static int __maybe_unused sysc_noirq_suspend(struct device *dev)
13381366 {
13391367 struct sysc *ddata;
@@ -1344,12 +1372,18 @@ static int __maybe_unused sysc_noirq_suspend(struct device *dev) · 4 unmodified lines
13441372 (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
13451373 return 0;
13461374
1347− return pm_runtime_force_suspend(dev);
1375+ if (!ddata->enabled)
1376+ return 0;
1377+
1378+ ddata->needs_resume = 1;
1379+
1380+ return sysc_runtime_suspend(dev);
13481381 }
13491382
13501383 static int __maybe_unused sysc_noirq_resume(struct device *dev)
13511384 {
13521385 struct sysc *ddata;
1386+ int error = 0;
13531387
13541388 ddata = dev_get_drvdata(dev);
13551389
@@ -1357,7 +1391,19 @@ static int __maybe_unused sysc_noirq_resume(struct device *dev) · 1 unmodified line
13571391 (SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_NO_IDLE))
13581392 return 0;
13591393
1360− return pm_runtime_force_resume(dev);
1394+ if (ddata->cfg.quirks & SYSC_QUIRK_REINIT_ON_RESUME) {
1395+ error = sysc_reinit_module(ddata, ddata->needs_resume);
1396+ if (error)
1397+ dev_warn(dev, "noirq_resume failed: %i\n", error);
1398+ } else if (ddata->needs_resume) {
1399+ error = sysc_runtime_resume(dev);
1400+ if (error)
1401+ dev_warn(dev, "noirq_resume failed: %i\n", error);
1402+ }
1403+
1404+ ddata->needs_resume = 0;
1405+
1406+ return error;
13611407 }
13621408
13631409 static const struct dev_pm_ops sysc_pm_ops = {
@@ -1408,9 +1454,9 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 44 unmodified lines
14081454 SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
14091455 /* Uarts on omap4 and later */
14101456 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff,
1411− SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
1457+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
14121458 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff,
1413− SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
1459+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
14141460
14151461 /* Quirks that need to be set based on the module address */
14161462 SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff,
@@ -1459,6 +1505,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 42 unmodified lines
14591505 SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
14601506 SYSC_QUIRK("tptc", 0, 0, -ENODEV, -ENODEV, 0x40007c00, 0xffffffff,
14611507 SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
1508+ SYSC_QUIRK("sata", 0, 0xfc, 0x1100, -ENODEV, 0x5e412000, 0xffffffff,
1509+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
14621510 SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff,
14631511 SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
14641512 SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff,
@@ -1466,7 +1514,8 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 1 unmodified line
14661514 SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050,
14671515 0xffffffff, SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
14681516 SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff,
1469− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY),
1517+ SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_SWSUP_MSTANDBY |
1518+ SYSC_QUIRK_REINIT_ON_RESUME),
14701519 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0,
14711520 SYSC_MODULE_QUIRK_WDT),
14721521 /* PRUSS on am3, am4 and am5 */
@@ -1524,7 +1573,6 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = { · 51 unmodified lines
15241573 SYSC_QUIRK("prcm", 0, 0, -ENODEV, -ENODEV, 0x40000400, 0xffffffff, 0),
15251574 SYSC_QUIRK("rfbi", 0x4832a800, 0, 0x10, 0x14, 0x00000010, 0xffffffff, 0),
15261575 SYSC_QUIRK("rfbi", 0x58002000, 0, 0x10, 0x14, 0x00000010, 0xffffffff, 0),
1527− SYSC_QUIRK("sata", 0, 0xfc, 0x1100, -ENODEV, 0x5e412000, 0xffffffff, 0),
15281576 SYSC_QUIRK("scm", 0, 0, 0x10, -ENODEV, 0x40000900, 0xffffffff, 0),
15291577 SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x4e8b0100, 0xffffffff, 0),
15301578 SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x4f000100, 0xffffffff, 0),
drivers/dma/idxd/init.c+2−2
@@ -745,12 +745,12 @@ static int __init idxd_init_module(void) · 744 unmodified lines
745745 * If the CPU does not support MOVDIR64B or ENQCMDS, there's no point in
746746 * enumerating the device. We can not utilize it.
747747 */
748− if (!boot_cpu_has(X86_FEATURE_MOVDIR64B)) {
748+ if (!cpu_feature_enabled(X86_FEATURE_MOVDIR64B)) {
749749 pr_warn("idxd driver failed to load without MOVDIR64B.\n");
750750 return -ENODEV;
751751 }
752752
753− if (!boot_cpu_has(X86_FEATURE_ENQCMD))
753+ if (!cpu_feature_enabled(X86_FEATURE_ENQCMD))
754754 pr_warn("Platform does not have ENQCMD(S) support.\n");
755755 else
756756 support_enqcmd = true;
drivers/firmware/efi/cper.c+1−3
@@ -276,8 +276,7 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) · 275 unmodified lines
276276 if (!msg || !(mem->validation_bits & CPER_MEM_VALID_MODULE_HANDLE))
277277 return 0;
278278
279− n = 0;
280− len = CPER_REC_LEN - 1;
279+ len = CPER_REC_LEN;
281280 dmi_memdev_name(mem->mem_dev_handle, &bank, &device);
282281 if (bank && device)
283282 n = snprintf(msg, len, "DIMM location: %s %s ", bank, device);
@@ -286,7 +285,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg) · 2 unmodified lines
286285 "DIMM location: not present. DMI handle: 0x%.4x ",
287286 mem->mem_dev_handle);
288287
289− msg[n] = '\0';
290288 return n;
291289 }
292290
drivers/firmware/efi/fdtparams.c+3−0
@@ -98,6 +98,9 @@ u64 __init efi_get_fdt_params(struct efi_memory_map_data *mm) · 97 unmodified lines
9898 BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(name));
9999 BUILD_BUG_ON(ARRAY_SIZE(target) != ARRAY_SIZE(dt_params[0].params));
100100
101+ if (!fdt)
102+ return 0;
103+
101104 for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
102105 node = fdt_path_offset(fdt, dt_params[i].path);
103106 if (node < 0)
drivers/firmware/efi/libstub/file.c+1−1
@@ -103,7 +103,7 @@ static int find_file_option(const efi_char16_t *cmdline, int cmdline_len, · 102 unmodified lines
103103 return 0;
104104
105105 /* Skip any leading slashes */
106− while (cmdline[i] == L'/' || cmdline[i] == L'\\')
106+ while (i < cmdline_len && (cmdline[i] == L'/' || cmdline[i] == L'\\'))
107107 i++;
108108
109109 while (--result_len > 0 && i < cmdline_len) {
drivers/firmware/efi/memattr.c+0−5
@@ -67,11 +67,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out) · 66 unmodified lines
6767 return false;
6868 }
6969
70− if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) {
71− pr_warn("Entry attributes invalid: RO and XP bits both cleared\n");
72− return false;
73− }
74−
7570 if (PAGE_SIZE > EFI_PAGE_SIZE &&
7671 (!PAGE_ALIGNED(in->phys_addr) ||
7772 !PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) {
drivers/gpio/gpio-wcd934x.c+1−1
@@ -7,7 +7,7 @@ · 6 unmodified lines
77 #include <linux/slab.h>
88 #include <linux/of_device.h>
99
10−#define WCD_PIN_MASK(p) BIT(p - 1)
10+#define WCD_PIN_MASK(p) BIT(p)
1111 #define WCD_REG_DIR_CTL_OFFSET 0x42
1212 #define WCD_REG_VAL_CTL_OFFSET 0x43
1313 #define WCD934X_NPINS 5
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c+0−16
@@ -337,7 +337,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev, · 336 unmodified lines
337337 {
338338 struct amdgpu_ctx *ctx;
339339 struct amdgpu_ctx_mgr *mgr;
340− unsigned long ras_counter;
341340
342341 if (!fpriv)
343342 return -EINVAL;
@@ -362,21 +361,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev, · 18 unmodified lines
362361 if (atomic_read(&ctx->guilty))
363362 out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_GUILTY;
364363
365− /*query ue count*/
366− ras_counter = amdgpu_ras_query_error_count(adev, false);
367− /*ras counter is monotonic increasing*/
368− if (ras_counter != ctx->ras_counter_ue) {
369− out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_UE;
370− ctx->ras_counter_ue = ras_counter;
371− }
372−
373− /*query ce count*/
374− ras_counter = amdgpu_ras_query_error_count(adev, true);
375− if (ras_counter != ctx->ras_counter_ce) {
376− out->state.flags |= AMDGPU_CTX_QUERY2_FLAGS_RAS_CE;
377− ctx->ras_counter_ce = ras_counter;
378− }
379−
380364 mutex_unlock(&mgr->lock);
381365 return 0;
382366 }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+3−1
@@ -3118,7 +3118,9 @@ bool amdgpu_device_asic_has_dc_support(enum amd_asic_type asic_type) · 3117 unmodified lines
31183118 */
31193119 bool amdgpu_device_has_dc_support(struct amdgpu_device *adev)
31203120 {
3121− if (amdgpu_sriov_vf(adev) || adev->enable_virtual_display)
3121+ if (amdgpu_sriov_vf(adev) ||
3122+ adev->enable_virtual_display ||
3123+ (adev->harvest_ip_mask & AMD_HARVEST_IP_DMU_MASK))
31223124 return false;
31233125
31243126 return amdgpu_device_asic_has_dc_support(adev->asic_type);
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c+2−2
@@ -1057,7 +1057,7 @@ int amdgpu_display_gem_fb_init(struct drm_device *dev, · 1056 unmodified lines
10571057
10581058 return 0;
10591059 err:
1060− drm_err(dev, "Failed to init gem fb: %d\n", ret);
1060+ drm_dbg_kms(dev, "Failed to init gem fb: %d\n", ret);
10611061 rfb->base.obj[0] = NULL;
10621062 return ret;
10631063 }
@@ -1094,7 +1094,7 @@ int amdgpu_display_gem_fb_verify_and_init( · 30 unmodified lines
10941094
10951095 return 0;
10961096 err:
1097− drm_err(dev, "Failed to verify and init gem fb: %d\n", ret);
1097+ drm_dbg_kms(dev, "Failed to verify and init gem fb: %d\n", ret);
10981098 rfb->base.obj[0] = NULL;
10991099 return ret;
11001100 }
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c+23−19
@@ -101,7 +101,8 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr, · 100 unmodified lines
101101 int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
102102 {
103103 unsigned char buff[34];
104− int addrptr = 0, size = 0;
104+ int addrptr, size;
105+ int len;
105106
106107 if (!is_fru_eeprom_supported(adev))
107108 return 0;
@@ -109,7 +110,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 1 unmodified line
109110 /* If algo exists, it means that the i2c_adapter's initialized */
110111 if (!adev->pm.smu_i2c.algo) {
111112 DRM_WARN("Cannot access FRU, EEPROM accessor not initialized");
112− return 0;
113+ return -ENODEV;
113114 }
114115
115116 /* There's a lot of repetition here. This is due to the FRU having
@@ -128,7 +129,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 12 unmodified lines
128129 size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
129130 if (size < 1) {
130131 DRM_ERROR("Failed to read FRU Manufacturer, ret:%d", size);
131− return size;
132+ return -EINVAL;
132133 }
133134
134135 /* Increment the addrptr by the size of the field, and 1 due to the
@@ -138,43 +139,45 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 3 unmodified lines
138139 size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
139140 if (size < 1) {
140141 DRM_ERROR("Failed to read FRU product name, ret:%d", size);
141− return size;
142+ return -EINVAL;
142143 }
143144
145+ len = size;
144146 /* Product name should only be 32 characters. Any more,
145147 * and something could be wrong. Cap it at 32 to be safe
146148 */
147− if (size > 32) {
149+ if (len >= sizeof(adev->product_name)) {
148150 DRM_WARN("FRU Product Number is larger than 32 characters. This is likely a mistake");
149− size = 32;
151+ len = sizeof(adev->product_name) - 1;
150152 }
151153 /* Start at 2 due to buff using fields 0 and 1 for the address */
152− memcpy(adev->product_name, &buff[2], size);
153− adev->product_name[size] = '\0';
154+ memcpy(adev->product_name, &buff[2], len);
155+ adev->product_name[len] = '\0';
154156
155157 addrptr += size + 1;
156158 size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
157159 if (size < 1) {
158160 DRM_ERROR("Failed to read FRU product number, ret:%d", size);
159− return size;
161+ return -EINVAL;
160162 }
161163
164+ len = size;
162165 /* Product number should only be 16 characters. Any more,
163166 * and something could be wrong. Cap it at 16 to be safe
164167 */
165− if (size > 16) {
168+ if (len >= sizeof(adev->product_number)) {
166169 DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
167− size = 16;
170+ len = sizeof(adev->product_number) - 1;
168171 }
169− memcpy(adev->product_number, &buff[2], size);
170− adev->product_number[size] = '\0';
172+ memcpy(adev->product_number, &buff[2], len);
173+ adev->product_number[len] = '\0';
171174
172175 addrptr += size + 1;
173176 size = amdgpu_fru_read_eeprom(adev, addrptr, buff);
174177
175178 if (size < 1) {
176179 DRM_ERROR("Failed to read FRU product version, ret:%d", size);
177− return size;
180+ return -EINVAL;
178181 }
179182
180183 addrptr += size + 1;
@@ -182,18 +185,19 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev) · 1 unmodified line
182185
183186 if (size < 1) {
184187 DRM_ERROR("Failed to read FRU serial number, ret:%d", size);
185− return size;
188+ return -EINVAL;
186189 }
187190
191+ len = size;
188192 /* Serial number should only be 16 characters. Any more,
189193 * and something could be wrong. Cap it at 16 to be safe
190194 */
191− if (size > 16) {
195+ if (len >= sizeof(adev->serial)) {
192196 DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
193− size = 16;
197+ len = sizeof(adev->serial) - 1;
194198 }
195− memcpy(adev->serial, &buff[2], size);
196− adev->serial[size] = '\0';
199+ memcpy(adev->serial, &buff[2], len);
200+ adev->serial[len] = '\0';
197201
198202 return 0;
199203 }
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c+2−2
@@ -100,7 +100,7 @@ static void amdgpu_bo_destroy(struct ttm_buffer_object *tbo) · 99 unmodified lines
100100 kfree(ubo->metadata);
101101 }
102102
103− kfree(bo);
103+ kvfree(bo);
104104 }
105105
106106 /**
@@ -552,7 +552,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, · 445 unmodified lines
552552 BUG_ON(bp->bo_ptr_size < sizeof(struct amdgpu_bo));
553553
554554 *bo_ptr = NULL;
555− bo = kzalloc(bp->bo_ptr_size, GFP_KERNEL);
555+ bo = kvzalloc(bp->bo_ptr_size, GFP_KERNEL);
556556 if (bo == NULL)
557557 return -ENOMEM;
558558 drm_gem_private_object_init(adev_to_drm(adev), &bo->tbo.base, size);
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h+1−0
@@ -76,6 +76,7 @@ struct psp_ring · 75 unmodified lines
7676 uint64_t ring_mem_mc_addr;
7777 void *ring_mem_handle;
7878 uint32_t ring_size;
79+ uint32_t ring_wptr;
7980 };
8081
8182 /* More registers may will be supported */
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+21−5
@@ -173,6 +173,9 @@ · 172 unmodified lines
173173 #define mmGC_THROTTLE_CTRL_Sienna_Cichlid 0x2030
174174 #define mmGC_THROTTLE_CTRL_Sienna_Cichlid_BASE_IDX 0
175175
176+#define mmRLC_SPARE_INT_0_Sienna_Cichlid 0x4ca5
177+#define mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX 1
178+
176179 #define GFX_RLCG_GC_WRITE_OLD (0x8 << 28)
177180 #define GFX_RLCG_GC_WRITE (0x0 << 28)
178181 #define GFX_RLCG_GC_READ (0x1 << 28)
@@ -1480,8 +1483,15 @@ static u32 gfx_v10_rlcg_rw(struct amdgpu_device *adev, u32 offset, u32 v, uint32 · 1301 unmodified lines
14801483 (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG0_BASE_IDX] + mmSCRATCH_REG2) * 4;
14811484 scratch_reg3 = adev->rmmio +
14821485 (adev->reg_offset[GC_HWIP][0][mmSCRATCH_REG1_BASE_IDX] + mmSCRATCH_REG3) * 4;
1483− spare_int = adev->rmmio +
1484− (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT) * 4;
1486+
1487+ if (adev->asic_type >= CHIP_SIENNA_CICHLID) {
1488+ spare_int = adev->rmmio +
1489+ (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_0_Sienna_Cichlid_BASE_IDX]
1490+ + mmRLC_SPARE_INT_0_Sienna_Cichlid) * 4;
1491+ } else {
1492+ spare_int = adev->rmmio +
1493+ (adev->reg_offset[GC_HWIP][0][mmRLC_SPARE_INT_BASE_IDX] + mmRLC_SPARE_INT) * 4;
1494+ }
14851495
14861496 grbm_cntl = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_CNTL_BASE_IDX] + mmGRBM_GFX_CNTL;
14871497 grbm_idx = adev->reg_offset[GC_HWIP][0][mmGRBM_GFX_INDEX_BASE_IDX] + mmGRBM_GFX_INDEX;
@@ -7349,9 +7359,15 @@ static int gfx_v10_0_hw_fini(void *handle) · 5861 unmodified lines
73497359 if (amdgpu_sriov_vf(adev)) {
73507360 gfx_v10_0_cp_gfx_enable(adev, false);
73517361 /* Program KIQ position of RLC_CP_SCHEDULERS during destroy */
7352− tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS);
7353− tmp &= 0xffffff00;
7354− WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp);
7362+ if (adev->asic_type >= CHIP_SIENNA_CICHLID) {
7363+ tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid);
7364+ tmp &= 0xffffff00;
7365+ WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS_Sienna_Cichlid, tmp);
7366+ } else {
7367+ tmp = RREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS);
7368+ tmp &= 0xffffff00;
7369+ WREG32_SOC15(GC, 0, mmRLC_CP_SCHEDULERS, tmp);
7370+ }
73557371
73567372 return 0;
73577373 }
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c+2−1
@@ -720,7 +720,7 @@ static uint32_t psp_v11_0_ring_get_wptr(struct psp_context *psp) · 719 unmodified lines
720720 struct amdgpu_device *adev = psp->adev;
721721
722722 if (amdgpu_sriov_vf(adev))
723− data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
723+ data = psp->km_ring.ring_wptr;
724724 else
725725 data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
726726
@@ -734,6 +734,7 @@ static void psp_v11_0_ring_set_wptr(struct psp_context *psp, uint32_t value) · 7 unmodified lines
734734 if (amdgpu_sriov_vf(adev)) {
735735 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value);
736736 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD);
737+ psp->km_ring.ring_wptr = value;
737738 } else
738739 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, value);
739740 }
drivers/gpu/drm/amd/amdgpu/psp_v3_1.c+2−1
@@ -379,7 +379,7 @@ static uint32_t psp_v3_1_ring_get_wptr(struct psp_context *psp) · 378 unmodified lines
379379 struct amdgpu_device *adev = psp->adev;
380380
381381 if (amdgpu_sriov_vf(adev))
382− data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
382+ data = psp->km_ring.ring_wptr;
383383 else
384384 data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
385385 return data;
@@ -394,6 +394,7 @@ static void psp_v3_1_ring_set_wptr(struct psp_context *psp, uint32_t value) · 8 unmodified lines
394394 /* send interrupt to PSP for SRIOV ring write pointer update */
395395 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
396396 GFX_CTRL_CMD_ID_CONSUME_CMD);
397+ psp->km_ring.ring_wptr = value;
397398 } else
398399 WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, value);
399400 }
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c+1−0
@@ -357,6 +357,7 @@ static int uvd_v6_0_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) · 356 unmodified lines
357357
358358 error:
359359 dma_fence_put(fence);
360+ amdgpu_bo_unpin(bo);
360361 amdgpu_bo_unreserve(bo);
361362 amdgpu_bo_unref(&bo);
362363 return r;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+19−11
@@ -925,7 +925,8 @@ static int dm_dmub_hw_init(struct amdgpu_device *adev) · 924 unmodified lines
925925 abm->dmcu_is_running = dmcu->funcs->is_dmcu_initialized(dmcu);
926926 }
927927
928− adev->dm.dc->ctx->dmub_srv = dc_dmub_srv_create(adev->dm.dc, dmub_srv);
928+ if (!adev->dm.dc->ctx->dmub_srv)
929+ adev->dm.dc->ctx->dmub_srv = dc_dmub_srv_create(adev->dm.dc, dmub_srv);
929930 if (!adev->dm.dc->ctx->dmub_srv) {
930931 DRM_ERROR("Couldn't allocate DC DMUB server!\n");
931932 return -ENOMEM;
@@ -1954,7 +1955,6 @@ static int dm_suspend(void *handle) · 1022 unmodified lines
19541955
19551956 amdgpu_dm_irq_suspend(adev);
19561957
1957−
19581958 dc_set_power_state(dm->dc, DC_ACPI_CM_POWER_STATE_D3);
19591959
19601960 return 0;
@@ -5500,7 +5500,8 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 3539 unmodified lines
55005500 struct drm_display_mode saved_mode;
55015501 struct drm_display_mode *freesync_mode = NULL;
55025502 bool native_mode_found = false;
5503− bool recalculate_timing = dm_state ? (dm_state->scaling != RMX_OFF) : false;
5503+ bool recalculate_timing = false;
5504+ bool scale = dm_state ? (dm_state->scaling != RMX_OFF) : false;
55045505 int mode_refresh;
55055506 int preferred_refresh = 0;
55065507 #if defined(CONFIG_DRM_AMD_DC_DCN)
@@ -5563,7 +5564,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 56 unmodified lines
55635564 */
55645565 DRM_DEBUG_DRIVER("No preferred mode found\n");
55655566 } else {
5566− recalculate_timing |= amdgpu_freesync_vid_mode &&
5567+ recalculate_timing = amdgpu_freesync_vid_mode &&
55675568 is_freesync_video_mode(&mode, aconnector);
55685569 if (recalculate_timing) {
55695570 freesync_mode = get_highest_refresh_rate_mode(aconnector, false);
@@ -5571,11 +5572,10 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 1 unmodified line
55715572 mode = *freesync_mode;
55725573 } else {
55735574 decide_crtc_timing_for_drm_display_mode(
5574− &mode, preferred_mode,
5575− dm_state ? (dm_state->scaling != RMX_OFF) : false);
5576− }
5575+ &mode, preferred_mode, scale);
55775576
5578− preferred_refresh = drm_mode_vrefresh(preferred_mode);
5577+ preferred_refresh = drm_mode_vrefresh(preferred_mode);
5578+ }
55795579 }
55805580
55815581 if (recalculate_timing)
@@ -5587,7 +5587,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 5 unmodified lines
55875587 * If scaling is enabled and refresh rate didn't change
55885588 * we copy the vic and polarities of the old timings
55895589 */
5590− if (!recalculate_timing || mode_refresh != preferred_refresh)
5590+ if (!scale || mode_refresh != preferred_refresh)
55915591 fill_stream_properties_from_drm_display_mode(
55925592 stream, &mode, &aconnector->base, con_state, NULL,
55935593 requested_bpc);
@@ -9854,7 +9854,7 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state, · 4260 unmodified lines
98549854
98559855 if (cursor_scale_w != primary_scale_w ||
98569856 cursor_scale_h != primary_scale_h) {
9857− DRM_DEBUG_ATOMIC("Cursor plane scaling doesn't match primary plane\n");
9857+ drm_dbg_atomic(crtc->dev, "Cursor plane scaling doesn't match primary plane\n");
98589858 return -EINVAL;
98599859 }
98609860
@@ -9891,7 +9891,7 @@ static int validate_overlay(struct drm_atomic_state *state) · 30 unmodified lines
98919891 int i;
98929892 struct drm_plane *plane;
98939893 struct drm_plane_state *old_plane_state, *new_plane_state;
9894− struct drm_plane_state *primary_state, *overlay_state = NULL;
9894+ struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL;
98959895
98969896 /* Check if primary plane is contained inside overlay */
98979897 for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) {
@@ -9921,6 +9921,14 @@ static int validate_overlay(struct drm_atomic_state *state) · 23 unmodified lines
99219921 if (!primary_state->crtc)
99229922 return 0;
99239923
9924+ /* check if cursor plane is enabled */
9925+ cursor_state = drm_atomic_get_plane_state(state, overlay_state->crtc->cursor);
9926+ if (IS_ERR(cursor_state))
9927+ return PTR_ERR(cursor_state);
9928+
9929+ if (drm_atomic_plane_disabling(plane->state, cursor_state))
9930+ return 0;
9931+
99249932 /* Perform the bounds check to ensure the overlay plane covers the primary */
99259933 if (primary_state->crtc_x < overlay_state->crtc_x ||
99269934 primary_state->crtc_y < overlay_state->crtc_y ||
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c+1−1
@@ -3236,7 +3236,7 @@ static noinline bool dcn20_validate_bandwidth_fp(struct dc *dc, · 3235 unmodified lines
32363236 voltage_supported = dcn20_validate_bandwidth_internal(dc, context, false);
32373237 dummy_pstate_supported = context->bw_ctx.bw.dcn.clk.p_state_change_support;
32383238
3239− if (voltage_supported && dummy_pstate_supported) {
3239+ if (voltage_supported && (dummy_pstate_supported || !(context->stream_count))) {
32403240 context->bw_ctx.bw.dcn.clk.p_state_change_support = false;
32413241 goto restore_dml_state;
32423242 }
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c+1−0
@@ -810,6 +810,7 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr, · 809 unmodified lines
810810 break;
811811 case AMD_DPM_FORCED_LEVEL_MANUAL:
812812 data->fine_grain_enabled = 1;
813+ break;
813814 case AMD_DPM_FORCED_LEVEL_PROFILE_EXIT:
814815 default:
815816 break;
drivers/gpu/drm/drm_auth.c+2−1
@@ -314,9 +314,10 @@ int drm_master_open(struct drm_file *file_priv) · 313 unmodified lines
314314 void drm_master_release(struct drm_file *file_priv)
315315 {
316316 struct drm_device *dev = file_priv->minor->dev;
317− struct drm_master *master = file_priv->master;
317+ struct drm_master *master;
318318
319319 mutex_lock(&dev->master_mutex);
320+ master = file_priv->master;
320321 if (file_priv->magic)
321322 idr_remove(&file_priv->master->magic_map, file_priv->magic);
322323
drivers/gpu/drm/drm_ioctl.c+5−4
@@ -118,17 +118,18 @@ int drm_getunique(struct drm_device *dev, void *data, · 117 unmodified lines
118118 struct drm_file *file_priv)
119119 {
120120 struct drm_unique *u = data;
121− struct drm_master *master = file_priv->master;
121+ struct drm_master *master;
122122
123− mutex_lock(&master->dev->master_mutex);
123+ mutex_lock(&dev->master_mutex);
124+ master = file_priv->master;
124125 if (u->unique_len >= master->unique_len) {
125126 if (copy_to_user(u->unique, master->unique, master->unique_len)) {
126− mutex_unlock(&master->dev->master_mutex);
127+ mutex_unlock(&dev->master_mutex);
127128 return -EFAULT;
128129 }
129130 }
130131 u->unique_len = master->unique_len;
131− mutex_unlock(&master->dev->master_mutex);
132+ mutex_unlock(&dev->master_mutex);
132133
133134 return 0;
134135 }
drivers/gpu/drm/i915/Kconfig+0−1
@@ -20,7 +20,6 @@ config DRM_I915 · 19 unmodified lines
2020 select INPUT if ACPI
2121 select ACPI_VIDEO if ACPI
2222 select ACPI_BUTTON if ACPI
23− select IO_MAPPING
2423 select SYNC_FILE
2524 select IOSF_MBI
2625 select CRC32
drivers/gpu/drm/i915/gem/i915_gem_mman.c+5−4
@@ -367,10 +367,11 @@ retry: · 366 unmodified lines
367367 goto err_unpin;
368368
369369 /* Finally, remap it using the new GTT offset */
370− ret = io_mapping_map_user(&ggtt->iomap, area, area->vm_start +
371− (vma->ggtt_view.partial.offset << PAGE_SHIFT),
372− (ggtt->gmadr.start + vma->node.start) >> PAGE_SHIFT,
373− min_t(u64, vma->size, area->vm_end - area->vm_start));
370+ ret = remap_io_mapping(area,
371+ area->vm_start + (vma->ggtt_view.partial.offset << PAGE_SHIFT),
372+ (ggtt->gmadr.start + vma->node.start) >> PAGE_SHIFT,
373+ min_t(u64, vma->size, area->vm_end - area->vm_start),
374+ &ggtt->iomap);
374375 if (ret)
375376 goto err_fence;
376377
drivers/gpu/drm/i915/i915_drv.h+3−0
@@ -1905,6 +1905,9 @@ int i915_reg_read_ioctl(struct drm_device *dev, void *data, · 1904 unmodified lines
19051905 struct drm_file *file);
19061906
19071907 /* i915_mm.c */
1908+int remap_io_mapping(struct vm_area_struct *vma,
1909+ unsigned long addr, unsigned long pfn, unsigned long size,
1910+ struct io_mapping *iomap);
19081911 int remap_io_sg(struct vm_area_struct *vma,
19091912 unsigned long addr, unsigned long size,
19101913 struct scatterlist *sgl, resource_size_t iobase);
drivers/gpu/drm/i915/i915_mm.c+44−0
@@ -37,6 +37,17 @@ struct remap_pfn { · 36 unmodified lines
3737 resource_size_t iobase;
3838 };
3939
40+static int remap_pfn(pte_t *pte, unsigned long addr, void *data)
41+{
42+ struct remap_pfn *r = data;
43+
44+ /* Special PTE are not associated with any struct page */
45+ set_pte_at(r->mm, addr, pte, pte_mkspecial(pfn_pte(r->pfn, r->prot)));
46+ r->pfn++;
47+
48+ return 0;
49+}
50+
4051 #define use_dma(io) ((io) != -1)
4152
4253 static inline unsigned long sgt_pfn(const struct remap_pfn *r)
@@ -66,7 +77,40 @@ static int remap_sg(pte_t *pte, unsigned long addr, void *data) · 23 unmodified lines
6677 return 0;
6778 }
6879
80+/**
81+ * remap_io_mapping - remap an IO mapping to userspace
82+ * @vma: user vma to map to
83+ * @addr: target user address to start at
84+ * @pfn: physical address of kernel memory
85+ * @size: size of map area
86+ * @iomap: the source io_mapping
87+ *
88+ * Note: this is only safe if the mm semaphore is held when called.
89+ */
90+int remap_io_mapping(struct vm_area_struct *vma,
91+ unsigned long addr, unsigned long pfn, unsigned long size,
92+ struct io_mapping *iomap)
93+{
94+ struct remap_pfn r;
95+ int err;
96+
6997 #define EXPECTED_FLAGS (VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP)
98+ GEM_BUG_ON((vma->vm_flags & EXPECTED_FLAGS) != EXPECTED_FLAGS);
99+
100+ /* We rely on prevalidation of the io-mapping to skip track_pfn(). */
101+ r.mm = vma->vm_mm;
102+ r.pfn = pfn;
103+ r.prot = __pgprot((pgprot_val(iomap->prot) & _PAGE_CACHE_MASK) |
104+ (pgprot_val(vma->vm_page_prot) & ~_PAGE_CACHE_MASK));
105+
106+ err = apply_to_page_range(r.mm, addr, size, remap_pfn, &r);
107+ if (unlikely(err)) {
108+ zap_vma_ptes(vma, addr, (r.pfn - pfn) << PAGE_SHIFT);
109+ return err;
110+ }
111+
112+ return 0;
113+}
70114
71115 /**
72116 * remap_io_sg - remap an IO mapping to userspace
drivers/gpu/drm/i915/selftests/i915_request.c+2−2
@@ -1592,8 +1592,8 @@ static int live_breadcrumbs_smoketest(void *arg) · 1591 unmodified lines
15921592
15931593 for (n = 0; n < smoke[0].ncontexts; n++) {
15941594 smoke[0].contexts[n] = live_context(i915, file);
1595− if (!smoke[0].contexts[n]) {
1596− ret = -ENOMEM;
1595+ if (IS_ERR(smoke[0].contexts[n])) {
1596+ ret = PTR_ERR(smoke[0].contexts[n]);
15971597 goto out_contexts;
15981598 }
15991599 }
drivers/gpu/drm/mcde/mcde_dsi.c+1−1
@@ -577,7 +577,7 @@ static void mcde_dsi_setup_video_mode(struct mcde_dsi *d, · 576 unmodified lines
577577 * porches and sync.
578578 */
579579 /* (ps/s) / (pixels/s) = ps/pixels */
580− pclk = DIV_ROUND_UP_ULL(1000000000000, mode->clock);
580+ pclk = DIV_ROUND_UP_ULL(1000000000000, (mode->clock * 1000));
581581 dev_dbg(d->dev, "picoseconds between two pixels: %llu\n",
582582 pclk);
583583
drivers/gpu/drm/msm/adreno/a6xx_gpu.c+114−41
@@ -157,7 +157,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 156 unmodified lines
157157 * GPU registers so we need to add 0x1a800 to the register value on A630
158158 * to get the right value from PM4.
159159 */
160− get_stats_counter(ring, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L + 0x1a800,
160+ get_stats_counter(ring, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO,
161161 rbmemptr_stats(ring, index, alwayson_start));
162162
163163 /* Invalidate CCU depth and color */
@@ -187,7 +187,7 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 23 unmodified lines
187187
188188 get_stats_counter(ring, REG_A6XX_RBBM_PERFCTR_CP_0_LO,
189189 rbmemptr_stats(ring, index, cpcycles_end));
190− get_stats_counter(ring, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L + 0x1a800,
190+ get_stats_counter(ring, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO,
191191 rbmemptr_stats(ring, index, alwayson_end));
192192
193193 /* Write the fence to the scratch register */
@@ -206,8 +206,8 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 12 unmodified lines
206206 OUT_RING(ring, submit->seqno);
207207
208208 trace_msm_gpu_submit_flush(submit,
209− gmu_read64(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L,
210− REG_A6XX_GMU_ALWAYS_ON_COUNTER_H));
209+ gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO,
210+ REG_A6XX_CP_ALWAYS_ON_COUNTER_HI));
211211
212212 a6xx_flush(gpu, ring);
213213 }
@@ -462,6 +462,113 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state) · 248 unmodified lines
462462 gpu_write(gpu, REG_A6XX_RBBM_CLOCK_CNTL, state ? clock_cntl_on : 0);
463463 }
464464
465+/* For a615, a616, a618, A619, a630, a640 and a680 */
466+static const u32 a6xx_protect[] = {
467+ A6XX_PROTECT_RDONLY(0x00000, 0x04ff),
468+ A6XX_PROTECT_RDONLY(0x00501, 0x0005),
469+ A6XX_PROTECT_RDONLY(0x0050b, 0x02f4),
470+ A6XX_PROTECT_NORDWR(0x0050e, 0x0000),
471+ A6XX_PROTECT_NORDWR(0x00510, 0x0000),
472+ A6XX_PROTECT_NORDWR(0x00534, 0x0000),
473+ A6XX_PROTECT_NORDWR(0x00800, 0x0082),
474+ A6XX_PROTECT_NORDWR(0x008a0, 0x0008),
475+ A6XX_PROTECT_NORDWR(0x008ab, 0x0024),
476+ A6XX_PROTECT_RDONLY(0x008de, 0x00ae),
477+ A6XX_PROTECT_NORDWR(0x00900, 0x004d),
478+ A6XX_PROTECT_NORDWR(0x0098d, 0x0272),
479+ A6XX_PROTECT_NORDWR(0x00e00, 0x0001),
480+ A6XX_PROTECT_NORDWR(0x00e03, 0x000c),
481+ A6XX_PROTECT_NORDWR(0x03c00, 0x00c3),
482+ A6XX_PROTECT_RDONLY(0x03cc4, 0x1fff),
483+ A6XX_PROTECT_NORDWR(0x08630, 0x01cf),
484+ A6XX_PROTECT_NORDWR(0x08e00, 0x0000),
485+ A6XX_PROTECT_NORDWR(0x08e08, 0x0000),
486+ A6XX_PROTECT_NORDWR(0x08e50, 0x001f),
487+ A6XX_PROTECT_NORDWR(0x09624, 0x01db),
488+ A6XX_PROTECT_NORDWR(0x09e70, 0x0001),
489+ A6XX_PROTECT_NORDWR(0x09e78, 0x0187),
490+ A6XX_PROTECT_NORDWR(0x0a630, 0x01cf),
491+ A6XX_PROTECT_NORDWR(0x0ae02, 0x0000),
492+ A6XX_PROTECT_NORDWR(0x0ae50, 0x032f),
493+ A6XX_PROTECT_NORDWR(0x0b604, 0x0000),
494+ A6XX_PROTECT_NORDWR(0x0be02, 0x0001),
495+ A6XX_PROTECT_NORDWR(0x0be20, 0x17df),
496+ A6XX_PROTECT_NORDWR(0x0f000, 0x0bff),
497+ A6XX_PROTECT_RDONLY(0x0fc00, 0x1fff),
498+ A6XX_PROTECT_NORDWR(0x11c00, 0x0000), /* note: infinite range */
499+};
500+
501+/* These are for a620 and a650 */
502+static const u32 a650_protect[] = {
503+ A6XX_PROTECT_RDONLY(0x00000, 0x04ff),
504+ A6XX_PROTECT_RDONLY(0x00501, 0x0005),
505+ A6XX_PROTECT_RDONLY(0x0050b, 0x02f4),
506+ A6XX_PROTECT_NORDWR(0x0050e, 0x0000),
507+ A6XX_PROTECT_NORDWR(0x00510, 0x0000),
508+ A6XX_PROTECT_NORDWR(0x00534, 0x0000),
509+ A6XX_PROTECT_NORDWR(0x00800, 0x0082),
510+ A6XX_PROTECT_NORDWR(0x008a0, 0x0008),
511+ A6XX_PROTECT_NORDWR(0x008ab, 0x0024),
512+ A6XX_PROTECT_RDONLY(0x008de, 0x00ae),
513+ A6XX_PROTECT_NORDWR(0x00900, 0x004d),
514+ A6XX_PROTECT_NORDWR(0x0098d, 0x0272),
515+ A6XX_PROTECT_NORDWR(0x00e00, 0x0001),
516+ A6XX_PROTECT_NORDWR(0x00e03, 0x000c),
517+ A6XX_PROTECT_NORDWR(0x03c00, 0x00c3),
518+ A6XX_PROTECT_RDONLY(0x03cc4, 0x1fff),
519+ A6XX_PROTECT_NORDWR(0x08630, 0x01cf),
520+ A6XX_PROTECT_NORDWR(0x08e00, 0x0000),
521+ A6XX_PROTECT_NORDWR(0x08e08, 0x0000),
522+ A6XX_PROTECT_NORDWR(0x08e50, 0x001f),
523+ A6XX_PROTECT_NORDWR(0x08e80, 0x027f),
524+ A6XX_PROTECT_NORDWR(0x09624, 0x01db),
525+ A6XX_PROTECT_NORDWR(0x09e60, 0x0011),
526+ A6XX_PROTECT_NORDWR(0x09e78, 0x0187),
527+ A6XX_PROTECT_NORDWR(0x0a630, 0x01cf),
528+ A6XX_PROTECT_NORDWR(0x0ae02, 0x0000),
529+ A6XX_PROTECT_NORDWR(0x0ae50, 0x032f),
530+ A6XX_PROTECT_NORDWR(0x0b604, 0x0000),
531+ A6XX_PROTECT_NORDWR(0x0b608, 0x0007),
532+ A6XX_PROTECT_NORDWR(0x0be02, 0x0001),
533+ A6XX_PROTECT_NORDWR(0x0be20, 0x17df),
534+ A6XX_PROTECT_NORDWR(0x0f000, 0x0bff),
535+ A6XX_PROTECT_RDONLY(0x0fc00, 0x1fff),
536+ A6XX_PROTECT_NORDWR(0x18400, 0x1fff),
537+ A6XX_PROTECT_NORDWR(0x1a800, 0x1fff),
538+ A6XX_PROTECT_NORDWR(0x1f400, 0x0443),
539+ A6XX_PROTECT_RDONLY(0x1f844, 0x007b),
540+ A6XX_PROTECT_NORDWR(0x1f887, 0x001b),
541+ A6XX_PROTECT_NORDWR(0x1f8c0, 0x0000), /* note: infinite range */
542+};
543+
544+static void a6xx_set_cp_protect(struct msm_gpu *gpu)
545+{
546+ struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
547+ const u32 *regs = a6xx_protect;
548+ unsigned i, count = ARRAY_SIZE(a6xx_protect), count_max = 32;
549+
550+ BUILD_BUG_ON(ARRAY_SIZE(a6xx_protect) > 32);
551+ BUILD_BUG_ON(ARRAY_SIZE(a650_protect) > 48);
552+
553+ if (adreno_is_a650(adreno_gpu)) {
554+ regs = a650_protect;
555+ count = ARRAY_SIZE(a650_protect);
556+ count_max = 48;
557+ }
558+
559+ /*
560+ * Enable access protection to privileged registers, fault on an access
561+ * protect violation and select the last span to protect from the start
562+ * address all the way to the end of the register address space
563+ */
564+ gpu_write(gpu, REG_A6XX_CP_PROTECT_CNTL, BIT(0) | BIT(1) | BIT(3));
565+
566+ for (i = 0; i < count - 1; i++)
567+ gpu_write(gpu, REG_A6XX_CP_PROTECT(i), regs[i]);
568+ /* last CP_PROTECT to have "infinite" length on the last entry */
569+ gpu_write(gpu, REG_A6XX_CP_PROTECT(count_max - 1), regs[i]);
570+}
571+
465572 static void a6xx_set_ubwc_config(struct msm_gpu *gpu)
466573 {
467574 struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
@@ -489,7 +596,7 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu) · 21 unmodified lines
489596 rgb565_predicator << 11 | amsbc << 4 | lower_bit << 1);
490597 gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, lower_bit << 1);
491598 gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL,
492− uavflagprd_inv >> 4 | lower_bit << 1);
599+ uavflagprd_inv << 4 | lower_bit << 1);
493600 gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, lower_bit << 21);
494601 }
495602
@@ -776,41 +883,7 @@ static int a6xx_hw_init(struct msm_gpu *gpu) · 280 unmodified lines
776883 }
777884
778885 /* Protect registers from the CP */
779− gpu_write(gpu, REG_A6XX_CP_PROTECT_CNTL, 0x00000003);
780−
781− gpu_write(gpu, REG_A6XX_CP_PROTECT(0),
782− A6XX_PROTECT_RDONLY(0x600, 0x51));
783− gpu_write(gpu, REG_A6XX_CP_PROTECT(1), A6XX_PROTECT_RW(0xae50, 0x2));
784− gpu_write(gpu, REG_A6XX_CP_PROTECT(2), A6XX_PROTECT_RW(0x9624, 0x13));
785− gpu_write(gpu, REG_A6XX_CP_PROTECT(3), A6XX_PROTECT_RW(0x8630, 0x8));
786− gpu_write(gpu, REG_A6XX_CP_PROTECT(4), A6XX_PROTECT_RW(0x9e70, 0x1));
787− gpu_write(gpu, REG_A6XX_CP_PROTECT(5), A6XX_PROTECT_RW(0x9e78, 0x187));
788− gpu_write(gpu, REG_A6XX_CP_PROTECT(6), A6XX_PROTECT_RW(0xf000, 0x810));
789− gpu_write(gpu, REG_A6XX_CP_PROTECT(7),
790− A6XX_PROTECT_RDONLY(0xfc00, 0x3));
791− gpu_write(gpu, REG_A6XX_CP_PROTECT(8), A6XX_PROTECT_RW(0x50e, 0x0));
792− gpu_write(gpu, REG_A6XX_CP_PROTECT(9), A6XX_PROTECT_RDONLY(0x50f, 0x0));
793− gpu_write(gpu, REG_A6XX_CP_PROTECT(10), A6XX_PROTECT_RW(0x510, 0x0));
794− gpu_write(gpu, REG_A6XX_CP_PROTECT(11),
795− A6XX_PROTECT_RDONLY(0x0, 0x4f9));
796− gpu_write(gpu, REG_A6XX_CP_PROTECT(12),
797− A6XX_PROTECT_RDONLY(0x501, 0xa));
798− gpu_write(gpu, REG_A6XX_CP_PROTECT(13),
799− A6XX_PROTECT_RDONLY(0x511, 0x44));
800− gpu_write(gpu, REG_A6XX_CP_PROTECT(14), A6XX_PROTECT_RW(0xe00, 0xe));
801− gpu_write(gpu, REG_A6XX_CP_PROTECT(15), A6XX_PROTECT_RW(0x8e00, 0x0));
802− gpu_write(gpu, REG_A6XX_CP_PROTECT(16), A6XX_PROTECT_RW(0x8e50, 0xf));
803− gpu_write(gpu, REG_A6XX_CP_PROTECT(17), A6XX_PROTECT_RW(0xbe02, 0x0));
804− gpu_write(gpu, REG_A6XX_CP_PROTECT(18),
805− A6XX_PROTECT_RW(0xbe20, 0x11f3));
806− gpu_write(gpu, REG_A6XX_CP_PROTECT(19), A6XX_PROTECT_RW(0x800, 0x82));
807− gpu_write(gpu, REG_A6XX_CP_PROTECT(20), A6XX_PROTECT_RW(0x8a0, 0x8));
808− gpu_write(gpu, REG_A6XX_CP_PROTECT(21), A6XX_PROTECT_RW(0x8ab, 0x19));
809− gpu_write(gpu, REG_A6XX_CP_PROTECT(22), A6XX_PROTECT_RW(0x900, 0x4d));
810− gpu_write(gpu, REG_A6XX_CP_PROTECT(23), A6XX_PROTECT_RW(0x98d, 0x76));
811− gpu_write(gpu, REG_A6XX_CP_PROTECT(24),
812− A6XX_PROTECT_RDONLY(0x980, 0x4));
813− gpu_write(gpu, REG_A6XX_CP_PROTECT(25), A6XX_PROTECT_RW(0xa630, 0x0));
886+ a6xx_set_cp_protect(gpu);
814887
815888 /* Enable expanded apriv for targets that support it */
816889 if (gpu->hw_apriv) {
@@ -1211,7 +1284,7 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) · 394 unmodified lines
12111284 if (ret)
12121285 return ret;
12131286
1214− if (adreno_gpu->base.hw_apriv || a6xx_gpu->has_whereami)
1287+ if (a6xx_gpu->shadow_bo)
12151288 for (i = 0; i < gpu->nr_rings; i++)
12161289 a6xx_gpu->shadow[i] = 0;
12171290
drivers/gpu/drm/msm/adreno/a6xx_gpu.h+1−1
@@ -44,7 +44,7 @@ struct a6xx_gpu { · 43 unmodified lines
4444 * REG_CP_PROTECT_REG(n) - this will block both reads and writes for _len
4545 * registers starting at _reg.
4646 */
47−#define A6XX_PROTECT_RW(_reg, _len) \
47+#define A6XX_PROTECT_NORDWR(_reg, _len) \
4848 ((1 << 31) | \
4949 (((_len) & 0x3FFF) << 18) | ((_reg) & 0x3FFFF))
5050
drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c+1−0
@@ -432,6 +432,7 @@ static unsigned long dsi_pll_10nm_vco_recalc_rate(struct clk_hw *hw, · 431 unmodified lines
432432 pll_freq += div_u64(tmp64, multiplier);
433433
434434 vco_rate = pll_freq;
435+ pll_10nm->vco_current_rate = vco_rate;
435436
436437 DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x",
437438 pll_10nm->phy->id, (unsigned long)vco_rate, dec, frac);
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c+1−0
@@ -460,6 +460,7 @@ static unsigned long dsi_pll_7nm_vco_recalc_rate(struct clk_hw *hw, · 459 unmodified lines
460460 pll_freq += div_u64(tmp64, multiplier);
461461
462462 vco_rate = pll_freq;
463+ pll_7nm->vco_current_rate = vco_rate;
463464
464465 DBG("DSI PLL%d returning vco rate = %lu, dec = %x, frac = %x",
465466 pll_7nm->phy->id, (unsigned long)vco_rate, dec, frac);
drivers/gpu/drm/msm/msm_gem.c+7−0
@@ -1241,6 +1241,13 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, · 1240 unmodified lines
12411241
12421242 to_msm_bo(obj)->vram_node = &vma->node;
12431243
1244+ /* Call chain get_pages() -> update_inactive() tries to
1245+ * access msm_obj->mm_list, but it is not initialized yet.
1246+ * To avoid NULL pointer dereference error, initialize
1247+ * mm_list to be empty.
1248+ */
1249+ INIT_LIST_HEAD(&msm_obj->mm_list);
1250+
12441251 msm_gem_lock(obj);
12451252 pages = get_pages(obj);
12461253 msm_gem_unlock(obj);
drivers/gpu/drm/radeon/radeon_uvd.c+2−2
@@ -286,7 +286,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) · 285 unmodified lines
286286 if (rdev->uvd.vcpu_bo == NULL)
287287 return -EINVAL;
288288
289− memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
289+ memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
290290
291291 size = radeon_bo_size(rdev->uvd.vcpu_bo);
292292 size -= rdev->uvd_fw->size;
@@ -294,7 +294,7 @@ int radeon_uvd_resume(struct radeon_device *rdev) · 1 unmodified line
294294 ptr = rdev->uvd.cpu_addr;
295295 ptr += rdev->uvd_fw->size;
296296
297− memset(ptr, 0, size);
297+ memset_io((void __iomem *)ptr, 0, size);
298298
299299 return 0;
300300 }
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c+27−4
@@ -209,7 +209,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, · 208 unmodified lines
209209 goto err_disable_clk_tmds;
210210 }
211211
212− ret = sun8i_hdmi_phy_probe(hdmi, phy_node);
212+ ret = sun8i_hdmi_phy_get(hdmi, phy_node);
213213 of_node_put(phy_node);
214214 if (ret) {
215215 dev_err(dev, "Couldn't get the HDMI PHY\n");
@@ -242,7 +242,6 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, · 26 unmodified lines
242242
243243 cleanup_encoder:
244244 drm_encoder_cleanup(encoder);
245− sun8i_hdmi_phy_remove(hdmi);
246245 err_disable_clk_tmds:
247246 clk_disable_unprepare(hdmi->clk_tmds);
248247 err_assert_ctrl_reset:
@@ -263,7 +262,6 @@ static void sun8i_dw_hdmi_unbind(struct device *dev, struct device *master, · 14 unmodified lines
263262 struct sun8i_dw_hdmi *hdmi = dev_get_drvdata(dev);
264263
265264 dw_hdmi_unbind(hdmi->hdmi);
266− sun8i_hdmi_phy_remove(hdmi);
267265 clk_disable_unprepare(hdmi->clk_tmds);
268266 reset_control_assert(hdmi->rst_ctrl);
269267 gpiod_set_value(hdmi->ddc_en, 0);
@@ -320,7 +318,32 @@ static struct platform_driver sun8i_dw_hdmi_pltfm_driver = { · 50 unmodified lines
320318 .of_match_table = sun8i_dw_hdmi_dt_ids,
321319 },
322320 };
323−module_platform_driver(sun8i_dw_hdmi_pltfm_driver);
321+
322+static int __init sun8i_dw_hdmi_init(void)
323+{
324+ int ret;
325+
326+ ret = platform_driver_register(&sun8i_dw_hdmi_pltfm_driver);
327+ if (ret)
328+ return ret;
329+
330+ ret = platform_driver_register(&sun8i_hdmi_phy_driver);
331+ if (ret) {
332+ platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver);
333+ return ret;
334+ }
335+
336+ return ret;
337+}
338+
339+static void __exit sun8i_dw_hdmi_exit(void)
340+{
341+ platform_driver_unregister(&sun8i_dw_hdmi_pltfm_driver);
342+ platform_driver_unregister(&sun8i_hdmi_phy_driver);
343+}
344+
345+module_init(sun8i_dw_hdmi_init);
346+module_exit(sun8i_dw_hdmi_exit);
324347
325348 MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>");
326349 MODULE_DESCRIPTION("Allwinner DW HDMI bridge");
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h+3−2
@@ -195,14 +195,15 @@ struct sun8i_dw_hdmi { · 194 unmodified lines
195195 struct gpio_desc *ddc_en;
196196 };
197197
198+extern struct platform_driver sun8i_hdmi_phy_driver;
199+
198200 static inline struct sun8i_dw_hdmi *
199201 encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder)
200202 {
201203 return container_of(encoder, struct sun8i_dw_hdmi, encoder);
202204 }
203205
204−int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node);
205−void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi);
206+int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node);
206207
207208 void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy);
208209 void sun8i_hdmi_phy_set_ops(struct sun8i_hdmi_phy *phy,
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c+36−5
@@ -5,6 +5,7 @@ · 4 unmodified lines
55
66 #include <linux/delay.h>
77 #include <linux/of_address.h>
8+#include <linux/of_platform.h>
89
910 #include "sun8i_dw_hdmi.h"
1011
@@ -597,10 +598,30 @@ static const struct of_device_id sun8i_hdmi_phy_of_table[] = { · 586 unmodified lines
597598 { /* sentinel */ }
598599 };
599600
600−int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
601+int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node)
602+{
603+ struct platform_device *pdev = of_find_device_by_node(node);
604+ struct sun8i_hdmi_phy *phy;
605+
606+ if (!pdev)
607+ return -EPROBE_DEFER;
608+
609+ phy = platform_get_drvdata(pdev);
610+ if (!phy)
611+ return -EPROBE_DEFER;
612+
613+ hdmi->phy = phy;
614+
615+ put_device(&pdev->dev);
616+
617+ return 0;
618+}
619+
620+static int sun8i_hdmi_phy_probe(struct platform_device *pdev)
601621 {
602622 const struct of_device_id *match;
603− struct device *dev = hdmi->dev;
623+ struct device *dev = &pdev->dev;
624+ struct device_node *node = dev->of_node;
604625 struct sun8i_hdmi_phy *phy;
605626 struct resource res;
606627 void __iomem *regs;
@@ -704,7 +725,7 @@ int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node) · 97 unmodified lines
704725 clk_prepare_enable(phy->clk_phy);
705726 }
706727
707− hdmi->phy = phy;
728+ platform_set_drvdata(pdev, phy);
708729
709730 return 0;
710731
@@ -728,9 +749,9 @@ err_put_clk_bus: · 17 unmodified lines
728749 return ret;
729750 }
730751
731−void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi)
752+static int sun8i_hdmi_phy_remove(struct platform_device *pdev)
732753 {
733− struct sun8i_hdmi_phy *phy = hdmi->phy;
754+ struct sun8i_hdmi_phy *phy = platform_get_drvdata(pdev);
734755
735756 clk_disable_unprepare(phy->clk_mod);
736757 clk_disable_unprepare(phy->clk_bus);
@@ -744,4 +765,14 @@ void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi) · 7 unmodified lines
744765 clk_put(phy->clk_pll1);
745766 clk_put(phy->clk_mod);
746767 clk_put(phy->clk_bus);
768+ return 0;
747769 }
770+
771+struct platform_driver sun8i_hdmi_phy_driver = {
772+ .probe = sun8i_hdmi_phy_probe,
773+ .remove = sun8i_hdmi_phy_remove,
774+ .driver = {
775+ .name = "sun8i-hdmi-phy",
776+ .of_match_table = sun8i_hdmi_phy_of_table,
777+ },
778+};
drivers/gpu/drm/tegra/drm.h+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 #include "trace.h"
2626
2727 /* XXX move to include/uapi/drm/drm_fourcc.h? */
28−#define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT(22)
28+#define DRM_FORMAT_MOD_NVIDIA_SECTOR_LAYOUT BIT_ULL(22)
2929
3030 struct reset_control;
3131
drivers/gpu/drm/tegra/hub.c+1−1
@@ -510,7 +510,7 @@ static void tegra_shared_plane_atomic_update(struct drm_plane *plane, · 509 unmodified lines
510510 * dGPU sector layout.
511511 */
512512 if (tegra_plane_state->tiling.sector_layout == TEGRA_BO_SECTOR_LAYOUT_GPU)
513− base |= BIT(39);
513+ base |= BIT_ULL(39);
514514 #endif
515515
516516 tegra_plane_writel(p, tegra_plane_state->format, DC_WIN_COLOR_DEPTH);
drivers/gpu/drm/tegra/sor.c+42−28
@@ -3125,21 +3125,21 @@ static int tegra_sor_init(struct host1x_client *client) · 3124 unmodified lines
31253125 if (err < 0) {
31263126 dev_err(sor->dev, "failed to acquire SOR reset: %d\n",
31273127 err);
3128− return err;
3128+ goto rpm_put;
31293129 }
31303130
31313131 err = reset_control_assert(sor->rst);
31323132 if (err < 0) {
31333133 dev_err(sor->dev, "failed to assert SOR reset: %d\n",
31343134 err);
3135− return err;
3135+ goto rpm_put;
31363136 }
31373137 }
31383138
31393139 err = clk_prepare_enable(sor->clk);
31403140 if (err < 0) {
31413141 dev_err(sor->dev, "failed to enable clock: %d\n", err);
3142− return err;
3142+ goto rpm_put;
31433143 }
31443144
31453145 usleep_range(1000, 3000);
@@ -3150,7 +3150,7 @@ static int tegra_sor_init(struct host1x_client *client) · 4 unmodified lines
31503150 dev_err(sor->dev, "failed to deassert SOR reset: %d\n",
31513151 err);
31523152 clk_disable_unprepare(sor->clk);
3153− return err;
3153+ goto rpm_put;
31543154 }
31553155
31563156 reset_control_release(sor->rst);
@@ -3171,6 +3171,12 @@ static int tegra_sor_init(struct host1x_client *client) · 14 unmodified lines
31713171 }
31723172
31733173 return 0;
3174+
3175+rpm_put:
3176+ if (sor->rst)
3177+ pm_runtime_put(sor->dev);
3178+
3179+ return err;
31743180 }
31753181
31763182 static int tegra_sor_exit(struct host1x_client *client)
@@ -3739,12 +3745,8 @@ static int tegra_sor_probe(struct platform_device *pdev) · 562 unmodified lines
37393745 if (!sor->aux)
37403746 return -EPROBE_DEFER;
37413747
3742− if (get_device(&sor->aux->ddc.dev)) {
3743− if (try_module_get(sor->aux->ddc.owner))
3744− sor->output.ddc = &sor->aux->ddc;
3745− else
3746− put_device(&sor->aux->ddc.dev);
3747− }
3748+ if (get_device(sor->aux->dev))
3749+ sor->output.ddc = &sor->aux->ddc;
37483750 }
37493751
37503752 if (!sor->aux) {
@@ -3772,12 +3774,13 @@ static int tegra_sor_probe(struct platform_device *pdev) · 21 unmodified lines
37723774
37733775 err = tegra_sor_parse_dt(sor);
37743776 if (err < 0)
3775− return err;
3777+ goto put_aux;
37763778
37773779 err = tegra_output_probe(&sor->output);
3778− if (err < 0)
3779− return dev_err_probe(&pdev->dev, err,
3780− "failed to probe output\n");
3780+ if (err < 0) {
3781+ dev_err_probe(&pdev->dev, err, "failed to probe output\n");
3782+ goto put_aux;
3783+ }
37813784
37823785 if (sor->ops && sor->ops->probe) {
37833786 err = sor->ops->probe(sor);
@@ -3916,17 +3919,10 @@ static int tegra_sor_probe(struct platform_device *pdev) · 132 unmodified lines
39163919 platform_set_drvdata(pdev, sor);
39173920 pm_runtime_enable(&pdev->dev);
39183921
3919− INIT_LIST_HEAD(&sor->client.list);
3922+ host1x_client_init(&sor->client);
39203923 sor->client.ops = &sor_client_ops;
39213924 sor->client.dev = &pdev->dev;
39223925
3923− err = host1x_client_register(&sor->client);
3924− if (err < 0) {
3925− dev_err(&pdev->dev, "failed to register host1x client: %d\n",
3926− err);
3927− goto rpm_disable;
3928− }
3929−
39303926 /*
39313927 * On Tegra210 and earlier, provide our own implementation for the
39323928 * pad output clock.
@@ -3938,13 +3934,13 @@ static int tegra_sor_probe(struct platform_device *pdev) · 5 unmodified lines
39383934 sor->index);
39393935 if (!name) {
39403936 err = -ENOMEM;
3941− goto unregister;
3937+ goto uninit;
39423938 }
39433939
39443940 err = host1x_client_resume(&sor->client);
39453941 if (err < 0) {
39463942 dev_err(sor->dev, "failed to resume: %d\n", err);
3947− goto unregister;
3943+ goto uninit;
39483944 }
39493945
39503946 sor->clk_pad = tegra_clk_sor_pad_register(sor, name);
@@ -3955,17 +3951,30 @@ static int tegra_sor_probe(struct platform_device *pdev) · 4 unmodified lines
39553951 err = PTR_ERR(sor->clk_pad);
39563952 dev_err(sor->dev, "failed to register SOR pad clock: %d\n",
39573953 err);
3958− goto unregister;
3954+ goto uninit;
3955+ }
3956+
3957+ err = __host1x_client_register(&sor->client);
3958+ if (err < 0) {
3959+ dev_err(&pdev->dev, "failed to register host1x client: %d\n",
3960+ err);
3961+ goto uninit;
39593962 }
39603963
39613964 return 0;
39623965
3963−unregister:
3964− host1x_client_unregister(&sor->client);
3965−rpm_disable:
3966+uninit:
3967+ host1x_client_exit(&sor->client);
39663968 pm_runtime_disable(&pdev->dev);
39673969 remove:
3970+ if (sor->aux)
3971+ sor->output.ddc = NULL;
3972+
39683973 tegra_output_remove(&sor->output);
3974+put_aux:
3975+ if (sor->aux)
3976+ put_device(sor->aux->dev);
3977+
39693978 return err;
39703979 }
39713980
@@ -3983,6 +3992,11 @@ static int tegra_sor_remove(struct platform_device *pdev) · 11 unmodified lines
39833992
39843993 pm_runtime_disable(&pdev->dev);
39853994
3995+ if (sor->aux) {
3996+ put_device(sor->aux->dev);
3997+ sor->output.ddc = NULL;
3998+ }
3999+
39864000 tegra_output_remove(&sor->output);
39874001
39884002 return 0;
drivers/gpu/drm/ttm/ttm_bo.c+4−1
@@ -1172,7 +1172,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 1171 unmodified lines
11721172 if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL))
11731173 return -EBUSY;
11741174
1175− if (!ttm_bo_get_unless_zero(bo)) {
1175+ if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
1176+ bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
1177+ bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
1178+ !ttm_bo_get_unless_zero(bo)) {
11761179 if (locked)
11771180 dma_resv_unlock(bo->base.resv);
11781181 return -EBUSY;
drivers/gpu/drm/ttm/ttm_device.c+1−7
@@ -143,14 +143,8 @@ int ttm_device_swapout(struct ttm_device *bdev, struct ttm_operation_ctx *ctx, · 142 unmodified lines
143143
144144 for (j = 0; j < TTM_MAX_BO_PRIORITY; ++j) {
145145 list_for_each_entry(bo, &man->lru[j], lru) {
146− uint32_t num_pages;
146+ uint32_t num_pages = PFN_UP(bo->base.size);
147147
148− if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
149− bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
150− bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED)
151− continue;
152−
153− num_pages = bo->ttm->num_pages;
154148 ret = ttm_bo_swapout(bo, ctx, gfp_flags);
155149 /* ttm_bo_swapout has dropped the lru_lock */
156150 if (!ret)
drivers/gpu/drm/vc4/vc4_kms.c+1−1
@@ -372,7 +372,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) · 371 unmodified lines
372372 if (!old_hvs_state->fifo_state[channel].in_use)
373373 continue;
374374
375− ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[i].pending_commit);
375+ ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[channel].pending_commit);
376376 if (ret)
377377 drm_err(dev, "Timed out waiting for commit\n");
378378 }
drivers/gpu/host1x/bus.c+24−6
@@ -735,6 +735,29 @@ void host1x_driver_unregister(struct host1x_driver *driver) · 734 unmodified lines
735735 }
736736 EXPORT_SYMBOL(host1x_driver_unregister);
737737
738+/**
739+ * __host1x_client_init() - initialize a host1x client
740+ * @client: host1x client
741+ * @key: lock class key for the client-specific mutex
742+ */
743+void __host1x_client_init(struct host1x_client *client, struct lock_class_key *key)
744+{
745+ INIT_LIST_HEAD(&client->list);
746+ __mutex_init(&client->lock, "host1x client lock", key);
747+ client->usecount = 0;
748+}
749+EXPORT_SYMBOL(__host1x_client_init);
750+
751+/**
752+ * host1x_client_exit() - uninitialize a host1x client
753+ * @client: host1x client
754+ */
755+void host1x_client_exit(struct host1x_client *client)
756+{
757+ mutex_destroy(&client->lock);
758+}
759+EXPORT_SYMBOL(host1x_client_exit);
760+
738761 /**
739762 * __host1x_client_register() - register a host1x client
740763 * @client: host1x client
@@ -747,16 +770,11 @@ EXPORT_SYMBOL(host1x_driver_unregister); · 6 unmodified lines
747770 * device and call host1x_device_init(), which will in turn call each client's
748771 * &host1x_client_ops.init implementation.
749772 */
750−int __host1x_client_register(struct host1x_client *client,
751− struct lock_class_key *key)
773+int __host1x_client_register(struct host1x_client *client)
752774 {
753775 struct host1x *host1x;
754776 int err;
755777
756− INIT_LIST_HEAD(&client->list);
757− __mutex_init(&client->lock, "host1x client lock", key);
758− client->usecount = 0;
759−
760778 mutex_lock(&devices_lock);
761779
762780 list_for_each_entry(host1x, &devices, list) {
drivers/hid/Kconfig+17−2
@@ -93,11 +93,11 @@ menu "Special HID drivers" · 92 unmodified lines
9393 depends on HID
9494
9595 config HID_A4TECH
96− tristate "A4 tech mice"
96+ tristate "A4TECH mice"
9797 depends on HID
9898 default !EXPERT
9999 help
100− Support for A4 tech X5 and WOP-35 / Trust 450L mice.
100+ Support for some A4TECH mice with two scroll wheels.
101101
102102 config HID_ACCUTOUCH
103103 tristate "Accutouch touch device"
@@ -922,6 +922,21 @@ config HID_SAMSUNG · 818 unmodified lines
922922 help
923923 Support for Samsung InfraRed remote control or keyboards.
924924
925+config HID_SEMITEK
926+ tristate "Semitek USB keyboards"
927+ depends on HID
928+ help
929+ Support for Semitek USB keyboards that are not fully compliant
930+ with the HID standard.
931+
932+ There are many variants, including:
933+ - GK61, GK64, GK68, GK84, GK96, etc.
934+ - SK61, SK64, SK68, SK84, SK96, etc.
935+ - Dierya DK61/DK66
936+ - Tronsmart TK09R
937+ - Woo-dy
938+ - X-Bows Nature/Knight
939+
925940 config HID_SONY
926941 tristate "Sony PS2/3/4 accessories"
927942 depends on USB_HID
drivers/hid/Makefile+1−0
@@ -106,6 +106,7 @@ obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ · 105 unmodified lines
106106 obj-$(CONFIG_HID_RMI) += hid-rmi.o
107107 obj-$(CONFIG_HID_SAITEK) += hid-saitek.o
108108 obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
109+obj-$(CONFIG_HID_SEMITEK) += hid-semitek.o
109110 obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o
110111 obj-$(CONFIG_HID_SONY) += hid-sony.o
111112 obj-$(CONFIG_HID_SPEEDLINK) += hid-speedlink.o
drivers/hid/amd-sfh-hid/amd_sfh_client.c+10−9
@@ -88,6 +88,7 @@ static void amd_sfh_work(struct work_struct *work) · 87 unmodified lines
8888 sensor_index = req_node->sensor_idx;
8989 report_id = req_node->report_id;
9090 node_type = req_node->report_type;
91+ kfree(req_node);
9192
9293 if (node_type == HID_FEATURE_REPORT) {
9394 report_size = get_feature_report(sensor_index, report_id,
@@ -142,7 +143,7 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) · 48 unmodified lines
142143 int rc, i;
143144
144145 dev = &privdata->pdev->dev;
145− cl_data = kzalloc(sizeof(*cl_data), GFP_KERNEL);
146+ cl_data = devm_kzalloc(dev, sizeof(*cl_data), GFP_KERNEL);
146147 if (!cl_data)
147148 return -ENOMEM;
148149
@@ -175,12 +176,12 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) · 26 unmodified lines
175176 rc = -EINVAL;
176177 goto cleanup;
177178 }
178− cl_data->feature_report[i] = kzalloc(feature_report_size, GFP_KERNEL);
179+ cl_data->feature_report[i] = devm_kzalloc(dev, feature_report_size, GFP_KERNEL);
179180 if (!cl_data->feature_report[i]) {
180181 rc = -ENOMEM;
181182 goto cleanup;
182183 }
183− cl_data->input_report[i] = kzalloc(input_report_size, GFP_KERNEL);
184+ cl_data->input_report[i] = devm_kzalloc(dev, input_report_size, GFP_KERNEL);
184185 if (!cl_data->input_report[i]) {
185186 rc = -ENOMEM;
186187 goto cleanup;
@@ -189,7 +190,8 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) · 2 unmodified lines
189190 info.sensor_idx = cl_idx;
190191 info.dma_address = cl_data->sensor_dma_addr[i];
191192
192− cl_data->report_descr[i] = kzalloc(cl_data->report_descr_sz[i], GFP_KERNEL);
193+ cl_data->report_descr[i] =
194+ devm_kzalloc(dev, cl_data->report_descr_sz[i], GFP_KERNEL);
193195 if (!cl_data->report_descr[i]) {
194196 rc = -ENOMEM;
195197 goto cleanup;
@@ -214,11 +216,11 @@ cleanup: · 18 unmodified lines
214216 cl_data->sensor_virt_addr[i],
215217 cl_data->sensor_dma_addr[i]);
216218 }
217− kfree(cl_data->feature_report[i]);
218− kfree(cl_data->input_report[i]);
219− kfree(cl_data->report_descr[i]);
219+ devm_kfree(dev, cl_data->feature_report[i]);
220+ devm_kfree(dev, cl_data->input_report[i]);
221+ devm_kfree(dev, cl_data->report_descr[i]);
220222 }
221− kfree(cl_data);
223+ devm_kfree(dev, cl_data);
222224 return rc;
223225 }
224226
@@ -241,6 +243,5 @@ int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata) · 16 unmodified lines
241243 cl_data->sensor_dma_addr[i]);
242244 }
243245 }
244− kfree(cl_data);
245246 return 0;
246247 }
drivers/hid/amd-sfh-hid/amd_sfh_hid.c+0−3
@@ -162,9 +162,6 @@ void amdtp_hid_remove(struct amdtp_cl_data *cli_data) · 161 unmodified lines
162162 int i;
163163
164164 for (i = 0; i < cli_data->num_hid_devices; ++i) {
165− kfree(cli_data->feature_report[i]);
166− kfree(cli_data->input_report[i]);
167− kfree(cli_data->report_descr[i]);
168165 if (cli_data->hid_sensor_hubs[i]) {
169166 kfree(cli_data->hid_sensor_hubs[i]->driver_data);
170167 hid_destroy_device(cli_data->hid_sensor_hubs[i]);
drivers/hid/hid-a4tech.c+2−0
@@ -147,6 +147,8 @@ static const struct hid_device_id a4_devices[] = { · 146 unmodified lines
147147 .driver_data = A4_2WHEEL_MOUSE_HACK_B8 },
148148 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649),
149149 .driver_data = A4_2WHEEL_MOUSE_HACK_B8 },
150+ { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_NB_95),
151+ .driver_data = A4_2WHEEL_MOUSE_HACK_B8 },
150152 { }
151153 };
152154 MODULE_DEVICE_TABLE(hid, a4_devices);
drivers/hid/hid-asus.c+20−12
@@ -79,10 +79,9 @@ MODULE_DESCRIPTION("Asus HID Keyboard and TouchPad"); · 78 unmodified lines
7979 #define QUIRK_T100_KEYBOARD BIT(6)
8080 #define QUIRK_T100CHI BIT(7)
8181 #define QUIRK_G752_KEYBOARD BIT(8)
82−#define QUIRK_T101HA_DOCK BIT(9)
83−#define QUIRK_T90CHI BIT(10)
84−#define QUIRK_MEDION_E1239T BIT(11)
85−#define QUIRK_ROG_NKEY_KEYBOARD BIT(12)
82+#define QUIRK_T90CHI BIT(9)
83+#define QUIRK_MEDION_E1239T BIT(10)
84+#define QUIRK_ROG_NKEY_KEYBOARD BIT(11)
8685
8786 #define I2C_KEYBOARD_QUIRKS (QUIRK_FIX_NOTEBOOK_REPORT | \
8887 QUIRK_NO_INIT_REPORTS | \
@@ -335,7 +334,7 @@ static int asus_raw_event(struct hid_device *hdev, · 246 unmodified lines
335334 if (drvdata->quirks & QUIRK_MEDION_E1239T)
336335 return asus_e1239t_event(drvdata, data, size);
337336
338− if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
337+ if (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) {
339338 /*
340339 * Skip these report ID, the device emits a continuous stream associated
341340 * with the AURA mode it is in which looks like an 'echo'.
@@ -355,6 +354,16 @@ static int asus_raw_event(struct hid_device *hdev, · 13 unmodified lines
355354 return -1;
356355 }
357356 }
357+ if (drvdata->quirks & QUIRK_ROG_NKEY_KEYBOARD) {
358+ /*
359+ * G713 and G733 send these codes on some keypresses, depending on
360+ * the key pressed it can trigger a shutdown event if not caught.
361+ */
362+ if(data[0] == 0x02 && data[1] == 0x30) {
363+ return -1;
364+ }
365+ }
366+
358367 }
359368
360369 return 0;
@@ -1072,11 +1081,6 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) · 711 unmodified lines
10721081 return ret;
10731082 }
10741083
1075− /* use hid-multitouch for T101HA touchpad */
1076− if (id->driver_data & QUIRK_T101HA_DOCK &&
1077− hdev->collection->usage == HID_GD_MOUSE)
1078− return -ENODEV;
1079−
10801084 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
10811085 if (ret) {
10821086 hid_err(hdev, "Asus hw start failed: %d\n", ret);
@@ -1230,8 +1234,6 @@ static const struct hid_device_id asus_devices[] = { · 147 unmodified lines
12301234 { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
12311235 USB_DEVICE_ID_ASUSTEK_T100TAF_KEYBOARD),
12321236 QUIRK_T100_KEYBOARD | QUIRK_NO_CONSUMER_USAGES },
1233− { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK,
1234− USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD), QUIRK_T101HA_DOCK },
12351237 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_ASUS_AK1D) },
12361238 { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_ASUS_MD_5110) },
12371239 { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_ASUS_MD_5112) },
@@ -1239,6 +1241,12 @@ static const struct hid_device_id asus_devices[] = { · 1 unmodified line
12391241 USB_DEVICE_ID_ASUSTEK_T100CHI_KEYBOARD), QUIRK_T100CHI },
12401242 { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE_MEDION_E1239T),
12411243 QUIRK_MEDION_E1239T },
1244+ /*
1245+ * Note bind to the HID_GROUP_GENERIC group, so that we only bind to the keyboard
1246+ * part, while letting hid-multitouch.c handle the touchpad.
1247+ */
1248+ { HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
1249+ USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) },
12421250 { }
12431251 };
12441252 MODULE_DEVICE_TABLE(hid, asus_devices);
drivers/hid/hid-core.c+3−1
@@ -2005,6 +2005,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) · 2004 unmodified lines
20052005 case BUS_I2C:
20062006 bus = "I2C";
20072007 break;
2008+ case BUS_VIRTUAL:
2009+ bus = "VIRTUAL";
2010+ break;
20082011 default:
20092012 bus = "<UNKNOWN>";
20102013 }
@@ -2588,7 +2591,6 @@ int hid_check_keys_pressed(struct hid_device *hid) · 577 unmodified lines
25882591
25892592 return 0;
25902593 }
2591−
25922594 EXPORT_SYMBOL_GPL(hid_check_keys_pressed);
25932595
25942596 static int __init hid_init(void)
drivers/hid/hid-debug.c+3−0
@@ -930,6 +930,9 @@ static const char *keys[KEY_MAX + 1] = { · 929 unmodified lines
930930 [KEY_APPSELECT] = "AppSelect",
931931 [KEY_SCREENSAVER] = "ScreenSaver",
932932 [KEY_VOICECOMMAND] = "VoiceCommand",
933+ [KEY_ASSISTANT] = "Assistant",
934+ [KEY_KBD_LAYOUT_NEXT] = "KbdLayoutNext",
935+ [KEY_EMOJI_PICKER] = "EmojiPicker",
933936 [KEY_BRIGHTNESS_MIN] = "BrightnessMin",
934937 [KEY_BRIGHTNESS_MAX] = "BrightnessMax",
935938 [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto",
drivers/hid/hid-ft260.c+16−13
@@ -201,7 +201,7 @@ struct ft260_i2c_write_request_report { · 200 unmodified lines
201201 u8 address; /* 7-bit I2C address */
202202 u8 flag; /* I2C transaction condition */
203203 u8 length; /* data payload length */
204− u8 data[60]; /* data payload */
204+ u8 data[FT260_WR_DATA_MAX]; /* data payload */
205205 } __packed;
206206
207207 struct ft260_i2c_read_request_report {
@@ -249,7 +249,10 @@ static int ft260_hid_feature_report_get(struct hid_device *hdev, · 41 unmodified lines
249249
250250 ret = hid_hw_raw_request(hdev, report_id, buf, len, HID_FEATURE_REPORT,
251251 HID_REQ_GET_REPORT);
252− memcpy(data, buf, len);
252+ if (likely(ret == len))
253+ memcpy(data, buf, len);
254+ else if (ret >= 0)
255+ ret = -EIO;
253256 kfree(buf);
254257 return ret;
255258 }
@@ -298,7 +301,7 @@ static int ft260_xfer_status(struct ft260_device *dev) · 42 unmodified lines
298301
299302 ret = ft260_hid_feature_report_get(hdev, FT260_I2C_STATUS,
300303 (u8 *)&report, sizeof(report));
301− if (ret < 0) {
304+ if (unlikely(ret < 0)) {
302305 hid_err(hdev, "failed to retrieve status: %d\n", ret);
303306 return ret;
304307 }
@@ -429,6 +432,9 @@ static int ft260_smbus_write(struct ft260_device *dev, u8 addr, u8 cmd, · 124 unmodified lines
429432 struct ft260_i2c_write_request_report *rep =
430433 (struct ft260_i2c_write_request_report *)dev->write_buf;
431434
435+ if (data_len >= sizeof(rep->data))
436+ return -EINVAL;
437+
432438 rep->address = addr;
433439 rep->data[0] = cmd;
434440 rep->length = data_len + 1;
@@ -721,10 +727,9 @@ static int ft260_get_system_config(struct hid_device *hdev, · 286 unmodified lines
721727
722728 ret = ft260_hid_feature_report_get(hdev, FT260_SYSTEM_SETTINGS,
723729 (u8 *)cfg, len);
724− if (ret != len) {
730+ if (ret < 0) {
725731 hid_err(hdev, "failed to retrieve system status\n");
726− if (ret >= 0)
727− return -EIO;
732+ return ret;
728733 }
729734 return 0;
730735 }
@@ -777,8 +782,8 @@ static int ft260_byte_show(struct hid_device *hdev, int id, u8 *cfg, int len, · 46 unmodified lines
777782 int ret;
778783
779784 ret = ft260_hid_feature_report_get(hdev, id, cfg, len);
780− if (ret != len && ret >= 0)
781− return -EIO;
785+ if (ret < 0)
786+ return ret;
782787
783788 return scnprintf(buf, PAGE_SIZE, "%hi\n", *field);
784789 }
@@ -789,8 +794,8 @@ static int ft260_word_show(struct hid_device *hdev, int id, u8 *cfg, int len, · 4 unmodified lines
789794 int ret;
790795
791796 ret = ft260_hid_feature_report_get(hdev, id, cfg, len);
792− if (ret != len && ret >= 0)
793− return -EIO;
797+ if (ret < 0)
798+ return ret;
794799
795800 return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field));
796801 }
@@ -941,10 +946,8 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id) · 144 unmodified lines
941946
942947 ret = ft260_hid_feature_report_get(hdev, FT260_CHIP_VERSION,
943948 (u8 *)&version, sizeof(version));
944− if (ret != sizeof(version)) {
949+ if (ret < 0) {
945950 hid_err(hdev, "failed to retrieve chip version\n");
946− if (ret >= 0)
947− ret = -EIO;
948951 goto err_hid_close;
949952 }
950953
drivers/hid/hid-gt683r.c+1−0
@@ -54,6 +54,7 @@ static const struct hid_device_id gt683r_led_id[] = { · 53 unmodified lines
5454 { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
5555 { }
5656 };
57+MODULE_DEVICE_TABLE(hid, gt683r_led_id);
5758
5859 static void gt683r_brightness_set(struct led_classdev *led_cdev,
5960 enum led_brightness brightness)
drivers/hid/hid-ids.h+7−2
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
2727 #define USB_DEVICE_ID_A4TECH_X5_005D 0x000a
2828 #define USB_DEVICE_ID_A4TECH_RP_649 0x001a
29+#define USB_DEVICE_ID_A4TECH_NB_95 0x022b
2930
3031 #define USB_VENDOR_ID_AASHIMA 0x06d6
3132 #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025
@@ -299,8 +300,6 @@ · 267 unmodified lines
299300
300301 #define USB_VENDOR_ID_CORSAIR 0x1b1c
301302 #define USB_DEVICE_ID_CORSAIR_K90 0x1b02
302−
303−#define USB_VENDOR_ID_CORSAIR 0x1b1c
304303 #define USB_DEVICE_ID_CORSAIR_K70R 0x1b09
305304 #define USB_DEVICE_ID_CORSAIR_K95RGB 0x1b11
306305 #define USB_DEVICE_ID_CORSAIR_M65RGB 0x1b12
@@ -751,6 +750,7 @@ · 444 unmodified lines
751750 #define USB_DEVICE_ID_LENOVO_X1_COVER 0x6085
752751 #define USB_DEVICE_ID_LENOVO_X1_TAB 0x60a3
753752 #define USB_DEVICE_ID_LENOVO_X1_TAB3 0x60b5
753+#define USB_DEVICE_ID_LENOVO_OPTICAL_USB_MOUSE_600E 0x600e
754754 #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D 0x608d
755755 #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019 0x6019
756756 #define USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E 0x602e
@@ -1051,6 +1051,7 @@ · 294 unmodified lines
10511051 #define USB_DEVICE_ID_SAITEK_X52 0x075c
10521052 #define USB_DEVICE_ID_SAITEK_X52_2 0x0255
10531053 #define USB_DEVICE_ID_SAITEK_X52_PRO 0x0762
1054+#define USB_DEVICE_ID_SAITEK_X65 0x0b6a
10541055
10551056 #define USB_VENDOR_ID_SAMSUNG 0x0419
10561057 #define USB_DEVICE_ID_SAMSUNG_IR_REMOTE 0x0001
@@ -1060,6 +1061,9 @@ · 3 unmodified lines
10601061 #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD 0x0023
10611062 #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD2 0x0027
10621063
1064+#define USB_VENDOR_ID_SEMITEK 0x1ea7
1065+#define USB_DEVICE_ID_SEMITEK_KEYBOARD 0x0907
1066+
10631067 #define USB_VENDOR_ID_SENNHEISER 0x1395
10641068 #define USB_DEVICE_ID_SENNHEISER_BTD500USB 0x002c
10651069
@@ -1161,6 +1165,7 @@ · 95 unmodified lines
11611165 #define USB_DEVICE_ID_SYNAPTICS_DELL_K12A 0x2819
11621166 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
11631167 #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
1168+#define USB_DEVICE_ID_SYNAPTICS_DELL_K15A 0x6e21
11641169 #define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1002 0x73f4
11651170 #define USB_DEVICE_ID_SYNAPTICS_ACER_ONE_S1003 0x73f5
11661171 #define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5 0x81a7
drivers/hid/hid-input.c+3−0
@@ -964,6 +964,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 963 unmodified lines
964964
965965 case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break;
966966 case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break;
967+
968+ case 0x0d9: map_key_clear(KEY_EMOJI_PICKER); break;
969+
967970 case 0x0e0: map_abs_clear(ABS_VOLUME); break;
968971 case 0x0e2: map_key_clear(KEY_MUTE); break;
969972 case 0x0e5: map_key_clear(KEY_BASSBOOST); break;
drivers/hid/hid-logitech-hidpp.c+1−0
@@ -1263,6 +1263,7 @@ static int hidpp20_battery_map_status_voltage(u8 data[3], int *voltage, · 1262 unmodified lines
12631263 int status;
12641264
12651265 long flags = (long) data[2];
1266+ *level = POWER_SUPPLY_CAPACITY_LEVEL_UNKNOWN;
12661267
12671268 if (flags & 0x80)
12681269 switch (flags & 0x07) {
drivers/hid/hid-magicmouse.c+5−2
@@ -693,7 +693,7 @@ static int magicmouse_probe(struct hid_device *hdev, · 692 unmodified lines
693693 if (id->vendor == USB_VENDOR_ID_APPLE &&
694694 id->product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 &&
695695 hdev->type != HID_TYPE_USBMOUSE)
696− return 0;
696+ return -ENODEV;
697697
698698 msc = devm_kzalloc(&hdev->dev, sizeof(*msc), GFP_KERNEL);
699699 if (msc == NULL) {
@@ -779,7 +779,10 @@ err_stop_hw: · 79 unmodified lines
779779 static void magicmouse_remove(struct hid_device *hdev)
780780 {
781781 struct magicmouse_sc *msc = hid_get_drvdata(hdev);
782− cancel_delayed_work_sync(&msc->work);
782+
783+ if (msc)
784+ cancel_delayed_work_sync(&msc->work);
785+
783786 hid_hw_stop(hdev);
784787 }
785788
drivers/hid/hid-multitouch.c+37−9
@@ -70,6 +70,7 @@ MODULE_LICENSE("GPL"); · 69 unmodified lines
7070 #define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18)
7171 #define MT_QUIRK_SEPARATE_APP_REPORT BIT(19)
7272 #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20)
73+#define MT_QUIRK_DISABLE_WAKEUP BIT(21)
7374
7475 #define MT_INPUTMODE_TOUCHSCREEN 0x02
7576 #define MT_INPUTMODE_TOUCHPAD 0x03
@@ -191,6 +192,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app); · 115 unmodified lines
191192 #define MT_CLS_EXPORT_ALL_INPUTS 0x0013
192193 /* reserved 0x0014 */
193194 #define MT_CLS_WIN_8_FORCE_MULTI_INPUT 0x0015
195+#define MT_CLS_WIN_8_DISABLE_WAKEUP 0x0016
194196
195197 /* vendor specific classes */
196198 #define MT_CLS_3M 0x0101
@@ -283,6 +285,15 @@ static const struct mt_class mt_classes[] = { · 86 unmodified lines
283285 MT_QUIRK_WIN8_PTP_BUTTONS |
284286 MT_QUIRK_FORCE_MULTI_INPUT,
285287 .export_all_inputs = true },
288+ { .name = MT_CLS_WIN_8_DISABLE_WAKEUP,
289+ .quirks = MT_QUIRK_ALWAYS_VALID |
290+ MT_QUIRK_IGNORE_DUPLICATES |
291+ MT_QUIRK_HOVERING |
292+ MT_QUIRK_CONTACT_CNT_ACCURATE |
293+ MT_QUIRK_STICKY_FINGERS |
294+ MT_QUIRK_WIN8_PTP_BUTTONS |
295+ MT_QUIRK_DISABLE_WAKEUP,
296+ .export_all_inputs = true },
286297
287298 /*
288299 * vendor specific classes
@@ -604,9 +615,13 @@ static struct mt_report_data *mt_allocate_report_data(struct mt_device *td, · 315 unmodified lines
604615 if (!(HID_MAIN_ITEM_VARIABLE & field->flags))
605616 continue;
606617
607− for (n = 0; n < field->report_count; n++) {
608− if (field->usage[n].hid == HID_DG_CONTACTID)
609− rdata->is_mt_collection = true;
618+ if (field->logical == HID_DG_FINGER || td->hdev->group != HID_GROUP_MULTITOUCH_WIN_8) {
619+ for (n = 0; n < field->report_count; n++) {
620+ if (field->usage[n].hid == HID_DG_CONTACTID) {
621+ rdata->is_mt_collection = true;
622+ break;
623+ }
624+ }
610625 }
611626 }
612627
@@ -759,7 +774,8 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 146 unmodified lines
759774 return 1;
760775 case HID_DG_CONFIDENCE:
761776 if ((cls->name == MT_CLS_WIN_8 ||
762− cls->name == MT_CLS_WIN_8_FORCE_MULTI_INPUT) &&
777+ cls->name == MT_CLS_WIN_8_FORCE_MULTI_INPUT ||
778+ cls->name == MT_CLS_WIN_8_DISABLE_WAKEUP) &&
763779 (field->application == HID_DG_TOUCHPAD ||
764780 field->application == HID_DG_TOUCHSCREEN))
765781 app->quirks |= MT_QUIRK_CONFIDENCE;
@@ -1576,13 +1592,13 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) · 810 unmodified lines
15761592 /* we do not set suffix = "Touchscreen" */
15771593 hi->input->name = hdev->name;
15781594 break;
1579− case HID_DG_STYLUS:
1580− /* force BTN_STYLUS to allow tablet matching in udev */
1581− __set_bit(BTN_STYLUS, hi->input->keybit);
1582− break;
15831595 case HID_VD_ASUS_CUSTOM_MEDIA_KEYS:
15841596 suffix = "Custom Media Keys";
15851597 break;
1598+ case HID_DG_STYLUS:
1599+ /* force BTN_STYLUS to allow tablet matching in udev */
1600+ __set_bit(BTN_STYLUS, hi->input->keybit);
1601+ fallthrough;
15861602 case HID_DG_PEN:
15871603 suffix = "Stylus";
15881604 break;
@@ -1749,8 +1765,14 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) · 160 unmodified lines
17491765 #ifdef CONFIG_PM
17501766 static int mt_suspend(struct hid_device *hdev, pm_message_t state)
17511767 {
1768+ struct mt_device *td = hid_get_drvdata(hdev);
1769+
17521770 /* High latency is desirable for power savings during S3/S0ix */
1753− mt_set_modes(hdev, HID_LATENCY_HIGH, true, true);
1771+ if (td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP)
1772+ mt_set_modes(hdev, HID_LATENCY_HIGH, false, false);
1773+ else
1774+ mt_set_modes(hdev, HID_LATENCY_HIGH, true, true);
1775+
17541776 return 0;
17551777 }
17561778
@@ -1809,6 +1831,12 @@ static const struct hid_device_id mt_devices[] = { · 52 unmodified lines
18091831 MT_USB_DEVICE(USB_VENDOR_ID_ANTON,
18101832 USB_DEVICE_ID_ANTON_TOUCH_PAD) },
18111833
1834+ /* Asus T101HA */
1835+ { .driver_data = MT_CLS_WIN_8_DISABLE_WAKEUP,
1836+ HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
1837+ USB_VENDOR_ID_ASUSTEK,
1838+ USB_DEVICE_ID_ASUSTEK_T101HA_KEYBOARD) },
1839+
18121840 /* Asus T304UA */
18131841 { .driver_data = MT_CLS_ASUS,
18141842 HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8,
drivers/hid/hid-quirks.c+4−0
@@ -110,6 +110,7 @@ static const struct hid_device_id hid_quirks[] = { · 109 unmodified lines
110110 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912), HID_QUIRK_MULTI_INPUT },
111111 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M406XE), HID_QUIRK_MULTI_INPUT },
112112 { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_PIXART_USB_OPTICAL_MOUSE_ID2), HID_QUIRK_ALWAYS_POLL },
113+ { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_OPTICAL_USB_MOUSE_600E), HID_QUIRK_ALWAYS_POLL },
113114 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_608D), HID_QUIRK_ALWAYS_POLL },
114115 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_6019), HID_QUIRK_ALWAYS_POLL },
115116 { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_PIXART_USB_MOUSE_602E), HID_QUIRK_ALWAYS_POLL },
@@ -158,6 +159,7 @@ static const struct hid_device_id hid_quirks[] = { · 42 unmodified lines
158159 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
159160 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
160161 { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
162+ { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X65), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
161163 { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS },
162164 { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS },
163165 { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET },
@@ -176,6 +178,7 @@ static const struct hid_device_id hid_quirks[] = { · 12 unmodified lines
176178 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD), HID_QUIRK_NO_INIT_REPORTS },
177179 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103), HID_QUIRK_NO_INIT_REPORTS },
178180 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K12A), HID_QUIRK_NO_INIT_REPORTS },
181+ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DELL_K15A), HID_QUIRK_NO_INIT_REPORTS },
179182 { HID_USB_DEVICE(USB_VENDOR_ID_TOPMAX, USB_DEVICE_ID_TOPMAX_COBRAPAD), HID_QUIRK_BADPAD },
180183 { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT },
181184 { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET },
@@ -211,6 +214,7 @@ static const struct hid_device_id hid_have_special_driver[] = { · 29 unmodified lines
211214 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
212215 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_X5_005D) },
213216 { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_RP_649) },
217+ { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_NB_95) },
214218 #endif
215219 #if IS_ENABLED(CONFIG_HID_ACCUTOUCH)
216220 { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_ACCUTOUCH_2216) },
drivers/hid/hid-semitek.c+40−0
@@ -0,0 +1,40 @@
1+// SPDX-License-Identifier: GPL-2.0-or-later
2+/*
3+ * HID driver for Semitek keyboards
4+ *
5+ * Copyright (c) 2021 Benjamin Moody
6+ */
7+
8+#include <linux/device.h>
9+#include <linux/hid.h>
10+#include <linux/module.h>
11+
12+#include "hid-ids.h"
13+
14+static __u8 *semitek_report_fixup(struct hid_device *hdev, __u8 *rdesc,
15+ unsigned int *rsize)
16+{
17+ /* In the report descriptor for interface 2, fix the incorrect
18+ description of report ID 0x04 (the report contains a
19+ bitmask, not an array of keycodes.) */
20+ if (*rsize == 0xcb && rdesc[0x83] == 0x81 && rdesc[0x84] == 0x00) {
21+ hid_info(hdev, "fixing up Semitek report descriptor\n");
22+ rdesc[0x84] = 0x02;
23+ }
24+ return rdesc;
25+}
26+
27+static const struct hid_device_id semitek_devices[] = {
28+ { HID_USB_DEVICE(USB_VENDOR_ID_SEMITEK, USB_DEVICE_ID_SEMITEK_KEYBOARD) },
29+ { }
30+};
31+MODULE_DEVICE_TABLE(hid, semitek_devices);
32+
33+static struct hid_driver semitek_driver = {
34+ .name = "semitek",
35+ .id_table = semitek_devices,
36+ .report_fixup = semitek_report_fixup,
37+};
38+module_hid_driver(semitek_driver);
39+
40+MODULE_LICENSE("GPL");
drivers/hid/hid-sensor-custom.c+5−3
@@ -387,7 +387,7 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, · 386 unmodified lines
387387 struct hid_sensor_custom *sensor_inst = dev_get_drvdata(dev);
388388 int index, field_index, usage;
389389 char name[HID_CUSTOM_NAME_LENGTH];
390− int value;
390+ int value, ret;
391391
392392 if (sscanf(attr->attr.name, "feature-%x-%x-%s", &index, &usage,
393393 name) == 3) {
@@ -403,8 +403,10 @@ static ssize_t store_value(struct device *dev, struct device_attribute *attr, · 9 unmodified lines
403403
404404 report_id = sensor_inst->fields[field_index].attribute.
405405 report_id;
406− sensor_hub_set_feature(sensor_inst->hsdev, report_id,
407− index, sizeof(value), &value);
406+ ret = sensor_hub_set_feature(sensor_inst->hsdev, report_id,
407+ index, sizeof(value), &value);
408+ if (ret)
409+ return ret;
408410 } else
409411 return -EINVAL;
410412
drivers/hid/hid-sensor-hub.c+9−4
@@ -209,16 +209,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, · 208 unmodified lines
209209 buffer_size = buffer_size / sizeof(__s32);
210210 if (buffer_size) {
211211 for (i = 0; i < buffer_size; ++i) {
212− hid_set_field(report->field[field_index], i,
213− (__force __s32)cpu_to_le32(*buf32));
212+ ret = hid_set_field(report->field[field_index], i,
213+ (__force __s32)cpu_to_le32(*buf32));
214+ if (ret)
215+ goto done_proc;
216+
214217 ++buf32;
215218 }
216219 }
217220 if (remaining_bytes) {
218221 value = 0;
219222 memcpy(&value, (u8 *)buf32, remaining_bytes);
220− hid_set_field(report->field[field_index], i,
221− (__force __s32)cpu_to_le32(value));
223+ ret = hid_set_field(report->field[field_index], i,
224+ (__force __s32)cpu_to_le32(value));
225+ if (ret)
226+ goto done_proc;
222227 }
223228 hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
224229 hid_hw_wait(hsdev->hdev);
drivers/hid/hid-thrustmaster.c+1−1
@@ -312,7 +312,7 @@ static int thrustmaster_probe(struct hid_device *hdev, const struct hid_device_i · 311 unmodified lines
312312 }
313313
314314 tm_wheel->change_request = kzalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
315− if (!tm_wheel->model_request) {
315+ if (!tm_wheel->change_request) {
316316 ret = -ENOMEM;
317317 goto error5;
318318 }
drivers/hid/i2c-hid/i2c-hid-core.c+10−3
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
4646 #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5)
4747 #define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6)
48+#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(7)
4849
4950
5051 /* flags */
@@ -178,6 +179,11 @@ static const struct i2c_hid_quirks { · 127 unmodified lines
178179 I2C_HID_QUIRK_RESET_ON_RESUME },
179180 { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
180181 I2C_HID_QUIRK_BAD_INPUT_SIZE },
182+ /*
183+ * Sending the wakeup after reset actually break ELAN touchscreen controller
184+ */
185+ { USB_VENDOR_ID_ELAN, HID_ANY_ID,
186+ I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET },
181187 { 0, 0 }
182188 };
183189
@@ -461,7 +467,8 @@ static int i2c_hid_hwreset(struct i2c_client *client) · 277 unmodified lines
461467 }
462468
463469 /* At least some SIS devices need this after reset */
464− ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
470+ if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET))
471+ ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
465472
466473 out_unlock:
467474 mutex_unlock(&ihid->reset_lock);
@@ -990,8 +997,8 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops, · 522 unmodified lines
990997 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
991998 hid->product = le16_to_cpu(ihid->hdesc.wProductID);
992999
993− snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
994− client->name, hid->vendor, hid->product);
1000+ snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
1001+ client->name, (u16)hid->vendor, (u16)hid->product);
9951002 strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
9961003
9971004 ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
drivers/hid/intel-ish-hid/ipc/hw-ish.h+2−0
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828 #define EHL_Ax_DEVICE_ID 0x4BB3
2929 #define TGL_LP_DEVICE_ID 0xA0FC
3030 #define TGL_H_DEVICE_ID 0x43FC
31+#define ADL_S_DEVICE_ID 0x7AF8
32+#define ADL_P_DEVICE_ID 0x51FC
3133
3234 #define REVISION_ID_CHT_A0 0x6
3335 #define REVISION_ID_CHT_Ax_SI 0x0
drivers/hid/intel-ish-hid/ipc/pci-ish.c+2−0
@@ -39,6 +39,8 @@ static const struct pci_device_id ish_pci_tbl[] = { · 38 unmodified lines
3939 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, EHL_Ax_DEVICE_ID)},
4040 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_LP_DEVICE_ID)},
4141 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, TGL_H_DEVICE_ID)},
42+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_S_DEVICE_ID)},
43+ {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ADL_P_DEVICE_ID)},
4244 {0, }
4345 };
4446 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
drivers/hid/surface-hid/surface_hid_core.c+3−3
@@ -168,9 +168,9 @@ int surface_hid_device_add(struct surface_hid_device *shid) · 167 unmodified lines
168168
169169 shid->hid->dev.parent = shid->dev;
170170 shid->hid->bus = BUS_HOST;
171− shid->hid->vendor = cpu_to_le16(shid->attrs.vendor);
172− shid->hid->product = cpu_to_le16(shid->attrs.product);
173− shid->hid->version = cpu_to_le16(shid->hid_desc.hid_version);
171+ shid->hid->vendor = get_unaligned_le16(&shid->attrs.vendor);
172+ shid->hid->product = get_unaligned_le16(&shid->attrs.product);
173+ shid->hid->version = get_unaligned_le16(&shid->hid_desc.hid_version);
174174 shid->hid->country = shid->hid_desc.country_code;
175175
176176 snprintf(shid->hid->name, sizeof(shid->hid->name), "Microsoft Surface %04X:%04X",
drivers/hid/usbhid/hid-core.c+1−1
@@ -374,7 +374,7 @@ static int hid_submit_ctrl(struct hid_device *hid) · 373 unmodified lines
374374 raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report;
375375 dir = usbhid->ctrl[usbhid->ctrltail].dir;
376376
377− len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
377+ len = hid_report_len(report);
378378 if (dir == USB_DIR_OUT) {
379379 usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0);
380380 usbhid->urbctrl->transfer_buffer_length = len;
drivers/hid/usbhid/hid-pidff.c+1−0
@@ -1292,6 +1292,7 @@ int hid_pidff_init(struct hid_device *hid) · 1291 unmodified lines
12921292
12931293 if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
12941294 pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
1295+ error = -EPERM;
12951296 hid_notice(hid,
12961297 "device does not support device managed pool\n");
12971298 goto fail;
drivers/hwmon/corsair-psu.c+14−0
@@ -771,6 +771,16 @@ static int corsairpsu_raw_event(struct hid_device *hdev, struct hid_report *repo · 770 unmodified lines
771771 return 0;
772772 }
773773
774+#ifdef CONFIG_PM
775+static int corsairpsu_resume(struct hid_device *hdev)
776+{
777+ struct corsairpsu_data *priv = hid_get_drvdata(hdev);
778+
779+ /* some PSUs turn off the microcontroller during standby, so a reinit is required */
780+ return corsairpsu_init(priv);
781+}
782+#endif
783+
774784 static const struct hid_device_id corsairpsu_idtable[] = {
775785 { HID_USB_DEVICE(0x1b1c, 0x1c03) }, /* Corsair HX550i */
776786 { HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */
@@ -793,6 +803,10 @@ static struct hid_driver corsairpsu_driver = { · 16 unmodified lines
793803 .probe = corsairpsu_probe,
794804 .remove = corsairpsu_remove,
795805 .raw_event = corsairpsu_raw_event,
806+#ifdef CONFIG_PM
807+ .resume = corsairpsu_resume,
808+ .reset_resume = corsairpsu_resume,
809+#endif
796810 };
797811 module_hid_driver(corsairpsu_driver);
798812
drivers/hwmon/dell-smm-hwmon.c+2−2
@@ -838,10 +838,10 @@ static struct attribute *i8k_attrs[] = { · 837 unmodified lines
838838 static umode_t i8k_is_visible(struct kobject *kobj, struct attribute *attr,
839839 int index)
840840 {
841− if (disallow_fan_support && index >= 8)
841+ if (disallow_fan_support && index >= 20)
842842 return 0;
843843 if (disallow_fan_type_call &&
844− (index == 9 || index == 12 || index == 15))
844+ (index == 21 || index == 25 || index == 28))
845845 return 0;
846846 if (index >= 0 && index <= 1 &&
847847 !(i8k_hwmon_flags & I8K_HWMON_HAVE_TEMP1))
drivers/hwmon/pmbus/fsp-3y.c+25−7
@@ -37,6 +37,8 @@ struct fsp3y_data { · 36 unmodified lines
3737 struct pmbus_driver_info info;
3838 int chip;
3939 int page;
40+
41+ bool vout_linear_11;
4042 };
4143
4244 #define to_fsp3y_data(x) container_of(x, struct fsp3y_data, info)
@@ -108,11 +110,9 @@ static int fsp3y_read_byte_data(struct i2c_client *client, int page, int reg) · 65 unmodified lines
108110 int rv;
109111
110112 /*
111− * YH5151-E outputs vout in linear11. The conversion is done when
112− * reading. Here, we have to inject pmbus_core with the correct
113− * exponent (it is -6).
113+ * Inject an exponent for non-compliant YH5151-E.
114114 */
115− if (data->chip == yh5151e && reg == PMBUS_VOUT_MODE)
115+ if (data->vout_linear_11 && reg == PMBUS_VOUT_MODE)
116116 return 0x1A;
117117
118118 rv = set_page(client, page);
@@ -161,10 +161,9 @@ static int fsp3y_read_word_data(struct i2c_client *client, int page, int phase, · 42 unmodified lines
161161 return rv;
162162
163163 /*
164− * YH-5151E is non-compliant and outputs output voltages in linear11
165− * instead of linear16.
164+ * Handle YH-5151E non-compliant linear11 vout voltage.
166165 */
167− if (data->chip == yh5151e && reg == PMBUS_READ_VOUT)
166+ if (data->vout_linear_11 && reg == PMBUS_READ_VOUT)
168167 rv = sign_extend32(rv, 10) & 0xffff;
169168
170169 return rv;
@@ -256,6 +255,25 @@ static int fsp3y_probe(struct i2c_client *client) · 85 unmodified lines
256255
257256 data->info = fsp3y_info[data->chip];
258257
258+ /*
259+ * YH-5151E sometimes reports vout in linear11 and sometimes in
260+ * linear16. This depends on the exact individual piece of hardware. One
261+ * YH-5151E can use linear16 and another might use linear11 instead.
262+ *
263+ * The format can be recognized by reading VOUT_MODE - if it doesn't
264+ * report a valid exponent, then vout uses linear11. Otherwise, the
265+ * device is compliant and uses linear16.
266+ */
267+ data->vout_linear_11 = false;
268+ if (data->chip == yh5151e) {
269+ rv = i2c_smbus_read_byte_data(client, PMBUS_VOUT_MODE);
270+ if (rv < 0)
271+ return rv;
272+
273+ if (rv == 0xFF)
274+ data->vout_linear_11 = true;
275+ }
276+
259277 return pmbus_do_probe(client, &data->info);
260278 }
261279
drivers/hwmon/pmbus/isl68137.c+2−2
@@ -244,8 +244,8 @@ static int isl68137_probe(struct i2c_client *client) · 243 unmodified lines
244244 info->read_word_data = raa_dmpvr2_read_word_data;
245245 break;
246246 case raa_dmpvr2_2rail_nontc:
247− info->func[0] &= ~PMBUS_HAVE_TEMP;
248− info->func[1] &= ~PMBUS_HAVE_TEMP;
247+ info->func[0] &= ~PMBUS_HAVE_TEMP3;
248+ info->func[1] &= ~PMBUS_HAVE_TEMP3;
249249 fallthrough;
250250 case raa_dmpvr2_2rail:
251251 info->pages = 2;
drivers/hwmon/pmbus/q54sj108a2.c+1−1
@@ -299,7 +299,7 @@ static int q54sj108a2_probe(struct i2c_client *client) · 298 unmodified lines
299299 dev_err(&client->dev, "Failed to read Manufacturer ID\n");
300300 return ret;
301301 }
302− if (ret != 5 || strncmp(buf, "DELTA", 5)) {
302+ if (ret != 6 || strncmp(buf, "DELTA", 5)) {
303303 buf[ret] = '\0';
304304 dev_err(dev, "Unsupported Manufacturer ID '%s'\n", buf);
305305 return -ENODEV;
drivers/hwmon/scpi-hwmon.c+9−0
@@ -99,6 +99,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf) · 98 unmodified lines
9999
100100 scpi_scale_reading(&value, sensor);
101101
102+ /*
103+ * Temperature sensor values are treated as signed values based on
104+ * observation even though that is not explicitly specified, and
105+ * because an unsigned u64 temperature does not really make practical
106+ * sense especially when the temperature is below zero degrees Celsius.
107+ */
108+ if (sensor->info.class == TEMPERATURE)
109+ return sprintf(buf, "%lld\n", (s64)value);
110+
102111 return sprintf(buf, "%llu\n", value);
103112 }
104113
drivers/hwmon/tps23861.c+15−2
@@ -99,11 +99,14 @@ · 98 unmodified lines
9999 #define POWER_ENABLE 0x19
100100 #define TPS23861_NUM_PORTS 4
101101
102+#define TPS23861_GENERAL_MASK_1 0x17
103+#define TPS23861_CURRENT_SHUNT_MASK BIT(0)
104+
102105 #define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */
103106 #define VOLTAGE_LSB 3662 /* 3.662 mV */
104107 #define SHUNT_RESISTOR_DEFAULT 255000 /* 255 mOhm */
105−#define CURRENT_LSB_255 62260 /* 62.260 uA */
106−#define CURRENT_LSB_250 61039 /* 61.039 uA */
108+#define CURRENT_LSB_250 62260 /* 62.260 uA */
109+#define CURRENT_LSB_255 61039 /* 61.039 uA */
107110 #define RESISTANCE_LSB 110966 /* 11.0966 Ohm*/
108111 #define RESISTANCE_LSB_LOW 157216 /* 15.7216 Ohm*/
109112
@@ -117,6 +120,7 @@ struct tps23861_data { · 7 unmodified lines
117120 static struct regmap_config tps23861_regmap_config = {
118121 .reg_bits = 8,
119122 .val_bits = 8,
123+ .max_register = 0x6f,
120124 };
121125
122126 static int tps23861_read_temp(struct tps23861_data *data, long *val)
@@ -560,6 +564,15 @@ static int tps23861_probe(struct i2c_client *client) · 437 unmodified lines
560564 else
561565 data->shunt_resistor = SHUNT_RESISTOR_DEFAULT;
562566
567+ if (data->shunt_resistor == SHUNT_RESISTOR_DEFAULT)
568+ regmap_clear_bits(data->regmap,
569+ TPS23861_GENERAL_MASK_1,
570+ TPS23861_CURRENT_SHUNT_MASK);
571+ else
572+ regmap_set_bits(data->regmap,
573+ TPS23861_GENERAL_MASK_1,
574+ TPS23861_CURRENT_SHUNT_MASK);
575+
563576 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
564577 data, &tps23861_chip_info,
565578 NULL);
drivers/i2c/busses/i2c-altera.c+4−5
@@ -55,7 +55,7 @@ · 54 unmodified lines
5555 #define ALTR_I2C_XFER_TIMEOUT (msecs_to_jiffies(250))
5656
5757 /**
58− * altr_i2c_dev - I2C device context
58+ * struct altr_i2c_dev - I2C device context
5959 * @base: pointer to register struct
6060 * @msg: pointer to current message
6161 * @msg_len: number of bytes transferred in msg
@@ -172,7 +172,7 @@ static void altr_i2c_init(struct altr_i2c_dev *idev) · 110 unmodified lines
172172 altr_i2c_int_enable(idev, ALTR_I2C_ALL_IRQ, false);
173173 }
174174
175−/**
175+/*
176176 * altr_i2c_transfer - On the last byte to be transmitted, send
177177 * a Stop bit on the last byte.
178178 */
@@ -185,7 +185,7 @@ static void altr_i2c_transfer(struct altr_i2c_dev *idev, u32 data) · 6 unmodified lines
185185 writel(data, idev->base + ALTR_I2C_TFR_CMD);
186186 }
187187
188−/**
188+/*
189189 * altr_i2c_empty_rx_fifo - Fetch data from RX FIFO until end of
190190 * transfer. Send a Stop bit on the last byte.
191191 */
@@ -201,9 +201,8 @@ static void altr_i2c_empty_rx_fifo(struct altr_i2c_dev *idev) · 9 unmodified lines
201201 }
202202 }
203203
204−/**
204+/*
205205 * altr_i2c_fill_tx_fifo - Fill TX FIFO from current message buffer.
206− * @return: Number of bytes left to transfer.
207206 */
208207 static int altr_i2c_fill_tx_fifo(struct altr_i2c_dev *idev)
209208 {
drivers/i2c/busses/i2c-qcom-geni.c+20−1
@@ -650,6 +650,14 @@ static int geni_i2c_remove(struct platform_device *pdev) · 649 unmodified lines
650650 return 0;
651651 }
652652
653+static void geni_i2c_shutdown(struct platform_device *pdev)
654+{
655+ struct geni_i2c_dev *gi2c = platform_get_drvdata(pdev);
656+
657+ /* Make client i2c transfers start failing */
658+ i2c_mark_adapter_suspended(&gi2c->adap);
659+}
660+
653661 static int __maybe_unused geni_i2c_runtime_suspend(struct device *dev)
654662 {
655663 int ret;
@@ -690,6 +698,8 @@ static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev) · 34 unmodified lines
690698 {
691699 struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);
692700
701+ i2c_mark_adapter_suspended(&gi2c->adap);
702+
693703 if (!gi2c->suspended) {
694704 geni_i2c_runtime_suspend(dev);
695705 pm_runtime_disable(dev);
@@ -699,8 +709,16 @@ static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev) · 3 unmodified lines
699709 return 0;
700710 }
701711
712+static int __maybe_unused geni_i2c_resume_noirq(struct device *dev)
713+{
714+ struct geni_i2c_dev *gi2c = dev_get_drvdata(dev);
715+
716+ i2c_mark_adapter_resumed(&gi2c->adap);
717+ return 0;
718+}
719+
702720 static const struct dev_pm_ops geni_i2c_pm_ops = {
703− SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, NULL)
721+ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, geni_i2c_resume_noirq)
704722 SET_RUNTIME_PM_OPS(geni_i2c_runtime_suspend, geni_i2c_runtime_resume,
705723 NULL)
706724 };
@@ -714,6 +732,7 @@ MODULE_DEVICE_TABLE(of, geni_i2c_dt_match); · 7 unmodified lines
714732 static struct platform_driver geni_i2c_driver = {
715733 .probe = geni_i2c_probe,
716734 .remove = geni_i2c_remove,
735+ .shutdown = geni_i2c_shutdown,
717736 .driver = {
718737 .name = "geni_i2c",
719738 .pm = &geni_i2c_pm_ops,
drivers/i2c/busses/i2c-tegra-bpmp.c+2−2
@@ -65,7 +65,7 @@ static void tegra_bpmp_xlate_flags(u16 flags, u16 *out) · 64 unmodified lines
6565 *out |= SERIALI2C_RECV_LEN;
6666 }
6767
68−/**
68+/*
6969 * The serialized I2C format is simply the following:
7070 * [addr little-endian][flags little-endian][len little-endian][data if write]
7171 * [addr little-endian][flags little-endian][len little-endian][data if write]
@@ -109,7 +109,7 @@ static void tegra_bpmp_serialize_i2c_msg(struct tegra_bpmp_i2c *i2c, · 37 unmodified lines
109109 request->xfer.data_size = pos;
110110 }
111111
112−/**
112+/*
113113 * The data in the BPMP -> CPU direction is composed of sequential blocks for
114114 * those messages that have I2C_M_RD. So, for example, if you have:
115115 *
drivers/infiniband/core/uverbs_cmd.c+5−0
@@ -3248,6 +3248,11 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs) · 3247 unmodified lines
32483248 goto err_free_attr;
32493249 }
32503250
3251+ if (!rdma_is_port_valid(uobj->context->device, cmd.flow_attr.port)) {
3252+ err = -EINVAL;
3253+ goto err_uobj;
3254+ }
3255+
32513256 qp = uobj_get_obj_read(qp, UVERBS_OBJECT_QP, cmd.qp_handle, attrs);
32523257 if (!qp) {
32533258 err = -EINVAL;
drivers/infiniband/hw/mlx4/main.c+1−7
@@ -581,12 +581,9 @@ static int mlx4_ib_query_device(struct ib_device *ibdev, · 580 unmodified lines
581581 props->cq_caps.max_cq_moderation_count = MLX4_MAX_CQ_COUNT;
582582 props->cq_caps.max_cq_moderation_period = MLX4_MAX_CQ_PERIOD;
583583
584− if (!mlx4_is_slave(dev->dev))
585− err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
586−
587584 if (uhw->outlen >= resp.response_length + sizeof(resp.hca_core_clock_offset)) {
588585 resp.response_length += sizeof(resp.hca_core_clock_offset);
589− if (!err && !mlx4_is_slave(dev->dev)) {
586+ if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) {
590587 resp.comp_mask |= MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET;
591588 resp.hca_core_clock_offset = clock_params.offset % PAGE_SIZE;
592589 }
@@ -1702,9 +1699,6 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, · 1109 unmodified lines
17021699 struct mlx4_dev *dev = (to_mdev(qp->device))->dev;
17031700 int is_bonded = mlx4_is_bonded(dev);
17041701
1705− if (!rdma_is_port_valid(qp->device, flow_attr->port))
1706− return ERR_PTR(-EINVAL);
1707−
17081702 if (flow_attr->flags & ~IB_FLOW_ATTR_FLAGS_DONT_TRAP)
17091703 return ERR_PTR(-EOPNOTSUPP);
17101704
drivers/infiniband/hw/mlx5/cq.c+4−5
@@ -849,15 +849,14 @@ static void destroy_cq_user(struct mlx5_ib_cq *cq, struct ib_udata *udata) · 848 unmodified lines
849849 ib_umem_release(cq->buf.umem);
850850 }
851851
852−static void init_cq_frag_buf(struct mlx5_ib_cq *cq,
853− struct mlx5_ib_cq_buf *buf)
852+static void init_cq_frag_buf(struct mlx5_ib_cq_buf *buf)
854853 {
855854 int i;
856855 void *cqe;
857856 struct mlx5_cqe64 *cqe64;
858857
859858 for (i = 0; i < buf->nent; i++) {
860− cqe = get_cqe(cq, i);
859+ cqe = mlx5_frag_buf_get_wqe(&buf->fbc, i);
861860 cqe64 = buf->cqe_size == 64 ? cqe : cqe + 64;
862861 cqe64->op_own = MLX5_CQE_INVALID << 4;
863862 }
@@ -883,7 +882,7 @@ static int create_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, · 19 unmodified lines
883882 if (err)
884883 goto err_db;
885884
886− init_cq_frag_buf(cq, &cq->buf);
885+ init_cq_frag_buf(&cq->buf);
887886
888887 *inlen = MLX5_ST_SZ_BYTES(create_cq_in) +
889888 MLX5_FLD_SZ_BYTES(create_cq_in, pas[0]) *
@@ -1184,7 +1183,7 @@ static int resize_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq, · 294 unmodified lines
11841183 if (err)
11851184 goto ex;
11861185
1187− init_cq_frag_buf(cq, cq->resize_buf);
1186+ init_cq_frag_buf(cq->resize_buf);
11881187
11891188 return 0;
11901189
drivers/infiniband/hw/mlx5/doorbell.c+6−1
@@ -41,6 +41,7 @@ struct mlx5_ib_user_db_page { · 40 unmodified lines
4141 struct ib_umem *umem;
4242 unsigned long user_virt;
4343 int refcnt;
44+ struct mm_struct *mm;
4445 };
4546
4647 int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context,
@@ -53,7 +54,8 @@ int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, · 6 unmodified lines
5354 mutex_lock(&context->db_page_mutex);
5455
5556 list_for_each_entry(page, &context->db_page_list, list)
56− if (page->user_virt == (virt & PAGE_MASK))
57+ if ((current->mm == page->mm) &&
58+ (page->user_virt == (virt & PAGE_MASK)))
5759 goto found;
5860
5961 page = kmalloc(sizeof(*page), GFP_KERNEL);
@@ -71,6 +73,8 @@ int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *context, · 11 unmodified lines
7173 kfree(page);
7274 goto out;
7375 }
76+ mmgrab(current->mm);
77+ page->mm = current->mm;
7478
7579 list_add(&page->list, &context->db_page_list);
7680
@@ -91,6 +95,7 @@ void mlx5_ib_db_unmap_user(struct mlx5_ib_ucontext *context, struct mlx5_db *db) · 14 unmodified lines
9195
9296 if (!--db->u.user_page->refcnt) {
9397 list_del(&db->u.user_page->list);
98+ mmdrop(db->u.user_page->mm);
9499 ib_umem_release(db->u.user_page->umem);
95100 kfree(db->u.user_page);
96101 }
drivers/infiniband/hw/mlx5/fs.c+8−3
@@ -1194,9 +1194,8 @@ static struct ib_flow *mlx5_ib_create_flow(struct ib_qp *qp, · 1193 unmodified lines
11941194 goto free_ucmd;
11951195 }
11961196
1197− if (flow_attr->port > dev->num_ports ||
1198− (flow_attr->flags &
1199− ~(IB_FLOW_ATTR_FLAGS_DONT_TRAP | IB_FLOW_ATTR_FLAGS_EGRESS))) {
1197+ if (flow_attr->flags &
1198+ ~(IB_FLOW_ATTR_FLAGS_DONT_TRAP | IB_FLOW_ATTR_FLAGS_EGRESS)) {
12001199 err = -EINVAL;
12011200 goto free_ucmd;
12021201 }
@@ -2134,6 +2133,12 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_MATCHER_CREATE)( · 931 unmodified lines
21342133 if (err)
21352134 goto end;
21362135
2136+ if (obj->ns_type == MLX5_FLOW_NAMESPACE_FDB &&
2137+ mlx5_eswitch_mode(dev->mdev) != MLX5_ESWITCH_OFFLOADS) {
2138+ err = -EINVAL;
2139+ goto end;
2140+ }
2141+
21372142 uobj->object = obj;
21382143 obj->mdev = dev->mdev;
21392144 atomic_set(&obj->usecnt, 0);
drivers/infiniband/hw/mlx5/mr.c+2−2
@@ -1940,8 +1940,8 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · 1939 unmodified lines
19401940 mlx5r_deref_wait_odp_mkey(&mr->mmkey);
19411941
19421942 if (ibmr->type == IB_MR_TYPE_INTEGRITY) {
1943− xa_cmpxchg(&dev->sig_mrs, mlx5_base_mkey(mr->mmkey.key), ibmr,
1944− NULL, GFP_KERNEL);
1943+ xa_cmpxchg(&dev->sig_mrs, mlx5_base_mkey(mr->mmkey.key),
1944+ mr->sig, NULL, GFP_KERNEL);
19451945
19461946 if (mr->mtt_mr) {
19471947 rc = mlx5_ib_dereg_mr(&mr->mtt_mr->ibmr, NULL);
drivers/infiniband/ulp/ipoib/ipoib_netlink.c+1−0
@@ -163,6 +163,7 @@ static size_t ipoib_get_size(const struct net_device *dev) · 162 unmodified lines
163163
164164 static struct rtnl_link_ops ipoib_link_ops __read_mostly = {
165165 .kind = "ipoib",
166+ .netns_refund = true,
166167 .maxtype = IFLA_IPOIB_MAX,
167168 .policy = ipoib_policy,
168169 .priv_size = sizeof(struct ipoib_dev_priv),
drivers/md/bcache/bcache.h+0−1
@@ -364,7 +364,6 @@ struct cached_dev { · 363 unmodified lines
364364
365365 /* The rest of this all shows up in sysfs */
366366 unsigned int sequential_cutoff;
367− unsigned int readahead;
368367
369368 unsigned int io_disable:1;
370369 unsigned int verify:1;
drivers/md/bcache/request.c+7−13
@@ -880,9 +880,9 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 879 unmodified lines
880880 struct bio *bio, unsigned int sectors)
881881 {
882882 int ret = MAP_CONTINUE;
883− unsigned int reada = 0;
884883 struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
885884 struct bio *miss, *cache_bio;
885+ unsigned int size_limit;
886886
887887 s->cache_missed = 1;
888888
@@ -892,14 +892,10 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 3 unmodified lines
892892 goto out_submit;
893893 }
894894
895− if (!(bio->bi_opf & REQ_RAHEAD) &&
896− !(bio->bi_opf & (REQ_META|REQ_PRIO)) &&
897− s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA)
898− reada = min_t(sector_t, dc->readahead >> 9,
899− get_capacity(bio->bi_bdev->bd_disk) -
900− bio_end_sector(bio));
901−
902− s->insert_bio_sectors = min(sectors, bio_sectors(bio) + reada);
895+ /* Limitation for valid replace key size and cache_bio bvecs number */
896+ size_limit = min_t(unsigned int, BIO_MAX_VECS * PAGE_SECTORS,
897+ (1 << KEY_SIZE_BITS) - 1);
898+ s->insert_bio_sectors = min3(size_limit, sectors, bio_sectors(bio));
903899
904900 s->iop.replace_key = KEY(s->iop.inode,
905901 bio->bi_iter.bi_sector + s->insert_bio_sectors,
@@ -911,7 +907,8 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 5 unmodified lines
911907
912908 s->iop.replace = true;
913909
914− miss = bio_next_split(bio, sectors, GFP_NOIO, &s->d->bio_split);
910+ miss = bio_next_split(bio, s->insert_bio_sectors, GFP_NOIO,
911+ &s->d->bio_split);
915912
916913 /* btree_search_recurse()'s btree iterator is no good anymore */
917914 ret = miss == bio ? MAP_DONE : -EINTR;
@@ -933,9 +930,6 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, · 15 unmodified lines
933930 if (bch_bio_alloc_pages(cache_bio, __GFP_NOWARN|GFP_NOIO))
934931 goto out_put;
935932
936− if (reada)
937− bch_mark_cache_readahead(s->iop.c, s->d);
938−
939933 s->cache_miss = miss;
940934 s->iop.bio = cache_bio;
941935 bio_get(cache_bio);
drivers/md/bcache/stats.c+0−14
@@ -46,7 +46,6 @@ read_attribute(cache_misses); · 45 unmodified lines
4646 read_attribute(cache_bypass_hits);
4747 read_attribute(cache_bypass_misses);
4848 read_attribute(cache_hit_ratio);
49−read_attribute(cache_readaheads);
5049 read_attribute(cache_miss_collisions);
5150 read_attribute(bypassed);
5251
@@ -64,7 +63,6 @@ SHOW(bch_stats) · 11 unmodified lines
6463 DIV_SAFE(var(cache_hits) * 100,
6564 var(cache_hits) + var(cache_misses)));
6665
67− var_print(cache_readaheads);
6866 var_print(cache_miss_collisions);
6967 sysfs_hprint(bypassed, var(sectors_bypassed) << 9);
7068 #undef var
@@ -86,7 +84,6 @@ static struct attribute *bch_stats_files[] = { · 15 unmodified lines
8684 &sysfs_cache_bypass_hits,
8785 &sysfs_cache_bypass_misses,
8886 &sysfs_cache_hit_ratio,
89− &sysfs_cache_readaheads,
9087 &sysfs_cache_miss_collisions,
9188 &sysfs_bypassed,
9289 NULL
@@ -113,7 +110,6 @@ void bch_cache_accounting_clear(struct cache_accounting *acc) · 20 unmodified lines
113110 acc->total.cache_misses = 0;
114111 acc->total.cache_bypass_hits = 0;
115112 acc->total.cache_bypass_misses = 0;
116− acc->total.cache_readaheads = 0;
117113 acc->total.cache_miss_collisions = 0;
118114 acc->total.sectors_bypassed = 0;
119115 }
@@ -145,7 +141,6 @@ static void scale_stats(struct cache_stats *stats, unsigned long rescale_at) · 25 unmodified lines
145141 scale_stat(&stats->cache_misses);
146142 scale_stat(&stats->cache_bypass_hits);
147143 scale_stat(&stats->cache_bypass_misses);
148− scale_stat(&stats->cache_readaheads);
149144 scale_stat(&stats->cache_miss_collisions);
150145 scale_stat(&stats->sectors_bypassed);
151146 }
@@ -168,7 +163,6 @@ static void scale_accounting(struct timer_list *t) · 16 unmodified lines
168163 move_stat(cache_misses);
169164 move_stat(cache_bypass_hits);
170165 move_stat(cache_bypass_misses);
171− move_stat(cache_readaheads);
172166 move_stat(cache_miss_collisions);
173167 move_stat(sectors_bypassed);
174168
@@ -209,14 +203,6 @@ void bch_mark_cache_accounting(struct cache_set *c, struct bcache_device *d, · 34 unmodified lines
209203 mark_cache_stats(&c->accounting.collector, hit, bypass);
210204 }
211205
212−void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d)
213−{
214− struct cached_dev *dc = container_of(d, struct cached_dev, disk);
215−
216− atomic_inc(&dc->accounting.collector.cache_readaheads);
217− atomic_inc(&c->accounting.collector.cache_readaheads);
218−}
219−
220206 void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d)
221207 {
222208 struct cached_dev *dc = container_of(d, struct cached_dev, disk);
drivers/md/bcache/stats.h+0−1
@@ -7,7 +7,6 @@ struct cache_stat_collector { · 6 unmodified lines
77 atomic_t cache_misses;
88 atomic_t cache_bypass_hits;
99 atomic_t cache_bypass_misses;
10− atomic_t cache_readaheads;
1110 atomic_t cache_miss_collisions;
1211 atomic_t sectors_bypassed;
1312 };
drivers/md/bcache/sysfs.c+0−4
@@ -137,7 +137,6 @@ rw_attribute(io_disable); · 136 unmodified lines
137137 rw_attribute(discard);
138138 rw_attribute(running);
139139 rw_attribute(label);
140−rw_attribute(readahead);
141140 rw_attribute(errors);
142141 rw_attribute(io_error_limit);
143142 rw_attribute(io_error_halflife);
@@ -260,7 +259,6 @@ SHOW(__bch_cached_dev) · 116 unmodified lines
260259 var_printf(partial_stripes_expensive, "%u");
261260
262261 var_hprint(sequential_cutoff);
263− var_hprint(readahead);
264262
265263 sysfs_print(running, atomic_read(&dc->running));
266264 sysfs_print(state, states[BDEV_STATE(&dc->sb)]);
@@ -365,7 +363,6 @@ STORE(__cached_dev) · 98 unmodified lines
365363 sysfs_strtoul_clamp(sequential_cutoff,
366364 dc->sequential_cutoff,
367365 0, UINT_MAX);
368− d_strtoi_h(readahead);
369366
370367 if (attr == &sysfs_clear_stats)
371368 bch_cache_accounting_clear(&dc->accounting);
@@ -538,7 +535,6 @@ static struct attribute *bch_cached_dev_files[] = { · 166 unmodified lines
538535 &sysfs_running,
539536 &sysfs_state,
540537 &sysfs_label,
541− &sysfs_readahead,
542538 #ifdef CONFIG_BCACHE_DEBUG
543539 &sysfs_verify,
544540 &sysfs_bypass_torture_test,
drivers/misc/cardreader/rtl8411.c+1−0
@@ -468,6 +468,7 @@ static void rtl8411_init_common_params(struct rtsx_pcr *pcr) · 467 unmodified lines
468468 pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
469469 pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
470470 pcr->aspm_en = ASPM_L1_EN;
471+ pcr->aspm_mode = ASPM_MODE_CFG;
471472 pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
472473 pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
473474 pcr->ic_version = rtl8411_get_ic_version(pcr);
drivers/misc/cardreader/rts5209.c+1−0
@@ -255,6 +255,7 @@ void rts5209_init_params(struct rtsx_pcr *pcr) · 254 unmodified lines
255255 pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
256256 pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
257257 pcr->aspm_en = ASPM_L1_EN;
258+ pcr->aspm_mode = ASPM_MODE_CFG;
258259 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 16);
259260 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
260261
drivers/misc/cardreader/rts5227.c+2−0
@@ -358,6 +358,7 @@ void rts5227_init_params(struct rtsx_pcr *pcr) · 357 unmodified lines
358358 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
359359 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
360360 pcr->aspm_en = ASPM_L1_EN;
361+ pcr->aspm_mode = ASPM_MODE_CFG;
361362 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15);
362363 pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 7, 7);
363364
@@ -483,6 +484,7 @@ void rts522a_init_params(struct rtsx_pcr *pcr) · 119 unmodified lines
483484
484485 rts5227_init_params(pcr);
485486 pcr->ops = &rts522a_pcr_ops;
487+ pcr->aspm_mode = ASPM_MODE_REG;
486488 pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
487489 pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
488490
drivers/misc/cardreader/rts5228.c+1−0
@@ -718,6 +718,7 @@ void rts5228_init_params(struct rtsx_pcr *pcr) · 717 unmodified lines
718718 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
719719 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
720720 pcr->aspm_en = ASPM_L1_EN;
721+ pcr->aspm_mode = ASPM_MODE_REG;
721722 pcr->tx_initial_phase = SET_CLOCK_PHASE(28, 27, 11);
722723 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
723724
drivers/misc/cardreader/rts5229.c+1−0
@@ -246,6 +246,7 @@ void rts5229_init_params(struct rtsx_pcr *pcr) · 245 unmodified lines
246246 pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
247247 pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
248248 pcr->aspm_en = ASPM_L1_EN;
249+ pcr->aspm_mode = ASPM_MODE_CFG;
249250 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15);
250251 pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 6, 6);
251252
drivers/misc/cardreader/rts5249.c+3−0
@@ -566,6 +566,7 @@ void rts5249_init_params(struct rtsx_pcr *pcr) · 565 unmodified lines
566566 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
567567 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
568568 pcr->aspm_en = ASPM_L1_EN;
569+ pcr->aspm_mode = ASPM_MODE_CFG;
569570 pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
570571 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
571572
@@ -729,6 +730,7 @@ static const struct pcr_ops rts524a_pcr_ops = { · 157 unmodified lines
729730 void rts524a_init_params(struct rtsx_pcr *pcr)
730731 {
731732 rts5249_init_params(pcr);
733+ pcr->aspm_mode = ASPM_MODE_REG;
732734 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
733735 pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
734736 pcr->option.ltr_l1off_snooze_sspwrgate =
@@ -845,6 +847,7 @@ static const struct pcr_ops rts525a_pcr_ops = { · 110 unmodified lines
845847 void rts525a_init_params(struct rtsx_pcr *pcr)
846848 {
847849 rts5249_init_params(pcr);
850+ pcr->aspm_mode = ASPM_MODE_REG;
848851 pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11);
849852 pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
850853 pcr->option.ltr_l1off_snooze_sspwrgate =
drivers/misc/cardreader/rts5260.c+1−0
@@ -628,6 +628,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr) · 627 unmodified lines
628628 pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
629629 pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
630630 pcr->aspm_en = ASPM_L1_EN;
631+ pcr->aspm_mode = ASPM_MODE_REG;
631632 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
632633 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
633634
drivers/misc/cardreader/rts5261.c+1−0
@@ -783,6 +783,7 @@ void rts5261_init_params(struct rtsx_pcr *pcr) · 782 unmodified lines
783783 pcr->sd30_drive_sel_1v8 = 0x00;
784784 pcr->sd30_drive_sel_3v3 = 0x00;
785785 pcr->aspm_en = ASPM_L1_EN;
786+ pcr->aspm_mode = ASPM_MODE_REG;
786787 pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11);
787788 pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
788789
drivers/misc/cardreader/rtsx_pcr.c+31−13
@@ -85,12 +85,18 @@ static void rtsx_comm_set_aspm(struct rtsx_pcr *pcr, bool enable) · 84 unmodified lines
8585 if (pcr->aspm_enabled == enable)
8686 return;
8787
88− if (pcr->aspm_en & 0x02)
89− rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 |
90− FORCE_ASPM_CTL1, enable ? 0 : FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1);
91− else
92− rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 |
93− FORCE_ASPM_CTL1, FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1);
88+ if (pcr->aspm_mode == ASPM_MODE_CFG) {
89+ pcie_capability_clear_and_set_word(pcr->pci, PCI_EXP_LNKCTL,
90+ PCI_EXP_LNKCTL_ASPMC,
91+ enable ? pcr->aspm_en : 0);
92+ } else if (pcr->aspm_mode == ASPM_MODE_REG) {
93+ if (pcr->aspm_en & 0x02)
94+ rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 |
95+ FORCE_ASPM_CTL1, enable ? 0 : FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1);
96+ else
97+ rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, FORCE_ASPM_CTL0 |
98+ FORCE_ASPM_CTL1, FORCE_ASPM_CTL0 | FORCE_ASPM_CTL1);
99+ }
94100
95101 if (!enable && (pcr->aspm_en & 0x02))
96102 mdelay(10);
@@ -1394,7 +1400,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 1297 unmodified lines
13941400 return err;
13951401 }
13961402
1397− rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30);
1403+ if (pcr->aspm_mode == ASPM_MODE_REG)
1404+ rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30);
13981405
13991406 /* No CD interrupt if probing driver with card inserted.
14001407 * So we need to initialize pcr->card_exist here.
@@ -1410,6 +1417,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 9 unmodified lines
14101417 static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
14111418 {
14121419 int err;
1420+ u16 cfg_val;
1421+ u8 val;
14131422
14141423 spin_lock_init(&pcr->lock);
14151424 mutex_init(&pcr->pcr_mutex);
@@ -1477,6 +1486,21 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) · 61 unmodified lines
14771486 if (!pcr->slots)
14781487 return -ENOMEM;
14791488
1489+ if (pcr->aspm_mode == ASPM_MODE_CFG) {
1490+ pcie_capability_read_word(pcr->pci, PCI_EXP_LNKCTL, &cfg_val);
1491+ if (cfg_val & PCI_EXP_LNKCTL_ASPM_L1)
1492+ pcr->aspm_enabled = true;
1493+ else
1494+ pcr->aspm_enabled = false;
1495+
1496+ } else if (pcr->aspm_mode == ASPM_MODE_REG) {
1497+ rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val);
1498+ if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1)
1499+ pcr->aspm_enabled = false;
1500+ else
1501+ pcr->aspm_enabled = true;
1502+ }
1503+
14801504 if (pcr->ops->fetch_vendor_settings)
14811505 pcr->ops->fetch_vendor_settings(pcr);
14821506
@@ -1506,7 +1530,6 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, · 23 unmodified lines
15061530 struct pcr_handle *handle;
15071531 u32 base, len;
15081532 int ret, i, bar = 0;
1509− u8 val;
15101533
15111534 dev_dbg(&(pcidev->dev),
15121535 ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n",
@@ -1572,11 +1595,6 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, · 59 unmodified lines
15721595 pcr->host_cmds_addr = pcr->rtsx_resv_buf_addr;
15731596 pcr->host_sg_tbl_ptr = pcr->rtsx_resv_buf + HOST_CMDS_BUF_LEN;
15741597 pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr + HOST_CMDS_BUF_LEN;
1575− rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val);
1576− if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1)
1577− pcr->aspm_enabled = false;
1578− else
1579− pcr->aspm_enabled = true;
15801598 pcr->card_inserted = 0;
15811599 pcr->card_removed = 0;
15821600 INIT_DELAYED_WORK(&pcr->carddet_work, rtsx_pci_card_detect);
drivers/mmc/host/renesas_sdhi_core.c+7−2
@@ -692,14 +692,19 @@ static int renesas_sdhi_execute_tuning(struct mmc_host *mmc, u32 opcode) · 691 unmodified lines
692692
693693 /* Issue CMD19 twice for each tap */
694694 for (i = 0; i < 2 * priv->tap_num; i++) {
695+ int cmd_error;
696+
695697 /* Set sampling clock position */
696698 sd_scc_write32(host, priv, SH_MOBILE_SDHI_SCC_TAPSET, i % priv->tap_num);
697699
698− if (mmc_send_tuning(mmc, opcode, NULL) == 0)
700+ if (mmc_send_tuning(mmc, opcode, &cmd_error) == 0)
699701 set_bit(i, priv->taps);
700702
701703 if (sd_scc_read32(host, priv, SH_MOBILE_SDHI_SCC_SMPCMP) == 0)
702704 set_bit(i, priv->smpcmp);
705+
706+ if (cmd_error)
707+ mmc_abort_tuning(mmc, opcode);
703708 }
704709
705710 ret = renesas_sdhi_select_tuning(host);
@@ -939,7 +944,7 @@ static const struct soc_device_attribute sdhi_quirks_match[] = { · 233 unmodified lines
939944 { .soc_id = "r8a7795", .revision = "ES3.*", .data = &sdhi_quirks_bad_taps2367 },
940945 { .soc_id = "r8a7796", .revision = "ES1.[012]", .data = &sdhi_quirks_4tap_nohs400 },
941946 { .soc_id = "r8a7796", .revision = "ES1.*", .data = &sdhi_quirks_r8a7796_es13 },
942− { .soc_id = "r8a7796", .revision = "ES3.*", .data = &sdhi_quirks_bad_taps1357 },
947+ { .soc_id = "r8a77961", .data = &sdhi_quirks_bad_taps1357 },
943948 { .soc_id = "r8a77965", .data = &sdhi_quirks_r8a77965 },
944949 { .soc_id = "r8a77980", .data = &sdhi_quirks_nohs400 },
945950 { .soc_id = "r8a77990", .data = &sdhi_quirks_r8a77990 },
drivers/net/ethernet/chelsio/cxgb4/cxgb4.h+0−2
@@ -2177,8 +2177,6 @@ int cxgb4_update_mac_filt(struct port_info *pi, unsigned int viid, · 2176 unmodified lines
21772177 bool persistent, u8 *smt_idx);
21782178 int cxgb4_get_msix_idx_from_bmap(struct adapter *adap);
21792179 void cxgb4_free_msix_idx_in_bmap(struct adapter *adap, u32 msix_idx);
2180−int cxgb_open(struct net_device *dev);
2181−int cxgb_close(struct net_device *dev);
21822180 void cxgb4_enable_rx(struct adapter *adap, struct sge_rspq *q);
21832181 void cxgb4_quiesce_rx(struct sge_rspq *q);
21842182 int cxgb4_port_mirror_alloc(struct net_device *dev);
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+2−2
@@ -2834,7 +2834,7 @@ static void cxgb_down(struct adapter *adapter) · 2833 unmodified lines
28342834 /*
28352835 * net_device operations
28362836 */
2837−int cxgb_open(struct net_device *dev)
2837+static int cxgb_open(struct net_device *dev)
28382838 {
28392839 struct port_info *pi = netdev_priv(dev);
28402840 struct adapter *adapter = pi->adapter;
@@ -2882,7 +2882,7 @@ out_unlock: · 41 unmodified lines
28822882 return err;
28832883 }
28842884
2885−int cxgb_close(struct net_device *dev)
2885+static int cxgb_close(struct net_device *dev)
28862886 {
28872887 struct port_info *pi = netdev_priv(dev);
28882888 struct adapter *adapter = pi->adapter;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c+5−9
@@ -997,20 +997,16 @@ int cxgb4_tc_flower_destroy(struct net_device *dev, · 996 unmodified lines
997997 if (!ch_flower)
998998 return -ENOENT;
999999
1000+ rhashtable_remove_fast(&adap->flower_tbl, &ch_flower->node,
1001+ adap->flower_ht_params);
1002+
10001003 ret = cxgb4_flow_rule_destroy(dev, ch_flower->fs.tc_prio,
10011004 &ch_flower->fs, ch_flower->filter_id);
10021005 if (ret)
1003− goto err;
1006+ netdev_err(dev, "Flow rule destroy failed for tid: %u, ret: %d",
1007+ ch_flower->filter_id, ret);
10041008
1005− ret = rhashtable_remove_fast(&adap->flower_tbl, &ch_flower->node,
1006− adap->flower_ht_params);
1007− if (ret) {
1008− netdev_err(dev, "Flow remove from rhashtable failed");
1009− goto err;
1010− }
10111009 kfree_rcu(ch_flower, rcu);
1012−
1013−err:
10141010 return ret;
10151011 }
10161012
drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c+6−3
@@ -589,7 +589,8 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev, · 588 unmodified lines
589589 * down before configuring tc params.
590590 */
591591 if (netif_running(dev)) {
592− cxgb_close(dev);
592+ netif_tx_stop_all_queues(dev);
593+ netif_carrier_off(dev);
593594 needs_bring_up = true;
594595 }
595596
@@ -615,8 +616,10 @@ int cxgb4_setup_tc_mqprio(struct net_device *dev, · 19 unmodified lines
615616 }
616617
617618 out:
618− if (needs_bring_up)
619− cxgb_open(dev);
619+ if (needs_bring_up) {
620+ netif_tx_start_all_queues(dev);
621+ netif_carrier_on(dev);
622+ }
620623
621624 mutex_unlock(&adap->tc_mqprio->mqprio_mutex);
622625 return ret;
drivers/net/ethernet/chelsio/cxgb4/sge.c+6−0
@@ -2556,6 +2556,12 @@ int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc) · 2555 unmodified lines
25562556 if (!eosw_txq)
25572557 return -ENOMEM;
25582558
2559+ if (!(adap->flags & CXGB4_FW_OK)) {
2560+ /* Don't stall caller when access to FW is lost */
2561+ complete(&eosw_txq->completion);
2562+ return -EIO;
2563+ }
2564+
25592565 skb = alloc_skb(len, GFP_KERNEL);
25602566 if (!skb)
25612567 return -ENOMEM;
drivers/net/ethernet/intel/i40e/i40e_txrx.c+6−1
@@ -2313,15 +2313,20 @@ static int i40e_run_xdp(struct i40e_ring *rx_ring, struct xdp_buff *xdp) · 2312 unmodified lines
23132313 case XDP_TX:
23142314 xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
23152315 result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
2316+ if (result == I40E_XDP_CONSUMED)
2317+ goto out_failure;
23162318 break;
23172319 case XDP_REDIRECT:
23182320 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
2319− result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
2321+ if (err)
2322+ goto out_failure;
2323+ result = I40E_XDP_REDIR;
23202324 break;
23212325 default:
23222326 bpf_warn_invalid_xdp_action(act);
23232327 fallthrough;
23242328 case XDP_ABORTED:
2329+out_failure:
23252330 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
23262331 fallthrough; /* handle aborts by dropping packet */
23272332 case XDP_DROP:
drivers/net/ethernet/intel/i40e/i40e_xsk.c+6−2
@@ -162,9 +162,10 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) · 161 unmodified lines
162162
163163 if (likely(act == XDP_REDIRECT)) {
164164 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
165− result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
165+ if (err)
166+ goto out_failure;
166167 rcu_read_unlock();
167− return result;
168+ return I40E_XDP_REDIR;
168169 }
169170
170171 switch (act) {
@@ -173,11 +174,14 @@ static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp) · 2 unmodified lines
173174 case XDP_TX:
174175 xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
175176 result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
177+ if (result == I40E_XDP_CONSUMED)
178+ goto out_failure;
176179 break;
177180 default:
178181 bpf_warn_invalid_xdp_action(act);
179182 fallthrough;
180183 case XDP_ABORTED:
184+out_failure:
181185 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
182186 fallthrough; /* handle aborts by dropping packet */
183187 case XDP_DROP:
drivers/net/ethernet/intel/ice/ice.h+5−3
@@ -335,6 +335,7 @@ struct ice_vsi { · 334 unmodified lines
335335 struct ice_tc_cfg tc_cfg;
336336 struct bpf_prog *xdp_prog;
337337 struct ice_ring **xdp_rings; /* XDP ring array */
338+ unsigned long *af_xdp_zc_qps; /* tracks AF_XDP ZC enabled qps */
338339 u16 num_xdp_txq; /* Used XDP queues */
339340 u8 xdp_mapping_mode; /* ICE_MAP_MODE_[CONTIG|SCATTER] */
340341
@@ -547,15 +548,16 @@ static inline void ice_set_ring_xdp(struct ice_ring *ring) · 206 unmodified lines
547548 */
548549 static inline struct xsk_buff_pool *ice_xsk_pool(struct ice_ring *ring)
549550 {
551+ struct ice_vsi *vsi = ring->vsi;
550552 u16 qid = ring->q_index;
551553
552554 if (ice_ring_is_xdp(ring))
553− qid -= ring->vsi->num_xdp_txq;
555+ qid -= vsi->num_xdp_txq;
554556
555− if (!ice_is_xdp_ena_vsi(ring->vsi))
557+ if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
556558 return NULL;
557559
558− return xsk_get_pool_from_qid(ring->vsi->netdev, qid);
560+ return xsk_get_pool_from_qid(vsi->netdev, qid);
559561 }
560562
561563 /**
drivers/net/ethernet/intel/ice/ice_ethtool.c+6−45
@@ -1773,49 +1773,6 @@ ice_phy_type_to_ethtool(struct net_device *netdev, · 1772 unmodified lines
17731773 ice_ethtool_advertise_link_mode(ICE_AQ_LINK_SPEED_100GB,
17741774 100000baseKR4_Full);
17751775 }
1776−
1777− /* Autoneg PHY types */
1778− if (phy_types_low & ICE_PHY_TYPE_LOW_100BASE_TX ||
1779− phy_types_low & ICE_PHY_TYPE_LOW_1000BASE_T ||
1780− phy_types_low & ICE_PHY_TYPE_LOW_1000BASE_KX ||
1781− phy_types_low & ICE_PHY_TYPE_LOW_2500BASE_T ||
1782− phy_types_low & ICE_PHY_TYPE_LOW_2500BASE_KX ||
1783− phy_types_low & ICE_PHY_TYPE_LOW_5GBASE_T ||
1784− phy_types_low & ICE_PHY_TYPE_LOW_5GBASE_KR ||
1785− phy_types_low & ICE_PHY_TYPE_LOW_10GBASE_T ||
1786− phy_types_low & ICE_PHY_TYPE_LOW_10GBASE_KR_CR1 ||
1787− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_T ||
1788− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR ||
1789− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR_S ||
1790− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_CR1 ||
1791− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR ||
1792− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR_S ||
1793− phy_types_low & ICE_PHY_TYPE_LOW_25GBASE_KR1 ||
1794− phy_types_low & ICE_PHY_TYPE_LOW_40GBASE_CR4 ||
1795− phy_types_low & ICE_PHY_TYPE_LOW_40GBASE_KR4) {
1796− ethtool_link_ksettings_add_link_mode(ks, supported,
1797− Autoneg);
1798− ethtool_link_ksettings_add_link_mode(ks, advertising,
1799− Autoneg);
1800− }
1801− if (phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_CR2 ||
1802− phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_KR2 ||
1803− phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_CP ||
1804− phy_types_low & ICE_PHY_TYPE_LOW_50GBASE_KR_PAM4) {
1805− ethtool_link_ksettings_add_link_mode(ks, supported,
1806− Autoneg);
1807− ethtool_link_ksettings_add_link_mode(ks, advertising,
1808− Autoneg);
1809− }
1810− if (phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_CR4 ||
1811− phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_KR4 ||
1812− phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_KR_PAM4 ||
1813− phy_types_low & ICE_PHY_TYPE_LOW_100GBASE_CP2) {
1814− ethtool_link_ksettings_add_link_mode(ks, supported,
1815− Autoneg);
1816− ethtool_link_ksettings_add_link_mode(ks, advertising,
1817− Autoneg);
1818− }
18191776 }
18201777
18211778 #define TEST_SET_BITS_TIMEOUT 50
@@ -1972,9 +1929,7 @@ ice_get_link_ksettings(struct net_device *netdev, · 150 unmodified lines
19721929 ks->base.port = PORT_TP;
19731930 break;
19741931 case ICE_MEDIA_BACKPLANE:
1975− ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
19761932 ethtool_link_ksettings_add_link_mode(ks, supported, Backplane);
1977− ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
19781933 ethtool_link_ksettings_add_link_mode(ks, advertising,
19791934 Backplane);
19801935 ks->base.port = PORT_NONE;
@@ -2049,6 +2004,12 @@ ice_get_link_ksettings(struct net_device *netdev, · 68 unmodified lines
20492004 if (caps->link_fec_options & ICE_AQC_PHY_FEC_25G_RS_CLAUSE91_EN)
20502005 ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);
20512006
2007+ /* Set supported and advertised autoneg */
2008+ if (ice_is_phy_caps_an_enabled(caps)) {
2009+ ethtool_link_ksettings_add_link_mode(ks, supported, Autoneg);
2010+ ethtool_link_ksettings_add_link_mode(ks, advertising, Autoneg);
2011+ }
2012+
20522013 done:
20532014 kfree(caps);
20542015 return err;
drivers/net/ethernet/intel/ice/ice_hw_autogen.h+1−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #define PF_FW_ATQLEN_ATQOVFL_M BIT(29)
3232 #define PF_FW_ATQLEN_ATQCRIT_M BIT(30)
3333 #define VF_MBX_ARQLEN(_VF) (0x0022BC00 + ((_VF) * 4))
34+#define VF_MBX_ATQLEN(_VF) (0x0022A800 + ((_VF) * 4))
3435 #define PF_FW_ATQLEN_ATQENABLE_M BIT(31)
3536 #define PF_FW_ATQT 0x00080400
3637 #define PF_MBX_ARQBAH 0x0022E400
drivers/net/ethernet/intel/ice/ice_lib.c+12−0
@@ -105,8 +105,14 @@ static int ice_vsi_alloc_arrays(struct ice_vsi *vsi) · 104 unmodified lines
105105 if (!vsi->q_vectors)
106106 goto err_vectors;
107107
108+ vsi->af_xdp_zc_qps = bitmap_zalloc(max_t(int, vsi->alloc_txq, vsi->alloc_rxq), GFP_KERNEL);
109+ if (!vsi->af_xdp_zc_qps)
110+ goto err_zc_qps;
111+
108112 return 0;
109113
114+err_zc_qps:
115+ devm_kfree(dev, vsi->q_vectors);
110116 err_vectors:
111117 devm_kfree(dev, vsi->rxq_map);
112118 err_rxq_map:
@@ -194,6 +200,8 @@ static void ice_vsi_set_num_qs(struct ice_vsi *vsi, u16 vf_id) · 81 unmodified lines
194200 break;
195201 case ICE_VSI_VF:
196202 vf = &pf->vf[vsi->vf_id];
203+ if (vf->num_req_qs)
204+ vf->num_vf_qs = vf->num_req_qs;
197205 vsi->alloc_txq = vf->num_vf_qs;
198206 vsi->alloc_rxq = vf->num_vf_qs;
199207 /* pf->num_msix_per_vf includes (VF miscellaneous vector +
@@ -288,6 +296,10 @@ static void ice_vsi_free_arrays(struct ice_vsi *vsi) · 88 unmodified lines
288296
289297 dev = ice_pf_to_dev(pf);
290298
299+ if (vsi->af_xdp_zc_qps) {
300+ bitmap_free(vsi->af_xdp_zc_qps);
301+ vsi->af_xdp_zc_qps = NULL;
302+ }
291303 /* free the ring and vector containers */
292304 if (vsi->q_vectors) {
293305 devm_kfree(dev, vsi->q_vectors);
drivers/net/ethernet/intel/ice/ice_txrx.c+13−4
@@ -523,7 +523,7 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, · 522 unmodified lines
523523 struct bpf_prog *xdp_prog)
524524 {
525525 struct ice_ring *xdp_ring;
526− int err;
526+ int err, result;
527527 u32 act;
528528
529529 act = bpf_prog_run_xdp(xdp_prog, xdp);
@@ -532,14 +532,20 @@ ice_run_xdp(struct ice_ring *rx_ring, struct xdp_buff *xdp, · 2 unmodified lines
532532 return ICE_XDP_PASS;
533533 case XDP_TX:
534534 xdp_ring = rx_ring->vsi->xdp_rings[smp_processor_id()];
535− return ice_xmit_xdp_buff(xdp, xdp_ring);
535+ result = ice_xmit_xdp_buff(xdp, xdp_ring);
536+ if (result == ICE_XDP_CONSUMED)
537+ goto out_failure;
538+ return result;
536539 case XDP_REDIRECT:
537540 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
538− return !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED;
541+ if (err)
542+ goto out_failure;
543+ return ICE_XDP_REDIR;
539544 default:
540545 bpf_warn_invalid_xdp_action(act);
541546 fallthrough;
542547 case XDP_ABORTED:
548+out_failure:
543549 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
544550 fallthrough;
545551 case XDP_DROP:
@@ -2143,6 +2149,7 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) · 1597 unmodified lines
21432149 struct ice_tx_offload_params offload = { 0 };
21442150 struct ice_vsi *vsi = tx_ring->vsi;
21452151 struct ice_tx_buf *first;
2152+ struct ethhdr *eth;
21462153 unsigned int count;
21472154 int tso, csum;
21482155
@@ -2189,7 +2196,9 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) · 40 unmodified lines
21892196 goto out_drop;
21902197
21912198 /* allow CONTROL frames egress from main VSI if FW LLDP disabled */
2192− if (unlikely(skb->priority == TC_PRIO_CONTROL &&
2199+ eth = (struct ethhdr *)skb_mac_header(skb);
2200+ if (unlikely((skb->priority == TC_PRIO_CONTROL ||
2201+ eth->h_proto == htons(ETH_P_LLDP)) &&
21932202 vsi->type == ICE_VSI_PF &&
21942203 vsi->port_info->qos_cfg.is_sw_lldp))
21952204 offload.cd_qw1 |= (u64)(ICE_TX_DESC_DTYPE_CTX |
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+13−6
@@ -713,13 +713,15 @@ static void ice_trigger_vf_reset(struct ice_vf *vf, bool is_vflr, bool is_pfr) · 712 unmodified lines
713713 */
714714 clear_bit(ICE_VF_STATE_INIT, vf->vf_states);
715715
716− /* VF_MBX_ARQLEN is cleared by PFR, so the driver needs to clear it
717− * in the case of VFR. If this is done for PFR, it can mess up VF
718− * resets because the VF driver may already have started cleanup
719− * by the time we get here.
716+ /* VF_MBX_ARQLEN and VF_MBX_ATQLEN are cleared by PFR, so the driver
717+ * needs to clear them in the case of VFR/VFLR. If this is done for
718+ * PFR, it can mess up VF resets because the VF driver may already
719+ * have started cleanup by the time we get here.
720720 */
721− if (!is_pfr)
721+ if (!is_pfr) {
722722 wr32(hw, VF_MBX_ARQLEN(vf->vf_id), 0);
723+ wr32(hw, VF_MBX_ATQLEN(vf->vf_id), 0);
724+ }
723725
724726 /* In the case of a VFLR, the HW has already reset the VF and we
725727 * just need to clean up, so don't hit the VFRTRIG register.
@@ -1698,7 +1700,12 @@ bool ice_reset_vf(struct ice_vf *vf, bool is_vflr) · 972 unmodified lines
16981700 ice_vf_ctrl_vsi_release(vf);
16991701
17001702 ice_vf_pre_vsi_rebuild(vf);
1701− ice_vf_rebuild_vsi_with_release(vf);
1703+
1704+ if (ice_vf_rebuild_vsi_with_release(vf)) {
1705+ dev_err(dev, "Failed to release and setup the VF%u's VSI\n", vf->vf_id);
1706+ return false;
1707+ }
1708+
17021709 ice_vf_post_vsi_rebuild(vf);
17031710
17041711 /* if the VF has been reset allow it to come up again */
drivers/net/ethernet/intel/ice/ice_xsk.c+9−2
@@ -270,6 +270,7 @@ static int ice_xsk_pool_disable(struct ice_vsi *vsi, u16 qid) · 269 unmodified lines
270270 if (!pool)
271271 return -EINVAL;
272272
273+ clear_bit(qid, vsi->af_xdp_zc_qps);
273274 xsk_pool_dma_unmap(pool, ICE_RX_DMA_ATTR);
274275
275276 return 0;
@@ -300,6 +301,8 @@ ice_xsk_pool_enable(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid) · 24 unmodified lines
300301 if (err)
301302 return err;
302303
304+ set_bit(qid, vsi->af_xdp_zc_qps);
305+
303306 return 0;
304307 }
305308
@@ -473,9 +476,10 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) · 167 unmodified lines
473476
474477 if (likely(act == XDP_REDIRECT)) {
475478 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
476− result = !err ? ICE_XDP_REDIR : ICE_XDP_CONSUMED;
479+ if (err)
480+ goto out_failure;
477481 rcu_read_unlock();
478− return result;
482+ return ICE_XDP_REDIR;
479483 }
480484
481485 switch (act) {
@@ -484,11 +488,14 @@ ice_run_xdp_zc(struct ice_ring *rx_ring, struct xdp_buff *xdp) · 2 unmodified lines
484488 case XDP_TX:
485489 xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->q_index];
486490 result = ice_xmit_xdp_buff(xdp, xdp_ring);
491+ if (result == ICE_XDP_CONSUMED)
492+ goto out_failure;
487493 break;
488494 default:
489495 bpf_warn_invalid_xdp_action(act);
490496 fallthrough;
491497 case XDP_ABORTED:
498+out_failure:
492499 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
493500 fallthrough;
494501 case XDP_DROP:
drivers/net/ethernet/intel/igb/igb.h+1−1
@@ -749,7 +749,7 @@ void igb_ptp_rx_hang(struct igb_adapter *adapter); · 748 unmodified lines
749749 void igb_ptp_tx_hang(struct igb_adapter *adapter);
750750 void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb);
751751 int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
752− struct sk_buff *skb);
752+ ktime_t *timestamp);
753753 int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
754754 int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
755755 void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
drivers/net/ethernet/intel/igb/igb_main.c+32−23
@@ -8280,7 +8280,7 @@ static void igb_add_rx_frag(struct igb_ring *rx_ring, · 8279 unmodified lines
82808280 static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring,
82818281 struct igb_rx_buffer *rx_buffer,
82828282 struct xdp_buff *xdp,
8283− union e1000_adv_rx_desc *rx_desc)
8283+ ktime_t timestamp)
82848284 {
82858285 #if (PAGE_SIZE < 8192)
82868286 unsigned int truesize = igb_rx_pg_size(rx_ring) / 2;
@@ -8300,12 +8300,8 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, · 13 unmodified lines
83008300 if (unlikely(!skb))
83018301 return NULL;
83028302
8303− if (unlikely(igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP))) {
8304− if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, xdp->data, skb)) {
8305− xdp->data += IGB_TS_HDR_LEN;
8306− size -= IGB_TS_HDR_LEN;
8307− }
8308− }
8303+ if (timestamp)
8304+ skb_hwtstamps(skb)->hwtstamp = timestamp;
83098305
83108306 /* Determine available headroom for copy */
83118307 headlen = size;
@@ -8336,7 +8332,7 @@ static struct sk_buff *igb_construct_skb(struct igb_ring *rx_ring, · 24 unmodified lines
83368332 static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring,
83378333 struct igb_rx_buffer *rx_buffer,
83388334 struct xdp_buff *xdp,
8339− union e1000_adv_rx_desc *rx_desc)
8335+ ktime_t timestamp)
83408336 {
83418337 #if (PAGE_SIZE < 8192)
83428338 unsigned int truesize = igb_rx_pg_size(rx_ring) / 2;
@@ -8363,11 +8359,8 @@ static struct sk_buff *igb_build_skb(struct igb_ring *rx_ring, · 20 unmodified lines
83638359 if (metasize)
83648360 skb_metadata_set(skb, metasize);
83658361
8366− /* pull timestamp out of packet data */
8367− if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
8368− if (!igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb))
8369− __skb_pull(skb, IGB_TS_HDR_LEN);
8370− }
8362+ if (timestamp)
8363+ skb_hwtstamps(skb)->hwtstamp = timestamp;
83718364
83728365 /* update buffer offset */
83738366 #if (PAGE_SIZE < 8192)
@@ -8401,18 +8394,20 @@ static struct sk_buff *igb_run_xdp(struct igb_adapter *adapter, · 27 unmodified lines
84018394 break;
84028395 case XDP_TX:
84038396 result = igb_xdp_xmit_back(adapter, xdp);
8397+ if (result == IGB_XDP_CONSUMED)
8398+ goto out_failure;
84048399 break;
84058400 case XDP_REDIRECT:
84068401 err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog);
8407− if (!err)
8408− result = IGB_XDP_REDIR;
8409− else
8410− result = IGB_XDP_CONSUMED;
8402+ if (err)
8403+ goto out_failure;
8404+ result = IGB_XDP_REDIR;
84118405 break;
84128406 default:
84138407 bpf_warn_invalid_xdp_action(act);
84148408 fallthrough;
84158409 case XDP_ABORTED:
8410+out_failure:
84168411 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
84178412 fallthrough;
84188413 case XDP_DROP:
@@ -8682,7 +8677,10 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 263 unmodified lines
86828677 while (likely(total_packets < budget)) {
86838678 union e1000_adv_rx_desc *rx_desc;
86848679 struct igb_rx_buffer *rx_buffer;
8680+ ktime_t timestamp = 0;
8681+ int pkt_offset = 0;
86858682 unsigned int size;
8683+ void *pktbuf;
86868684
86878685 /* return some buffers to hardware, one at a time is too slow */
86888686 if (cleaned_count >= IGB_RX_BUFFER_WRITE) {
@@ -8702,14 +8700,24 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 13 unmodified lines
87028700 dma_rmb();
87038701
87048702 rx_buffer = igb_get_rx_buffer(rx_ring, size, &rx_buf_pgcnt);
8703+ pktbuf = page_address(rx_buffer->page) + rx_buffer->page_offset;
8704+
8705+ /* pull rx packet timestamp if available and valid */
8706+ if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
8707+ int ts_hdr_len;
8708+
8709+ ts_hdr_len = igb_ptp_rx_pktstamp(rx_ring->q_vector,
8710+ pktbuf, &timestamp);
8711+
8712+ pkt_offset += ts_hdr_len;
8713+ size -= ts_hdr_len;
8714+ }
87058715
87068716 /* retrieve a buffer from the ring */
87078717 if (!skb) {
8708− unsigned int offset = igb_rx_offset(rx_ring);
8709− unsigned char *hard_start;
8718+ unsigned char *hard_start = pktbuf - igb_rx_offset(rx_ring);
8719+ unsigned int offset = pkt_offset + igb_rx_offset(rx_ring);
87108720
8711− hard_start = page_address(rx_buffer->page) +
8712− rx_buffer->page_offset - offset;
87138721 xdp_prepare_buff(&xdp, hard_start, offset, size, true);
87148722 #if (PAGE_SIZE > 4096)
87158723 /* At larger PAGE_SIZE, frame_sz depend on len size */
@@ -8732,10 +8740,11 @@ static int igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget) · 16 unmodified lines
87328740 } else if (skb)
87338741 igb_add_rx_frag(rx_ring, rx_buffer, skb, size);
87348742 else if (ring_uses_build_skb(rx_ring))
8735− skb = igb_build_skb(rx_ring, rx_buffer, &xdp, rx_desc);
8743+ skb = igb_build_skb(rx_ring, rx_buffer, &xdp,
8744+ timestamp);
87368745 else
87378746 skb = igb_construct_skb(rx_ring, rx_buffer,
8738− &xdp, rx_desc);
8747+ &xdp, timestamp);
87398748
87408749 /* exit if we failed to retrieve a buffer */
87418750 if (!skb) {
drivers/net/ethernet/intel/igb/igb_ptp.c+10−13
@@ -856,30 +856,28 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter) · 855 unmodified lines
856856 dev_kfree_skb_any(skb);
857857 }
858858
859−#define IGB_RET_PTP_DISABLED 1
860−#define IGB_RET_PTP_INVALID 2
861−
862859 /**
863860 * igb_ptp_rx_pktstamp - retrieve Rx per packet timestamp
864861 * @q_vector: Pointer to interrupt specific structure
865862 * @va: Pointer to address containing Rx buffer
866− * @skb: Buffer containing timestamp and packet
863+ * @timestamp: Pointer where timestamp will be stored
867864 *
868865 * This function is meant to retrieve a timestamp from the first buffer of an
869866 * incoming frame. The value is stored in little endian format starting on
870867 * byte 8
871868 *
872− * Returns: 0 if success, nonzero if failure
869+ * Returns: The timestamp header length or 0 if not available
873870 **/
874871 int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va,
875− struct sk_buff *skb)
872+ ktime_t *timestamp)
876873 {
877874 struct igb_adapter *adapter = q_vector->adapter;
875+ struct skb_shared_hwtstamps ts;
878876 __le64 *regval = (__le64 *)va;
879877 int adjust = 0;
880878
881879 if (!(adapter->ptp_flags & IGB_PTP_ENABLED))
882− return IGB_RET_PTP_DISABLED;
880+ return 0;
883881
884882 /* The timestamp is recorded in little endian format.
885883 * DWORD: 0 1 2 3
@@ -888,10 +886,9 @@ int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 2 unmodified lines
888886
889887 /* check reserved dwords are zero, be/le doesn't matter for zero */
890888 if (regval[0])
891− return IGB_RET_PTP_INVALID;
889+ return 0;
892890
893− igb_ptp_systim_to_hwtstamp(adapter, skb_hwtstamps(skb),
894− le64_to_cpu(regval[1]));
891+ igb_ptp_systim_to_hwtstamp(adapter, &ts, le64_to_cpu(regval[1]));
895892
896893 /* adjust timestamp for the RX latency based on link speed */
897894 if (adapter->hw.mac.type == e1000_i210) {
@@ -907,10 +904,10 @@ int igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, void *va, · 9 unmodified lines
907904 break;
908905 }
909906 }
910− skb_hwtstamps(skb)->hwtstamp =
911− ktime_sub_ns(skb_hwtstamps(skb)->hwtstamp, adjust);
912907
913− return 0;
908+ *timestamp = ktime_sub_ns(ts.hwtstamp, adjust);
909+
910+ return IGB_TS_HDR_LEN;
914911 }
915912
916913 /**
drivers/net/ethernet/intel/igc/igc_main.c+5−6
@@ -2047,20 +2047,19 @@ static struct sk_buff *igc_xdp_run_prog(struct igc_adapter *adapter, · 2046 unmodified lines
20472047 break;
20482048 case XDP_TX:
20492049 if (igc_xdp_xmit_back(adapter, xdp) < 0)
2050− res = IGC_XDP_CONSUMED;
2051− else
2052− res = IGC_XDP_TX;
2050+ goto out_failure;
2051+ res = IGC_XDP_TX;
20532052 break;
20542053 case XDP_REDIRECT:
20552054 if (xdp_do_redirect(adapter->netdev, xdp, prog) < 0)
2056− res = IGC_XDP_CONSUMED;
2057− else
2058− res = IGC_XDP_REDIRECT;
2055+ goto out_failure;
2056+ res = IGC_XDP_REDIRECT;
20592057 break;
20602058 default:
20612059 bpf_warn_invalid_xdp_action(act);
20622060 fallthrough;
20632061 case XDP_ABORTED:
2062+out_failure:
20642063 trace_xdp_exception(adapter->netdev, prog, act);
20652064 fallthrough;
20662065 case XDP_DROP:
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+8−8
@@ -2213,23 +2213,23 @@ static struct sk_buff *ixgbe_run_xdp(struct ixgbe_adapter *adapter, · 2212 unmodified lines
22132213 break;
22142214 case XDP_TX:
22152215 xdpf = xdp_convert_buff_to_frame(xdp);
2216− if (unlikely(!xdpf)) {
2217− result = IXGBE_XDP_CONSUMED;
2218− break;
2219− }
2216+ if (unlikely(!xdpf))
2217+ goto out_failure;
22202218 result = ixgbe_xmit_xdp_ring(adapter, xdpf);
2219+ if (result == IXGBE_XDP_CONSUMED)
2220+ goto out_failure;
22212221 break;
22222222 case XDP_REDIRECT:
22232223 err = xdp_do_redirect(adapter->netdev, xdp, xdp_prog);
2224− if (!err)
2225− result = IXGBE_XDP_REDIR;
2226− else
2227− result = IXGBE_XDP_CONSUMED;
2224+ if (err)
2225+ goto out_failure;
2226+ result = IXGBE_XDP_REDIR;
22282227 break;
22292228 default:
22302229 bpf_warn_invalid_xdp_action(act);
22312230 fallthrough;
22322231 case XDP_ABORTED:
2232+out_failure:
22332233 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
22342234 fallthrough; /* handle aborts by dropping packet */
22352235 case XDP_DROP:
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c+8−6
@@ -106,9 +106,10 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, · 105 unmodified lines
106106
107107 if (likely(act == XDP_REDIRECT)) {
108108 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
109− result = !err ? IXGBE_XDP_REDIR : IXGBE_XDP_CONSUMED;
109+ if (err)
110+ goto out_failure;
110111 rcu_read_unlock();
111− return result;
112+ return IXGBE_XDP_REDIR;
112113 }
113114
114115 switch (act) {
@@ -116,16 +117,17 @@ static int ixgbe_run_xdp_zc(struct ixgbe_adapter *adapter, · 1 unmodified line
116117 break;
117118 case XDP_TX:
118119 xdpf = xdp_convert_buff_to_frame(xdp);
119− if (unlikely(!xdpf)) {
120− result = IXGBE_XDP_CONSUMED;
121− break;
122− }
120+ if (unlikely(!xdpf))
121+ goto out_failure;
123122 result = ixgbe_xmit_xdp_ring(adapter, xdpf);
123+ if (result == IXGBE_XDP_CONSUMED)
124+ goto out_failure;
124125 break;
125126 default:
126127 bpf_warn_invalid_xdp_action(act);
127128 fallthrough;
128129 case XDP_ABORTED:
130+out_failure:
129131 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
130132 fallthrough; /* handle aborts by dropping packet */
131133 case XDP_DROP:
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c+3−0
@@ -1067,11 +1067,14 @@ static struct sk_buff *ixgbevf_run_xdp(struct ixgbevf_adapter *adapter, · 1066 unmodified lines
10671067 case XDP_TX:
10681068 xdp_ring = adapter->xdp_ring[rx_ring->queue_index];
10691069 result = ixgbevf_xmit_xdp_ring(xdp_ring, xdp);
1070+ if (result == IXGBEVF_XDP_CONSUMED)
1071+ goto out_failure;
10701072 break;
10711073 default:
10721074 bpf_warn_invalid_xdp_action(act);
10731075 fallthrough;
10741076 case XDP_ABORTED:
1077+out_failure:
10751078 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
10761079 fallthrough; /* handle aborts by dropping packet */
10771080 case XDP_DROP:
drivers/net/ethernet/mellanox/mlx4/fw.c+3−0
@@ -823,6 +823,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 822 unmodified lines
823823 #define QUERY_DEV_CAP_MAD_DEMUX_OFFSET 0xb0
824824 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_BASE_OFFSET 0xa8
825825 #define QUERY_DEV_CAP_DMFS_HIGH_RATE_QPN_RANGE_OFFSET 0xac
826+#define QUERY_DEV_CAP_MAP_CLOCK_TO_USER 0xc1
826827 #define QUERY_DEV_CAP_QP_RATE_LIMIT_NUM_OFFSET 0xcc
827828 #define QUERY_DEV_CAP_QP_RATE_LIMIT_MAX_OFFSET 0xd0
828829 #define QUERY_DEV_CAP_QP_RATE_LIMIT_MIN_OFFSET 0xd2
@@ -841,6 +842,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 12 unmodified lines
841842
842843 if (mlx4_is_mfunc(dev))
843844 disable_unsupported_roce_caps(outbox);
845+ MLX4_GET(field, outbox, QUERY_DEV_CAP_MAP_CLOCK_TO_USER);
846+ dev_cap->map_clock_to_user = field & 0x80;
844847 MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_QP_OFFSET);
845848 dev_cap->reserved_qps = 1 << (field & 0xf);
846849 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_QP_OFFSET);
drivers/net/ethernet/mellanox/mlx4/fw.h+1−0
@@ -131,6 +131,7 @@ struct mlx4_dev_cap { · 130 unmodified lines
131131 u32 health_buffer_addrs;
132132 struct mlx4_port_cap port_cap[MLX4_MAX_PORTS + 1];
133133 bool wol_port[MLX4_MAX_PORTS + 1];
134+ bool map_clock_to_user;
134135 };
135136
136137 struct mlx4_func_cap {
drivers/net/ethernet/mellanox/mlx4/main.c+6−0
@@ -498,6 +498,7 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) · 497 unmodified lines
498498 }
499499 }
500500
501+ dev->caps.map_clock_to_user = dev_cap->map_clock_to_user;
501502 dev->caps.uar_page_size = PAGE_SIZE;
502503 dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE;
503504 dev->caps.local_ca_ack_delay = dev_cap->local_ca_ack_delay;
@@ -1948,6 +1949,11 @@ int mlx4_get_internal_clock_params(struct mlx4_dev *dev, · 1444 unmodified lines
19481949 if (mlx4_is_slave(dev))
19491950 return -EOPNOTSUPP;
19501951
1952+ if (!dev->caps.map_clock_to_user) {
1953+ mlx4_dbg(dev, "Map clock to user is not supported.\n");
1954+ return -EOPNOTSUPP;
1955+ }
1956+
19511957 if (!params)
19521958 return -EINVAL;
19531959
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c+10−2
@@ -1624,12 +1624,13 @@ static int mlx5e_set_fecparam(struct net_device *netdev, · 1623 unmodified lines
16241624 {
16251625 struct mlx5e_priv *priv = netdev_priv(netdev);
16261626 struct mlx5_core_dev *mdev = priv->mdev;
1627+ unsigned long fec_bitmap;
16271628 u16 fec_policy = 0;
16281629 int mode;
16291630 int err;
16301631
1631− if (bitmap_weight((unsigned long *)&fecparam->fec,
1632− ETHTOOL_FEC_LLRS_BIT + 1) > 1)
1632+ bitmap_from_arr32(&fec_bitmap, &fecparam->fec, sizeof(fecparam->fec) * BITS_PER_BYTE);
1633+ if (bitmap_weight(&fec_bitmap, ETHTOOL_FEC_LLRS_BIT + 1) > 1)
16331634 return -EOPNOTSUPP;
16341635
16351636 for (mode = 0; mode < ARRAY_SIZE(pplm_fec_2_ethtool); mode++) {
@@ -1893,6 +1894,13 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val · 257 unmodified lines
18931894 if (curr_val == new_val)
18941895 return 0;
18951896
1897+ if (new_val && !priv->profile->rx_ptp_support &&
1898+ priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) {
1899+ netdev_err(priv->netdev,
1900+ "Profile doesn't support enabling of CQE compression while hardware time-stamping is enabled.\n");
1901+ return -EINVAL;
1902+ }
1903+
18961904 new_params = priv->channels.params;
18971905 MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_COMPRESS, new_val);
18981906 if (priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+62−15
@@ -3858,6 +3858,16 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, · 3857 unmodified lines
38583858 netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n");
38593859 }
38603860
3861+ if (mlx5e_is_uplink_rep(priv)) {
3862+ features &= ~NETIF_F_HW_TLS_RX;
3863+ if (netdev->features & NETIF_F_HW_TLS_RX)
3864+ netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n");
3865+
3866+ features &= ~NETIF_F_HW_TLS_TX;
3867+ if (netdev->features & NETIF_F_HW_TLS_TX)
3868+ netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n");
3869+ }
3870+
38613871 mutex_unlock(&priv->state_lock);
38623872
38633873 return features;
@@ -3974,11 +3984,45 @@ int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx) · 110 unmodified lines
39743984 return mlx5e_ptp_rx_manage_fs(priv, set);
39753985 }
39763986
3977−int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
3987+static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filter)
3988+{
3989+ bool rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def;
3990+ int err;
3991+
3992+ if (!rx_filter)
3993+ /* Reset CQE compression to Admin default */
3994+ return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def);
3995+
3996+ if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS))
3997+ return 0;
3998+
3999+ /* Disable CQE compression */
4000+ netdev_warn(priv->netdev, "Disabling RX cqe compression\n");
4001+ err = mlx5e_modify_rx_cqe_compression_locked(priv, false);
4002+ if (err)
4003+ netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err);
4004+
4005+ return err;
4006+}
4007+
4008+static int mlx5e_hwstamp_config_ptp_rx(struct mlx5e_priv *priv, bool ptp_rx)
39784009 {
39794010 struct mlx5e_params new_params;
4011+
4012+ if (ptp_rx == priv->channels.params.ptp_rx)
4013+ return 0;
4014+
4015+ new_params = priv->channels.params;
4016+ new_params.ptp_rx = ptp_rx;
4017+ return mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx,
4018+ &new_params.ptp_rx, true);
4019+}
4020+
4021+int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
4022+{
39804023 struct hwtstamp_config config;
39814024 bool rx_cqe_compress_def;
4025+ bool ptp_rx;
39824026 int err;
39834027
39844028 if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) ||
@@ -3998,13 +4042,12 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) · 13 unmodified lines
39984042 }
39994043
40004044 mutex_lock(&priv->state_lock);
4001− new_params = priv->channels.params;
40024045 rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def;
40034046
40044047 /* RX HW timestamp */
40054048 switch (config.rx_filter) {
40064049 case HWTSTAMP_FILTER_NONE:
4007− new_params.ptp_rx = false;
4050+ ptp_rx = false;
40084051 break;
40094052 case HWTSTAMP_FILTER_ALL:
40104053 case HWTSTAMP_FILTER_SOME:
@@ -4021,24 +4064,25 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) · 10 unmodified lines
40214064 case HWTSTAMP_FILTER_PTP_V2_SYNC:
40224065 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
40234066 case HWTSTAMP_FILTER_NTP_ALL:
4024− new_params.ptp_rx = rx_cqe_compress_def;
40254067 config.rx_filter = HWTSTAMP_FILTER_ALL;
4068+ /* ptp_rx is set if both HW TS is set and CQE
4069+ * compression is set
4070+ */
4071+ ptp_rx = rx_cqe_compress_def;
40264072 break;
40274073 default:
4028− mutex_unlock(&priv->state_lock);
4029− return -ERANGE;
4074+ err = -ERANGE;
4075+ goto err_unlock;
40304076 }
40314077
4032− if (new_params.ptp_rx == priv->channels.params.ptp_rx)
4033− goto out;
4078+ if (!priv->profile->rx_ptp_support)
4079+ err = mlx5e_hwstamp_config_no_ptp_rx(priv,
4080+ config.rx_filter != HWTSTAMP_FILTER_NONE);
4081+ else
4082+ err = mlx5e_hwstamp_config_ptp_rx(priv, ptp_rx);
4083+ if (err)
4084+ goto err_unlock;
40344085
4035− err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx,
4036− &new_params.ptp_rx, true);
4037− if (err) {
4038− mutex_unlock(&priv->state_lock);
4039− return err;
4040− }
4041−out:
40424086 memcpy(&priv->tstamp, &config, sizeof(config));
40434087 mutex_unlock(&priv->state_lock);
40444088
@@ -4047,6 +4091,9 @@ out: · 2 unmodified lines
40474091
40484092 return copy_to_user(ifr->ifr_data, &config,
40494093 sizeof(config)) ? -EFAULT : 0;
4094+err_unlock:
4095+ mutex_unlock(&priv->state_lock);
4096+ return err;
40504097 }
40514098
40524099 int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+9−0
@@ -2015,11 +2015,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 2014 unmodified lines
20152015 misc_parameters_3);
20162016 struct flow_rule *rule = flow_cls_offload_flow_rule(f);
20172017 struct flow_dissector *dissector = rule->match.dissector;
2018+ enum fs_flow_table_type fs_type;
20182019 u16 addr_type = 0;
20192020 u8 ip_proto = 0;
20202021 u8 *match_level;
20212022 int err;
20222023
2024+ fs_type = mlx5e_is_eswitch_flow(flow) ? FS_FT_FDB : FS_FT_NIC_RX;
20232025 match_level = outer_match_level;
20242026
20252027 if (dissector->used_keys &
@@ -2145,6 +2147,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 119 unmodified lines
21452147 if (match.mask->vlan_id ||
21462148 match.mask->vlan_priority ||
21472149 match.mask->vlan_tpid) {
2150+ if (!MLX5_CAP_FLOWTABLE_TYPE(priv->mdev, ft_field_support.outer_second_vid,
2151+ fs_type)) {
2152+ NL_SET_ERR_MSG_MOD(extack,
2153+ "Matching on CVLAN is not supported");
2154+ return -EOPNOTSUPP;
2155+ }
2156+
21482157 if (match.key->vlan_tpid == htons(ETH_P_8021AD)) {
21492158 MLX5_SET(fte_match_set_misc, misc_c,
21502159 outer_second_svlan_tag, 1);
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c+2−1
@@ -219,7 +219,8 @@ esw_setup_slow_path_dest(struct mlx5_flow_destination *dest, · 218 unmodified lines
219219 struct mlx5_fs_chains *chains,
220220 int i)
221221 {
222− flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL;
222+ if (mlx5_chains_ignore_flow_level_supported(chains))
223+ flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL;
223224 dest[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
224225 dest[i].ft = mlx5_chains_get_tc_end_ft(chains);
225226 }
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c+3−0
@@ -349,6 +349,9 @@ static void mlx5_sync_reset_abort_event(struct work_struct *work) · 348 unmodified lines
349349 reset_abort_work);
350350 struct mlx5_core_dev *dev = fw_reset->dev;
351351
352+ if (!test_bit(MLX5_FW_RESET_FLAGS_RESET_REQUESTED, &fw_reset->reset_flags))
353+ return;
354+
352355 mlx5_sync_reset_clear_reset_requested(dev, true);
353356 mlx5_core_warn(dev, "PCI Sync FW Update Reset Aborted.\n");
354357 }
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c+1−1
@@ -107,7 +107,7 @@ bool mlx5_chains_prios_supported(struct mlx5_fs_chains *chains) · 106 unmodified lines
107107 return chains->flags & MLX5_CHAINS_AND_PRIOS_SUPPORTED;
108108 }
109109
110−static bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains)
110+bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains)
111111 {
112112 return chains->flags & MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED;
113113 }
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h+5−0
@@ -28,6 +28,7 @@ struct mlx5_chains_attr { · 27 unmodified lines
2828
2929 bool
3030 mlx5_chains_prios_supported(struct mlx5_fs_chains *chains);
31+bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains);
3132 bool
3233 mlx5_chains_backwards_supported(struct mlx5_fs_chains *chains);
3334 u32
@@ -70,6 +71,10 @@ mlx5_chains_set_end_ft(struct mlx5_fs_chains *chains, · 36 unmodified lines
7071
7172 #else /* CONFIG_MLX5_CLS_ACT */
7273
74+static inline bool
75+mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains)
76+{ return false; }
77+
7378 static inline struct mlx5_flow_table *
7479 mlx5_chains_get_table(struct mlx5_fs_chains *chains, u32 chain, u32 prio,
7580 u32 level) { return ERR_PTR(-EOPNOTSUPP); }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c+2−1
@@ -112,7 +112,8 @@ int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn, · 111 unmodified lines
112112 int ret;
113113
114114 ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB;
115− ft_attr.level = dmn->info.caps.max_ft_level - 2;
115+ ft_attr.level = min_t(int, dmn->info.caps.max_ft_level - 2,
116+ MLX5_FT_MAX_MULTIPATH_LEVEL);
116117 ft_attr.reformat_en = reformat_req;
117118 ft_attr.decap_en = reformat_req;
118119
drivers/net/ethernet/myricom/myri10ge/myri10ge.c+1−0
@@ -3815,6 +3815,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 3814 unmodified lines
38153815 dev_err(&pdev->dev,
38163816 "invalid sram_size %dB or board span %ldB\n",
38173817 mgp->sram_size, mgp->board_span);
3818+ status = -EINVAL;
38183819 goto abort_with_ioremap;
38193820 }
38203821 memcpy_fromio(mgp->eeprom_strings,
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+3−3
@@ -1240,8 +1240,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) · 1239 unmodified lines
12401240 priv->phylink_config.dev = &priv->dev->dev;
12411241 priv->phylink_config.type = PHYLINK_NETDEV;
12421242 priv->phylink_config.pcs_poll = true;
1243− priv->phylink_config.ovr_an_inband =
1244− priv->plat->mdio_bus_data->xpcs_an_inband;
1243+ if (priv->plat->mdio_bus_data)
1244+ priv->phylink_config.ovr_an_inband =
1245+ priv->plat->mdio_bus_data->xpcs_an_inband;
12451246
12461247 if (!fwnode)
12471248 fwnode = dev_fwnode(priv->device);
@@ -7048,7 +7049,6 @@ error_mdio_register: · 5800 unmodified lines
70487049 stmmac_napi_del(ndev);
70497050 error_hw_init:
70507051 destroy_workqueue(priv->wq);
7051− stmmac_bus_clks_config(priv, false);
70527052 bitmap_free(priv->af_xdp_zc_qps);
70537053
70547054 return ret;
drivers/net/ieee802154/mrf24j40.c+2−2
@@ -8,8 +8,8 @@ · 7 unmodified lines
88
99 #include <linux/spi/spi.h>
1010 #include <linux/interrupt.h>
11+#include <linux/mod_devicetable.h>
1112 #include <linux/module.h>
12−#include <linux/of.h>
1313 #include <linux/regmap.h>
1414 #include <linux/ieee802154.h>
1515 #include <linux/irq.h>
@@ -1388,7 +1388,7 @@ MODULE_DEVICE_TABLE(spi, mrf24j40_ids); · 1372 unmodified lines
13881388
13891389 static struct spi_driver mrf24j40_driver = {
13901390 .driver = {
1391− .of_match_table = of_match_ptr(mrf24j40_of_match),
1391+ .of_match_table = mrf24j40_of_match,
13921392 .name = "mrf24j40",
13931393 },
13941394 .id_table = mrf24j40_ids,
drivers/net/virtio_net.c+8−12
@@ -401,18 +401,13 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi, · 400 unmodified lines
401401 /* If headroom is not 0, there is an offset between the beginning of the
402402 * data and the allocated space, otherwise the data and the allocated
403403 * space are aligned.
404+ *
405+ * Buffers with headroom use PAGE_SIZE as alloc size, see
406+ * add_recvbuf_mergeable() + get_mergeable_buf_len()
404407 */
405− if (headroom) {
406− /* Buffers with headroom use PAGE_SIZE as alloc size,
407− * see add_recvbuf_mergeable() + get_mergeable_buf_len()
408− */
409− truesize = PAGE_SIZE;
410− tailroom = truesize - len - offset;
411− buf = page_address(page);
412− } else {
413− tailroom = truesize - len;
414− buf = p;
415− }
408+ truesize = headroom ? PAGE_SIZE : truesize;
409+ tailroom = truesize - len - headroom - (hdr_padded_len - hdr_len);
410+ buf = p - headroom;
416411
417412 len -= hdr_len;
418413 offset += hdr_padded_len;
@@ -958,7 +953,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev, · 539 unmodified lines
958953 put_page(page);
959954 head_skb = page_to_skb(vi, rq, xdp_page, offset,
960955 len, PAGE_SIZE, false,
961− metasize, headroom);
956+ metasize,
957+ VIRTIO_XDP_HEADROOM);
962958 return head_skb;
963959 }
964960 break;
drivers/net/wireguard/Makefile+1−2
@@ -1,5 +1,4 @@
1−ccflags-y := -O3
2−ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt'
1+ccflags-y := -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt'
32 ccflags-$(CONFIG_WIREGUARD_DEBUG) += -DDEBUG
43 wireguard-y := main.o
54 wireguard-y += noise.o
drivers/net/wireguard/allowedips.c+99−90
@@ -6,6 +6,8 @@ · 5 unmodified lines
66 #include "allowedips.h"
77 #include "peer.h"
88
9+static struct kmem_cache *node_cache;
10+
911 static void swap_endian(u8 *dst, const u8 *src, u8 bits)
1012 {
1113 if (bits == 32) {
@@ -28,8 +30,11 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src, · 16 unmodified lines
2830 node->bitlen = bits;
2931 memcpy(node->bits, src, bits / 8U);
3032 }
31−#define CHOOSE_NODE(parent, key) \
32− parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1]
33+
34+static inline u8 choose(struct allowedips_node *node, const u8 *key)
35+{
36+ return (key[node->bit_at_a] >> node->bit_at_b) & 1;
37+}
3338
3439 static void push_rcu(struct allowedips_node **stack,
3540 struct allowedips_node __rcu *p, unsigned int *len)
@@ -40,6 +45,11 @@ static void push_rcu(struct allowedips_node **stack, · 4 unmodified lines
4045 }
4146 }
4247
48+static void node_free_rcu(struct rcu_head *rcu)
49+{
50+ kmem_cache_free(node_cache, container_of(rcu, struct allowedips_node, rcu));
51+}
52+
4353 static void root_free_rcu(struct rcu_head *rcu)
4454 {
4555 struct allowedips_node *node, *stack[128] = {
@@ -49,7 +59,7 @@ static void root_free_rcu(struct rcu_head *rcu) · 3 unmodified lines
4959 while (len > 0 && (node = stack[--len])) {
5060 push_rcu(stack, node->bit[0], &len);
5161 push_rcu(stack, node->bit[1], &len);
52− kfree(node);
62+ kmem_cache_free(node_cache, node);
5363 }
5464 }
5565
@@ -66,60 +76,6 @@ static void root_remove_peer_lists(struct allowedips_node *root) · 10 unmodified lines
6676 }
6777 }
6878
69−static void walk_remove_by_peer(struct allowedips_node __rcu **top,
70− struct wg_peer *peer, struct mutex *lock)
71−{
72−#define REF(p) rcu_access_pointer(p)
73−#define DEREF(p) rcu_dereference_protected(*(p), lockdep_is_held(lock))
74−#define PUSH(p) ({ \
75− WARN_ON(IS_ENABLED(DEBUG) && len >= 128); \
76− stack[len++] = p; \
77− })
78−
79− struct allowedips_node __rcu **stack[128], **nptr;
80− struct allowedips_node *node, *prev;
81− unsigned int len;
82−
83− if (unlikely(!peer || !REF(*top)))
84− return;
85−
86− for (prev = NULL, len = 0, PUSH(top); len > 0; prev = node) {
87− nptr = stack[len - 1];
88− node = DEREF(nptr);
89− if (!node) {
90− --len;
91− continue;
92− }
93− if (!prev || REF(prev->bit[0]) == node ||
94− REF(prev->bit[1]) == node) {
95− if (REF(node->bit[0]))
96− PUSH(&node->bit[0]);
97− else if (REF(node->bit[1]))
98− PUSH(&node->bit[1]);
99− } else if (REF(node->bit[0]) == prev) {
100− if (REF(node->bit[1]))
101− PUSH(&node->bit[1]);
102− } else {
103− if (rcu_dereference_protected(node->peer,
104− lockdep_is_held(lock)) == peer) {
105− RCU_INIT_POINTER(node->peer, NULL);
106− list_del_init(&node->peer_list);
107− if (!node->bit[0] || !node->bit[1]) {
108− rcu_assign_pointer(*nptr, DEREF(
109− &node->bit[!REF(node->bit[0])]));
110− kfree_rcu(node, rcu);
111− node = DEREF(nptr);
112− }
113− }
114− --len;
115− }
116− }
117−
118−#undef REF
119−#undef DEREF
120−#undef PUSH
121−}
122−
12379 static unsigned int fls128(u64 a, u64 b)
12480 {
12581 return a ? fls64(a) + 64U : fls64(b);
@@ -159,7 +115,7 @@ static struct allowedips_node *find_node(struct allowedips_node *trie, u8 bits, · 33 unmodified lines
159115 found = node;
160116 if (node->cidr == bits)
161117 break;
162− node = rcu_dereference_bh(CHOOSE_NODE(node, key));
118+ node = rcu_dereference_bh(node->bit[choose(node, key)]);
163119 }
164120 return found;
165121 }
@@ -191,8 +147,7 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, · 25 unmodified lines
191147 u8 cidr, u8 bits, struct allowedips_node **rnode,
192148 struct mutex *lock)
193149 {
194− struct allowedips_node *node = rcu_dereference_protected(trie,
195− lockdep_is_held(lock));
150+ struct allowedips_node *node = rcu_dereference_protected(trie, lockdep_is_held(lock));
196151 struct allowedips_node *parent = NULL;
197152 bool exact = false;
198153
@@ -202,13 +157,24 @@ static bool node_placement(struct allowedips_node __rcu *trie, const u8 *key, · 3 unmodified lines
202157 exact = true;
203158 break;
204159 }
205− node = rcu_dereference_protected(CHOOSE_NODE(parent, key),
206− lockdep_is_held(lock));
160+ node = rcu_dereference_protected(parent->bit[choose(parent, key)], lockdep_is_held(lock));
207161 }
208162 *rnode = parent;
209163 return exact;
210164 }
211165
166+static inline void connect_node(struct allowedips_node **parent, u8 bit, struct allowedips_node *node)
167+{
168+ node->parent_bit_packed = (unsigned long)parent | bit;
169+ rcu_assign_pointer(*parent, node);
170+}
171+
172+static inline void choose_and_connect_node(struct allowedips_node *parent, struct allowedips_node *node)
173+{
174+ u8 bit = choose(parent, node->bits);
175+ connect_node(&parent->bit[bit], bit, node);
176+}
177+
212178 static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key,
213179 u8 cidr, struct wg_peer *peer, struct mutex *lock)
214180 {
@@ -218,13 +184,13 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 3 unmodified lines
218184 return -EINVAL;
219185
220186 if (!rcu_access_pointer(*trie)) {
221− node = kzalloc(sizeof(*node), GFP_KERNEL);
187+ node = kmem_cache_zalloc(node_cache, GFP_KERNEL);
222188 if (unlikely(!node))
223189 return -ENOMEM;
224190 RCU_INIT_POINTER(node->peer, peer);
225191 list_add_tail(&node->peer_list, &peer->allowedips_list);
226192 copy_and_assign_cidr(node, key, cidr, bits);
227− rcu_assign_pointer(*trie, node);
193+ connect_node(trie, 2, node);
228194 return 0;
229195 }
230196 if (node_placement(*trie, key, cidr, bits, &node, lock)) {
@@ -233,7 +199,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 2 unmodified lines
233199 return 0;
234200 }
235201
236− newnode = kzalloc(sizeof(*newnode), GFP_KERNEL);
202+ newnode = kmem_cache_zalloc(node_cache, GFP_KERNEL);
237203 if (unlikely(!newnode))
238204 return -ENOMEM;
239205 RCU_INIT_POINTER(newnode->peer, peer);
@@ -243,10 +209,10 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 3 unmodified lines
243209 if (!node) {
244210 down = rcu_dereference_protected(*trie, lockdep_is_held(lock));
245211 } else {
246− down = rcu_dereference_protected(CHOOSE_NODE(node, key),
247− lockdep_is_held(lock));
212+ const u8 bit = choose(node, key);
213+ down = rcu_dereference_protected(node->bit[bit], lockdep_is_held(lock));
248214 if (!down) {
249− rcu_assign_pointer(CHOOSE_NODE(node, key), newnode);
215+ connect_node(&node->bit[bit], bit, newnode);
250216 return 0;
251217 }
252218 }
@@ -254,30 +220,29 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *key, · 1 unmodified line
254220 parent = node;
255221
256222 if (newnode->cidr == cidr) {
257− rcu_assign_pointer(CHOOSE_NODE(newnode, down->bits), down);
223+ choose_and_connect_node(newnode, down);
258224 if (!parent)
259− rcu_assign_pointer(*trie, newnode);
225+ connect_node(trie, 2, newnode);
260226 else
261− rcu_assign_pointer(CHOOSE_NODE(parent, newnode->bits),
262− newnode);
263− } else {
264− node = kzalloc(sizeof(*node), GFP_KERNEL);
265− if (unlikely(!node)) {
266− list_del(&newnode->peer_list);
267− kfree(newnode);
268− return -ENOMEM;
269− }
270− INIT_LIST_HEAD(&node->peer_list);
271− copy_and_assign_cidr(node, newnode->bits, cidr, bits);
227+ choose_and_connect_node(parent, newnode);
228+ return 0;
229+ }
272230
273− rcu_assign_pointer(CHOOSE_NODE(node, down->bits), down);
274− rcu_assign_pointer(CHOOSE_NODE(node, newnode->bits), newnode);
275− if (!parent)
276− rcu_assign_pointer(*trie, node);
277− else
278− rcu_assign_pointer(CHOOSE_NODE(parent, node->bits),
279− node);
231+ node = kmem_cache_zalloc(node_cache, GFP_KERNEL);
232+ if (unlikely(!node)) {
233+ list_del(&newnode->peer_list);
234+ kmem_cache_free(node_cache, newnode);
235+ return -ENOMEM;
280236 }
237+ INIT_LIST_HEAD(&node->peer_list);
238+ copy_and_assign_cidr(node, newnode->bits, cidr, bits);
239+
240+ choose_and_connect_node(node, down);
241+ choose_and_connect_node(node, newnode);
242+ if (!parent)
243+ connect_node(trie, 2, node);
244+ else
245+ choose_and_connect_node(parent, node);
281246 return 0;
282247 }
283248
@@ -335,9 +300,41 @@ int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip, · 51 unmodified lines
335300 void wg_allowedips_remove_by_peer(struct allowedips *table,
336301 struct wg_peer *peer, struct mutex *lock)
337302 {
303+ struct allowedips_node *node, *child, **parent_bit, *parent, *tmp;
304+ bool free_parent;
305+
306+ if (list_empty(&peer->allowedips_list))
307+ return;
338308 ++table->seq;
339− walk_remove_by_peer(&table->root4, peer, lock);
340− walk_remove_by_peer(&table->root6, peer, lock);
309+ list_for_each_entry_safe(node, tmp, &peer->allowedips_list, peer_list) {
310+ list_del_init(&node->peer_list);
311+ RCU_INIT_POINTER(node->peer, NULL);
312+ if (node->bit[0] && node->bit[1])
313+ continue;
314+ child = rcu_dereference_protected(node->bit[!rcu_access_pointer(node->bit[0])],
315+ lockdep_is_held(lock));
316+ if (child)
317+ child->parent_bit_packed = node->parent_bit_packed;
318+ parent_bit = (struct allowedips_node **)(node->parent_bit_packed & ~3UL);
319+ *parent_bit = child;
320+ parent = (void *)parent_bit -
321+ offsetof(struct allowedips_node, bit[node->parent_bit_packed & 1]);
322+ free_parent = !rcu_access_pointer(node->bit[0]) &&
323+ !rcu_access_pointer(node->bit[1]) &&
324+ (node->parent_bit_packed & 3) <= 1 &&
325+ !rcu_access_pointer(parent->peer);
326+ if (free_parent)
327+ child = rcu_dereference_protected(
328+ parent->bit[!(node->parent_bit_packed & 1)],
329+ lockdep_is_held(lock));
330+ call_rcu(&node->rcu, node_free_rcu);
331+ if (!free_parent)
332+ continue;
333+ if (child)
334+ child->parent_bit_packed = parent->parent_bit_packed;
335+ *(struct allowedips_node **)(parent->parent_bit_packed & ~3UL) = child;
336+ call_rcu(&parent->rcu, node_free_rcu);
337+ }
341338 }
342339
343340 int wg_allowedips_read_node(struct allowedips_node *node, u8 ip[16], u8 *cidr)
@@ -374,4 +371,16 @@ struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, · 30 unmodified lines
374371 return NULL;
375372 }
376373
374+int __init wg_allowedips_slab_init(void)
375+{
376+ node_cache = KMEM_CACHE(allowedips_node, 0);
377+ return node_cache ? 0 : -ENOMEM;
378+}
379+
380+void wg_allowedips_slab_uninit(void)
381+{
382+ rcu_barrier();
383+ kmem_cache_destroy(node_cache);
384+}
385+
377386 #include "selftest/allowedips.c"
drivers/net/wireguard/allowedips.h+7−7
@@ -15,14 +15,11 @@ struct wg_peer; · 14 unmodified lines
1515 struct allowedips_node {
1616 struct wg_peer __rcu *peer;
1717 struct allowedips_node __rcu *bit[2];
18− /* While it may seem scandalous that we waste space for v4,
19− * we're alloc'ing to the nearest power of 2 anyway, so this
20− * doesn't actually make a difference.
21− */
22− u8 bits[16] __aligned(__alignof(u64));
2318 u8 cidr, bit_at_a, bit_at_b, bitlen;
19+ u8 bits[16] __aligned(__alignof(u64));
2420
25− /* Keep rarely used list at bottom to be beyond cache line. */
21+ /* Keep rarely used members at bottom to be beyond cache line. */
22+ unsigned long parent_bit_packed;
2623 union {
2724 struct list_head peer_list;
2825 struct rcu_head rcu;
@@ -33,7 +30,7 @@ struct allowedips { · 4 unmodified lines
3330 struct allowedips_node __rcu *root4;
3431 struct allowedips_node __rcu *root6;
3532 u64 seq;
36−};
33+} __aligned(4); /* We pack the lower 2 bits of &root, but m68k only gives 16-bit alignment. */
3734
3835 void wg_allowedips_init(struct allowedips *table);
3936 void wg_allowedips_free(struct allowedips *table, struct mutex *mutex);
@@ -56,4 +53,7 @@ struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table, · 16 unmodified lines
5653 bool wg_allowedips_selftest(void);
5754 #endif
5855
56+int wg_allowedips_slab_init(void);
57+void wg_allowedips_slab_uninit(void);
58+
5959 #endif /* _WG_ALLOWEDIPS_H */
drivers/net/wireguard/main.c+16−1
@@ -21,13 +21,22 @@ static int __init mod_init(void) · 20 unmodified lines
2121 {
2222 int ret;
2323
24+ ret = wg_allowedips_slab_init();
25+ if (ret < 0)
26+ goto err_allowedips;
27+
2428 #ifdef DEBUG
29+ ret = -ENOTRECOVERABLE;
2530 if (!wg_allowedips_selftest() || !wg_packet_counter_selftest() ||
2631 !wg_ratelimiter_selftest())
27− return -ENOTRECOVERABLE;
32+ goto err_peer;
2833 #endif
2934 wg_noise_init();
3035
36+ ret = wg_peer_init();
37+ if (ret < 0)
38+ goto err_peer;
39+
3140 ret = wg_device_init();
3241 if (ret < 0)
3342 goto err_device;
@@ -44,6 +53,10 @@ static int __init mod_init(void) · 10 unmodified lines
4453 err_netlink:
4554 wg_device_uninit();
4655 err_device:
56+ wg_peer_uninit();
57+err_peer:
58+ wg_allowedips_slab_uninit();
59+err_allowedips:
4760 return ret;
4861 }
4962
@@ -51,6 +64,8 @@ static void __exit mod_exit(void) · 1 unmodified line
5164 {
5265 wg_genetlink_uninit();
5366 wg_device_uninit();
67+ wg_peer_uninit();
68+ wg_allowedips_slab_uninit();
5469 }
5570
5671 module_init(mod_init);
drivers/net/wireguard/peer.c+20−7
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/rcupdate.h>
1616 #include <linux/list.h>
1717
18+static struct kmem_cache *peer_cache;
1819 static atomic64_t peer_counter = ATOMIC64_INIT(0);
1920
2021 struct wg_peer *wg_peer_create(struct wg_device *wg,
@@ -29,10 +30,10 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, · 8 unmodified lines
2930 if (wg->num_peers >= MAX_PEERS_PER_DEVICE)
3031 return ERR_PTR(ret);
3132
32− peer = kzalloc(sizeof(*peer), GFP_KERNEL);
33+ peer = kmem_cache_zalloc(peer_cache, GFP_KERNEL);
3334 if (unlikely(!peer))
3435 return ERR_PTR(ret);
35− if (dst_cache_init(&peer->endpoint_cache, GFP_KERNEL))
36+ if (unlikely(dst_cache_init(&peer->endpoint_cache, GFP_KERNEL)))
3637 goto err;
3738
3839 peer->device = wg;
@@ -64,7 +65,7 @@ struct wg_peer *wg_peer_create(struct wg_device *wg, · 25 unmodified lines
6465 return peer;
6566
6667 err:
67− kfree(peer);
68+ kmem_cache_free(peer_cache, peer);
6869 return ERR_PTR(ret);
6970 }
7071
@@ -88,7 +89,7 @@ static void peer_make_dead(struct wg_peer *peer) · 17 unmodified lines
8889 /* Mark as dead, so that we don't allow jumping contexts after. */
8990 WRITE_ONCE(peer->is_dead, true);
9091
91− /* The caller must now synchronize_rcu() for this to take effect. */
92+ /* The caller must now synchronize_net() for this to take effect. */
9293 }
9394
9495 static void peer_remove_after_dead(struct wg_peer *peer)
@@ -160,7 +161,7 @@ void wg_peer_remove(struct wg_peer *peer) · 65 unmodified lines
160161 lockdep_assert_held(&peer->device->device_update_lock);
161162
162163 peer_make_dead(peer);
163− synchronize_rcu();
164+ synchronize_net();
164165 peer_remove_after_dead(peer);
165166 }
166167
@@ -178,7 +179,7 @@ void wg_peer_remove_all(struct wg_device *wg) · 11 unmodified lines
178179 peer_make_dead(peer);
179180 list_add_tail(&peer->peer_list, &dead_peers);
180181 }
181− synchronize_rcu();
182+ synchronize_net();
182183 list_for_each_entry_safe(peer, temp, &dead_peers, peer_list)
183184 peer_remove_after_dead(peer);
184185 }
@@ -193,7 +194,8 @@ static void rcu_release(struct rcu_head *rcu) · 8 unmodified lines
193194 /* The final zeroing takes care of clearing any remaining handshake key
194195 * material and other potentially sensitive information.
195196 */
196− kfree_sensitive(peer);
197+ memzero_explicit(peer, sizeof(*peer));
198+ kmem_cache_free(peer_cache, peer);
197199 }
198200
199201 static void kref_release(struct kref *refcount)
@@ -225,3 +227,14 @@ void wg_peer_put(struct wg_peer *peer) · 25 unmodified lines
225227 return;
226228 kref_put(&peer->refcount, kref_release);
227229 }
230+
231+int __init wg_peer_init(void)
232+{
233+ peer_cache = KMEM_CACHE(wg_peer, 0);
234+ return peer_cache ? 0 : -ENOMEM;
235+}
236+
237+void wg_peer_uninit(void)
238+{
239+ kmem_cache_destroy(peer_cache);
240+}
drivers/net/wireguard/peer.h+3−0
@@ -80,4 +80,7 @@ void wg_peer_put(struct wg_peer *peer); · 79 unmodified lines
8080 void wg_peer_remove(struct wg_peer *peer);
8181 void wg_peer_remove_all(struct wg_device *wg);
8282
83+int wg_peer_init(void);
84+void wg_peer_uninit(void);
85+
8386 #endif /* _WG_PEER_H */
drivers/net/wireguard/selftest/allowedips.c+79−86
@@ -19,32 +19,22 @@ · 18 unmodified lines
1919
2020 #include <linux/siphash.h>
2121
22−static __init void swap_endian_and_apply_cidr(u8 *dst, const u8 *src, u8 bits,
23− u8 cidr)
24−{
25− swap_endian(dst, src, bits);
26− memset(dst + (cidr + 7) / 8, 0, bits / 8 - (cidr + 7) / 8);
27− if (cidr)
28− dst[(cidr + 7) / 8 - 1] &= ~0U << ((8 - (cidr % 8)) % 8);
29−}
30−
3122 static __init void print_node(struct allowedips_node *node, u8 bits)
3223 {
3324 char *fmt_connection = KERN_DEBUG "\t\"%p/%d\" -> \"%p/%d\";\n";
34− char *fmt_declaration = KERN_DEBUG
35− "\t\"%p/%d\"[style=%s, color=\"#%06x\"];\n";
25+ char *fmt_declaration = KERN_DEBUG "\t\"%p/%d\"[style=%s, color=\"#%06x\"];\n";
26+ u8 ip1[16], ip2[16], cidr1, cidr2;
3627 char *style = "dotted";
37− u8 ip1[16], ip2[16];
3828 u32 color = 0;
3929
30+ if (node == NULL)
31+ return;
4032 if (bits == 32) {
4133 fmt_connection = KERN_DEBUG "\t\"%pI4/%d\" -> \"%pI4/%d\";\n";
42− fmt_declaration = KERN_DEBUG
43− "\t\"%pI4/%d\"[style=%s, color=\"#%06x\"];\n";
34+ fmt_declaration = KERN_DEBUG "\t\"%pI4/%d\"[style=%s, color=\"#%06x\"];\n";
4435 } else if (bits == 128) {
4536 fmt_connection = KERN_DEBUG "\t\"%pI6/%d\" -> \"%pI6/%d\";\n";
46− fmt_declaration = KERN_DEBUG
47− "\t\"%pI6/%d\"[style=%s, color=\"#%06x\"];\n";
37+ fmt_declaration = KERN_DEBUG "\t\"%pI6/%d\"[style=%s, color=\"#%06x\"];\n";
4838 }
4939 if (node->peer) {
5040 hsiphash_key_t key = { { 0 } };
@@ -55,24 +45,20 @@ static __init void print_node(struct allowedips_node *node, u8 bits) · 4 unmodified lines
5545 hsiphash_1u32(0xabad1dea, &key) % 200;
5646 style = "bold";
5747 }
58− swap_endian_and_apply_cidr(ip1, node->bits, bits, node->cidr);
59− printk(fmt_declaration, ip1, node->cidr, style, color);
48+ wg_allowedips_read_node(node, ip1, &cidr1);
49+ printk(fmt_declaration, ip1, cidr1, style, color);
6050 if (node->bit[0]) {
61− swap_endian_and_apply_cidr(ip2,
62− rcu_dereference_raw(node->bit[0])->bits, bits,
63− node->cidr);
64− printk(fmt_connection, ip1, node->cidr, ip2,
65− rcu_dereference_raw(node->bit[0])->cidr);
66− print_node(rcu_dereference_raw(node->bit[0]), bits);
51+ wg_allowedips_read_node(rcu_dereference_raw(node->bit[0]), ip2, &cidr2);
52+ printk(fmt_connection, ip1, cidr1, ip2, cidr2);
6753 }
6854 if (node->bit[1]) {
69− swap_endian_and_apply_cidr(ip2,
70− rcu_dereference_raw(node->bit[1])->bits,
71− bits, node->cidr);
72− printk(fmt_connection, ip1, node->cidr, ip2,
73− rcu_dereference_raw(node->bit[1])->cidr);
74− print_node(rcu_dereference_raw(node->bit[1]), bits);
55+ wg_allowedips_read_node(rcu_dereference_raw(node->bit[1]), ip2, &cidr2);
56+ printk(fmt_connection, ip1, cidr1, ip2, cidr2);
7557 }
58+ if (node->bit[0])
59+ print_node(rcu_dereference_raw(node->bit[0]), bits);
60+ if (node->bit[1])
61+ print_node(rcu_dereference_raw(node->bit[1]), bits);
7662 }
7763
7864 static __init void print_tree(struct allowedips_node __rcu *top, u8 bits)
@@ -121,8 +107,8 @@ static __init inline union nf_inet_addr horrible_cidr_to_mask(u8 cidr) · 42 unmodified lines
121107 {
122108 union nf_inet_addr mask;
123109
124− memset(&mask, 0x00, 128 / 8);
125− memset(&mask, 0xff, cidr / 8);
110+ memset(&mask, 0, sizeof(mask));
111+ memset(&mask.all, 0xff, cidr / 8);
126112 if (cidr % 32)
127113 mask.all[cidr / 32] = (__force u32)htonl(
128114 (0xFFFFFFFFUL << (32 - (cidr % 32))) & 0xFFFFFFFFUL);
@@ -149,42 +135,36 @@ horrible_mask_self(struct horrible_allowedips_node *node) · 20 unmodified lines
149135 }
150136
151137 static __init inline bool
152−horrible_match_v4(const struct horrible_allowedips_node *node,
153− struct in_addr *ip)
138+horrible_match_v4(const struct horrible_allowedips_node *node, struct in_addr *ip)
154139 {
155140 return (ip->s_addr & node->mask.ip) == node->ip.ip;
156141 }
157142
158143 static __init inline bool
159−horrible_match_v6(const struct horrible_allowedips_node *node,
160− struct in6_addr *ip)
144+horrible_match_v6(const struct horrible_allowedips_node *node, struct in6_addr *ip)
161145 {
162− return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) ==
163− node->ip.ip6[0] &&
164− (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) ==
165− node->ip.ip6[1] &&
166− (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) ==
167− node->ip.ip6[2] &&
146+ return (ip->in6_u.u6_addr32[0] & node->mask.ip6[0]) == node->ip.ip6[0] &&
147+ (ip->in6_u.u6_addr32[1] & node->mask.ip6[1]) == node->ip.ip6[1] &&
148+ (ip->in6_u.u6_addr32[2] & node->mask.ip6[2]) == node->ip.ip6[2] &&
168149 (ip->in6_u.u6_addr32[3] & node->mask.ip6[3]) == node->ip.ip6[3];
169150 }
170151
171152 static __init void
172−horrible_insert_ordered(struct horrible_allowedips *table,
173− struct horrible_allowedips_node *node)
153+horrible_insert_ordered(struct horrible_allowedips *table, struct horrible_allowedips_node *node)
174154 {
175155 struct horrible_allowedips_node *other = NULL, *where = NULL;
176156 u8 my_cidr = horrible_mask_to_cidr(node->mask);
177157
178158 hlist_for_each_entry(other, &table->head, table) {
179− if (!memcmp(&other->mask, &node->mask,
180− sizeof(union nf_inet_addr)) &&
181− !memcmp(&other->ip, &node->ip,
182− sizeof(union nf_inet_addr)) &&
183− other->ip_version == node->ip_version) {
159+ if (other->ip_version == node->ip_version &&
160+ !memcmp(&other->mask, &node->mask, sizeof(union nf_inet_addr)) &&
161+ !memcmp(&other->ip, &node->ip, sizeof(union nf_inet_addr))) {
184162 other->value = node->value;
185163 kfree(node);
186164 return;
187165 }
166+ }
167+ hlist_for_each_entry(other, &table->head, table) {
188168 where = other;
189169 if (horrible_mask_to_cidr(other->mask) <= my_cidr)
190170 break;
@@ -201,8 +181,7 @@ static __init int · 10 unmodified lines
201181 horrible_allowedips_insert_v4(struct horrible_allowedips *table,
202182 struct in_addr *ip, u8 cidr, void *value)
203183 {
204− struct horrible_allowedips_node *node = kzalloc(sizeof(*node),
205− GFP_KERNEL);
184+ struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL);
206185
207186 if (unlikely(!node))
208187 return -ENOMEM;
@@ -219,8 +198,7 @@ static __init int · 10 unmodified lines
219198 horrible_allowedips_insert_v6(struct horrible_allowedips *table,
220199 struct in6_addr *ip, u8 cidr, void *value)
221200 {
222− struct horrible_allowedips_node *node = kzalloc(sizeof(*node),
223− GFP_KERNEL);
201+ struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL);
224202
225203 if (unlikely(!node))
226204 return -ENOMEM;
@@ -234,39 +212,43 @@ horrible_allowedips_insert_v6(struct horrible_allowedips *table, · 7 unmodified lines
234212 }
235213
236214 static __init void *
237−horrible_allowedips_lookup_v4(struct horrible_allowedips *table,
238− struct in_addr *ip)
215+horrible_allowedips_lookup_v4(struct horrible_allowedips *table, struct in_addr *ip)
239216 {
240217 struct horrible_allowedips_node *node;
241− void *ret = NULL;
242218
243219 hlist_for_each_entry(node, &table->head, table) {
244− if (node->ip_version != 4)
245− continue;
246− if (horrible_match_v4(node, ip)) {
247− ret = node->value;
248− break;
249− }
220+ if (node->ip_version == 4 && horrible_match_v4(node, ip))
221+ return node->value;
250222 }
251− return ret;
223+ return NULL;
252224 }
253225
254226 static __init void *
255−horrible_allowedips_lookup_v6(struct horrible_allowedips *table,
256− struct in6_addr *ip)
227+horrible_allowedips_lookup_v6(struct horrible_allowedips *table, struct in6_addr *ip)
257228 {
258229 struct horrible_allowedips_node *node;
259− void *ret = NULL;
260230
261231 hlist_for_each_entry(node, &table->head, table) {
262− if (node->ip_version != 6)
232+ if (node->ip_version == 6 && horrible_match_v6(node, ip))
233+ return node->value;
234+ }
235+ return NULL;
236+}
237+
238+
239+static __init void
240+horrible_allowedips_remove_by_value(struct horrible_allowedips *table, void *value)
241+{
242+ struct horrible_allowedips_node *node;
243+ struct hlist_node *h;
244+
245+ hlist_for_each_entry_safe(node, h, &table->head, table) {
246+ if (node->value != value)
263247 continue;
264− if (horrible_match_v6(node, ip)) {
265− ret = node->value;
266− break;
267− }
248+ hlist_del(&node->table);
249+ kfree(node);
268250 }
269− return ret;
251+
270252 }
271253
272254 static __init bool randomized_test(void)
@@ -296,6 +278,7 @@ static __init bool randomized_test(void) · 23 unmodified lines
296278 goto free;
297279 }
298280 kref_init(&peers[i]->refcount);
281+ INIT_LIST_HEAD(&peers[i]->allowedips_list);
299282 }
300283
301284 mutex_lock(&mutex);
@@ -333,7 +316,7 @@ static __init bool randomized_test(void) · 31 unmodified lines
333316 if (wg_allowedips_insert_v4(&t,
334317 (struct in_addr *)mutated,
335318 cidr, peer, &mutex) < 0) {
336− pr_err("allowedips random malloc: FAIL\n");
319+ pr_err("allowedips random self-test malloc: FAIL\n");
337320 goto free_locked;
338321 }
339322 if (horrible_allowedips_insert_v4(&h,
@@ -396,23 +379,33 @@ static __init bool randomized_test(void) · 56 unmodified lines
396379 print_tree(t.root6, 128);
397380 }
398381
399− for (i = 0; i < NUM_QUERIES; ++i) {
400− prandom_bytes(ip, 4);
401− if (lookup(t.root4, 32, ip) !=
402− horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) {
403− pr_err("allowedips random self-test: FAIL\n");
404− goto free;
382+ for (j = 0;; ++j) {
383+ for (i = 0; i < NUM_QUERIES; ++i) {
384+ prandom_bytes(ip, 4);
385+ if (lookup(t.root4, 32, ip) != horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip)) {
386+ horrible_allowedips_lookup_v4(&h, (struct in_addr *)ip);
387+ pr_err("allowedips random v4 self-test: FAIL\n");
388+ goto free;
389+ }
390+ prandom_bytes(ip, 16);
391+ if (lookup(t.root6, 128, ip) != horrible_allowedips_lookup_v6(&h, (struct in6_addr *)ip)) {
392+ pr_err("allowedips random v6 self-test: FAIL\n");
393+ goto free;
394+ }
405395 }
396+ if (j >= NUM_PEERS)
397+ break;
398+ mutex_lock(&mutex);
399+ wg_allowedips_remove_by_peer(&t, peers[j], &mutex);
400+ mutex_unlock(&mutex);
401+ horrible_allowedips_remove_by_value(&h, peers[j]);
406402 }
407403
408− for (i = 0; i < NUM_QUERIES; ++i) {
409− prandom_bytes(ip, 16);
410− if (lookup(t.root6, 128, ip) !=
411− horrible_allowedips_lookup_v6(&h, (struct in6_addr *)ip)) {
412− pr_err("allowedips random self-test: FAIL\n");
413− goto free;
414− }
404+ if (t.root4 || t.root6) {
405+ pr_err("allowedips random self-test removal: FAIL\n");
406+ goto free;
415407 }
408+
416409 ret = true;
417410
418411 free:
drivers/net/wireguard/socket.c+1−1
@@ -430,7 +430,7 @@ void wg_socket_reinit(struct wg_device *wg, struct sock *new4, · 429 unmodified lines
430430 if (new4)
431431 wg->incoming_port = ntohs(inet_sk(new4)->inet_sport);
432432 mutex_unlock(&wg->socket_update_lock);
433− synchronize_rcu();
433+ synchronize_net();
434434 sock_free(old4);
435435 sock_free(old6);
436436 }
drivers/net/wireless/mediatek/mt76/mac80211.c+26−0
@@ -514,10 +514,36 @@ EXPORT_SYMBOL_GPL(mt76_free_device); · 513 unmodified lines
514514 static void mt76_rx_release_amsdu(struct mt76_phy *phy, enum mt76_rxq_id q)
515515 {
516516 struct sk_buff *skb = phy->rx_amsdu[q].head;
517+ struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
517518 struct mt76_dev *dev = phy->dev;
518519
519520 phy->rx_amsdu[q].head = NULL;
520521 phy->rx_amsdu[q].tail = NULL;
522+
523+ /*
524+ * Validate if the amsdu has a proper first subframe.
525+ * A single MSDU can be parsed as A-MSDU when the unauthenticated A-MSDU
526+ * flag of the QoS header gets flipped. In such cases, the first
527+ * subframe has a LLC/SNAP header in the location of the destination
528+ * address.
529+ */
530+ if (skb_shinfo(skb)->frag_list) {
531+ int offset = 0;
532+
533+ if (!(status->flag & RX_FLAG_8023)) {
534+ offset = ieee80211_get_hdrlen_from_skb(skb);
535+
536+ if ((status->flag &
537+ (RX_FLAG_DECRYPTED | RX_FLAG_IV_STRIPPED)) ==
538+ RX_FLAG_DECRYPTED)
539+ offset += 8;
540+ }
541+
542+ if (ether_addr_equal(skb->data + offset, rfc1042_header)) {
543+ dev_kfree_skb(skb);
544+ return;
545+ }
546+ }
521547 __skb_queue_tail(&dev->rx_skb[q], skb);
522548 }
523549
drivers/net/wireless/mediatek/mt76/mt7615/init.c+0−1
@@ -510,7 +510,6 @@ void mt7615_init_device(struct mt7615_dev *dev) · 509 unmodified lines
510510 mutex_init(&dev->pm.mutex);
511511 init_waitqueue_head(&dev->pm.wait);
512512 spin_lock_init(&dev->pm.txq_lock);
513− set_bit(MT76_STATE_PM, &dev->mphy.state);
514513 INIT_DELAYED_WORK(&dev->mphy.mac_work, mt7615_mac_work);
515514 INIT_DELAYED_WORK(&dev->phy.scan_work, mt7615_scan_work);
516515 INIT_DELAYED_WORK(&dev->coredump.work, mt7615_coredump_work);
drivers/net/wireless/mediatek/mt76/mt7615/mac.c+3−2
@@ -1912,8 +1912,9 @@ void mt7615_pm_wake_work(struct work_struct *work) · 1911 unmodified lines
19121912 napi_schedule(&dev->mt76.napi[i]);
19131913 mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
19141914 mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], false);
1915− ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
1916− MT7615_WATCHDOG_TIME);
1915+ if (test_bit(MT76_STATE_RUNNING, &mphy->state))
1916+ ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
1917+ MT7615_WATCHDOG_TIME);
19171918 }
19181919
19191920 ieee80211_wake_queues(mphy->hw);
drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c+12−7
@@ -51,16 +51,13 @@ mt7663s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb, · 50 unmodified lines
5151 return ret;
5252 }
5353
54−static int mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev)
54+static int __mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev)
5555 {
5656 struct sdio_func *func = dev->mt76.sdio.func;
5757 struct mt76_phy *mphy = &dev->mt76.phy;
5858 u32 status;
5959 int ret;
6060
61− if (!test_and_clear_bit(MT76_STATE_PM, &mphy->state))
62− goto out;
63−
6461 sdio_claim_host(func);
6562
6663 sdio_writel(func, WHLPCR_FW_OWN_REQ_CLR, MCR_WHLPCR, NULL);
@@ -76,13 +73,21 @@ static int mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev) · 9 unmodified lines
7673 }
7774
7875 sdio_release_host(func);
79−
80−out:
8176 dev->pm.last_activity = jiffies;
8277
8378 return 0;
8479 }
8580
81+static int mt7663s_mcu_drv_pmctrl(struct mt7615_dev *dev)
82+{
83+ struct mt76_phy *mphy = &dev->mt76.phy;
84+
85+ if (test_and_clear_bit(MT76_STATE_PM, &mphy->state))
86+ return __mt7663s_mcu_drv_pmctrl(dev);
87+
88+ return 0;
89+}
90+
8691 static int mt7663s_mcu_fw_pmctrl(struct mt7615_dev *dev)
8792 {
8893 struct sdio_func *func = dev->mt76.sdio.func;
@@ -123,7 +128,7 @@ int mt7663s_mcu_init(struct mt7615_dev *dev) · 34 unmodified lines
123128 struct mt7615_mcu_ops *mcu_ops;
124129 int ret;
125130
126− ret = mt7663s_mcu_drv_pmctrl(dev);
131+ ret = __mt7663s_mcu_drv_pmctrl(dev);
127132 if (ret)
128133 return ret;
129134
drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c+0−3
@@ -55,10 +55,7 @@ int mt7663u_mcu_init(struct mt7615_dev *dev) · 54 unmodified lines
5555
5656 dev->mt76.mcu_ops = &mt7663u_mcu_ops,
5757
58− /* usb does not support runtime-pm */
59− clear_bit(MT76_STATE_PM, &dev->mphy.state);
6058 mt76_set(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN);
61−
6259 if (test_and_clear_bit(MT76_STATE_POWER_OFF, &dev->mphy.state)) {
6360 mt7615_mcu_restart(&dev->mt76);
6461 if (!mt76_poll_msec(dev, MT_CONN_ON_MISC,
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c+4−0
@@ -721,6 +721,10 @@ void mt76_connac_mcu_sta_tlv(struct mt76_phy *mphy, struct sk_buff *skb, · 720 unmodified lines
721721 phy->phy_type = mt76_connac_get_phy_mode_v2(mphy, vif, band, sta);
722722 phy->basic_rate = cpu_to_le16((u16)vif->bss_conf.basic_rates);
723723 phy->rcpi = rcpi;
724+ phy->ampdu = FIELD_PREP(IEEE80211_HT_AMPDU_PARM_FACTOR,
725+ sta->ht_cap.ampdu_factor) |
726+ FIELD_PREP(IEEE80211_HT_AMPDU_PARM_DENSITY,
727+ sta->ht_cap.ampdu_density);
724728
725729 tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_RA, sizeof(*ra_info));
726730 ra_info = (struct sta_rec_ra_info *)tlv;
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c+77−4
@@ -87,7 +87,7 @@ static const struct ieee80211_ops mt76x0e_ops = { · 86 unmodified lines
8787 .reconfig_complete = mt76x02_reconfig_complete,
8888 };
8989
90−static int mt76x0e_register_device(struct mt76x02_dev *dev)
90+static int mt76x0e_init_hardware(struct mt76x02_dev *dev, bool resume)
9191 {
9292 int err;
9393
@@ -100,9 +100,11 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev) · 6 unmodified lines
100100 if (err < 0)
101101 return err;
102102
103− err = mt76x02_dma_init(dev);
104− if (err < 0)
105− return err;
103+ if (!resume) {
104+ err = mt76x02_dma_init(dev);
105+ if (err < 0)
106+ return err;
107+ }
106108
107109 err = mt76x0_init_hardware(dev);
108110 if (err < 0)
@@ -123,6 +125,17 @@ static int mt76x0e_register_device(struct mt76x02_dev *dev) · 14 unmodified lines
123125 mt76_clear(dev, 0x110, BIT(9));
124126 mt76_set(dev, MT_MAX_LEN_CFG, BIT(13));
125127
128+ return 0;
129+}
130+
131+static int mt76x0e_register_device(struct mt76x02_dev *dev)
132+{
133+ int err;
134+
135+ err = mt76x0e_init_hardware(dev, false);
136+ if (err < 0)
137+ return err;
138+
126139 err = mt76x0_register_device(dev);
127140 if (err < 0)
128141 return err;
@@ -167,6 +180,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 38 unmodified lines
167180 if (ret)
168181 return ret;
169182
183+ mt76_pci_disable_aspm(pdev);
184+
170185 mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x0e_ops,
171186 &drv_ops);
172187 if (!mdev)
@@ -220,6 +235,60 @@ mt76x0e_remove(struct pci_dev *pdev) · 47 unmodified lines
220235 mt76_free_device(mdev);
221236 }
222237
238+#ifdef CONFIG_PM
239+static int mt76x0e_suspend(struct pci_dev *pdev, pm_message_t state)
240+{
241+ struct mt76_dev *mdev = pci_get_drvdata(pdev);
242+ struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
243+ int i;
244+
245+ mt76_worker_disable(&mdev->tx_worker);
246+ for (i = 0; i < ARRAY_SIZE(mdev->phy.q_tx); i++)
247+ mt76_queue_tx_cleanup(dev, mdev->phy.q_tx[i], true);
248+ for (i = 0; i < ARRAY_SIZE(mdev->q_mcu); i++)
249+ mt76_queue_tx_cleanup(dev, mdev->q_mcu[i], true);
250+ napi_disable(&mdev->tx_napi);
251+
252+ mt76_for_each_q_rx(mdev, i)
253+ napi_disable(&mdev->napi[i]);
254+
255+ mt76x02_dma_disable(dev);
256+ mt76x02_mcu_cleanup(dev);
257+ mt76x0_chip_onoff(dev, false, false);
258+
259+ pci_enable_wake(pdev, pci_choose_state(pdev, state), true);
260+ pci_save_state(pdev);
261+
262+ return pci_set_power_state(pdev, pci_choose_state(pdev, state));
263+}
264+
265+static int mt76x0e_resume(struct pci_dev *pdev)
266+{
267+ struct mt76_dev *mdev = pci_get_drvdata(pdev);
268+ struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
269+ int err, i;
270+
271+ err = pci_set_power_state(pdev, PCI_D0);
272+ if (err)
273+ return err;
274+
275+ pci_restore_state(pdev);
276+
277+ mt76_worker_enable(&mdev->tx_worker);
278+
279+ mt76_for_each_q_rx(mdev, i) {
280+ mt76_queue_rx_reset(dev, i);
281+ napi_enable(&mdev->napi[i]);
282+ napi_schedule(&mdev->napi[i]);
283+ }
284+
285+ napi_enable(&mdev->tx_napi);
286+ napi_schedule(&mdev->tx_napi);
287+
288+ return mt76x0e_init_hardware(dev, true);
289+}
290+#endif /* CONFIG_PM */
291+
223292 static const struct pci_device_id mt76x0e_device_table[] = {
224293 { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7610) },
225294 { PCI_DEVICE(PCI_VENDOR_ID_MEDIATEK, 0x7630) },
@@ -237,6 +306,10 @@ static struct pci_driver mt76x0e_driver = { · 11 unmodified lines
237306 .id_table = mt76x0e_device_table,
238307 .probe = mt76x0e_probe,
239308 .remove = mt76x0e_remove,
309+#ifdef CONFIG_PM
310+ .suspend = mt76x0e_suspend,
311+ .resume = mt76x0e_resume,
312+#endif /* CONFIG_PM */
240313 };
241314
242315 module_pci_driver(mt76x0e_driver);
drivers/net/wireless/mediatek/mt76/mt7921/init.c+2−2
@@ -76,8 +76,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) · 75 unmodified lines
7676 struct wiphy *wiphy = hw->wiphy;
7777
7878 hw->queues = 4;
79− hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
80− hw->max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
79+ hw->max_rx_aggregation_subframes = 64;
80+ hw->max_tx_aggregation_subframes = 128;
8181
8282 hw->radiotap_timestamp.units_pos =
8383 IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US;
drivers/net/wireless/mediatek/mt76/mt7921/mac.c+3−2
@@ -1404,8 +1404,9 @@ void mt7921_pm_wake_work(struct work_struct *work) · 1403 unmodified lines
14041404 napi_schedule(&dev->mt76.napi[i]);
14051405 mt76_connac_pm_dequeue_skbs(mphy, &dev->pm);
14061406 mt7921_tx_cleanup(dev);
1407− ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
1408− MT7921_WATCHDOG_TIME);
1407+ if (test_bit(MT76_STATE_RUNNING, &mphy->state))
1408+ ieee80211_queue_delayed_work(mphy->hw, &mphy->mac_work,
1409+ MT7921_WATCHDOG_TIME);
14091410 }
14101411
14111412 ieee80211_wake_queues(mphy->hw);
drivers/net/wireless/mediatek/mt76/mt7921/main.c+1−2
@@ -74,8 +74,7 @@ mt7921_init_he_caps(struct mt7921_phy *phy, enum nl80211_band band, · 73 unmodified lines
7474 IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G;
7575 else if (band == NL80211_BAND_5GHZ)
7676 he_cap_elem->phy_cap_info[0] =
77− IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
78− IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G;
77+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
7978
8079 he_cap_elem->phy_cap_info[1] =
8180 IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD;
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c+10−7
@@ -402,20 +402,22 @@ static void · 401 unmodified lines
402402 mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb,
403403 u16 wlan_idx)
404404 {
405− struct mt7921_mcu_wlan_info_event *wtbl_info =
406− (struct mt7921_mcu_wlan_info_event *)(skb->data);
407− struct rate_info rate = {};
408− u8 curr_idx = wtbl_info->rate_info.rate_idx;
409− u16 curr = le16_to_cpu(wtbl_info->rate_info.rate[curr_idx]);
410− struct mt7921_mcu_peer_cap peer = wtbl_info->peer_cap;
405+ struct mt7921_mcu_wlan_info_event *wtbl_info;
411406 struct mt76_phy *mphy = &dev->mphy;
412407 struct mt7921_sta_stats *stats;
408+ struct rate_info rate = {};
413409 struct mt7921_sta *msta;
414410 struct mt76_wcid *wcid;
411+ u8 idx;
415412
416413 if (wlan_idx >= MT76_N_WCIDS)
417414 return;
418415
416+ wtbl_info = (struct mt7921_mcu_wlan_info_event *)skb->data;
417+ idx = wtbl_info->rate_info.rate_idx;
418+ if (idx >= ARRAY_SIZE(wtbl_info->rate_info.rate))
419+ return;
420+
419421 rcu_read_lock();
420422
421423 wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
@@ -426,7 +428,8 @@ mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb, · 4 unmodified lines
426428 stats = &msta->stats;
427429
428430 /* current rate */
429− mt7921_mcu_tx_rate_parse(mphy, &peer, &rate, curr);
431+ mt7921_mcu_tx_rate_parse(mphy, &wtbl_info->peer_cap, &rate,
432+ le16_to_cpu(wtbl_info->rate_info.rate[idx]));
430433 stats->tx_rate = rate;
431434 out:
432435 rcu_read_unlock();
drivers/net/xen-netback/interface.c+6−0
@@ -684,6 +684,7 @@ static void xenvif_disconnect_queue(struct xenvif_queue *queue) · 683 unmodified lines
684684 {
685685 if (queue->task) {
686686 kthread_stop(queue->task);
687+ put_task_struct(queue->task);
687688 queue->task = NULL;
688689 }
689690
@@ -745,6 +746,11 @@ int xenvif_connect_data(struct xenvif_queue *queue, · 55 unmodified lines
745746 if (IS_ERR(task))
746747 goto kthread_err;
747748 queue->task = task;
749+ /*
750+ * Take a reference to the task in order to prevent it from being freed
751+ * if the thread function returns before kthread_stop is called.
752+ */
753+ get_task_struct(task);
748754
749755 task = kthread_run(xenvif_dealloc_kthread, queue,
750756 "%s-dealloc", queue->name);
drivers/nvme/host/rdma.c+3−2
@@ -1320,16 +1320,17 @@ static int nvme_rdma_map_sg_inline(struct nvme_rdma_queue *queue, · 1319 unmodified lines
13201320 int count)
13211321 {
13221322 struct nvme_sgl_desc *sg = &c->common.dptr.sgl;
1323− struct scatterlist *sgl = req->data_sgl.sg_table.sgl;
13241323 struct ib_sge *sge = &req->sge[1];
1324+ struct scatterlist *sgl;
13251325 u32 len = 0;
13261326 int i;
13271327
1328− for (i = 0; i < count; i++, sgl++, sge++) {
1328+ for_each_sg(req->data_sgl.sg_table.sgl, sgl, count, i) {
13291329 sge->addr = sg_dma_address(sgl);
13301330 sge->length = sg_dma_len(sgl);
13311331 sge->lkey = queue->device->pd->local_dma_lkey;
13321332 len += sge->length;
1333+ sge++;
13331334 }
13341335
13351336 sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff);
drivers/nvme/target/core.c+16−17
@@ -1005,19 +1005,23 @@ static unsigned int nvmet_data_transfer_len(struct nvmet_req *req) · 1004 unmodified lines
10051005 return req->transfer_len - req->metadata_len;
10061006 }
10071007
1008−static int nvmet_req_alloc_p2pmem_sgls(struct nvmet_req *req)
1008+static int nvmet_req_alloc_p2pmem_sgls(struct pci_dev *p2p_dev,
1009+ struct nvmet_req *req)
10091010 {
1010− req->sg = pci_p2pmem_alloc_sgl(req->p2p_dev, &req->sg_cnt,
1011+ req->sg = pci_p2pmem_alloc_sgl(p2p_dev, &req->sg_cnt,
10111012 nvmet_data_transfer_len(req));
10121013 if (!req->sg)
10131014 goto out_err;
10141015
10151016 if (req->metadata_len) {
1016− req->metadata_sg = pci_p2pmem_alloc_sgl(req->p2p_dev,
1017+ req->metadata_sg = pci_p2pmem_alloc_sgl(p2p_dev,
10171018 &req->metadata_sg_cnt, req->metadata_len);
10181019 if (!req->metadata_sg)
10191020 goto out_free_sg;
10201021 }
1022+
1023+ req->p2p_dev = p2p_dev;
1024+
10211025 return 0;
10221026 out_free_sg:
10231027 pci_p2pmem_free_sgl(req->p2p_dev, req->sg);
@@ -1025,25 +1029,19 @@ out_err: · 1 unmodified line
10251029 return -ENOMEM;
10261030 }
10271031
1028−static bool nvmet_req_find_p2p_dev(struct nvmet_req *req)
1032+static struct pci_dev *nvmet_req_find_p2p_dev(struct nvmet_req *req)
10291033 {
1030− if (!IS_ENABLED(CONFIG_PCI_P2PDMA))
1031− return false;
1032−
1033− if (req->sq->ctrl && req->sq->qid && req->ns) {
1034− req->p2p_dev = radix_tree_lookup(&req->sq->ctrl->p2p_ns_map,
1035− req->ns->nsid);
1036− if (req->p2p_dev)
1037− return true;
1038− }
1039−
1040− req->p2p_dev = NULL;
1041− return false;
1034+ if (!IS_ENABLED(CONFIG_PCI_P2PDMA) ||
1035+ !req->sq->ctrl || !req->sq->qid || !req->ns)
1036+ return NULL;
1037+ return radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, req->ns->nsid);
10421038 }
10431039
10441040 int nvmet_req_alloc_sgls(struct nvmet_req *req)
10451041 {
1046− if (nvmet_req_find_p2p_dev(req) && !nvmet_req_alloc_p2pmem_sgls(req))
1042+ struct pci_dev *p2p_dev = nvmet_req_find_p2p_dev(req);
1043+
1044+ if (p2p_dev && !nvmet_req_alloc_p2pmem_sgls(p2p_dev, req))
10471045 return 0;
10481046
10491047 req->sg = sgl_alloc(nvmet_data_transfer_len(req), GFP_KERNEL,
@@ -1072,6 +1070,7 @@ void nvmet_req_free_sgls(struct nvmet_req *req) · 22 unmodified lines
10721070 pci_p2pmem_free_sgl(req->p2p_dev, req->sg);
10731071 if (req->metadata_sg)
10741072 pci_p2pmem_free_sgl(req->p2p_dev, req->metadata_sg);
1073+ req->p2p_dev = NULL;
10751074 } else {
10761075 sgl_free(req->sg);
10771076 if (req->metadata_sg)
drivers/nvme/target/loop.c+8−3
@@ -263,7 +263,8 @@ static const struct blk_mq_ops nvme_loop_admin_mq_ops = { · 262 unmodified lines
263263
264264 static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl)
265265 {
266− clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
266+ if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags))
267+ return;
267268 nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
268269 blk_cleanup_queue(ctrl->ctrl.admin_q);
269270 blk_cleanup_queue(ctrl->ctrl.fabrics_q);
@@ -299,6 +300,7 @@ static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl) · 29 unmodified lines
299300 clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[i].flags);
300301 nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
301302 }
303+ ctrl->ctrl.queue_count = 1;
302304 }
303305
304306 static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl)
@@ -405,6 +407,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl) · 100 unmodified lines
405407 return 0;
406408
407409 out_cleanup_queue:
410+ clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
408411 blk_cleanup_queue(ctrl->ctrl.admin_q);
409412 out_cleanup_fabrics_q:
410413 blk_cleanup_queue(ctrl->ctrl.fabrics_q);
@@ -462,8 +465,10 @@ static void nvme_loop_reset_ctrl_work(struct work_struct *work) · 51 unmodified lines
462465 nvme_loop_shutdown_ctrl(ctrl);
463466
464467 if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
465− /* state change failure should never happen */
466− WARN_ON_ONCE(1);
468+ if (ctrl->ctrl.state != NVME_CTRL_DELETING &&
469+ ctrl->ctrl.state != NVME_CTRL_DELETING_NOIO)
470+ /* state change failure for non-deleted ctrl? */
471+ WARN_ON_ONCE(1);
467472 return;
468473 }
469474
drivers/pci/of.c+7−0
@@ -103,6 +103,13 @@ struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus) · 102 unmodified lines
103103 #endif
104104 }
105105
106+bool pci_host_of_has_msi_map(struct device *dev)
107+{
108+ if (dev && dev->of_node)
109+ return of_get_property(dev->of_node, "msi-map", NULL);
110+ return false;
111+}
112+
106113 static inline int __of_pci_pci_compare(struct device_node *node,
107114 unsigned int data)
108115 {
drivers/pci/probe.c+2−1
@@ -925,7 +925,8 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge) · 924 unmodified lines
925925 device_enable_async_suspend(bus->bridge);
926926 pci_set_bus_of_node(bus);
927927 pci_set_bus_msi_domain(bus);
928− if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev))
928+ if (bridge->msi_domain && !dev_get_msi_domain(&bus->dev) &&
929+ !pci_host_of_has_msi_map(parent))
929930 bus->bus_flags |= PCI_BUS_FLAGS_NO_MSI;
930931
931932 if (!parent)
drivers/phy/broadcom/phy-brcm-usb-init.h+2−2
@@ -78,7 +78,7 @@ static inline u32 brcm_usb_readl(void __iomem *addr) · 77 unmodified lines
7878 * Other architectures (e.g., ARM) either do not support big endian, or
7979 * else leave I/O in little endian mode.
8080 */
81− if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN))
81+ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
8282 return __raw_readl(addr);
8383 else
8484 return readl_relaxed(addr);
@@ -87,7 +87,7 @@ static inline u32 brcm_usb_readl(void __iomem *addr) · 2 unmodified lines
8787 static inline void brcm_usb_writel(u32 val, void __iomem *addr)
8888 {
8989 /* See brcmnand_readl() comments */
90− if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(__BIG_ENDIAN))
90+ if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
9191 __raw_writel(val, addr);
9292 else
9393 writel_relaxed(val, addr);
drivers/phy/cadence/phy-cadence-sierra.c+1−0
@@ -940,6 +940,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) · 939 unmodified lines
940940 sp->nsubnodes = node;
941941
942942 if (sp->num_lanes > SIERRA_MAX_LANES) {
943+ ret = -EINVAL;
943944 dev_err(dev, "Invalid lane configuration\n");
944945 goto put_child2;
945946 }
drivers/phy/mediatek/phy-mtk-tphy.c+2−0
@@ -949,6 +949,8 @@ static int mtk_phy_init(struct phy *phy) · 948 unmodified lines
949949 break;
950950 default:
951951 dev_err(tphy->dev, "incompatible PHY type\n");
952+ clk_disable_unprepare(instance->ref_clk);
953+ clk_disable_unprepare(instance->da_ref_clk);
952954 return -EINVAL;
953955 }
954956
drivers/phy/microchip/sparx5_serdes.c+4−0
@@ -2470,6 +2470,10 @@ static int sparx5_serdes_probe(struct platform_device *pdev) · 2469 unmodified lines
24702470 priv->coreclock = clock;
24712471
24722472 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2473+ if (!iores) {
2474+ dev_err(priv->dev, "Invalid resource\n");
2475+ return -EINVAL;
2476+ }
24732477 iomem = devm_ioremap(priv->dev, iores->start, resource_size(iores));
24742478 if (IS_ERR(iomem)) {
24752479 dev_err(priv->dev, "Unable to get serdes registers: %s\n",
drivers/phy/ralink/phy-mt7621-pci.c+1−1
@@ -341,7 +341,7 @@ static struct platform_driver mt7621_pci_phy_driver = { · 340 unmodified lines
341341 .probe = mt7621_pci_phy_probe,
342342 .driver = {
343343 .name = "mt7621-pci-phy",
344− .of_match_table = of_match_ptr(mt7621_pci_phy_ids),
344+ .of_match_table = mt7621_pci_phy_ids,
345345 },
346346 };
347347
drivers/phy/ti/phy-j721e-wiz.c+1−0
@@ -1212,6 +1212,7 @@ static int wiz_probe(struct platform_device *pdev) · 1211 unmodified lines
12121212
12131213 if (wiz->typec_dir_delay < WIZ_TYPEC_DIR_DEBOUNCE_MIN ||
12141214 wiz->typec_dir_delay > WIZ_TYPEC_DIR_DEBOUNCE_MAX) {
1215+ ret = -EINVAL;
12151216 dev_err(dev, "Invalid typec-dir-debounce property\n");
12161217 goto err_addr_to_resource;
12171218 }
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c+2−2
@@ -2702,8 +2702,8 @@ static int aspeed_g5_sig_expr_eval(struct aspeed_pinmux_data *ctx, · 2701 unmodified lines
27022702 }
27032703
27042704 /**
2705− * Configure a pin's signal by applying an expression's descriptor state for
2706− * all descriptors in the expression.
2705+ * aspeed_g5_sig_expr_set() - Configure a pin's signal by applying an
2706+ * expression's descriptor state for all descriptors in the expression.
27072707 *
27082708 * @ctx: The pinmux context
27092709 * @expr: The expression associated with the function whose signal is to be
drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c+2−2
@@ -2611,8 +2611,8 @@ static struct aspeed_pin_config aspeed_g6_configs[] = { · 2610 unmodified lines
26112611 };
26122612
26132613 /**
2614− * Configure a pin's signal by applying an expression's descriptor state for
2615− * all descriptors in the expression.
2614+ * aspeed_g6_sig_expr_set() - Configure a pin's signal by applying an
2615+ * expression's descriptor state for all descriptors in the expression.
26162616 *
26172617 * @ctx: The pinmux context
26182618 * @expr: The expression associated with the function whose signal is to be
drivers/pinctrl/aspeed/pinctrl-aspeed.c+2−1
@@ -108,7 +108,8 @@ static int aspeed_sig_expr_disable(struct aspeed_pinmux_data *ctx, · 107 unmodified lines
108108 }
109109
110110 /**
111− * Disable a signal on a pin by disabling all provided signal expressions.
111+ * aspeed_disable_sig() - Disable a signal on a pin by disabling all provided
112+ * signal expressions.
112113 *
113114 * @ctx: The pinmux context
114115 * @exprs: The list of signal expressions (from a priority level on a pin)
drivers/pinctrl/aspeed/pinmux-aspeed.c+2−1
@@ -21,7 +21,8 @@ static inline void aspeed_sig_desc_print_val( · 20 unmodified lines
2121 }
2222
2323 /**
24− * Query the enabled or disabled state of a signal descriptor
24+ * aspeed_sig_desc_eval() - Query the enabled or disabled state of a signal
25+ * descriptor.
2526 *
2627 * @desc: The signal descriptor of interest
2728 * @enabled: True to query the enabled state, false to query disabled state
drivers/pinctrl/qcom/Kconfig+1−1
@@ -223,7 +223,7 @@ config PINCTRL_SC7280 · 222 unmodified lines
223223 config PINCTRL_SC8180X
224224 tristate "Qualcomm Technologies Inc SC8180x pin controller driver"
225225 depends on GPIOLIB && (OF || ACPI)
226− select PINCTRL_MSM
226+ depends on PINCTRL_MSM
227227 help
228228 This is the pinctrl, pinmux, pinconf and gpiolib driver for the
229229 Qualcomm Technologies Inc TLMM block found on the Qualcomm
drivers/pinctrl/qcom/pinctrl-sdx55.c+9−9
@@ -410,15 +410,15 @@ static const char * const gpio_groups[] = { · 409 unmodified lines
410410 "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35",
411411 "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42",
412412 "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49",
413− "gpio50", "gpio51", "gpio52", "gpio52", "gpio53", "gpio53", "gpio54",
414− "gpio55", "gpio56", "gpio57", "gpio58", "gpio59", "gpio60", "gpio61",
415− "gpio62", "gpio63", "gpio64", "gpio65", "gpio66", "gpio67", "gpio68",
416− "gpio69", "gpio70", "gpio71", "gpio72", "gpio73", "gpio74", "gpio75",
417− "gpio76", "gpio77", "gpio78", "gpio79", "gpio80", "gpio81", "gpio82",
418− "gpio83", "gpio84", "gpio85", "gpio86", "gpio87", "gpio88", "gpio89",
419− "gpio90", "gpio91", "gpio92", "gpio93", "gpio94", "gpio95", "gpio96",
420− "gpio97", "gpio98", "gpio99", "gpio100", "gpio101", "gpio102",
421− "gpio103", "gpio104", "gpio105", "gpio106", "gpio107",
413+ "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56",
414+ "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63",
415+ "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70",
416+ "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77",
417+ "gpio78", "gpio79", "gpio80", "gpio81", "gpio82", "gpio83", "gpio84",
418+ "gpio85", "gpio86", "gpio87", "gpio88", "gpio89", "gpio90", "gpio91",
419+ "gpio92", "gpio93", "gpio94", "gpio95", "gpio96", "gpio97", "gpio98",
420+ "gpio99", "gpio100", "gpio101", "gpio102", "gpio103", "gpio104",
421+ "gpio105", "gpio106", "gpio107",
422422 };
423423
424424 static const char * const qdss_stm_groups[] = {
drivers/pinctrl/ralink/pinctrl-rt2880.c+1−1
@@ -127,7 +127,7 @@ static int rt2880_pmx_group_enable(struct pinctrl_dev *pctrldev, · 126 unmodified lines
127127 if (p->groups[group].enabled) {
128128 dev_err(p->dev, "%s is already enabled\n",
129129 p->groups[group].name);
130− return -EBUSY;
130+ return 0;
131131 }
132132
133133 p->groups[group].enabled = 1;
drivers/platform/mellanox/mlxreg-hotplug.c+2−2
@@ -683,13 +683,13 @@ static int mlxreg_hotplug_probe(struct platform_device *pdev) · 682 unmodified lines
683683
684684 err = devm_request_irq(&pdev->dev, priv->irq,
685685 mlxreg_hotplug_irq_handler, IRQF_TRIGGER_FALLING
686− | IRQF_SHARED | IRQF_NO_AUTOEN,
687− "mlxreg-hotplug", priv);
686+ | IRQF_SHARED, "mlxreg-hotplug", priv);
688687 if (err) {
689688 dev_err(&pdev->dev, "Failed to request irq: %d\n", err);
690689 return err;
691690 }
692691
692+ disable_irq(priv->irq);
693693 spin_lock_init(&priv->lock);
694694 INIT_DELAYED_WORK(&priv->dwork_irq, mlxreg_hotplug_work_handler);
695695 dev_set_drvdata(&pdev->dev, priv);
drivers/platform/surface/aggregator/controller.c+1−1
@@ -1907,7 +1907,7 @@ static int ssam_ssh_event_disable(struct ssam_controller *ctrl, · 1906 unmodified lines
19071907 {
19081908 int status;
19091909
1910− status = __ssam_ssh_event_request(ctrl, reg, reg.cid_enable, id, flags);
1910+ status = __ssam_ssh_event_request(ctrl, reg, reg.cid_disable, id, flags);
19111911
19121912 if (status < 0 && status != -EINVAL) {
19131913 ssam_err(ctrl,
drivers/platform/surface/surface_aggregator_registry.c+5−2
@@ -156,7 +156,7 @@ static const struct software_node *ssam_node_group_sl2[] = { · 155 unmodified lines
156156 NULL,
157157 };
158158
159−/* Devices for Surface Laptop 3. */
159+/* Devices for Surface Laptop 3 and 4. */
160160 static const struct software_node *ssam_node_group_sl3[] = {
161161 &ssam_node_root,
162162 &ssam_node_bat_ac,
@@ -521,9 +521,12 @@ static const struct acpi_device_id ssam_platform_hub_match[] = { · 358 unmodified lines
521521 /* Surface Laptop 3 (13", Intel) */
522522 { "MSHW0114", (unsigned long)ssam_node_group_sl3 },
523523
524− /* Surface Laptop 3 (15", AMD) */
524+ /* Surface Laptop 3 (15", AMD) and 4 (15", AMD) */
525525 { "MSHW0110", (unsigned long)ssam_node_group_sl3 },
526526
527+ /* Surface Laptop 4 (13", Intel) */
528+ { "MSHW0250", (unsigned long)ssam_node_group_sl3 },
529+
527530 /* Surface Laptop Go 1 */
528531 { "MSHW0118", (unsigned long)ssam_node_group_slg1 },
529532
drivers/platform/surface/surface_dtx.c+1−0
@@ -427,6 +427,7 @@ static int surface_dtx_open(struct inode *inode, struct file *file) · 426 unmodified lines
427427 */
428428 if (test_bit(SDTX_DEVICE_SHUTDOWN_BIT, &ddev->flags)) {
429429 up_write(&ddev->client_lock);
430+ mutex_destroy(&client->read_lock);
430431 sdtx_device_put(client->ddev);
431432 kfree(client);
432433 return -ENODEV;
drivers/platform/x86/thinkpad_acpi.c+1−0
@@ -8853,6 +8853,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 8852 unmodified lines
88538853 TPACPI_Q_LNV3('N', '2', 'O', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (2nd gen) */
88548854 TPACPI_Q_LNV3('N', '2', 'V', TPACPI_FAN_2CTL), /* P1 / X1 Extreme (3nd gen) */
88558855 TPACPI_Q_LNV3('N', '3', '0', TPACPI_FAN_2CTL), /* P15 (1st gen) / P15v (1st gen) */
8856+ TPACPI_Q_LNV3('N', '3', '2', TPACPI_FAN_2CTL), /* X1 Carbon (9th gen) */
88568857 };
88578858
88588859 static int __init fan_init(struct ibm_init_struct *iibm)
drivers/regulator/Kconfig+1−1
@@ -1031,7 +1031,7 @@ config REGULATOR_RT5033 · 1030 unmodified lines
10311031 current source, LDO and Buck.
10321032
10331033 config REGULATOR_RTMV20
1034− tristate "RTMV20 Laser Diode Regulator"
1034+ tristate "Richtek RTMV20 Laser Diode Regulator"
10351035 depends on I2C
10361036 select REGMAP_I2C
10371037 help
drivers/regulator/atc260x-regulator.c+10−9
@@ -28,16 +28,16 @@ static const struct linear_range atc2609a_dcdc_voltage_ranges[] = { · 27 unmodified lines
2828
2929 static const struct linear_range atc2609a_ldo_voltage_ranges0[] = {
3030 REGULATOR_LINEAR_RANGE(700000, 0, 15, 100000),
31− REGULATOR_LINEAR_RANGE(2100000, 16, 28, 100000),
31+ REGULATOR_LINEAR_RANGE(2100000, 0, 12, 100000),
3232 };
3333
3434 static const struct linear_range atc2609a_ldo_voltage_ranges1[] = {
3535 REGULATOR_LINEAR_RANGE(850000, 0, 15, 100000),
36− REGULATOR_LINEAR_RANGE(2100000, 16, 27, 100000),
36+ REGULATOR_LINEAR_RANGE(2100000, 0, 11, 100000),
3737 };
3838
3939 static const unsigned int atc260x_ldo_voltage_range_sel[] = {
40− 0x0, 0x1,
40+ 0x0, 0x20,
4141 };
4242
4343 static int atc260x_dcdc_set_voltage_time_sel(struct regulator_dev *rdev,
@@ -411,7 +411,7 @@ enum atc2609a_reg_ids { · 367 unmodified lines
411411 .owner = THIS_MODULE, \
412412 }
413413
414−#define atc2609a_reg_desc_ldo_range_pick(num, n_range) { \
414+#define atc2609a_reg_desc_ldo_range_pick(num, n_range, n_volt) { \
415415 .name = "LDO"#num, \
416416 .supply_name = "ldo"#num, \
417417 .of_match = of_match_ptr("ldo"#num), \
@@ -421,6 +421,7 @@ enum atc2609a_reg_ids { · 3 unmodified lines
421421 .type = REGULATOR_VOLTAGE, \
422422 .linear_ranges = atc2609a_ldo_voltage_ranges##n_range, \
423423 .n_linear_ranges = ARRAY_SIZE(atc2609a_ldo_voltage_ranges##n_range), \
424+ .n_voltages = n_volt, \
424425 .vsel_reg = ATC2609A_PMU_LDO##num##_CTL0, \
425426 .vsel_mask = GENMASK(4, 1), \
426427 .vsel_range_reg = ATC2609A_PMU_LDO##num##_CTL0, \
@@ -458,12 +459,12 @@ static const struct regulator_desc atc2609a_reg[] = { · 31 unmodified lines
458459 atc2609a_reg_desc_ldo_bypass(0),
459460 atc2609a_reg_desc_ldo_bypass(1),
460461 atc2609a_reg_desc_ldo_bypass(2),
461− atc2609a_reg_desc_ldo_range_pick(3, 0),
462− atc2609a_reg_desc_ldo_range_pick(4, 0),
462+ atc2609a_reg_desc_ldo_range_pick(3, 0, 29),
463+ atc2609a_reg_desc_ldo_range_pick(4, 0, 29),
463464 atc2609a_reg_desc_ldo(5),
464− atc2609a_reg_desc_ldo_range_pick(6, 1),
465− atc2609a_reg_desc_ldo_range_pick(7, 0),
466− atc2609a_reg_desc_ldo_range_pick(8, 0),
465+ atc2609a_reg_desc_ldo_range_pick(6, 1, 28),
466+ atc2609a_reg_desc_ldo_range_pick(7, 0, 29),
467+ atc2609a_reg_desc_ldo_range_pick(8, 0, 29),
467468 atc2609a_reg_desc_ldo_fixed(9),
468469 };
469470
drivers/regulator/bd718x7-regulator.c+1−1
@@ -334,7 +334,7 @@ BD718XX_OPS(bd71837_buck_regulator_ops, regulator_list_voltage_linear_range, · 333 unmodified lines
334334 NULL);
335335
336336 BD718XX_OPS(bd71837_buck_regulator_nolinear_ops, regulator_list_voltage_table,
337− regulator_map_voltage_ascend, bd718xx_set_voltage_sel_restricted,
337+ regulator_map_voltage_ascend, bd71837_set_voltage_sel_restricted,
338338 regulator_get_voltage_sel_regmap, regulator_set_voltage_time_sel,
339339 NULL);
340340 /*
drivers/regulator/core.c+6−0
@@ -1425,6 +1425,12 @@ static int set_machine_constraints(struct regulator_dev *rdev) · 1424 unmodified lines
14251425 * and we have control then make sure it is enabled.
14261426 */
14271427 if (rdev->constraints->always_on || rdev->constraints->boot_on) {
1428+ /* If we want to enable this regulator, make sure that we know
1429+ * the supplying regulator.
1430+ */
1431+ if (rdev->supply_name && !rdev->supply)
1432+ return -EPROBE_DEFER;
1433+
14281434 if (rdev->supply) {
14291435 ret = regulator_enable(rdev->supply);
14301436 if (ret < 0) {
drivers/regulator/cros-ec-regulator.c+2−1
@@ -225,8 +225,9 @@ static int cros_ec_regulator_probe(struct platform_device *pdev) · 224 unmodified lines
225225
226226 drvdata->dev = devm_regulator_register(dev, &drvdata->desc, &cfg);
227227 if (IS_ERR(drvdata->dev)) {
228+ ret = PTR_ERR(drvdata->dev);
228229 dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret);
229− return PTR_ERR(drvdata->dev);
230+ return ret;
230231 }
231232
232233 platform_set_drvdata(pdev, drvdata);
drivers/regulator/da9121-regulator.c+7−3
@@ -280,7 +280,7 @@ static unsigned int da9121_map_mode(unsigned int mode) · 279 unmodified lines
280280 case DA9121_BUCK_MODE_FORCE_PFM:
281281 return REGULATOR_MODE_STANDBY;
282282 default:
283− return -EINVAL;
283+ return REGULATOR_MODE_INVALID;
284284 }
285285 }
286286
@@ -317,7 +317,7 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev) · 30 unmodified lines
317317 {
318318 struct da9121 *chip = rdev_get_drvdata(rdev);
319319 int id = rdev_get_id(rdev);
320− unsigned int val;
320+ unsigned int val, mode;
321321 int ret = 0;
322322
323323 ret = regmap_read(chip->regmap, da9121_mode_field[id].reg, &val);
@@ -326,7 +326,11 @@ static unsigned int da9121_buck_get_mode(struct regulator_dev *rdev) · 2 unmodified lines
326326 return -EINVAL;
327327 }
328328
329− return da9121_map_mode(val & da9121_mode_field[id].msk);
329+ mode = da9121_map_mode(val & da9121_mode_field[id].msk);
330+ if (mode == REGULATOR_MODE_INVALID)
331+ return -EINVAL;
332+
333+ return mode;
330334 }
331335
332336 static const struct regulator_ops da9121_buck_ops = {
drivers/regulator/fan53555.c+1−2
@@ -55,7 +55,6 @@ · 54 unmodified lines
5555
5656 #define FAN53555_NVOLTAGES 64 /* Numbers of voltages */
5757 #define FAN53526_NVOLTAGES 128
58−#define TCS4525_NVOLTAGES 127 /* Numbers of voltages */
5958
6059 #define TCS_VSEL_NSEL_MASK 0x7f
6160 #define TCS_VSEL0_MODE (1 << 7)
@@ -376,7 +375,7 @@ static int fan53555_voltages_setup_tcs(struct fan53555_device_info *di) · 314 unmodified lines
376375 /* Init voltage range and step */
377376 di->vsel_min = 600000;
378377 di->vsel_step = 6250;
379− di->vsel_count = TCS4525_NVOLTAGES;
378+ di->vsel_count = FAN53526_NVOLTAGES;
380379
381380 return 0;
382381 }
drivers/regulator/fan53880.c+3−0
@@ -51,6 +51,7 @@ static const struct regulator_ops fan53880_ops = { · 50 unmodified lines
5151 REGULATOR_LINEAR_RANGE(800000, 0xf, 0x73, 25000), \
5252 }, \
5353 .n_linear_ranges = 2, \
54+ .n_voltages = 0x74, \
5455 .vsel_reg = FAN53880_LDO ## _num ## VOUT, \
5556 .vsel_mask = 0x7f, \
5657 .enable_reg = FAN53880_ENABLE, \
@@ -76,6 +77,7 @@ static const struct regulator_desc fan53880_regulators[] = { · 19 unmodified lines
7677 REGULATOR_LINEAR_RANGE(600000, 0x1f, 0xf7, 12500),
7778 },
7879 .n_linear_ranges = 2,
80+ .n_voltages = 0xf8,
7981 .vsel_reg = FAN53880_BUCKVOUT,
8082 .vsel_mask = 0x7f,
8183 .enable_reg = FAN53880_ENABLE,
@@ -95,6 +97,7 @@ static const struct regulator_desc fan53880_regulators[] = { · 13 unmodified lines
9597 REGULATOR_LINEAR_RANGE(3000000, 0x4, 0x70, 25000),
9698 },
9799 .n_linear_ranges = 2,
100+ .n_voltages = 0x71,
98101 .vsel_reg = FAN53880_BOOSTVOUT,
99102 .vsel_mask = 0x7f,
100103 .enable_reg = FAN53880_ENABLE_BOOST,
drivers/regulator/fixed.c+6−1
@@ -88,10 +88,15 @@ static int reg_domain_disable(struct regulator_dev *rdev) · 87 unmodified lines
8888 {
8989 struct fixed_voltage_data *priv = rdev_get_drvdata(rdev);
9090 struct device *dev = rdev->dev.parent;
91+ int ret;
92+
93+ ret = dev_pm_genpd_set_performance_state(dev, 0);
94+ if (ret)
95+ return ret;
9196
9297 priv->enable_counter--;
9398
94− return dev_pm_genpd_set_performance_state(dev, 0);
99+ return 0;
95100 }
96101
97102 static int reg_is_enabled(struct regulator_dev *rdev)
drivers/regulator/helpers.c+1−1
@@ -948,7 +948,7 @@ int regulator_set_ramp_delay_regmap(struct regulator_dev *rdev, int ramp_delay) · 947 unmodified lines
948948 int ret;
949949 unsigned int sel;
950950
951− if (!rdev->desc->n_ramp_values)
951+ if (WARN_ON(!rdev->desc->n_ramp_values || !rdev->desc->ramp_delay_table))
952952 return -EINVAL;
953953
954954 ret = find_closest_bigger(ramp_delay, rdev->desc->ramp_delay_table,
drivers/regulator/hi6421v600-regulator.c+2−2
@@ -3,7 +3,7 @@ · 2 unmodified lines
33 // Device driver for regulators in Hisi IC
44 //
55 // Copyright (c) 2013 Linaro Ltd.
6−// Copyright (c) 2011 Hisilicon.
6+// Copyright (c) 2011 HiSilicon Ltd.
77 // Copyright (c) 2020-2021 Huawei Technologies Co., Ltd
88 //
99 // Guodong Xu <guodong.xu@linaro.org>
@@ -83,7 +83,7 @@ static const unsigned int ldo34_voltages[] = { · 73 unmodified lines
8383 .owner = THIS_MODULE, \
8484 .volt_table = vtable, \
8585 .n_voltages = ARRAY_SIZE(vtable), \
86− .vsel_mask = (1 << (ARRAY_SIZE(vtable) - 1)) - 1, \
86+ .vsel_mask = ARRAY_SIZE(vtable) - 1, \
8787 .vsel_reg = vreg, \
8888 .enable_reg = ereg, \
8989 .enable_mask = emask, \
drivers/regulator/hi655x-regulator.c+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 //
33 // Device driver for regulators in Hi655x IC
44 //
5−// Copyright (c) 2016 Hisilicon.
5+// Copyright (c) 2016 HiSilicon Ltd.
66 //
77 // Authors:
88 // Chen Feng <puck.chen@hisilicon.com>
drivers/regulator/max77620-regulator.c+11−6
@@ -814,6 +814,13 @@ static int max77620_regulator_probe(struct platform_device *pdev) · 813 unmodified lines
814814 config.dev = dev;
815815 config.driver_data = pmic;
816816
817+ /*
818+ * Set of_node_reuse flag to prevent driver core from attempting to
819+ * claim any pinmux resources already claimed by the parent device.
820+ * Otherwise PMIC driver will fail to re-probe.
821+ */
822+ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
823+
817824 for (id = 0; id < MAX77620_NUM_REGS; id++) {
818825 struct regulator_dev *rdev;
819826 struct regulator_desc *rdesc;
@@ -839,12 +846,10 @@ static int max77620_regulator_probe(struct platform_device *pdev) · 19 unmodified lines
839846 return ret;
840847
841848 rdev = devm_regulator_register(dev, rdesc, &config);
842− if (IS_ERR(rdev)) {
843− ret = PTR_ERR(rdev);
844− dev_err(dev, "Regulator registration %s failed: %d\n",
845− rdesc->name, ret);
846− return ret;
847− }
849+ if (IS_ERR(rdev))
850+ return dev_err_probe(dev, PTR_ERR(rdev),
851+ "Regulator registration %s failed\n",
852+ rdesc->name);
848853 }
849854
850855 return 0;
drivers/regulator/mt6315-regulator.c+1−1
@@ -59,7 +59,7 @@ static const struct linear_range mt_volt_range1[] = { · 58 unmodified lines
5959 REGULATOR_LINEAR_RANGE(0, 0, 0xbf, 6250),
6060 };
6161
62−static unsigned int mt6315_map_mode(u32 mode)
62+static unsigned int mt6315_map_mode(unsigned int mode)
6363 {
6464 switch (mode) {
6565 case MT6315_BUCK_MODE_AUTO:
drivers/regulator/rt4801-regulator.c+2−2
@@ -66,7 +66,7 @@ static int rt4801_enable(struct regulator_dev *rdev) · 65 unmodified lines
6666 struct gpio_descs *gpios = priv->enable_gpios;
6767 int id = rdev_get_id(rdev), ret;
6868
69− if (gpios->ndescs <= id) {
69+ if (!gpios || gpios->ndescs <= id) {
7070 dev_warn(&rdev->dev, "no dedicated gpio can control\n");
7171 goto bypass_gpio;
7272 }
@@ -88,7 +88,7 @@ static int rt4801_disable(struct regulator_dev *rdev) · 15 unmodified lines
8888 struct gpio_descs *gpios = priv->enable_gpios;
8989 int id = rdev_get_id(rdev);
9090
91− if (gpios->ndescs <= id) {
91+ if (!gpios || gpios->ndescs <= id) {
9292 dev_warn(&rdev->dev, "no dedicated gpio can control\n");
9393 goto bypass_gpio;
9494 }
drivers/regulator/rtmv20-regulator.c+42−2
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #define RTMV20_REG_LDIRQ 0x30
2828 #define RTMV20_REG_LDSTAT 0x40
2929 #define RTMV20_REG_LDMASK 0x50
30+#define RTMV20_MAX_REGS (RTMV20_REG_LDMASK + 1)
3031
3132 #define RTMV20_VID_MASK GENMASK(7, 4)
3233 #define RICHTEK_VID 0x80
@@ -103,9 +104,47 @@ static int rtmv20_lsw_disable(struct regulator_dev *rdev) · 70 unmodified lines
103104 return 0;
104105 }
105106
107+static int rtmv20_lsw_set_current_limit(struct regulator_dev *rdev, int min_uA,
108+ int max_uA)
109+{
110+ int sel;
111+
112+ if (min_uA > RTMV20_LSW_MAXUA || max_uA < RTMV20_LSW_MINUA)
113+ return -EINVAL;
114+
115+ if (max_uA > RTMV20_LSW_MAXUA)
116+ max_uA = RTMV20_LSW_MAXUA;
117+
118+ sel = (max_uA - RTMV20_LSW_MINUA) / RTMV20_LSW_STEPUA;
119+
120+ /* Ensure the selected setting is still in range */
121+ if ((sel * RTMV20_LSW_STEPUA + RTMV20_LSW_MINUA) < min_uA)
122+ return -EINVAL;
123+
124+ sel <<= ffs(rdev->desc->csel_mask) - 1;
125+
126+ return regmap_update_bits(rdev->regmap, rdev->desc->csel_reg,
127+ rdev->desc->csel_mask, sel);
128+}
129+
130+static int rtmv20_lsw_get_current_limit(struct regulator_dev *rdev)
131+{
132+ unsigned int val;
133+ int ret;
134+
135+ ret = regmap_read(rdev->regmap, rdev->desc->csel_reg, &val);
136+ if (ret)
137+ return ret;
138+
139+ val &= rdev->desc->csel_mask;
140+ val >>= ffs(rdev->desc->csel_mask) - 1;
141+
142+ return val * RTMV20_LSW_STEPUA + RTMV20_LSW_MINUA;
143+}
144+
106145 static const struct regulator_ops rtmv20_regulator_ops = {
107− .set_current_limit = regulator_set_current_limit_regmap,
108− .get_current_limit = regulator_get_current_limit_regmap,
146+ .set_current_limit = rtmv20_lsw_set_current_limit,
147+ .get_current_limit = rtmv20_lsw_get_current_limit,
109148 .enable = rtmv20_lsw_enable,
110149 .disable = rtmv20_lsw_disable,
111150 .is_enabled = regulator_is_enabled_regmap,
@@ -275,6 +314,7 @@ static const struct regmap_config rtmv20_regmap_config = { · 163 unmodified lines
275314 .val_bits = 8,
276315 .cache_type = REGCACHE_RBTREE,
277316 .max_register = RTMV20_REG_LDMASK,
317+ .num_reg_defaults_raw = RTMV20_MAX_REGS,
278318
279319 .writeable_reg = rtmv20_is_accessible_reg,
280320 .readable_reg = rtmv20_is_accessible_reg,
drivers/regulator/scmi-regulator.c+1−1
@@ -173,7 +173,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg, · 172 unmodified lines
173173 sreg->desc.uV_step =
174174 vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP];
175175 sreg->desc.linear_min_sel = 0;
176− sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step;
176+ sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1;
177177 sreg->desc.ops = &scmi_reg_linear_ops;
178178 }
179179
drivers/scsi/hosts.c+26−21
@@ -254,12 +254,11 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, · 253 unmodified lines
254254
255255 device_enable_async_suspend(&shost->shost_dev);
256256
257+ get_device(&shost->shost_gendev);
257258 error = device_add(&shost->shost_dev);
258259 if (error)
259260 goto out_del_gendev;
260261
261− get_device(&shost->shost_gendev);
262−
263262 if (shost->transportt->host_size) {
264263 shost->shost_data = kzalloc(shost->transportt->host_size,
265264 GFP_KERNEL);
@@ -278,33 +277,36 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, · 12 unmodified lines
278277
279278 if (!shost->work_q) {
280279 error = -EINVAL;
281− goto out_free_shost_data;
280+ goto out_del_dev;
282281 }
283282 }
284283
285284 error = scsi_sysfs_add_host(shost);
286285 if (error)
287− goto out_destroy_host;
286+ goto out_del_dev;
288287
289288 scsi_proc_host_add(shost);
290289 scsi_autopm_put_host(shost);
291290 return error;
292291
293− out_destroy_host:
294− if (shost->work_q)
295− destroy_workqueue(shost->work_q);
296− out_free_shost_data:
297− kfree(shost->shost_data);
292+ /*
293+ * Any host allocation in this function will be freed in
294+ * scsi_host_dev_release().
295+ */
298296 out_del_dev:
299297 device_del(&shost->shost_dev);
300298 out_del_gendev:
299+ /*
300+ * Host state is SHOST_RUNNING so we have to explicitly release
301+ * ->shost_dev.
302+ */
303+ put_device(&shost->shost_dev);
301304 device_del(&shost->shost_gendev);
302305 out_disable_runtime_pm:
303306 device_disable_async_suspend(&shost->shost_gendev);
304307 pm_runtime_disable(&shost->shost_gendev);
305308 pm_runtime_set_suspended(&shost->shost_gendev);
306309 pm_runtime_put_noidle(&shost->shost_gendev);
307− scsi_mq_destroy_tags(shost);
308310 fail:
309311 return error;
310312 }
@@ -345,7 +347,7 @@ static void scsi_host_dev_release(struct device *dev) · 34 unmodified lines
345347
346348 ida_simple_remove(&host_index_ida, shost->host_no);
347349
348− if (parent)
350+ if (shost->shost_state != SHOST_CREATED)
349351 put_device(parent);
350352 kfree(shost);
351353 }
@@ -388,8 +390,10 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 36 unmodified lines
388390 mutex_init(&shost->scan_mutex);
389391
390392 index = ida_simple_get(&host_index_ida, 0, 0, GFP_KERNEL);
391− if (index < 0)
392− goto fail_kfree;
393+ if (index < 0) {
394+ kfree(shost);
395+ return NULL;
396+ }
393397 shost->host_no = index;
394398
395399 shost->dma_channel = 0xff;
@@ -481,7 +485,7 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 85 unmodified lines
481485 shost_printk(KERN_WARNING, shost,
482486 "error handler thread failed to spawn, error = %ld\n",
483487 PTR_ERR(shost->ehandler));
484− goto fail_index_remove;
488+ goto fail;
485489 }
486490
487491 shost->tmf_work_q = alloc_workqueue("scsi_tmf_%d",
@@ -490,17 +494,18 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize) · 2 unmodified lines
490494 if (!shost->tmf_work_q) {
491495 shost_printk(KERN_WARNING, shost,
492496 "failed to create tmf workq\n");
493− goto fail_kthread;
497+ goto fail;
494498 }
495499 scsi_proc_hostdir_add(shost->hostt);
496500 return shost;
501+ fail:
502+ /*
503+ * Host state is still SHOST_CREATED and that is enough to release
504+ * ->shost_gendev. scsi_host_dev_release() will free
505+ * dev_name(&shost->shost_dev).
506+ */
507+ put_device(&shost->shost_gendev);
497508
498− fail_kthread:
499− kthread_stop(shost->ehandler);
500− fail_index_remove:
501− ida_simple_remove(&host_index_ida, shost->host_no);
502− fail_kfree:
503− kfree(shost);
504509 return NULL;
505510 }
506511 EXPORT_SYMBOL(scsi_host_alloc);
drivers/scsi/lpfc/lpfc_sli.c+1−3
@@ -20589,10 +20589,8 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, · 20588 unmodified lines
2058920589 abtswqe = &abtsiocb->wqe;
2059020590 memset(abtswqe, 0, sizeof(*abtswqe));
2059120591
20592− if (lpfc_is_link_up(phba))
20592+ if (!lpfc_is_link_up(phba))
2059320593 bf_set(abort_cmd_ia, &abtswqe->abort_cmd, 1);
20594− else
20595− bf_set(abort_cmd_ia, &abtswqe->abort_cmd, 0);
2059620594 bf_set(abort_cmd_criteria, &abtswqe->abort_cmd, T_XRI_TAG);
2059720595 abtswqe->abort_cmd.rsrvd5 = 0;
2059820596 abtswqe->abort_cmd.wqe_com.abort_tag = xritag;
drivers/scsi/qedf/qedf_main.c+9−11
@@ -1827,22 +1827,20 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 1826 unmodified lines
18271827 fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf));
18281828 QEDF_WARN(&(base_qedf->dbg_ctx), "Failed to create vport, "
18291829 "WWPN (0x%s) already exists.\n", buf);
1830− goto err1;
1830+ return rc;
18311831 }
18321832
18331833 if (atomic_read(&base_qedf->link_state) != QEDF_LINK_UP) {
18341834 QEDF_WARN(&(base_qedf->dbg_ctx), "Cannot create vport "
18351835 "because link is not up.\n");
1836− rc = -EIO;
1837− goto err1;
1836+ return -EIO;
18381837 }
18391838
18401839 vn_port = libfc_vport_create(vport, sizeof(struct qedf_ctx));
18411840 if (!vn_port) {
18421841 QEDF_WARN(&(base_qedf->dbg_ctx), "Could not create lport "
18431842 "for vport.\n");
1844− rc = -ENOMEM;
1845− goto err1;
1843+ return -ENOMEM;
18461844 }
18471845
18481846 fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf));
@@ -1866,7 +1864,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 17 unmodified lines
18661864 if (rc) {
18671865 QEDF_ERR(&(base_qedf->dbg_ctx), "Could not allocate memory "
18681866 "for lport stats.\n");
1869− goto err2;
1867+ goto err;
18701868 }
18711869
18721870 fc_set_wwnn(vn_port, vport->node_name);
@@ -1884,7 +1882,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 11 unmodified lines
18841882 if (rc) {
18851883 QEDF_WARN(&base_qedf->dbg_ctx,
18861884 "Error adding Scsi_Host rc=0x%x.\n", rc);
1887− goto err2;
1885+ goto err;
18881886 }
18891887
18901888 /* Set default dev_loss_tmo based on module parameter */
@@ -1925,9 +1923,10 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled) · 34 unmodified lines
19251923 vport_qedf->dbg_ctx.host_no = vn_port->host->host_no;
19261924 vport_qedf->dbg_ctx.pdev = base_qedf->pdev;
19271925
1928−err2:
1926+ return 0;
1927+
1928+err:
19291929 scsi_host_put(vn_port->host);
1930−err1:
19311930 return rc;
19321931 }
19331932
@@ -1968,8 +1967,7 @@ static int qedf_vport_destroy(struct fc_vport *vport) · 34 unmodified lines
19681967 fc_lport_free_stats(vn_port);
19691968
19701969 /* Release Scsi_Host */
1971− if (vn_port->host)
1972− scsi_host_put(vn_port->host);
1970+ scsi_host_put(vn_port->host);
19731971
19741972 out:
19751973 return 0;
drivers/scsi/scsi_devinfo.c+1−0
@@ -184,6 +184,7 @@ static struct { · 183 unmodified lines
184184 {"HP", "C3323-300", "4269", BLIST_NOTQ},
185185 {"HP", "C5713A", NULL, BLIST_NOREPORTLUN},
186186 {"HP", "DISK-SUBSYSTEM", "*", BLIST_REPORTLUN2},
187+ {"HPE", "OPEN-", "*", BLIST_REPORTLUN2 | BLIST_TRY_VPD_PAGES},
187188 {"IBM", "AuSaV1S2", NULL, BLIST_FORCELUN},
188189 {"IBM", "ProFibre 4000R", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
189190 {"IBM", "2105", NULL, BLIST_RETRY_HWERROR},
drivers/scsi/ufs/ufs-mediatek.c+14−1
@@ -603,11 +603,23 @@ static void ufs_mtk_get_controller_version(struct ufs_hba *hba) · 602 unmodified lines
603603
604604 ret = ufshcd_dme_get(hba, UIC_ARG_MIB(PA_LOCALVERINFO), &ver);
605605 if (!ret) {
606− if (ver >= UFS_UNIPRO_VER_1_8)
606+ if (ver >= UFS_UNIPRO_VER_1_8) {
607607 host->hw_ver.major = 3;
608+ /*
609+ * Fix HCI version for some platforms with
610+ * incorrect version
611+ */
612+ if (hba->ufs_version < ufshci_version(3, 0))
613+ hba->ufs_version = ufshci_version(3, 0);
614+ }
608615 }
609616 }
610617
618+static u32 ufs_mtk_get_ufs_hci_version(struct ufs_hba *hba)
619+{
620+ return hba->ufs_version;
621+}
622+
611623 /**
612624 * ufs_mtk_init - find other essential mmio bases
613625 * @hba: host controller instance
@@ -1048,6 +1060,7 @@ static void ufs_mtk_event_notify(struct ufs_hba *hba, · 434 unmodified lines
10481060 static const struct ufs_hba_variant_ops ufs_hba_mtk_vops = {
10491061 .name = "mediatek.ufshci",
10501062 .init = ufs_mtk_init,
1063+ .get_ufs_hci_version = ufs_mtk_get_ufs_hci_version,
10511064 .setup_clocks = ufs_mtk_setup_clocks,
10521065 .hce_enable_notify = ufs_mtk_hce_enable_notify,
10531066 .link_startup_notify = ufs_mtk_link_startup_notify,
drivers/soc/amlogic/meson-clk-measure.c+1−3
@@ -626,10 +626,8 @@ static int meson_msr_probe(struct platform_device *pdev) · 625 unmodified lines
626626
627627 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
628628 base = devm_ioremap_resource(&pdev->dev, res);
629− if (IS_ERR(base)) {
630− dev_err(&pdev->dev, "io resource mapping failed\n");
629+ if (IS_ERR(base))
631630 return PTR_ERR(base);
632− }
633631
634632 priv->regmap = devm_regmap_init_mmio(&pdev->dev, base,
635633 &meson_clk_msr_regmap_config);
drivers/spi/spi-bcm2835.c+8−2
@@ -68,7 +68,7 @@ · 67 unmodified lines
6868 #define BCM2835_SPI_FIFO_SIZE 64
6969 #define BCM2835_SPI_FIFO_SIZE_3_4 48
7070 #define BCM2835_SPI_DMA_MIN_LENGTH 96
71−#define BCM2835_SPI_NUM_CS 4 /* raise as necessary */
71+#define BCM2835_SPI_NUM_CS 24 /* raise as necessary */
7272 #define BCM2835_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
7373 | SPI_NO_CS | SPI_3WIRE)
7474
@@ -1195,6 +1195,12 @@ static int bcm2835_spi_setup(struct spi_device *spi) · 1120 unmodified lines
11951195 struct gpio_chip *chip;
11961196 u32 cs;
11971197
1198+ if (spi->chip_select >= BCM2835_SPI_NUM_CS) {
1199+ dev_err(&spi->dev, "only %d chip-selects supported\n",
1200+ BCM2835_SPI_NUM_CS - 1);
1201+ return -EINVAL;
1202+ }
1203+
11981204 /*
11991205 * Precalculate SPI slave's CS register value for ->prepare_message():
12001206 * The driver always uses software-controlled GPIO chip select, hence
@@ -1288,7 +1294,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev) · 87 unmodified lines
12881294 ctlr->use_gpio_descriptors = true;
12891295 ctlr->mode_bits = BCM2835_SPI_MODE_BITS;
12901296 ctlr->bits_per_word_mask = SPI_BPW_MASK(8);
1291− ctlr->num_chipselect = BCM2835_SPI_NUM_CS;
1297+ ctlr->num_chipselect = 3;
12921298 ctlr->setup = bcm2835_spi_setup;
12931299 ctlr->transfer_one = bcm2835_spi_transfer_one;
12941300 ctlr->handle_err = bcm2835_spi_handle_err;
drivers/spi/spi-bitbang.c+14−4
@@ -184,6 +184,8 @@ int spi_bitbang_setup(struct spi_device *spi) · 183 unmodified lines
184184 {
185185 struct spi_bitbang_cs *cs = spi->controller_state;
186186 struct spi_bitbang *bitbang;
187+ bool initial_setup = false;
188+ int retval;
187189
188190 bitbang = spi_master_get_devdata(spi->master);
189191
@@ -192,22 +194,30 @@ int spi_bitbang_setup(struct spi_device *spi) · 2 unmodified lines
192194 if (!cs)
193195 return -ENOMEM;
194196 spi->controller_state = cs;
197+ initial_setup = true;
195198 }
196199
197200 /* per-word shift register access, in hardware or bitbanging */
198201 cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)];
199− if (!cs->txrx_word)
200− return -EINVAL;
202+ if (!cs->txrx_word) {
203+ retval = -EINVAL;
204+ goto err_free;
205+ }
201206
202207 if (bitbang->setup_transfer) {
203− int retval = bitbang->setup_transfer(spi, NULL);
208+ retval = bitbang->setup_transfer(spi, NULL);
204209 if (retval < 0)
205− return retval;
210+ goto err_free;
206211 }
207212
208213 dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs);
209214
210215 return 0;
216+
217+err_free:
218+ if (initial_setup)
219+ kfree(cs);
220+ return retval;
211221 }
212222 EXPORT_SYMBOL_GPL(spi_bitbang_setup);
213223
drivers/spi/spi-fsl-spi.c+4−0
@@ -440,6 +440,7 @@ static int fsl_spi_setup(struct spi_device *spi) · 439 unmodified lines
440440 {
441441 struct mpc8xxx_spi *mpc8xxx_spi;
442442 struct fsl_spi_reg __iomem *reg_base;
443+ bool initial_setup = false;
443444 int retval;
444445 u32 hw_mode;
445446 struct spi_mpc8xxx_cs *cs = spi_get_ctldata(spi);
@@ -452,6 +453,7 @@ static int fsl_spi_setup(struct spi_device *spi) · 6 unmodified lines
452453 if (!cs)
453454 return -ENOMEM;
454455 spi_set_ctldata(spi, cs);
456+ initial_setup = true;
455457 }
456458 mpc8xxx_spi = spi_master_get_devdata(spi->master);
457459
@@ -475,6 +477,8 @@ static int fsl_spi_setup(struct spi_device *spi) · 17 unmodified lines
475477 retval = fsl_spi_setup_transfer(spi, NULL);
476478 if (retval < 0) {
477479 cs->hw_mode = hw_mode; /* Restore settings */
480+ if (initial_setup)
481+ kfree(cs);
478482 return retval;
479483 }
480484
drivers/spi/spi-omap-uwire.c+8−1
@@ -424,15 +424,22 @@ done: · 423 unmodified lines
424424 static int uwire_setup(struct spi_device *spi)
425425 {
426426 struct uwire_state *ust = spi->controller_state;
427+ bool initial_setup = false;
428+ int status;
427429
428430 if (ust == NULL) {
429431 ust = kzalloc(sizeof(*ust), GFP_KERNEL);
430432 if (ust == NULL)
431433 return -ENOMEM;
432434 spi->controller_state = ust;
435+ initial_setup = true;
433436 }
434437
435− return uwire_setup_transfer(spi, NULL);
438+ status = uwire_setup_transfer(spi, NULL);
439+ if (status && initial_setup)
440+ kfree(ust);
441+
442+ return status;
436443 }
437444
438445 static void uwire_cleanup(struct spi_device *spi)
drivers/spi/spi-omap2-mcspi.c+20−13
@@ -1032,8 +1032,22 @@ static void omap2_mcspi_release_dma(struct spi_master *master) · 1031 unmodified lines
10321032 }
10331033 }
10341034
1035+static void omap2_mcspi_cleanup(struct spi_device *spi)
1036+{
1037+ struct omap2_mcspi_cs *cs;
1038+
1039+ if (spi->controller_state) {
1040+ /* Unlink controller state from context save list */
1041+ cs = spi->controller_state;
1042+ list_del(&cs->node);
1043+
1044+ kfree(cs);
1045+ }
1046+}
1047+
10351048 static int omap2_mcspi_setup(struct spi_device *spi)
10361049 {
1050+ bool initial_setup = false;
10371051 int ret;
10381052 struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master);
10391053 struct omap2_mcspi_regs *ctx = &mcspi->ctx;
@@ -1051,35 +1065,28 @@ static int omap2_mcspi_setup(struct spi_device *spi) · 11 unmodified lines
10511065 spi->controller_state = cs;
10521066 /* Link this to context save list */
10531067 list_add_tail(&cs->node, &ctx->cs);
1068+ initial_setup = true;
10541069 }
10551070
10561071 ret = pm_runtime_get_sync(mcspi->dev);
10571072 if (ret < 0) {
10581073 pm_runtime_put_noidle(mcspi->dev);
1074+ if (initial_setup)
1075+ omap2_mcspi_cleanup(spi);
10591076
10601077 return ret;
10611078 }
10621079
10631080 ret = omap2_mcspi_setup_transfer(spi, NULL);
1081+ if (ret && initial_setup)
1082+ omap2_mcspi_cleanup(spi);
1083+
10641084 pm_runtime_mark_last_busy(mcspi->dev);
10651085 pm_runtime_put_autosuspend(mcspi->dev);
10661086
10671087 return ret;
10681088 }
10691089
1070−static void omap2_mcspi_cleanup(struct spi_device *spi)
1071−{
1072− struct omap2_mcspi_cs *cs;
1073−
1074− if (spi->controller_state) {
1075− /* Unlink controller state from context save list */
1076− cs = spi->controller_state;
1077− list_del(&cs->node);
1078−
1079− kfree(cs);
1080− }
1081−}
1082−
10831090 static irqreturn_t omap2_mcspi_irq_handler(int irq, void *data)
10841091 {
10851092 struct omap2_mcspi *mcspi = data;
drivers/spi/spi-pxa2xx.c+8−1
@@ -1254,6 +1254,8 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip, · 1253 unmodified lines
12541254 chip->gpio_cs_inverted = spi->mode & SPI_CS_HIGH;
12551255
12561256 err = gpiod_direction_output(gpiod, !chip->gpio_cs_inverted);
1257+ if (err)
1258+ gpiod_put(chip->gpiod_cs);
12571259 }
12581260
12591261 return err;
@@ -1267,6 +1269,7 @@ static int setup(struct spi_device *spi) · 7 unmodified lines
12671269 struct driver_data *drv_data =
12681270 spi_controller_get_devdata(spi->controller);
12691271 uint tx_thres, tx_hi_thres, rx_thres;
1272+ int err;
12701273
12711274 switch (drv_data->ssp_type) {
12721275 case QUARK_X1000_SSP:
@@ -1413,7 +1416,11 @@ static int setup(struct spi_device *spi) · 140 unmodified lines
14131416 if (drv_data->ssp_type == CE4100_SSP)
14141417 return 0;
14151418
1416− return setup_cs(spi, chip, chip_info);
1419+ err = setup_cs(spi, chip, chip_info);
1420+ if (err)
1421+ kfree(chip);
1422+
1423+ return err;
14171424 }
14181425
14191426 static void cleanup(struct spi_device *spi)
drivers/spi/spi-stm32-qspi.c+4−1
@@ -294,7 +294,7 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, · 293 unmodified lines
294294 int err = 0;
295295
296296 if (!op->data.nbytes)
297− return stm32_qspi_wait_nobusy(qspi);
297+ goto wait_nobusy;
298298
299299 if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF)
300300 goto out;
@@ -315,6 +315,9 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi, · 14 unmodified lines
315315 out:
316316 /* clear flags */
317317 writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR);
318+wait_nobusy:
319+ if (!err)
320+ err = stm32_qspi_wait_nobusy(qspi);
318321
319322 return err;
320323 }
drivers/spi/spi-zynq-qspi.c+4−3
@@ -678,14 +678,14 @@ static int zynq_qspi_probe(struct platform_device *pdev) · 677 unmodified lines
678678 xqspi->irq = platform_get_irq(pdev, 0);
679679 if (xqspi->irq <= 0) {
680680 ret = -ENXIO;
681− goto remove_master;
681+ goto clk_dis_all;
682682 }
683683 ret = devm_request_irq(&pdev->dev, xqspi->irq, zynq_qspi_irq,
684684 0, pdev->name, xqspi);
685685 if (ret != 0) {
686686 ret = -ENXIO;
687687 dev_err(&pdev->dev, "request_irq failed\n");
688− goto remove_master;
688+ goto clk_dis_all;
689689 }
690690
691691 ret = of_property_read_u32(np, "num-cs",
@@ -693,8 +693,9 @@ static int zynq_qspi_probe(struct platform_device *pdev) · 1 unmodified line
693693 if (ret < 0) {
694694 ctlr->num_chipselect = 1;
695695 } else if (num_cs > ZYNQ_QSPI_MAX_NUM_CS) {
696+ ret = -EINVAL;
696697 dev_err(&pdev->dev, "only 2 chip selects are available\n");
697− goto remove_master;
698+ goto clk_dis_all;
698699 } else {
699700 ctlr->num_chipselect = num_cs;
700701 }
drivers/staging/ralink-gdma/ralink-gdma.c+0−2
@@ -1,6 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0+
22 /*
3− * Copyright (C) 2013, Lars-Peter Clausen <lars@metafoo.de>
43 * GDMA4740 DMAC support
54 */
65
@@ -914,6 +913,5 @@ static struct platform_driver gdma_dma_driver = { · 907 unmodified lines
914913 };
915914 module_platform_driver(gdma_dma_driver);
916915
917−MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
918916 MODULE_DESCRIPTION("Ralink/MTK DMA driver");
919917 MODULE_LICENSE("GPL v2");
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c+1−1
@@ -2091,7 +2091,7 @@ void rtw_cfg80211_indicate_sta_assoc(struct adapter *padapter, u8 *pmgmt_frame, · 2090 unmodified lines
20912091 struct net_device *ndev = padapter->pnetdev;
20922092
20932093 {
2094− struct station_info sinfo;
2094+ struct station_info sinfo = {};
20952095 u8 ie_offset;
20962096 if (GetFrameSubType(pmgmt_frame) == WIFI_ASSOCREQ)
20972097 ie_offset = _ASOCREQ_IE_OFFSET_;
drivers/target/target_core_transport.c+1−3
@@ -3121,9 +3121,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, · 3120 unmodified lines
31213121 __releases(&cmd->t_state_lock)
31223122 __acquires(&cmd->t_state_lock)
31233123 {
3124−
3125− assert_spin_locked(&cmd->t_state_lock);
3126− WARN_ON_ONCE(!irqs_disabled());
3124+ lockdep_assert_held(&cmd->t_state_lock);
31273125
31283126 if (fabric_stop)
31293127 cmd->transport_state |= CMD_T_FABRIC_STOP;
drivers/tee/optee/call.c+4−2
@@ -220,6 +220,7 @@ int optee_open_session(struct tee_context *ctx, · 219 unmodified lines
220220 struct optee_msg_arg *msg_arg;
221221 phys_addr_t msg_parg;
222222 struct optee_session *sess = NULL;
223+ uuid_t client_uuid;
223224
224225 /* +2 for the meta parameters added below */
225226 shm = get_msg_arg(ctx, arg->num_params + 2, &msg_arg, &msg_parg);
@@ -240,10 +241,11 @@ int optee_open_session(struct tee_context *ctx, · 14 unmodified lines
240241 memcpy(&msg_arg->params[0].u.value, arg->uuid, sizeof(arg->uuid));
241242 msg_arg->params[1].u.value.c = arg->clnt_login;
242243
243− rc = tee_session_calc_client_uuid((uuid_t *)&msg_arg->params[1].u.value,
244− arg->clnt_login, arg->clnt_uuid);
244+ rc = tee_session_calc_client_uuid(&client_uuid, arg->clnt_login,
245+ arg->clnt_uuid);
245246 if (rc)
246247 goto out;
248+ export_uuid(msg_arg->params[1].u.octets, &client_uuid);
247249
248250 rc = optee_to_msg_param(msg_arg->params + 2, arg->num_params, param);
249251 if (rc)
drivers/tee/optee/optee_msg.h+4−2
@@ -9,7 +9,7 @@ · 8 unmodified lines
99 #include <linux/types.h>
1010
1111 /*
12− * This file defines the OP-TEE message protocol used to communicate
12+ * This file defines the OP-TEE message protocol (ABI) used to communicate
1313 * with an instance of OP-TEE running in secure world.
1414 *
1515 * This file is divided into two sections.
@@ -144,9 +144,10 @@ struct optee_msg_param_value { · 128 unmodified lines
144144 * @tmem: parameter by temporary memory reference
145145 * @rmem: parameter by registered memory reference
146146 * @value: parameter by opaque value
147+ * @octets: parameter by octet string
147148 *
148149 * @attr & OPTEE_MSG_ATTR_TYPE_MASK indicates if tmem, rmem or value is used in
149− * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value,
150+ * the union. OPTEE_MSG_ATTR_TYPE_VALUE_* indicates value or octets,
150151 * OPTEE_MSG_ATTR_TYPE_TMEM_* indicates @tmem and
151152 * OPTEE_MSG_ATTR_TYPE_RMEM_* indicates @rmem,
152153 * OPTEE_MSG_ATTR_TYPE_NONE indicates that none of the members are used.
@@ -157,6 +158,7 @@ struct optee_msg_param { · 4 unmodified lines
157158 struct optee_msg_param_tmem tmem;
158159 struct optee_msg_param_rmem rmem;
159160 struct optee_msg_param_value value;
161+ u8 octets[24];
160162 } u;
161163 };
162164
drivers/thermal/intel/therm_throt.c+11−4
@@ -621,6 +621,17 @@ bool x86_thermal_enabled(void) · 620 unmodified lines
621621 return atomic_read(&therm_throt_en);
622622 }
623623
624+void __init therm_lvt_init(void)
625+{
626+ /*
627+ * This function is only called on boot CPU. Save the init thermal
628+ * LVT value on BSP and use that value to restore APs' thermal LVT
629+ * entry BIOS programmed later
630+ */
631+ if (intel_thermal_supported(&boot_cpu_data))
632+ lvtthmr_init = apic_read(APIC_LVTTHMR);
633+}
634+
624635 void intel_init_thermal(struct cpuinfo_x86 *c)
625636 {
626637 unsigned int cpu = smp_processor_id();
@@ -630,10 +641,6 @@ void intel_init_thermal(struct cpuinfo_x86 *c) · 3 unmodified lines
630641 if (!intel_thermal_supported(c))
631642 return;
632643
633− /* On the BSP? */
634− if (c == &boot_cpu_data)
635− lvtthmr_init = apic_read(APIC_LVTTHMR);
636−
637644 /*
638645 * First check if its enabled already, in which case there might
639646 * be some SMM goo which handles it, so we can't even put a handler
drivers/tty/serial/8250/8250_exar.c+5−1
@@ -553,7 +553,11 @@ static void pci_xr17v35x_exit(struct pci_dev *pcidev) · 552 unmodified lines
553553 {
554554 struct exar8250 *priv = pci_get_drvdata(pcidev);
555555 struct uart_8250_port *port = serial8250_get_port(priv->line[0]);
556− struct platform_device *pdev = port->port.private_data;
556+ struct platform_device *pdev;
557+
558+ pdev = port->port.private_data;
559+ if (!pdev)
560+ return;
557561
558562 device_remove_software_node(&pdev->dev);
559563 platform_device_unregister(pdev);
drivers/usb/cdns3/cdns3-gadget.c+3−5
@@ -2007,7 +2007,7 @@ static void cdns3_configure_dmult(struct cdns3_device *priv_dev, · 2006 unmodified lines
20072007 else
20082008 mask = BIT(priv_ep->num);
20092009
2010− if (priv_ep->type != USB_ENDPOINT_XFER_ISOC) {
2010+ if (priv_ep->type != USB_ENDPOINT_XFER_ISOC && !priv_ep->dir) {
20112011 cdns3_set_register_bit(&regs->tdl_from_trb, mask);
20122012 cdns3_set_register_bit(&regs->tdl_beh, mask);
20132013 cdns3_set_register_bit(&regs->tdl_beh2, mask);
@@ -2046,15 +2046,13 @@ int cdns3_ep_config(struct cdns3_endpoint *priv_ep, bool enable) · 32 unmodified lines
20462046 case USB_ENDPOINT_XFER_INT:
20472047 ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_INT);
20482048
2049− if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
2050− priv_dev->dev_ver > DEV_VER_V2)
2049+ if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
20512050 ep_cfg |= EP_CFG_TDL_CHK;
20522051 break;
20532052 case USB_ENDPOINT_XFER_BULK:
20542053 ep_cfg = EP_CFG_EPTYPE(USB_ENDPOINT_XFER_BULK);
20552054
2056− if ((priv_dev->dev_ver == DEV_VER_V2 && !priv_ep->dir) ||
2057− priv_dev->dev_ver > DEV_VER_V2)
2055+ if (priv_dev->dev_ver >= DEV_VER_V2 && !priv_ep->dir)
20582056 ep_cfg |= EP_CFG_TDL_CHK;
20592057 break;
20602058 default:
drivers/usb/cdns3/cdnsp-ring.c+4−3
@@ -1517,13 +1517,14 @@ irqreturn_t cdnsp_thread_irq_handler(int irq, void *data) · 1516 unmodified lines
15171517 {
15181518 struct cdnsp_device *pdev = (struct cdnsp_device *)data;
15191519 union cdnsp_trb *event_ring_deq;
1520+ unsigned long flags;
15201521 int counter = 0;
15211522
1522− spin_lock(&pdev->lock);
1523+ spin_lock_irqsave(&pdev->lock, flags);
15231524
15241525 if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) {
15251526 cdnsp_died(pdev);
1526− spin_unlock(&pdev->lock);
1527+ spin_unlock_irqrestore(&pdev->lock, flags);
15271528 return IRQ_HANDLED;
15281529 }
15291530
@@ -1539,7 +1540,7 @@ irqreturn_t cdnsp_thread_irq_handler(int irq, void *data) · 9 unmodified lines
15391540
15401541 cdnsp_update_erst_dequeue(pdev, event_ring_deq, 1);
15411542
1542− spin_unlock(&pdev->lock);
1543+ spin_unlock_irqrestore(&pdev->lock, flags);
15431544
15441545 return IRQ_HANDLED;
15451546 }
drivers/usb/dwc3/core.c+0−6
@@ -1690,11 +1690,6 @@ static int dwc3_remove(struct platform_device *pdev) · 1689 unmodified lines
16901690 return 0;
16911691 }
16921692
1693−static void dwc3_shutdown(struct platform_device *pdev)
1694−{
1695− dwc3_remove(pdev);
1696−}
1697−
16981693 #ifdef CONFIG_PM
16991694 static int dwc3_core_init_for_resume(struct dwc3 *dwc)
17001695 {
@@ -2012,7 +2007,6 @@ MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match); · 311 unmodified lines
20122007 static struct platform_driver dwc3_driver = {
20132008 .probe = dwc3_probe,
20142009 .remove = dwc3_remove,
2015− .shutdown = dwc3_shutdown,
20162010 .driver = {
20172011 .name = "dwc3",
20182012 .of_match_table = of_match_ptr(of_dwc3_match),
drivers/usb/dwc3/debug.h+3−0
@@ -413,9 +413,12 @@ static inline const char *dwc3_gadget_generic_cmd_status_string(int status) · 412 unmodified lines
413413
414414
415415 #ifdef CONFIG_DEBUG_FS
416+extern void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep);
416417 extern void dwc3_debugfs_init(struct dwc3 *d);
417418 extern void dwc3_debugfs_exit(struct dwc3 *d);
418419 #else
420+static inline void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep)
421+{ }
419422 static inline void dwc3_debugfs_init(struct dwc3 *d)
420423 { }
421424 static inline void dwc3_debugfs_exit(struct dwc3 *d)
drivers/usb/dwc3/debugfs.c+2−19
@@ -886,30 +886,14 @@ static void dwc3_debugfs_create_endpoint_files(struct dwc3_ep *dep, · 885 unmodified lines
886886 }
887887 }
888888
889−static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep,
890− struct dentry *parent)
889+void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep)
891890 {
892891 struct dentry *dir;
893892
894− dir = debugfs_create_dir(dep->name, parent);
893+ dir = debugfs_create_dir(dep->name, dep->dwc->root);
895894 dwc3_debugfs_create_endpoint_files(dep, dir);
896895 }
897896
898−static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc,
899− struct dentry *parent)
900−{
901− int i;
902−
903− for (i = 0; i < dwc->num_eps; i++) {
904− struct dwc3_ep *dep = dwc->eps[i];
905−
906− if (!dep)
907− continue;
908−
909− dwc3_debugfs_create_endpoint_dir(dep, parent);
910− }
911−}
912−
913897 void dwc3_debugfs_init(struct dwc3 *dwc)
914898 {
915899 struct dentry *root;
@@ -940,7 +924,6 @@ void dwc3_debugfs_init(struct dwc3 *dwc) · 24 unmodified lines
940924 &dwc3_testmode_fops);
941925 debugfs_create_file("link_state", 0644, root, dwc,
942926 &dwc3_link_state_fops);
943− dwc3_debugfs_create_endpoint_dirs(dwc, root);
944927 }
945928 }
946929
drivers/usb/dwc3/dwc3-meson-g12a.c+10−3
@@ -651,7 +651,7 @@ static int dwc3_meson_g12a_setup_regmaps(struct dwc3_meson_g12a *priv, · 650 unmodified lines
651651 return PTR_ERR(priv->usb_glue_regmap);
652652
653653 /* Create a regmap for each USB2 PHY control register set */
654− for (i = 0; i < priv->usb2_ports; i++) {
654+ for (i = 0; i < priv->drvdata->num_phys; i++) {
655655 struct regmap_config u2p_regmap_config = {
656656 .reg_bits = 8,
657657 .val_bits = 32,
@@ -659,6 +659,9 @@ static int dwc3_meson_g12a_setup_regmaps(struct dwc3_meson_g12a *priv, · 1 unmodified line
659659 .max_register = U2P_R1,
660660 };
661661
662+ if (!strstr(priv->drvdata->phy_names[i], "usb2"))
663+ continue;
664+
662665 u2p_regmap_config.name = devm_kasprintf(priv->dev, GFP_KERNEL,
663666 "u2p-%d", i);
664667 if (!u2p_regmap_config.name)
@@ -772,13 +775,13 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) · 107 unmodified lines
772775
773776 ret = priv->drvdata->usb_init(priv);
774777 if (ret)
775− goto err_disable_clks;
778+ goto err_disable_regulator;
776779
777780 /* Init PHYs */
778781 for (i = 0 ; i < PHY_COUNT ; ++i) {
779782 ret = phy_init(priv->phys[i]);
780783 if (ret)
781− goto err_disable_clks;
784+ goto err_disable_regulator;
782785 }
783786
784787 /* Set PHY Power */
@@ -816,6 +819,10 @@ err_phys_exit: · 31 unmodified lines
816819 for (i = 0 ; i < PHY_COUNT ; ++i)
817820 phy_exit(priv->phys[i]);
818821
822+err_disable_regulator:
823+ if (priv->vbus)
824+ regulator_disable(priv->vbus);
825+
819826 err_disable_clks:
820827 clk_bulk_disable_unprepare(priv->drvdata->num_clks,
821828 priv->drvdata->clks);
drivers/usb/dwc3/ep0.c+3−0
@@ -292,6 +292,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le) · 291 unmodified lines
292292 epnum |= 1;
293293
294294 dep = dwc->eps[epnum];
295+ if (dep == NULL)
296+ return NULL;
297+
295298 if (dep->flags & DWC3_EP_ENABLED)
296299 return dep;
297300
drivers/usb/dwc3/gadget.c+12−6
@@ -2261,13 +2261,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 2260 unmodified lines
22612261 }
22622262
22632263 /*
2264− * Synchronize any pending event handling before executing the controller
2265− * halt routine.
2264+ * Synchronize and disable any further event handling while controller
2265+ * is being enabled/disabled.
22662266 */
2267− if (!is_on) {
2268− dwc3_gadget_disable_irq(dwc);
2269− synchronize_irq(dwc->irq_gadget);
2270− }
2267+ disable_irq(dwc->irq_gadget);
22712268
22722269 spin_lock_irqsave(&dwc->lock, flags);
22732270
@@ -2305,6 +2302,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 31 unmodified lines
23052302
23062303 ret = dwc3_gadget_run_stop(dwc, is_on, false);
23072304 spin_unlock_irqrestore(&dwc->lock, flags);
2305+ enable_irq(dwc->irq_gadget);
2306+
23082307 pm_runtime_put(dwc->dev);
23092308
23102309 return ret;
@@ -2754,6 +2753,8 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) · 443 unmodified lines
27542753 INIT_LIST_HEAD(&dep->started_list);
27552754 INIT_LIST_HEAD(&dep->cancelled_list);
27562755
2756+ dwc3_debugfs_create_endpoint_dir(dep);
2757+
27572758 return 0;
27582759 }
27592760
@@ -2797,6 +2798,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) · 37 unmodified lines
27972798 list_del(&dep->endpoint.ep_list);
27982799 }
27992800
2801+ debugfs_remove_recursive(debugfs_lookup(dep->name, dwc->root));
28002802 kfree(dep);
28012803 }
28022804 }
@@ -4046,6 +4048,7 @@ err5: · 1243 unmodified lines
40464048 dwc3_gadget_free_endpoints(dwc);
40474049 err4:
40484050 usb_put_gadget(dwc->gadget);
4051+ dwc->gadget = NULL;
40494052 err3:
40504053 dma_free_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc->bounce,
40514054 dwc->bounce_addr);
@@ -4065,6 +4068,9 @@ err0: · 13 unmodified lines
40654068
40664069 void dwc3_gadget_exit(struct dwc3 *dwc)
40674070 {
4071+ if (!dwc->gadget)
4072+ return;
4073+
40684074 usb_del_gadget(dwc->gadget);
40694075 dwc3_gadget_free_endpoints(dwc);
40704076 usb_put_gadget(dwc->gadget);
drivers/usb/gadget/config.c+8−0
@@ -164,6 +164,14 @@ int usb_assign_descriptors(struct usb_function *f, · 163 unmodified lines
164164 {
165165 struct usb_gadget *g = f->config->cdev->gadget;
166166
167+ /* super-speed-plus descriptor falls back to super-speed one,
168+ * if such a descriptor was provided, thus avoiding a NULL
169+ * pointer dereference if a 5gbps capable gadget is used with
170+ * a 10gbps capable config (device port + cable + host port)
171+ */
172+ if (!ssp)
173+ ssp = ss;
174+
167175 if (fs) {
168176 f->fs_descriptors = usb_copy_descriptors(fs);
169177 if (!f->fs_descriptors)
drivers/usb/gadget/function/f_ecm.c+1−1
@@ -791,7 +791,7 @@ ecm_bind(struct usb_configuration *c, struct usb_function *f) · 790 unmodified lines
791791 fs_ecm_notify_desc.bEndpointAddress;
792792
793793 status = usb_assign_descriptors(f, ecm_fs_function, ecm_hs_function,
794− ecm_ss_function, NULL);
794+ ecm_ss_function, ecm_ss_function);
795795 if (status)
796796 goto fail;
797797
drivers/usb/gadget/function/f_eem.c+3−3
@@ -302,7 +302,7 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) · 301 unmodified lines
302302 eem_ss_out_desc.bEndpointAddress = eem_fs_out_desc.bEndpointAddress;
303303
304304 status = usb_assign_descriptors(f, eem_fs_function, eem_hs_function,
305− eem_ss_function, NULL);
305+ eem_ss_function, eem_ss_function);
306306 if (status)
307307 goto fail;
308308
@@ -495,7 +495,7 @@ static int eem_unwrap(struct gether *port, · 186 unmodified lines
495495 skb2 = skb_clone(skb, GFP_ATOMIC);
496496 if (unlikely(!skb2)) {
497497 DBG(cdev, "unable to unframe EEM packet\n");
498− continue;
498+ goto next;
499499 }
500500 skb_trim(skb2, len - ETH_FCS_LEN);
501501
@@ -505,7 +505,7 @@ static int eem_unwrap(struct gether *port, · 3 unmodified lines
505505 GFP_ATOMIC);
506506 if (unlikely(!skb3)) {
507507 dev_kfree_skb_any(skb2);
508− continue;
508+ goto next;
509509 }
510510 dev_kfree_skb_any(skb2);
511511 skb_queue_tail(list, skb3);
drivers/usb/gadget/function/f_fs.c+3−0
@@ -3567,6 +3567,9 @@ static void ffs_func_unbind(struct usb_configuration *c, · 3566 unmodified lines
35673567 ffs->func = NULL;
35683568 }
35693569
3570+ /* Drain any pending AIO completions */
3571+ drain_workqueue(ffs->io_completion_wq);
3572+
35703573 if (!--opts->refcnt)
35713574 functionfs_unbind(ffs);
35723575
drivers/usb/gadget/function/f_hid.c+2−1
@@ -802,7 +802,8 @@ static int hidg_bind(struct usb_configuration *c, struct usb_function *f) · 801 unmodified lines
802802 hidg_fs_out_ep_desc.bEndpointAddress;
803803
804804 status = usb_assign_descriptors(f, hidg_fs_descriptors,
805− hidg_hs_descriptors, hidg_ss_descriptors, NULL);
805+ hidg_hs_descriptors, hidg_ss_descriptors,
806+ hidg_ss_descriptors);
806807 if (status)
807808 goto fail;
808809
drivers/usb/gadget/function/f_loopback.c+1−1
@@ -207,7 +207,7 @@ autoconf_fail: · 206 unmodified lines
207207 ss_loop_sink_desc.bEndpointAddress = fs_loop_sink_desc.bEndpointAddress;
208208
209209 ret = usb_assign_descriptors(f, fs_loopback_descs, hs_loopback_descs,
210− ss_loopback_descs, NULL);
210+ ss_loopback_descs, ss_loopback_descs);
211211 if (ret)
212212 return ret;
213213
drivers/usb/gadget/function/f_ncm.c+5−5
@@ -583,7 +583,7 @@ static void ncm_do_notify(struct f_ncm *ncm) · 582 unmodified lines
583583 data[0] = cpu_to_le32(ncm_bitrate(cdev->gadget));
584584 data[1] = data[0];
585585
586− DBG(cdev, "notify speed %d\n", ncm_bitrate(cdev->gadget));
586+ DBG(cdev, "notify speed %u\n", ncm_bitrate(cdev->gadget));
587587 ncm->notify_state = NCM_NOTIFY_CONNECT;
588588 break;
589589 }
@@ -1101,11 +1101,11 @@ static struct sk_buff *ncm_wrap_ntb(struct gether *port, · 511 unmodified lines
11011101 ncm->ndp_dgram_count = 1;
11021102
11031103 /* Note: we skip opts->next_ndp_index */
1104− }
11051104
1106− /* Delay the timer. */
1107− hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS,
1108− HRTIMER_MODE_REL_SOFT);
1105+ /* Start the timer. */
1106+ hrtimer_start(&ncm->task_timer, TX_TIMEOUT_NSECS,
1107+ HRTIMER_MODE_REL_SOFT);
1108+ }
11091109
11101110 /* Add the datagram position entries */
11111111 ntb_ndp = skb_put_zero(ncm->skb_tx_ndp, dgram_idx_len);
drivers/usb/gadget/function/f_printer.c+2−1
@@ -1101,7 +1101,8 @@ autoconf_fail: · 1100 unmodified lines
11011101 ss_ep_out_desc.bEndpointAddress = fs_ep_out_desc.bEndpointAddress;
11021102
11031103 ret = usb_assign_descriptors(f, fs_printer_function,
1104− hs_printer_function, ss_printer_function, NULL);
1104+ hs_printer_function, ss_printer_function,
1105+ ss_printer_function);
11051106 if (ret)
11061107 return ret;
11071108
drivers/usb/gadget/function/f_rndis.c+1−1
@@ -789,7 +789,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) · 788 unmodified lines
789789 ss_notify_desc.bEndpointAddress = fs_notify_desc.bEndpointAddress;
790790
791791 status = usb_assign_descriptors(f, eth_fs_function, eth_hs_function,
792− eth_ss_function, NULL);
792+ eth_ss_function, eth_ss_function);
793793 if (status)
794794 goto fail;
795795
drivers/usb/gadget/function/f_serial.c+1−1
@@ -233,7 +233,7 @@ static int gser_bind(struct usb_configuration *c, struct usb_function *f) · 232 unmodified lines
233233 gser_ss_out_desc.bEndpointAddress = gser_fs_out_desc.bEndpointAddress;
234234
235235 status = usb_assign_descriptors(f, gser_fs_function, gser_hs_function,
236− gser_ss_function, NULL);
236+ gser_ss_function, gser_ss_function);
237237 if (status)
238238 goto fail;
239239 dev_dbg(&cdev->gadget->dev, "generic ttyGS%d: %s speed IN/%s OUT/%s\n",
drivers/usb/gadget/function/f_sourcesink.c+2−1
@@ -431,7 +431,8 @@ no_iso: · 430 unmodified lines
431431 ss_iso_sink_desc.bEndpointAddress = fs_iso_sink_desc.bEndpointAddress;
432432
433433 ret = usb_assign_descriptors(f, fs_source_sink_descs,
434− hs_source_sink_descs, ss_source_sink_descs, NULL);
434+ hs_source_sink_descs, ss_source_sink_descs,
435+ ss_source_sink_descs);
435436 if (ret)
436437 return ret;
437438
drivers/usb/gadget/function/f_subset.c+1−1
@@ -358,7 +358,7 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) · 357 unmodified lines
358358 fs_subset_out_desc.bEndpointAddress;
359359
360360 status = usb_assign_descriptors(f, fs_eth_function, hs_eth_function,
361− ss_eth_function, NULL);
361+ ss_eth_function, ss_eth_function);
362362 if (status)
363363 goto fail;
364364
drivers/usb/gadget/function/f_tcm.c+2−1
@@ -2057,7 +2057,8 @@ static int tcm_bind(struct usb_configuration *c, struct usb_function *f) · 2056 unmodified lines
20572057 uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress;
20582058
20592059 ret = usb_assign_descriptors(f, uasp_fs_function_desc,
2060− uasp_hs_function_desc, uasp_ss_function_desc, NULL);
2060+ uasp_hs_function_desc, uasp_ss_function_desc,
2061+ uasp_ss_function_desc);
20612062 if (ret)
20622063 goto ep_fail;
20632064
drivers/usb/host/xhci-pci.c+6−1
@@ -59,6 +59,7 @@ · 58 unmodified lines
5959 #define PCI_DEVICE_ID_INTEL_MAPLE_RIDGE_XHCI 0x1138
6060 #define PCI_DEVICE_ID_INTEL_ALDER_LAKE_XHCI 0x461e
6161
62+#define PCI_DEVICE_ID_AMD_RENOIR_XHCI 0x1639
6263 #define PCI_DEVICE_ID_AMD_PROMONTORYA_4 0x43b9
6364 #define PCI_DEVICE_ID_AMD_PROMONTORYA_3 0x43ba
6465 #define PCI_DEVICE_ID_AMD_PROMONTORYA_2 0x43bb
@@ -182,6 +183,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) · 117 unmodified lines
182183 (pdev->device == PCI_DEVICE_ID_AMD_PROMONTORYA_1)))
183184 xhci->quirks |= XHCI_U2_DISABLE_WAKE;
184185
186+ if (pdev->vendor == PCI_VENDOR_ID_AMD &&
187+ pdev->device == PCI_DEVICE_ID_AMD_RENOIR_XHCI)
188+ xhci->quirks |= XHCI_BROKEN_D3COLD;
189+
185190 if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
186191 xhci->quirks |= XHCI_LPM_SUPPORT;
187192 xhci->quirks |= XHCI_INTEL_HOST;
@@ -539,7 +544,7 @@ static int xhci_pci_suspend(struct usb_hcd *hcd, bool do_wakeup) · 351 unmodified lines
539544 * Systems with the TI redriver that loses port status change events
540545 * need to have the registers polled during D3, so avoid D3cold.
541546 */
542− if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
547+ if (xhci->quirks & (XHCI_COMP_MODE_QUIRK | XHCI_BROKEN_D3COLD))
543548 pci_d3cold_disable(pdev);
544549
545550 if (xhci->quirks & XHCI_PME_STUCK_QUIRK)
drivers/usb/host/xhci.h+1−0
@@ -1892,6 +1892,7 @@ struct xhci_hcd { · 1891 unmodified lines
18921892 #define XHCI_DISABLE_SPARSE BIT_ULL(38)
18931893 #define XHCI_SG_TRB_CACHE_SIZE_QUIRK BIT_ULL(39)
18941894 #define XHCI_NO_SOFT_RETRY BIT_ULL(40)
1895+#define XHCI_BROKEN_D3COLD BIT_ULL(41)
18951896
18961897 unsigned int num_active_eps;
18971898 unsigned int limit_active_eps;
drivers/usb/misc/brcmstb-usb-pinmap.c+2−0
@@ -263,6 +263,8 @@ static int __init brcmstb_usb_pinmap_probe(struct platform_device *pdev) · 262 unmodified lines
263263 return -EINVAL;
264264
265265 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
266+ if (!r)
267+ return -EINVAL;
266268
267269 pdata = devm_kzalloc(&pdev->dev,
268270 sizeof(*pdata) +
drivers/usb/musb/musb_core.c+1−2
@@ -2009,9 +2009,8 @@ static void musb_pm_runtime_check_session(struct musb *musb) · 2008 unmodified lines
20092009 schedule_delayed_work(&musb->irq_work,
20102010 msecs_to_jiffies(1000));
20112011 musb->quirk_retries--;
2012− break;
20132012 }
2014− fallthrough;
2013+ break;
20152014 case MUSB_QUIRK_B_INVALID_VBUS_91:
20162015 if (musb->quirk_retries && !musb->flush_irq_work) {
20172016 musb_dbg(musb,
drivers/usb/serial/cp210x.c+78−6
@@ -252,9 +252,11 @@ struct cp210x_serial_private { · 251 unmodified lines
252252 u8 gpio_input;
253253 #endif
254254 u8 partnum;
255+ u32 fw_version;
255256 speed_t min_speed;
256257 speed_t max_speed;
257258 bool use_actual_rate;
259+ bool no_flow_control;
258260 };
259261
260262 enum cp210x_event_state {
@@ -398,6 +400,7 @@ struct cp210x_special_chars { · 137 unmodified lines
398400
399401 /* CP210X_VENDOR_SPECIFIC values */
400402 #define CP210X_READ_2NCONFIG 0x000E
403+#define CP210X_GET_FW_VER_2N 0x0010
401404 #define CP210X_READ_LATCH 0x00C2
402405 #define CP210X_GET_PARTNUM 0x370B
403406 #define CP210X_GET_PORTCONFIG 0x370C
@@ -537,6 +540,12 @@ struct cp210x_single_port_config { · 133 unmodified lines
537540 #define CP210X_2NCONFIG_GPIO_RSTLATCH_IDX 587
538541 #define CP210X_2NCONFIG_GPIO_CONTROL_IDX 600
539542
543+/* CP2102N QFN20 port configuration values */
544+#define CP2102N_QFN20_GPIO2_TXLED_MODE BIT(2)
545+#define CP2102N_QFN20_GPIO3_RXLED_MODE BIT(3)
546+#define CP2102N_QFN20_GPIO1_RS485_MODE BIT(4)
547+#define CP2102N_QFN20_GPIO0_CLK_MODE BIT(6)
548+
540549 /* CP210X_VENDOR_SPECIFIC, CP210X_WRITE_LATCH call writes these 0x2 bytes. */
541550 struct cp210x_gpio_write {
542551 u8 mask;
@@ -1122,6 +1131,7 @@ static bool cp210x_termios_change(const struct ktermios *a, const struct ktermio · 579 unmodified lines
11221131 static void cp210x_set_flow_control(struct tty_struct *tty,
11231132 struct usb_serial_port *port, struct ktermios *old_termios)
11241133 {
1134+ struct cp210x_serial_private *priv = usb_get_serial_data(port->serial);
11251135 struct cp210x_port_private *port_priv = usb_get_serial_port_data(port);
11261136 struct cp210x_special_chars chars;
11271137 struct cp210x_flow_ctl flow_ctl;
@@ -1129,6 +1139,15 @@ static void cp210x_set_flow_control(struct tty_struct *tty, · 1 unmodified line
11291139 u32 ctl_hs;
11301140 int ret;
11311141
1142+ /*
1143+ * Some CP2102N interpret ulXonLimit as ulFlowReplace (erratum
1144+ * CP2102N_E104). Report back that flow control is not supported.
1145+ */
1146+ if (priv->no_flow_control) {
1147+ tty->termios.c_cflag &= ~CRTSCTS;
1148+ tty->termios.c_iflag &= ~(IXON | IXOFF);
1149+ }
1150+
11321151 if (old_termios &&
11331152 C_CRTSCTS(tty) == (old_termios->c_cflag & CRTSCTS) &&
11341153 I_IXON(tty) == (old_termios->c_iflag & IXON) &&
@@ -1185,19 +1204,20 @@ static void cp210x_set_flow_control(struct tty_struct *tty, · 50 unmodified lines
11851204 port_priv->crtscts = false;
11861205 }
11871206
1188− if (I_IXOFF(tty))
1207+ if (I_IXOFF(tty)) {
11891208 flow_repl |= CP210X_SERIAL_AUTO_RECEIVE;
1190− else
1209+
1210+ flow_ctl.ulXonLimit = cpu_to_le32(128);
1211+ flow_ctl.ulXoffLimit = cpu_to_le32(128);
1212+ } else {
11911213 flow_repl &= ~CP210X_SERIAL_AUTO_RECEIVE;
1214+ }
11921215
11931216 if (I_IXON(tty))
11941217 flow_repl |= CP210X_SERIAL_AUTO_TRANSMIT;
11951218 else
11961219 flow_repl &= ~CP210X_SERIAL_AUTO_TRANSMIT;
11971220
1198− flow_ctl.ulXonLimit = cpu_to_le32(128);
1199− flow_ctl.ulXoffLimit = cpu_to_le32(128);
1200−
12011221 dev_dbg(&port->dev, "%s - ctrl = 0x%02x, flow = 0x%02x\n", __func__,
12021222 ctl_hs, flow_repl);
12031223
@@ -1733,7 +1753,19 @@ static int cp2102n_gpioconf_init(struct usb_serial *serial) · 529 unmodified lines
17331753 priv->gpio_pushpull = (gpio_pushpull >> 3) & 0x0f;
17341754
17351755 /* 0 indicates GPIO mode, 1 is alternate function */
1736− priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f;
1756+ if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN20) {
1757+ /* QFN20 is special... */
1758+ if (gpio_ctrl & CP2102N_QFN20_GPIO0_CLK_MODE) /* GPIO 0 */
1759+ priv->gpio_altfunc |= BIT(0);
1760+ if (gpio_ctrl & CP2102N_QFN20_GPIO1_RS485_MODE) /* GPIO 1 */
1761+ priv->gpio_altfunc |= BIT(1);
1762+ if (gpio_ctrl & CP2102N_QFN20_GPIO2_TXLED_MODE) /* GPIO 2 */
1763+ priv->gpio_altfunc |= BIT(2);
1764+ if (gpio_ctrl & CP2102N_QFN20_GPIO3_RXLED_MODE) /* GPIO 3 */
1765+ priv->gpio_altfunc |= BIT(3);
1766+ } else {
1767+ priv->gpio_altfunc = (gpio_ctrl >> 2) & 0x0f;
1768+ }
17371769
17381770 if (priv->partnum == CP210X_PARTNUM_CP2102N_QFN28) {
17391771 /*
@@ -1908,6 +1940,45 @@ static void cp210x_init_max_speed(struct usb_serial *serial) · 168 unmodified lines
19081940 priv->use_actual_rate = use_actual_rate;
19091941 }
19101942
1943+static int cp210x_get_fw_version(struct usb_serial *serial, u16 value)
1944+{
1945+ struct cp210x_serial_private *priv = usb_get_serial_data(serial);
1946+ u8 ver[3];
1947+ int ret;
1948+
1949+ ret = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST, value,
1950+ ver, sizeof(ver));
1951+ if (ret)
1952+ return ret;
1953+
1954+ dev_dbg(&serial->interface->dev, "%s - %d.%d.%d\n", __func__,
1955+ ver[0], ver[1], ver[2]);
1956+
1957+ priv->fw_version = ver[0] << 16 | ver[1] << 8 | ver[2];
1958+
1959+ return 0;
1960+}
1961+
1962+static void cp210x_determine_quirks(struct usb_serial *serial)
1963+{
1964+ struct cp210x_serial_private *priv = usb_get_serial_data(serial);
1965+ int ret;
1966+
1967+ switch (priv->partnum) {
1968+ case CP210X_PARTNUM_CP2102N_QFN28:
1969+ case CP210X_PARTNUM_CP2102N_QFN24:
1970+ case CP210X_PARTNUM_CP2102N_QFN20:
1971+ ret = cp210x_get_fw_version(serial, CP210X_GET_FW_VER_2N);
1972+ if (ret)
1973+ break;
1974+ if (priv->fw_version <= 0x10004)
1975+ priv->no_flow_control = true;
1976+ break;
1977+ default:
1978+ break;
1979+ }
1980+}
1981+
19111982 static int cp210x_attach(struct usb_serial *serial)
19121983 {
19131984 int result;
@@ -1928,6 +1999,7 @@ static int cp210x_attach(struct usb_serial *serial) · 14 unmodified lines
19281999
19292000 usb_set_serial_data(serial, priv);
19302001
2002+ cp210x_determine_quirks(serial);
19312003 cp210x_init_max_speed(serial);
19322004
19332005 result = cp210x_gpio_init(serial);
drivers/usb/serial/ftdi_sio.c+1−0
@@ -611,6 +611,7 @@ static const struct usb_device_id id_table_combined[] = { · 610 unmodified lines
611611 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
612612 { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLX_PLUS_PID) },
613613 { USB_DEVICE(FTDI_VID, FTDI_NT_ORION_IO_PID) },
614+ { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONMX_PID) },
614615 { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
615616 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) },
616617 { USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
drivers/usb/serial/ftdi_sio_ids.h+1−0
@@ -581,6 +581,7 @@ · 580 unmodified lines
581581 #define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */
582582 #define FTDI_NT_ORIONLX_PLUS_PID 0x7c91 /* OrionLX+ Substation Automation Platform */
583583 #define FTDI_NT_ORION_IO_PID 0x7c92 /* Orion I/O */
584+#define FTDI_NT_ORIONMX_PID 0x7c93 /* OrionMX */
584585
585586 /*
586587 * Synapse Wireless product ids (FTDI_VID)
drivers/usb/serial/omninet.c+5−3
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
3− * USB ZyXEL omni.net LCD PLUS driver
3+ * USB ZyXEL omni.net driver
44 *
55 * Copyright (C) 2013,2017 Johan Hovold <johan@kernel.org>
66 *
@@ -22,10 +22,11 @@ · 15 unmodified lines
2222 #include <linux/usb/serial.h>
2323
2424 #define DRIVER_AUTHOR "Alessandro Zummo"
25−#define DRIVER_DESC "USB ZyXEL omni.net LCD PLUS Driver"
25+#define DRIVER_DESC "USB ZyXEL omni.net Driver"
2626
2727 #define ZYXEL_VENDOR_ID 0x0586
2828 #define ZYXEL_OMNINET_ID 0x1000
29+#define ZYXEL_OMNI_56K_PLUS_ID 0x1500
2930 /* This one seems to be a re-branded ZyXEL device */
3031 #define BT_IGNITIONPRO_ID 0x2000
3132
@@ -40,6 +41,7 @@ static void omninet_port_remove(struct usb_serial_port *port); · 8 unmodified lines
4041
4142 static const struct usb_device_id id_table[] = {
4243 { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) },
44+ { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNI_56K_PLUS_ID) },
4345 { USB_DEVICE(ZYXEL_VENDOR_ID, BT_IGNITIONPRO_ID) },
4446 { } /* Terminating entry */
4547 };
@@ -50,7 +52,7 @@ static struct usb_serial_driver zyxel_omninet_device = { · 4 unmodified lines
5052 .owner = THIS_MODULE,
5153 .name = "omninet",
5254 },
53− .description = "ZyXEL - omni.net lcd plus usb",
55+ .description = "ZyXEL - omni.net usb",
5456 .id_table = id_table,
5557 .num_bulk_out = 2,
5658 .calc_num_ports = omninet_calc_num_ports,
drivers/usb/serial/quatech2.c+3−3
@@ -416,7 +416,7 @@ static void qt2_close(struct usb_serial_port *port) · 415 unmodified lines
416416
417417 /* flush the port transmit buffer */
418418 i = usb_control_msg(serial->dev,
419− usb_rcvctrlpipe(serial->dev, 0),
419+ usb_sndctrlpipe(serial->dev, 0),
420420 QT2_FLUSH_DEVICE, 0x40, 1,
421421 port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT);
422422
@@ -426,7 +426,7 @@ static void qt2_close(struct usb_serial_port *port) · 3 unmodified lines
426426
427427 /* flush the port receive buffer */
428428 i = usb_control_msg(serial->dev,
429− usb_rcvctrlpipe(serial->dev, 0),
429+ usb_sndctrlpipe(serial->dev, 0),
430430 QT2_FLUSH_DEVICE, 0x40, 0,
431431 port_priv->device_port, NULL, 0, QT2_USB_TIMEOUT);
432432
@@ -639,7 +639,7 @@ static int qt2_attach(struct usb_serial *serial) · 206 unmodified lines
639639 int status;
640640
641641 /* power on unit */
642− status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
642+ status = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
643643 0xc2, 0x40, 0x8000, 0, NULL, 0,
644644 QT2_USB_TIMEOUT);
645645 if (status < 0) {
drivers/usb/typec/mux.c+1−1
@@ -239,7 +239,7 @@ find_mux: · 238 unmodified lines
239239 dev = class_find_device(&typec_mux_class, NULL, fwnode,
240240 mux_fwnode_match);
241241
242− return dev ? to_typec_switch(dev) : ERR_PTR(-EPROBE_DEFER);
242+ return dev ? to_typec_mux(dev) : ERR_PTR(-EPROBE_DEFER);
243243 }
244244
245245 /**
drivers/usb/typec/mux/intel_pmc_mux.c+11−4
@@ -582,10 +582,15 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc) · 581 unmodified lines
582582 acpi_dev_free_resource_list(&resource_list);
583583
584584 if (!pmc->iom_base) {
585− put_device(&adev->dev);
585+ acpi_dev_put(adev);
586586 return -ENOMEM;
587587 }
588588
589+ if (IS_ERR(pmc->iom_base)) {
590+ acpi_dev_put(adev);
591+ return PTR_ERR(pmc->iom_base);
592+ }
593+
589594 pmc->iom_adev = adev;
590595
591596 return 0;
@@ -636,8 +641,10 @@ static int pmc_usb_probe(struct platform_device *pdev) · 44 unmodified lines
636641 break;
637642
638643 ret = pmc_usb_register_port(pmc, i, fwnode);
639− if (ret)
644+ if (ret) {
645+ fwnode_handle_put(fwnode);
640646 goto err_remove_ports;
647+ }
641648 }
642649
643650 platform_set_drvdata(pdev, pmc);
@@ -651,7 +658,7 @@ err_remove_ports: · 7 unmodified lines
651658 usb_role_switch_unregister(pmc->port[i].usb_sw);
652659 }
653660
654− put_device(&pmc->iom_adev->dev);
661+ acpi_dev_put(pmc->iom_adev);
655662
656663 return ret;
657664 }
@@ -667,7 +674,7 @@ static int pmc_usb_remove(struct platform_device *pdev) · 9 unmodified lines
667674 usb_role_switch_unregister(pmc->port[i].usb_sw);
668675 }
669676
670− put_device(&pmc->iom_adev->dev);
677+ acpi_dev_put(pmc->iom_adev);
671678
672679 return 0;
673680 }
drivers/usb/typec/tcpm/tcpm.c+77−46
@@ -401,6 +401,8 @@ struct tcpm_port { · 400 unmodified lines
401401 unsigned int nr_src_pdo;
402402 u32 snk_pdo[PDO_MAX_OBJECTS];
403403 unsigned int nr_snk_pdo;
404+ u32 snk_vdo_v1[VDO_MAX_OBJECTS];
405+ unsigned int nr_snk_vdo_v1;
404406 u32 snk_vdo[VDO_MAX_OBJECTS];
405407 unsigned int nr_snk_vdo;
406408
@@ -1547,42 +1549,45 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev, · 1140 unmodified lines
15471549 if (PD_VDO_VID(p[0]) != USB_SID_PD)
15481550 break;
15491551
1550− if (PD_VDO_SVDM_VER(p[0]) < svdm_version)
1552+ if (PD_VDO_SVDM_VER(p[0]) < svdm_version) {
15511553 typec_partner_set_svdm_version(port->partner,
15521554 PD_VDO_SVDM_VER(p[0]));
1555+ svdm_version = PD_VDO_SVDM_VER(p[0]);
1556+ }
15531557
1554− tcpm_ams_start(port, DISCOVER_IDENTITY);
1555− /* 6.4.4.3.1: Only respond as UFP (device) */
1556− if (port->data_role == TYPEC_DEVICE &&
1558+ port->ams = DISCOVER_IDENTITY;
1559+ /*
1560+ * PD2.0 Spec 6.10.3: respond with NAK as DFP (data host)
1561+ * PD3.1 Spec 6.4.4.2.5.1: respond with NAK if "invalid field" or
1562+ * "wrong configuation" or "Unrecognized"
1563+ */
1564+ if ((port->data_role == TYPEC_DEVICE || svdm_version >= SVDM_VER_2_0) &&
15571565 port->nr_snk_vdo) {
1558− /*
1559− * Product Type DFP and Connector Type are not defined in SVDM
1560− * version 1.0 and shall be set to zero.
1561− */
1562− if (typec_get_negotiated_svdm_version(typec) < SVDM_VER_2_0)
1563− response[1] = port->snk_vdo[0] & ~IDH_DFP_MASK
1564− & ~IDH_CONN_MASK;
1565− else
1566− response[1] = port->snk_vdo[0];
1567− for (i = 1; i < port->nr_snk_vdo; i++)
1568− response[i + 1] = port->snk_vdo[i];
1569− rlen = port->nr_snk_vdo + 1;
1566+ if (svdm_version < SVDM_VER_2_0) {
1567+ for (i = 0; i < port->nr_snk_vdo_v1; i++)
1568+ response[i + 1] = port->snk_vdo_v1[i];
1569+ rlen = port->nr_snk_vdo_v1 + 1;
1570+
1571+ } else {
1572+ for (i = 0; i < port->nr_snk_vdo; i++)
1573+ response[i + 1] = port->snk_vdo[i];
1574+ rlen = port->nr_snk_vdo + 1;
1575+ }
15701576 }
15711577 break;
15721578 case CMD_DISCOVER_SVID:
1573− tcpm_ams_start(port, DISCOVER_SVIDS);
1579+ port->ams = DISCOVER_SVIDS;
15741580 break;
15751581 case CMD_DISCOVER_MODES:
1576− tcpm_ams_start(port, DISCOVER_MODES);
1582+ port->ams = DISCOVER_MODES;
15771583 break;
15781584 case CMD_ENTER_MODE:
1579− tcpm_ams_start(port, DFP_TO_UFP_ENTER_MODE);
1585+ port->ams = DFP_TO_UFP_ENTER_MODE;
15801586 break;
15811587 case CMD_EXIT_MODE:
1582− tcpm_ams_start(port, DFP_TO_UFP_EXIT_MODE);
1588+ port->ams = DFP_TO_UFP_EXIT_MODE;
15831589 break;
15841590 case CMD_ATTENTION:
1585− tcpm_ams_start(port, ATTENTION);
15861591 /* Attention command does not have response */
15871592 *adev_action = ADEV_ATTENTION;
15881593 return 0;
@@ -1937,6 +1942,9 @@ static void vdm_run_state_machine(struct tcpm_port *port) · 348 unmodified lines
19371942 tcpm_log(port, "VDM Tx error, retry");
19381943 port->vdm_retries++;
19391944 port->vdm_state = VDM_STATE_READY;
1945+ if (PD_VDO_SVDM(vdo_hdr) && PD_VDO_CMDT(vdo_hdr) == CMDT_INIT)
1946+ tcpm_ams_finish(port);
1947+ } else {
19401948 tcpm_ams_finish(port);
19411949 }
19421950 break;
@@ -2183,20 +2191,25 @@ static void tcpm_handle_alert(struct tcpm_port *port, const __le32 *payload, · 240 unmodified lines
21832191
21842192 if (!type) {
21852193 tcpm_log(port, "Alert message received with no type");
2194+ tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP);
21862195 return;
21872196 }
21882197
21892198 /* Just handling non-battery alerts for now */
21902199 if (!(type & USB_PD_ADO_TYPE_BATT_STATUS_CHANGE)) {
2191− switch (port->state) {
2192− case SRC_READY:
2193− case SNK_READY:
2200+ if (port->pwr_role == TYPEC_SOURCE) {
2201+ port->upcoming_state = GET_STATUS_SEND;
2202+ tcpm_ams_start(port, GETTING_SOURCE_SINK_STATUS);
2203+ } else {
2204+ /*
2205+ * Do not check SinkTxOk here in case the Source doesn't set its Rp to
2206+ * SinkTxOk in time.
2207+ */
2208+ port->ams = GETTING_SOURCE_SINK_STATUS;
21942209 tcpm_set_state(port, GET_STATUS_SEND, 0);
2195− break;
2196− default:
2197− tcpm_queue_message(port, PD_MSG_CTRL_WAIT);
2198− break;
21992210 }
2211+ } else {
2212+ tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP);
22002213 }
22012214 }
22022215
@@ -2440,7 +2453,12 @@ static void tcpm_pd_data_request(struct tcpm_port *port, · 237 unmodified lines
24402453 tcpm_pd_handle_state(port, BIST_RX, BIST, 0);
24412454 break;
24422455 case PD_DATA_ALERT:
2443− tcpm_handle_alert(port, msg->payload, cnt);
2456+ if (port->state != SRC_READY && port->state != SNK_READY)
2457+ tcpm_pd_handle_state(port, port->pwr_role == TYPEC_SOURCE ?
2458+ SRC_SOFT_RESET_WAIT_SNK_TX : SNK_SOFT_RESET,
2459+ NONE_AMS, 0);
2460+ else
2461+ tcpm_handle_alert(port, msg->payload, cnt);
24442462 break;
24452463 case PD_DATA_BATT_STATUS:
24462464 case PD_DATA_GET_COUNTRY_INFO:
@@ -2764,24 +2782,16 @@ static void tcpm_pd_ext_msg_request(struct tcpm_port *port, · 317 unmodified lines
27642782
27652783 switch (type) {
27662784 case PD_EXT_STATUS:
2767− /*
2768− * If PPS related events raised then get PPS status to clear
2769− * (see USB PD 3.0 Spec, 6.5.2.4)
2770− */
2771− if (msg->ext_msg.data[USB_PD_EXT_SDB_EVENT_FLAGS] &
2772− USB_PD_EXT_SDB_PPS_EVENTS)
2773− tcpm_pd_handle_state(port, GET_PPS_STATUS_SEND,
2774− GETTING_SOURCE_SINK_STATUS, 0);
2775−
2776− else
2777− tcpm_pd_handle_state(port, ready_state(port), NONE_AMS, 0);
2778− break;
27792785 case PD_EXT_PPS_STATUS:
2780− /*
2781− * For now the PPS status message is used to clear events
2782− * and nothing more.
2783− */
2784− tcpm_pd_handle_state(port, ready_state(port), NONE_AMS, 0);
2786+ if (port->ams == GETTING_SOURCE_SINK_STATUS) {
2787+ tcpm_ams_finish(port);
2788+ tcpm_set_state(port, ready_state(port), 0);
2789+ } else {
2790+ /* unexpected Status or PPS_Status Message */
2791+ tcpm_pd_handle_state(port, port->pwr_role == TYPEC_SOURCE ?
2792+ SRC_SOFT_RESET_WAIT_SNK_TX : SNK_SOFT_RESET,
2793+ NONE_AMS, 0);
2794+ }
27852795 break;
27862796 case PD_EXT_SOURCE_CAP_EXT:
27872797 case PD_EXT_GET_BATT_CAP:
@@ -5947,6 +5957,22 @@ sink: · 3159 unmodified lines
59475957 return ret;
59485958 }
59495959
5960+ /* If sink-vdos is found, sink-vdos-v1 is expected for backward compatibility. */
5961+ if (port->nr_snk_vdo) {
5962+ ret = fwnode_property_count_u32(fwnode, "sink-vdos-v1");
5963+ if (ret < 0)
5964+ return ret;
5965+ else if (ret == 0)
5966+ return -ENODATA;
5967+
5968+ port->nr_snk_vdo_v1 = min(ret, VDO_MAX_OBJECTS);
5969+ ret = fwnode_property_read_u32_array(fwnode, "sink-vdos-v1",
5970+ port->snk_vdo_v1,
5971+ port->nr_snk_vdo_v1);
5972+ if (ret < 0)
5973+ return ret;
5974+ }
5975+
59505976 return 0;
59515977 }
59525978
@@ -6312,6 +6338,11 @@ void tcpm_unregister_port(struct tcpm_port *port) · 359 unmodified lines
63126338 {
63136339 int i;
63146340
6341+ hrtimer_cancel(&port->send_discover_timer);
6342+ hrtimer_cancel(&port->enable_frs_timer);
6343+ hrtimer_cancel(&port->vdm_state_machine_timer);
6344+ hrtimer_cancel(&port->state_machine_timer);
6345+
63156346 tcpm_reset_port(port);
63166347 for (i = 0; i < ARRAY_SIZE(port->port_altmode); i++)
63176348 typec_unregister_altmode(port->port_altmode[i]);
drivers/usb/typec/tcpm/wcove.c+1−1
@@ -378,7 +378,7 @@ static int wcove_pd_transmit(struct tcpc_dev *tcpc, · 377 unmodified lines
378378 const u8 *data = (void *)msg;
379379 int i;
380380
381− for (i = 0; i < pd_header_cnt(msg->header) * 4 + 2; i++) {
381+ for (i = 0; i < pd_header_cnt_le(msg->header) * 4 + 2; i++) {
382382 ret = regmap_write(wcove->regmap, USBC_TX_DATA + i,
383383 data[i]);
384384 if (ret)
drivers/usb/typec/ucsi/ucsi.c+1−0
@@ -1253,6 +1253,7 @@ err_unregister: · 1252 unmodified lines
12531253 }
12541254
12551255 err_reset:
1256+ memset(&ucsi->cap, 0, sizeof(ucsi->cap));
12561257 ucsi_reset_ppm(ucsi);
12571258 err:
12581259 return ret;
drivers/vfio/pci/Kconfig+1−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22 config VFIO_PCI
33 tristate "VFIO support for PCI devices"
44 depends on VFIO && PCI && EVENTFD
5+ depends on MMU
56 select VFIO_VIRQFD
67 select IRQ_BYPASS_MANAGER
78 help
drivers/vfio/pci/vfio_pci_config.c+1−1
@@ -1581,7 +1581,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev) · 1580 unmodified lines
15811581 if (len == 0xFF) {
15821582 len = vfio_ext_cap_len(vdev, ecap, epos);
15831583 if (len < 0)
1584− return ret;
1584+ return len;
15851585 }
15861586 }
15871587
drivers/vfio/platform/vfio_platform_common.c+1−1
@@ -291,7 +291,7 @@ err_irq: · 290 unmodified lines
291291 vfio_platform_regions_cleanup(vdev);
292292 err_reg:
293293 mutex_unlock(&driver_lock);
294− module_put(THIS_MODULE);
294+ module_put(vdev->parent_module);
295295 return ret;
296296 }
297297
drivers/vfio/vfio_iommu_type1.c+1−1
@@ -2795,7 +2795,7 @@ static int vfio_iommu_iova_build_caps(struct vfio_iommu *iommu, · 2794 unmodified lines
27952795 return 0;
27962796 }
27972797
2798− size = sizeof(*cap_iovas) + (iovas * sizeof(*cap_iovas->iova_ranges));
2798+ size = struct_size(cap_iovas, iova_ranges, iovas);
27992799
28002800 cap_iovas = kzalloc(size, GFP_KERNEL);
28012801 if (!cap_iovas)
drivers/video/fbdev/core/fb_defio.c+35−0
@@ -52,6 +52,13 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf) · 51 unmodified lines
5252 return VM_FAULT_SIGBUS;
5353
5454 get_page(page);
55+
56+ if (vmf->vma->vm_file)
57+ page->mapping = vmf->vma->vm_file->f_mapping;
58+ else
59+ printk(KERN_ERR "no mapping available\n");
60+
61+ BUG_ON(!page->mapping);
5562 page->index = vmf->pgoff;
5663
5764 vmf->page = page;
@@ -144,6 +151,17 @@ static const struct vm_operations_struct fb_deferred_io_vm_ops = { · 86 unmodified lines
144151 .page_mkwrite = fb_deferred_io_mkwrite,
145152 };
146153
154+static int fb_deferred_io_set_page_dirty(struct page *page)
155+{
156+ if (!PageDirty(page))
157+ SetPageDirty(page);
158+ return 0;
159+}
160+
161+static const struct address_space_operations fb_deferred_io_aops = {
162+ .set_page_dirty = fb_deferred_io_set_page_dirty,
163+};
164+
147165 int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma)
148166 {
149167 vma->vm_ops = &fb_deferred_io_vm_ops;
@@ -194,12 +212,29 @@ void fb_deferred_io_init(struct fb_info *info) · 44 unmodified lines
194212 }
195213 EXPORT_SYMBOL_GPL(fb_deferred_io_init);
196214
215+void fb_deferred_io_open(struct fb_info *info,
216+ struct inode *inode,
217+ struct file *file)
218+{
219+ file->f_mapping->a_ops = &fb_deferred_io_aops;
220+}
221+EXPORT_SYMBOL_GPL(fb_deferred_io_open);
222+
197223 void fb_deferred_io_cleanup(struct fb_info *info)
198224 {
199225 struct fb_deferred_io *fbdefio = info->fbdefio;
226+ struct page *page;
227+ int i;
200228
201229 BUG_ON(!fbdefio);
202230 cancel_delayed_work_sync(&info->deferred_work);
231+
232+ /* clear out the mapping that we setup */
233+ for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
234+ page = fb_deferred_io_page(info, i);
235+ page->mapping = NULL;
236+ }
237+
203238 mutex_destroy(&fbdefio->lock);
204239 }
205240 EXPORT_SYMBOL_GPL(fb_deferred_io_cleanup);
drivers/video/fbdev/core/fbmem.c+4−0
@@ -1415,6 +1415,10 @@ __releases(&info->lock) · 1414 unmodified lines
14151415 if (res)
14161416 module_put(info->fbops->owner);
14171417 }
1418+#ifdef CONFIG_FB_DEFERRED_IO
1419+ if (info->fbdefio)
1420+ fb_deferred_io_open(info, inode, file);
1421+#endif
14181422 out:
14191423 unlock_fb_info(info);
14201424 if (res)
fs/afs/write.c+1−1
@@ -730,7 +730,7 @@ static int afs_writepages_region(struct address_space *mapping, · 729 unmodified lines
730730 return ret;
731731 }
732732
733− start += ret * PAGE_SIZE;
733+ start += ret;
734734
735735 cond_resched();
736736 } while (wbc->nr_to_write > 0);
fs/btrfs/compression.c+12−5
@@ -457,7 +457,7 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, · 456 unmodified lines
457457 bytes_left = compressed_len;
458458 for (pg_index = 0; pg_index < cb->nr_pages; pg_index++) {
459459 int submit = 0;
460− int len;
460+ int len = 0;
461461
462462 page = compressed_pages[pg_index];
463463 page->mapping = inode->vfs_inode.i_mapping;
@@ -465,10 +465,17 @@ blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start, · 1 unmodified line
465465 submit = btrfs_bio_fits_in_stripe(page, PAGE_SIZE, bio,
466466 0);
467467
468− if (pg_index == 0 && use_append)
469− len = bio_add_zone_append_page(bio, page, PAGE_SIZE, 0);
470− else
471− len = bio_add_page(bio, page, PAGE_SIZE, 0);
468+ /*
469+ * Page can only be added to bio if the current bio fits in
470+ * stripe.
471+ */
472+ if (!submit) {
473+ if (pg_index == 0 && use_append)
474+ len = bio_add_zone_append_page(bio, page,
475+ PAGE_SIZE, 0);
476+ else
477+ len = bio_add_page(bio, page, PAGE_SIZE, 0);
478+ }
472479
473480 page->mapping = NULL;
474481 if (submit || len < PAGE_SIZE) {
fs/btrfs/disk-io.c+18−8
@@ -2648,6 +2648,24 @@ static int validate_super(struct btrfs_fs_info *fs_info, · 2647 unmodified lines
26482648 ret = -EINVAL;
26492649 }
26502650
2651+ if (memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid,
2652+ BTRFS_FSID_SIZE)) {
2653+ btrfs_err(fs_info,
2654+ "superblock fsid doesn't match fsid of fs_devices: %pU != %pU",
2655+ fs_info->super_copy->fsid, fs_info->fs_devices->fsid);
2656+ ret = -EINVAL;
2657+ }
2658+
2659+ if (btrfs_fs_incompat(fs_info, METADATA_UUID) &&
2660+ memcmp(fs_info->fs_devices->metadata_uuid,
2661+ fs_info->super_copy->metadata_uuid, BTRFS_FSID_SIZE)) {
2662+ btrfs_err(fs_info,
2663+"superblock metadata_uuid doesn't match metadata uuid of fs_devices: %pU != %pU",
2664+ fs_info->super_copy->metadata_uuid,
2665+ fs_info->fs_devices->metadata_uuid);
2666+ ret = -EINVAL;
2667+ }
2668+
26512669 if (memcmp(fs_info->fs_devices->metadata_uuid, sb->dev_item.fsid,
26522670 BTRFS_FSID_SIZE) != 0) {
26532671 btrfs_err(fs_info,
@@ -3279,14 +3297,6 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device · 625 unmodified lines
32793297
32803298 disk_super = fs_info->super_copy;
32813299
3282− ASSERT(!memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid,
3283− BTRFS_FSID_SIZE));
3284−
3285− if (btrfs_fs_incompat(fs_info, METADATA_UUID)) {
3286− ASSERT(!memcmp(fs_info->fs_devices->metadata_uuid,
3287− fs_info->super_copy->metadata_uuid,
3288− BTRFS_FSID_SIZE));
3289− }
32903300
32913301 features = btrfs_super_flags(disk_super);
32923302 if (features & BTRFS_SUPER_FLAG_CHANGING_FSID_V2) {
fs/btrfs/extent-tree.c+1−1
@@ -1868,7 +1868,7 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans, · 1867 unmodified lines
18681868 trace_run_delayed_ref_head(fs_info, head, 0);
18691869 btrfs_delayed_ref_unlock(head);
18701870 btrfs_put_delayed_ref_head(head);
1871− return 0;
1871+ return ret;
18721872 }
18731873
18741874 static struct btrfs_delayed_ref_head *btrfs_obtain_ref_head(
fs/btrfs/file-item.c+81−27
@@ -788,7 +788,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, · 787 unmodified lines
788788 u64 end_byte = bytenr + len;
789789 u64 csum_end;
790790 struct extent_buffer *leaf;
791− int ret;
791+ int ret = 0;
792792 const u32 csum_size = fs_info->csum_size;
793793 u32 blocksize_bits = fs_info->sectorsize_bits;
794794
@@ -806,6 +806,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, · 11 unmodified lines
806806
807807 ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
808808 if (ret > 0) {
809+ ret = 0;
809810 if (path->slots[0] == 0)
810811 break;
811812 path->slots[0]--;
@@ -862,7 +863,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, · 50 unmodified lines
862863 ret = btrfs_del_items(trans, root, path,
863864 path->slots[0], del_nr);
864865 if (ret)
865− goto out;
866+ break;
866867 if (key.offset == bytenr)
867868 break;
868869 } else if (key.offset < bytenr && csum_end > end_byte) {
@@ -906,8 +907,9 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, · 37 unmodified lines
906907 ret = btrfs_split_item(trans, root, path, &key, offset);
907908 if (ret && ret != -EAGAIN) {
908909 btrfs_abort_transaction(trans, ret);
909− goto out;
910+ break;
910911 }
912+ ret = 0;
911913
912914 key.offset = end_byte - 1;
913915 } else {
@@ -917,12 +919,41 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans, · 3 unmodified lines
917919 }
918920 btrfs_release_path(path);
919921 }
920− ret = 0;
921−out:
922922 btrfs_free_path(path);
923923 return ret;
924924 }
925925
926+static int find_next_csum_offset(struct btrfs_root *root,
927+ struct btrfs_path *path,
928+ u64 *next_offset)
929+{
930+ const u32 nritems = btrfs_header_nritems(path->nodes[0]);
931+ struct btrfs_key found_key;
932+ int slot = path->slots[0] + 1;
933+ int ret;
934+
935+ if (nritems == 0 || slot >= nritems) {
936+ ret = btrfs_next_leaf(root, path);
937+ if (ret < 0) {
938+ return ret;
939+ } else if (ret > 0) {
940+ *next_offset = (u64)-1;
941+ return 0;
942+ }
943+ slot = path->slots[0];
944+ }
945+
946+ btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot);
947+
948+ if (found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
949+ found_key.type != BTRFS_EXTENT_CSUM_KEY)
950+ *next_offset = (u64)-1;
951+ else
952+ *next_offset = found_key.offset;
953+
954+ return 0;
955+}
956+
926957 int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans,
927958 struct btrfs_root *root,
928959 struct btrfs_ordered_sum *sums)
@@ -938,7 +969,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, · 9 unmodified lines
938969 u64 total_bytes = 0;
939970 u64 csum_offset;
940971 u64 bytenr;
941− u32 nritems;
942972 u32 ins_size;
943973 int index = 0;
944974 int found_next;
@@ -981,26 +1011,10 @@ again: · 36 unmodified lines
9811011 goto insert;
9821012 }
9831013 } else {
984− int slot = path->slots[0] + 1;
985− /* we didn't find a csum item, insert one */
986− nritems = btrfs_header_nritems(path->nodes[0]);
987− if (!nritems || (path->slots[0] >= nritems - 1)) {
988− ret = btrfs_next_leaf(root, path);
989− if (ret < 0) {
990− goto out;
991− } else if (ret > 0) {
992− found_next = 1;
993− goto insert;
994− }
995− slot = path->slots[0];
996− }
997− btrfs_item_key_to_cpu(path->nodes[0], &found_key, slot);
998− if (found_key.objectid != BTRFS_EXTENT_CSUM_OBJECTID ||
999− found_key.type != BTRFS_EXTENT_CSUM_KEY) {
1000− found_next = 1;
1001− goto insert;
1002− }
1003− next_offset = found_key.offset;
1014+ /* We didn't find a csum item, insert one. */
1015+ ret = find_next_csum_offset(root, path, &next_offset);
1016+ if (ret < 0)
1017+ goto out;
10041018 found_next = 1;
10051019 goto insert;
10061020 }
@@ -1056,8 +1070,48 @@ extend_csum: · 49 unmodified lines
10561070 tmp = sums->len - total_bytes;
10571071 tmp >>= fs_info->sectorsize_bits;
10581072 WARN_ON(tmp < 1);
1073+ extend_nr = max_t(int, 1, tmp);
1074+
1075+ /*
1076+ * A log tree can already have checksum items with a subset of
1077+ * the checksums we are trying to log. This can happen after
1078+ * doing a sequence of partial writes into prealloc extents and
1079+ * fsyncs in between, with a full fsync logging a larger subrange
1080+ * of an extent for which a previous fast fsync logged a smaller
1081+ * subrange. And this happens in particular due to merging file
1082+ * extent items when we complete an ordered extent for a range
1083+ * covered by a prealloc extent - this is done at
1084+ * btrfs_mark_extent_written().
1085+ *
1086+ * So if we try to extend the previous checksum item, which has
1087+ * a range that ends at the start of the range we want to insert,
1088+ * make sure we don't extend beyond the start offset of the next
1089+ * checksum item. If we are at the last item in the leaf, then
1090+ * forget the optimization of extending and add a new checksum
1091+ * item - it is not worth the complexity of releasing the path,
1092+ * getting the first key for the next leaf, repeat the btree
1093+ * search, etc, because log trees are temporary anyway and it
1094+ * would only save a few bytes of leaf space.
1095+ */
1096+ if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) {
1097+ if (path->slots[0] + 1 >=
1098+ btrfs_header_nritems(path->nodes[0])) {
1099+ ret = find_next_csum_offset(root, path, &next_offset);
1100+ if (ret < 0)
1101+ goto out;
1102+ found_next = 1;
1103+ goto insert;
1104+ }
1105+
1106+ ret = find_next_csum_offset(root, path, &next_offset);
1107+ if (ret < 0)
1108+ goto out;
1109+
1110+ tmp = (next_offset - bytenr) >> fs_info->sectorsize_bits;
1111+ if (tmp <= INT_MAX)
1112+ extend_nr = min_t(int, extend_nr, tmp);
1113+ }
10591114
1060− extend_nr = max_t(int, 1, (int)tmp);
10611115 diff = (csum_offset + extend_nr) * csum_size;
10621116 diff = min(diff,
10631117 MAX_CSUM_ITEMS(fs_info, csum_size) * csum_size);
fs/btrfs/file.c+2−2
@@ -1094,7 +1094,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, · 1093 unmodified lines
10941094 int del_nr = 0;
10951095 int del_slot = 0;
10961096 int recow;
1097− int ret;
1097+ int ret = 0;
10981098 u64 ino = btrfs_ino(inode);
10991099
11001100 path = btrfs_alloc_path();
@@ -1315,7 +1315,7 @@ again: · 214 unmodified lines
13151315 }
13161316 out:
13171317 btrfs_free_path(path);
1318− return 0;
1318+ return ret;
13191319 }
13201320
13211321 /*
fs/btrfs/inode.c+18−1
@@ -3000,6 +3000,18 @@ out: · 2999 unmodified lines
30003000 if (ret || truncated) {
30013001 u64 unwritten_start = start;
30023002
3003+ /*
3004+ * If we failed to finish this ordered extent for any reason we
3005+ * need to make sure BTRFS_ORDERED_IOERR is set on the ordered
3006+ * extent, and mark the inode with the error if it wasn't
3007+ * already set. Any error during writeback would have already
3008+ * set the mapping error, so we need to set it if we're the ones
3009+ * marking this ordered extent as failed.
3010+ */
3011+ if (ret && !test_and_set_bit(BTRFS_ORDERED_IOERR,
3012+ &ordered_extent->flags))
3013+ mapping_set_error(ordered_extent->inode->i_mapping, -EIO);
3014+
30033015 if (truncated)
30043016 unwritten_start += logical_len;
30053017 clear_extent_uptodate(io_tree, unwritten_start, end, NULL);
@@ -9076,6 +9088,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, · 6070 unmodified lines
90769088 int ret2;
90779089 bool root_log_pinned = false;
90789090 bool dest_log_pinned = false;
9091+ bool need_abort = false;
90799092
90809093 /* we only allow rename subvolume link between subvolumes */
90819094 if (old_ino != BTRFS_FIRST_FREE_OBJECTID && root != dest)
@@ -9135,6 +9148,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, · 53 unmodified lines
91359148 old_idx);
91369149 if (ret)
91379150 goto out_fail;
9151+ need_abort = true;
91389152 }
91399153
91409154 /* And now for the dest. */
@@ -9150,8 +9164,11 @@ static int btrfs_rename_exchange(struct inode *old_dir, · 9 unmodified lines
91509164 new_ino,
91519165 btrfs_ino(BTRFS_I(old_dir)),
91529166 new_idx);
9153− if (ret)
9167+ if (ret) {
9168+ if (need_abort)
9169+ btrfs_abort_transaction(trans, ret);
91549170 goto out_fail;
9171+ }
91559172 }
91569173
91579174 /* Update inode version and ctime/mtime. */
fs/btrfs/reflink.c+22−16
@@ -203,10 +203,7 @@ static int clone_copy_inline_extent(struct inode *dst, · 202 unmodified lines
203203 * inline extent's data to the page.
204204 */
205205 ASSERT(key.offset > 0);
206− ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
207− inline_data, size, datal,
208− comp_type);
209− goto out;
206+ goto copy_to_page;
210207 }
211208 } else if (i_size_read(dst) <= datal) {
212209 struct btrfs_file_extent_item *ei;
@@ -222,13 +219,10 @@ static int clone_copy_inline_extent(struct inode *dst, · 9 unmodified lines
222219 BTRFS_FILE_EXTENT_INLINE)
223220 goto copy_inline_extent;
224221
225− ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
226− inline_data, size, datal, comp_type);
227− goto out;
222+ goto copy_to_page;
228223 }
229224
230225 copy_inline_extent:
231− ret = 0;
232226 /*
233227 * We have no extent items, or we have an extent at offset 0 which may
234228 * or may not be inlined. All these cases are dealt the same way.
@@ -240,11 +234,13 @@ copy_inline_extent: · 5 unmodified lines
240234 * clone. Deal with all these cases by copying the inline extent
241235 * data into the respective page at the destination inode.
242236 */
243− ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
244− inline_data, size, datal, comp_type);
245− goto out;
237+ goto copy_to_page;
246238 }
247239
240+ /*
241+ * Release path before starting a new transaction so we don't hold locks
242+ * that would confuse lockdep.
243+ */
248244 btrfs_release_path(path);
249245 /*
250246 * If we end up here it means were copy the inline extent into a leaf
@@ -281,11 +277,6 @@ copy_inline_extent: · 30 unmodified lines
281277 ret = btrfs_inode_set_file_extent_range(BTRFS_I(dst), 0, aligned_end);
282278 out:
283279 if (!ret && !trans) {
284− /*
285− * Release path before starting a new transaction so we don't
286− * hold locks that would confuse lockdep.
287− */
288− btrfs_release_path(path);
289280 /*
290281 * No transaction here means we copied the inline extent into a
291282 * page of the destination inode.
@@ -306,6 +297,21 @@ out: · 14 unmodified lines
306297 *trans_out = trans;
307298
308299 return ret;
300+
301+copy_to_page:
302+ /*
303+ * Release our path because we don't need it anymore and also because
304+ * copy_inline_to_page() needs to reserve data and metadata, which may
305+ * need to flush delalloc when we are low on available space and
306+ * therefore cause a deadlock if writeback of an inline extent needs to
307+ * write to the same leaf or an ordered extent completion needs to write
308+ * to the same leaf.
309+ */
310+ btrfs_release_path(path);
311+
312+ ret = copy_inline_to_page(BTRFS_I(dst), new_key->offset,
313+ inline_data, size, datal, comp_type);
314+ goto out;
309315 }
310316
311317 /**
fs/btrfs/tree-log.c+29−8
@@ -1574,7 +1574,9 @@ static noinline int add_inode_ref(struct btrfs_trans_handle *trans, · 1573 unmodified lines
15741574 if (ret)
15751575 goto out;
15761576
1577− btrfs_update_inode(trans, root, BTRFS_I(inode));
1577+ ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
1578+ if (ret)
1579+ goto out;
15781580 }
15791581
15801582 ref_ptr = (unsigned long)(ref_ptr + ref_struct_size) + namelen;
@@ -1749,7 +1751,9 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans, · 168 unmodified lines
17491751
17501752 if (nlink != inode->i_nlink) {
17511753 set_nlink(inode, nlink);
1752− btrfs_update_inode(trans, root, BTRFS_I(inode));
1754+ ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
1755+ if (ret)
1756+ goto out;
17531757 }
17541758 BTRFS_I(inode)->index_cnt = (u64)-1;
17551759
@@ -1787,6 +1791,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, · 31 unmodified lines
17871791 break;
17881792
17891793 if (ret == 1) {
1794+ ret = 0;
17901795 if (path->slots[0] == 0)
17911796 break;
17921797 path->slots[0]--;
@@ -1799,17 +1804,19 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, · 6 unmodified lines
17991804
18001805 ret = btrfs_del_item(trans, root, path);
18011806 if (ret)
1802− goto out;
1807+ break;
18031808
18041809 btrfs_release_path(path);
18051810 inode = read_one_inode(root, key.offset);
1806− if (!inode)
1807− return -EIO;
1811+ if (!inode) {
1812+ ret = -EIO;
1813+ break;
1814+ }
18081815
18091816 ret = fixup_inode_link_count(trans, root, inode);
18101817 iput(inode);
18111818 if (ret)
1812− goto out;
1819+ break;
18131820
18141821 /*
18151822 * fixup on a directory may create new entries,
@@ -1818,8 +1825,6 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans, · 2 unmodified lines
18181825 */
18191826 key.offset = (u64)-1;
18201827 }
1821− ret = 0;
1822−out:
18231828 btrfs_release_path(path);
18241829 return ret;
18251830 }
@@ -3297,6 +3302,22 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, · 1471 unmodified lines
32973302 * begins and releases it only after writing its superblock.
32983303 */
32993304 mutex_lock(&fs_info->tree_log_mutex);
3305+
3306+ /*
3307+ * The previous transaction writeout phase could have failed, and thus
3308+ * marked the fs in an error state. We must not commit here, as we
3309+ * could have updated our generation in the super_for_commit and
3310+ * writing the super here would result in transid mismatches. If there
3311+ * is an error here just bail.
3312+ */
3313+ if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state)) {
3314+ ret = -EIO;
3315+ btrfs_set_log_full_commit(trans);
3316+ btrfs_abort_transaction(trans, ret);
3317+ mutex_unlock(&fs_info->tree_log_mutex);
3318+ goto out_wake_log_root;
3319+ }
3320+
33003321 btrfs_set_super_log_root(fs_info->super_for_commit, log_root_start);
33013322 btrfs_set_super_log_root_level(fs_info->super_for_commit, log_root_level);
33023323 ret = write_all_supers(fs_info, 1);
fs/btrfs/zoned.c+18−5
@@ -150,6 +150,18 @@ static inline u32 sb_zone_number(int shift, int mirror) · 149 unmodified lines
150150 return (u32)zone;
151151 }
152152
153+static inline sector_t zone_start_sector(u32 zone_number,
154+ struct block_device *bdev)
155+{
156+ return (sector_t)zone_number << ilog2(bdev_zone_sectors(bdev));
157+}
158+
159+static inline u64 zone_start_physical(u32 zone_number,
160+ struct btrfs_zoned_device_info *zone_info)
161+{
162+ return (u64)zone_number << zone_info->zone_size_shift;
163+}
164+
153165 /*
154166 * Emulate blkdev_report_zones() for a non-zoned device. It slices up the block
155167 * device into static sized chunks and fake a conventional zone on each of
@@ -405,8 +417,8 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device) · 249 unmodified lines
405417 if (sb_zone + 1 >= zone_info->nr_zones)
406418 continue;
407419
408− sector = sb_zone << (zone_info->zone_size_shift - SECTOR_SHIFT);
409− ret = btrfs_get_dev_zones(device, sector << SECTOR_SHIFT,
420+ ret = btrfs_get_dev_zones(device,
421+ zone_start_physical(sb_zone, zone_info),
410422 &zone_info->sb_zones[sb_pos],
411423 &nr_zones);
412424 if (ret)
@@ -721,7 +733,7 @@ int btrfs_sb_log_location_bdev(struct block_device *bdev, int mirror, int rw, · 308 unmodified lines
721733 if (sb_zone + 1 >= nr_zones)
722734 return -ENOENT;
723735
724− ret = blkdev_report_zones(bdev, sb_zone << zone_sectors_shift,
736+ ret = blkdev_report_zones(bdev, zone_start_sector(sb_zone, bdev),
725737 BTRFS_NR_SB_LOG_ZONES, copy_zone_info_cb,
726738 zones);
727739 if (ret < 0)
@@ -826,7 +838,7 @@ int btrfs_reset_sb_log_zones(struct block_device *bdev, int mirror) · 98 unmodified lines
826838 return -ENOENT;
827839
828840 return blkdev_zone_mgmt(bdev, REQ_OP_ZONE_RESET,
829− sb_zone << zone_sectors_shift,
841+ zone_start_sector(sb_zone, bdev),
830842 zone_sectors * BTRFS_NR_SB_LOG_ZONES, GFP_NOFS);
831843 }
832844
@@ -878,7 +890,8 @@ u64 btrfs_find_allocatable_zones(struct btrfs_device *device, u64 hole_start, · 45 unmodified lines
878890 if (!(end <= sb_zone ||
879891 sb_zone + BTRFS_NR_SB_LOG_ZONES <= begin)) {
880892 have_sb = true;
881− pos = ((u64)sb_zone + BTRFS_NR_SB_LOG_ZONES) << shift;
893+ pos = zone_start_physical(
894+ sb_zone + BTRFS_NR_SB_LOG_ZONES, zinfo);
882895 break;
883896 }
884897
fs/coredump.c+1−1
@@ -519,7 +519,7 @@ static bool dump_interrupted(void) · 518 unmodified lines
519519 * but then we need to teach dump_write() to restart and clear
520520 * TIF_SIGPENDING.
521521 */
522− return signal_pending(current);
522+ return fatal_signal_pending(current) || freezing(current);
523523 }
524524
525525 static void wait_for_dump_helpers(struct file *file)
fs/debugfs/file.c+1−1
@@ -893,7 +893,7 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf, · 892 unmodified lines
893893
894894 copy[copy_len] = '\n';
895895
896− ret = simple_read_from_buffer(user_buf, count, ppos, copy, copy_len);
896+ ret = simple_read_from_buffer(user_buf, count, ppos, copy, len);
897897 kfree(copy);
898898
899899 return ret;
fs/ext4/extents.c+23−20
@@ -3206,7 +3206,10 @@ static int ext4_split_extent_at(handle_t *handle, · 3205 unmodified lines
32063206 ext4_ext_mark_unwritten(ex2);
32073207
32083208 err = ext4_ext_insert_extent(handle, inode, ppath, &newex, flags);
3209− if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) {
3209+ if (err != -ENOSPC && err != -EDQUOT)
3210+ goto out;
3211+
3212+ if (EXT4_EXT_MAY_ZEROOUT & split_flag) {
32103213 if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) {
32113214 if (split_flag & EXT4_EXT_DATA_VALID1) {
32123215 err = ext4_ext_zeroout(inode, ex2);
@@ -3232,25 +3235,22 @@ static int ext4_split_extent_at(handle_t *handle, · 19 unmodified lines
32323235 ext4_ext_pblock(&orig_ex));
32333236 }
32343237
3235− if (err)
3236− goto fix_extent_len;
3237− /* update the extent length and mark as initialized */
3238− ex->ee_len = cpu_to_le16(ee_len);
3239− ext4_ext_try_to_merge(handle, inode, path, ex);
3240− err = ext4_ext_dirty(handle, inode, path + path->p_depth);
3241− if (err)
3242− goto fix_extent_len;
3243−
3244− /* update extent status tree */
3245− err = ext4_zeroout_es(inode, &zero_ex);
3246−
3247− goto out;
3248− } else if (err)
3249− goto fix_extent_len;
3250−
3251−out:
3252− ext4_ext_show_leaf(inode, path);
3253− return err;
3238+ if (!err) {
3239+ /* update the extent length and mark as initialized */
3240+ ex->ee_len = cpu_to_le16(ee_len);
3241+ ext4_ext_try_to_merge(handle, inode, path, ex);
3242+ err = ext4_ext_dirty(handle, inode, path + path->p_depth);
3243+ if (!err)
3244+ /* update extent status tree */
3245+ err = ext4_zeroout_es(inode, &zero_ex);
3246+ /* If we failed at this point, we don't know in which
3247+ * state the extent tree exactly is so don't try to fix
3248+ * length of the original extent as it may do even more
3249+ * damage.
3250+ */
3251+ goto out;
3252+ }
3253+ }
32543254
32553255 fix_extent_len:
32563256 ex->ee_len = orig_ex.ee_len;
@@ -3260,6 +3260,9 @@ fix_extent_len: · 3 unmodified lines
32603260 */
32613261 ext4_ext_dirty(handle, inode, path + path->p_depth);
32623262 return err;
3263+out:
3264+ ext4_ext_show_leaf(inode, path);
3265+ return err;
32633266 }
32643267
32653268 /*
fs/ext4/fast_commit.c+90−80
@@ -1288,28 +1288,29 @@ struct dentry_info_args { · 1287 unmodified lines
12881288 };
12891289
12901290 static inline void tl_to_darg(struct dentry_info_args *darg,
1291− struct ext4_fc_tl *tl)
1291+ struct ext4_fc_tl *tl, u8 *val)
12921292 {
1293− struct ext4_fc_dentry_info *fcd;
1293+ struct ext4_fc_dentry_info fcd;
12941294
1295− fcd = (struct ext4_fc_dentry_info *)ext4_fc_tag_val(tl);
1295+ memcpy(&fcd, val, sizeof(fcd));
12961296
1297− darg->parent_ino = le32_to_cpu(fcd->fc_parent_ino);
1298− darg->ino = le32_to_cpu(fcd->fc_ino);
1299− darg->dname = fcd->fc_dname;
1300− darg->dname_len = ext4_fc_tag_len(tl) -
1301− sizeof(struct ext4_fc_dentry_info);
1297+ darg->parent_ino = le32_to_cpu(fcd.fc_parent_ino);
1298+ darg->ino = le32_to_cpu(fcd.fc_ino);
1299+ darg->dname = val + offsetof(struct ext4_fc_dentry_info, fc_dname);
1300+ darg->dname_len = le16_to_cpu(tl->fc_len) -
1301+ sizeof(struct ext4_fc_dentry_info);
13021302 }
13031303
13041304 /* Unlink replay function */
1305−static int ext4_fc_replay_unlink(struct super_block *sb, struct ext4_fc_tl *tl)
1305+static int ext4_fc_replay_unlink(struct super_block *sb, struct ext4_fc_tl *tl,
1306+ u8 *val)
13061307 {
13071308 struct inode *inode, *old_parent;
13081309 struct qstr entry;
13091310 struct dentry_info_args darg;
13101311 int ret = 0;
13111312
1312− tl_to_darg(&darg, tl);
1313+ tl_to_darg(&darg, tl, val);
13131314
13141315 trace_ext4_fc_replay(sb, EXT4_FC_TAG_UNLINK, darg.ino,
13151316 darg.parent_ino, darg.dname_len);
@@ -1399,13 +1400,14 @@ out: · 83 unmodified lines
13991400 }
14001401
14011402 /* Link replay function */
1402−static int ext4_fc_replay_link(struct super_block *sb, struct ext4_fc_tl *tl)
1403+static int ext4_fc_replay_link(struct super_block *sb, struct ext4_fc_tl *tl,
1404+ u8 *val)
14031405 {
14041406 struct inode *inode;
14051407 struct dentry_info_args darg;
14061408 int ret = 0;
14071409
1408− tl_to_darg(&darg, tl);
1410+ tl_to_darg(&darg, tl, val);
14091411 trace_ext4_fc_replay(sb, EXT4_FC_TAG_LINK, darg.ino,
14101412 darg.parent_ino, darg.dname_len);
14111413
@@ -1450,9 +1452,10 @@ static int ext4_fc_record_modified_inode(struct super_block *sb, int ino) · 38 unmodified lines
14501452 /*
14511453 * Inode replay function
14521454 */
1453−static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl)
1455+static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl,
1456+ u8 *val)
14541457 {
1455− struct ext4_fc_inode *fc_inode;
1458+ struct ext4_fc_inode fc_inode;
14561459 struct ext4_inode *raw_inode;
14571460 struct ext4_inode *raw_fc_inode;
14581461 struct inode *inode = NULL;
@@ -1460,9 +1463,9 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl) · 1 unmodified line
14601463 int inode_len, ino, ret, tag = le16_to_cpu(tl->fc_tag);
14611464 struct ext4_extent_header *eh;
14621465
1463− fc_inode = (struct ext4_fc_inode *)ext4_fc_tag_val(tl);
1466+ memcpy(&fc_inode, val, sizeof(fc_inode));
14641467
1465− ino = le32_to_cpu(fc_inode->fc_ino);
1468+ ino = le32_to_cpu(fc_inode.fc_ino);
14661469 trace_ext4_fc_replay(sb, tag, ino, 0, 0);
14671470
14681471 inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL);
@@ -1474,12 +1477,13 @@ static int ext4_fc_replay_inode(struct super_block *sb, struct ext4_fc_tl *tl) · 5 unmodified lines
14741477
14751478 ext4_fc_record_modified_inode(sb, ino);
14761479
1477− raw_fc_inode = (struct ext4_inode *)fc_inode->fc_raw_inode;
1480+ raw_fc_inode = (struct ext4_inode *)
1481+ (val + offsetof(struct ext4_fc_inode, fc_raw_inode));
14781482 ret = ext4_get_fc_inode_loc(sb, ino, &iloc);
14791483 if (ret)
14801484 goto out;
14811485
1482− inode_len = ext4_fc_tag_len(tl) - sizeof(struct ext4_fc_inode);
1486+ inode_len = le16_to_cpu(tl->fc_len) - sizeof(struct ext4_fc_inode);
14831487 raw_inode = ext4_raw_inode(&iloc);
14841488
14851489 memcpy(raw_inode, raw_fc_inode, offsetof(struct ext4_inode, i_block));
@@ -1547,14 +1551,15 @@ out: · 61 unmodified lines
15471551 * inode for which we are trying to create a dentry here, should already have
15481552 * been replayed before we start here.
15491553 */
1550−static int ext4_fc_replay_create(struct super_block *sb, struct ext4_fc_tl *tl)
1554+static int ext4_fc_replay_create(struct super_block *sb, struct ext4_fc_tl *tl,
1555+ u8 *val)
15511556 {
15521557 int ret = 0;
15531558 struct inode *inode = NULL;
15541559 struct inode *dir = NULL;
15551560 struct dentry_info_args darg;
15561561
1557− tl_to_darg(&darg, tl);
1562+ tl_to_darg(&darg, tl, val);
15581563
15591564 trace_ext4_fc_replay(sb, EXT4_FC_TAG_CREAT, darg.ino,
15601565 darg.parent_ino, darg.dname_len);
@@ -1633,9 +1638,9 @@ static int ext4_fc_record_regions(struct super_block *sb, int ino, · 72 unmodified lines
16331638
16341639 /* Replay add range tag */
16351640 static int ext4_fc_replay_add_range(struct super_block *sb,
1636− struct ext4_fc_tl *tl)
1641+ struct ext4_fc_tl *tl, u8 *val)
16371642 {
1638− struct ext4_fc_add_range *fc_add_ex;
1643+ struct ext4_fc_add_range fc_add_ex;
16391644 struct ext4_extent newex, *ex;
16401645 struct inode *inode;
16411646 ext4_lblk_t start, cur;
@@ -1645,15 +1650,14 @@ static int ext4_fc_replay_add_range(struct super_block *sb, · 3 unmodified lines
16451650 struct ext4_ext_path *path = NULL;
16461651 int ret;
16471652
1648− fc_add_ex = (struct ext4_fc_add_range *)ext4_fc_tag_val(tl);
1649− ex = (struct ext4_extent *)&fc_add_ex->fc_ex;
1653+ memcpy(&fc_add_ex, val, sizeof(fc_add_ex));
1654+ ex = (struct ext4_extent *)&fc_add_ex.fc_ex;
16501655
16511656 trace_ext4_fc_replay(sb, EXT4_FC_TAG_ADD_RANGE,
1652− le32_to_cpu(fc_add_ex->fc_ino), le32_to_cpu(ex->ee_block),
1657+ le32_to_cpu(fc_add_ex.fc_ino), le32_to_cpu(ex->ee_block),
16531658 ext4_ext_get_actual_len(ex));
16541659
1655− inode = ext4_iget(sb, le32_to_cpu(fc_add_ex->fc_ino),
1656− EXT4_IGET_NORMAL);
1660+ inode = ext4_iget(sb, le32_to_cpu(fc_add_ex.fc_ino), EXT4_IGET_NORMAL);
16571661 if (IS_ERR(inode)) {
16581662 jbd_debug(1, "Inode not found.");
16591663 return 0;
@@ -1762,32 +1766,33 @@ next: · 102 unmodified lines
17621766
17631767 /* Replay DEL_RANGE tag */
17641768 static int
1765−ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl)
1769+ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
1770+ u8 *val)
17661771 {
17671772 struct inode *inode;
1768− struct ext4_fc_del_range *lrange;
1773+ struct ext4_fc_del_range lrange;
17691774 struct ext4_map_blocks map;
17701775 ext4_lblk_t cur, remaining;
17711776 int ret;
17721777
1773− lrange = (struct ext4_fc_del_range *)ext4_fc_tag_val(tl);
1774− cur = le32_to_cpu(lrange->fc_lblk);
1775− remaining = le32_to_cpu(lrange->fc_len);
1778+ memcpy(&lrange, val, sizeof(lrange));
1779+ cur = le32_to_cpu(lrange.fc_lblk);
1780+ remaining = le32_to_cpu(lrange.fc_len);
17761781
17771782 trace_ext4_fc_replay(sb, EXT4_FC_TAG_DEL_RANGE,
1778− le32_to_cpu(lrange->fc_ino), cur, remaining);
1783+ le32_to_cpu(lrange.fc_ino), cur, remaining);
17791784
1780− inode = ext4_iget(sb, le32_to_cpu(lrange->fc_ino), EXT4_IGET_NORMAL);
1785+ inode = ext4_iget(sb, le32_to_cpu(lrange.fc_ino), EXT4_IGET_NORMAL);
17811786 if (IS_ERR(inode)) {
1782− jbd_debug(1, "Inode %d not found", le32_to_cpu(lrange->fc_ino));
1787+ jbd_debug(1, "Inode %d not found", le32_to_cpu(lrange.fc_ino));
17831788 return 0;
17841789 }
17851790
17861791 ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
17871792
17881793 jbd_debug(1, "DEL_RANGE, inode %ld, lblk %d, len %d\n",
1789− inode->i_ino, le32_to_cpu(lrange->fc_lblk),
1790− le32_to_cpu(lrange->fc_len));
1794+ inode->i_ino, le32_to_cpu(lrange.fc_lblk),
1795+ le32_to_cpu(lrange.fc_len));
17911796 while (remaining > 0) {
17921797 map.m_lblk = cur;
17931798 map.m_len = remaining;
@@ -1808,8 +1813,8 @@ ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl) · 14 unmodified lines
18081813 }
18091814
18101815 ret = ext4_punch_hole(inode,
1811− le32_to_cpu(lrange->fc_lblk) << sb->s_blocksize_bits,
1812− le32_to_cpu(lrange->fc_len) << sb->s_blocksize_bits);
1816+ le32_to_cpu(lrange.fc_lblk) << sb->s_blocksize_bits,
1817+ le32_to_cpu(lrange.fc_len) << sb->s_blocksize_bits);
18131818 if (ret)
18141819 jbd_debug(1, "ext4_punch_hole returned %d", ret);
18151820 ext4_ext_replay_shrink_inode(inode,
@@ -1925,11 +1930,11 @@ static int ext4_fc_replay_scan(journal_t *journal, · 109 unmodified lines
19251930 struct ext4_sb_info *sbi = EXT4_SB(sb);
19261931 struct ext4_fc_replay_state *state;
19271932 int ret = JBD2_FC_REPLAY_CONTINUE;
1928− struct ext4_fc_add_range *ext;
1929− struct ext4_fc_tl *tl;
1930− struct ext4_fc_tail *tail;
1931− __u8 *start, *end;
1932− struct ext4_fc_head *head;
1933+ struct ext4_fc_add_range ext;
1934+ struct ext4_fc_tl tl;
1935+ struct ext4_fc_tail tail;
1936+ __u8 *start, *end, *cur, *val;
1937+ struct ext4_fc_head head;
19331938 struct ext4_extent *ex;
19341939
19351940 state = &sbi->s_fc_replay_state;
@@ -1956,15 +1961,17 @@ static int ext4_fc_replay_scan(journal_t *journal, · 20 unmodified lines
19561961 }
19571962
19581963 state->fc_replay_expected_off++;
1959− fc_for_each_tl(start, end, tl) {
1964+ for (cur = start; cur < end; cur = cur + sizeof(tl) + le16_to_cpu(tl.fc_len)) {
1965+ memcpy(&tl, cur, sizeof(tl));
1966+ val = cur + sizeof(tl);
19601967 jbd_debug(3, "Scan phase, tag:%s, blk %lld\n",
1961− tag2str(le16_to_cpu(tl->fc_tag)), bh->b_blocknr);
1962− switch (le16_to_cpu(tl->fc_tag)) {
1968+ tag2str(le16_to_cpu(tl.fc_tag)), bh->b_blocknr);
1969+ switch (le16_to_cpu(tl.fc_tag)) {
19631970 case EXT4_FC_TAG_ADD_RANGE:
1964− ext = (struct ext4_fc_add_range *)ext4_fc_tag_val(tl);
1965− ex = (struct ext4_extent *)&ext->fc_ex;
1971+ memcpy(&ext, val, sizeof(ext));
1972+ ex = (struct ext4_extent *)&ext.fc_ex;
19661973 ret = ext4_fc_record_regions(sb,
1967− le32_to_cpu(ext->fc_ino),
1974+ le32_to_cpu(ext.fc_ino),
19681975 le32_to_cpu(ex->ee_block), ext4_ext_pblock(ex),
19691976 ext4_ext_get_actual_len(ex));
19701977 if (ret < 0)
@@ -1978,18 +1985,18 @@ static int ext4_fc_replay_scan(journal_t *journal, · 7 unmodified lines
19781985 case EXT4_FC_TAG_INODE:
19791986 case EXT4_FC_TAG_PAD:
19801987 state->fc_cur_tag++;
1981− state->fc_crc = ext4_chksum(sbi, state->fc_crc, tl,
1982− sizeof(*tl) + ext4_fc_tag_len(tl));
1988+ state->fc_crc = ext4_chksum(sbi, state->fc_crc, cur,
1989+ sizeof(tl) + le16_to_cpu(tl.fc_len));
19831990 break;
19841991 case EXT4_FC_TAG_TAIL:
19851992 state->fc_cur_tag++;
1986− tail = (struct ext4_fc_tail *)ext4_fc_tag_val(tl);
1987− state->fc_crc = ext4_chksum(sbi, state->fc_crc, tl,
1988− sizeof(*tl) +
1993+ memcpy(&tail, val, sizeof(tail));
1994+ state->fc_crc = ext4_chksum(sbi, state->fc_crc, cur,
1995+ sizeof(tl) +
19891996 offsetof(struct ext4_fc_tail,
19901997 fc_crc));
1991− if (le32_to_cpu(tail->fc_tid) == expected_tid &&
1992− le32_to_cpu(tail->fc_crc) == state->fc_crc) {
1998+ if (le32_to_cpu(tail.fc_tid) == expected_tid &&
1999+ le32_to_cpu(tail.fc_crc) == state->fc_crc) {
19932000 state->fc_replay_num_tags = state->fc_cur_tag;
19942001 state->fc_regions_valid =
19952002 state->fc_regions_used;
@@ -2000,19 +2007,19 @@ static int ext4_fc_replay_scan(journal_t *journal, · 4 unmodified lines
20002007 state->fc_crc = 0;
20012008 break;
20022009 case EXT4_FC_TAG_HEAD:
2003− head = (struct ext4_fc_head *)ext4_fc_tag_val(tl);
2004− if (le32_to_cpu(head->fc_features) &
2010+ memcpy(&head, val, sizeof(head));
2011+ if (le32_to_cpu(head.fc_features) &
20052012 ~EXT4_FC_SUPPORTED_FEATURES) {
20062013 ret = -EOPNOTSUPP;
20072014 break;
20082015 }
2009− if (le32_to_cpu(head->fc_tid) != expected_tid) {
2016+ if (le32_to_cpu(head.fc_tid) != expected_tid) {
20102017 ret = JBD2_FC_REPLAY_STOP;
20112018 break;
20122019 }
20132020 state->fc_cur_tag++;
2014− state->fc_crc = ext4_chksum(sbi, state->fc_crc, tl,
2015− sizeof(*tl) + ext4_fc_tag_len(tl));
2021+ state->fc_crc = ext4_chksum(sbi, state->fc_crc, cur,
2022+ sizeof(tl) + le16_to_cpu(tl.fc_len));
20162023 break;
20172024 default:
20182025 ret = state->fc_replay_num_tags ?
@@ -2036,11 +2043,11 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh, · 17 unmodified lines
20362043 {
20372044 struct super_block *sb = journal->j_private;
20382045 struct ext4_sb_info *sbi = EXT4_SB(sb);
2039− struct ext4_fc_tl *tl;
2040− __u8 *start, *end;
2046+ struct ext4_fc_tl tl;
2047+ __u8 *start, *end, *cur, *val;
20412048 int ret = JBD2_FC_REPLAY_CONTINUE;
20422049 struct ext4_fc_replay_state *state = &sbi->s_fc_replay_state;
2043− struct ext4_fc_tail *tail;
2050+ struct ext4_fc_tail tail;
20442051
20452052 if (pass == PASS_SCAN) {
20462053 state->fc_current_pass = PASS_SCAN;
@@ -2067,49 +2074,52 @@ static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh, · 20 unmodified lines
20672074 start = (u8 *)bh->b_data;
20682075 end = (__u8 *)bh->b_data + journal->j_blocksize - 1;
20692076
2070− fc_for_each_tl(start, end, tl) {
2077+ for (cur = start; cur < end; cur = cur + sizeof(tl) + le16_to_cpu(tl.fc_len)) {
2078+ memcpy(&tl, cur, sizeof(tl));
2079+ val = cur + sizeof(tl);
2080+
20712081 if (state->fc_replay_num_tags == 0) {
20722082 ret = JBD2_FC_REPLAY_STOP;
20732083 ext4_fc_set_bitmaps_and_counters(sb);
20742084 break;
20752085 }
20762086 jbd_debug(3, "Replay phase, tag:%s\n",
2077− tag2str(le16_to_cpu(tl->fc_tag)));
2087+ tag2str(le16_to_cpu(tl.fc_tag)));
20782088 state->fc_replay_num_tags--;
2079− switch (le16_to_cpu(tl->fc_tag)) {
2089+ switch (le16_to_cpu(tl.fc_tag)) {
20802090 case EXT4_FC_TAG_LINK:
2081− ret = ext4_fc_replay_link(sb, tl);
2091+ ret = ext4_fc_replay_link(sb, &tl, val);
20822092 break;
20832093 case EXT4_FC_TAG_UNLINK:
2084− ret = ext4_fc_replay_unlink(sb, tl);
2094+ ret = ext4_fc_replay_unlink(sb, &tl, val);
20852095 break;
20862096 case EXT4_FC_TAG_ADD_RANGE:
2087− ret = ext4_fc_replay_add_range(sb, tl);
2097+ ret = ext4_fc_replay_add_range(sb, &tl, val);
20882098 break;
20892099 case EXT4_FC_TAG_CREAT:
2090− ret = ext4_fc_replay_create(sb, tl);
2100+ ret = ext4_fc_replay_create(sb, &tl, val);
20912101 break;
20922102 case EXT4_FC_TAG_DEL_RANGE:
2093− ret = ext4_fc_replay_del_range(sb, tl);
2103+ ret = ext4_fc_replay_del_range(sb, &tl, val);
20942104 break;
20952105 case EXT4_FC_TAG_INODE:
2096− ret = ext4_fc_replay_inode(sb, tl);
2106+ ret = ext4_fc_replay_inode(sb, &tl, val);
20972107 break;
20982108 case EXT4_FC_TAG_PAD:
20992109 trace_ext4_fc_replay(sb, EXT4_FC_TAG_PAD, 0,
2100− ext4_fc_tag_len(tl), 0);
2110+ le16_to_cpu(tl.fc_len), 0);
21012111 break;
21022112 case EXT4_FC_TAG_TAIL:
21032113 trace_ext4_fc_replay(sb, EXT4_FC_TAG_TAIL, 0,
2104− ext4_fc_tag_len(tl), 0);
2105− tail = (struct ext4_fc_tail *)ext4_fc_tag_val(tl);
2106− WARN_ON(le32_to_cpu(tail->fc_tid) != expected_tid);
2114+ le16_to_cpu(tl.fc_len), 0);
2115+ memcpy(&tail, val, sizeof(tail));
2116+ WARN_ON(le32_to_cpu(tail.fc_tid) != expected_tid);
21072117 break;
21082118 case EXT4_FC_TAG_HEAD:
21092119 break;
21102120 default:
2111− trace_ext4_fc_replay(sb, le16_to_cpu(tl->fc_tag), 0,
2112− ext4_fc_tag_len(tl), 0);
2121+ trace_ext4_fc_replay(sb, le16_to_cpu(tl.fc_tag), 0,
2122+ le16_to_cpu(tl.fc_len), 0);
21132123 ret = -ECANCELED;
21142124 break;
21152125 }
fs/ext4/fast_commit.h+0−19
@@ -153,13 +153,6 @@ struct ext4_fc_replay_state { · 152 unmodified lines
153153 #define region_last(__region) (((__region)->lblk) + ((__region)->len) - 1)
154154 #endif
155155
156−#define fc_for_each_tl(__start, __end, __tl) \
157− for (tl = (struct ext4_fc_tl *)(__start); \
158− (__u8 *)tl < (__u8 *)(__end); \
159− tl = (struct ext4_fc_tl *)((__u8 *)tl + \
160− sizeof(struct ext4_fc_tl) + \
161− + le16_to_cpu(tl->fc_len)))
162−
163156 static inline const char *tag2str(__u16 tag)
164157 {
165158 switch (tag) {
@@ -186,16 +179,4 @@ static inline const char *tag2str(__u16 tag) · 20 unmodified lines
186179 }
187180 }
188181
189−/* Get length of a particular tlv */
190−static inline int ext4_fc_tag_len(struct ext4_fc_tl *tl)
191−{
192− return le16_to_cpu(tl->fc_len);
193−}
194−
195−/* Get a pointer to "value" of a tlv */
196−static inline __u8 *ext4_fc_tag_val(struct ext4_fc_tl *tl)
197−{
198− return (__u8 *)tl + sizeof(*tl);
199−}
200−
201182 #endif /* __FAST_COMMIT_H__ */
fs/ext4/ialloc.c+4−2
@@ -322,14 +322,16 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) · 321 unmodified lines
322322 if (is_directory) {
323323 count = ext4_used_dirs_count(sb, gdp) - 1;
324324 ext4_used_dirs_set(sb, gdp, count);
325− percpu_counter_dec(&sbi->s_dirs_counter);
325+ if (percpu_counter_initialized(&sbi->s_dirs_counter))
326+ percpu_counter_dec(&sbi->s_dirs_counter);
326327 }
327328 ext4_inode_bitmap_csum_set(sb, block_group, gdp, bitmap_bh,
328329 EXT4_INODES_PER_GROUP(sb) / 8);
329330 ext4_group_desc_csum_set(sb, block_group, gdp);
330331 ext4_unlock_group(sb, block_group);
331332
332− percpu_counter_inc(&sbi->s_freeinodes_counter);
333+ if (percpu_counter_initialized(&sbi->s_freeinodes_counter))
334+ percpu_counter_inc(&sbi->s_freeinodes_counter);
333335 if (sbi->s_log_groups_per_flex) {
334336 struct flex_groups *fg;
335337
fs/ext4/mballoc.c+1−1
@@ -3217,7 +3217,7 @@ static int ext4_mb_init_backend(struct super_block *sb) · 3216 unmodified lines
32173217 */
32183218 if (sbi->s_es->s_log_groups_per_flex >= 32) {
32193219 ext4_msg(sb, KERN_ERR, "too many log groups per flexible block group");
3220− goto err_freesgi;
3220+ goto err_freebuddy;
32213221 }
32223222 sbi->s_mb_prefetch = min_t(uint, 1 << sbi->s_es->s_log_groups_per_flex,
32233223 BLK_MAX_SEGMENT_SIZE >> (sb->s_blocksize_bits - 9));
fs/ext4/namei.c+4−2
@@ -1376,7 +1376,8 @@ int ext4_fname_setup_ci_filename(struct inode *dir, const struct qstr *iname, · 1375 unmodified lines
13761376 struct dx_hash_info *hinfo = &name->hinfo;
13771377 int len;
13781378
1379− if (!IS_CASEFOLDED(dir) || !dir->i_sb->s_encoding) {
1379+ if (!IS_CASEFOLDED(dir) || !dir->i_sb->s_encoding ||
1380+ (IS_ENCRYPTED(dir) && !fscrypt_has_encryption_key(dir))) {
13801381 cf_name->name = NULL;
13811382 return 0;
13821383 }
@@ -1427,7 +1428,8 @@ static bool ext4_match(struct inode *parent, · 44 unmodified lines
14271428 #endif
14281429
14291430 #ifdef CONFIG_UNICODE
1430− if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent)) {
1431+ if (parent->i_sb->s_encoding && IS_CASEFOLDED(parent) &&
1432+ (!IS_ENCRYPTED(parent) || fscrypt_has_encryption_key(parent))) {
14311433 if (fname->cf_name.name) {
14321434 struct qstr cf = {.name = fname->cf_name.name,
14331435 .len = fname->cf_name.len};
fs/ext4/super.c+9−2
@@ -4462,14 +4462,20 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) · 4461 unmodified lines
44624462 }
44634463
44644464 if (sb->s_blocksize != blocksize) {
4465+ /*
4466+ * bh must be released before kill_bdev(), otherwise
4467+ * it won't be freed and its page also. kill_bdev()
4468+ * is called by sb_set_blocksize().
4469+ */
4470+ brelse(bh);
44654471 /* Validate the filesystem blocksize */
44664472 if (!sb_set_blocksize(sb, blocksize)) {
44674473 ext4_msg(sb, KERN_ERR, "bad block size %d",
44684474 blocksize);
4475+ bh = NULL;
44694476 goto failed_mount;
44704477 }
44714478
4472− brelse(bh);
44734479 logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
44744480 offset = do_div(logical_sb_block, blocksize);
44754481 bh = ext4_sb_bread_unmovable(sb, logical_sb_block);
@@ -5202,8 +5208,9 @@ failed_mount: · 726 unmodified lines
52025208 kfree(get_qf_name(sb, sbi, i));
52035209 #endif
52045210 fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
5205− ext4_blkdev_remove(sbi);
5211+ /* ext4_blkdev_remove() calls kill_bdev(), release bh before it. */
52065212 brelse(bh);
5213+ ext4_blkdev_remove(sbi);
52075214 out_fail:
52085215 sb->s_fs_info = NULL;
52095216 kfree(sbi->s_blockgroup_lock);
fs/ext4/sysfs.c+4−0
@@ -315,7 +315,9 @@ EXT4_ATTR_FEATURE(verity); · 314 unmodified lines
315315 #endif
316316 EXT4_ATTR_FEATURE(metadata_csum_seed);
317317 EXT4_ATTR_FEATURE(fast_commit);
318+#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
318319 EXT4_ATTR_FEATURE(encrypted_casefold);
320+#endif
319321
320322 static struct attribute *ext4_feat_attrs[] = {
321323 ATTR_LIST(lazy_itable_init),
@@ -333,7 +335,9 @@ static struct attribute *ext4_feat_attrs[] = { · 11 unmodified lines
333335 #endif
334336 ATTR_LIST(metadata_csum_seed),
335337 ATTR_LIST(fast_commit),
338+#if defined(CONFIG_UNICODE) && defined(CONFIG_FS_ENCRYPTION)
336339 ATTR_LIST(encrypted_casefold),
340+#endif
337341 NULL,
338342 };
339343 ATTRIBUTE_GROUPS(ext4_feat);
fs/gfs2/file.c+4−1
@@ -911,8 +911,11 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) · 910 unmodified lines
911911 current->backing_dev_info = inode_to_bdi(inode);
912912 buffered = iomap_file_buffered_write(iocb, from, &gfs2_iomap_ops);
913913 current->backing_dev_info = NULL;
914− if (unlikely(buffered <= 0))
914+ if (unlikely(buffered <= 0)) {
915+ if (!ret)
916+ ret = buffered;
915917 goto out_unlock;
918+ }
916919
917920 /*
918921 * We need to ensure that the page cache pages are written to
fs/gfs2/glock.c+24−4
@@ -582,6 +582,16 @@ out_locked: · 581 unmodified lines
582582 spin_unlock(&gl->gl_lockref.lock);
583583 }
584584
585+static bool is_system_glock(struct gfs2_glock *gl)
586+{
587+ struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
588+ struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
589+
590+ if (gl == m_ip->i_gl)
591+ return true;
592+ return false;
593+}
594+
585595 /**
586596 * do_xmote - Calls the DLM to change the state of a lock
587597 * @gl: The lock state
@@ -671,17 +681,25 @@ skip_inval: · 83 unmodified lines
671681 * to see sd_log_error and withdraw, and in the meantime, requeue the
672682 * work for later.
673683 *
684+ * We make a special exception for some system glocks, such as the
685+ * system statfs inode glock, which needs to be granted before the
686+ * gfs2_quotad daemon can exit, and that exit needs to finish before
687+ * we can unmount the withdrawn file system.
688+ *
674689 * However, if we're just unlocking the lock (say, for unmount, when
675690 * gfs2_gl_hash_clear calls clear_glock) and recovery is complete
676691 * then it's okay to tell dlm to unlock it.
677692 */
678693 if (unlikely(sdp->sd_log_error && !gfs2_withdrawn(sdp)))
679694 gfs2_withdraw_delayed(sdp);
680− if (glock_blocked_by_withdraw(gl)) {
681− if (target != LM_ST_UNLOCKED ||
682− test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags)) {
695+ if (glock_blocked_by_withdraw(gl) &&
696+ (target != LM_ST_UNLOCKED ||
697+ test_bit(SDF_WITHDRAW_RECOVERY, &sdp->sd_flags))) {
698+ if (!is_system_glock(gl)) {
683699 gfs2_glock_queue_work(gl, GL_GLOCK_DFT_HOLD);
684700 goto out;
701+ } else {
702+ clear_bit(GLF_INVALIDATE_IN_PROGRESS, &gl->gl_flags);
685703 }
686704 }
687705
@@ -1466,9 +1484,11 @@ void gfs2_glock_dq(struct gfs2_holder *gh) · 778 unmodified lines
14661484 glock_blocked_by_withdraw(gl) &&
14671485 gh->gh_gl != sdp->sd_jinode_gl) {
14681486 sdp->sd_glock_dqs_held++;
1487+ spin_unlock(&gl->gl_lockref.lock);
14691488 might_sleep();
14701489 wait_on_bit(&sdp->sd_flags, SDF_WITHDRAW_RECOVERY,
14711490 TASK_UNINTERRUPTIBLE);
1491+ spin_lock(&gl->gl_lockref.lock);
14721492 }
14731493 if (gh->gh_flags & GL_NOCACHE)
14741494 handle_callback(gl, LM_ST_UNLOCKED, 0, false);
@@ -1775,6 +1795,7 @@ __acquires(&lru_lock) · 300 unmodified lines
17751795 while(!list_empty(list)) {
17761796 gl = list_first_entry(list, struct gfs2_glock, gl_lru);
17771797 list_del_init(&gl->gl_lru);
1798+ clear_bit(GLF_LRU, &gl->gl_flags);
17781799 if (!spin_trylock(&gl->gl_lockref.lock)) {
17791800 add_back_to_lru:
17801801 list_add(&gl->gl_lru, &lru_list);
@@ -1820,7 +1841,6 @@ static long gfs2_scan_glock_lru(int nr) · 39 unmodified lines
18201841 if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
18211842 list_move(&gl->gl_lru, &dispose);
18221843 atomic_dec(&lru_count);
1823− clear_bit(GLF_LRU, &gl->gl_flags);
18241844 freed++;
18251845 continue;
18261846 }
fs/gfs2/glops.c+1−1
@@ -396,7 +396,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) · 395 unmodified lines
396396 struct timespec64 atime;
397397 u16 height, depth;
398398 umode_t mode = be32_to_cpu(str->di_mode);
399− bool is_new = ip->i_inode.i_flags & I_NEW;
399+ bool is_new = ip->i_inode.i_state & I_NEW;
400400
401401 if (unlikely(ip->i_no_addr != be64_to_cpu(str->di_num.no_addr)))
402402 goto corrupt;
fs/gfs2/log.c+3−3
@@ -926,10 +926,10 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags) · 925 unmodified lines
926926 }
927927
928928 /**
929− * ail_drain - drain the ail lists after a withdraw
929+ * gfs2_ail_drain - drain the ail lists after a withdraw
930930 * @sdp: Pointer to GFS2 superblock
931931 */
932−static void ail_drain(struct gfs2_sbd *sdp)
932+void gfs2_ail_drain(struct gfs2_sbd *sdp)
933933 {
934934 struct gfs2_trans *tr;
935935
@@ -956,6 +956,7 @@ static void ail_drain(struct gfs2_sbd *sdp) · 20 unmodified lines
956956 list_del(&tr->tr_list);
957957 gfs2_trans_free(sdp, tr);
958958 }
959+ gfs2_drain_revokes(sdp);
959960 spin_unlock(&sdp->sd_ail_lock);
960961 }
961962
@@ -1162,7 +1163,6 @@ out_withdraw: · 200 unmodified lines
11621163 if (tr && list_empty(&tr->tr_list))
11631164 list_add(&tr->tr_list, &sdp->sd_ail1_list);
11641165 spin_unlock(&sdp->sd_ail_lock);
1165− ail_drain(sdp); /* frees all transactions */
11661166 tr = NULL;
11671167 goto out_end;
11681168 }
fs/gfs2/log.h+1−0
@@ -93,5 +93,6 @@ extern int gfs2_logd(void *data); · 92 unmodified lines
9393 extern void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
9494 extern void gfs2_glock_remove_revoke(struct gfs2_glock *gl);
9595 extern void gfs2_flush_revokes(struct gfs2_sbd *sdp);
96+extern void gfs2_ail_drain(struct gfs2_sbd *sdp);
9697
9798 #endif /* __LOG_DOT_H__ */
fs/gfs2/lops.c+6−1
@@ -885,7 +885,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) · 884 unmodified lines
885885 gfs2_log_write_page(sdp, page);
886886 }
887887
888−static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
888+void gfs2_drain_revokes(struct gfs2_sbd *sdp)
889889 {
890890 struct list_head *head = &sdp->sd_log_revokes;
891891 struct gfs2_bufdata *bd;
@@ -900,6 +900,11 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) · 8 unmodified lines
900900 }
901901 }
902902
903+static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
904+{
905+ gfs2_drain_revokes(sdp);
906+}
907+
903908 static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
904909 struct gfs2_log_header_host *head, int pass)
905910 {
fs/gfs2/lops.h+1−0
@@ -20,6 +20,7 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf); · 19 unmodified lines
2020 extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
2121 extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
2222 struct gfs2_log_header_host *head, bool keep_cache);
23+extern void gfs2_drain_revokes(struct gfs2_sbd *sdp);
2324 static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
2425 {
2526 return sdp->sd_ldptrs;
fs/gfs2/util.c+1−0
@@ -131,6 +131,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) · 130 unmodified lines
131131 if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc)
132132 return;
133133
134+ gfs2_ail_drain(sdp); /* frees all transactions */
134135 inode = sdp->sd_jdesc->jd_inode;
135136 ip = GFS2_I(inode);
136137 i_gl = ip->i_gl;
fs/io_uring.c+30−13
@@ -783,6 +783,11 @@ struct io_task_work { · 782 unmodified lines
783783 task_work_func_t func;
784784 };
785785
786+enum {
787+ IORING_RSRC_FILE = 0,
788+ IORING_RSRC_BUFFER = 1,
789+};
790+
786791 /*
787792 * NOTE! Each of the iocb union members has the file pointer
788793 * as the first entry in their struct definition. So you can
@@ -8228,6 +8233,7 @@ static int io_buffer_account_pin(struct io_ring_ctx *ctx, struct page **pages, · 7439 unmodified lines
82288233 {
82298234 int i, ret;
82308235
8236+ imu->acct_pages = 0;
82318237 for (i = 0; i < nr_pages; i++) {
82328238 if (!PageCompound(pages[i])) {
82338239 imu->acct_pages++;
@@ -9670,7 +9676,8 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, · 1436 unmodified lines
96709676 IORING_FEAT_SUBMIT_STABLE | IORING_FEAT_RW_CUR_POS |
96719677 IORING_FEAT_CUR_PERSONALITY | IORING_FEAT_FAST_POLL |
96729678 IORING_FEAT_POLL_32BITS | IORING_FEAT_SQPOLL_NONFIXED |
9673− IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS;
9679+ IORING_FEAT_EXT_ARG | IORING_FEAT_NATIVE_WORKERS |
9680+ IORING_FEAT_RSRC_TAGS;
96749681
96759682 if (copy_to_user(params, p, sizeof(*p))) {
96769683 ret = -EFAULT;
@@ -9910,7 +9917,7 @@ static int io_register_files_update(struct io_ring_ctx *ctx, void __user *arg, · 233 unmodified lines
99109917 }
99119918
99129919 static int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg,
9913− unsigned size)
9920+ unsigned size, unsigned type)
99149921 {
99159922 struct io_uring_rsrc_update2 up;
99169923
@@ -9918,13 +9925,13 @@ static int io_register_rsrc_update(struct io_ring_ctx *ctx, void __user *arg, · 1 unmodified line
99189925 return -EINVAL;
99199926 if (copy_from_user(&up, arg, sizeof(up)))
99209927 return -EFAULT;
9921− if (!up.nr)
9928+ if (!up.nr || up.resv)
99229929 return -EINVAL;
9923− return __io_register_rsrc_update(ctx, up.type, &up, up.nr);
9930+ return __io_register_rsrc_update(ctx, type, &up, up.nr);
99249931 }
99259932
99269933 static int io_register_rsrc(struct io_ring_ctx *ctx, void __user *arg,
9927− unsigned int size)
9934+ unsigned int size, unsigned int type)
99289935 {
99299936 struct io_uring_rsrc_register rr;
99309937
@@ -9935,10 +9942,10 @@ static int io_register_rsrc(struct io_ring_ctx *ctx, void __user *arg, · 4 unmodified lines
99359942 memset(&rr, 0, sizeof(rr));
99369943 if (copy_from_user(&rr, arg, size))
99379944 return -EFAULT;
9938− if (!rr.nr)
9945+ if (!rr.nr || rr.resv || rr.resv2)
99399946 return -EINVAL;
99409947
9941− switch (rr.type) {
9948+ switch (type) {
99429949 case IORING_RSRC_FILE:
99439950 return io_sqe_files_register(ctx, u64_to_user_ptr(rr.data),
99449951 rr.nr, u64_to_user_ptr(rr.tags));
@@ -9960,8 +9967,10 @@ static bool io_register_op_must_quiesce(int op) · 15 unmodified lines
99609967 case IORING_REGISTER_PROBE:
99619968 case IORING_REGISTER_PERSONALITY:
99629969 case IORING_UNREGISTER_PERSONALITY:
9963− case IORING_REGISTER_RSRC:
9964− case IORING_REGISTER_RSRC_UPDATE:
9970+ case IORING_REGISTER_FILES2:
9971+ case IORING_REGISTER_FILES_UPDATE2:
9972+ case IORING_REGISTER_BUFFERS2:
9973+ case IORING_REGISTER_BUFFERS_UPDATE:
99659974 return false;
99669975 default:
99679976 return true;
@@ -10087,11 +10096,19 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, · 119 unmodified lines
1008710096 case IORING_REGISTER_RESTRICTIONS:
1008810097 ret = io_register_restrictions(ctx, arg, nr_args);
1008910098 break;
10090− case IORING_REGISTER_RSRC:
10091− ret = io_register_rsrc(ctx, arg, nr_args);
10099+ case IORING_REGISTER_FILES2:
10100+ ret = io_register_rsrc(ctx, arg, nr_args, IORING_RSRC_FILE);
10101+ break;
10102+ case IORING_REGISTER_FILES_UPDATE2:
10103+ ret = io_register_rsrc_update(ctx, arg, nr_args,
10104+ IORING_RSRC_FILE);
10105+ break;
10106+ case IORING_REGISTER_BUFFERS2:
10107+ ret = io_register_rsrc(ctx, arg, nr_args, IORING_RSRC_BUFFER);
1009210108 break;
10093− case IORING_REGISTER_RSRC_UPDATE:
10094− ret = io_register_rsrc_update(ctx, arg, nr_args);
10109+ case IORING_REGISTER_BUFFERS_UPDATE:
10110+ ret = io_register_rsrc_update(ctx, arg, nr_args,
10111+ IORING_RSRC_BUFFER);
1009510112 break;
1009610113 default:
1009710114 ret = -EINVAL;
fs/nfs/client.c+1−1
@@ -406,7 +406,7 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) · 405 unmodified lines
406406
407407 if (cl_init->hostname == NULL) {
408408 WARN_ON(1);
409− return NULL;
409+ return ERR_PTR(-EINVAL);
410410 }
411411
412412 /* see if the client already exists */
fs/nfs/nfs4_fs.h+1−0
@@ -205,6 +205,7 @@ struct nfs4_exception { · 204 unmodified lines
205205 struct inode *inode;
206206 nfs4_stateid *stateid;
207207 long timeout;
208+ unsigned char task_is_privileged : 1;
208209 unsigned char delay : 1,
209210 recovering : 1,
210211 retry : 1;
fs/nfs/nfs4client.c+1−1
@@ -435,8 +435,8 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp, · 434 unmodified lines
435435 */
436436 nfs_mark_client_ready(clp, -EPERM);
437437 }
438− nfs_put_client(clp);
439438 clear_bit(NFS_CS_TSM_POSSIBLE, &clp->cl_flags);
439+ nfs_put_client(clp);
440440 return old;
441441
442442 error:
fs/nfs/nfs4proc.c+30−7
@@ -589,6 +589,8 @@ int nfs4_handle_exception(struct nfs_server *server, int errorcode, struct nfs4_ · 588 unmodified lines
589589 goto out_retry;
590590 }
591591 if (exception->recovering) {
592+ if (exception->task_is_privileged)
593+ return -EDEADLOCK;
592594 ret = nfs4_wait_clnt_recover(clp);
593595 if (test_bit(NFS_MIG_FAILED, &server->mig_status))
594596 return -EIO;
@@ -614,6 +616,8 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, · 19 unmodified lines
614616 goto out_retry;
615617 }
616618 if (exception->recovering) {
619+ if (exception->task_is_privileged)
620+ return -EDEADLOCK;
617621 rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL);
618622 if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0)
619623 rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task);
@@ -3878,6 +3882,10 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f · 3258 unmodified lines
38783882 server->caps |= NFS_CAP_HARDLINKS;
38793883 if (res.has_symlinks != 0)
38803884 server->caps |= NFS_CAP_SYMLINKS;
3885+#ifdef CONFIG_NFS_V4_SECURITY_LABEL
3886+ if (res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL)
3887+ server->caps |= NFS_CAP_SECURITY_LABEL;
3888+#endif
38813889 if (!(res.attr_bitmask[0] & FATTR4_WORD0_FILEID))
38823890 server->fattr_valid &= ~NFS_ATTR_FATTR_FILEID;
38833891 if (!(res.attr_bitmask[1] & FATTR4_WORD1_MODE))
@@ -3898,10 +3906,6 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f · 14 unmodified lines
38983906 server->fattr_valid &= ~NFS_ATTR_FATTR_CTIME;
38993907 if (!(res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY))
39003908 server->fattr_valid &= ~NFS_ATTR_FATTR_MTIME;
3901−#ifdef CONFIG_NFS_V4_SECURITY_LABEL
3902− if (!(res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL))
3903− server->fattr_valid &= ~NFS_ATTR_FATTR_V4_SECURITY_LABEL;
3904−#endif
39053909 memcpy(server->attr_bitmask_nl, res.attr_bitmask,
39063910 sizeof(server->attr_bitmask));
39073911 server->attr_bitmask_nl[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
@@ -5968,6 +5972,14 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen · 2060 unmodified lines
59685972 do {
59695973 err = __nfs4_proc_set_acl(inode, buf, buflen);
59705974 trace_nfs4_set_acl(inode, err);
5975+ if (err == -NFS4ERR_BADOWNER || err == -NFS4ERR_BADNAME) {
5976+ /*
5977+ * no need to retry since the kernel
5978+ * isn't involved in encoding the ACEs.
5979+ */
5980+ err = -EINVAL;
5981+ break;
5982+ }
59715983 err = nfs4_handle_exception(NFS_SERVER(inode), err,
59725984 &exception);
59735985 } while (exception.retry);
@@ -6409,6 +6421,7 @@ static void nfs4_delegreturn_done(struct rpc_task *task, void *calldata) · 435 unmodified lines
64096421 struct nfs4_exception exception = {
64106422 .inode = data->inode,
64116423 .stateid = &data->stateid,
6424+ .task_is_privileged = data->args.seq_args.sa_privileged,
64126425 };
64136426
64146427 if (!nfs4_sequence_done(task, &data->res.seq_res))
@@ -6532,7 +6545,6 @@ static int _nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, · 117 unmodified lines
65326545 data = kzalloc(sizeof(*data), GFP_NOFS);
65336546 if (data == NULL)
65346547 return -ENOMEM;
6535− nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1, 0);
65366548
65376549 nfs4_state_protect(server->nfs_client,
65386550 NFS_SP4_MACH_CRED_CLEANUP,
@@ -6563,6 +6575,12 @@ static int _nfs4_proc_delegreturn(struct inode *inode, const struct cred *cred, · 24 unmodified lines
65636575 }
65646576 }
65656577
6578+ if (!data->inode)
6579+ nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1,
6580+ 1);
6581+ else
6582+ nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1,
6583+ 0);
65666584 task_setup_data.callback_data = data;
65676585 msg.rpc_argp = &data->args;
65686586 msg.rpc_resp = &data->res;
@@ -9640,15 +9658,20 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) · 3071 unmodified lines
96409658 &task_setup_data.rpc_client, &msg);
96419659
96429660 dprintk("--> %s\n", __func__);
9661+ lrp->inode = nfs_igrab_and_active(lrp->args.inode);
96439662 if (!sync) {
9644− lrp->inode = nfs_igrab_and_active(lrp->args.inode);
96459663 if (!lrp->inode) {
96469664 nfs4_layoutreturn_release(lrp);
96479665 return -EAGAIN;
96489666 }
96499667 task_setup_data.flags |= RPC_TASK_ASYNC;
96509668 }
9651− nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 0);
9669+ if (!lrp->inode)
9670+ nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1,
9671+ 1);
9672+ else
9673+ nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1,
9674+ 0);
96529675 task = rpc_run_task(&task_setup_data);
96539676 if (IS_ERR(task))
96549677 return PTR_ERR(task);
fs/nfs/nfstrace.h+0−4
@@ -430,10 +430,6 @@ TRACE_DEFINE_ENUM(O_CLOEXEC); · 429 unmodified lines
430430 { O_NOATIME, "O_NOATIME" }, \
431431 { O_CLOEXEC, "O_CLOEXEC" })
432432
433−TRACE_DEFINE_ENUM(FMODE_READ);
434−TRACE_DEFINE_ENUM(FMODE_WRITE);
435−TRACE_DEFINE_ENUM(FMODE_EXEC);
436−
437433 #define show_fmode_flags(mode) \
438434 __print_flags(mode, "|", \
439435 { ((__force unsigned long)FMODE_READ), "READ" }, \
fs/notify/fanotify/fanotify_user.c+24−6
@@ -424,11 +424,18 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group, · 423 unmodified lines
424424 * events generated by the listener process itself, without disclosing
425425 * the pids of other processes.
426426 */
427− if (!capable(CAP_SYS_ADMIN) &&
427+ if (FAN_GROUP_FLAG(group, FANOTIFY_UNPRIV) &&
428428 task_tgid(current) != event->pid)
429429 metadata.pid = 0;
430430
431− if (path && path->mnt && path->dentry) {
431+ /*
432+ * For now, fid mode is required for an unprivileged listener and
433+ * fid mode does not report fd in events. Keep this check anyway
434+ * for safety in case fid mode requirement is relaxed in the future
435+ * to allow unprivileged listener to get events with no fd and no fid.
436+ */
437+ if (!FAN_GROUP_FLAG(group, FANOTIFY_UNPRIV) &&
438+ path && path->mnt && path->dentry) {
432439 fd = create_fd(group, path, &f);
433440 if (fd < 0)
434441 return fd;
@@ -1040,6 +1047,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) · 605 unmodified lines
10401047 int f_flags, fd;
10411048 unsigned int fid_mode = flags & FANOTIFY_FID_BITS;
10421049 unsigned int class = flags & FANOTIFY_CLASS_BITS;
1050+ unsigned int internal_flags = 0;
10431051
10441052 pr_debug("%s: flags=%x event_f_flags=%x\n",
10451053 __func__, flags, event_f_flags);
@@ -1053,6 +1061,13 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) · 7 unmodified lines
10531061 */
10541062 if ((flags & FANOTIFY_ADMIN_INIT_FLAGS) || !fid_mode)
10551063 return -EPERM;
1064+
1065+ /*
1066+ * Setting the internal flag FANOTIFY_UNPRIV on the group
1067+ * prevents setting mount/filesystem marks on this group and
1068+ * prevents reporting pid and open fd in events.
1069+ */
1070+ internal_flags |= FANOTIFY_UNPRIV;
10561071 }
10571072
10581073 #ifdef CONFIG_AUDITSYSCALL
@@ -1105,7 +1120,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) · 46 unmodified lines
11051120 goto out_destroy_group;
11061121 }
11071122
1108− group->fanotify_data.flags = flags;
1123+ group->fanotify_data.flags = flags | internal_flags;
11091124 group->memcg = get_mem_cgroup_from_mm(current->mm);
11101125
11111126 group->fanotify_data.merge_hash = fanotify_alloc_merge_hash();
@@ -1305,11 +1320,13 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask, · 193 unmodified lines
13051320 group = f.file->private_data;
13061321
13071322 /*
1308− * An unprivileged user is not allowed to watch a mount point nor
1309− * a filesystem.
1323+ * An unprivileged user is not allowed to setup mount nor filesystem
1324+ * marks. This also includes setting up such marks by a group that
1325+ * was initialized by an unprivileged user.
13101326 */
13111327 ret = -EPERM;
1312− if (!capable(CAP_SYS_ADMIN) &&
1328+ if ((!capable(CAP_SYS_ADMIN) ||
1329+ FAN_GROUP_FLAG(group, FANOTIFY_UNPRIV)) &&
13131330 mark_type != FAN_MARK_INODE)
13141331 goto fput_and_out;
13151332
@@ -1460,6 +1477,7 @@ static int __init fanotify_user_setup(void) · 144 unmodified lines
14601477 max_marks = clamp(max_marks, FANOTIFY_OLD_DEFAULT_MAX_MARKS,
14611478 FANOTIFY_DEFAULT_MAX_USER_MARKS);
14621479
1480+ BUILD_BUG_ON(FANOTIFY_INIT_FLAGS & FANOTIFY_INTERNAL_GROUP_FLAGS);
14631481 BUILD_BUG_ON(HWEIGHT32(FANOTIFY_INIT_FLAGS) != 10);
14641482 BUILD_BUG_ON(HWEIGHT32(FANOTIFY_MARK_FLAGS) != 9);
14651483
fs/notify/fdinfo.c+1−1
@@ -144,7 +144,7 @@ void fanotify_show_fdinfo(struct seq_file *m, struct file *f) · 143 unmodified lines
144144 struct fsnotify_group *group = f->private_data;
145145
146146 seq_printf(m, "fanotify flags:%x event-flags:%x\n",
147− group->fanotify_data.flags,
147+ group->fanotify_data.flags & FANOTIFY_INIT_FLAGS,
148148 group->fanotify_data.f_flags);
149149
150150 show_fdinfo(m, f, fanotify_fdinfo);
fs/ocfs2/file.c+50−5
@@ -1855,6 +1855,45 @@ out: · 1854 unmodified lines
18551855 return ret;
18561856 }
18571857
1858+/*
1859+ * zero out partial blocks of one cluster.
1860+ *
1861+ * start: file offset where zero starts, will be made upper block aligned.
1862+ * len: it will be trimmed to the end of current cluster if "start + len"
1863+ * is bigger than it.
1864+ */
1865+static int ocfs2_zeroout_partial_cluster(struct inode *inode,
1866+ u64 start, u64 len)
1867+{
1868+ int ret;
1869+ u64 start_block, end_block, nr_blocks;
1870+ u64 p_block, offset;
1871+ u32 cluster, p_cluster, nr_clusters;
1872+ struct super_block *sb = inode->i_sb;
1873+ u64 end = ocfs2_align_bytes_to_clusters(sb, start);
1874+
1875+ if (start + len < end)
1876+ end = start + len;
1877+
1878+ start_block = ocfs2_blocks_for_bytes(sb, start);
1879+ end_block = ocfs2_blocks_for_bytes(sb, end);
1880+ nr_blocks = end_block - start_block;
1881+ if (!nr_blocks)
1882+ return 0;
1883+
1884+ cluster = ocfs2_bytes_to_clusters(sb, start);
1885+ ret = ocfs2_get_clusters(inode, cluster, &p_cluster,
1886+ &nr_clusters, NULL);
1887+ if (ret)
1888+ return ret;
1889+ if (!p_cluster)
1890+ return 0;
1891+
1892+ offset = start_block - ocfs2_clusters_to_blocks(sb, cluster);
1893+ p_block = ocfs2_clusters_to_blocks(sb, p_cluster) + offset;
1894+ return sb_issue_zeroout(sb, p_block, nr_blocks, GFP_NOFS);
1895+}
1896+
18581897 /*
18591898 * Parts of this function taken from xfs_change_file_space()
18601899 */
@@ -1865,7 +1904,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, · 4 unmodified lines
18651904 {
18661905 int ret;
18671906 s64 llen;
1868− loff_t size;
1907+ loff_t size, orig_isize;
18691908 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
18701909 struct buffer_head *di_bh = NULL;
18711910 handle_t *handle;
@@ -1896,6 +1935,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, · 24 unmodified lines
18961935 goto out_inode_unlock;
18971936 }
18981937
1938+ orig_isize = i_size_read(inode);
18991939 switch (sr->l_whence) {
19001940 case 0: /*SEEK_SET*/
19011941 break;
@@ -1903,7 +1943,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, · 1 unmodified line
19031943 sr->l_start += f_pos;
19041944 break;
19051945 case 2: /*SEEK_END*/
1906− sr->l_start += i_size_read(inode);
1946+ sr->l_start += orig_isize;
19071947 break;
19081948 default:
19091949 ret = -EINVAL;
@@ -1957,6 +1997,14 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, · 47 unmodified lines
19571997 default:
19581998 ret = -EINVAL;
19591999 }
2000+
2001+ /* zeroout eof blocks in the cluster. */
2002+ if (!ret && change_size && orig_isize < size) {
2003+ ret = ocfs2_zeroout_partial_cluster(inode, orig_isize,
2004+ size - orig_isize);
2005+ if (!ret)
2006+ i_size_write(inode, size);
2007+ }
19602008 up_write(&OCFS2_I(inode)->ip_alloc_sem);
19612009 if (ret) {
19622010 mlog_errno(ret);
@@ -1973,9 +2021,6 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, · 10 unmodified lines
19732021 goto out_inode_unlock;
19742022 }
19752023
1976− if (change_size && i_size_read(inode) < size)
1977− i_size_write(inode, size);
1978−
19792024 inode->i_ctime = inode->i_mtime = current_time(inode);
19802025 ret = ocfs2_mark_inode_dirty(handle, inode, di_bh);
19812026 if (ret < 0)
fs/proc/base.c+8−1
@@ -2674,6 +2674,11 @@ out: · 2673 unmodified lines
26742674 }
26752675
26762676 #ifdef CONFIG_SECURITY
2677+static int proc_pid_attr_open(struct inode *inode, struct file *file)
2678+{
2679+ return __mem_open(inode, file, PTRACE_MODE_READ_FSCREDS);
2680+}
2681+
26772682 static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
26782683 size_t count, loff_t *ppos)
26792684 {
@@ -2704,7 +2709,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, · 24 unmodified lines
27042709 int rv;
27052710
27062711 /* A task may only write when it was the opener. */
2707− if (file->f_cred != current_real_cred())
2712+ if (file->private_data != current->mm)
27082713 return -EPERM;
27092714
27102715 rcu_read_lock();
@@ -2754,9 +2759,11 @@ out: · 43 unmodified lines
27542759 }
27552760
27562761 static const struct file_operations proc_pid_attr_operations = {
2762+ .open = proc_pid_attr_open,
27572763 .read = proc_pid_attr_read,
27582764 .write = proc_pid_attr_write,
27592765 .llseek = generic_file_llseek,
2766+ .release = mem_release,
27602767 };
27612768
27622769 #define LSM_DIR_OPS(LSM) \
include/asm-generic/vmlinux.lds.h+1−0
@@ -960,6 +960,7 @@ · 959 unmodified lines
960960 #ifdef CONFIG_AMD_MEM_ENCRYPT
961961 #define PERCPU_DECRYPTED_SECTION \
962962 . = ALIGN(PAGE_SIZE); \
963+ *(.data..decrypted) \
963964 *(.data..percpu..decrypted) \
964965 . = ALIGN(PAGE_SIZE);
965966 #else
include/dt-bindings/usb/pd.h+76−13
@@ -106,6 +106,10 @@ · 105 unmodified lines
106106 * <20:16> :: Reserved, Shall be set to zero
107107 * <15:0> :: USB-IF assigned VID for this cable vendor
108108 */
109+
110+/* PD Rev2.0 definition */
111+#define IDH_PTYPE_UNDEF 0
112+
109113 /* SOP Product Type (UFP) */
110114 #define IDH_PTYPE_NOT_UFP 0
111115 #define IDH_PTYPE_HUB 1
@@ -163,10 +167,10 @@ · 51 unmodified lines
163167 #define UFP_VDO_VER1_2 2
164168
165169 /* Device Capability */
166−#define DEV_USB2_CAPABLE BIT(0)
167−#define DEV_USB2_BILLBOARD BIT(1)
168−#define DEV_USB3_CAPABLE BIT(2)
169−#define DEV_USB4_CAPABLE BIT(3)
170+#define DEV_USB2_CAPABLE (1 << 0)
171+#define DEV_USB2_BILLBOARD (1 << 1)
172+#define DEV_USB3_CAPABLE (1 << 2)
173+#define DEV_USB4_CAPABLE (1 << 3)
170174
171175 /* Connector Type */
172176 #define UFP_RECEPTACLE 2
@@ -191,9 +195,9 @@ · 18 unmodified lines
191195
192196 /* Alternate Modes */
193197 #define UFP_ALTMODE_NOT_SUPP 0
194−#define UFP_ALTMODE_TBT3 BIT(0)
195−#define UFP_ALTMODE_RECFG BIT(1)
196−#define UFP_ALTMODE_NO_RECFG BIT(2)
198+#define UFP_ALTMODE_TBT3 (1 << 0)
199+#define UFP_ALTMODE_RECFG (1 << 1)
200+#define UFP_ALTMODE_NO_RECFG (1 << 2)
197201
198202 /* USB Highest Speed */
199203 #define UFP_USB2_ONLY 0
@@ -217,9 +221,9 @@ · 17 unmodified lines
217221 * <4:0> :: Port number
218222 */
219223 #define DFP_VDO_VER1_1 1
220−#define HOST_USB2_CAPABLE BIT(0)
221−#define HOST_USB3_CAPABLE BIT(1)
222−#define HOST_USB4_CAPABLE BIT(2)
224+#define HOST_USB2_CAPABLE (1 << 0)
225+#define HOST_USB3_CAPABLE (1 << 1)
226+#define HOST_USB4_CAPABLE (1 << 2)
223227 #define DFP_RECEPTACLE 2
224228 #define DFP_CAPTIVE 3
225229
@@ -228,7 +232,25 @@ · 2 unmodified lines
228232 | ((pnum) & 0x1f))
229233
230234 /*
231− * Passive Cable VDO
235+ * Cable VDO (for both Passive and Active Cable VDO in PD Rev2.0)
236+ * ---------
237+ * <31:28> :: Cable HW version
238+ * <27:24> :: Cable FW version
239+ * <23:20> :: Reserved, Shall be set to zero
240+ * <19:18> :: type-C to Type-A/B/C/Captive (00b == A, 01 == B, 10 == C, 11 == Captive)
241+ * <17> :: Reserved, Shall be set to zero
242+ * <16:13> :: cable latency (0001 == <10ns(~1m length))
243+ * <12:11> :: cable termination type (11b == both ends active VCONN req)
244+ * <10> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable)
245+ * <9> :: SSTX2 Directionality support
246+ * <8> :: SSRX1 Directionality support
247+ * <7> :: SSRX2 Directionality support
248+ * <6:5> :: Vbus current handling capability (01b == 3A, 10b == 5A)
249+ * <4> :: Vbus through cable (0b == no, 1b == yes)
250+ * <3> :: SOP" controller present? (0b == no, 1b == yes)
251+ * <2:0> :: USB SS Signaling support
252+ *
253+ * Passive Cable VDO (PD Rev3.0+)
232254 * ---------
233255 * <31:28> :: Cable HW version
234256 * <27:24> :: Cable FW version
@@ -244,7 +266,7 @@ · 9 unmodified lines
244266 * <4:3> :: Reserved, Shall be set to zero
245267 * <2:0> :: USB highest speed
246268 *
247− * Active Cable VDO 1
269+ * Active Cable VDO 1 (PD Rev3.0+)
248270 * ---------
249271 * <31:28> :: Cable HW version
250272 * <27:24> :: Cable FW version
@@ -266,7 +288,9 @@ · 15 unmodified lines
266288 #define CABLE_VDO_VER1_0 0
267289 #define CABLE_VDO_VER1_3 3
268290
269−/* Connector Type */
291+/* Connector Type (_ATYPE and _BTYPE are for PD Rev2.0 only) */
292+#define CABLE_ATYPE 0
293+#define CABLE_BTYPE 1
270294 #define CABLE_CTYPE 2
271295 #define CABLE_CAPTIVE 3
272296
@@ -303,12 +327,22 @@ · 30 unmodified lines
303327 #define CABLE_CURR_3A 1
304328 #define CABLE_CURR_5A 2
305329
330+/* USB SuperSpeed Signaling Support (PD Rev2.0) */
331+#define CABLE_USBSS_U2_ONLY 0
332+#define CABLE_USBSS_U31_GEN1 1
333+#define CABLE_USBSS_U31_GEN2 2
334+
306335 /* USB Highest Speed */
307336 #define CABLE_USB2_ONLY 0
308337 #define CABLE_USB32_GEN1 1
309338 #define CABLE_USB32_4_GEN2 2
310339 #define CABLE_USB4_GEN3 3
311340
341+#define VDO_CABLE(hw, fw, cbl, lat, term, tx1d, tx2d, rx1d, rx2d, cur, vps, sopp, usbss) \
342+ (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18 \
343+ | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11 | (tx1d) << 10 \
344+ | (tx2d) << 9 | (rx1d) << 8 | (rx2d) << 7 | ((cur) & 0x3) << 5 \
345+ | (vps) << 4 | (sopp) << 3 | ((usbss) & 0x7))
312346 #define VDO_PCABLE(hw, fw, ver, conn, lat, term, vbm, cur, spd) \
313347 (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 | ((ver) & 0x7) << 21 \
314348 | ((conn) & 0x3) << 18 | ((lat) & 0xf) << 13 | ((term) & 0x3) << 11 \
@@ -373,6 +407,35 @@ · 58 unmodified lines
373407 | ((hops) & 0x3) << 6 | (u2) << 5 | (u32) << 4 | (lane) << 3 \
374408 | (iso) << 2 | (gen))
375409
410+/*
411+ * AMA VDO (PD Rev2.0)
412+ * ---------
413+ * <31:28> :: Cable HW version
414+ * <27:24> :: Cable FW version
415+ * <23:12> :: Reserved, Shall be set to zero
416+ * <11> :: SSTX1 Directionality support (0b == fixed, 1b == cfgable)
417+ * <10> :: SSTX2 Directionality support
418+ * <9> :: SSRX1 Directionality support
419+ * <8> :: SSRX2 Directionality support
420+ * <7:5> :: Vconn power
421+ * <4> :: Vconn power required
422+ * <3> :: Vbus power required
423+ * <2:0> :: USB SS Signaling support
424+ */
425+#define VDO_AMA(hw, fw, tx1d, tx2d, rx1d, rx2d, vcpwr, vcr, vbr, usbss) \
426+ (((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 \
427+ | (tx1d) << 11 | (tx2d) << 10 | (rx1d) << 9 | (rx2d) << 8 \
428+ | ((vcpwr) & 0x7) << 5 | (vcr) << 4 | (vbr) << 3 \
429+ | ((usbss) & 0x7))
430+
431+#define PD_VDO_AMA_VCONN_REQ(vdo) (((vdo) >> 4) & 1)
432+#define PD_VDO_AMA_VBUS_REQ(vdo) (((vdo) >> 3) & 1)
433+
434+#define AMA_USBSS_U2_ONLY 0
435+#define AMA_USBSS_U31_GEN1 1
436+#define AMA_USBSS_U31_GEN2 2
437+#define AMA_USBSS_BBONLY 3
438+
376439 /*
377440 * VPD VDO
378441 * ---------
include/linux/avf/virtchnl.h+1−0
@@ -830,6 +830,7 @@ VIRTCHNL_CHECK_STRUCT_LEN(72, virtchnl_proto_hdr); · 829 unmodified lines
830830
831831 struct virtchnl_proto_hdrs {
832832 u8 tunnel_level;
833+ u8 pad[3];
833834 /**
834835 * specify where protocol header start from.
835836 * 0 - from the outer layer
include/linux/compiler_attributes.h+1−0
@@ -199,6 +199,7 @@ · 198 unmodified lines
199199 * must end with any of these keywords:
200200 * break;
201201 * fallthrough;
202+ * continue;
202203 * goto <label>;
203204 * return [expression];
204205 *
include/linux/entry-kvm.h+2−1
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #define __LINUX_ENTRYKVM_H
44
55 #include <linux/entry-common.h>
6+#include <linux/tick.h>
67
78 /* Transfer to guest mode work */
89 #ifdef CONFIG_KVM_XFER_TO_GUEST_WORK
@@ -57,7 +58,7 @@ int xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu); · 48 unmodified lines
5758 static inline void xfer_to_guest_mode_prepare(void)
5859 {
5960 lockdep_assert_irqs_disabled();
60− rcu_nocb_flush_deferred_wakeup();
61+ tick_nohz_user_enter_prepare();
6162 }
6263
6364 /**
include/linux/fanotify.h+4−0
@@ -51,6 +51,10 @@ extern struct ctl_table fanotify_table[]; /* for sysctl */ · 50 unmodified lines
5151 #define FANOTIFY_INIT_FLAGS (FANOTIFY_ADMIN_INIT_FLAGS | \
5252 FANOTIFY_USER_INIT_FLAGS)
5353
54+/* Internal group flags */
55+#define FANOTIFY_UNPRIV 0x80000000
56+#define FANOTIFY_INTERNAL_GROUP_FLAGS (FANOTIFY_UNPRIV)
57+
5458 #define FANOTIFY_MARK_TYPE_BITS (FAN_MARK_INODE | FAN_MARK_MOUNT | \
5559 FAN_MARK_FILESYSTEM)
5660
include/linux/fb.h+3−0
@@ -659,6 +659,9 @@ static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, · 658 unmodified lines
659659 /* drivers/video/fb_defio.c */
660660 int fb_deferred_io_mmap(struct fb_info *info, struct vm_area_struct *vma);
661661 extern void fb_deferred_io_init(struct fb_info *info);
662+extern void fb_deferred_io_open(struct fb_info *info,
663+ struct inode *inode,
664+ struct file *file);
662665 extern void fb_deferred_io_cleanup(struct fb_info *info);
663666 extern int fb_deferred_io_fsync(struct file *file, loff_t start,
664667 loff_t end, int datasync);
include/linux/hid.h+1−2
@@ -1167,8 +1167,7 @@ static inline void hid_hw_wait(struct hid_device *hdev) · 1166 unmodified lines
11671167 */
11681168 static inline u32 hid_report_len(struct hid_report *report)
11691169 {
1170− /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
1171− return ((report->size - 1) >> 3) + 1 + (report->id > 0);
1170+ return DIV_ROUND_UP(report->size, 8) + (report->id > 0);
11721171 }
11731172
11741173 int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
include/linux/host1x.h+24−6
@@ -332,12 +332,30 @@ static inline struct host1x_device *to_host1x_device(struct device *dev) · 331 unmodified lines
332332 int host1x_device_init(struct host1x_device *device);
333333 int host1x_device_exit(struct host1x_device *device);
334334
335−int __host1x_client_register(struct host1x_client *client,
336− struct lock_class_key *key);
337−#define host1x_client_register(class) \
338− ({ \
339− static struct lock_class_key __key; \
340− __host1x_client_register(class, &__key); \
335+void __host1x_client_init(struct host1x_client *client, struct lock_class_key *key);
336+void host1x_client_exit(struct host1x_client *client);
337+
338+#define host1x_client_init(client) \
339+ ({ \
340+ static struct lock_class_key __key; \
341+ __host1x_client_init(client, &__key); \
342+ })
343+
344+int __host1x_client_register(struct host1x_client *client);
345+
346+/*
347+ * Note that this wrapper calls __host1x_client_init() for compatibility
348+ * with existing callers. Callers that want to separately initialize and
349+ * register a host1x client must first initialize using either of the
350+ * __host1x_client_init() or host1x_client_init() functions and then use
351+ * the low-level __host1x_client_register() function to avoid the client
352+ * getting reinitialized.
353+ */
354+#define host1x_client_register(client) \
355+ ({ \
356+ static struct lock_class_key __key; \
357+ __host1x_client_init(client, &__key); \
358+ __host1x_client_register(client); \
341359 })
342360
343361 int host1x_client_unregister(struct host1x_client *client);
include/linux/kvm_host.h+9−1
@@ -1185,7 +1185,15 @@ __gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn) · 1184 unmodified lines
11851185 static inline unsigned long
11861186 __gfn_to_hva_memslot(const struct kvm_memory_slot *slot, gfn_t gfn)
11871187 {
1188− return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE;
1188+ /*
1189+ * The index was checked originally in search_memslots. To avoid
1190+ * that a malicious guest builds a Spectre gadget out of e.g. page
1191+ * table walks, do not let the processor speculate loads outside
1192+ * the guest's registered memslots.
1193+ */
1194+ unsigned long offset = gfn - slot->base_gfn;
1195+ offset = array_index_nospec(offset, slot->npages);
1196+ return slot->userspace_addr + offset * PAGE_SIZE;
11891197 }
11901198
11911199 static inline int memslot_id(struct kvm *kvm, gfn_t gfn)
include/linux/mfd/rohm-bd70528.h+1−3
@@ -26,9 +26,7 @@ struct bd70528_data { · 25 unmodified lines
2626 struct mutex rtc_timer_lock;
2727 };
2828
29−#define BD70528_BUCK_VOLTS 17
30−#define BD70528_BUCK_VOLTS 17
31−#define BD70528_BUCK_VOLTS 17
29+#define BD70528_BUCK_VOLTS 0x10
3230 #define BD70528_LDO_VOLTS 0x20
3331
3432 #define BD70528_REG_BUCK1_EN 0x0F
include/linux/mfd/rohm-bd71828.h+5−5
@@ -26,11 +26,11 @@ enum { · 25 unmodified lines
2626 BD71828_REGULATOR_AMOUNT,
2727 };
2828
29−#define BD71828_BUCK1267_VOLTS 0xEF
30−#define BD71828_BUCK3_VOLTS 0x10
31−#define BD71828_BUCK4_VOLTS 0x20
32−#define BD71828_BUCK5_VOLTS 0x10
33−#define BD71828_LDO_VOLTS 0x32
29+#define BD71828_BUCK1267_VOLTS 0x100
30+#define BD71828_BUCK3_VOLTS 0x20
31+#define BD71828_BUCK4_VOLTS 0x40
32+#define BD71828_BUCK5_VOLTS 0x20
33+#define BD71828_LDO_VOLTS 0x40
3434 /* LDO6 is fixed 1.8V voltage */
3535 #define BD71828_LDO_6_VOLTAGE 1800000
3636
include/linux/mlx4/device.h+1−0
@@ -630,6 +630,7 @@ struct mlx4_caps { · 629 unmodified lines
630630 bool wol_port[MLX4_MAX_PORTS + 1];
631631 struct mlx4_rate_limit_caps rl_caps;
632632 u32 health_buffer_addrs;
633+ bool map_clock_to_user;
633634 };
634635
635636 struct mlx4_buf_list {
include/linux/mlx5/mlx5_ifc.h+2−0
@@ -1289,6 +1289,8 @@ enum mlx5_fc_bulk_alloc_bitmask { · 1288 unmodified lines
12891289
12901290 #define MLX5_FC_BULK_NUM_FCS(fc_enum) (MLX5_FC_BULK_SIZE_FACTOR * (fc_enum))
12911291
1292+#define MLX5_FT_MAX_MULTIPATH_LEVEL 63
1293+
12921294 enum {
12931295 MLX5_STEERING_FORMAT_CONNECTX_5 = 0,
12941296 MLX5_STEERING_FORMAT_CONNECTX_6DX = 1,
include/linux/mm_types.h+20−7
@@ -445,13 +445,6 @@ struct mm_struct { · 444 unmodified lines
445445 */
446446 atomic_t has_pinned;
447447
448− /**
449− * @write_protect_seq: Locked when any thread is write
450− * protecting pages mapped by this mm to enforce a later COW,
451− * for instance during page table copying for fork().
452− */
453− seqcount_t write_protect_seq;
454−
455448 #ifdef CONFIG_MMU
456449 atomic_long_t pgtables_bytes; /* PTE page table pages */
457450 #endif
@@ -460,6 +453,18 @@ struct mm_struct { · 2 unmodified lines
460453 spinlock_t page_table_lock; /* Protects page tables and some
461454 * counters
462455 */
456+ /*
457+ * With some kernel config, the current mmap_lock's offset
458+ * inside 'mm_struct' is at 0x120, which is very optimal, as
459+ * its two hot fields 'count' and 'owner' sit in 2 different
460+ * cachelines, and when mmap_lock is highly contended, both
461+ * of the 2 fields will be accessed frequently, current layout
462+ * will help to reduce cache bouncing.
463+ *
464+ * So please be careful with adding new fields before
465+ * mmap_lock, which can easily push the 2 fields into one
466+ * cacheline.
467+ */
463468 struct rw_semaphore mmap_lock;
464469
465470 struct list_head mmlist; /* List of maybe swapped mm's. These
@@ -480,7 +485,15 @@ struct mm_struct { · 14 unmodified lines
480485 unsigned long stack_vm; /* VM_STACK */
481486 unsigned long def_flags;
482487
488+ /**
489+ * @write_protect_seq: Locked when any thread is write
490+ * protecting pages mapped by this mm to enforce a later COW,
491+ * for instance during page table copying for fork().
492+ */
493+ seqcount_t write_protect_seq;
494+
483495 spinlock_t arg_lock; /* protect the below fields */
496+
484497 unsigned long start_code, end_code, start_data, end_data;
485498 unsigned long start_brk, brk, start_stack;
486499 unsigned long arg_start, arg_end, env_start, env_end;
include/linux/pci.h+2−0
@@ -2344,6 +2344,7 @@ int pci_vpd_find_info_keyword(const u8 *buf, unsigned int off, · 2343 unmodified lines
23442344 struct device_node;
23452345 struct irq_domain;
23462346 struct irq_domain *pci_host_bridge_of_msi_domain(struct pci_bus *bus);
2347+bool pci_host_of_has_msi_map(struct device *dev);
23472348
23482349 /* Arch may override this (weak) */
23492350 struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus);
@@ -2351,6 +2352,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); · 1 unmodified line
23512352 #else /* CONFIG_OF */
23522353 static inline struct irq_domain *
23532354 pci_host_bridge_of_msi_domain(struct pci_bus *bus) { return NULL; }
2355+static inline bool pci_host_of_has_msi_map(struct device *dev) { return false; }
23542356 #endif /* CONFIG_OF */
23552357
23562358 static inline struct device_node *
include/linux/pgtable.h+8−0
@@ -432,6 +432,14 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres · 431 unmodified lines
432432 * To be differentiate with macro pte_mkyoung, this macro is used on platforms
433433 * where software maintains page access bit.
434434 */
435+#ifndef pte_sw_mkyoung
436+static inline pte_t pte_sw_mkyoung(pte_t pte)
437+{
438+ return pte;
439+}
440+#define pte_sw_mkyoung pte_sw_mkyoung
441+#endif
442+
435443 #ifndef pte_savedwrite
436444 #define pte_savedwrite pte_write
437445 #endif
include/linux/platform_data/ti-sysc.h+1−0
@@ -50,6 +50,7 @@ struct sysc_regbits { · 49 unmodified lines
5050 s8 emufree_shift;
5151 };
5252
53+#define SYSC_QUIRK_REINIT_ON_RESUME BIT(27)
5354 #define SYSC_QUIRK_GPMC_DEBUG BIT(26)
5455 #define SYSC_MODULE_QUIRK_ENA_RESETDONE BIT(25)
5556 #define SYSC_MODULE_QUIRK_PRUSS BIT(24)
include/linux/rtsx_pci.h+2−0
@@ -1109,6 +1109,7 @@ struct pcr_ops { · 1108 unmodified lines
11091109 };
11101110
11111111 enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
1112+enum ASPM_MODE {ASPM_MODE_CFG, ASPM_MODE_REG};
11121113
11131114 #define ASPM_L1_1_EN BIT(0)
11141115 #define ASPM_L1_2_EN BIT(1)
@@ -1234,6 +1235,7 @@ struct rtsx_pcr { · 119 unmodified lines
12341235 u8 card_drive_sel;
12351236 #define ASPM_L1_EN 0x02
12361237 u8 aspm_en;
1238+ enum ASPM_MODE aspm_mode;
12371239 bool aspm_enabled;
12381240
12391241 #define PCR_MS_PMOS (1 << 0)
include/linux/sched.h+8−0
@@ -350,11 +350,19 @@ struct load_weight { · 349 unmodified lines
350350 * Only for tasks we track a moving average of the past instantaneous
351351 * estimated utilization. This allows to absorb sporadic drops in utilization
352352 * of an otherwise almost periodic task.
353+ *
354+ * The UTIL_AVG_UNCHANGED flag is used to synchronize util_est with util_avg
355+ * updates. When a task is dequeued, its util_est should not be updated if its
356+ * util_avg has not been updated in the meantime.
357+ * This information is mapped into the MSB bit of util_est.enqueued at dequeue
358+ * time. Since max value of util_est.enqueued for a task is 1024 (PELT util_avg
359+ * for a task) it is safe to use MSB.
353360 */
354361 struct util_est {
355362 unsigned int enqueued;
356363 unsigned int ewma;
357364 #define UTIL_EST_WEIGHT_SHIFT 2
365+#define UTIL_AVG_UNCHANGED 0x80000000
358366 } __attribute__((__aligned__(sizeof(u64))));
359367
360368 /*
include/linux/tick.h+7−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/context_tracking_state.h>
1212 #include <linux/cpumask.h>
1313 #include <linux/sched.h>
14+#include <linux/rcupdate.h>
1415
1516 #ifdef CONFIG_GENERIC_CLOCKEVENTS
1617 extern void __init tick_init(void);
@@ -300,4 +301,10 @@ static inline void tick_nohz_task_switch(void) · 283 unmodified lines
300301 __tick_nohz_task_switch();
301302 }
302303
304+static inline void tick_nohz_user_enter_prepare(void)
305+{
306+ if (tick_nohz_full_cpu(smp_processor_id()))
307+ rcu_nocb_flush_deferred_wakeup();
308+}
309+
303310 #endif
include/linux/usb/pd.h+1−1
@@ -460,7 +460,7 @@ static inline unsigned int rdo_max_power(u32 rdo) · 459 unmodified lines
460460 #define PD_T_RECEIVER_RESPONSE 15 /* 15ms max */
461461 #define PD_T_SOURCE_ACTIVITY 45
462462 #define PD_T_SINK_ACTIVITY 135
463−#define PD_T_SINK_WAIT_CAP 240
463+#define PD_T_SINK_WAIT_CAP 310 /* 310 - 620 ms */
464464 #define PD_T_PS_TRANSITION 500
465465 #define PD_T_SRC_TRANSITION 35
466466 #define PD_T_DRP_SNK 40
include/linux/usb/pd_ext_sdb.h+0−4
@@ -24,8 +24,4 @@ enum usb_pd_ext_sdb_fields { · 23 unmodified lines
2424 #define USB_PD_EXT_SDB_EVENT_OVP BIT(3)
2525 #define USB_PD_EXT_SDB_EVENT_CF_CV_MODE BIT(4)
2626
27−#define USB_PD_EXT_SDB_PPS_EVENTS (USB_PD_EXT_SDB_EVENT_OCP | \
28− USB_PD_EXT_SDB_EVENT_OTP | \
29− USB_PD_EXT_SDB_EVENT_OVP)
30−
3127 #endif /* __LINUX_USB_PD_EXT_SDB_H */
include/net/caif/caif_dev.h+1−1
@@ -119,7 +119,7 @@ void caif_free_client(struct cflayer *adap_layer); · 118 unmodified lines
119119 * The link_support layer is used to add any Link Layer specific
120120 * framing.
121121 */
122−void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev,
122+int caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev,
123123 struct cflayer *link_support, int head_room,
124124 struct cflayer **layer, int (**rcv_func)(
125125 struct sk_buff *, struct net_device *,
include/net/caif/cfcnfg.h+1−1
@@ -62,7 +62,7 @@ void cfcnfg_remove(struct cfcnfg *cfg); · 61 unmodified lines
6262 * @fcs: Specify if checksum is used in CAIF Framing Layer.
6363 * @head_room: Head space needed by link specific protocol.
6464 */
65−void
65+int
6666 cfcnfg_add_phy_layer(struct cfcnfg *cnfg,
6767 struct net_device *dev, struct cflayer *phy_layer,
6868 enum cfcnfg_phy_preference pref,
include/net/caif/cfserl.h+1−0
@@ -9,4 +9,5 @@ · 8 unmodified lines
99 #include <net/caif/caif_layer.h>
1010
1111 struct cflayer *cfserl_create(int instance, bool use_stx);
12+void cfserl_release(struct cflayer *layer);
1213 #endif
include/net/netfilter/nf_tables.h+0−6
@@ -1506,16 +1506,10 @@ struct nft_trans_chain { · 1505 unmodified lines
15061506
15071507 struct nft_trans_table {
15081508 bool update;
1509− u8 state;
1510− u32 flags;
15111509 };
15121510
15131511 #define nft_trans_table_update(trans) \
15141512 (((struct nft_trans_table *)trans->data)->update)
1515−#define nft_trans_table_state(trans) \
1516− (((struct nft_trans_table *)trans->data)->state)
1517−#define nft_trans_table_flags(trans) \
1518− (((struct nft_trans_table *)trans->data)->flags)
15191513
15201514 struct nft_trans_elem {
15211515 struct nft_set *set;
include/net/tls.h+9−1
@@ -193,7 +193,11 @@ struct tls_offload_context_tx { · 192 unmodified lines
193193 (sizeof(struct tls_offload_context_tx) + TLS_DRIVER_STATE_SIZE_TX)
194194
195195 enum tls_context_flags {
196− TLS_RX_SYNC_RUNNING = 0,
196+ /* tls_device_down was called after the netdev went down, device state
197+ * was released, and kTLS works in software, even though rx_conf is
198+ * still TLS_HW (needed for transition).
199+ */
200+ TLS_RX_DEV_DEGRADED = 0,
197201 /* Unlike RX where resync is driven entirely by the core in TX only
198202 * the driver knows when things went out of sync, so we need the flag
199203 * to be atomic.
@@ -266,6 +270,7 @@ struct tls_context { · 66 unmodified lines
266270
267271 /* cache cold stuff */
268272 struct proto *sk_proto;
273+ struct sock *sk;
269274
270275 void (*sk_destruct)(struct sock *sk);
271276
@@ -448,6 +453,9 @@ static inline u16 tls_user_config(struct tls_context *ctx, bool tx) · 176 unmodified lines
448453 struct sk_buff *
449454 tls_validate_xmit_skb(struct sock *sk, struct net_device *dev,
450455 struct sk_buff *skb);
456+struct sk_buff *
457+tls_validate_xmit_skb_sw(struct sock *sk, struct net_device *dev,
458+ struct sk_buff *skb);
451459
452460 static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk)
453461 {
include/uapi/linux/input-event-codes.h+1−0
@@ -611,6 +611,7 @@ · 610 unmodified lines
611611 #define KEY_VOICECOMMAND 0x246 /* Listening Voice Command */
612612 #define KEY_ASSISTANT 0x247 /* AL Context-aware desktop assistant */
613613 #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */
614+#define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */
614615
615616 #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */
616617 #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
include/uapi/linux/io_uring.h+10−9
@@ -280,6 +280,7 @@ struct io_uring_params { · 279 unmodified lines
280280 #define IORING_FEAT_SQPOLL_NONFIXED (1U << 7)
281281 #define IORING_FEAT_EXT_ARG (1U << 8)
282282 #define IORING_FEAT_NATIVE_WORKERS (1U << 9)
283+#define IORING_FEAT_RSRC_TAGS (1U << 10)
283284
284285 /*
285286 * io_uring_register(2) opcodes and arguments
@@ -298,8 +299,12 @@ enum { · 12 unmodified lines
298299 IORING_UNREGISTER_PERSONALITY = 10,
299300 IORING_REGISTER_RESTRICTIONS = 11,
300301 IORING_REGISTER_ENABLE_RINGS = 12,
301− IORING_REGISTER_RSRC = 13,
302− IORING_REGISTER_RSRC_UPDATE = 14,
302+
303+ /* extended with tagging */
304+ IORING_REGISTER_FILES2 = 13,
305+ IORING_REGISTER_FILES_UPDATE2 = 14,
306+ IORING_REGISTER_BUFFERS2 = 15,
307+ IORING_REGISTER_BUFFERS_UPDATE = 16,
303308
304309 /* this goes last */
305310 IORING_REGISTER_LAST
@@ -312,14 +317,10 @@ struct io_uring_files_update { · 6 unmodified lines
312317 __aligned_u64 /* __s32 * */ fds;
313318 };
314319
315−enum {
316− IORING_RSRC_FILE = 0,
317− IORING_RSRC_BUFFER = 1,
318−};
319−
320320 struct io_uring_rsrc_register {
321− __u32 type;
322321 __u32 nr;
322+ __u32 resv;
323+ __u64 resv2;
323324 __aligned_u64 data;
324325 __aligned_u64 tags;
325326 };
@@ -335,8 +336,8 @@ struct io_uring_rsrc_update2 { · 9 unmodified lines
335336 __u32 resv;
336337 __aligned_u64 data;
337338 __aligned_u64 tags;
338− __u32 type;
339339 __u32 nr;
340+ __u32 resv2;
340341 };
341342
342343 /* Skip updating fd indexes set to this value in the fd table */
include/uapi/linux/virtio_ids.h+1−1
@@ -54,7 +54,7 @@ · 53 unmodified lines
5454 #define VIRTIO_ID_SOUND 25 /* virtio sound */
5555 #define VIRTIO_ID_FS 26 /* virtio filesystem */
5656 #define VIRTIO_ID_PMEM 27 /* virtio pmem */
57−#define VIRTIO_ID_BT 28 /* virtio bluetooth */
5857 #define VIRTIO_ID_MAC80211_HWSIM 29 /* virtio mac80211-hwsim */
58+#define VIRTIO_ID_BT 40 /* virtio bluetooth */
5959
6060 #endif /* _LINUX_VIRTIO_IDS_H */
init/main.c+1−1
@@ -1537,7 +1537,7 @@ static noinline void __init kernel_init_freeable(void) · 1536 unmodified lines
15371537 */
15381538 set_mems_allowed(node_states[N_MEMORY]);
15391539
1540− cad_pid = task_pid(current);
1540+ cad_pid = get_pid(task_pid(current));
15411541
15421542 smp_prepare_cpus(setup_max_cpus);
15431543
kernel/bpf/helpers.c+5−2
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/jiffies.h>
1515 #include <linux/pid_namespace.h>
1616 #include <linux/proc_ns.h>
17+#include <linux/security.h>
1718
1819 #include "../../lib/kstrtox.h"
1920
@@ -1069,11 +1070,13 @@ bpf_base_func_proto(enum bpf_func_id func_id) · 1049 unmodified lines
10691070 case BPF_FUNC_probe_read_user:
10701071 return &bpf_probe_read_user_proto;
10711072 case BPF_FUNC_probe_read_kernel:
1072− return &bpf_probe_read_kernel_proto;
1073+ return security_locked_down(LOCKDOWN_BPF_READ) < 0 ?
1074+ NULL : &bpf_probe_read_kernel_proto;
10731075 case BPF_FUNC_probe_read_user_str:
10741076 return &bpf_probe_read_user_str_proto;
10751077 case BPF_FUNC_probe_read_kernel_str:
1076− return &bpf_probe_read_kernel_str_proto;
1078+ return security_locked_down(LOCKDOWN_BPF_READ) < 0 ?
1079+ NULL : &bpf_probe_read_kernel_str_proto;
10771080 case BPF_FUNC_snprintf_btf:
10781081 return &bpf_snprintf_btf_proto;
10791082 case BPF_FUNC_snprintf:
kernel/cgroup/cgroup-v1.c+4−0
@@ -820,6 +820,10 @@ static int cgroup1_rename(struct kernfs_node *kn, struct kernfs_node *new_parent · 819 unmodified lines
820820 struct cgroup *cgrp = kn->priv;
821821 int ret;
822822
823+ /* do not accept '\n' to prevent making /proc/<pid>/cgroup unparsable */
824+ if (strchr(new_name_str, '\n'))
825+ return -EINVAL;
826+
823827 if (kernfs_type(kn) != KERNFS_DIR)
824828 return -ENOTDIR;
825829 if (kn->parent != new_parent)
kernel/entry/common.c+3−2
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/highmem.h>
66 #include <linux/livepatch.h>
77 #include <linux/audit.h>
8+#include <linux/tick.h>
89
910 #include "common.h"
1011
@@ -186,7 +187,7 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs, · 175 unmodified lines
186187 local_irq_disable_exit_to_user();
187188
188189 /* Check if any of the above work has queued a deferred wakeup */
189− rcu_nocb_flush_deferred_wakeup();
190+ tick_nohz_user_enter_prepare();
190191
191192 ti_work = READ_ONCE(current_thread_info()->flags);
192193 }
@@ -202,7 +203,7 @@ static void exit_to_user_mode_prepare(struct pt_regs *regs) · 9 unmodified lines
202203 lockdep_assert_irqs_disabled();
203204
204205 /* Flush pending rcuog wakeup before the last need_resched() check */
205− rcu_nocb_flush_deferred_wakeup();
206+ tick_nohz_user_enter_prepare();
206207
207208 if (unlikely(ti_work & EXIT_TO_USER_MODE_WORK))
208209 ti_work = exit_to_user_mode_loop(regs, ti_work);
kernel/events/core.c+2−0
@@ -4609,7 +4609,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task, · 4608 unmodified lines
46094609 cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
46104610 ctx = &cpuctx->ctx;
46114611 get_ctx(ctx);
4612+ raw_spin_lock_irqsave(&ctx->lock, flags);
46124613 ++ctx->pin_count;
4614+ raw_spin_unlock_irqrestore(&ctx->lock, flags);
46134615
46144616 return ctx;
46154617 }
kernel/irq_work.c+0−3
@@ -70,9 +70,6 @@ bool irq_work_queue(struct irq_work *work) · 69 unmodified lines
7070 if (!irq_work_claim(work))
7171 return false;
7272
73− /*record irq_work call stack in order to print it in KASAN reports*/
74− kasan_record_aux_stack(work);
75−
7673 /* Queue the entry and raise the IPI if needed. */
7774 preempt_disable();
7875 __irq_work_queue_local(work);
kernel/sched/debug.c+2−1
@@ -885,6 +885,7 @@ static const struct seq_operations sched_debug_sops = { · 884 unmodified lines
885885 #define __PS(S, F) SEQ_printf(m, "%-45s:%21Ld\n", S, (long long)(F))
886886 #define __P(F) __PS(#F, F)
887887 #define P(F) __PS(#F, p->F)
888+#define PM(F, M) __PS(#F, p->F & (M))
888889 #define __PSN(S, F) SEQ_printf(m, "%-45s:%14Ld.%06ld\n", S, SPLIT_NS((long long)(F)))
889890 #define __PN(F) __PSN(#F, F)
890891 #define PN(F) __PSN(#F, p->F)
@@ -1011,7 +1012,7 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, · 120 unmodified lines
10111012 P(se.avg.util_avg);
10121013 P(se.avg.last_update_time);
10131014 P(se.avg.util_est.ewma);
1014− P(se.avg.util_est.enqueued);
1015+ PM(se.avg.util_est.enqueued, ~UTIL_AVG_UNCHANGED);
10151016 #endif
10161017 #ifdef CONFIG_UCLAMP_TASK
10171018 __PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
kernel/sched/fair.c+17−11
@@ -3499,10 +3499,9 @@ update_tg_cfs_runnable(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cf · 3498 unmodified lines
34993499 static inline void
35003500 update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq *gcfs_rq)
35013501 {
3502− long delta_avg, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum;
3502+ long delta, running_sum, runnable_sum = gcfs_rq->prop_runnable_sum;
35033503 unsigned long load_avg;
35043504 u64 load_sum = 0;
3505− s64 delta_sum;
35063505 u32 divider;
35073506
35083507 if (!runnable_sum)
@@ -3549,13 +3548,13 @@ update_tg_cfs_load(struct cfs_rq *cfs_rq, struct sched_entity *se, struct cfs_rq · 40 unmodified lines
35493548 load_sum = (s64)se_weight(se) * runnable_sum;
35503549 load_avg = div_s64(load_sum, divider);
35513550
3552− delta_sum = load_sum - (s64)se_weight(se) * se->avg.load_sum;
3553− delta_avg = load_avg - se->avg.load_avg;
3551+ delta = load_avg - se->avg.load_avg;
35543552
35553553 se->avg.load_sum = runnable_sum;
35563554 se->avg.load_avg = load_avg;
3557− add_positive(&cfs_rq->avg.load_avg, delta_avg);
3558− add_positive(&cfs_rq->avg.load_sum, delta_sum);
3555+
3556+ add_positive(&cfs_rq->avg.load_avg, delta);
3557+ cfs_rq->avg.load_sum = cfs_rq->avg.load_avg * divider;
35593558 }
35603559
35613560 static inline void add_tg_cfs_propagate(struct cfs_rq *cfs_rq, long runnable_sum)
@@ -3766,11 +3765,17 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s · 204 unmodified lines
37663765 */
37673766 static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se)
37683767 {
3768+ /*
3769+ * cfs_rq->avg.period_contrib can be used for both cfs_rq and se.
3770+ * See ___update_load_avg() for details.
3771+ */
3772+ u32 divider = get_pelt_divider(&cfs_rq->avg);
3773+
37693774 dequeue_load_avg(cfs_rq, se);
37703775 sub_positive(&cfs_rq->avg.util_avg, se->avg.util_avg);
3771− sub_positive(&cfs_rq->avg.util_sum, se->avg.util_sum);
3776+ cfs_rq->avg.util_sum = cfs_rq->avg.util_avg * divider;
37723777 sub_positive(&cfs_rq->avg.runnable_avg, se->avg.runnable_avg);
3773− sub_positive(&cfs_rq->avg.runnable_sum, se->avg.runnable_sum);
3778+ cfs_rq->avg.runnable_sum = cfs_rq->avg.runnable_avg * divider;
37743779
37753780 add_tg_cfs_propagate(cfs_rq, -se->avg.load_sum);
37763781
@@ -3902,7 +3907,7 @@ static inline unsigned long _task_util_est(struct task_struct *p) · 125 unmodified lines
39023907 {
39033908 struct util_est ue = READ_ONCE(p->se.avg.util_est);
39043909
3905− return (max(ue.ewma, ue.enqueued) | UTIL_AVG_UNCHANGED);
3910+ return max(ue.ewma, (ue.enqueued & ~UTIL_AVG_UNCHANGED));
39063911 }
39073912
39083913 static inline unsigned long task_util_est(struct task_struct *p)
@@ -4002,7 +4007,7 @@ static inline void util_est_update(struct cfs_rq *cfs_rq, · 93 unmodified lines
40024007 * Reset EWMA on utilization increases, the moving average is used only
40034008 * to smooth utilization decreases.
40044009 */
4005− ue.enqueued = (task_util(p) | UTIL_AVG_UNCHANGED);
4010+ ue.enqueued = task_util(p);
40064011 if (sched_feat(UTIL_EST_FASTUP)) {
40074012 if (ue.ewma < ue.enqueued) {
40084013 ue.ewma = ue.enqueued;
@@ -4051,6 +4056,7 @@ static inline void util_est_update(struct cfs_rq *cfs_rq, · 42 unmodified lines
40514056 ue.ewma += last_ewma_diff;
40524057 ue.ewma >>= UTIL_EST_WEIGHT_SHIFT;
40534058 done:
4059+ ue.enqueued |= UTIL_AVG_UNCHANGED;
40544060 WRITE_ONCE(p->se.avg.util_est, ue);
40554061
40564062 trace_sched_util_est_se_tp(&p->se);
@@ -8030,7 +8036,7 @@ static bool __update_blocked_fair(struct rq *rq, bool *done) · 3973 unmodified lines
80308036 /* Propagate pending load changes to the parent, if any: */
80318037 se = cfs_rq->tg->se[cpu];
80328038 if (se && !skip_blocked_update(se))
8033− update_load_avg(cfs_rq_of(se), se, 0);
8039+ update_load_avg(cfs_rq_of(se), se, UPDATE_TG);
80348040
80358041 /*
80368042 * There can be a lot of idle CPU cgroups. Don't let fully
kernel/sched/pelt.h+1−10
@@ -42,15 +42,6 @@ static inline u32 get_pelt_divider(struct sched_avg *avg) · 41 unmodified lines
4242 return LOAD_AVG_MAX - 1024 + avg->period_contrib;
4343 }
4444
45−/*
46− * When a task is dequeued, its estimated utilization should not be update if
47− * its util_avg has not been updated at least once.
48− * This flag is used to synchronize util_avg updates with util_est updates.
49− * We map this information into the LSB bit of the utilization saved at
50− * dequeue time (i.e. util_est.dequeued).
51− */
52−#define UTIL_AVG_UNCHANGED 0x1
53−
5445 static inline void cfs_se_util_change(struct sched_avg *avg)
5546 {
5647 unsigned int enqueued;
@@ -58,7 +49,7 @@ static inline void cfs_se_util_change(struct sched_avg *avg) · 1 unmodified line
5849 if (!sched_feat(UTIL_EST))
5950 return;
6051
61− /* Avoid store if the flag has been already set */
52+ /* Avoid store if the flag has been already reset */
6253 enqueued = avg->util_est.enqueued;
6354 if (!(enqueued & UTIL_AVG_UNCHANGED))
6455 return;
kernel/time/tick-sched.c+1−0
@@ -230,6 +230,7 @@ static void tick_sched_handle(struct tick_sched *ts, struct pt_regs *regs) · 229 unmodified lines
230230
231231 #ifdef CONFIG_NO_HZ_FULL
232232 cpumask_var_t tick_nohz_full_mask;
233+EXPORT_SYMBOL_GPL(tick_nohz_full_mask);
233234 bool tick_nohz_full_running;
234235 EXPORT_SYMBOL_GPL(tick_nohz_full_running);
235236 static atomic_t tick_dep_mask;
kernel/trace/bpf_trace.c+12−20
@@ -215,16 +215,11 @@ const struct bpf_func_proto bpf_probe_read_user_str_proto = { · 214 unmodified lines
215215 static __always_inline int
216216 bpf_probe_read_kernel_common(void *dst, u32 size, const void *unsafe_ptr)
217217 {
218− int ret = security_locked_down(LOCKDOWN_BPF_READ);
218+ int ret;
219219
220− if (unlikely(ret < 0))
221− goto fail;
222220 ret = copy_from_kernel_nofault(dst, unsafe_ptr, size);
223221 if (unlikely(ret < 0))
224− goto fail;
225− return ret;
226−fail:
227− memset(dst, 0, size);
222+ memset(dst, 0, size);
228223 return ret;
229224 }
230225
@@ -246,10 +241,7 @@ const struct bpf_func_proto bpf_probe_read_kernel_proto = { · 15 unmodified lines
246241 static __always_inline int
247242 bpf_probe_read_kernel_str_common(void *dst, u32 size, const void *unsafe_ptr)
248243 {
249− int ret = security_locked_down(LOCKDOWN_BPF_READ);
250−
251− if (unlikely(ret < 0))
252− goto fail;
244+ int ret;
253245
254246 /*
255247 * The strncpy_from_kernel_nofault() call will likely not fill the
@@ -262,11 +254,7 @@ bpf_probe_read_kernel_str_common(void *dst, u32 size, const void *unsafe_ptr) · 6 unmodified lines
262254 */
263255 ret = strncpy_from_kernel_nofault(dst, unsafe_ptr, size);
264256 if (unlikely(ret < 0))
265− goto fail;
266−
267− return ret;
268−fail:
269− memset(dst, 0, size);
257+ memset(dst, 0, size);
270258 return ret;
271259 }
272260
@@ -1011,16 +999,20 @@ bpf_tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) · 738 unmodified lines
1011999 case BPF_FUNC_probe_read_user:
10121000 return &bpf_probe_read_user_proto;
10131001 case BPF_FUNC_probe_read_kernel:
1014− return &bpf_probe_read_kernel_proto;
1002+ return security_locked_down(LOCKDOWN_BPF_READ) < 0 ?
1003+ NULL : &bpf_probe_read_kernel_proto;
10151004 case BPF_FUNC_probe_read_user_str:
10161005 return &bpf_probe_read_user_str_proto;
10171006 case BPF_FUNC_probe_read_kernel_str:
1018− return &bpf_probe_read_kernel_str_proto;
1007+ return security_locked_down(LOCKDOWN_BPF_READ) < 0 ?
1008+ NULL : &bpf_probe_read_kernel_str_proto;
10191009 #ifdef CONFIG_ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
10201010 case BPF_FUNC_probe_read:
1021− return &bpf_probe_read_compat_proto;
1011+ return security_locked_down(LOCKDOWN_BPF_READ) < 0 ?
1012+ NULL : &bpf_probe_read_compat_proto;
10221013 case BPF_FUNC_probe_read_str:
1023− return &bpf_probe_read_compat_str_proto;
1014+ return security_locked_down(LOCKDOWN_BPF_READ) < 0 ?
1015+ NULL : &bpf_probe_read_compat_str_proto;
10241016 #endif
10251017 #ifdef CONFIG_CGROUPS
10261018 case BPF_FUNC_get_current_cgroup_id:
kernel/trace/ftrace.c+7−1
@@ -1967,12 +1967,18 @@ static int ftrace_hash_ipmodify_update(struct ftrace_ops *ops, · 1966 unmodified lines
19671967
19681968 static void print_ip_ins(const char *fmt, const unsigned char *p)
19691969 {
1970+ char ins[MCOUNT_INSN_SIZE];
19701971 int i;
19711972
1973+ if (copy_from_kernel_nofault(ins, p, MCOUNT_INSN_SIZE)) {
1974+ printk(KERN_CONT "%s[FAULT] %px\n", fmt, p);
1975+ return;
1976+ }
1977+
19721978 printk(KERN_CONT "%s", fmt);
19731979
19741980 for (i = 0; i < MCOUNT_INSN_SIZE; i++)
1975− printk(KERN_CONT "%s%02x", i ? ":" : "", p[i]);
1981+ printk(KERN_CONT "%s%02x", i ? ":" : "", ins[i]);
19761982 }
19771983
19781984 enum ftrace_bug_type ftrace_bug_type;
kernel/trace/trace.c+1−1
@@ -2736,7 +2736,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb, · 2735 unmodified lines
27362736 (entry = this_cpu_read(trace_buffered_event))) {
27372737 /* Try to use the per cpu buffer first */
27382738 val = this_cpu_inc_return(trace_buffered_event_cnt);
2739− if ((len < (PAGE_SIZE - sizeof(*entry))) && val == 1) {
2739+ if ((len < (PAGE_SIZE - sizeof(*entry) - sizeof(entry->array[0]))) && val == 1) {
27402740 trace_event_setup(entry, type, trace_ctx);
27412741 entry->array[0] = len;
27422742 return entry;
lib/crc64.c+1−1
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL v2"); · 36 unmodified lines
3737 /**
3838 * crc64_be - Calculate bitwise big-endian ECMA-182 CRC64
3939 * @crc: seed value for computation. 0 or (u64)~0 for a new CRC calculation,
40− or the previous crc64 value if computing incrementally.
40+ * or the previous crc64 value if computing incrementally.
4141 * @p: pointer to buffer over which CRC64 is run
4242 * @len: length of buffer @p
4343 */
mm/debug_vm_pgtable.c+2−2
@@ -192,7 +192,7 @@ static void __init pmd_advanced_tests(struct mm_struct *mm, · 191 unmodified lines
192192
193193 pr_debug("Validating PMD advanced\n");
194194 /* Align the address wrt HPAGE_PMD_SIZE */
195− vaddr = (vaddr & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE;
195+ vaddr &= HPAGE_PMD_MASK;
196196
197197 pgtable_trans_huge_deposit(mm, pmdp, pgtable);
198198
@@ -330,7 +330,7 @@ static void __init pud_advanced_tests(struct mm_struct *mm, · 131 unmodified lines
330330
331331 pr_debug("Validating PUD advanced\n");
332332 /* Align the address wrt HPAGE_PUD_SIZE */
333− vaddr = (vaddr & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE;
333+ vaddr &= HPAGE_PUD_MASK;
334334
335335 set_pud_at(mm, vaddr, pudp, pud);
336336 pudp_set_wrprotect(mm, vaddr, pudp);
mm/hugetlb.c+13−3
@@ -1793,7 +1793,7 @@ retry: · 1792 unmodified lines
17931793 SetPageHWPoison(page);
17941794 ClearPageHWPoison(head);
17951795 }
1796− remove_hugetlb_page(h, page, false);
1796+ remove_hugetlb_page(h, head, false);
17971797 h->max_huge_pages--;
17981798 spin_unlock_irq(&hugetlb_lock);
17991799 update_and_free_page(h, head);
@@ -4889,10 +4889,20 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, · 3089 unmodified lines
48894889 if (!page)
48904890 goto out;
48914891 } else if (!*pagep) {
4892− ret = -ENOMEM;
4892+ /* If a page already exists, then it's UFFDIO_COPY for
4893+ * a non-missing case. Return -EEXIST.
4894+ */
4895+ if (vm_shared &&
4896+ hugetlbfs_pagecache_present(h, dst_vma, dst_addr)) {
4897+ ret = -EEXIST;
4898+ goto out;
4899+ }
4900+
48934901 page = alloc_huge_page(dst_vma, dst_addr, 0);
4894− if (IS_ERR(page))
4902+ if (IS_ERR(page)) {
4903+ ret = -ENOMEM;
48954904 goto out;
4905+ }
48964906
48974907 ret = copy_huge_page_from_user(page,
48984908 (const void __user *) src_addr,
mm/kasan/init.c+2−2
@@ -220,8 +220,8 @@ static int __ref zero_p4d_populate(pgd_t *pgd, unsigned long addr, · 219 unmodified lines
220220 /**
221221 * kasan_populate_early_shadow - populate shadow memory region with
222222 * kasan_early_shadow_page
223− * @shadow_start - start of the memory range to populate
224− * @shadow_end - end of the memory range to populate
223+ * @shadow_start: start of the memory range to populate
224+ * @shadow_end: end of the memory range to populate
225225 */
226226 int __ref kasan_populate_early_shadow(const void *shadow_start,
227227 const void *shadow_end)
mm/kfence/core.c+3−3
@@ -627,10 +627,10 @@ static void toggle_allocation_gate(struct work_struct *work) · 626 unmodified lines
627627 * During low activity with no allocations we might wait a
628628 * while; let's avoid the hung task warning.
629629 */
630− wait_event_timeout(allocation_wait, atomic_read(&kfence_allocation_gate),
631− sysctl_hung_task_timeout_secs * HZ / 2);
630+ wait_event_idle_timeout(allocation_wait, atomic_read(&kfence_allocation_gate),
631+ sysctl_hung_task_timeout_secs * HZ / 2);
632632 } else {
633− wait_event(allocation_wait, atomic_read(&kfence_allocation_gate));
633+ wait_event_idle(allocation_wait, atomic_read(&kfence_allocation_gate));
634634 }
635635
636636 /* Disable static key and reset timer. */
mm/memory.c+4−0
@@ -2939,6 +2939,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) · 2938 unmodified lines
29392939 }
29402940 flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte));
29412941 entry = mk_pte(new_page, vma->vm_page_prot);
2942+ entry = pte_sw_mkyoung(entry);
29422943 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
29432944
29442945 /*
@@ -3602,6 +3603,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) · 657 unmodified lines
36023603 __SetPageUptodate(page);
36033604
36043605 entry = mk_pte(page, vma->vm_page_prot);
3606+ entry = pte_sw_mkyoung(entry);
36053607 if (vma->vm_flags & VM_WRITE)
36063608 entry = pte_mkwrite(pte_mkdirty(entry));
36073609
@@ -3786,6 +3788,8 @@ void do_set_pte(struct vm_fault *vmf, struct page *page, unsigned long addr) · 178 unmodified lines
37863788
37873789 if (prefault && arch_wants_old_prefaulted_pte())
37883790 entry = pte_mkold(entry);
3791+ else
3792+ entry = pte_sw_mkyoung(entry);
37893793
37903794 if (write)
37913795 entry = maybe_mkwrite(pte_mkdirty(entry), vma);
mm/page_alloc.c+2−0
@@ -9158,6 +9158,8 @@ bool take_page_off_buddy(struct page *page) · 9157 unmodified lines
91589158 del_page_from_free_list(page_head, zone, page_order);
91599159 break_down_buddy_pages(zone, page_head, page, 0,
91609160 page_order, migratetype);
9161+ if (!is_migrate_isolate(migratetype))
9162+ __mod_zone_freepage_state(zone, -1, migratetype);
91619163 ret = true;
91629164 break;
91639165 }
net/bluetooth/hci_core.c+6−1
@@ -1610,8 +1610,13 @@ setup_failed: · 1609 unmodified lines
16101610 } else {
16111611 /* Init failed, cleanup */
16121612 flush_work(&hdev->tx_work);
1613− flush_work(&hdev->cmd_work);
1613+
1614+ /* Since hci_rx_work() is possible to awake new cmd_work
1615+ * it should be flushed first to avoid unexpected call of
1616+ * hci_cmd_work()
1617+ */
16141618 flush_work(&hdev->rx_work);
1619+ flush_work(&hdev->cmd_work);
16151620
16161621 skb_queue_purge(&hdev->cmd_q);
16171622 skb_queue_purge(&hdev->rx_q);
net/bluetooth/hci_sock.c+2−2
@@ -762,7 +762,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) · 761 unmodified lines
762762 /* Detach sockets from device */
763763 read_lock(&hci_sk_list.lock);
764764 sk_for_each(sk, &hci_sk_list.head) {
765− bh_lock_sock_nested(sk);
765+ lock_sock(sk);
766766 if (hci_pi(sk)->hdev == hdev) {
767767 hci_pi(sk)->hdev = NULL;
768768 sk->sk_err = EPIPE;
@@ -771,7 +771,7 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event) · 2 unmodified lines
771771
772772 hci_dev_put(hdev);
773773 }
774− bh_unlock_sock(sk);
774+ release_sock(sk);
775775 }
776776 read_unlock(&hci_sk_list.lock);
777777 }
net/caif/caif_dev.c+9−4
@@ -308,7 +308,7 @@ static void dev_flowctrl(struct net_device *dev, int on) · 307 unmodified lines
308308 caifd_put(caifd);
309309 }
310310
311−void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev,
311+int caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev,
312312 struct cflayer *link_support, int head_room,
313313 struct cflayer **layer,
314314 int (**rcv_func)(struct sk_buff *, struct net_device *,
@@ -319,11 +319,12 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, · 4 unmodified lines
319319 enum cfcnfg_phy_preference pref;
320320 struct cfcnfg *cfg = get_cfcnfg(dev_net(dev));
321321 struct caif_device_entry_list *caifdevs;
322+ int res;
322323
323324 caifdevs = caif_device_list(dev_net(dev));
324325 caifd = caif_device_alloc(dev);
325326 if (!caifd)
326− return;
327+ return -ENOMEM;
327328 *layer = &caifd->layer;
328329 spin_lock_init(&caifd->flow_lock);
329330
@@ -344,7 +345,7 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, · 14 unmodified lines
344345 strlcpy(caifd->layer.name, dev->name,
345346 sizeof(caifd->layer.name));
346347 caifd->layer.transmit = transmit;
347− cfcnfg_add_phy_layer(cfg,
348+ res = cfcnfg_add_phy_layer(cfg,
348349 dev,
349350 &caifd->layer,
350351 pref,
@@ -354,6 +355,7 @@ void caif_enroll_dev(struct net_device *dev, struct caif_dev_common *caifdev, · 3 unmodified lines
354355 mutex_unlock(&caifdevs->lock);
355356 if (rcv_func)
356357 *rcv_func = receive;
358+ return res;
357359 }
358360 EXPORT_SYMBOL(caif_enroll_dev);
359361
@@ -368,6 +370,7 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, · 8 unmodified lines
368370 struct cflayer *layer, *link_support;
369371 int head_room = 0;
370372 struct caif_device_entry_list *caifdevs;
373+ int res;
371374
372375 cfg = get_cfcnfg(dev_net(dev));
373376 caifdevs = caif_device_list(dev_net(dev));
@@ -393,8 +396,10 @@ static int caif_device_notify(struct notifier_block *me, unsigned long what, · 19 unmodified lines
393396 break;
394397 }
395398 }
396− caif_enroll_dev(dev, caifdev, link_support, head_room,
399+ res = caif_enroll_dev(dev, caifdev, link_support, head_room,
397400 &layer, NULL);
401+ if (res)
402+ cfserl_release(link_support);
398403 caifdev->flowctrl = dev_flowctrl;
399404 break;
400405
net/caif/caif_usb.c+13−1
@@ -115,6 +115,11 @@ static struct cflayer *cfusbl_create(int phyid, u8 ethaddr[ETH_ALEN], · 114 unmodified lines
115115 return (struct cflayer *) this;
116116 }
117117
118+static void cfusbl_release(struct cflayer *layer)
119+{
120+ kfree(layer);
121+}
122+
118123 static struct packet_type caif_usb_type __read_mostly = {
119124 .type = cpu_to_be16(ETH_P_802_EX1),
120125 };
@@ -127,6 +132,7 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, · 6 unmodified lines
127132 struct cflayer *layer, *link_support;
128133 struct usbnet *usbnet;
129134 struct usb_device *usbdev;
135+ int res;
130136
131137 /* Check whether we have a NCM device, and find its VID/PID. */
132138 if (!(dev->dev.parent && dev->dev.parent->driver &&
@@ -169,8 +175,11 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, · 36 unmodified lines
169175 if (dev->num_tx_queues > 1)
170176 pr_warn("USB device uses more than one tx queue\n");
171177
172− caif_enroll_dev(dev, &common, link_support, CFUSB_MAX_HEADLEN,
178+ res = caif_enroll_dev(dev, &common, link_support, CFUSB_MAX_HEADLEN,
173179 &layer, &caif_usb_type.func);
180+ if (res)
181+ goto err;
182+
174183 if (!pack_added)
175184 dev_add_pack(&caif_usb_type);
176185 pack_added = true;
@@ -178,6 +187,9 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, · 1 unmodified line
178187 strlcpy(layer->name, dev->name, sizeof(layer->name));
179188
180189 return 0;
190+err:
191+ cfusbl_release(link_support);
192+ return res;
181193 }
182194
183195 static struct notifier_block caif_device_notifier = {
net/caif/cfcnfg.c+11−5
@@ -450,7 +450,7 @@ unlock: · 449 unmodified lines
450450 rcu_read_unlock();
451451 }
452452
453−void
453+int
454454 cfcnfg_add_phy_layer(struct cfcnfg *cnfg,
455455 struct net_device *dev, struct cflayer *phy_layer,
456456 enum cfcnfg_phy_preference pref,
@@ -459,7 +459,7 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, · 2 unmodified lines
459459 {
460460 struct cflayer *frml;
461461 struct cfcnfg_phyinfo *phyinfo = NULL;
462− int i;
462+ int i, res = 0;
463463 u8 phyid;
464464
465465 mutex_lock(&cnfg->lock);
@@ -473,12 +473,15 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, · 7 unmodified lines
473473 goto got_phyid;
474474 }
475475 pr_warn("Too many CAIF Link Layers (max 6)\n");
476+ res = -EEXIST;
476477 goto out;
477478
478479 got_phyid:
479480 phyinfo = kzalloc(sizeof(struct cfcnfg_phyinfo), GFP_ATOMIC);
480− if (!phyinfo)
481+ if (!phyinfo) {
482+ res = -ENOMEM;
481483 goto out_err;
484+ }
482485
483486 phy_layer->id = phyid;
484487 phyinfo->pref = pref;
@@ -492,8 +495,10 @@ got_phyid: · 7 unmodified lines
492495
493496 frml = cffrml_create(phyid, fcs);
494497
495− if (!frml)
498+ if (!frml) {
499+ res = -ENOMEM;
496500 goto out_err;
501+ }
497502 phyinfo->frm_layer = frml;
498503 layer_set_up(frml, cnfg->mux);
499504
@@ -511,11 +516,12 @@ got_phyid: · 11 unmodified lines
511516 list_add_rcu(&phyinfo->node, &cnfg->phys);
512517 out:
513518 mutex_unlock(&cnfg->lock);
514− return;
519+ return res;
515520
516521 out_err:
517522 kfree(phyinfo);
518523 mutex_unlock(&cnfg->lock);
524+ return res;
519525 }
520526 EXPORT_SYMBOL(cfcnfg_add_phy_layer);
521527
net/caif/cfserl.c+5−0
@@ -31,6 +31,11 @@ static int cfserl_transmit(struct cflayer *layr, struct cfpkt *pkt); · 30 unmodified lines
3131 static void cfserl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl,
3232 int phyid);
3333
34+void cfserl_release(struct cflayer *layer)
35+{
36+ kfree(layer);
37+}
38+
3439 struct cflayer *cfserl_create(int instance, bool use_stx)
3540 {
3641 struct cfserl *this = kzalloc(sizeof(struct cfserl), GFP_ATOMIC);
net/compat.c+1−1
@@ -177,7 +177,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk, · 176 unmodified lines
177177 if (kcmlen > stackbuf_size)
178178 kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
179179 if (kcmsg == NULL)
180− return -ENOBUFS;
180+ return -ENOMEM;
181181
182182 /* Now copy them over neatly. */
183183 memset(kcmsg, 0, kcmlen);
net/core/devlink.c+2−2
@@ -705,7 +705,6 @@ static int devlink_nl_port_attrs_put(struct sk_buff *msg, · 704 unmodified lines
705705 case DEVLINK_PORT_FLAVOUR_PHYSICAL:
706706 case DEVLINK_PORT_FLAVOUR_CPU:
707707 case DEVLINK_PORT_FLAVOUR_DSA:
708− case DEVLINK_PORT_FLAVOUR_VIRTUAL:
709708 if (nla_put_u32(msg, DEVLINK_ATTR_PORT_NUMBER,
710709 attrs->phys.port_number))
711710 return -EMSGSIZE;
@@ -8631,7 +8630,6 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, · 7919 unmodified lines
86318630
86328631 switch (attrs->flavour) {
86338632 case DEVLINK_PORT_FLAVOUR_PHYSICAL:
8634− case DEVLINK_PORT_FLAVOUR_VIRTUAL:
86358633 if (!attrs->split)
86368634 n = snprintf(name, len, "p%u", attrs->phys.port_number);
86378635 else
@@ -8679,6 +8677,8 @@ static int __devlink_port_phys_port_name_get(struct devlink_port *devlink_port, · 41 unmodified lines
86798677 n = snprintf(name, len, "pf%usf%u", attrs->pci_sf.pf,
86808678 attrs->pci_sf.sf);
86818679 break;
8680+ case DEVLINK_PORT_FLAVOUR_VIRTUAL:
8681+ return -EOPNOTSUPP;
86828682 }
86838683
86848684 if (n >= len)
net/core/fib_rules.c+1−1
@@ -1168,7 +1168,7 @@ static void notify_rule_change(int event, struct fib_rule *rule, · 1167 unmodified lines
11681168 {
11691169 struct net *net;
11701170 struct sk_buff *skb;
1171− int err = -ENOBUFS;
1171+ int err = -ENOMEM;
11721172
11731173 net = ops->fro_net;
11741174 skb = nlmsg_new(fib_rule_nlmsg_size(ops, rule), GFP_KERNEL);
net/core/rtnetlink.c+3−1
@@ -4842,8 +4842,10 @@ static int rtnl_bridge_notify(struct net_device *dev) · 4841 unmodified lines
48424842 if (err < 0)
48434843 goto errout;
48444844
4845− if (!skb->len)
4845+ if (!skb->len) {
4846+ err = -EINVAL;
48464847 goto errout;
4848+ }
48474849
48484850 rtnl_notify(skb, net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
48494851 return 0;
net/core/sock.c+12−4
@@ -815,10 +815,18 @@ void sock_set_rcvbuf(struct sock *sk, int val) · 814 unmodified lines
815815 }
816816 EXPORT_SYMBOL(sock_set_rcvbuf);
817817
818+static void __sock_set_mark(struct sock *sk, u32 val)
819+{
820+ if (val != sk->sk_mark) {
821+ sk->sk_mark = val;
822+ sk_dst_reset(sk);
823+ }
824+}
825+
818826 void sock_set_mark(struct sock *sk, u32 val)
819827 {
820828 lock_sock(sk);
821− sk->sk_mark = val;
829+ __sock_set_mark(sk, val);
822830 release_sock(sk);
823831 }
824832 EXPORT_SYMBOL(sock_set_mark);
@@ -1126,10 +1134,10 @@ set_sndbuf: · 301 unmodified lines
11261134 case SO_MARK:
11271135 if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) {
11281136 ret = -EPERM;
1129− } else if (val != sk->sk_mark) {
1130− sk->sk_mark = val;
1131− sk_dst_reset(sk);
1137+ break;
11321138 }
1139+
1140+ __sock_set_mark(sk, val);
11331141 break;
11341142
11351143 case SO_RXQ_OVFL:
net/dsa/tag_8021q.c+1−1
@@ -64,7 +64,7 @@ · 63 unmodified lines
6464 #define DSA_8021Q_SUBVLAN_HI_SHIFT 9
6565 #define DSA_8021Q_SUBVLAN_HI_MASK GENMASK(9, 9)
6666 #define DSA_8021Q_SUBVLAN_LO_SHIFT 4
67−#define DSA_8021Q_SUBVLAN_LO_MASK GENMASK(4, 3)
67+#define DSA_8021Q_SUBVLAN_LO_MASK GENMASK(5, 4)
6868 #define DSA_8021Q_SUBVLAN_HI(x) (((x) & GENMASK(2, 2)) >> 2)
6969 #define DSA_8021Q_SUBVLAN_LO(x) ((x) & GENMASK(1, 0))
7070 #define DSA_8021Q_SUBVLAN(x) \
net/ieee802154/nl-mac.c+6−4
@@ -680,8 +680,10 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info) · 679 unmodified lines
680680 nla_put_u8(msg, IEEE802154_ATTR_LLSEC_SECLEVEL, params.out_level) ||
681681 nla_put_u32(msg, IEEE802154_ATTR_LLSEC_FRAME_COUNTER,
682682 be32_to_cpu(params.frame_counter)) ||
683− ieee802154_llsec_fill_key_id(msg, &params.out_key))
683+ ieee802154_llsec_fill_key_id(msg, &params.out_key)) {
684+ rc = -ENOBUFS;
684685 goto out_free;
686+ }
685687
686688 dev_put(dev);
687689
@@ -1184,7 +1186,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data) · 496 unmodified lines
11841186 {
11851187 struct ieee802154_llsec_device *dpos;
11861188 struct ieee802154_llsec_device_key *kpos;
1187− int rc = 0, idx = 0, idx2;
1189+ int idx = 0, idx2;
11881190
11891191 list_for_each_entry(dpos, &data->table->devices, list) {
11901192 if (idx++ < data->s_idx)
@@ -1200,7 +1202,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data) · 9 unmodified lines
12001202 data->nlmsg_seq,
12011203 dpos->hwaddr, kpos,
12021204 data->dev)) {
1203− return rc = -EMSGSIZE;
1205+ return -EMSGSIZE;
12041206 }
12051207
12061208 data->s_idx2++;
@@ -1209,7 +1211,7 @@ static int llsec_iter_devkeys(struct llsec_dump_data *data) · 2 unmodified lines
12091211 data->s_idx++;
12101212 }
12111213
1212− return rc;
1214+ return 0;
12131215 }
12141216
12151217 int ieee802154_llsec_dump_devkeys(struct sk_buff *skb,
net/ieee802154/nl-phy.c+3−1
@@ -241,8 +241,10 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info) · 240 unmodified lines
241241 }
242242
243243 if (nla_put_string(msg, IEEE802154_ATTR_PHY_NAME, wpan_phy_name(phy)) ||
244− nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name))
244+ nla_put_string(msg, IEEE802154_ATTR_DEV_NAME, dev->name)) {
245+ rc = -EMSGSIZE;
245246 goto nla_put_failure;
247+ }
246248 dev_put(dev);
247249
248250 wpan_phy_put(phy);
net/ieee802154/nl802154.c+5−4
@@ -1298,19 +1298,20 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla, · 1297 unmodified lines
12981298 if (!nla || nla_parse_nested_deprecated(attrs, NL802154_DEV_ADDR_ATTR_MAX, nla, nl802154_dev_addr_policy, NULL))
12991299 return -EINVAL;
13001300
1301− if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
1302− !attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
1303− !(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
1304− attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
1301+ if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || !attrs[NL802154_DEV_ADDR_ATTR_MODE])
13051302 return -EINVAL;
13061303
13071304 addr->pan_id = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_PAN_ID]);
13081305 addr->mode = nla_get_u32(attrs[NL802154_DEV_ADDR_ATTR_MODE]);
13091306 switch (addr->mode) {
13101307 case NL802154_DEV_ADDR_SHORT:
1308+ if (!attrs[NL802154_DEV_ADDR_ATTR_SHORT])
1309+ return -EINVAL;
13111310 addr->short_addr = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_SHORT]);
13121311 break;
13131312 case NL802154_DEV_ADDR_EXTENDED:
1313+ if (!attrs[NL802154_DEV_ADDR_ATTR_EXTENDED])
1314+ return -EINVAL;
13141315 addr->extended_addr = nla_get_le64(attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]);
13151316 break;
13161317 default:
net/ipv4/ipconfig.c+8−5
@@ -886,7 +886,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d · 885 unmodified lines
886886
887887
888888 /*
889− * Copy BOOTP-supplied string if not already set.
889+ * Copy BOOTP-supplied string
890890 */
891891 static int __init ic_bootp_string(char *dest, char *src, int len, int max)
892892 {
@@ -935,12 +935,15 @@ static void __init ic_do_bootp_ext(u8 *ext) · 42 unmodified lines
935935 }
936936 break;
937937 case 12: /* Host name */
938− ic_bootp_string(utsname()->nodename, ext+1, *ext,
939− __NEW_UTS_LEN);
940− ic_host_name_set = 1;
938+ if (!ic_host_name_set) {
939+ ic_bootp_string(utsname()->nodename, ext+1, *ext,
940+ __NEW_UTS_LEN);
941+ ic_host_name_set = 1;
942+ }
941943 break;
942944 case 15: /* Domain name (DNS) */
943− ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
945+ if (!ic_domain[0])
946+ ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
944947 break;
945948 case 17: /* Root path */
946949 if (!root_server_path[0])
net/ipv6/route.c+6−2
@@ -3673,11 +3673,11 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, · 3672 unmodified lines
36733673 if (nh) {
36743674 if (rt->fib6_src.plen) {
36753675 NL_SET_ERR_MSG(extack, "Nexthops can not be used with source routing");
3676− goto out;
3676+ goto out_free;
36773677 }
36783678 if (!nexthop_get(nh)) {
36793679 NL_SET_ERR_MSG(extack, "Nexthop has been deleted");
3680− goto out;
3680+ goto out_free;
36813681 }
36823682 rt->nh = nh;
36833683 fib6_nh = nexthop_fib6_nh(rt->nh);
@@ -3714,6 +3714,10 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, · 30 unmodified lines
37143714 out:
37153715 fib6_info_release(rt);
37163716 return ERR_PTR(err);
3717+out_free:
3718+ ip_fib_metrics_put(rt->fib6_metrics);
3719+ kfree(rt);
3720+ return ERR_PTR(err);
37173721 }
37183722
37193723 int ip6_route_add(struct fib6_config *cfg, gfp_t gfp_flags,
net/ipv6/sit.c+3−0
@@ -271,6 +271,9 @@ static struct ip_tunnel *ipip6_tunnel_locate(struct net *net, · 270 unmodified lines
271271 if (ipip6_tunnel_create(dev) < 0)
272272 goto failed_free;
273273
274+ if (!parms->name[0])
275+ strcpy(parms->name, dev->name);
276+
274277 return nt;
275278
276279 failed_free:
net/kcm/kcmsock.c+5−0
@@ -1066,6 +1066,11 @@ out_error: · 1065 unmodified lines
10661066 goto partial_message;
10671067 }
10681068
1069+ if (skb_has_frag_list(head)) {
1070+ kfree_skb_list(skb_shinfo(head)->frag_list);
1071+ skb_shinfo(head)->frag_list = NULL;
1072+ }
1073+
10691074 if (head != kcm->seq_skb)
10701075 kfree_skb(head);
10711076
net/mptcp/protocol.c+15−1
@@ -947,6 +947,10 @@ static void __mptcp_update_wmem(struct sock *sk) · 946 unmodified lines
947947 {
948948 struct mptcp_sock *msk = mptcp_sk(sk);
949949
950+#ifdef CONFIG_LOCKDEP
951+ WARN_ON_ONCE(!lockdep_is_held(&sk->sk_lock.slock));
952+#endif
953+
950954 if (!msk->wmem_reserved)
951955 return;
952956
@@ -1085,10 +1089,20 @@ out: · 132 unmodified lines
10851089
10861090 static void __mptcp_clean_una_wakeup(struct sock *sk)
10871091 {
1092+#ifdef CONFIG_LOCKDEP
1093+ WARN_ON_ONCE(!lockdep_is_held(&sk->sk_lock.slock));
1094+#endif
10881095 __mptcp_clean_una(sk);
10891096 mptcp_write_space(sk);
10901097 }
10911098
1099+static void mptcp_clean_una_wakeup(struct sock *sk)
1100+{
1101+ mptcp_data_lock(sk);
1102+ __mptcp_clean_una_wakeup(sk);
1103+ mptcp_data_unlock(sk);
1104+}
1105+
10921106 static void mptcp_enter_memory_pressure(struct sock *sk)
10931107 {
10941108 struct mptcp_subflow_context *subflow;
@@ -2299,7 +2313,7 @@ static void __mptcp_retrans(struct sock *sk) · 1204 unmodified lines
22992313 struct sock *ssk;
23002314 int ret;
23012315
2302− __mptcp_clean_una_wakeup(sk);
2316+ mptcp_clean_una_wakeup(sk);
23032317 dfrag = mptcp_rtx_head(sk);
23042318 if (!dfrag) {
23052319 if (mptcp_data_fin_enabled(msk)) {
net/mptcp/subflow.c+40−39
@@ -630,21 +630,20 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, · 629 unmodified lines
630630
631631 /* if the sk is MP_CAPABLE, we try to fetch the client key */
632632 if (subflow_req->mp_capable) {
633− if (TCP_SKB_CB(skb)->seq != subflow_req->ssn_offset + 1) {
634− /* here we can receive and accept an in-window,
635− * out-of-order pkt, which will not carry the MP_CAPABLE
636− * opt even on mptcp enabled paths
637− */
638− goto create_msk;
639− }
640−
633+ /* we can receive and accept an in-window, out-of-order pkt,
634+ * which may not carry the MP_CAPABLE opt even on mptcp enabled
635+ * paths: always try to extract the peer key, and fallback
636+ * for packets missing it.
637+ * Even OoO DSS packets coming legitly after dropped or
638+ * reordered MPC will cause fallback, but we don't have other
639+ * options.
640+ */
641641 mptcp_get_options(skb, &mp_opt);
642642 if (!mp_opt.mp_capable) {
643643 fallback = true;
644644 goto create_child;
645645 }
646646
647−create_msk:
648647 new_msk = mptcp_sk_clone(listener->conn, &mp_opt, req);
649648 if (!new_msk)
650649 fallback = true;
@@ -1012,21 +1011,11 @@ static bool subflow_check_data_avail(struct sock *ssk) · 361 unmodified lines
10121011
10131012 status = get_mapping_status(ssk, msk);
10141013 trace_subflow_check_data_avail(status, skb_peek(&ssk->sk_receive_queue));
1015− if (status == MAPPING_INVALID) {
1016− ssk->sk_err = EBADMSG;
1017− goto fatal;
1018− }
1019− if (status == MAPPING_DUMMY) {
1020− __mptcp_do_fallback(msk);
1021− skb = skb_peek(&ssk->sk_receive_queue);
1022− subflow->map_valid = 1;
1023− subflow->map_seq = READ_ONCE(msk->ack_seq);
1024− subflow->map_data_len = skb->len;
1025− subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq -
1026− subflow->ssn_offset;
1027− subflow->data_avail = MPTCP_SUBFLOW_DATA_AVAIL;
1028− return true;
1029− }
1014+ if (unlikely(status == MAPPING_INVALID))
1015+ goto fallback;
1016+
1017+ if (unlikely(status == MAPPING_DUMMY))
1018+ goto fallback;
10301019
10311020 if (status != MAPPING_OK)
10321021 goto no_data;
@@ -1039,10 +1028,8 @@ static bool subflow_check_data_avail(struct sock *ssk) · 6 unmodified lines
10391028 * MP_CAPABLE-based mapping
10401029 */
10411030 if (unlikely(!READ_ONCE(msk->can_ack))) {
1042− if (!subflow->mpc_map) {
1043− ssk->sk_err = EBADMSG;
1044− goto fatal;
1045− }
1031+ if (!subflow->mpc_map)
1032+ goto fallback;
10461033 WRITE_ONCE(msk->remote_key, subflow->remote_key);
10471034 WRITE_ONCE(msk->ack_seq, subflow->map_seq);
10481035 WRITE_ONCE(msk->can_ack, true);
@@ -1070,17 +1057,31 @@ static bool subflow_check_data_avail(struct sock *ssk) · 21 unmodified lines
10701057 no_data:
10711058 subflow_sched_work_if_closed(msk, ssk);
10721059 return false;
1073−fatal:
1074− /* fatal protocol error, close the socket */
1075− /* This barrier is coupled with smp_rmb() in tcp_poll() */
1076− smp_wmb();
1077− ssk->sk_error_report(ssk);
1078− tcp_set_state(ssk, TCP_CLOSE);
1079− subflow->reset_transient = 0;
1080− subflow->reset_reason = MPTCP_RST_EMPTCP;
1081− tcp_send_active_reset(ssk, GFP_ATOMIC);
1082− subflow->data_avail = 0;
1083− return false;
1060+
1061+fallback:
1062+ /* RFC 8684 section 3.7. */
1063+ if (subflow->mp_join || subflow->fully_established) {
1064+ /* fatal protocol error, close the socket.
1065+ * subflow_error_report() will introduce the appropriate barriers
1066+ */
1067+ ssk->sk_err = EBADMSG;
1068+ ssk->sk_error_report(ssk);
1069+ tcp_set_state(ssk, TCP_CLOSE);
1070+ subflow->reset_transient = 0;
1071+ subflow->reset_reason = MPTCP_RST_EMPTCP;
1072+ tcp_send_active_reset(ssk, GFP_ATOMIC);
1073+ subflow->data_avail = 0;
1074+ return false;
1075+ }
1076+
1077+ __mptcp_do_fallback(msk);
1078+ skb = skb_peek(&ssk->sk_receive_queue);
1079+ subflow->map_valid = 1;
1080+ subflow->map_seq = READ_ONCE(msk->ack_seq);
1081+ subflow->map_data_len = skb->len;
1082+ subflow->map_subflow_seq = tcp_sk(ssk)->copied_seq - subflow->ssn_offset;
1083+ subflow->data_avail = MPTCP_SUBFLOW_DATA_AVAIL;
1084+ return true;
10841085 }
10851086
10861087 bool mptcp_subflow_data_available(struct sock *sk)
net/netfilter/ipvs/ip_vs_ctl.c+1−1
@@ -1367,7 +1367,7 @@ ip_vs_add_service(struct netns_ipvs *ipvs, struct ip_vs_service_user_kern *u, · 1366 unmodified lines
13671367 ip_vs_addr_copy(svc->af, &svc->addr, &u->addr);
13681368 svc->port = u->port;
13691369 svc->fwmark = u->fwmark;
1370− svc->flags = u->flags;
1370+ svc->flags = u->flags & ~IP_VS_SVC_F_HASHED;
13711371 svc->timeout = u->timeout * HZ;
13721372 svc->netmask = u->netmask;
13731373 svc->ipvs = ipvs;
net/netfilter/nf_conntrack_proto.c+1−1
@@ -664,7 +664,7 @@ int nf_conntrack_proto_init(void) · 663 unmodified lines
664664
665665 #if IS_ENABLED(CONFIG_IPV6)
666666 cleanup_sockopt:
667− nf_unregister_sockopt(&so_getorigdst6);
667+ nf_unregister_sockopt(&so_getorigdst);
668668 #endif
669669 return ret;
670670 }
net/netfilter/nf_tables_api.c+57−27
@@ -736,7 +736,8 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, · 735 unmodified lines
736736 goto nla_put_failure;
737737
738738 if (nla_put_string(skb, NFTA_TABLE_NAME, table->name) ||
739− nla_put_be32(skb, NFTA_TABLE_FLAGS, htonl(table->flags)) ||
739+ nla_put_be32(skb, NFTA_TABLE_FLAGS,
740+ htonl(table->flags & NFT_TABLE_F_MASK)) ||
740741 nla_put_be32(skb, NFTA_TABLE_USE, htonl(table->use)) ||
741742 nla_put_be64(skb, NFTA_TABLE_HANDLE, cpu_to_be64(table->handle),
742743 NFTA_TABLE_PAD))
@@ -947,20 +948,22 @@ err_register_hooks: · 204 unmodified lines
947948
948949 static void nf_tables_table_disable(struct net *net, struct nft_table *table)
949950 {
951+ table->flags &= ~NFT_TABLE_F_DORMANT;
950952 nft_table_disable(net, table, 0);
953+ table->flags |= NFT_TABLE_F_DORMANT;
951954 }
952955
953−enum {
954− NFT_TABLE_STATE_UNCHANGED = 0,
955− NFT_TABLE_STATE_DORMANT,
956− NFT_TABLE_STATE_WAKEUP
957−};
956+#define __NFT_TABLE_F_INTERNAL (NFT_TABLE_F_MASK + 1)
957+#define __NFT_TABLE_F_WAS_DORMANT (__NFT_TABLE_F_INTERNAL << 0)
958+#define __NFT_TABLE_F_WAS_AWAKEN (__NFT_TABLE_F_INTERNAL << 1)
959+#define __NFT_TABLE_F_UPDATE (__NFT_TABLE_F_WAS_DORMANT | \
960+ __NFT_TABLE_F_WAS_AWAKEN)
958961
959962 static int nf_tables_updtable(struct nft_ctx *ctx)
960963 {
961964 struct nft_trans *trans;
962965 u32 flags;
963− int ret = 0;
966+ int ret;
964967
965968 if (!ctx->nla[NFTA_TABLE_FLAGS])
966969 return 0;
@@ -985,21 +988,27 @@ static int nf_tables_updtable(struct nft_ctx *ctx) · 18 unmodified lines
985988
986989 if ((flags & NFT_TABLE_F_DORMANT) &&
987990 !(ctx->table->flags & NFT_TABLE_F_DORMANT)) {
988− nft_trans_table_state(trans) = NFT_TABLE_STATE_DORMANT;
991+ ctx->table->flags |= NFT_TABLE_F_DORMANT;
992+ if (!(ctx->table->flags & __NFT_TABLE_F_UPDATE))
993+ ctx->table->flags |= __NFT_TABLE_F_WAS_AWAKEN;
989994 } else if (!(flags & NFT_TABLE_F_DORMANT) &&
990995 ctx->table->flags & NFT_TABLE_F_DORMANT) {
991− ret = nf_tables_table_enable(ctx->net, ctx->table);
992− if (ret >= 0)
993− nft_trans_table_state(trans) = NFT_TABLE_STATE_WAKEUP;
996+ ctx->table->flags &= ~NFT_TABLE_F_DORMANT;
997+ if (!(ctx->table->flags & __NFT_TABLE_F_UPDATE)) {
998+ ret = nf_tables_table_enable(ctx->net, ctx->table);
999+ if (ret < 0)
1000+ goto err_register_hooks;
1001+
1002+ ctx->table->flags |= __NFT_TABLE_F_WAS_DORMANT;
1003+ }
9941004 }
995− if (ret < 0)
996− goto err;
9971005
998− nft_trans_table_flags(trans) = flags;
9991006 nft_trans_table_update(trans) = true;
10001007 nft_trans_commit_list_add_tail(ctx->net, trans);
1008+
10011009 return 0;
1002−err:
1010+
1011+err_register_hooks:
10031012 nft_trans_destroy(trans);
10041013 return ret;
10051014 }
@@ -1905,7 +1914,7 @@ static int nft_chain_parse_netdev(struct net *net, · 899 unmodified lines
19051914 static int nft_chain_parse_hook(struct net *net,
19061915 const struct nlattr * const nla[],
19071916 struct nft_chain_hook *hook, u8 family,
1908− bool autoload)
1917+ struct netlink_ext_ack *extack, bool autoload)
19091918 {
19101919 struct nftables_pernet *nft_net = nft_pernet(net);
19111920 struct nlattr *ha[NFTA_HOOK_MAX + 1];
@@ -1935,8 +1944,10 @@ static int nft_chain_parse_hook(struct net *net, · 23 unmodified lines
19351944 if (nla[NFTA_CHAIN_TYPE]) {
19361945 type = nf_tables_chain_type_lookup(net, nla[NFTA_CHAIN_TYPE],
19371946 family, autoload);
1938− if (IS_ERR(type))
1947+ if (IS_ERR(type)) {
1948+ NL_SET_BAD_ATTR(extack, nla[NFTA_CHAIN_TYPE]);
19391949 return PTR_ERR(type);
1950+ }
19401951 }
19411952 if (hook->num >= NFT_MAX_HOOKS || !(type->hook_mask & (1 << hook->num)))
19421953 return -EOPNOTSUPP;
@@ -1945,8 +1956,11 @@ static int nft_chain_parse_hook(struct net *net, · 2 unmodified lines
19451956 hook->priority <= NF_IP_PRI_CONNTRACK)
19461957 return -EOPNOTSUPP;
19471958
1948− if (!try_module_get(type->owner))
1959+ if (!try_module_get(type->owner)) {
1960+ if (nla[NFTA_CHAIN_TYPE])
1961+ NL_SET_BAD_ATTR(extack, nla[NFTA_CHAIN_TYPE]);
19491962 return -ENOENT;
1963+ }
19501964
19511965 hook->type = type;
19521966
@@ -2057,7 +2071,8 @@ static int nft_chain_add(struct nft_table *table, struct nft_chain *chain) · 104 unmodified lines
20572071 static u64 chain_id;
20582072
20592073 static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
2060− u8 policy, u32 flags)
2074+ u8 policy, u32 flags,
2075+ struct netlink_ext_ack *extack)
20612076 {
20622077 const struct nlattr * const *nla = ctx->nla;
20632078 struct nft_table *table = ctx->table;
@@ -2079,7 +2094,8 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask, · 15 unmodified lines
20792094 if (flags & NFT_CHAIN_BINDING)
20802095 return -EOPNOTSUPP;
20812096
2082− err = nft_chain_parse_hook(net, nla, &hook, family, true);
2097+ err = nft_chain_parse_hook(net, nla, &hook, family, extack,
2098+ true);
20832099 if (err < 0)
20842100 return err;
20852101
@@ -2234,7 +2250,7 @@ static int nf_tables_updchain(struct nft_ctx *ctx, u8 genmask, u8 policy, · 148 unmodified lines
22342250 return -EEXIST;
22352251 }
22362252 err = nft_chain_parse_hook(ctx->net, nla, &hook, ctx->family,
2237− false);
2253+ extack, false);
22382254 if (err < 0)
22392255 return err;
22402256
@@ -2447,7 +2463,7 @@ static int nf_tables_newchain(struct sk_buff *skb, const struct nfnl_info *info, · 206 unmodified lines
24472463 extack);
24482464 }
24492465
2450− return nf_tables_addchain(&ctx, family, genmask, policy, flags);
2466+ return nf_tables_addchain(&ctx, family, genmask, policy, flags, extack);
24512467 }
24522468
24532469 static int nf_tables_delchain(struct sk_buff *skb, const struct nfnl_info *info,
@@ -3328,8 +3344,10 @@ static int nf_tables_newrule(struct sk_buff *skb, const struct nfnl_info *info, · 874 unmodified lines
33283344 if (n == NFT_RULE_MAXEXPRS)
33293345 goto err1;
33303346 err = nf_tables_expr_parse(&ctx, tmp, &expr_info[n]);
3331− if (err < 0)
3347+ if (err < 0) {
3348+ NL_SET_BAD_ATTR(extack, tmp);
33323349 goto err1;
3350+ }
33333351 size += expr_info[n].ops->size;
33343352 n++;
33353353 }
@@ -8547,10 +8565,14 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) · 5211 unmodified lines
85478565 switch (trans->msg_type) {
85488566 case NFT_MSG_NEWTABLE:
85498567 if (nft_trans_table_update(trans)) {
8550− if (nft_trans_table_state(trans) == NFT_TABLE_STATE_DORMANT)
8568+ if (!(trans->ctx.table->flags & __NFT_TABLE_F_UPDATE)) {
8569+ nft_trans_destroy(trans);
8570+ break;
8571+ }
8572+ if (trans->ctx.table->flags & NFT_TABLE_F_DORMANT)
85518573 nf_tables_table_disable(net, trans->ctx.table);
85528574
8553− trans->ctx.table->flags = nft_trans_table_flags(trans);
8575+ trans->ctx.table->flags &= ~__NFT_TABLE_F_UPDATE;
85548576 } else {
85558577 nft_clear(net, trans->ctx.table);
85568578 }
@@ -8768,9 +8790,17 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) · 211 unmodified lines
87688790 switch (trans->msg_type) {
87698791 case NFT_MSG_NEWTABLE:
87708792 if (nft_trans_table_update(trans)) {
8771− if (nft_trans_table_state(trans) == NFT_TABLE_STATE_WAKEUP)
8793+ if (!(trans->ctx.table->flags & __NFT_TABLE_F_UPDATE)) {
8794+ nft_trans_destroy(trans);
8795+ break;
8796+ }
8797+ if (trans->ctx.table->flags & __NFT_TABLE_F_WAS_DORMANT) {
87728798 nf_tables_table_disable(net, trans->ctx.table);
8773−
8799+ trans->ctx.table->flags |= NFT_TABLE_F_DORMANT;
8800+ } else if (trans->ctx.table->flags & __NFT_TABLE_F_WAS_AWAKEN) {
8801+ trans->ctx.table->flags &= ~NFT_TABLE_F_DORMANT;
8802+ }
8803+ trans->ctx.table->flags &= ~__NFT_TABLE_F_UPDATE;
87748804 nft_trans_destroy(trans);
87758805 } else {
87768806 list_del_rcu(&trans->ctx.table->list);
net/netfilter/nfnetlink_cthelper.c+6−2
@@ -380,10 +380,14 @@ static int · 379 unmodified lines
380380 nfnl_cthelper_update(const struct nlattr * const tb[],
381381 struct nf_conntrack_helper *helper)
382382 {
383+ u32 size;
383384 int ret;
384385
385− if (tb[NFCTH_PRIV_DATA_LEN])
386− return -EBUSY;
386+ if (tb[NFCTH_PRIV_DATA_LEN]) {
387+ size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN]));
388+ if (size != helper->data_len)
389+ return -EBUSY;
390+ }
387391
388392 if (tb[NFCTH_POLICY]) {
389393 ret = nfnl_cthelper_update_policy(helper, tb[NFCTH_POLICY]);
net/netfilter/nft_ct.c+1−1
@@ -1217,7 +1217,7 @@ static void nft_ct_expect_obj_eval(struct nft_object *obj, · 1216 unmodified lines
12171217 struct nf_conn *ct;
12181218
12191219 ct = nf_ct_get(pkt->skb, &ctinfo);
1220− if (!ct || ctinfo == IP_CT_UNTRACKED) {
1220+ if (!ct || nf_ct_is_confirmed(ct) || nf_ct_is_template(ct)) {
12211221 regs->verdict.code = NFT_BREAK;
12221222 return;
12231223 }
net/nfc/llcp_sock.c+2−0
@@ -110,6 +110,7 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) · 109 unmodified lines
110110 if (!llcp_sock->service_name) {
111111 nfc_llcp_local_put(llcp_sock->local);
112112 llcp_sock->local = NULL;
113+ llcp_sock->dev = NULL;
113114 ret = -ENOMEM;
114115 goto put_dev;
115116 }
@@ -119,6 +120,7 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen) · 3 unmodified lines
119120 llcp_sock->local = NULL;
120121 kfree(llcp_sock->service_name);
121122 llcp_sock->service_name = NULL;
123+ llcp_sock->dev = NULL;
122124 ret = -EADDRINUSE;
123125 goto put_dev;
124126 }
net/sched/act_ct.c+4−6
@@ -984,7 +984,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a, · 983 unmodified lines
984984 */
985985 cached = tcf_ct_skb_nfct_cached(net, skb, p->zone, force);
986986 if (!cached) {
987− if (!commit && tcf_ct_flow_table_lookup(p, skb, family)) {
987+ if (tcf_ct_flow_table_lookup(p, skb, family)) {
988988 skip_add = true;
989989 goto do_nat;
990990 }
@@ -1022,10 +1022,11 @@ do_nat: · 31 unmodified lines
10221022 * even if the connection is already confirmed.
10231023 */
10241024 nf_conntrack_confirm(skb);
1025− } else if (!skip_add) {
1026− tcf_ct_flow_table_process_conn(p->ct_ft, ct, ctinfo);
10271025 }
10281026
1027+ if (!skip_add)
1028+ tcf_ct_flow_table_process_conn(p->ct_ft, ct, ctinfo);
1029+
10291030 out_push:
10301031 skb_push_rcsum(skb, nh_ofs);
10311032
@@ -1202,9 +1203,6 @@ static int tcf_ct_fill_params(struct net *net, · 170 unmodified lines
12021203 sizeof(p->zone));
12031204 }
12041205
1205− if (p->zone == NF_CT_DEFAULT_ZONE_ID)
1206− return 0;
1207−
12081206 nf_ct_zone_init(&zone, p->zone, NF_CT_DEFAULT_ZONE_DIR, 0);
12091207 tmpl = nf_ct_tmpl_alloc(net, &zone, GFP_KERNEL);
12101208 if (!tmpl) {
net/sched/sch_htb.c+4−4
@@ -1488,7 +1488,8 @@ static void htb_parent_to_leaf_offload(struct Qdisc *sch, · 1487 unmodified lines
14881488 struct Qdisc *old_q;
14891489
14901490 /* One ref for cl->leaf.q, the other for dev_queue->qdisc. */
1491− qdisc_refcount_inc(new_q);
1491+ if (new_q)
1492+ qdisc_refcount_inc(new_q);
14921493 old_q = htb_graft_helper(dev_queue, new_q);
14931494 WARN_ON(!(old_q->flags & TCQ_F_BUILTIN));
14941495 }
@@ -1675,10 +1676,9 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg, · 180 unmodified lines
16751676 cl->parent->common.classid,
16761677 NULL);
16771678 if (q->offload) {
1678− if (new_q) {
1679+ if (new_q)
16791680 htb_set_lockdep_class_child(new_q);
1680− htb_parent_to_leaf_offload(sch, dev_queue, new_q);
1681− }
1681+ htb_parent_to_leaf_offload(sch, dev_queue, new_q);
16821682 }
16831683 }
16841684
net/tls/tls_device.c+49−11
@@ -50,6 +50,7 @@ static void tls_device_gc_task(struct work_struct *work); · 49 unmodified lines
5050 static DECLARE_WORK(tls_device_gc_work, tls_device_gc_task);
5151 static LIST_HEAD(tls_device_gc_list);
5252 static LIST_HEAD(tls_device_list);
53+static LIST_HEAD(tls_device_down_list);
5354 static DEFINE_SPINLOCK(tls_device_lock);
5455
5556 static void tls_device_free_ctx(struct tls_context *ctx)
@@ -680,15 +681,13 @@ static void tls_device_resync_rx(struct tls_context *tls_ctx, · 624 unmodified lines
680681 struct tls_offload_context_rx *rx_ctx = tls_offload_ctx_rx(tls_ctx);
681682 struct net_device *netdev;
682683
683− if (WARN_ON(test_and_set_bit(TLS_RX_SYNC_RUNNING, &tls_ctx->flags)))
684− return;
685−
686684 trace_tls_device_rx_resync_send(sk, seq, rcd_sn, rx_ctx->resync_type);
685+ rcu_read_lock();
687686 netdev = READ_ONCE(tls_ctx->netdev);
688687 if (netdev)
689688 netdev->tlsdev_ops->tls_dev_resync(netdev, sk, seq, rcd_sn,
690689 TLS_OFFLOAD_CTX_DIR_RX);
691− clear_bit_unlock(TLS_RX_SYNC_RUNNING, &tls_ctx->flags);
690+ rcu_read_unlock();
692691 TLS_INC_STATS(sock_net(sk), LINUX_MIB_TLSRXDEVICERESYNC);
693692 }
694693
@@ -761,6 +760,8 @@ void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq) · 66 unmodified lines
761760
762761 if (tls_ctx->rx_conf != TLS_HW)
763762 return;
763+ if (unlikely(test_bit(TLS_RX_DEV_DEGRADED, &tls_ctx->flags)))
764+ return;
764765
765766 prot = &tls_ctx->prot_info;
766767 rx_ctx = tls_offload_ctx_rx(tls_ctx);
@@ -963,6 +964,17 @@ int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx, · 196 unmodified lines
963964
964965 ctx->sw.decrypted |= is_decrypted;
965966
967+ if (unlikely(test_bit(TLS_RX_DEV_DEGRADED, &tls_ctx->flags))) {
968+ if (likely(is_encrypted || is_decrypted))
969+ return 0;
970+
971+ /* After tls_device_down disables the offload, the next SKB will
972+ * likely have initial fragments decrypted, and final ones not
973+ * decrypted. We need to reencrypt that single SKB.
974+ */
975+ return tls_device_reencrypt(sk, skb);
976+ }
977+
966978 /* Return immediately if the record is either entirely plaintext or
967979 * entirely ciphertext. Otherwise handle reencrypt partially decrypted
968980 * record.
@@ -1292,6 +1304,26 @@ static int tls_device_down(struct net_device *netdev) · 323 unmodified lines
12921304 spin_unlock_irqrestore(&tls_device_lock, flags);
12931305
12941306 list_for_each_entry_safe(ctx, tmp, &list, list) {
1307+ /* Stop offloaded TX and switch to the fallback.
1308+ * tls_is_sk_tx_device_offloaded will return false.
1309+ */
1310+ WRITE_ONCE(ctx->sk->sk_validate_xmit_skb, tls_validate_xmit_skb_sw);
1311+
1312+ /* Stop the RX and TX resync.
1313+ * tls_dev_resync must not be called after tls_dev_del.
1314+ */
1315+ WRITE_ONCE(ctx->netdev, NULL);
1316+
1317+ /* Start skipping the RX resync logic completely. */
1318+ set_bit(TLS_RX_DEV_DEGRADED, &ctx->flags);
1319+
1320+ /* Sync with inflight packets. After this point:
1321+ * TX: no non-encrypted packets will be passed to the driver.
1322+ * RX: resync requests from the driver will be ignored.
1323+ */
1324+ synchronize_net();
1325+
1326+ /* Release the offload context on the driver side. */
12951327 if (ctx->tx_conf == TLS_HW)
12961328 netdev->tlsdev_ops->tls_dev_del(netdev, ctx,
12971329 TLS_OFFLOAD_CTX_DIR_TX);
@@ -1299,15 +1331,21 @@ static int tls_device_down(struct net_device *netdev) · 1 unmodified line
12991331 !test_bit(TLS_RX_DEV_CLOSED, &ctx->flags))
13001332 netdev->tlsdev_ops->tls_dev_del(netdev, ctx,
13011333 TLS_OFFLOAD_CTX_DIR_RX);
1302− WRITE_ONCE(ctx->netdev, NULL);
1303− smp_mb__before_atomic(); /* pairs with test_and_set_bit() */
1304− while (test_bit(TLS_RX_SYNC_RUNNING, &ctx->flags))
1305− usleep_range(10, 200);
1334+
13061335 dev_put(netdev);
1307− list_del_init(&ctx->list);
13081336
1309− if (refcount_dec_and_test(&ctx->refcount))
1310− tls_device_free_ctx(ctx);
1337+ /* Move the context to a separate list for two reasons:
1338+ * 1. When the context is deallocated, list_del is called.
1339+ * 2. It's no longer an offloaded context, so we don't want to
1340+ * run offload-specific code on this context.
1341+ */
1342+ spin_lock_irqsave(&tls_device_lock, flags);
1343+ list_move_tail(&ctx->list, &tls_device_down_list);
1344+ spin_unlock_irqrestore(&tls_device_lock, flags);
1345+
1346+ /* Device contexts for RX and TX will be freed in on sk_destruct
1347+ * by tls_device_free_ctx. rx_conf and tx_conf stay in TLS_HW.
1348+ */
13111349 }
13121350
13131351 up_write(&device_offload_lock);
net/tls/tls_device_fallback.c+7−0
@@ -431,6 +431,13 @@ struct sk_buff *tls_validate_xmit_skb(struct sock *sk, · 430 unmodified lines
431431 }
432432 EXPORT_SYMBOL_GPL(tls_validate_xmit_skb);
433433
434+struct sk_buff *tls_validate_xmit_skb_sw(struct sock *sk,
435+ struct net_device *dev,
436+ struct sk_buff *skb)
437+{
438+ return tls_sw_fallback(sk, skb);
439+}
440+
434441 struct sk_buff *tls_encrypt_skb(struct sk_buff *skb)
435442 {
436443 return tls_sw_fallback(skb->sk, skb);
net/tls/tls_main.c+1−0
@@ -636,6 +636,7 @@ struct tls_context *tls_ctx_create(struct sock *sk) · 635 unmodified lines
636636 mutex_init(&ctx->tx_lock);
637637 rcu_assign_pointer(icsk->icsk_ulp_data, ctx);
638638 ctx->sk_proto = READ_ONCE(sk->sk_prot);
639+ ctx->sk = sk;
639640 return ctx;
640641 }
641642
net/x25/af_x25.c+1−1
@@ -536,7 +536,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol, · 535 unmodified lines
536536 if (protocol)
537537 goto out;
538538
539− rc = -ENOBUFS;
539+ rc = -ENOMEM;
540540 if ((sk = x25_alloc_socket(net, kern)) == NULL)
541541 goto out;
542542
samples/vfio-mdev/mdpy-fb.c+9−4
@@ -117,22 +117,27 @@ static int mdpy_fb_probe(struct pci_dev *pdev, · 116 unmodified lines
117117 if (format != DRM_FORMAT_XRGB8888) {
118118 pci_err(pdev, "format mismatch (0x%x != 0x%x)\n",
119119 format, DRM_FORMAT_XRGB8888);
120− return -EINVAL;
120+ ret = -EINVAL;
121+ goto err_release_regions;
121122 }
122123 if (width < 100 || width > 10000) {
123124 pci_err(pdev, "width (%d) out of range\n", width);
124− return -EINVAL;
125+ ret = -EINVAL;
126+ goto err_release_regions;
125127 }
126128 if (height < 100 || height > 10000) {
127129 pci_err(pdev, "height (%d) out of range\n", height);
128− return -EINVAL;
130+ ret = -EINVAL;
131+ goto err_release_regions;
129132 }
130133 pci_info(pdev, "mdpy found: %dx%d framebuffer\n",
131134 width, height);
132135
133136 info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
134− if (!info)
137+ if (!info) {
138+ ret = -ENOMEM;
135139 goto err_release_regions;
140+ }
136141 pci_set_drvdata(pdev, info);
137142 par = info->par;
138143
scripts/Makefile.modfinal+1−1
@@ -59,7 +59,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ · 58 unmodified lines
5959 quiet_cmd_btf_ko = BTF [M] $@
6060 cmd_btf_ko = \
6161 if [ -f vmlinux ]; then \
62− LLVM_OBJCOPY=$(OBJCOPY) $(PAHOLE) -J --btf_base vmlinux $@; \
62+ LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \
6363 else \
6464 printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
6565 fi;
scripts/link-vmlinux.sh+1−1
@@ -240,7 +240,7 @@ gen_btf() · 239 unmodified lines
240240 fi
241241
242242 info "BTF" ${2}
243− LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${extra_paholeopt} ${1}
243+ LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${extra_paholeopt} ${1}
244244
245245 # Create ${2} which contains just .BTF section but no symbols. Add
246246 # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
sound/core/control_led.c+26−7
@@ -17,6 +17,9 @@ MODULE_LICENSE("GPL"); · 16 unmodified lines
1717 #define MAX_LED (((SNDRV_CTL_ELEM_ACCESS_MIC_LED - SNDRV_CTL_ELEM_ACCESS_SPK_LED) \
1818 >> SNDRV_CTL_ELEM_ACCESS_LED_SHIFT) + 1)
1919
20+#define to_led_card_dev(_dev) \
21+ container_of(_dev, struct snd_ctl_led_card, dev)
22+
2023 enum snd_ctl_led_mode {
2124 MODE_FOLLOW_MUTE = 0,
2225 MODE_FOLLOW_ROUTE,
@@ -371,6 +374,21 @@ static void snd_ctl_led_disconnect(struct snd_card *card) · 348 unmodified lines
371374 snd_ctl_led_refresh();
372375 }
373376
377+static void snd_ctl_led_card_release(struct device *dev)
378+{
379+ struct snd_ctl_led_card *led_card = to_led_card_dev(dev);
380+
381+ kfree(led_card);
382+}
383+
384+static void snd_ctl_led_release(struct device *dev)
385+{
386+}
387+
388+static void snd_ctl_led_dev_release(struct device *dev)
389+{
390+}
391+
374392 /*
375393 * sysfs
376394 */
@@ -663,6 +681,7 @@ static void snd_ctl_led_sysfs_add(struct snd_card *card) · 286 unmodified lines
663681 led_card->number = card->number;
664682 led_card->led = led;
665683 device_initialize(&led_card->dev);
684+ led_card->dev.release = snd_ctl_led_card_release;
666685 if (dev_set_name(&led_card->dev, "card%d", card->number) < 0)
667686 goto cerr;
668687 led_card->dev.parent = &led->dev;
@@ -681,7 +700,6 @@ cerr: · 12 unmodified lines
681700 put_device(&led_card->dev);
682701 cerr2:
683702 printk(KERN_ERR "snd_ctl_led: unable to add card%d", card->number);
684− kfree(led_card);
685703 }
686704 }
687705
@@ -700,8 +718,7 @@ static void snd_ctl_led_sysfs_remove(struct snd_card *card) · 12 unmodified lines
700718 snprintf(link_name, sizeof(link_name), "led-%s", led->name);
701719 sysfs_remove_link(&card->ctl_dev.kobj, link_name);
702720 sysfs_remove_link(&led_card->dev.kobj, "card");
703− device_del(&led_card->dev);
704− kfree(led_card);
721+ device_unregister(&led_card->dev);
705722 led->cards[card->number] = NULL;
706723 }
707724 }
@@ -723,6 +740,7 @@ static int __init snd_ctl_led_init(void) · 15 unmodified lines
723740
724741 device_initialize(&snd_ctl_led_dev);
725742 snd_ctl_led_dev.class = sound_class;
743+ snd_ctl_led_dev.release = snd_ctl_led_dev_release;
726744 dev_set_name(&snd_ctl_led_dev, "ctl-led");
727745 if (device_add(&snd_ctl_led_dev)) {
728746 put_device(&snd_ctl_led_dev);
@@ -733,15 +751,16 @@ static int __init snd_ctl_led_init(void) · 4 unmodified lines
733751 INIT_LIST_HEAD(&led->controls);
734752 device_initialize(&led->dev);
735753 led->dev.parent = &snd_ctl_led_dev;
754+ led->dev.release = snd_ctl_led_release;
736755 led->dev.groups = snd_ctl_led_dev_attr_groups;
737756 dev_set_name(&led->dev, led->name);
738757 if (device_add(&led->dev)) {
739758 put_device(&led->dev);
740759 for (; group > 0; group--) {
741760 led = &snd_ctl_leds[group - 1];
742− device_del(&led->dev);
761+ device_unregister(&led->dev);
743762 }
744− device_del(&snd_ctl_led_dev);
763+ device_unregister(&snd_ctl_led_dev);
745764 return -ENOMEM;
746765 }
747766 }
@@ -767,9 +786,9 @@ static void __exit snd_ctl_led_exit(void) · 19 unmodified lines
767786 }
768787 for (group = 0; group < MAX_LED; group++) {
769788 led = &snd_ctl_leds[group];
770− device_del(&led->dev);
789+ device_unregister(&led->dev);
771790 }
772− device_del(&snd_ctl_led_dev);
791+ device_unregister(&snd_ctl_led_dev);
773792 snd_ctl_led_clean(NULL);
774793 }
775794
sound/core/seq/seq_timer.c+9−1
@@ -297,8 +297,16 @@ int snd_seq_timer_open(struct snd_seq_queue *q) · 296 unmodified lines
297297 return err;
298298 }
299299 spin_lock_irq(&tmr->lock);
300− tmr->timeri = t;
300+ if (tmr->timeri)
301+ err = -EBUSY;
302+ else
303+ tmr->timeri = t;
301304 spin_unlock_irq(&tmr->lock);
305+ if (err < 0) {
306+ snd_timer_close(t);
307+ snd_timer_instance_free(t);
308+ return err;
309+ }
302310 return 0;
303311 }
304312
sound/core/timer.c+2−1
@@ -520,9 +520,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) · 519 unmodified lines
520520 return;
521521 if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
522522 return;
523+ event += 10; /* convert to SNDRV_TIMER_EVENT_MXXX */
523524 list_for_each_entry(ts, &ti->slave_active_head, active_list)
524525 if (ts->ccallback)
525− ts->ccallback(ts, event + 100, &tstamp, resolution);
526+ ts->ccallback(ts, event, &tstamp, resolution);
526527 }
527528
528529 /* start/continue a master timer */
sound/firewire/amdtp-stream.c+1−1
@@ -804,7 +804,7 @@ static void generate_pkt_descs(struct amdtp_stream *s, struct pkt_desc *descs, · 803 unmodified lines
804804 static inline void cancel_stream(struct amdtp_stream *s)
805805 {
806806 s->packet_index = -1;
807− if (current_work() == &s->period_work)
807+ if (in_interrupt())
808808 amdtp_stream_pcm_abort(s);
809809 WRITE_ONCE(s->pcm_buffer_pointer, SNDRV_PCM_POS_XRUN);
810810 }
sound/hda/intel-dsp-config.c+4−0
@@ -331,6 +331,10 @@ static const struct config_entry config_table[] = { · 330 unmodified lines
331331 .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
332332 .device = 0x51c8,
333333 },
334+ {
335+ .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE,
336+ .device = 0x51cc,
337+ },
334338 #endif
335339
336340 };
sound/pci/hda/hda_codec.c+5−0
@@ -2917,6 +2917,7 @@ static int hda_codec_runtime_resume(struct device *dev) · 2916 unmodified lines
29172917 #ifdef CONFIG_PM_SLEEP
29182918 static int hda_codec_pm_prepare(struct device *dev)
29192919 {
2920+ dev->power.power_state = PMSG_SUSPEND;
29202921 return pm_runtime_suspended(dev);
29212922 }
29222923
@@ -2924,6 +2925,10 @@ static void hda_codec_pm_complete(struct device *dev) · 1 unmodified line
29242925 {
29252926 struct hda_codec *codec = dev_to_hda_codec(dev);
29262927
2928+ /* If no other pm-functions are called between prepare() and complete() */
2929+ if (dev->power.power_state.event == PM_EVENT_SUSPEND)
2930+ dev->power.power_state = PMSG_RESUME;
2931+
29272932 if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
29282933 hda_codec_need_resume(codec) || codec->forced_resume))
29292934 pm_request_resume(dev);
sound/pci/hda/hda_generic.c+1−0
@@ -3520,6 +3520,7 @@ static int cap_sw_put(struct snd_kcontrol *kcontrol, · 3519 unmodified lines
35203520 static const struct snd_kcontrol_new cap_sw_temp = {
35213521 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
35223522 .name = "Capture Switch",
3523+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
35233524 .info = cap_sw_info,
35243525 .get = cap_sw_get,
35253526 .put = cap_sw_put,
sound/pci/hda/hda_intel.c+3−0
@@ -2485,6 +2485,9 @@ static const struct pci_device_id azx_ids[] = { · 2484 unmodified lines
24852485 /* Alderlake-P */
24862486 { PCI_DEVICE(0x8086, 0x51c8),
24872487 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
2488+ /* Alderlake-M */
2489+ { PCI_DEVICE(0x8086, 0x51cc),
2490+ .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
24882491 /* Elkhart Lake */
24892492 { PCI_DEVICE(0x8086, 0x4b55),
24902493 .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
sound/pci/hda/patch_cirrus.c+3−4
@@ -2206,10 +2206,9 @@ static void cs8409_cs42l42_fixups(struct hda_codec *codec, · 2205 unmodified lines
22062206 break;
22072207 case HDA_FIXUP_ACT_PROBE:
22082208
2209− /* Set initial volume on Bullseye to -26 dB */
2210− if (codec->fixup_id == CS8409_BULLSEYE)
2211− snd_hda_codec_amp_init_stereo(codec, CS8409_CS42L42_DMIC_ADC_PIN_NID,
2212− HDA_INPUT, 0, 0xff, 0x19);
2209+ /* Set initial DMIC volume to -26 dB */
2210+ snd_hda_codec_amp_init_stereo(codec, CS8409_CS42L42_DMIC_ADC_PIN_NID,
2211+ HDA_INPUT, 0, 0xff, 0x19);
22132212 snd_hda_gen_add_kctl(&spec->gen,
22142213 NULL, &cs8409_cs42l42_hp_volume_mixer);
22152214 snd_hda_gen_add_kctl(&spec->gen,
sound/pci/hda/patch_realtek.c+17−0
@@ -6568,6 +6568,7 @@ enum { · 6567 unmodified lines
65686568 ALC285_FIXUP_HP_SPECTRE_X360,
65696569 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
65706570 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
6571+ ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
65716572 };
65726573
65736574 static const struct hda_fixup alc269_fixups[] = {
@@ -8146,6 +8147,15 @@ static const struct hda_fixup alc269_fixups[] = { · 1572 unmodified lines
81468147 .chained = true,
81478148 .chain_id = ALC283_FIXUP_HEADSET_MIC,
81488149 },
8150+ [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8151+ .type = HDA_FIXUP_PINS,
8152+ .v.pins = (const struct hda_pintbl[]) {
8153+ { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8154+ { }
8155+ },
8156+ .chained = true,
8157+ .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8158+ },
81498159 };
81508160
81518161 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -8182,6 +8192,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 30 unmodified lines
81828192 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
81838193 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
81848194 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8195+ SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
81858196 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
81868197 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
81878198 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
@@ -8303,12 +8314,15 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 115 unmodified lines
83038314 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
83048315 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
83058316 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8317+ SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
83068318 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
83078319 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
83088320 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
83098321 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
83108322 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
83118323 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
8324+ SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8325+ SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
83128326 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
83138327 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
83148328 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
@@ -8327,10 +8341,12 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { · 12 unmodified lines
83278341 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
83288342 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
83298343 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
8344+ SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
83308345 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
83318346 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
83328347 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
83338348 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
8349+ SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
83348350 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
83358351 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
83368352 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
@@ -8736,6 +8752,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { · 399 unmodified lines
87368752 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
87378753 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
87388754 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
8755+ {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
87398756 {}
87408757 };
87418758 #define ALC225_STANDARD_PINS \
sound/soc/codecs/rt5659.c+21−5
@@ -2433,13 +2433,18 @@ static int set_dmic_power(struct snd_soc_dapm_widget *w, · 2432 unmodified lines
24332433 return 0;
24342434 }
24352435
2436−static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = {
2436+static const struct snd_soc_dapm_widget rt5659_particular_dapm_widgets[] = {
24372437 SND_SOC_DAPM_SUPPLY("LDO2", RT5659_PWR_ANLG_3, RT5659_PWR_LDO2_BIT, 0,
24382438 NULL, 0),
2439− SND_SOC_DAPM_SUPPLY("PLL", RT5659_PWR_ANLG_3, RT5659_PWR_PLL_BIT, 0,
2440− NULL, 0),
2439+ SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5659_PWR_ANLG_2, RT5659_PWR_MB1_BIT,
2440+ 0, NULL, 0),
24412441 SND_SOC_DAPM_SUPPLY("Mic Det Power", RT5659_PWR_VOL,
24422442 RT5659_PWR_MIC_DET_BIT, 0, NULL, 0),
2443+};
2444+
2445+static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = {
2446+ SND_SOC_DAPM_SUPPLY("PLL", RT5659_PWR_ANLG_3, RT5659_PWR_PLL_BIT, 0,
2447+ NULL, 0),
24432448 SND_SOC_DAPM_SUPPLY("Mono Vref", RT5659_PWR_ANLG_1,
24442449 RT5659_PWR_VREF3_BIT, 0, NULL, 0),
24452450
@@ -2464,8 +2469,6 @@ static const struct snd_soc_dapm_widget rt5659_dapm_widgets[] = { · 18 unmodified lines
24642469 RT5659_ADC_MONO_R_ASRC_SFT, 0, NULL, 0),
24652470
24662471 /* Input Side */
2467− SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5659_PWR_ANLG_2, RT5659_PWR_MB1_BIT,
2468− 0, NULL, 0),
24692472 SND_SOC_DAPM_SUPPLY("MICBIAS2", RT5659_PWR_ANLG_2, RT5659_PWR_MB2_BIT,
24702473 0, NULL, 0),
24712474 SND_SOC_DAPM_SUPPLY("MICBIAS3", RT5659_PWR_ANLG_2, RT5659_PWR_MB3_BIT,
@@ -3660,10 +3663,23 @@ static int rt5659_set_bias_level(struct snd_soc_component *component, · 1188 unmodified lines
36603663
36613664 static int rt5659_probe(struct snd_soc_component *component)
36623665 {
3666+ struct snd_soc_dapm_context *dapm =
3667+ snd_soc_component_get_dapm(component);
36633668 struct rt5659_priv *rt5659 = snd_soc_component_get_drvdata(component);
36643669
36653670 rt5659->component = component;
36663671
3672+ switch (rt5659->pdata.jd_src) {
3673+ case RT5659_JD_HDA_HEADER:
3674+ break;
3675+
3676+ default:
3677+ snd_soc_dapm_new_controls(dapm,
3678+ rt5659_particular_dapm_widgets,
3679+ ARRAY_SIZE(rt5659_particular_dapm_widgets));
3680+ break;
3681+ }
3682+
36673683 return 0;
36683684 }
36693685
sound/soc/codecs/rt5682-sdw.c+2−1
@@ -462,7 +462,8 @@ static int rt5682_io_init(struct device *dev, struct sdw_slave *slave) · 461 unmodified lines
462462
463463 regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_2,
464464 RT5682_EXT_JD_SRC, RT5682_EXT_JD_SRC_MANUAL);
465− regmap_write(rt5682->regmap, RT5682_CBJ_CTRL_1, 0xd042);
465+ regmap_write(rt5682->regmap, RT5682_CBJ_CTRL_1, 0xd142);
466+ regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_5, 0x0700, 0x0600);
466467 regmap_update_bits(rt5682->regmap, RT5682_CBJ_CTRL_3,
467468 RT5682_CBJ_IN_BUF_EN, RT5682_CBJ_IN_BUF_EN);
468469 regmap_update_bits(rt5682->regmap, RT5682_SAR_IL_CMD_1,
sound/soc/codecs/tas2562.h+7−7
@@ -57,13 +57,13 @@ · 56 unmodified lines
5757 #define TAS2562_TDM_CFG0_RAMPRATE_MASK BIT(5)
5858 #define TAS2562_TDM_CFG0_RAMPRATE_44_1 BIT(5)
5959 #define TAS2562_TDM_CFG0_SAMPRATE_MASK GENMASK(3, 1)
60−#define TAS2562_TDM_CFG0_SAMPRATE_7305_8KHZ 0x0
61−#define TAS2562_TDM_CFG0_SAMPRATE_14_7_16KHZ 0x1
62−#define TAS2562_TDM_CFG0_SAMPRATE_22_05_24KHZ 0x2
63−#define TAS2562_TDM_CFG0_SAMPRATE_29_4_32KHZ 0x3
64−#define TAS2562_TDM_CFG0_SAMPRATE_44_1_48KHZ 0x4
65−#define TAS2562_TDM_CFG0_SAMPRATE_88_2_96KHZ 0x5
66−#define TAS2562_TDM_CFG0_SAMPRATE_176_4_192KHZ 0x6
60+#define TAS2562_TDM_CFG0_SAMPRATE_7305_8KHZ (0x0 << 1)
61+#define TAS2562_TDM_CFG0_SAMPRATE_14_7_16KHZ (0x1 << 1)
62+#define TAS2562_TDM_CFG0_SAMPRATE_22_05_24KHZ (0x2 << 1)
63+#define TAS2562_TDM_CFG0_SAMPRATE_29_4_32KHZ (0x3 << 1)
64+#define TAS2562_TDM_CFG0_SAMPRATE_44_1_48KHZ (0x4 << 1)
65+#define TAS2562_TDM_CFG0_SAMPRATE_88_2_96KHZ (0x5 << 1)
66+#define TAS2562_TDM_CFG0_SAMPRATE_176_4_192KHZ (0x6 << 1)
6767
6868 #define TAS2562_TDM_CFG2_RIGHT_JUSTIFY BIT(6)
6969
sound/soc/fsl/fsl-asoc-card.c+1−0
@@ -744,6 +744,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) · 743 unmodified lines
744744 /* Initialize sound card */
745745 priv->pdev = pdev;
746746 priv->card.dev = &pdev->dev;
747+ priv->card.owner = THIS_MODULE;
747748 ret = snd_soc_of_parse_card_name(&priv->card, "model");
748749 if (ret) {
749750 snprintf(priv->name, sizeof(priv->name), "%s-audio",
sound/soc/qcom/lpass-cpu.c+79−0
@@ -93,8 +93,30 @@ static void lpass_cpu_daiops_shutdown(struct snd_pcm_substream *substream, · 92 unmodified lines
9393 struct snd_soc_dai *dai)
9494 {
9595 struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
96+ struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
97+ unsigned int id = dai->driver->id;
9698
9799 clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
100+ /*
101+ * Ensure LRCLK is disabled even in device node validation.
102+ * Will not impact if disabled in lpass_cpu_daiops_trigger()
103+ * suspend.
104+ */
105+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
106+ regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_DISABLE);
107+ else
108+ regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_DISABLE);
109+
110+ /*
111+ * BCLK may not be enabled if lpass_cpu_daiops_prepare is called before
112+ * lpass_cpu_daiops_shutdown. It's paired with the clk_enable in
113+ * lpass_cpu_daiops_prepare.
114+ */
115+ if (drvdata->mi2s_was_prepared[dai->driver->id]) {
116+ drvdata->mi2s_was_prepared[dai->driver->id] = false;
117+ clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
118+ }
119+
98120 clk_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
99121 }
100122
@@ -275,6 +297,18 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 174 unmodified lines
275297 case SNDRV_PCM_TRIGGER_START:
276298 case SNDRV_PCM_TRIGGER_RESUME:
277299 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
300+ /*
301+ * Ensure lpass BCLK/LRCLK is enabled during
302+ * device resume as lpass_cpu_daiops_prepare() is not called
303+ * after the device resumes. We don't check mi2s_was_prepared before
304+ * enable/disable BCLK in trigger events because:
305+ * 1. These trigger events are paired, so the BCLK
306+ * enable_count is balanced.
307+ * 2. the BCLK can be shared (ex: headset and headset mic),
308+ * we need to increase the enable_count so that we don't
309+ * turn off the shared BCLK while other devices are using
310+ * it.
311+ */
278312 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
279313 ret = regmap_fields_write(i2sctl->spken, id,
280314 LPAIF_I2SCTL_SPKEN_ENABLE);
@@ -296,6 +330,10 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 15 unmodified lines
296330 case SNDRV_PCM_TRIGGER_STOP:
297331 case SNDRV_PCM_TRIGGER_SUSPEND:
298332 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
333+ /*
334+ * To ensure lpass BCLK/LRCLK is disabled during
335+ * device suspend.
336+ */
299337 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
300338 ret = regmap_fields_write(i2sctl->spken, id,
301339 LPAIF_I2SCTL_SPKEN_DISABLE);
@@ -315,12 +353,53 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream, · 13 unmodified lines
315353 return ret;
316354 }
317355
356+static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
357+ struct snd_soc_dai *dai)
358+{
359+ struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
360+ struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
361+ unsigned int id = dai->driver->id;
362+ int ret;
363+
364+ /*
365+ * Ensure lpass BCLK/LRCLK is enabled bit before playback/capture
366+ * data flow starts. This allows other codec to have some delay before
367+ * the data flow.
368+ * (ex: to drop start up pop noise before capture starts).
369+ */
370+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
371+ ret = regmap_fields_write(i2sctl->spken, id, LPAIF_I2SCTL_SPKEN_ENABLE);
372+ else
373+ ret = regmap_fields_write(i2sctl->micen, id, LPAIF_I2SCTL_MICEN_ENABLE);
374+
375+ if (ret) {
376+ dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret);
377+ return ret;
378+ }
379+
380+ /*
381+ * Check mi2s_was_prepared before enabling BCLK as lpass_cpu_daiops_prepare can
382+ * be called multiple times. It's paired with the clk_disable in
383+ * lpass_cpu_daiops_shutdown.
384+ */
385+ if (!drvdata->mi2s_was_prepared[dai->driver->id]) {
386+ ret = clk_enable(drvdata->mi2s_bit_clk[id]);
387+ if (ret) {
388+ dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
389+ return ret;
390+ }
391+ drvdata->mi2s_was_prepared[dai->driver->id] = true;
392+ }
393+ return 0;
394+}
395+
318396 const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = {
319397 .set_sysclk = lpass_cpu_daiops_set_sysclk,
320398 .startup = lpass_cpu_daiops_startup,
321399 .shutdown = lpass_cpu_daiops_shutdown,
322400 .hw_params = lpass_cpu_daiops_hw_params,
323401 .trigger = lpass_cpu_daiops_trigger,
402+ .prepare = lpass_cpu_daiops_prepare,
324403 };
325404 EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops);
326405
sound/soc/qcom/lpass.h+4−0
@@ -67,6 +67,10 @@ struct lpass_data { · 66 unmodified lines
6767 /* MI2S SD lines to use for playback/capture */
6868 unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS];
6969 unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS];
70+
71+ /* The state of MI2S prepare dai_ops was called */
72+ bool mi2s_was_prepared[LPASS_MAX_MI2S_PORTS];
73+
7074 int hdmi_port_enable;
7175
7276 /* low-power audio interface (LPAIF) registers */
sound/soc/soc-core.c+2−0
@@ -2225,6 +2225,8 @@ static char *fmt_single_name(struct device *dev, int *id) · 2224 unmodified lines
22252225 return NULL;
22262226
22272227 name = devm_kstrdup(dev, devname, GFP_KERNEL);
2228+ if (!name)
2229+ return NULL;
22282230
22292231 /* are we a "%s.%d" name (platform and SPI components) */
22302232 found = strstr(name, dev->driver->name);
sound/soc/soc-topology.c+3−3
@@ -1901,7 +1901,7 @@ static void stream_caps_new_ver(struct snd_soc_tplg_stream_caps *dest, · 1900 unmodified lines
19011901 * @src: older version of pcm as a source
19021902 * @pcm: latest version of pcm created from the source
19031903 *
1904− * Support from vesion 4. User should free the returned pcm manually.
1904+ * Support from version 4. User should free the returned pcm manually.
19051905 */
19061906 static int pcm_new_ver(struct soc_tplg *tplg,
19071907 struct snd_soc_tplg_pcm *src,
@@ -2089,7 +2089,7 @@ static void set_link_hw_format(struct snd_soc_dai_link *link, · 181 unmodified lines
20892089 * @src: old version of phyical link config as a source
20902090 * @link: latest version of physical link config created from the source
20912091 *
2092− * Support from vesion 4. User need free the returned link config manually.
2092+ * Support from version 4. User need free the returned link config manually.
20932093 */
20942094 static int link_new_ver(struct soc_tplg *tplg,
20952095 struct snd_soc_tplg_link_config *src,
@@ -2400,7 +2400,7 @@ static int soc_tplg_dai_elems_load(struct soc_tplg *tplg, · 304 unmodified lines
24002400 * @src: old version of manifest as a source
24012401 * @manifest: latest version of manifest created from the source
24022402 *
2403− * Support from vesion 4. Users need free the returned manifest manually.
2403+ * Support from version 4. Users need free the returned manifest manually.
24042404 */
24052405 static int manifest_new_ver(struct soc_tplg *tplg,
24062406 struct snd_soc_tplg_manifest *src,
sound/soc/sof/pm.c+1−0
@@ -256,6 +256,7 @@ suspend: · 255 unmodified lines
256256
257257 /* reset FW state */
258258 sdev->fw_state = SOF_FW_BOOT_NOT_STARTED;
259+ sdev->enabled_cores_mask = 0;
259260
260261 return ret;
261262 }
tools/arch/mips/include/uapi/asm/perf_regs.h+40−0
@@ -0,0 +1,40 @@
1+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+#ifndef _ASM_MIPS_PERF_REGS_H
3+#define _ASM_MIPS_PERF_REGS_H
4+
5+enum perf_event_mips_regs {
6+ PERF_REG_MIPS_PC,
7+ PERF_REG_MIPS_R1,
8+ PERF_REG_MIPS_R2,
9+ PERF_REG_MIPS_R3,
10+ PERF_REG_MIPS_R4,
11+ PERF_REG_MIPS_R5,
12+ PERF_REG_MIPS_R6,
13+ PERF_REG_MIPS_R7,
14+ PERF_REG_MIPS_R8,
15+ PERF_REG_MIPS_R9,
16+ PERF_REG_MIPS_R10,
17+ PERF_REG_MIPS_R11,
18+ PERF_REG_MIPS_R12,
19+ PERF_REG_MIPS_R13,
20+ PERF_REG_MIPS_R14,
21+ PERF_REG_MIPS_R15,
22+ PERF_REG_MIPS_R16,
23+ PERF_REG_MIPS_R17,
24+ PERF_REG_MIPS_R18,
25+ PERF_REG_MIPS_R19,
26+ PERF_REG_MIPS_R20,
27+ PERF_REG_MIPS_R21,
28+ PERF_REG_MIPS_R22,
29+ PERF_REG_MIPS_R23,
30+ PERF_REG_MIPS_R24,
31+ PERF_REG_MIPS_R25,
32+ PERF_REG_MIPS_R26,
33+ PERF_REG_MIPS_R27,
34+ PERF_REG_MIPS_R28,
35+ PERF_REG_MIPS_R29,
36+ PERF_REG_MIPS_R30,
37+ PERF_REG_MIPS_R31,
38+ PERF_REG_MIPS_MAX = PERF_REG_MIPS_R31 + 1,
39+};
40+#endif /* _ASM_MIPS_PERF_REGS_H */
tools/arch/x86/include/asm/disabled-features.h+2−5
@@ -56,11 +56,8 @@ · 55 unmodified lines
5656 # define DISABLE_PTI (1 << (X86_FEATURE_PTI & 31))
5757 #endif
5858
59−#ifdef CONFIG_IOMMU_SUPPORT
60−# define DISABLE_ENQCMD 0
61−#else
62−# define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
63−#endif
59+/* Force disable because it's broken beyond repair */
60+#define DISABLE_ENQCMD (1 << (X86_FEATURE_ENQCMD & 31))
6461
6562 #ifdef CONFIG_X86_SGX
6663 # define DISABLE_SGX 0
tools/bootconfig/include/linux/bootconfig.h+4−0
@@ -4,4 +4,8 @@ · 3 unmodified lines
44
55 #include "../../../../include/linux/bootconfig.h"
66
7+#ifndef fallthrough
8+# define fallthrough
9+#endif
10+
711 #endif
tools/bootconfig/main.c+1−0
@@ -399,6 +399,7 @@ static int apply_xbc(const char *path, const char *xbc_path) · 398 unmodified lines
399399 }
400400 /* TODO: Ensure the @path is initramfs/initrd image */
401401 if (fstat(fd, &stat) < 0) {
402+ ret = -errno;
402403 pr_err("Failed to get the size of %s\n", path);
403404 goto out;
404405 }
tools/objtool/arch/x86/decode.c+4−0
@@ -747,6 +747,10 @@ int arch_rewrite_retpolines(struct objtool_file *file) · 746 unmodified lines
747747
748748 list_for_each_entry(insn, &file->retpoline_call_list, call_node) {
749749
750+ if (insn->type != INSN_JUMP_DYNAMIC &&
751+ insn->type != INSN_CALL_DYNAMIC)
752+ continue;
753+
750754 if (!strcmp(insn->sec->name, ".text.__x86.indirect_thunk"))
751755 continue;
752756
tools/objtool/elf.c+24−1
@@ -717,7 +717,7 @@ static int elf_add_string(struct elf *elf, struct section *strtab, char *str) · 716 unmodified lines
717717
718718 struct symbol *elf_create_undef_symbol(struct elf *elf, const char *name)
719719 {
720− struct section *symtab;
720+ struct section *symtab, *symtab_shndx;
721721 struct symbol *sym;
722722 Elf_Data *data;
723723 Elf_Scn *s;
@@ -769,6 +769,29 @@ struct symbol *elf_create_undef_symbol(struct elf *elf, const char *name) · 45 unmodified lines
769769 symtab->len += data->d_size;
770770 symtab->changed = true;
771771
772+ symtab_shndx = find_section_by_name(elf, ".symtab_shndx");
773+ if (symtab_shndx) {
774+ s = elf_getscn(elf->elf, symtab_shndx->idx);
775+ if (!s) {
776+ WARN_ELF("elf_getscn");
777+ return NULL;
778+ }
779+
780+ data = elf_newdata(s);
781+ if (!data) {
782+ WARN_ELF("elf_newdata");
783+ return NULL;
784+ }
785+
786+ data->d_buf = &sym->sym.st_size; /* conveniently 0 */
787+ data->d_size = sizeof(Elf32_Word);
788+ data->d_align = 4;
789+ data->d_type = ELF_T_WORD;
790+
791+ symtab_shndx->len += 4;
792+ symtab_shndx->changed = true;
793+ }
794+
772795 sym->sec = find_section_by_index(elf, 0);
773796
774797 elf_add_symbol(elf, sym);
tools/perf/Makefile.config+0−1
@@ -90,7 +90,6 @@ endif · 89 unmodified lines
9090 ifeq ($(ARCH),mips)
9191 NO_PERF_REGS := 0
9292 CFLAGS += -I$(OUTPUT)arch/mips/include/generated
93− CFLAGS += -I../../arch/mips/include/uapi -I../../arch/mips/include/generated/uapi
9493 LIBUNWIND_LIBS = -lunwind -lunwind-mips
9594 endif
9695
tools/perf/builtin-record.c+6−0
@@ -2714,6 +2714,12 @@ int cmd_record(int argc, const char **argv) · 2713 unmodified lines
27142714 rec->no_buildid = true;
27152715 }
27162716
2717+ if (rec->opts.record_cgroup && !perf_can_record_cgroup()) {
2718+ pr_err("Kernel has no cgroup sampling support.\n");
2719+ err = -EINVAL;
2720+ goto out_opts;
2721+ }
2722+
27172723 if (rec->opts.kcore)
27182724 rec->data.is_dir = true;
27192725
tools/perf/check-headers.sh+1−0
@@ -39,6 +39,7 @@ arch/x86/lib/x86-opcode-map.txt · 38 unmodified lines
3939 arch/x86/tools/gen-insn-attr-x86.awk
4040 arch/arm/include/uapi/asm/perf_regs.h
4141 arch/arm64/include/uapi/asm/perf_regs.h
42+arch/mips/include/uapi/asm/perf_regs.h
4243 arch/powerpc/include/uapi/asm/perf_regs.h
4344 arch/s390/include/uapi/asm/perf_regs.h
4445 arch/x86/include/uapi/asm/perf_regs.h
tools/perf/tests/attr/base-record+1−1
@@ -16,7 +16,7 @@ pinned=0 · 15 unmodified lines
1616 exclusive=0
1717 exclude_user=0
1818 exclude_kernel=0|1
19−exclude_hv=0
19+exclude_hv=0|1
2020 exclude_idle=0
2121 mmap=1
2222 comm=1
tools/perf/util/bpf_counter.c+4−2
@@ -521,9 +521,10 @@ static int bperf__load(struct evsel *evsel, struct target *target) · 520 unmodified lines
521521
522522 evsel->bperf_leader_link_fd = bpf_link_get_fd_by_id(entry.link_id);
523523 if (evsel->bperf_leader_link_fd < 0 &&
524− bperf_reload_leader_program(evsel, attr_map_fd, &entry))
524+ bperf_reload_leader_program(evsel, attr_map_fd, &entry)) {
525+ err = -1;
525526 goto out;
526−
527+ }
527528 /*
528529 * The bpf_link holds reference to the leader program, and the
529530 * leader program holds reference to the maps. Therefore, if
@@ -550,6 +551,7 @@ static int bperf__load(struct evsel *evsel, struct target *target) · 20 unmodified lines
550551 /* Step 2: load the follower skeleton */
551552 evsel->follower_skel = bperf_follower_bpf__open();
552553 if (!evsel->follower_skel) {
554+ err = -1;
553555 pr_err("Failed to open follower skeleton\n");
554556 goto out;
555557 }
tools/perf/util/dwarf-aux.c+6−2
@@ -975,9 +975,13 @@ static int __die_find_variable_cb(Dwarf_Die *die_mem, void *data) · 974 unmodified lines
975975 if ((tag == DW_TAG_formal_parameter ||
976976 tag == DW_TAG_variable) &&
977977 die_compare_name(die_mem, fvp->name) &&
978− /* Does the DIE have location information or external instance? */
978+ /*
979+ * Does the DIE have location information or const value
980+ * or external instance?
981+ */
979982 (dwarf_attr(die_mem, DW_AT_external, &attr) ||
980− dwarf_attr(die_mem, DW_AT_location, &attr)))
983+ dwarf_attr(die_mem, DW_AT_location, &attr) ||
984+ dwarf_attr(die_mem, DW_AT_const_value, &attr)))
981985 return DIE_FIND_CB_END;
982986 if (dwarf_haspc(die_mem, fvp->addr))
983987 return DIE_FIND_CB_CONTINUE;
tools/perf/util/env.c+1−0
@@ -144,6 +144,7 @@ static void perf_env__purge_bpf(struct perf_env *env) · 143 unmodified lines
144144 node = rb_entry(next, struct bpf_prog_info_node, rb_node);
145145 next = rb_next(&node->rb_node);
146146 rb_erase(&node->rb_node, root);
147+ free(node->info_linear);
147148 free(node);
148149 }
149150
tools/perf/util/evsel.c+1−0
@@ -428,6 +428,7 @@ struct evsel *evsel__clone(struct evsel *orig) · 427 unmodified lines
428428 evsel->auto_merge_stats = orig->auto_merge_stats;
429429 evsel->collect_stat = orig->collect_stat;
430430 evsel->weak_group = orig->weak_group;
431+ evsel->use_config_name = orig->use_config_name;
431432
432433 if (evsel__copy_config_terms(evsel, orig) < 0)
433434 goto out_err;
tools/perf/util/evsel.h+2−2
@@ -83,8 +83,10 @@ struct evsel { · 82 unmodified lines
8383 bool collect_stat;
8484 bool weak_group;
8585 bool bpf_counter;
86+ bool use_config_name;
8687 int bpf_fd;
8788 struct bpf_object *bpf_obj;
89+ struct list_head config_terms;
8890 };
8991
9092 /*
@@ -116,10 +118,8 @@ struct evsel { · 25 unmodified lines
116118 bool merged_stat;
117119 bool reset_group;
118120 bool errored;
119− bool use_config_name;
120121 struct hashmap *per_pkg_mask;
121122 struct evsel *leader;
122− struct list_head config_terms;
123123 int err;
124124 int cpu_iter;
125125 struct {
tools/perf/util/perf_api_probe.c+10−0
@@ -103,6 +103,11 @@ static void perf_probe_build_id(struct evsel *evsel) · 102 unmodified lines
103103 evsel->core.attr.build_id = 1;
104104 }
105105
106+static void perf_probe_cgroup(struct evsel *evsel)
107+{
108+ evsel->core.attr.cgroup = 1;
109+}
110+
106111 bool perf_can_sample_identifier(void)
107112 {
108113 return perf_probe_api(perf_probe_sample_identifier);
@@ -182,3 +187,8 @@ bool perf_can_record_build_id(void) · 73 unmodified lines
182187 {
183188 return perf_probe_api(perf_probe_build_id);
184189 }
190+
191+bool perf_can_record_cgroup(void)
192+{
193+ return perf_probe_api(perf_probe_cgroup);
194+}
tools/perf/util/perf_api_probe.h+1−0
@@ -12,5 +12,6 @@ bool perf_can_record_switch_events(void); · 11 unmodified lines
1212 bool perf_can_record_text_poke_events(void);
1313 bool perf_can_sample_identifier(void);
1414 bool perf_can_record_build_id(void);
15+bool perf_can_record_cgroup(void);
1516
1617 #endif // __PERF_API_PROBE_H
tools/perf/util/probe-finder.c+3−0
@@ -190,6 +190,9 @@ static int convert_variable_location(Dwarf_Die *vr_die, Dwarf_Addr addr, · 189 unmodified lines
190190 immediate_value_is_supported()) {
191191 Dwarf_Sword snum;
192192
193+ if (!tvar)
194+ return 0;
195+
193196 dwarf_formsdata(&attr, &snum);
194197 ret = asprintf(&tvar->value, "\\%ld", (long)snum);
195198
tools/perf/util/session.c+1−0
@@ -1723,6 +1723,7 @@ int perf_session__peek_event(struct perf_session *session, off_t file_offset, · 1722 unmodified lines
17231723 if (event->header.size < hdr_sz || event->header.size > buf_sz)
17241724 return -1;
17251725
1726+ buf += hdr_sz;
17261727 rest = event->header.size - hdr_sz;
17271728
17281729 if (readn(fd, buf, rest) != (ssize_t)rest)
tools/perf/util/stat-display.c+3−5
@@ -541,7 +541,7 @@ static void uniquify_event_name(struct evsel *counter) · 540 unmodified lines
541541 char *config;
542542 int ret = 0;
543543
544− if (counter->uniquified_name ||
544+ if (counter->uniquified_name || counter->use_config_name ||
545545 !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
546546 strlen(counter->pmu_name)))
547547 return;
@@ -555,10 +555,8 @@ static void uniquify_event_name(struct evsel *counter) · 7 unmodified lines
555555 }
556556 } else {
557557 if (perf_pmu__has_hybrid()) {
558− if (!counter->use_config_name) {
559− ret = asprintf(&new_name, "%s/%s/",
560− counter->pmu_name, counter->name);
561− }
558+ ret = asprintf(&new_name, "%s/%s/",
559+ counter->pmu_name, counter->name);
562560 } else {
563561 ret = asprintf(&new_name, "%s [%s]",
564562 counter->name, counter->pmu_name);
tools/perf/util/symbol-elf.c+1−0
@@ -2412,6 +2412,7 @@ int cleanup_sdt_note_list(struct list_head *sdt_notes) · 2411 unmodified lines
24122412
24132413 list_for_each_entry_safe(pos, tmp, sdt_notes, note_list) {
24142414 list_del_init(&pos->note_list);
2415+ zfree(&pos->args);
24152416 zfree(&pos->name);
24162417 zfree(&pos->provider);
24172418 free(pos);
tools/testing/selftests/kvm/include/kvm_util.h+6−4
@@ -43,6 +43,7 @@ enum vm_guest_mode { · 42 unmodified lines
4343 VM_MODE_P40V48_4K,
4444 VM_MODE_P40V48_64K,
4545 VM_MODE_PXXV48_4K, /* For 48bits VA but ANY bits PA */
46+ VM_MODE_P47V64_4K,
4647 NUM_VM_MODES,
4748 };
4849
@@ -60,7 +61,7 @@ enum vm_guest_mode { · 11 unmodified lines
6061
6162 #elif defined(__s390x__)
6263
63−#define VM_MODE_DEFAULT VM_MODE_P52V48_4K
64+#define VM_MODE_DEFAULT VM_MODE_P47V64_4K
6465 #define MIN_PAGE_SHIFT 12U
6566 #define ptes_per_page(page_size) ((page_size) / 16)
6667
@@ -285,10 +286,11 @@ struct kvm_vm *vm_create_default_with_vcpus(uint32_t nr_vcpus, uint64_t extra_me · 218 unmodified lines
285286 uint32_t num_percpu_pages, void *guest_code,
286287 uint32_t vcpuids[]);
287288
288−/* Like vm_create_default_with_vcpus, but accepts mode as a parameter */
289+/* Like vm_create_default_with_vcpus, but accepts mode and slot0 memory as a parameter */
289290 struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
290− uint64_t extra_mem_pages, uint32_t num_percpu_pages,
291− void *guest_code, uint32_t vcpuids[]);
291+ uint64_t slot0_mem_pages, uint64_t extra_mem_pages,
292+ uint32_t num_percpu_pages, void *guest_code,
293+ uint32_t vcpuids[]);
292294
293295 /*
294296 * Adds a vCPU with reasonable defaults (e.g. a stack)
tools/testing/selftests/kvm/kvm_page_table_test.c+1−1
@@ -268,7 +268,7 @@ static struct kvm_vm *pre_init_before_test(enum vm_guest_mode mode, void *arg) · 267 unmodified lines
268268
269269 /* Create a VM with enough guest pages */
270270 guest_num_pages = test_mem_size / guest_page_size;
271− vm = vm_create_with_vcpus(mode, nr_vcpus,
271+ vm = vm_create_with_vcpus(mode, nr_vcpus, DEFAULT_GUEST_PHY_PAGES,
272272 guest_num_pages, 0, guest_code, NULL);
273273
274274 /* Align down GPA of the testing memslot */
tools/testing/selftests/kvm/lib/kvm_util.c+43−9
@@ -175,6 +175,7 @@ const char *vm_guest_mode_string(uint32_t i) · 174 unmodified lines
175175 [VM_MODE_P40V48_4K] = "PA-bits:40, VA-bits:48, 4K pages",
176176 [VM_MODE_P40V48_64K] = "PA-bits:40, VA-bits:48, 64K pages",
177177 [VM_MODE_PXXV48_4K] = "PA-bits:ANY, VA-bits:48, 4K pages",
178+ [VM_MODE_P47V64_4K] = "PA-bits:47, VA-bits:64, 4K pages",
178179 };
179180 _Static_assert(sizeof(strings)/sizeof(char *) == NUM_VM_MODES,
180181 "Missing new mode strings?");
@@ -192,6 +193,7 @@ const struct vm_guest_mode_params vm_guest_mode_params[] = { · 11 unmodified lines
192193 { 40, 48, 0x1000, 12 },
193194 { 40, 48, 0x10000, 16 },
194195 { 0, 0, 0x1000, 12 },
196+ { 47, 64, 0x1000, 12 },
195197 };
196198 _Static_assert(sizeof(vm_guest_mode_params)/sizeof(struct vm_guest_mode_params) == NUM_VM_MODES,
197199 "Missing new mode params?");
@@ -277,6 +279,9 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) · 79 unmodified lines
277279 TEST_FAIL("VM_MODE_PXXV48_4K not supported on non-x86 platforms");
278280 #endif
279281 break;
282+ case VM_MODE_P47V64_4K:
283+ vm->pgtable_levels = 5;
284+ break;
280285 default:
281286 TEST_FAIL("Unknown guest mode, mode: 0x%x", mode);
282287 }
@@ -308,21 +313,50 @@ struct kvm_vm *vm_create(enum vm_guest_mode mode, uint64_t phy_pages, int perm) · 25 unmodified lines
308313 return vm;
309314 }
310315
316+/*
317+ * VM Create with customized parameters
318+ *
319+ * Input Args:
320+ * mode - VM Mode (e.g. VM_MODE_P52V48_4K)
321+ * nr_vcpus - VCPU count
322+ * slot0_mem_pages - Slot0 physical memory size
323+ * extra_mem_pages - Non-slot0 physical memory total size
324+ * num_percpu_pages - Per-cpu physical memory pages
325+ * guest_code - Guest entry point
326+ * vcpuids - VCPU IDs
327+ *
328+ * Output Args: None
329+ *
330+ * Return:
331+ * Pointer to opaque structure that describes the created VM.
332+ *
333+ * Creates a VM with the mode specified by mode (e.g. VM_MODE_P52V48_4K),
334+ * with customized slot0 memory size, at least 512 pages currently.
335+ * extra_mem_pages is only used to calculate the maximum page table size,
336+ * no real memory allocation for non-slot0 memory in this function.
337+ */
311338 struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
312− uint64_t extra_mem_pages, uint32_t num_percpu_pages,
313− void *guest_code, uint32_t vcpuids[])
339+ uint64_t slot0_mem_pages, uint64_t extra_mem_pages,
340+ uint32_t num_percpu_pages, void *guest_code,
341+ uint32_t vcpuids[])
314342 {
343+ uint64_t vcpu_pages, extra_pg_pages, pages;
344+ struct kvm_vm *vm;
345+ int i;
346+
347+ /* Force slot0 memory size not small than DEFAULT_GUEST_PHY_PAGES */
348+ if (slot0_mem_pages < DEFAULT_GUEST_PHY_PAGES)
349+ slot0_mem_pages = DEFAULT_GUEST_PHY_PAGES;
350+
315351 /* The maximum page table size for a memory region will be when the
316352 * smallest pages are used. Considering each page contains x page
317353 * table descriptors, the total extra size for page tables (for extra
318354 * N pages) will be: N/x+N/x^2+N/x^3+... which is definitely smaller
319355 * than N/x*2.
320356 */
321− uint64_t vcpu_pages = (DEFAULT_STACK_PGS + num_percpu_pages) * nr_vcpus;
322− uint64_t extra_pg_pages = (extra_mem_pages + vcpu_pages) / PTES_PER_MIN_PAGE * 2;
323− uint64_t pages = DEFAULT_GUEST_PHY_PAGES + extra_mem_pages + vcpu_pages + extra_pg_pages;
324− struct kvm_vm *vm;
325− int i;
357+ vcpu_pages = (DEFAULT_STACK_PGS + num_percpu_pages) * nr_vcpus;
358+ extra_pg_pages = (slot0_mem_pages + extra_mem_pages + vcpu_pages) / PTES_PER_MIN_PAGE * 2;
359+ pages = slot0_mem_pages + vcpu_pages + extra_pg_pages;
326360
327361 TEST_ASSERT(nr_vcpus <= kvm_check_cap(KVM_CAP_MAX_VCPUS),
328362 "nr_vcpus = %d too large for host, max-vcpus = %d",
@@ -354,8 +388,8 @@ struct kvm_vm *vm_create_default_with_vcpus(uint32_t nr_vcpus, uint64_t extra_me · 25 unmodified lines
354388 uint32_t num_percpu_pages, void *guest_code,
355389 uint32_t vcpuids[])
356390 {
357− return vm_create_with_vcpus(VM_MODE_DEFAULT, nr_vcpus, extra_mem_pages,
358− num_percpu_pages, guest_code, vcpuids);
391+ return vm_create_with_vcpus(VM_MODE_DEFAULT, nr_vcpus, DEFAULT_GUEST_PHY_PAGES,
392+ extra_mem_pages, num_percpu_pages, guest_code, vcpuids);
359393 }
360394
361395 struct kvm_vm *vm_create_default(uint32_t vcpuid, uint64_t extra_mem_pages,
tools/testing/selftests/kvm/lib/perf_test_util.c+1−1
@@ -69,7 +69,7 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus, · 68 unmodified lines
6969 TEST_ASSERT(vcpu_memory_bytes % perf_test_args.guest_page_size == 0,
7070 "Guest memory size is not guest page size aligned.");
7171
72− vm = vm_create_with_vcpus(mode, vcpus,
72+ vm = vm_create_with_vcpus(mode, vcpus, DEFAULT_GUEST_PHY_PAGES,
7373 (vcpus * vcpu_memory_bytes) / perf_test_args.guest_page_size,
7474 0, guest_code, NULL);
7575
tools/testing/selftests/kvm/memslot_perf_test.c+1−1
@@ -267,7 +267,7 @@ static bool prepare_vm(struct vm_data *data, int nslots, uint64_t *maxslots, · 266 unmodified lines
267267 data->hva_slots = malloc(sizeof(*data->hva_slots) * data->nslots);
268268 TEST_ASSERT(data->hva_slots, "malloc() fail");
269269
270− data->vm = vm_create_default(VCPU_ID, 1024, guest_code);
270+ data->vm = vm_create_default(VCPU_ID, mempages, guest_code);
271271
272272 pr_info_v("Adding slots 1..%i, each slot with %"PRIu64" pages + %"PRIu64" extra pages last\n",
273273 max_mem_slots - 1, data->pages_per_slot, rempages);
tools/testing/selftests/net/mptcp/mptcp_connect.sh+9−4
@@ -501,6 +501,7 @@ do_transfer() · 500 unmodified lines
501501 local stat_ackrx_now_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableACKRX")
502502 local stat_cookietx_now=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesSent")
503503 local stat_cookierx_now=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv")
504+ local stat_ooo_now=$(get_mib_counter "${listener_ns}" "TcpExtTCPOFOQueue")
504505
505506 expect_synrx=$((stat_synrx_last_l))
506507 expect_ackrx=$((stat_ackrx_last_l))
@@ -518,10 +519,14 @@ do_transfer() · 11 unmodified lines
518519 "${stat_synrx_now_l}" "${expect_synrx}" 1>&2
519520 retc=1
520521 fi
521− if [ ${stat_ackrx_now_l} -lt ${expect_ackrx} ]; then
522− printf "[ FAIL ] lower MPC ACK rx (%d) than expected (%d)\n" \
523− "${stat_ackrx_now_l}" "${expect_ackrx}" 1>&2
524− rets=1
522+ if [ ${stat_ackrx_now_l} -lt ${expect_ackrx} -a ${stat_ooo_now} -eq 0 ]; then
523+ if [ ${stat_ooo_now} -eq 0 ]; then
524+ printf "[ FAIL ] lower MPC ACK rx (%d) than expected (%d)\n" \
525+ "${stat_ackrx_now_l}" "${expect_ackrx}" 1>&2
526+ rets=1
527+ else
528+ printf "[ Note ] fallback due to TCP OoO"
529+ fi
525530 fi
526531
527532 if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then
tools/testing/selftests/proc/.gitignore+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 /proc-self-map-files-002
1111 /proc-self-syscall
1212 /proc-self-wchan
13+/proc-subset-pid
1314 /proc-uptime-001
1415 /proc-uptime-002
1516 /read
tools/testing/selftests/wireguard/netns.sh+1−0
@@ -363,6 +363,7 @@ ip1 -6 rule add table main suppress_prefixlength 0 · 362 unmodified lines
363363 ip1 -4 route add default dev wg0 table 51820
364364 ip1 -4 rule add not fwmark 51820 table 51820
365365 ip1 -4 rule add table main suppress_prefixlength 0
366+n1 bash -c 'printf 0 > /proc/sys/net/ipv4/conf/vethc/rp_filter'
366367 # Flood the pings instead of sending just one, to trigger routing table reference counting bugs.
367368 n1 ping -W 1 -c 100 -f 192.168.99.7
368369 n1 ping -W 1 -c 100 -f abab::1111
tools/testing/selftests/wireguard/qemu/kernel.config+0−1
@@ -19,7 +19,6 @@ CONFIG_NETFILTER_XTABLES=y · 18 unmodified lines
1919 CONFIG_NETFILTER_XT_NAT=y
2020 CONFIG_NETFILTER_XT_MATCH_LENGTH=y
2121 CONFIG_NETFILTER_XT_MARK=y
22−CONFIG_NF_CONNTRACK_IPV4=y
2322 CONFIG_NF_NAT_IPV4=y
2423 CONFIG_IP_NF_IPTABLES=y
2524 CONFIG_IP_NF_FILTER=y