History

Backmerge tag 'v5.13-rc7' into drm-next

Backmerge Linux 5.13-rc7 to make some pulls from later bases apply, and to bake in the conflicts so far.

Dave Airlie committed 5 years ago

Commit f45fbbb2 parents d472b36 13311e71141 files · +13286 −5752Browse files

Unified · Split

1141 files
  1. .clang-format +11 −2
  2. .mailmap +3 −0
  3. Documentation/admin-guide/sysctl/kernel.rst +14 −3
  4. Documentation/devicetree/bindings/connector/usb-connector.yaml +15 −0
  5. Documentation/devicetree/bindings/hwmon/ti,ads7828.yaml +1 −1
  6. Documentation/devicetree/bindings/i2c/i2c-mpc.yaml +7 −0
  7. Documentation/devicetree/bindings/media/renesas,drif.yaml +1 −3
  8. Documentation/devicetree/bindings/net/renesas,ether.yaml +1 −1
  9. Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml +2 −2
  10. Documentation/devicetree/bindings/spi/spi-mux.yaml +1 −1
  11. Documentation/driver-api/usb/usb.rst +2 −0
  12. Documentation/riscv/vm-layout.rst +2 −2
  13. Documentation/userspace-api/seccomp_filter.rst +8 −8
  14. Documentation/virt/kvm/mmu.rst +2 −2
  15. Documentation/virt/kvm/vcpu-requests.rst +5 −3
  16. Documentation/vm/slub.rst +5 −5
  17. MAINTAINERS +40 −12
  18. Makefile +10 −2
  19. arch/arc/include/uapi/asm/sigcontext.h +1 −0
  20. arch/arc/kernel/signal.c +43 −0
  21. arch/arc/kernel/vmlinux.lds.S +1 −1
  22. arch/arm/boot/dts/imx6dl-yapp4-common.dtsi +5 −1
  23. arch/arm/boot/dts/imx6q-dhcom-som.dtsi +12 −0
  24. arch/arm/boot/dts/imx6qdl-emcon-avari.dtsi +1 −1
  25. arch/arm/boot/dts/imx7d-meerkat96.dts +1 −1
  26. arch/arm/boot/dts/imx7d-pico.dtsi +1 −1
  27. arch/arm/include/asm/cpuidle.h +3 −2
  28. arch/arm/mach-imx/pm-imx27.c +1 −0
  29. arch/arm/mach-omap1/board-ams-delta.c +0 −14
  30. arch/arm/mach-omap1/board-h2.c +3 −1
  31. arch/arm/mach-omap1/pm.c +7 −3
  32. arch/arm/mach-omap2/board-n8x0.c +1 −1
  33. arch/arm64/Kbuild +1 −2
  34. arch/arm64/Kconfig.platforms +1 −0
  35. arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var1.dts +2 −1
  36. arch/arm64/boot/dts/freescale/fsl-ls1028a-kontron-sl28-var4.dts +2 −3
  37. arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +2 −2
  38. arch/arm64/boot/dts/freescale/imx8mq-zii-ultra-rmb3.dts +5 −5
  39. arch/arm64/boot/dts/freescale/imx8mq-zii-ultra.dtsi +7 −16
  40. arch/arm64/boot/dts/ti/k3-am64-main.dtsi +6 −5
  41. arch/arm64/boot/dts/ti/k3-am64-mcu.dtsi +2 −1
  42. arch/arm64/boot/dts/ti/k3-am65-main.dtsi +6 −4
  43. arch/arm64/boot/dts/ti/k3-am65-mcu.dtsi +2 −2
  44. arch/arm64/boot/dts/ti/k3-am65-wakeup.dtsi +7 −6
  45. arch/arm64/boot/dts/ti/k3-am654-base-board.dts +0 −31
  46. arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +6 −2
  47. arch/arm64/boot/dts/ti/k3-j7200-mcu-wakeup.dtsi +4 −3
  48. arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +6 −4
  49. arch/arm64/boot/dts/ti/k3-j721e-mcu-wakeup.dtsi +6 −5
  50. arch/arm64/include/asm/barrier.h +1 −1
  51. arch/arm64/include/asm/kvm_asm.h +3 −0
  52. arch/arm64/include/asm/kvm_emulate.h +5 −0
  53. arch/arm64/kvm/arm.c +17 −3
  54. arch/arm64/kvm/hyp/exception.c +17 −1
  55. arch/arm64/kvm/hyp/include/hyp/adjust_pc.h +0 −18
  56. arch/arm64/kvm/hyp/nvhe/hyp-main.c +8 −0
  57. arch/arm64/kvm/hyp/nvhe/mem_protect.c +2 −2
  58. arch/arm64/kvm/hyp/nvhe/setup.c +1 −1
  59. arch/arm64/kvm/hyp/nvhe/switch.c +1 −2
  60. arch/arm64/kvm/hyp/vhe/switch.c +1 −2
  61. arch/arm64/kvm/mmu.c +6 −6
  62. arch/arm64/kvm/reset.c +24 −4
  63. arch/arm64/kvm/sys_regs.c +21 −21
  64. arch/arm64/mm/mmu.c +2 −1
  65. arch/mips/alchemy/board-xxs1500.c +1 −0
  66. arch/mips/include/asm/mips-boards/launch.h +5 −0
  67. arch/mips/lib/mips-atomic.c +6 −6
  68. arch/mips/mm/cache.c +14 −16
  69. arch/mips/ralink/of.c +2 −0
  70. arch/powerpc/boot/dts/fsl/p1010si-post.dtsi +8 −0
  71. arch/powerpc/boot/dts/fsl/p2041si-post.dtsi +16 −0
  72. arch/powerpc/include/asm/jump_label.h +1 −1
  73. arch/powerpc/include/asm/kvm_host.h +1 −0
  74. arch/powerpc/include/asm/pte-walk.h +29 −0
  75. arch/powerpc/kernel/eeh.c +1 −22
  76. arch/powerpc/kernel/io-workarounds.c +3 −13
  77. arch/powerpc/kernel/iommu.c +5 −6
  78. arch/powerpc/kernel/kprobes.c +2 −2
  79. arch/powerpc/kernel/signal_64.c +4 −5
  80. arch/powerpc/kvm/book3s_hv.c +1 −2
  81. arch/powerpc/kvm/book3s_hv_rm_mmu.c +2 −13
  82. arch/powerpc/kvm/book3s_hv_rmhandlers.S +7 −0
  83. arch/powerpc/mm/mem.c +1 −0
  84. arch/powerpc/perf/core-book3s.c +1 −1
  85. arch/riscv/Kconfig +10 −9
  86. arch/riscv/Kconfig.socs +1 −0
  87. arch/riscv/Makefile +10 −1
  88. arch/riscv/boot/dts/microchip/Makefile +1 −0
  89. arch/riscv/boot/dts/sifive/Makefile +1 −0
  90. arch/riscv/boot/dts/sifive/fu740-c000.dtsi +1 −1
  91. arch/riscv/errata/sifive/Makefile +1 −1
  92. arch/riscv/include/asm/alternative-macros.h +2 −2
  93. arch/riscv/include/asm/kexec.h +2 −2
  94. arch/riscv/include/asm/pgtable.h +2 −3
  95. arch/riscv/kernel/machine_kexec.c +6 −5
  96. arch/riscv/kernel/probes/kprobes.c +2 −0
  97. arch/riscv/kernel/setup.c +2 −2
  98. arch/riscv/kernel/stacktrace.c +7 −7
  99. arch/riscv/kernel/traps.c +9 −4
  100. arch/riscv/kernel/vmlinux-xip.lds.S +14 −1
  101. arch/riscv/mm/init.c +6 −2
  102. arch/riscv/mm/kasan_init.c +5 −5
  103. arch/s390/kernel/entry.S +2 −2
  104. arch/x86/Makefile +3 −2
  105. arch/x86/events/intel/uncore_snbep.c +6 −3
  106. arch/x86/include/asm/apic.h +1 −0
  107. arch/x86/include/asm/disabled-features.h +2 −5
  108. arch/x86/include/asm/fpu/api.h +1 −5
  109. arch/x86/include/asm/fpu/internal.h +10 −10
  110. arch/x86/include/asm/kvm-x86-ops.h +1 −0
  111. arch/x86/include/asm/kvm_host.h +1 −0
  112. arch/x86/include/asm/thermal.h +3 −1
  113. arch/x86/kernel/alternative.c +46 −18
  114. arch/x86/kernel/apic/apic.c +1 −0
  115. arch/x86/kernel/apic/vector.c +20 −0
  116. arch/x86/kernel/cpu/perfctr-watchdog.c +2 −2
  117. arch/x86/kernel/cpu/sgx/virt.c +1 −0
  118. arch/x86/kernel/fpu/signal.c +35 −19
  119. arch/x86/kernel/fpu/xstate.c +0 −57
  120. arch/x86/kernel/setup.c +30 −14
  121. arch/x86/kvm/cpuid.c +1 −0
  122. arch/x86/kvm/emulate.c +3 −2
  123. arch/x86/kvm/hyperv.c +8 −0
  124. arch/x86/kvm/kvm_emulate.h +1 −2
  125. arch/x86/kvm/lapic.c +26 −10
  126. arch/x86/kvm/mmu/mmu.c +25 −1
  127. arch/x86/kvm/mmu/paging_tmpl.h +9 −5
  128. arch/x86/kvm/mmu/tdp_mmu.c +3 −3
  129. arch/x86/kvm/svm/avic.c +5 −7
  130. arch/x86/kvm/svm/sev.c +17 −9
  131. arch/x86/kvm/svm/svm.c +1 −3
  132. arch/x86/kvm/svm/svm.h +1 −1
  133. arch/x86/kvm/trace.h +3 −3
  134. arch/x86/kvm/vmx/capabilities.h +1 −2
  135. arch/x86/kvm/vmx/posted_intr.c +14 −0
  136. arch/x86/kvm/vmx/posted_intr.h +1 −0
  137. arch/x86/kvm/vmx/vmx.c +4 −3
  138. arch/x86/kvm/x86.c +37 −15
  139. arch/x86/mm/fault.c +2 −2
  140. arch/x86/mm/ioremap.c +3 −1
  141. arch/x86/mm/mem_encrypt_identity.c +6 −5
  142. arch/x86/mm/numa.c +7 −1
  143. arch/x86/pci/fixup.c +44 −0
  144. arch/x86/platform/efi/quirks.c +12 −0
  145. arch/x86/realmode/init.c +8 −6
  146. crypto/async_tx/async_xor.c +2 −1
  147. drivers/acpi/acpi_apd.c +1 −0
  148. drivers/acpi/acpica/utdelete.c +8 −0
  149. drivers/acpi/bus.c +8 −19
  150. drivers/acpi/internal.h +2 −2
  151. drivers/acpi/power.c +46 −13
  152. drivers/acpi/scan.c +1 −1
  153. drivers/acpi/sleep.c +2 −4
  154. drivers/base/core.c +36 −32
  155. drivers/base/memory.c +3 −3
  156. drivers/block/loop.c +7 −18
  157. drivers/block/loop.h +1 −0
  158. drivers/bluetooth/btusb.c +23 −2
  159. drivers/bus/mhi/pci_generic.c +38 −4
  160. drivers/bus/ti-sysc.c +54 −6
  161. drivers/cpufreq/Kconfig.arm +0 −10
  162. drivers/cpufreq/cppc_cpufreq.c +12 −233
  163. drivers/dma/Kconfig +2 −0
  164. drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c +3 −0
  165. drivers/dma/idxd/cdev.c +1 −0
  166. drivers/dma/idxd/init.c +62 −5
  167. drivers/dma/ipu/ipu_irq.c +1 −1
  168. drivers/dma/mediatek/mtk-uart-apdma.c +14 −13
  169. drivers/dma/pl330.c +4 −2
  170. drivers/dma/qcom/Kconfig +1 −0
  171. drivers/dma/sf-pdma/Kconfig +1 −0
  172. drivers/dma/sh/rcar-dmac.c +1 −1
  173. drivers/dma/ste_dma40.c +3 −0
  174. drivers/dma/stm32-mdma.c +2 −2
  175. drivers/dma/xilinx/xilinx_dpdma.c +28 −3
  176. drivers/dma/xilinx/zynqmp_dma.c +1 −1
  177. drivers/firmware/efi/cper.c +1 −3
  178. drivers/firmware/efi/fdtparams.c +3 −0
  179. drivers/firmware/efi/libstub/file.c +1 −1
  180. drivers/firmware/efi/memattr.c +0 −5
  181. drivers/gpio/gpio-wcd934x.c +1 −1
  182. drivers/gpu/drm/drm_auth.c +2 −1
  183. drivers/gpu/drm/drm_ioctl.c +5 −4
  184. drivers/gpu/drm/mcde/mcde_dsi.c +1 −1
  185. drivers/gpu/drm/meson/meson_drv.c +5 −4
  186. drivers/gpu/drm/msm/adreno/a6xx_gpu.c +114 −41
  187. drivers/gpu/drm/msm/adreno/a6xx_gpu.h +1 −1
  188. drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +1 −0
  189. drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +1 −0
  190. drivers/gpu/drm/msm/msm_gem.c +7 −0
  191. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +27 −4
  192. drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +3 −2
  193. drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +36 −5
  194. drivers/gpu/drm/tegra/drm.h +1 −1
  195. drivers/gpu/drm/tegra/hub.c +1 −1
  196. drivers/gpu/drm/tegra/sor.c +42 −28
  197. drivers/gpu/drm/ttm/ttm_bo.c +4 −1
  198. drivers/gpu/drm/ttm/ttm_device.c +1 −7
  199. drivers/gpu/drm/vc4/vc4_kms.c +1 −1
  200. drivers/gpu/host1x/bus.c +24 −6
  201. drivers/hid/Kconfig +17 −2
  202. drivers/hid/Makefile +1 −0
  203. drivers/hid/amd-sfh-hid/amd_sfh_client.c +10 −9
  204. drivers/hid/amd-sfh-hid/amd_sfh_hid.c +0 −3
  205. drivers/hid/hid-a4tech.c +2 −0
  206. drivers/hid/hid-asus.c +20 −12
  207. drivers/hid/hid-core.c +3 −1
  208. drivers/hid/hid-debug.c +3 −0
  209. drivers/hid/hid-ft260.c +16 −13
  210. drivers/hid/hid-gt683r.c +1 −0
  211. drivers/hid/hid-ids.h +7 −2
  212. drivers/hid/hid-input.c +3 −0
  213. drivers/hid/hid-logitech-hidpp.c +1 −0
  214. drivers/hid/hid-magicmouse.c +5 −2
  215. drivers/hid/hid-multitouch.c +37 −9
  216. drivers/hid/hid-quirks.c +4 −0
  217. drivers/hid/hid-semitek.c +40 −0
  218. drivers/hid/hid-sensor-custom.c +5 −3
  219. drivers/hid/hid-sensor-hub.c +9 −4
  220. drivers/hid/hid-thrustmaster.c +1 −1
  221. drivers/hid/i2c-hid/i2c-hid-core.c +10 −3
  222. drivers/hid/intel-ish-hid/ipc/hw-ish.h +2 −0
  223. drivers/hid/intel-ish-hid/ipc/pci-ish.c +2 −0
  224. drivers/hid/surface-hid/surface_hid_core.c +3 −3
  225. drivers/hid/usbhid/hid-core.c +1 −1
  226. drivers/hid/usbhid/hid-pidff.c +1 −0
  227. drivers/hwmon/corsair-psu.c +14 −0
  228. drivers/hwmon/dell-smm-hwmon.c +2 −2
  229. drivers/hwmon/pmbus/fsp-3y.c +25 −7
  230. drivers/hwmon/pmbus/isl68137.c +2 −2
  231. drivers/hwmon/pmbus/q54sj108a2.c +1 −1
  232. drivers/hwmon/scpi-hwmon.c +9 −0
  233. drivers/hwmon/tps23861.c +15 −2
  234. drivers/i2c/busses/Kconfig +1 −1
  235. drivers/i2c/busses/i2c-ali1563.c +1 −1
  236. drivers/i2c/busses/i2c-altera.c +4 −5
  237. drivers/i2c/busses/i2c-cadence.c +1 −1
  238. drivers/i2c/busses/i2c-designware-master.c +1 −1
  239. drivers/i2c/busses/i2c-eg20t.c +2 −1
  240. drivers/i2c/busses/i2c-i801.c +2 −4
  241. drivers/i2c/busses/i2c-icy.c +0 −1
  242. drivers/i2c/busses/i2c-mpc.c +79 −2
  243. drivers/i2c/busses/i2c-mt65xx.c +5 −0
  244. drivers/i2c/busses/i2c-nomadik.c +1 −1
  245. drivers/i2c/busses/i2c-ocores.c +4 −4
  246. drivers/i2c/busses/i2c-pnx.c +4 −4
  247. drivers/i2c/busses/i2c-qcom-geni.c +21 −2
  248. drivers/i2c/busses/i2c-s3c2410.c +3 −0
  249. drivers/i2c/busses/i2c-sh_mobile.c +1 −1
  250. drivers/i2c/busses/i2c-st.c +2 −2
  251. drivers/i2c/busses/i2c-stm32f4.c +1 −1
  252. drivers/i2c/busses/i2c-tegra-bpmp.c +2 −2
  253. drivers/i2c/muxes/i2c-arb-gpio-challenge.c +2 −2
  254. drivers/iio/adc/ad7124.c +20 −16
  255. drivers/iio/adc/ad7192.c +10 −9
  256. drivers/iio/adc/ad7768-1.c +6 −2
  257. drivers/iio/adc/ad7793.c +1 −0
  258. drivers/iio/adc/ad7923.c +3 −1
  259. drivers/iio/dac/ad5770r.c +11 −5
  260. drivers/iio/gyro/fxas21002c_core.c +2 −0
  261. drivers/infiniband/core/uverbs_cmd.c +5 −0
  262. drivers/infiniband/hw/mlx4/main.c +1 −7
  263. drivers/infiniband/hw/mlx5/cq.c +4 −5
  264. drivers/infiniband/hw/mlx5/doorbell.c +6 −1
  265. drivers/infiniband/hw/mlx5/fs.c +8 −3
  266. drivers/infiniband/hw/mlx5/mr.c +4 −4
  267. drivers/infiniband/ulp/ipoib/ipoib_netlink.c +1 −0
  268. drivers/interconnect/qcom/bcm-voter.c +3 −1
  269. drivers/iommu/amd/iommu.c +3 −1
  270. drivers/iommu/intel/dmar.c +3 −1
  271. drivers/iommu/intel/iommu.c +7 −2
  272. drivers/iommu/intel/pasid.c +2 −1
  273. drivers/iommu/virtio-iommu.c +1 −0
  274. drivers/irqchip/irq-gic-v3.c +35 −1
  275. drivers/isdn/hardware/mISDN/netjet.c +0 −1
  276. drivers/md/bcache/bcache.h +0 −1
  277. drivers/md/bcache/request.c +7 −13
  278. drivers/md/bcache/stats.c +0 −14
  279. drivers/md/bcache/stats.h +0 −1
  280. drivers/md/bcache/sysfs.c +0 −4
  281. drivers/md/dm-snap.c +2 −1
  282. drivers/md/dm-verity-verify-sig.c +1 −1
  283. drivers/md/raid5.c +0 −2
  284. drivers/misc/cardreader/rtl8411.c +1 −0
  285. drivers/misc/cardreader/rts5209.c +1 −0
  286. drivers/misc/cardreader/rts5227.c +2 −0
  287. drivers/misc/cardreader/rts5228.c +1 −0
  288. drivers/misc/cardreader/rts5229.c +1 −0
  289. drivers/misc/cardreader/rts5249.c +3 −0
  290. drivers/misc/cardreader/rts5260.c +1 −0
  291. drivers/misc/cardreader/rts5261.c +1 −0
  292. drivers/misc/cardreader/rtsx_pcr.c +31 −13
  293. drivers/misc/kgdbts.c +2 −1
  294. drivers/misc/mei/interrupt.c +3 −0
  295. drivers/mmc/host/renesas_sdhi_core.c +7 −2
  296. drivers/mtd/nand/raw/cs553x_nand.c +11 −1
  297. drivers/mtd/nand/raw/fsmc_nand.c +11 −1
  298. drivers/mtd/nand/raw/lpc32xx_slc.c +14 −1
  299. drivers/mtd/nand/raw/ndfc.c +11 −1
  300. drivers/mtd/nand/raw/sharpsl.c +11 −1
  301. drivers/mtd/nand/raw/tmio_nand.c +5 −3
  302. drivers/mtd/nand/raw/txx9ndfmc.c +3 −2
  303. drivers/mtd/parsers/ofpart_core.c +14 −12
  304. drivers/net/appletalk/cops.c +2 −2
  305. drivers/net/bonding/bond_main.c +1 −1
  306. drivers/net/caif/caif_serial.c +1 −0
  307. drivers/net/can/usb/mcba_usb.c +15 −2
  308. drivers/net/dsa/bcm_sf2.c +2 −3
  309. drivers/net/dsa/microchip/ksz9477.c +1 −0
  310. drivers/net/dsa/mt7530.c +0 −8
  311. drivers/net/dsa/ocelot/felix_vsc9959.c +10 −5
  312. drivers/net/dsa/sja1105/sja1105_dynamic_config.c +19 −4
  313. drivers/net/dsa/sja1105/sja1105_main.c +51 −23
  314. drivers/net/ethernet/amazon/ena/ena_netdev.c +28 −26
  315. drivers/net/ethernet/atheros/alx/main.c +1 −0
  316. drivers/net/ethernet/broadcom/bnx2.c +1 −1
  317. drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c +3 −1
  318. drivers/net/ethernet/broadcom/bnxt/bnxt.c +117 −29
  319. drivers/net/ethernet/broadcom/bnxt/bnxt.h +10 −0
  320. drivers/net/ethernet/cadence/macb_main.c +3 −0
  321. drivers/net/ethernet/chelsio/cxgb4/cxgb4.h +0 −2
  322. drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c +35 −13
  323. drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +2 −2
  324. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +3 −5
  325. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +5 −9
  326. drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_mqprio.c +6 −3
  327. drivers/net/ethernet/chelsio/cxgb4/sge.c +6 −0
  328. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +29 −17
  329. drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c +79 −1
  330. drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.h +2 −0
  331. drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c +4 −2
  332. drivers/net/ethernet/ec_bhf.c +3 −1
  333. drivers/net/ethernet/emulex/benet/be_main.c +1 −0
  334. drivers/net/ethernet/freescale/fec_main.c +19 −5
  335. drivers/net/ethernet/freescale/fec_ptp.c +5 −3
  336. drivers/net/ethernet/google/gve/gve_main.c +12 −9
  337. drivers/net/ethernet/google/gve/gve_tx.c +7 −3
  338. drivers/net/ethernet/hisilicon/hns/hns_ethtool.c +3 −3
  339. drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +51 −59
  340. drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c +23 −41
  341. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c +3 −1
  342. drivers/net/ethernet/intel/i40e/i40e_txrx.c +6 −1
  343. drivers/net/ethernet/intel/i40e/i40e_xsk.c +6 −2
  344. drivers/net/ethernet/intel/ice/ice.h +5 −3
  345. drivers/net/ethernet/intel/ice/ice_ethtool.c +6 −45
  346. drivers/net/ethernet/intel/ice/ice_hw_autogen.h +1 −0
  347. drivers/net/ethernet/intel/ice/ice_lib.c +22 −8
  348. drivers/net/ethernet/intel/ice/ice_main.c +15 −0
  349. drivers/net/ethernet/intel/ice/ice_txrx.c +13 −4
  350. drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +13 −6
  351. drivers/net/ethernet/intel/ice/ice_xsk.c +9 −2
  352. drivers/net/ethernet/intel/igb/igb.h +1 −1
  353. drivers/net/ethernet/intel/igb/igb_main.c +32 −23
  354. drivers/net/ethernet/intel/igb/igb_ptp.c +10 −13
  355. drivers/net/ethernet/intel/igc/igc_main.c +5 −6
  356. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +8 −8
  357. drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c +7 −9
  358. drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +8 −6
  359. drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +3 −0
  360. drivers/net/ethernet/korina.c +6 −6
  361. drivers/net/ethernet/lantiq_xrx200.c +11 −6
  362. drivers/net/ethernet/marvell/mvpp2/mvpp2.h +22 −0
  363. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +45 −9
  364. drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +4 −0
  365. drivers/net/ethernet/mediatek/mtk_eth_soc.c +52 −25
  366. drivers/net/ethernet/mediatek/mtk_eth_soc.h +22 −2
  367. drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +1 −3
  368. drivers/net/ethernet/mellanox/mlx4/fw.c +3 −0
  369. drivers/net/ethernet/mellanox/mlx4/fw.h +1 −0
  370. drivers/net/ethernet/mellanox/mlx4/main.c +6 −0
  371. drivers/net/ethernet/mellanox/mlx4/port.c +103 −4
  372. drivers/net/ethernet/mellanox/mlx5/core/dev.c +19 −0
  373. drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c +2 −0
  374. drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c +0 −1
  375. drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h +22 −0
  376. drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c +2 −0
  377. drivers/net/ethernet/mellanox/mlx5/core/en/rep/neigh.c +6 −9
  378. drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c +2 −6
  379. drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +31 −4
  380. drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c +0 −3
  381. drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c +1 −1
  382. drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +10 −2
  383. drivers/net/ethernet/mellanox/mlx5/core/en_fs.c +1 −0
  384. drivers/net/ethernet/mellanox/mlx5/core/en_main.c +81 −33
  385. drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +32 −7
  386. drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +3 −0
  387. drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +3 −22
  388. drivers/net/ethernet/mellanox/mlx5/core/eq.c +4 −2
  389. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +7 −0
  390. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +2 −1
  391. drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_termtbl.c +26 −35
  392. drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +3 −0
  393. drivers/net/ethernet/mellanox/mlx5/core/lag_mp.c +6 −0
  394. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c +1 −1
  395. drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.h +5 −0
  396. drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c +3 −0
  397. drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.h +1 −4
  398. drivers/net/ethernet/mellanox/mlx5/core/main.c +7 −7
  399. drivers/net/ethernet/mellanox/mlx5/core/mr.c +1 −1
  400. drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c +17 −5
  401. drivers/net/ethernet/mellanox/mlx5/core/rdma.c +3 −0
  402. drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c +1 −0
  403. drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c +11 −7
  404. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c +2 −1
  405. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_ste_v1.c +16 −10
  406. drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h +5 −4
  407. drivers/net/ethernet/mellanox/mlx5/core/transobj.c +24 −6
  408. drivers/net/ethernet/mellanox/mlx5/core/vport.c +0 −2
  409. drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +4 −2
  410. drivers/net/ethernet/mellanox/mlxsw/reg.h +1 −1
  411. drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +4 −1
  412. drivers/net/ethernet/microchip/encx24j600.c +1 −1
  413. drivers/net/ethernet/microchip/encx24j600_hw.h +1 −1
  414. drivers/net/ethernet/mscc/ocelot.c +5 −0
  415. drivers/net/ethernet/myricom/myri10ge/myri10ge.c +1 −0
  416. drivers/net/ethernet/pensando/Kconfig +1 −0
  417. drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +2 −0
  418. drivers/net/ethernet/qlogic/qed/qed_dcbx.c +3 −1
  419. drivers/net/ethernet/qlogic/qla3xxx.c +1 −1
  420. drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +1 −0
  421. drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +9 −9
  422. drivers/net/ethernet/realtek/r8169_main.c +1 −1
  423. drivers/net/ethernet/renesas/sh_eth.c +1 −1
  424. drivers/net/ethernet/sfc/nic.c +1 −0
  425. drivers/net/ethernet/stmicro/stmmac/dwmac1000.h +4 −4
  426. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +25 −13
  427. drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +2 −0
  428. drivers/net/ethernet/ti/netcp_core.c +2 −2
  429. drivers/net/ethernet/xilinx/ll_temac_main.c +24 −3
  430. drivers/net/hamradio/mkiss.c +1 −0
  431. drivers/net/ieee802154/mrf24j40.c +2 −2
  432. drivers/net/ipa/ipa.h +2 −0
  433. drivers/net/ipa/ipa_mem.c +2 −1
  434. drivers/net/mdio/mdio-octeon.c +0 −2
  435. drivers/net/mdio/mdio-thunder.c +0 −1
  436. drivers/net/mhi/net.c +1 −1
  437. drivers/net/phy/dp83867.c +1 −5
  438. drivers/net/phy/mdio_bus.c +2 −1
  439. drivers/net/usb/cdc_eem.c +2 −2
  440. drivers/net/usb/cdc_ncm.c +1 −1
  441. drivers/net/usb/hso.c +22 −23
  442. drivers/net/usb/lan78xx.c +1 −0
  443. drivers/net/usb/qmi_wwan.c +1 −1
  444. drivers/net/usb/r8152.c +38 −6
  445. drivers/net/usb/smsc75xx.c +9 −3
  446. drivers/net/virtio_net.c +8 −12
  447. drivers/net/vrf.c +2 −4
  448. drivers/net/wireguard/Makefile +1 −2
  449. drivers/net/wireguard/allowedips.c +99 −90
  450. drivers/net/wireguard/allowedips.h +7 −7
  451. drivers/net/wireguard/main.c +16 −1
  452. drivers/net/wireguard/peer.c +20 −7
  453. drivers/net/wireguard/peer.h +3 −0
  454. drivers/net/wireguard/selftest/allowedips.c +79 −86
  455. drivers/net/wireguard/socket.c +1 −1
  456. drivers/net/wireless/ath/ath10k/htt.h +1 −0
  457. drivers/net/wireless/ath/ath10k/htt_rx.c +191 −10
  458. drivers/net/wireless/ath/ath10k/rx_desc.h +13 −1
  459. drivers/net/wireless/ath/ath11k/dp_rx.c +34 −0
  460. drivers/net/wireless/ath/ath11k/dp_rx.h +1 −0
  461. drivers/net/wireless/ath/ath11k/mac.c +6 −0
  462. drivers/net/wireless/mac80211_hwsim.c +5 −0
  463. drivers/net/wireless/mediatek/mt76/mac80211.c +26 −0
  464. drivers/net/wireless/mediatek/mt76/mt7615/init.c +0 −1
  465. drivers/net/wireless/mediatek/mt76/mt7615/mac.c +3 −2
  466. drivers/net/wireless/mediatek/mt76/mt7615/sdio_mcu.c +12 −7
  467. drivers/net/wireless/mediatek/mt76/mt7615/usb_mcu.c +0 −3
  468. drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +4 −0
  469. drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +77 −4
  470. drivers/net/wireless/mediatek/mt76/mt7921/init.c +2 −2
  471. drivers/net/wireless/mediatek/mt76/mt7921/mac.c +3 −2
  472. drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 −2
  473. drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +10 −7
  474. drivers/net/xen-netback/interface.c +6 −0
  475. drivers/nfc/nfcmrvl/fw_dnld.h +1 −1
  476. drivers/nfc/nfcmrvl/i2c.c +1 −1
  477. drivers/nfc/nfcmrvl/nfcmrvl.h +1 −1
  478. drivers/nfc/nfcmrvl/spi.c +1 −1
  479. drivers/nfc/nfcmrvl/uart.c +1 −1
  480. drivers/nfc/nfcmrvl/usb.c +1 −1
  481. drivers/nvme/host/Kconfig +2 −1
  482. drivers/nvme/host/core.c +3 −1
  483. drivers/nvme/host/fabrics.c +5 −0
  484. drivers/nvme/host/fc.c +17 −8
  485. drivers/nvme/host/rdma.c +3 −2
  486. drivers/nvme/target/core.c +27 −21
  487. drivers/nvme/target/loop.c +8 −3
  488. drivers/nvme/target/nvmet.h +1 −1
  489. drivers/nvme/target/tcp.c +1 −1
  490. drivers/pci/controller/dwc/Makefile +2 −1
  491. drivers/pci/controller/dwc/pcie-tegra194-acpi.c +108 −0
  492. drivers/pci/controller/dwc/pcie-tegra194.c +18 −120
  493. drivers/pci/controller/pci-aardvark.c +40 −9
  494. drivers/pci/of.c +9 −0
  495. drivers/pci/probe.c +2 −1
  496. drivers/pci/quirks.c +92 −1
  497. drivers/phy/broadcom/phy-brcm-usb-init.h +2 −2
  498. drivers/phy/cadence/phy-cadence-sierra.c +1 −0
  499. drivers/phy/mediatek/phy-mtk-tphy.c +2 −0
  500. drivers/phy/microchip/sparx5_serdes.c +4 −0
  501. drivers/phy/ralink/phy-mt7621-pci.c +1 −1
  502. drivers/phy/ti/phy-j721e-wiz.c +1 −0
  503. drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +2 −2
  504. drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c +2 −2
  505. drivers/pinctrl/aspeed/pinctrl-aspeed.c +2 −1
  506. drivers/pinctrl/aspeed/pinmux-aspeed.c +2 −1
  507. drivers/pinctrl/qcom/Kconfig +1 −1
  508. drivers/pinctrl/qcom/pinctrl-sdx55.c +9 −9
  509. drivers/pinctrl/ralink/pinctrl-rt2880.c +1 −1
  510. drivers/platform/mellanox/mlxreg-hotplug.c +2 −2
  511. drivers/platform/surface/aggregator/controller.c +1 −1
  512. drivers/platform/surface/surface_aggregator_registry.c +5 −2
  513. drivers/platform/surface/surface_dtx.c +1 −0
  514. drivers/platform/x86/thinkpad_acpi.c +1 −0
  515. drivers/ptp/ptp_clock.c +3 −3
  516. drivers/ptp/ptp_ocp.c +3 −1
  517. drivers/regulator/Kconfig +1 −1
  518. drivers/regulator/atc260x-regulator.c +10 −9
  519. drivers/regulator/bd718x7-regulator.c +1 −1
  520. drivers/regulator/core.c +6 −0
  521. drivers/regulator/cros-ec-regulator.c +2 −1
  522. drivers/regulator/da9121-regulator.c +7 −3
  523. drivers/regulator/fan53555.c +1 −2
  524. drivers/regulator/fan53880.c +3 −0
  525. drivers/regulator/fixed.c +6 −1
  526. drivers/regulator/helpers.c +1 −1
  527. drivers/regulator/hi6421v600-regulator.c +2 −2
  528. drivers/regulator/hi655x-regulator.c +1 −1
  529. drivers/regulator/max77620-regulator.c +11 −6
  530. drivers/regulator/mt6315-regulator.c +1 −1
  531. drivers/regulator/rt4801-regulator.c +2 −2
  532. drivers/regulator/rtmv20-regulator.c +42 −2
  533. drivers/regulator/scmi-regulator.c +1 −1
  534. drivers/s390/block/dasd_diag.c +7 −1
  535. drivers/s390/block/dasd_fba.c +7 −1
  536. drivers/s390/block/dasd_int.h +0 −1
  537. drivers/s390/cio/vfio_ccw_cp.c +4 −0
  538. drivers/s390/cio/vfio_ccw_drv.c +10 −2
  539. drivers/s390/cio/vfio_ccw_fsm.c +1 −0
  540. drivers/s390/cio/vfio_ccw_ops.c +0 −2
  541. drivers/s390/crypto/ap_queue.c +9 −2
  542. drivers/scsi/aic7xxx/aicasm/aicasm_gram.y +0 −1
  543. drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h +1 −1
  544. drivers/scsi/aic7xxx/scsi_message.h +11 −0
  545. drivers/scsi/bnx2fc/bnx2fc_io.c +1 −0
  546. drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +4 −4
  547. drivers/scsi/hosts.c +26 −21
  548. drivers/scsi/libsas/sas_port.c +2 −2
  549. drivers/scsi/lpfc/lpfc_sli.c +1 −3
  550. drivers/scsi/qedf/qedf_main.c +9 −11
  551. drivers/scsi/qla2xxx/qla_target.c +2 −0
  552. drivers/scsi/scsi_devinfo.c +1 −0
  553. drivers/scsi/ufs/ufs-mediatek.c +14 −1
  554. drivers/scsi/vmw_pvscsi.c +7 −1
  555. drivers/soc/amlogic/meson-clk-measure.c +1 −3
  556. drivers/soundwire/qcom.c +10 −2
  557. drivers/spi/Kconfig +1 −1
  558. drivers/spi/spi-bcm2835.c +8 −2
  559. drivers/spi/spi-bitbang.c +14 −4
  560. drivers/spi/spi-fsl-dspi.c +3 −1
  561. drivers/spi/spi-fsl-spi.c +4 −0
  562. drivers/spi/spi-omap-uwire.c +8 −1
  563. drivers/spi/spi-omap2-mcspi.c +20 −13
  564. drivers/spi/spi-pxa2xx.c +8 −1
  565. drivers/spi/spi-sc18is602.c +8 −1
  566. drivers/spi/spi-sprd.c +1 −0
  567. drivers/spi/spi-stm32-qspi.c +4 −1
  568. drivers/spi/spi-zynq-qspi.c +8 −8
  569. drivers/spi/spi.c +38 −13
  570. drivers/staging/emxx_udc/emxx_udc.c +2 −2
  571. drivers/staging/iio/cdc/ad7746.c +0 −1
  572. drivers/staging/ralink-gdma/ralink-gdma.c +0 −2
  573. drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +3 −3
  574. drivers/target/target_core_iblock.c +2 −2
  575. drivers/target/target_core_transport.c +2 −4
  576. drivers/target/target_core_user.c +7 −5
  577. drivers/tee/optee/call.c +4 −2
  578. drivers/tee/optee/optee_msg.h +4 −2
  579. drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c +4 −0
  580. drivers/thermal/intel/therm_throt.c +11 −4
  581. drivers/thermal/intel/x86_pkg_temp_thermal.c +1 −1
  582. drivers/thermal/qcom/qcom-spmi-adc-tm5.c +1 −1
  583. drivers/thermal/ti-soc-thermal/ti-bandgap.c +1 −1
  584. drivers/thunderbolt/dma_port.c +6 −5
  585. drivers/thunderbolt/usb4.c +5 −4
  586. drivers/tty/serial/8250/8250.h +17 −15
  587. drivers/tty/serial/8250/8250_aspeed_vuart.c +1 −0
  588. drivers/tty/serial/8250/8250_dw.c +1 −0
  589. drivers/tty/serial/8250/8250_exar.c +5 −1
  590. drivers/tty/serial/8250/8250_pci.c +35 −12
  591. drivers/tty/serial/8250/8250_port.c +12 −0
  592. drivers/tty/serial/rp2.c +17 −35
  593. drivers/tty/serial/serial-tegra.c +1 −1
  594. drivers/tty/serial/serial_core.c +5 −3
  595. drivers/tty/serial/sh-sci.c +2 −2
  596. drivers/usb/cdns3/cdns3-gadget.c +6 −6
  597. drivers/usb/cdns3/cdnsp-gadget.c +7 −7
  598. drivers/usb/cdns3/cdnsp-ring.c +4 −3
  599. drivers/usb/chipidea/udc.c +1 −0
  600. drivers/usb/chipidea/usbmisc_imx.c +14 −2
  601. drivers/usb/core/devio.c +8 −3
  602. drivers/usb/core/hub.c +7 −0
  603. drivers/usb/dwc3/core.c +1 −7
  604. drivers/usb/dwc3/debug.h +3 −0
  605. drivers/usb/dwc3/debugfs.c +2 −19
  606. drivers/usb/dwc3/dwc3-meson-g12a.c +10 −3
  607. drivers/usb/dwc3/ep0.c +3 −0
  608. drivers/usb/dwc3/gadget.c +19 −12
  609. drivers/usb/gadget/config.c +8 −0
  610. drivers/usb/gadget/function/f_ecm.c +1 −1
  611. drivers/usb/gadget/function/f_eem.c +3 −3
  612. drivers/usb/gadget/function/f_fs.c +3 −0
  613. drivers/usb/gadget/function/f_hid.c +2 −1
  614. drivers/usb/gadget/function/f_loopback.c +1 −1
  615. drivers/usb/gadget/function/f_ncm.c +5 −5
  616. drivers/usb/gadget/function/f_printer.c +2 −1
  617. drivers/usb/gadget/function/f_rndis.c +1 −1
  618. drivers/usb/gadget/function/f_serial.c +1 −1
  619. drivers/usb/gadget/function/f_sourcesink.c +2 −1
  620. drivers/usb/gadget/function/f_subset.c +1 −1
  621. drivers/usb/gadget/function/f_tcm.c +2 −1
  622. drivers/usb/gadget/udc/renesas_usb3.c +3 −2
  623. drivers/usb/host/xhci-pci.c +6 −1
  624. drivers/usb/host/xhci-ring.c +7 −7
  625. drivers/usb/host/xhci.h +1 −0
  626. drivers/usb/misc/brcmstb-usb-pinmap.c +2 −0
  627. drivers/usb/misc/trancevibrator.c +2 −2
  628. drivers/usb/misc/uss720.c +1 −0
  629. drivers/usb/musb/musb_core.c +1 −2
  630. drivers/usb/serial/cp210x.c +78 −6
  631. drivers/usb/serial/ftdi_sio.c +4 −0
  632. drivers/usb/serial/ftdi_sio_ids.h +8 −0
  633. drivers/usb/serial/omninet.c +5 −3
  634. drivers/usb/serial/option.c +4 −0
  635. drivers/usb/serial/pl2303.c +1 −0
  636. drivers/usb/serial/pl2303.h +1 −0
  637. drivers/usb/serial/quatech2.c +3 −3
  638. drivers/usb/serial/ti_usb_3410_5052.c +3 −0
  639. drivers/usb/typec/mux.c +5 −4
  640. drivers/usb/typec/mux/intel_pmc_mux.c +11 −4
  641. drivers/usb/typec/tcpm/tcpm.c +107 −43
  642. drivers/usb/typec/tcpm/wcove.c +1 −1
  643. drivers/usb/typec/ucsi/ucsi.c +2 −1
  644. drivers/vdpa/mlx5/net/mlx5_vnet.c +18 −1
  645. drivers/vfio/pci/Kconfig +1 −0
  646. drivers/vfio/pci/vfio_pci_config.c +1 −1
  647. drivers/vfio/platform/vfio_platform_common.c +1 −1
  648. drivers/vfio/vfio_iommu_type1.c +1 −1
  649. drivers/video/fbdev/core/fb_defio.c +35 −0
  650. drivers/video/fbdev/core/fbmem.c +4 −0
  651. drivers/video/fbdev/hgafb.c +1 −1
  652. fs/afs/cmservice.c +5 −0
  653. fs/afs/dir.c +3 −1
  654. fs/afs/fsclient.c +4 −0
  655. fs/afs/main.c +2 −2
  656. fs/afs/vlclient.c +1 −0
  657. fs/afs/write.c +9 −6
  658. fs/btrfs/block-group.c +4 −4
  659. fs/btrfs/compression.c +12 −5
  660. fs/btrfs/disk-io.c +18 −8
  661. fs/btrfs/extent-tree.c +1 −1
  662. fs/btrfs/file-item.c +81 −27
  663. fs/btrfs/file.c +2 −2
  664. fs/btrfs/inode.c +18 −1
  665. fs/btrfs/reflink.c +22 −16
  666. fs/btrfs/tree-log.c +29 −8
  667. fs/btrfs/zoned.c +18 −5
  668. fs/cifs/cifs_ioctl.h +19 −6
  669. fs/cifs/cifspdu.h +2 −1
  670. fs/cifs/ioctl.c +105 −38
  671. fs/cifs/smb2pdu.c +7 −0
  672. fs/cifs/trace.h +17 −12
  673. fs/coredump.c +1 −1
  674. fs/debugfs/file.c +1 −1
  675. fs/debugfs/inode.c +6 −3
  676. fs/ext4/extents.c +23 −20
  677. fs/ext4/fast_commit.c +90 −80
  678. fs/ext4/fast_commit.h +0 −19
  679. fs/ext4/ialloc.c +4 −2
  680. fs/ext4/mballoc.c +1 −1
  681. fs/ext4/namei.c +4 −2
  682. fs/ext4/super.c +9 −2
  683. fs/ext4/sysfs.c +4 −0
  684. fs/gfs2/file.c +4 −1
  685. fs/gfs2/glock.c +24 −4
  686. fs/gfs2/glops.c +1 −1
  687. fs/gfs2/log.c +3 −3
  688. fs/gfs2/log.h +1 −0
  689. fs/gfs2/lops.c +6 −1
  690. fs/gfs2/lops.h +1 −0
  691. fs/gfs2/util.c +1 −0
  692. fs/hugetlbfs/inode.c +1 −0
  693. fs/io-wq.c +15 −14
  694. fs/io-wq.h +1 −1
  695. fs/io_uring.c +43 −15
  696. fs/netfs/Kconfig +1 −1
  697. fs/netfs/read_helper.c +1 −1
  698. fs/nfs/client.c +1 −1
  699. fs/nfs/filelayout/filelayout.c +1 −1
  700. fs/nfs/namespace.c +1 −1
  701. fs/nfs/nfs4_fs.h +1 −0
  702. fs/nfs/nfs4client.c +1 −1
  703. fs/nfs/nfs4file.c +1 −1
  704. fs/nfs/nfs4proc.c +32 −9
  705. fs/nfs/nfstrace.h +0 −4
  706. fs/nfs/pagelist.c +6 −14
  707. fs/nfs/pnfs.c +8 −9
  708. fs/nfs/super.c +1 −1
  709. fs/notify/fanotify/fanotify_user.c +26 −8
  710. fs/notify/fdinfo.c +1 −1
  711. fs/ocfs2/file.c +50 −5
  712. fs/proc/base.c +13 −0
  713. fs/xfs/libxfs/xfs_ag_resv.c +15 −3
  714. fs/xfs/libxfs/xfs_bmap.c +0 −12
  715. fs/xfs/libxfs/xfs_inode_buf.c +42 −4
  716. fs/xfs/libxfs/xfs_trans_inode.c +17 −0
  717. fs/xfs/xfs_inode.c +29 −0
  718. fs/xfs/xfs_ioctl.c +34 −67
  719. fs/xfs/xfs_message.h +2 −0
  720. include/asm-generic/vmlinux.lds.h +1 −0
  721. include/dt-bindings/usb/pd.h +76 −13
  722. include/linux/arch_topology.h +0 −1
  723. include/linux/avf/virtchnl.h +1 −0
  724. include/linux/cgroup-defs.h +3 −3
  725. include/linux/cgroup.h +1 −1
  726. include/linux/compiler_attributes.h +1 −0
  727. include/linux/device.h +2 −4
  728. include/linux/entry-kvm.h +2 −1
  729. include/linux/fanotify.h +4 −0
  730. include/linux/fb.h +3 −0
  731. include/linux/hid.h +1 −2
  732. include/linux/host1x.h +24 −6
  733. include/linux/huge_mm.h +7 −1
  734. include/linux/hugetlb.h +8 −0
  735. include/linux/init.h +2 −1
  736. include/linux/kvm_host.h +16 −2
  737. include/linux/mfd/rohm-bd70528.h +1 −3
  738. include/linux/mfd/rohm-bd71828.h +5 −5
  739. include/linux/mlx4/device.h +1 −0
  740. include/linux/mlx5/driver.h +26 −22
  741. include/linux/mlx5/mlx5_ifc.h +2 −0
  742. include/linux/mlx5/mpfs.h +18 −0
  743. include/linux/mlx5/transobj.h +1 −0
  744. include/linux/mm.h +3 −0
  745. include/linux/mm_types.h +20 −7
  746. include/linux/pci.h +2 −0
  747. include/linux/pgtable.h +8 −0
  748. include/linux/phy.h +5 −0
  749. include/linux/platform_data/ti-sysc.h +1 −0
  750. include/linux/ptp_clock_kernel.h +1 −1
  751. include/linux/rmap.h +1 −0
  752. include/linux/rtsx_pci.h +2 −0
  753. include/linux/sched.h +8 −0
  754. include/linux/socket.h +0 −2
  755. include/linux/spi/spi.h +2 −2
  756. include/linux/sunrpc/xprt.h +2 −0
  757. include/linux/swapops.h +11 −4
  758. include/linux/tick.h +7 −0
  759. include/linux/usb/pd.h +1 −1
  760. include/linux/usb/pd_ext_sdb.h +0 −4
  761. include/net/caif/caif_dev.h +1 −1
  762. include/net/caif/cfcnfg.h +1 −1
  763. include/net/caif/cfserl.h +1 −0
  764. include/net/cfg80211.h +2 −2
  765. include/net/mac80211.h +7 −2
  766. include/net/net_namespace.h +13 −1
  767. include/net/netfilter/nf_flow_table.h +0 −1
  768. include/net/netfilter/nf_tables.h +0 −6
  769. include/net/nfc/nci_core.h +1 −0
  770. include/net/pkt_cls.h +11 −0
  771. include/net/pkt_sched.h +1 −6
  772. include/net/sch_generic.h +34 −1
  773. include/net/sock.h +16 −5
  774. include/net/tls.h +9 −1
  775. include/sound/soc-dai.h +1 −1
  776. include/uapi/asm-generic/unistd.h +1 −2
  777. include/uapi/linux/in.h +3 −0
  778. include/uapi/linux/input-event-codes.h +1 −0
  779. include/uapi/linux/io_uring.h +10 −9
  780. include/uapi/linux/kvm.h +3 −2
  781. include/uapi/linux/virtio_ids.h +1 −1
  782. init/Kconfig +1 −40
  783. init/main.c +1 −1
  784. kernel/bpf/Kconfig +89 −0
  785. kernel/bpf/bpf_lsm.c +2 −0
  786. kernel/bpf/btf.c +12 −0
  787. kernel/bpf/helpers.c +24 −18
  788. kernel/bpf/ringbuf.c +11 −13
  789. kernel/bpf/syscall.c +2 −1
  790. kernel/bpf/verifier.c +118 −44
  791. kernel/cgroup/cgroup-v1.c +5 −1
  792. kernel/cgroup/cgroup.c +9 −12
  793. kernel/cgroup/cpuset.c +1 −1
  794. kernel/cgroup/rdma.c +1 −1
  795. kernel/cgroup/rstat.c +1 −1
  796. kernel/crash_core.c +1 −0
  797. kernel/entry/common.c +3 −2
  798. kernel/events/core.c +2 −0
  799. kernel/irq_work.c +0 −3
  800. kernel/printk/printk_safe.c +1 −1
  801. kernel/sched/core.c +0 −1
  802. kernel/sched/debug.c +2 −1
  803. kernel/sched/fair.c +42 −30
  804. kernel/sched/pelt.h +1 −10
  805. kernel/seccomp.c +16 −14
  806. kernel/sysctl.c +24 −5
  807. kernel/time/tick-sched.c +1 −0
  808. kernel/trace/bpf_trace.c +12 −20
  809. kernel/trace/ftrace.c +7 −1
  810. kernel/trace/trace.c +1 −12
  811. kernel/trace/trace_clock.c +3 −3
  812. kernel/workqueue.c +10 −2
  813. lib/crc64.c +1 −1
  814. lib/percpu-refcount.c +3 −3
  815. mm/debug_vm_pgtable.c +2 −2
  816. mm/huge_memory.c +29 −27
  817. mm/hugetlb.c +125 −26
  818. mm/internal.h +39 −14
  819. mm/kasan/init.c +2 −2
  820. mm/kfence/core.c +3 −3
  821. mm/memory-failure.c +33 −3
  822. mm/memory.c +45 −0
  823. mm/migrate.c +1 −0
  824. mm/page_alloc.c +2 −0
  825. mm/page_vma_mapped.c +17 −10
  826. mm/pgtable-generic.c +2 −3
  827. mm/rmap.c +27 −12
  828. mm/slab_common.c +1 −2
  829. mm/slub.c +16 −21
  830. mm/sparse.c +11 −2
  831. mm/swapfile.c +1 −1
  832. mm/truncate.c +19 −24
  833. net/Kconfig +0 −27
  834. net/appletalk/aarp.c +1 −1
  835. net/batman-adv/bat_iv_ogm.c +3 −1
  836. net/bluetooth/hci_core.c +6 −1
  837. net/bluetooth/hci_sock.c +2 −2
  838. net/bluetooth/smp.c +3 −3
  839. net/bridge/br_private.h +2 −2
  840. net/bridge/br_vlan_tunnel.c +24 −14
  841. net/caif/caif_dev.c +9 −4
  842. net/caif/caif_usb.c +13 −1
  843. net/caif/cfcnfg.c +11 −5
  844. net/caif/cfserl.c +5 −0
  845. net/can/bcm.c +49 −13
  846. net/can/isotp.c +81 −29
  847. net/can/j1939/transport.c +40 −14
  848. net/can/raw.c +48 −14
  849. net/compat.c +1 −1
  850. net/core/dev.c +24 −5
  851. net/core/devlink.c +2 −2
  852. net/core/fib_rules.c +1 −1
  853. net/core/filter.c +1 −0
  854. net/core/neighbour.c +1 −0
  855. net/core/net_namespace.c +13 −7
  856. net/core/rtnetlink.c +4 −0
  857. net/core/skbuff.c +3 −1
  858. net/core/sock.c +16 −8
  859. net/dsa/master.c +3 −2
  860. net/dsa/slave.c +7 −5
  861. net/dsa/tag_8021q.c +1 −1
  862. net/ethtool/eeprom.c +1 −1
  863. net/ethtool/ioctl.c +5 −5
  864. net/ethtool/stats.c +1 −1
  865. net/ethtool/strset.c +2 −0
  866. net/hsr/hsr_device.c +2 −0
  867. net/hsr/hsr_forward.c +21 −9
  868. net/hsr/hsr_forward.h +4 −4
  869. net/hsr/hsr_main.h +2 −2
  870. net/hsr/hsr_slave.c +5 −6
  871. net/ieee802154/nl-mac.c +6 −4
  872. net/ieee802154/nl-phy.c +3 −1
  873. net/ieee802154/nl802154.c +5 −4
  874. net/ipv4/af_inet.c +2 −2
  875. net/ipv4/bpf_tcp_ca.c +2 −0
  876. net/ipv4/cipso_ipv4.c +1 −0
  877. net/ipv4/devinet.c +1 −1
  878. net/ipv4/icmp.c +7 −0
  879. net/ipv4/igmp.c +1 −0
  880. net/ipv4/ipconfig.c +8 −5
  881. net/ipv4/ping.c +7 −5
  882. net/ipv4/route.c +14 −1
  883. net/ipv4/udp.c +10 −0
  884. net/ipv6/addrconf.c +1 −1
  885. net/ipv6/mcast.c +0 −3
  886. net/ipv6/netfilter/nft_fib_ipv6.c +18 −4
  887. net/ipv6/reassembly.c +3 −1
  888. net/ipv6/route.c +6 −2
  889. net/ipv6/sit.c +3 −0
  890. net/ipv6/udp.c +3 −0
  891. net/mac80211/debugfs.c +9 −2
  892. net/mac80211/ieee80211_i.h +14 −24
  893. net/mac80211/iface.c +15 −15
  894. net/mac80211/key.c +7 −0
  895. net/mac80211/key.h +2 −0
  896. net/mac80211/main.c +6 −1
  897. net/mac80211/mlme.c +8 −0
  898. net/mac80211/rc80211_minstrel_ht.c +1 −1
  899. net/mac80211/rx.c +119 −38
  900. net/mac80211/scan.c +16 −5
  901. net/mac80211/sta_info.c +5 −1
  902. net/mac80211/sta_info.h +32 −1
  903. net/mac80211/tx.c +36 −16
  904. net/mac80211/util.c +11 −13
  905. net/mac80211/wpa.c +9 −4
  906. net/mptcp/options.c +3 −2
  907. net/mptcp/pm_netlink.c +4 −4
  908. net/mptcp/protocol.c +59 −29
  909. net/mptcp/protocol.h +2 −2
  910. net/mptcp/sockopt.c +2 −2
  911. net/mptcp/subflow.c +90 −92
  912. net/netfilter/ipvs/ip_vs_ctl.c +1 −1
  913. net/netfilter/nf_conntrack_proto.c +1 −1
  914. net/netfilter/nf_flow_table_core.c +1 −2
  915. net/netfilter/nf_flow_table_offload.c +4 −3
  916. net/netfilter/nf_synproxy_core.c +5 −0
  917. net/netfilter/nf_tables_api.c +100 −69
  918. net/netfilter/nfnetlink_cthelper.c +6 −2
  919. net/netfilter/nft_ct.c +1 −1
  920. net/netfilter/nft_set_pipapo.c +2 −2
  921. net/netfilter/nft_set_pipapo.h +2 −0
  922. net/netfilter/nft_set_pipapo_avx2.c +3 −0
  923. net/netlink/af_netlink.c +4 −2
  924. net/nfc/llcp_sock.c +2 −0
  925. net/nfc/nci/core.c +1 −0
  926. net/nfc/nci/hci.c +5 −0
  927. net/nfc/rawsock.c +1 −1
  928. net/openvswitch/meter.c +8 −0
  929. net/packet/af_packet.c +31 −20
  930. net/qrtr/qrtr.c +1 −1
  931. net/rds/connection.c +17 −6
  932. net/rds/recv.c +1 −1
  933. net/rds/tcp.c +2 −2
  934. net/rds/tcp.h +2 −1
  935. net/rds/tcp_listen.c +6 −0
  936. net/sched/act_ct.c +17 −14
  937. net/sched/cls_api.c +1 −1
  938. net/sched/sch_cake.c +11 −7
  939. net/sched/sch_dsmark.c +2 −1
  940. net/sched/sch_fq_pie.c +13 −6
  941. net/sched/sch_generic.c +48 −2
  942. net/sched/sch_htb.c +4 −4
  943. net/sctp/socket.c +1 −0
  944. net/sctp/sysctl.c +1 −1
  945. net/smc/smc_ism.c +10 −1
  946. net/socket.c +0 −13
  947. net/sunrpc/clnt.c +0 −7
  948. net/sunrpc/xprt.c +32 −8
  949. net/sunrpc/xprtrdma/rpc_rdma.c +18 −9
  950. net/sunrpc/xprtrdma/transport.c +6 −6
  951. net/sunrpc/xprtrdma/verbs.c +15 −3
  952. net/sunrpc/xprtrdma/xprt_rdma.h +1 −0
  953. net/sunrpc/xprtsock.c +2 −0
  954. net/tipc/core.c +4 −2
  955. net/tipc/core.h +3 −7
  956. net/tipc/discover.c +2 −2
  957. net/tipc/link.c +5 −0
  958. net/tipc/link.h +1 −0
  959. net/tipc/msg.c +2 −7
  960. net/tipc/net.c +3 −12
  961. net/tipc/node.c +6 −6
  962. net/tipc/socket.c +4 −1
  963. net/tipc/udp_media.c +2 −0
  964. net/tls/tls_device.c +49 −11
  965. net/tls/tls_device_fallback.c +7 −0
  966. net/tls/tls_main.c +1 −0
  967. net/tls/tls_sw.c +6 −5
  968. net/unix/af_unix.c +4 −3
  969. net/wireless/Makefile +1 −1
  970. net/wireless/core.c +5 −8
  971. net/wireless/pmsr.c +14 −2
  972. net/wireless/sysfs.c +4 −0
  973. net/wireless/util.c +8 −2
  974. net/x25/af_x25.c +1 −1
  975. samples/bpf/xdpsock_user.c +1 −1
  976. samples/vfio-mdev/mdpy-fb.c +9 −4
  977. scripts/Makefile.modfinal +1 −1
  978. scripts/link-vmlinux.sh +1 −1
  979. scripts/recordmcount.h +10 −5
  980. sound/core/control_led.c +26 −7
  981. sound/core/seq/seq_timer.c +9 −1
  982. sound/core/timer.c +2 −1
  983. sound/firewire/amdtp-stream.c +1 −1
  984. sound/hda/intel-dsp-config.c +4 −0
  985. sound/pci/hda/hda_codec.c +5 −0
  986. sound/pci/hda/hda_generic.c +1 −0
  987. sound/pci/hda/hda_intel.c +3 −0
  988. sound/pci/hda/patch_cirrus.c +3 −4
  989. sound/pci/hda/patch_realtek.c +62 −1
  990. sound/soc/amd/raven/acp3x-pcm-dma.c +0 −10
  991. sound/soc/amd/raven/acp3x.h +1 −0
  992. sound/soc/amd/raven/pci-acp3x.c +15 −0
  993. sound/soc/codecs/ak5558.c +1 −1
  994. sound/soc/codecs/cs35l32.c +3 −0
  995. sound/soc/codecs/cs35l33.c +1 −0
  996. sound/soc/codecs/cs35l34.c +3 −0
  997. sound/soc/codecs/cs42l42.c +3 −0
  998. sound/soc/codecs/cs42l56.c +6 −1
  999. sound/soc/codecs/cs42l73.c +3 −0
  1000. sound/soc/codecs/cs53l30.c +3 −0
  1001. sound/soc/codecs/da7219.c +1 −4
  1002. sound/soc/codecs/lpass-rx-macro.c +1 −0
  1003. sound/soc/codecs/lpass-tx-macro.c +1 −0
  1004. sound/soc/codecs/max98088.c +11 −2
  1005. sound/soc/codecs/rt5659.c +21 −5
  1006. sound/soc/codecs/rt5682-sdw.c +2 −1
  1007. sound/soc/codecs/rt711-sdca.c +2 −2
  1008. sound/soc/codecs/sti-sas.c +1 −0
  1009. sound/soc/codecs/tas2562.h +7 −7
  1010. sound/soc/fsl/Kconfig +1 −0
  1011. sound/soc/fsl/fsl-asoc-card.c +1 −0
  1012. sound/soc/generic/audio-graph-card.c +29 −28
  1013. sound/soc/generic/simple-card.c +83 −85
  1014. sound/soc/intel/boards/bytcr_rt5640.c +25 −0
  1015. sound/soc/qcom/lpass-cpu.c +80 −11
  1016. sound/soc/qcom/lpass.h +4 −0
  1017. sound/soc/soc-core.c +2 −0
  1018. sound/soc/soc-topology.c +3 −3
  1019. sound/soc/sof/intel/hda-dai.c +5 −0
  1020. sound/soc/sof/pm.c +1 −0
  1021. sound/soc/stm/stm32_sai_sub.c +1 −4
  1022. sound/usb/format.c +1 −1
  1023. sound/usb/mixer_quirks.c +1 −1
  1024. sound/usb/mixer_scarlett_gen2.c +51 −30
  1025. sound/usb/mixer_scarlett_gen2.h +1 −1
  1026. tools/arch/mips/include/uapi/asm/perf_regs.h +40 −0
  1027. tools/arch/x86/include/asm/disabled-features.h +2 −5
  1028. tools/arch/x86/include/uapi/asm/kvm.h +2 −0
  1029. tools/bootconfig/include/linux/bootconfig.h +4 −0
  1030. tools/bootconfig/main.c +1 −0
  1031. tools/bpf/bpftool/Documentation/bpftool-cgroup.rst +3 −1
  1032. tools/bpf/bpftool/Documentation/bpftool-prog.rst +1 −1
  1033. tools/bpf/bpftool/bash-completion/bpftool +3 −3
  1034. tools/bpf/bpftool/cgroup.c +2 −1
  1035. tools/bpf/bpftool/prog.c +1 −1
  1036. tools/include/uapi/asm-generic/unistd.h +1 −2
  1037. tools/include/uapi/linux/fs.h +1 −1
  1038. tools/include/uapi/linux/in.h +3 −0
  1039. tools/include/uapi/linux/kvm.h +3 −2
  1040. tools/include/uapi/linux/perf_event.h +1 −1
  1041. tools/lib/bpf/libbpf.c +3 −0
  1042. tools/lib/bpf/libbpf_internal.h +5 −0
  1043. tools/lib/bpf/xsk.c +1 −1
  1044. tools/objtool/arch/x86/decode.c +4 −0
  1045. tools/objtool/elf.c +24 −1
  1046. tools/perf/Documentation/perf-intel-pt.txt +3 −3
  1047. tools/perf/Documentation/perf-script.txt +4 −3
  1048. tools/perf/Makefile.config +0 −1
  1049. tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl +1 −1
  1050. tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +1 −1
  1051. tools/perf/arch/s390/entry/syscalls/syscall.tbl +1 −1
  1052. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +1 −1
  1053. tools/perf/builtin-buildid-list.c +3 −0
  1054. tools/perf/builtin-record.c +6 −0
  1055. tools/perf/builtin-stat.c +10 −3
  1056. tools/perf/check-headers.sh +1 −0
  1057. tools/perf/perf.c +2 −2
  1058. tools/perf/pmu-events/arch/powerpc/power10/cache.json +20 −10
  1059. tools/perf/pmu-events/arch/powerpc/power10/floating_point.json +1 −1
  1060. tools/perf/pmu-events/arch/powerpc/power10/frontend.json +77 −47
  1061. tools/perf/pmu-events/arch/powerpc/power10/locks.json +2 −2
  1062. tools/perf/pmu-events/arch/powerpc/power10/marked.json +28 −33
  1063. tools/perf/pmu-events/arch/powerpc/power10/memory.json +37 −42
  1064. tools/perf/pmu-events/arch/powerpc/power10/others.json +54 −79
  1065. tools/perf/pmu-events/arch/powerpc/power10/pipeline.json +65 −70
  1066. tools/perf/pmu-events/arch/powerpc/power10/pmc.json +4 −4
  1067. tools/perf/pmu-events/arch/powerpc/power10/translation.json +11 −11
  1068. tools/perf/pmu-events/jevents.c +1 −1
  1069. tools/perf/scripts/python/exported-sql-viewer.py +9 −3
  1070. tools/perf/tests/attr/base-record +1 −1
  1071. tools/perf/tests/pfm.c +2 −2
  1072. tools/perf/tests/shell/stat_bpf_counters.sh +2 −2
  1073. tools/perf/trace/beauty/include/linux/socket.h +0 −2
  1074. tools/perf/util/bpf_counter.c +6 −4
  1075. tools/perf/util/dwarf-aux.c +6 −2
  1076. tools/perf/util/env.c +1 −0
  1077. tools/perf/util/event.h +1 −1
  1078. tools/perf/util/evlist.c +0 −3
  1079. tools/perf/util/evsel.c +1 −0
  1080. tools/perf/util/evsel.h +2 −2
  1081. tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +5 −1
  1082. tools/perf/util/intel-pt.c +4 −2
  1083. tools/perf/util/machine.c +2 −1
  1084. tools/perf/util/metricgroup.c +8 −6
  1085. tools/perf/util/parse-events.c +11 −2
  1086. tools/perf/util/parse-events.l +1 −0
  1087. tools/perf/util/perf_api_probe.c +10 −0
  1088. tools/perf/util/perf_api_probe.h +1 −0
  1089. tools/perf/util/pfm.c +10 −1
  1090. tools/perf/util/probe-finder.c +3 −0
  1091. tools/perf/util/session.c +1 −0
  1092. tools/perf/util/stat-display.c +3 −5
  1093. tools/perf/util/symbol-elf.c +1 −0
  1094. tools/testing/selftests/bpf/network_helpers.c +1 −1
  1095. tools/testing/selftests/bpf/network_helpers.h +1 −0
  1096. tools/testing/selftests/bpf/prog_tests/ringbuf.c +48 −1
  1097. tools/testing/selftests/bpf/prog_tests/tc_redirect.c +785 −0
  1098. tools/testing/selftests/bpf/progs/test_tc_neigh.c +10 −23
  1099. tools/testing/selftests/bpf/progs/test_tc_neigh_fib.c +6 −3
  1100. tools/testing/selftests/bpf/progs/test_tc_peer.c +37 −19
  1101. tools/testing/selftests/bpf/test_tc_redirect.sh +0 −216
  1102. tools/testing/selftests/bpf/test_verifier.c +1 −1
  1103. tools/testing/selftests/bpf/verifier/and.c +2 −0
  1104. tools/testing/selftests/bpf/verifier/bounds.c +14 −0
  1105. tools/testing/selftests/bpf/verifier/dead_code.c +2 −0
  1106. tools/testing/selftests/bpf/verifier/jmp32.c +22 −0
  1107. tools/testing/selftests/bpf/verifier/jset.c +6 −4
  1108. tools/testing/selftests/bpf/verifier/stack_ptr.c +0 −2
  1109. tools/testing/selftests/bpf/verifier/unpriv.c +2 −0
  1110. tools/testing/selftests/bpf/verifier/value_ptr_arith.c +4 −11
  1111. tools/testing/selftests/kvm/.gitignore +1 −0
  1112. tools/testing/selftests/kvm/Makefile +2 −1
  1113. tools/testing/selftests/kvm/demand_paging_test.c +109 −65
  1114. tools/testing/selftests/kvm/hardware_disable_test.c +31 −1
  1115. tools/testing/selftests/kvm/include/kvm_util.h +9 −5
  1116. tools/testing/selftests/kvm/include/test_util.h +12 −0
  1117. tools/testing/selftests/kvm/kvm_page_table_test.c +1 −1
  1118. tools/testing/selftests/kvm/lib/kvm_util.c +263 −67
  1119. tools/testing/selftests/kvm/lib/kvm_util_internal.h +15 −2
  1120. tools/testing/selftests/kvm/lib/perf_test_util.c +4 −2
  1121. tools/testing/selftests/kvm/lib/rbtree.c +1 −0
  1122. tools/testing/selftests/kvm/lib/test_util.c +35 −16
  1123. tools/testing/selftests/kvm/lib/x86_64/processor.c +4 −12
  1124. tools/testing/selftests/kvm/memslot_modification_stress_test.c +11 −7
  1125. tools/testing/selftests/kvm/memslot_perf_test.c +1037 −0
  1126. tools/testing/selftests/kvm/x86_64/get_cpuid_test.c +5 −0
  1127. tools/testing/selftests/kvm/x86_64/get_msr_index_features.c +2 −6
  1128. tools/testing/selftests/nci/.gitignore +1 −0
  1129. tools/testing/selftests/net/fib_tests.sh +25 −0
  1130. tools/testing/selftests/net/icmp.sh +74 −0
  1131. tools/testing/selftests/net/mptcp/mptcp_connect.sh +17 −7
  1132. tools/testing/selftests/net/udpgro_fwd.sh +1 −1
  1133. tools/testing/selftests/net/veth.sh +3 −2
  1134. tools/testing/selftests/netfilter/Makefile +1 −1
  1135. tools/testing/selftests/netfilter/nft_fib.sh +221 −0
  1136. tools/testing/selftests/proc/.gitignore +1 −0
  1137. tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq_pie.json +4 −4
  1138. tools/testing/selftests/wireguard/netns.sh +1 −0
  1139. tools/testing/selftests/wireguard/qemu/kernel.config +0 −1
  1140. virt/kvm/kvm_main.c +4 −2
  1141. virt/lib/irqbypass.c +6 −10
.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/admin-guide/sysctl/kernel.rst+14−3
@@ -1458,11 +1458,22 @@ unprivileged_bpf_disabled · 1457 unmodified lines
14581458 =========================
14591459
14601460 Writing 1 to this entry will disable unprivileged calls to ``bpf()``;
1461−once disabled, calling ``bpf()`` without ``CAP_SYS_ADMIN`` will return
1462−``-EPERM``.
1461+once disabled, calling ``bpf()`` without ``CAP_SYS_ADMIN`` or ``CAP_BPF``
1462+will return ``-EPERM``. Once set to 1, this can't be cleared from the
1463+running kernel anymore.
14631464
1464−Once set, this can't be cleared.
1465+Writing 2 to this entry will also disable unprivileged calls to ``bpf()``,
1466+however, an admin can still change this setting later on, if needed, by
1467+writing 0 or 1 to this entry.
14651468
1469+If ``BPF_UNPRIV_DEFAULT_OFF`` is enabled in the kernel config, then this
1470+entry will default to 2 instead of 0.
1471+
1472+= =============================================================
1473+0 Unprivileged calls to ``bpf()`` are enabled
1474+1 Unprivileged calls to ``bpf()`` are disabled without recovery
1475+2 Unprivileged calls to ``bpf()`` are disabled
1476+= =============================================================
14661477
14671478 watchdog
14681479 ========
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/i2c/i2c-mpc.yaml+7−0
@@ -46,6 +46,13 @@ properties: · 45 unmodified lines
4646 description: |
4747 I2C bus timeout in microseconds
4848
49+ fsl,i2c-erratum-a004447:
50+ $ref: /schemas/types.yaml#/definitions/flag
51+ description: |
52+ Indicates the presence of QorIQ erratum A-004447, which
53+ says that the standard i2c recovery scheme mechanism does
54+ not work and an alternate implementation is needed.
55+
4956 required:
5057 - compatible
5158 - reg
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/net/renesas,ether.yaml+1−1
@@ -10,7 +10,7 @@ allOf: · 9 unmodified lines
1010 - $ref: ethernet-controller.yaml#
1111
1212 maintainers:
13− - Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
13+ - Sergei Shtylyov <sergei.shtylyov@gmail.com>
1414
1515 properties:
1616 compatible:
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/devicetree/bindings/spi/spi-mux.yaml+1−1
@@ -72,7 +72,7 @@ examples: · 71 unmodified lines
7272
7373 mux-controls = <&mux>;
7474
75− spi-flash@0 {
75+ flash@0 {
7676 compatible = "jedec,spi-nor";
7777 reg = <0>;
7878 spi-max-frequency = <40000000>;
Documentation/driver-api/usb/usb.rst+2−0
@@ -123,6 +123,8 @@ are in ``drivers/usb/common/common.c``. · 122 unmodified lines
123123 In addition, some functions useful for creating debugging output are
124124 defined in ``drivers/usb/common/debug.c``.
125125
126+.. _usb_header:
127+
126128 Host-Side Data Types and Macros
127129 ===============================
128130
Documentation/riscv/vm-layout.rst+2−2
@@ -58,6 +58,6 @@ RISC-V Linux Kernel SV39 · 57 unmodified lines
5858 |
5959 ____________________________________________________________|____________________________________________________________
6060 | | | |
61− ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules
62− ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel, BPF
61+ ffffffff00000000 | -4 GB | ffffffff7fffffff | 2 GB | modules, BPF
62+ ffffffff80000000 | -2 GB | ffffffffffffffff | 2 GB | kernel
6363 __________________|____________|__________________|_________|____________________________________________________________
Documentation/userspace-api/seccomp_filter.rst+8−8
@@ -250,14 +250,14 @@ Users can read via ``ioctl(SECCOMP_IOCTL_NOTIF_RECV)`` (or ``poll()``) on a · 249 unmodified lines
250250 seccomp notification fd to receive a ``struct seccomp_notif``, which contains
251251 five members: the input length of the structure, a unique-per-filter ``id``,
252252 the ``pid`` of the task which triggered this request (which may be 0 if the
253−task is in a pid ns not visible from the listener's pid namespace), a ``flags``
254−member which for now only has ``SECCOMP_NOTIF_FLAG_SIGNALED``, representing
255−whether or not the notification is a result of a non-fatal signal, and the
256−``data`` passed to seccomp. Userspace can then make a decision based on this
257−information about what to do, and ``ioctl(SECCOMP_IOCTL_NOTIF_SEND)`` a
258−response, indicating what should be returned to userspace. The ``id`` member of
259−``struct seccomp_notif_resp`` should be the same ``id`` as in ``struct
260−seccomp_notif``.
253+task is in a pid ns not visible from the listener's pid namespace). The
254+notification also contains the ``data`` passed to seccomp, and a filters flag.
255+The structure should be zeroed out prior to calling the ioctl.
256+
257+Userspace can then make a decision based on this information about what to do,
258+and ``ioctl(SECCOMP_IOCTL_NOTIF_SEND)`` a response, indicating what should be
259+returned to userspace. The ``id`` member of ``struct seccomp_notif_resp`` should
260+be the same ``id`` as in ``struct seccomp_notif``.
261261
262262 It is worth noting that ``struct seccomp_data`` contains the values of register
263263 arguments to the syscall, but does not contain pointers to memory. The task's
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
Documentation/virt/kvm/vcpu-requests.rst+5−3
@@ -118,10 +118,12 @@ KVM_REQ_MMU_RELOAD · 117 unmodified lines
118118 necessary to inform each VCPU to completely refresh the tables. This
119119 request is used for that.
120120
121−KVM_REQ_PENDING_TIMER
121+KVM_REQ_UNBLOCK
122122
123− This request may be made from a timer handler run on the host on behalf
124− of a VCPU. It informs the VCPU thread to inject a timer interrupt.
123+ This request informs the vCPU to exit kvm_vcpu_block. It is used for
124+ example from timer handlers that run on the host on behalf of a vCPU,
125+ or in order to update the interrupt routing and ensure that assigned
126+ devices will wake up the vCPU.
125127
126128 KVM_REQ_UNHALT
127129
Documentation/vm/slub.rst+5−5
@@ -181,7 +181,7 @@ SLUB Debug output · 180 unmodified lines
181181 Here is a sample of slub debug output::
182182
183183 ====================================================================
184− BUG kmalloc-8: Redzone overwritten
184+ BUG kmalloc-8: Right Redzone overwritten
185185 --------------------------------------------------------------------
186186
187187 INFO: 0xc90f6d28-0xc90f6d2b. First byte 0x00 instead of 0xcc
@@ -189,10 +189,10 @@ Here is a sample of slub debug output:: · 1 unmodified line
189189 INFO: Object 0xc90f6d20 @offset=3360 fp=0xc90f6d58
190190 INFO: Allocated in get_modalias+0x61/0xf5 age=53 cpu=1 pid=554
191191
192− Bytes b4 0xc90f6d10: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ
193− Object 0xc90f6d20: 31 30 31 39 2e 30 30 35 1019.005
194− Redzone 0xc90f6d28: 00 cc cc cc .
195− Padding 0xc90f6d50: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
192+ Bytes b4 (0xc90f6d10): 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ
193+ Object (0xc90f6d20): 31 30 31 39 2e 30 30 35 1019.005
194+ Redzone (0xc90f6d28): 00 cc cc cc .
195+ Padding (0xc90f6d50): 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
196196
197197 [<c010523d>] dump_trace+0x63/0x1eb
198198 [<c01053df>] show_trace_log_lvl+0x1a/0x2f
MAINTAINERS+40−12
@@ -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/
@@ -4138,6 +4139,14 @@ S: Odd Fixes · 255 unmodified lines
41384139 F: Documentation/devicetree/bindings/arm/cavium-thunder2.txt
41394140 F: arch/arm64/boot/dts/cavium/thunder2-99xx*
41404141
4142+CBS/ETF/TAPRIO QDISCS
4143+M: Vinicius Costa Gomes <vinicius.gomes@intel.com>
4144+S: Maintained
4145+L: netdev@vger.kernel.org
4146+F: net/sched/sch_cbs.c
4147+F: net/sched/sch_etf.c
4148+F: net/sched/sch_taprio.c
4149+
41414150 CC2520 IEEE-802.15.4 RADIO DRIVER
41424151 M: Varka Bhadram <varkabhadram@gmail.com>
41434152 L: linux-wpan@vger.kernel.org
@@ -5569,7 +5578,6 @@ F: drivers/soc/fsl/dpio · 1425 unmodified lines
55695578
55705579 DPAA2 ETHERNET DRIVER
55715580 M: Ioana Ciornei <ioana.ciornei@nxp.com>
5572−M: Ioana Radulescu <ruxandra.radulescu@nxp.com>
55735581 L: netdev@vger.kernel.org
55745582 S: Maintained
55755583 F: Documentation/networking/device_drivers/ethernet/freescale/dpaa2/ethernet-driver.rst
@@ -6953,6 +6961,7 @@ F: net/core/failover.c · 1377 unmodified lines
69536961 FANOTIFY
69546962 M: Jan Kara <jack@suse.cz>
69556963 R: Amir Goldstein <amir73il@gmail.com>
6964+R: Matthew Bobrowski <repnop@google.com>
69566965 L: linux-fsdevel@vger.kernel.org
69576966 S: Maintained
69586967 F: fs/notify/fanotify/
@@ -12704,9 +12713,9 @@ F: drivers/rtc/rtc-ntxec.c · 5745 unmodified lines
1270412713 F: include/linux/mfd/ntxec.h
1270512714
1270612715 NETRONOME ETHERNET DRIVERS
12707−M: Simon Horman <simon.horman@netronome.com>
12716+M: Simon Horman <simon.horman@corigine.com>
1270812717 R: Jakub Kicinski <kuba@kernel.org>
12709−L: oss-drivers@netronome.com
12718+L: oss-drivers@corigine.com
1271012719 S: Maintained
1271112720 F: drivers/net/ethernet/netronome/
1271212721
@@ -12733,7 +12742,6 @@ M: "David S. Miller" <davem@davemloft.net> · 20 unmodified lines
1273312742 M: Jakub Kicinski <kuba@kernel.org>
1273412743 L: netdev@vger.kernel.org
1273512744 S: Maintained
12736−W: http://www.linuxfoundation.org/en/Net
1273712745 Q: https://patchwork.kernel.org/project/netdevbpf/list/
1273812746 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
1273912747 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
@@ -12778,7 +12786,6 @@ M: "David S. Miller" <davem@davemloft.net> · 38 unmodified lines
1277812786 M: Jakub Kicinski <kuba@kernel.org>
1277912787 L: netdev@vger.kernel.org
1278012788 S: Maintained
12781−W: http://www.linuxfoundation.org/en/Net
1278212789 Q: https://patchwork.kernel.org/project/netdevbpf/list/
1278312790 B: mailto:netdev@vger.kernel.org
1278412791 T: git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
@@ -12920,8 +12927,10 @@ F: include/uapi/linux/nexthop.h · 135 unmodified lines
1292012927 F: net/ipv4/nexthop.c
1292112928
1292212929 NFC SUBSYSTEM
12930+M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
12931+L: linux-nfc@lists.01.org (subscribers-only)
1292312932 L: netdev@vger.kernel.org
12924−S: Orphan
12933+S: Maintained
1292512934 F: Documentation/devicetree/bindings/net/nfc/
1292612935 F: drivers/nfc/
1292712936 F: include/linux/platform_data/nfcmrvl.h
@@ -12932,7 +12941,7 @@ F: net/nfc/ · 4 unmodified lines
1293212941 NFC VIRTUAL NCI DEVICE DRIVER
1293312942 M: Bongsu Jeon <bongsu.jeon@samsung.com>
1293412943 L: netdev@vger.kernel.org
12935−L: linux-nfc@lists.01.org (moderated for non-subscribers)
12944+L: linux-nfc@lists.01.org (subscribers-only)
1293612945 S: Supported
1293712946 F: drivers/nfc/virtual_ncidev.c
1293812947 F: tools/testing/selftests/nci/
@@ -13229,9 +13238,8 @@ F: Documentation/devicetree/bindings/sound/tfa9879.txt · 290 unmodified lines
1322913238 F: sound/soc/codecs/tfa9879*
1323013239
1323113240 NXP-NCI NFC DRIVER
13232−M: Clément Perrochaud <clement.perrochaud@effinnov.com>
1323313241 R: Charles Gorand <charles.gorand@effinnov.com>
13234−L: linux-nfc@lists.01.org (moderated for non-subscribers)
13242+L: linux-nfc@lists.01.org (subscribers-only)
1323513243 S: Supported
1323613244 F: drivers/nfc/nxp-nci
1323713245
@@ -14134,6 +14142,7 @@ F: drivers/pci/controller/pci-v3-semi.c · 896 unmodified lines
1413414142 PCI ENDPOINT SUBSYSTEM
1413514143 M: Kishon Vijay Abraham I <kishon@ti.com>
1413614144 M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
14145+R: Krzysztof Wilczyński <kw@linux.com>
1413714146 L: linux-pci@vger.kernel.org
1413814147 S: Supported
1413914148 F: Documentation/PCI/endpoint/*
@@ -14182,6 +14191,7 @@ F: drivers/pci/controller/pci-xgene-msi.c · 42 unmodified lines
1418214191 PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
1418314192 M: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
1418414193 R: Rob Herring <robh@kernel.org>
14194+R: Krzysztof Wilczyński <kw@linux.com>
1418514195 L: linux-pci@vger.kernel.org
1418614196 S: Supported
1418714197 Q: http://patchwork.ozlabs.org/project/linux-pci/list/
@@ -14341,10 +14351,12 @@ PER-CPU MEMORY ALLOCATOR · 153 unmodified lines
1434114351 M: Dennis Zhou <dennis@kernel.org>
1434214352 M: Tejun Heo <tj@kernel.org>
1434314353 M: Christoph Lameter <cl@linux.com>
14354+L: linux-mm@kvack.org
1434414355 S: Maintained
1434514356 T: git git://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu.git
1434614357 F: arch/*/include/asm/percpu.h
1434714358 F: include/linux/percpu*.h
14359+F: lib/percpu*.c
1434814360 F: mm/percpu*.c
1434914361
1435014362 PER-TASK DELAY ACCOUNTING
@@ -15969,6 +15981,7 @@ S390 IUCV NETWORK LAYER · 1618 unmodified lines
1596915981 M: Julian Wiedmann <jwi@linux.ibm.com>
1597015982 M: Karsten Graul <kgraul@linux.ibm.com>
1597115983 L: linux-s390@vger.kernel.org
15984+L: netdev@vger.kernel.org
1597215985 S: Supported
1597315986 W: http://www.ibm.com/developerworks/linux/linux390/
1597415987 F: drivers/s390/net/*iucv*
@@ -15979,6 +15992,7 @@ S390 NETWORK DRIVERS · 4 unmodified lines
1597915992 M: Julian Wiedmann <jwi@linux.ibm.com>
1598015993 M: Karsten Graul <kgraul@linux.ibm.com>
1598115994 L: linux-s390@vger.kernel.org
15995+L: netdev@vger.kernel.org
1598215996 S: Supported
1598315997 W: http://www.ibm.com/developerworks/linux/linux390/
1598415998 F: drivers/s390/net/
@@ -16157,7 +16171,7 @@ F: include/media/drv-intf/s3c_camif.h · 172 unmodified lines
1615716171 SAMSUNG S3FWRN5 NFC DRIVER
1615816172 M: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
1615916173 M: Krzysztof Opasiak <k.opasiak@samsung.com>
16160−L: linux-nfc@lists.01.org (moderated for non-subscribers)
16174+L: linux-nfc@lists.01.org (subscribers-only)
1616116175 S: Maintained
1616216176 F: Documentation/devicetree/bindings/net/nfc/samsung,s3fwrn5.yaml
1616316177 F: drivers/nfc/s3fwrn5
@@ -16570,6 +16584,7 @@ F: drivers/misc/sgi-xp/ · 406 unmodified lines
1657016584
1657116585 SHARED MEMORY COMMUNICATIONS (SMC) SOCKETS
1657216586 M: Karsten Graul <kgraul@linux.ibm.com>
16587+M: Guvenc Gulce <guvenc@linux.ibm.com>
1657316588 L: linux-s390@vger.kernel.org
1657416589 S: Supported
1657516590 W: http://www.ibm.com/developerworks/linux/linux390/
@@ -17328,6 +17343,12 @@ L: linux-i2c@vger.kernel.org · 752 unmodified lines
1732817343 S: Maintained
1732917344 F: drivers/i2c/busses/i2c-stm32*
1733017345
17346+ST STM32 SPI DRIVER
17347+M: Alain Volmat <alain.volmat@foss.st.com>
17348+L: linux-spi@vger.kernel.org
17349+S: Maintained
17350+F: drivers/spi/spi-stm32.c
17351+
1733117352 ST STPDDC60 DRIVER
1733217353 M: Daniel Nilsson <daniel.nilsson@flex.com>
1733317354 L: linux-hwmon@vger.kernel.org
@@ -17686,7 +17707,6 @@ R: Mika Westerberg <mika.westerberg@linux.intel.com> · 352 unmodified lines
1768617707 L: linux-i2c@vger.kernel.org
1768717708 S: Maintained
1768817709 F: drivers/i2c/busses/i2c-designware-*
17689−F: include/linux/platform_data/i2c-designware.h
1769017710
1769117711 SYNOPSYS DESIGNWARE MMC/SD/SDIO DRIVER
1769217712 M: Jaehoon Chung <jh80.chung@samsung.com>
@@ -18342,7 +18362,7 @@ F: sound/soc/codecs/tas571x* · 649 unmodified lines
1834218362 TI TRF7970A NFC DRIVER
1834318363 M: Mark Greer <mgreer@animalcreek.com>
1834418364 L: linux-wireless@vger.kernel.org
18345−L: linux-nfc@lists.01.org (moderated for non-subscribers)
18365+L: linux-nfc@lists.01.org (subscribers-only)
1834618366 S: Supported
1834718367 F: Documentation/devicetree/bindings/net/nfc/trf7970a.txt
1834818368 F: drivers/nfc/trf7970a.c
@@ -18878,6 +18898,13 @@ S: Maintained · 529 unmodified lines
1887818898 F: drivers/usb/host/isp116x*
1887918899 F: include/linux/usb/isp116x.h
1888018900
18901+USB ISP1760 DRIVER
18902+M: Rui Miguel Silva <rui.silva@linaro.org>
18903+L: linux-usb@vger.kernel.org
18904+S: Maintained
18905+F: drivers/usb/isp1760/*
18906+F: Documentation/devicetree/bindings/usb/nxp,isp1760.yaml
18907+
1888118908 USB LAN78XX ETHERNET DRIVER
1888218909 M: Woojung Huh <woojung.huh@microchip.com>
1888318910 M: UNGLinuxDriver@microchip.com
@@ -20022,6 +20049,7 @@ F: arch/x86/xen/*swiotlb* · 1138 unmodified lines
2002220049 F: drivers/xen/*swiotlb*
2002320050
2002420051 XFS FILESYSTEM
20052+C: irc://irc.oftc.net/xfs
2002520053 M: Darrick J. Wong <djwong@kernel.org>
2002620054 M: linux-xfs@vger.kernel.org
2002720055 L: linux-xfs@vger.kernel.org
Makefile+10−2
@@ -2,8 +2,8 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 13
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc3
6−NAME = Frozen Wasteland
5+EXTRAVERSION = -rc7
6+NAME = Opossums on Parade
77
88 # *DOCUMENTATION*
99 # To see a list of typical targets execute "make help"
@@ -928,6 +928,14 @@ CC_FLAGS_LTO += -fvisibility=hidden · 918 unmodified lines
928928
929929 # Limit inlining across translation units to reduce binary size
930930 KBUILD_LDFLAGS += -mllvm -import-instr-limit=5
931+
932+# Check for frame size exceeding threshold during prolog/epilog insertion
933+# when using lld < 13.0.0.
934+ifneq ($(CONFIG_FRAME_WARN),0)
935+ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0)
936+KBUILD_LDFLAGS += -plugin-opt=-warn-stack-size=$(CONFIG_FRAME_WARN)
937+endif
938+endif
931939 endif
932940
933941 ifdef CONFIG_LTO
arch/arc/include/uapi/asm/sigcontext.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 */
1919 struct sigcontext {
2020 struct user_regs_struct regs;
21+ struct user_regs_arcv2 v2abi;
2122 };
2223
2324 #endif /* _ASM_ARC_SIGCONTEXT_H */
arch/arc/kernel/signal.c+43−0
@@ -61,6 +61,41 @@ struct rt_sigframe { · 60 unmodified lines
6161 unsigned int sigret_magic;
6262 };
6363
64+static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
65+{
66+ int err = 0;
67+#ifndef CONFIG_ISA_ARCOMPACT
68+ struct user_regs_arcv2 v2abi;
69+
70+ v2abi.r30 = regs->r30;
71+#ifdef CONFIG_ARC_HAS_ACCL_REGS
72+ v2abi.r58 = regs->r58;
73+ v2abi.r59 = regs->r59;
74+#else
75+ v2abi.r58 = v2abi.r59 = 0;
76+#endif
77+ err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
78+#endif
79+ return err;
80+}
81+
82+static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
83+{
84+ int err = 0;
85+#ifndef CONFIG_ISA_ARCOMPACT
86+ struct user_regs_arcv2 v2abi;
87+
88+ err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
89+
90+ regs->r30 = v2abi.r30;
91+#ifdef CONFIG_ARC_HAS_ACCL_REGS
92+ regs->r58 = v2abi.r58;
93+ regs->r59 = v2abi.r59;
94+#endif
95+#endif
96+ return err;
97+}
98+
6499 static int
65100 stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
66101 sigset_t *set)
@@ -94,6 +129,10 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, · 27 unmodified lines
94129
95130 err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
96131 sizeof(sf->uc.uc_mcontext.regs.scratch));
132+
133+ if (is_isa_arcv2())
134+ err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
135+
97136 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
98137
99138 return err ? -EFAULT : 0;
@@ -109,6 +148,10 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) · 9 unmodified lines
109148 err |= __copy_from_user(&uregs.scratch,
110149 &(sf->uc.uc_mcontext.regs.scratch),
111150 sizeof(sf->uc.uc_mcontext.regs.scratch));
151+
152+ if (is_isa_arcv2())
153+ err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs);
154+
112155 if (err)
113156 return -EFAULT;
114157
arch/arc/kernel/vmlinux.lds.S+1−1
@@ -57,7 +57,6 @@ SECTIONS · 56 unmodified lines
5757 .init.ramfs : { INIT_RAM_FS }
5858
5959 . = ALIGN(PAGE_SIZE);
60− _stext = .;
6160
6261 HEAD_TEXT_SECTION
6362 INIT_TEXT_SECTION(L1_CACHE_BYTES)
@@ -83,6 +82,7 @@ SECTIONS · 19 unmodified lines
8382
8483 .text : {
8584 _text = .;
85+ _stext = .;
8686 TEXT_TEXT
8787 SCHED_TEXT
8888 CPUIDLE_TEXT
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/Kbuild+1−2
@@ -1,6 +1,5 @@
11 # SPDX-License-Identifier: GPL-2.0-only
2−obj-y += kernel/ mm/
3−obj-$(CONFIG_NET) += net/
2+obj-y += kernel/ mm/ net/
43 obj-$(CONFIG_KVM) += kvm/
54 obj-$(CONFIG_XEN) += xen/
65 obj-$(CONFIG_CRYPTO) += crypto/
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/arm64/include/asm/barrier.h+1−1
@@ -74,7 +74,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long idx, · 73 unmodified lines
7474 * This insanity brought to you by speculative system register reads,
7575 * out-of-order memory accesses, sequence locks and Thomas Gleixner.
7676 *
77− * http://lists.infradead.org/pipermail/linux-arm-kernel/2019-February/631195.html
77+ * https://lore.kernel.org/r/alpine.DEB.2.21.1902081950260.1662@nanos.tec.linutronix.de/
7878 */
7979 #define arch_counter_enforce_ordering(val) do { \
8080 u64 tmp, _val = (val); \
arch/arm64/include/asm/kvm_asm.h+3−0
@@ -63,6 +63,7 @@ · 62 unmodified lines
6363 #define __KVM_HOST_SMCCC_FUNC___pkvm_cpu_set_vector 18
6464 #define __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize 19
6565 #define __KVM_HOST_SMCCC_FUNC___pkvm_mark_hyp 20
66+#define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc 21
6667
6768 #ifndef __ASSEMBLY__
6869
@@ -201,6 +202,8 @@ extern void __kvm_timer_set_cntvoff(u64 cntvoff); · 132 unmodified lines
201202
202203 extern int __kvm_vcpu_run(struct kvm_vcpu *vcpu);
203204
205+extern void __kvm_adjust_pc(struct kvm_vcpu *vcpu);
206+
204207 extern u64 __vgic_v3_get_gic_config(void);
205208 extern u64 __vgic_v3_read_vmcr(void);
206209 extern void __vgic_v3_write_vmcr(u32 vmcr);
arch/arm64/include/asm/kvm_emulate.h+5−0
@@ -463,4 +463,9 @@ static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu) · 462 unmodified lines
463463 vcpu->arch.flags |= KVM_ARM64_INCREMENT_PC;
464464 }
465465
466+static inline bool vcpu_has_feature(struct kvm_vcpu *vcpu, int feature)
467+{
468+ return test_bit(feature, vcpu->arch.features);
469+}
470+
466471 #endif /* __ARM64_KVM_EMULATE_H__ */
arch/arm64/kvm/arm.c+17−3
@@ -720,11 +720,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 719 unmodified lines
720720 return ret;
721721 }
722722
723− if (run->immediate_exit)
724− return -EINTR;
725−
726723 vcpu_load(vcpu);
727724
725+ if (run->immediate_exit) {
726+ ret = -EINTR;
727+ goto out;
728+ }
729+
728730 kvm_sigset_activate(vcpu);
729731
730732 ret = 1;
@@ -897,6 +899,18 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu) · 166 unmodified lines
897899
898900 kvm_sigset_deactivate(vcpu);
899901
902+out:
903+ /*
904+ * In the unlikely event that we are returning to userspace
905+ * with pending exceptions or PC adjustment, commit these
906+ * adjustments in order to give userspace a consistent view of
907+ * the vcpu state. Note that this relies on __kvm_adjust_pc()
908+ * being preempt-safe on VHE.
909+ */
910+ if (unlikely(vcpu->arch.flags & (KVM_ARM64_PENDING_EXCEPTION |
911+ KVM_ARM64_INCREMENT_PC)))
912+ kvm_call_hyp(__kvm_adjust_pc, vcpu);
913+
900914 vcpu_put(vcpu);
901915 return ret;
902916 }
arch/arm64/kvm/hyp/exception.c+17−1
@@ -296,7 +296,7 @@ static void enter_exception32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset) · 295 unmodified lines
296296 *vcpu_pc(vcpu) = vect_offset;
297297 }
298298
299−void kvm_inject_exception(struct kvm_vcpu *vcpu)
299+static void kvm_inject_exception(struct kvm_vcpu *vcpu)
300300 {
301301 if (vcpu_el1_is_32bit(vcpu)) {
302302 switch (vcpu->arch.flags & KVM_ARM64_EXCEPT_MASK) {
@@ -329,3 +329,19 @@ void kvm_inject_exception(struct kvm_vcpu *vcpu) · 26 unmodified lines
329329 }
330330 }
331331 }
332+
333+/*
334+ * Adjust the guest PC (and potentially exception state) depending on
335+ * flags provided by the emulation code.
336+ */
337+void __kvm_adjust_pc(struct kvm_vcpu *vcpu)
338+{
339+ if (vcpu->arch.flags & KVM_ARM64_PENDING_EXCEPTION) {
340+ kvm_inject_exception(vcpu);
341+ vcpu->arch.flags &= ~(KVM_ARM64_PENDING_EXCEPTION |
342+ KVM_ARM64_EXCEPT_MASK);
343+ } else if (vcpu->arch.flags & KVM_ARM64_INCREMENT_PC) {
344+ kvm_skip_instr(vcpu);
345+ vcpu->arch.flags &= ~KVM_ARM64_INCREMENT_PC;
346+ }
347+}
arch/arm64/kvm/hyp/include/hyp/adjust_pc.h+0−18
@@ -13,8 +13,6 @@ · 12 unmodified lines
1313 #include <asm/kvm_emulate.h>
1414 #include <asm/kvm_host.h>
1515
16−void kvm_inject_exception(struct kvm_vcpu *vcpu);
17−
1816 static inline void kvm_skip_instr(struct kvm_vcpu *vcpu)
1917 {
2018 if (vcpu_mode_is_32bit(vcpu)) {
@@ -43,22 +41,6 @@ static inline void __kvm_skip_instr(struct kvm_vcpu *vcpu) · 22 unmodified lines
4341 write_sysreg_el2(*vcpu_pc(vcpu), SYS_ELR);
4442 }
4543
46−/*
47− * Adjust the guest PC on entry, depending on flags provided by EL1
48− * for the purpose of emulation (MMIO, sysreg) or exception injection.
49− */
50−static inline void __adjust_pc(struct kvm_vcpu *vcpu)
51−{
52− if (vcpu->arch.flags & KVM_ARM64_PENDING_EXCEPTION) {
53− kvm_inject_exception(vcpu);
54− vcpu->arch.flags &= ~(KVM_ARM64_PENDING_EXCEPTION |
55− KVM_ARM64_EXCEPT_MASK);
56− } else if (vcpu->arch.flags & KVM_ARM64_INCREMENT_PC) {
57− kvm_skip_instr(vcpu);
58− vcpu->arch.flags &= ~KVM_ARM64_INCREMENT_PC;
59− }
60−}
61−
6244 /*
6345 * Skip an instruction while host sysregs are live.
6446 * Assumes host is always 64-bit.
arch/arm64/kvm/hyp/nvhe/hyp-main.c+8−0
@@ -28,6 +28,13 @@ static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt) · 27 unmodified lines
2828 cpu_reg(host_ctxt, 1) = __kvm_vcpu_run(kern_hyp_va(vcpu));
2929 }
3030
31+static void handle___kvm_adjust_pc(struct kvm_cpu_context *host_ctxt)
32+{
33+ DECLARE_REG(struct kvm_vcpu *, vcpu, host_ctxt, 1);
34+
35+ __kvm_adjust_pc(kern_hyp_va(vcpu));
36+}
37+
3138 static void handle___kvm_flush_vm_context(struct kvm_cpu_context *host_ctxt)
3239 {
3340 __kvm_flush_vm_context();
@@ -170,6 +177,7 @@ typedef void (*hcall_t)(struct kvm_cpu_context *); · 136 unmodified lines
170177
171178 static const hcall_t host_hcall[] = {
172179 HANDLE_FUNC(__kvm_vcpu_run),
180+ HANDLE_FUNC(__kvm_adjust_pc),
173181 HANDLE_FUNC(__kvm_flush_vm_context),
174182 HANDLE_FUNC(__kvm_tlb_flush_vmid_ipa),
175183 HANDLE_FUNC(__kvm_tlb_flush_vmid),
arch/arm64/kvm/hyp/nvhe/mem_protect.c+2−2
@@ -23,8 +23,8 @@ · 22 unmodified lines
2323 extern unsigned long hyp_nr_cpus;
2424 struct host_kvm host_kvm;
2525
26−struct hyp_pool host_s2_mem;
27−struct hyp_pool host_s2_dev;
26+static struct hyp_pool host_s2_mem;
27+static struct hyp_pool host_s2_dev;
2828
2929 /*
3030 * Copies of the host's CPU features registers holding sanitized values.
arch/arm64/kvm/hyp/nvhe/setup.c+1−1
@@ -17,7 +17,6 @@ · 16 unmodified lines
1717 #include <nvhe/trap_handler.h>
1818
1919 struct hyp_pool hpool;
20−struct kvm_pgtable_mm_ops pkvm_pgtable_mm_ops;
2120 unsigned long hyp_nr_cpus;
2221
2322 #define hyp_percpu_size ((unsigned long)__per_cpu_end - \
@@ -27,6 +26,7 @@ static void *vmemmap_base; · 3 unmodified lines
2726 static void *hyp_pgt_base;
2827 static void *host_s2_mem_pgt_base;
2928 static void *host_s2_dev_pgt_base;
29+static struct kvm_pgtable_mm_ops pkvm_pgtable_mm_ops;
3030
3131 static int divide_memory_pool(void *virt, unsigned long size)
3232 {
arch/arm64/kvm/hyp/nvhe/switch.c+1−2
@@ -4,7 +4,6 @@ · 3 unmodified lines
44 * Author: Marc Zyngier <marc.zyngier@arm.com>
55 */
66
7−#include <hyp/adjust_pc.h>
87 #include <hyp/switch.h>
98 #include <hyp/sysreg-sr.h>
109
@@ -201,7 +200,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu) · 190 unmodified lines
201200 */
202201 __debug_save_host_buffers_nvhe(vcpu);
203202
204− __adjust_pc(vcpu);
203+ __kvm_adjust_pc(vcpu);
205204
206205 /*
207206 * We must restore the 32-bit state before the sysregs, thanks
arch/arm64/kvm/hyp/vhe/switch.c+1−2
@@ -4,7 +4,6 @@ · 3 unmodified lines
44 * Author: Marc Zyngier <marc.zyngier@arm.com>
55 */
66
7−#include <hyp/adjust_pc.h>
87 #include <hyp/switch.h>
98
109 #include <linux/arm-smccc.h>
@@ -132,7 +131,7 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) · 121 unmodified lines
132131 __load_guest_stage2(vcpu->arch.hw_mmu);
133132 __activate_traps(vcpu);
134133
135− __adjust_pc(vcpu);
134+ __kvm_adjust_pc(vcpu);
136135
137136 sysreg_restore_guest_state_vhe(guest_ctxt);
138137 __debug_switch_to_guest(vcpu);
arch/arm64/kvm/mmu.c+6−6
@@ -1156,13 +1156,13 @@ out_unlock: · 1155 unmodified lines
11561156 bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
11571157 {
11581158 if (!kvm->arch.mmu.pgt)
1159− return 0;
1159+ return false;
11601160
11611161 __unmap_stage2_range(&kvm->arch.mmu, range->start << PAGE_SHIFT,
11621162 (range->end - range->start) << PAGE_SHIFT,
11631163 range->may_block);
11641164
1165− return 0;
1165+ return false;
11661166 }
11671167
11681168 bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
@@ -1170,7 +1170,7 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 1 unmodified line
11701170 kvm_pfn_t pfn = pte_pfn(range->pte);
11711171
11721172 if (!kvm->arch.mmu.pgt)
1173− return 0;
1173+ return false;
11741174
11751175 WARN_ON(range->end - range->start != 1);
11761176
@@ -1190,7 +1190,7 @@ bool kvm_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 13 unmodified lines
11901190 PAGE_SIZE, __pfn_to_phys(pfn),
11911191 KVM_PGTABLE_PROT_R, NULL);
11921192
1193− return 0;
1193+ return false;
11941194 }
11951195
11961196 bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
@@ -1200,7 +1200,7 @@ bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 3 unmodified lines
12001200 pte_t pte;
12011201
12021202 if (!kvm->arch.mmu.pgt)
1203− return 0;
1203+ return false;
12041204
12051205 WARN_ON(size != PAGE_SIZE && size != PMD_SIZE && size != PUD_SIZE);
12061206
@@ -1213,7 +1213,7 @@ bool kvm_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 6 unmodified lines
12131213 bool kvm_test_age_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
12141214 {
12151215 if (!kvm->arch.mmu.pgt)
1216− return 0;
1216+ return false;
12171217
12181218 return kvm_pgtable_stage2_is_young(kvm->arch.mmu.pgt,
12191219 range->start << PAGE_SHIFT);
arch/arm64/kvm/reset.c+24−4
@@ -166,6 +166,25 @@ static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu) · 165 unmodified lines
166166 return 0;
167167 }
168168
169+static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu)
170+{
171+ struct kvm_vcpu *tmp;
172+ bool is32bit;
173+ int i;
174+
175+ is32bit = vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT);
176+ if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1) && is32bit)
177+ return false;
178+
179+ /* Check that the vcpus are either all 32bit or all 64bit */
180+ kvm_for_each_vcpu(i, tmp, vcpu->kvm) {
181+ if (vcpu_has_feature(tmp, KVM_ARM_VCPU_EL1_32BIT) != is32bit)
182+ return false;
183+ }
184+
185+ return true;
186+}
187+
169188 /**
170189 * kvm_reset_vcpu - sets core registers and sys_regs to reset value
171190 * @vcpu: The VCPU pointer
@@ -217,13 +236,14 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) · 45 unmodified lines
217236 }
218237 }
219238
239+ if (!vcpu_allowed_register_width(vcpu)) {
240+ ret = -EINVAL;
241+ goto out;
242+ }
243+
220244 switch (vcpu->arch.target) {
221245 default:
222246 if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) {
223− if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1)) {
224− ret = -EINVAL;
225− goto out;
226− }
227247 pstate = VCPU_RESET_PSTATE_SVC;
228248 } else {
229249 pstate = VCPU_RESET_PSTATE_EL1;
arch/arm64/kvm/sys_regs.c+21−21
@@ -399,14 +399,14 @@ static bool trap_bvr(struct kvm_vcpu *vcpu, · 398 unmodified lines
399399 struct sys_reg_params *p,
400400 const struct sys_reg_desc *rd)
401401 {
402− u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
402+ u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm];
403403
404404 if (p->is_write)
405405 reg_to_dbg(vcpu, p, rd, dbg_reg);
406406 else
407407 dbg_to_reg(vcpu, p, rd, dbg_reg);
408408
409− trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
409+ trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
410410
411411 return true;
412412 }
@@ -414,7 +414,7 @@ static bool trap_bvr(struct kvm_vcpu *vcpu, · 1 unmodified line
414414 static int set_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
415415 const struct kvm_one_reg *reg, void __user *uaddr)
416416 {
417− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
417+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm];
418418
419419 if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
420420 return -EFAULT;
@@ -424,7 +424,7 @@ static int set_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
424424 static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
425425 const struct kvm_one_reg *reg, void __user *uaddr)
426426 {
427− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg];
427+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm];
428428
429429 if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
430430 return -EFAULT;
@@ -434,21 +434,21 @@ static int get_bvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
434434 static void reset_bvr(struct kvm_vcpu *vcpu,
435435 const struct sys_reg_desc *rd)
436436 {
437− vcpu->arch.vcpu_debug_state.dbg_bvr[rd->reg] = rd->val;
437+ vcpu->arch.vcpu_debug_state.dbg_bvr[rd->CRm] = rd->val;
438438 }
439439
440440 static bool trap_bcr(struct kvm_vcpu *vcpu,
441441 struct sys_reg_params *p,
442442 const struct sys_reg_desc *rd)
443443 {
444− u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
444+ u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm];
445445
446446 if (p->is_write)
447447 reg_to_dbg(vcpu, p, rd, dbg_reg);
448448 else
449449 dbg_to_reg(vcpu, p, rd, dbg_reg);
450450
451− trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
451+ trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
452452
453453 return true;
454454 }
@@ -456,7 +456,7 @@ static bool trap_bcr(struct kvm_vcpu *vcpu, · 1 unmodified line
456456 static int set_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
457457 const struct kvm_one_reg *reg, void __user *uaddr)
458458 {
459− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
459+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm];
460460
461461 if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
462462 return -EFAULT;
@@ -467,7 +467,7 @@ static int set_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 4 unmodified lines
467467 static int get_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
468468 const struct kvm_one_reg *reg, void __user *uaddr)
469469 {
470− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg];
470+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm];
471471
472472 if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
473473 return -EFAULT;
@@ -477,22 +477,22 @@ static int get_bcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
477477 static void reset_bcr(struct kvm_vcpu *vcpu,
478478 const struct sys_reg_desc *rd)
479479 {
480− vcpu->arch.vcpu_debug_state.dbg_bcr[rd->reg] = rd->val;
480+ vcpu->arch.vcpu_debug_state.dbg_bcr[rd->CRm] = rd->val;
481481 }
482482
483483 static bool trap_wvr(struct kvm_vcpu *vcpu,
484484 struct sys_reg_params *p,
485485 const struct sys_reg_desc *rd)
486486 {
487− u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
487+ u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm];
488488
489489 if (p->is_write)
490490 reg_to_dbg(vcpu, p, rd, dbg_reg);
491491 else
492492 dbg_to_reg(vcpu, p, rd, dbg_reg);
493493
494− trace_trap_reg(__func__, rd->reg, p->is_write,
495− vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg]);
494+ trace_trap_reg(__func__, rd->CRm, p->is_write,
495+ vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm]);
496496
497497 return true;
498498 }
@@ -500,7 +500,7 @@ static bool trap_wvr(struct kvm_vcpu *vcpu, · 1 unmodified line
500500 static int set_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
501501 const struct kvm_one_reg *reg, void __user *uaddr)
502502 {
503− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
503+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm];
504504
505505 if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
506506 return -EFAULT;
@@ -510,7 +510,7 @@ static int set_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
510510 static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
511511 const struct kvm_one_reg *reg, void __user *uaddr)
512512 {
513− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg];
513+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm];
514514
515515 if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
516516 return -EFAULT;
@@ -520,21 +520,21 @@ static int get_wvr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
520520 static void reset_wvr(struct kvm_vcpu *vcpu,
521521 const struct sys_reg_desc *rd)
522522 {
523− vcpu->arch.vcpu_debug_state.dbg_wvr[rd->reg] = rd->val;
523+ vcpu->arch.vcpu_debug_state.dbg_wvr[rd->CRm] = rd->val;
524524 }
525525
526526 static bool trap_wcr(struct kvm_vcpu *vcpu,
527527 struct sys_reg_params *p,
528528 const struct sys_reg_desc *rd)
529529 {
530− u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
530+ u64 *dbg_reg = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm];
531531
532532 if (p->is_write)
533533 reg_to_dbg(vcpu, p, rd, dbg_reg);
534534 else
535535 dbg_to_reg(vcpu, p, rd, dbg_reg);
536536
537− trace_trap_reg(__func__, rd->reg, p->is_write, *dbg_reg);
537+ trace_trap_reg(__func__, rd->CRm, p->is_write, *dbg_reg);
538538
539539 return true;
540540 }
@@ -542,7 +542,7 @@ static bool trap_wcr(struct kvm_vcpu *vcpu, · 1 unmodified line
542542 static int set_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
543543 const struct kvm_one_reg *reg, void __user *uaddr)
544544 {
545− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
545+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm];
546546
547547 if (copy_from_user(r, uaddr, KVM_REG_SIZE(reg->id)) != 0)
548548 return -EFAULT;
@@ -552,7 +552,7 @@ static int set_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
552552 static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd,
553553 const struct kvm_one_reg *reg, void __user *uaddr)
554554 {
555− __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg];
555+ __u64 *r = &vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm];
556556
557557 if (copy_to_user(uaddr, r, KVM_REG_SIZE(reg->id)) != 0)
558558 return -EFAULT;
@@ -562,7 +562,7 @@ static int get_wcr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd, · 3 unmodified lines
562562 static void reset_wcr(struct kvm_vcpu *vcpu,
563563 const struct sys_reg_desc *rd)
564564 {
565− vcpu->arch.vcpu_debug_state.dbg_wcr[rd->reg] = rd->val;
565+ vcpu->arch.vcpu_debug_state.dbg_wcr[rd->CRm] = rd->val;
566566 }
567567
568568 static void reset_amair_el1(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
arch/arm64/mm/mmu.c+2−1
@@ -515,7 +515,8 @@ static void __init map_mem(pgd_t *pgdp) · 514 unmodified lines
515515 */
516516 BUILD_BUG_ON(pgd_index(direct_map_end - 1) == pgd_index(direct_map_end));
517517
518− if (rodata_full || crash_mem_map || debug_pagealloc_enabled())
518+ if (rodata_full || crash_mem_map || debug_pagealloc_enabled() ||
519+ IS_ENABLED(CONFIG_KFENCE))
519520 flags |= NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS;
520521
521522 /*
arch/mips/alchemy/board-xxs1500.c+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <asm/reboot.h>
1919 #include <asm/setup.h>
2020 #include <asm/mach-au1x00/au1000.h>
21+#include <asm/mach-au1x00/gpio-au1000.h>
2122 #include <prom.h>
2223
2324 const char *get_system_type(void)
arch/mips/include/asm/mips-boards/launch.h+5−0
@@ -3,6 +3,9 @@ · 2 unmodified lines
33 *
44 */
55
6+#ifndef _ASM_MIPS_BOARDS_LAUNCH_H
7+#define _ASM_MIPS_BOARDS_LAUNCH_H
8+
69 #ifndef _ASSEMBLER_
710
811 struct cpulaunch {
@@ -34,3 +37,5 @@ struct cpulaunch { · 25 unmodified lines
3437
3538 /* Polling period in count cycles for secondary CPU's */
3639 #define LAUNCHPERIOD 10000
40+
41+#endif /* _ASM_MIPS_BOARDS_LAUNCH_H */
arch/mips/lib/mips-atomic.c+6−6
@@ -37,7 +37,7 @@ · 36 unmodified lines
3737 */
3838 notrace void arch_local_irq_disable(void)
3939 {
40− preempt_disable();
40+ preempt_disable_notrace();
4141
4242 __asm__ __volatile__(
4343 " .set push \n"
@@ -53,7 +53,7 @@ notrace void arch_local_irq_disable(void) · 9 unmodified lines
5353 : /* no inputs */
5454 : "memory");
5555
56− preempt_enable();
56+ preempt_enable_notrace();
5757 }
5858 EXPORT_SYMBOL(arch_local_irq_disable);
5959
@@ -61,7 +61,7 @@ notrace unsigned long arch_local_irq_save(void) · 1 unmodified line
6161 {
6262 unsigned long flags;
6363
64− preempt_disable();
64+ preempt_disable_notrace();
6565
6666 __asm__ __volatile__(
6767 " .set push \n"
@@ -78,7 +78,7 @@ notrace unsigned long arch_local_irq_save(void) · 10 unmodified lines
7878 : /* no inputs */
7979 : "memory");
8080
81− preempt_enable();
81+ preempt_enable_notrace();
8282
8383 return flags;
8484 }
@@ -88,7 +88,7 @@ notrace void arch_local_irq_restore(unsigned long flags) · 3 unmodified lines
8888 {
8989 unsigned long __tmp1;
9090
91− preempt_disable();
91+ preempt_disable_notrace();
9292
9393 __asm__ __volatile__(
9494 " .set push \n"
@@ -106,7 +106,7 @@ notrace void arch_local_irq_restore(unsigned long flags) · 11 unmodified lines
106106 : "0" (flags)
107107 : "memory");
108108
109− preempt_enable();
109+ preempt_enable_notrace();
110110 }
111111 EXPORT_SYMBOL(arch_local_irq_restore);
112112
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/mips/ralink/of.c+2−0
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <linux/io.h>
1010 #include <linux/clk.h>
11+#include <linux/export.h>
1112 #include <linux/init.h>
1213 #include <linux/sizes.h>
1314 #include <linux/of_fdt.h>
@@ -25,6 +26,7 @@ · 11 unmodified lines
2526
2627 __iomem void *rt_sysc_membase;
2728 __iomem void *rt_memc_membase;
29+EXPORT_SYMBOL_GPL(rt_sysc_membase);
2830
2931 __iomem void *plat_of_remap_node(const char *node)
3032 {
arch/powerpc/boot/dts/fsl/p1010si-post.dtsi+8−0
@@ -122,7 +122,15 @@ · 121 unmodified lines
122122 };
123123
124124 /include/ "pq3-i2c-0.dtsi"
125+ i2c@3000 {
126+ fsl,i2c-erratum-a004447;
127+ };
128+
125129 /include/ "pq3-i2c-1.dtsi"
130+ i2c@3100 {
131+ fsl,i2c-erratum-a004447;
132+ };
133+
126134 /include/ "pq3-duart-0.dtsi"
127135 /include/ "pq3-espi-0.dtsi"
128136 spi0: spi@7000 {
arch/powerpc/boot/dts/fsl/p2041si-post.dtsi+16−0
@@ -371,7 +371,23 @@ · 370 unmodified lines
371371 };
372372
373373 /include/ "qoriq-i2c-0.dtsi"
374+ i2c@118000 {
375+ fsl,i2c-erratum-a004447;
376+ };
377+
378+ i2c@118100 {
379+ fsl,i2c-erratum-a004447;
380+ };
381+
374382 /include/ "qoriq-i2c-1.dtsi"
383+ i2c@119000 {
384+ fsl,i2c-erratum-a004447;
385+ };
386+
387+ i2c@119100 {
388+ fsl,i2c-erratum-a004447;
389+ };
390+
375391 /include/ "qoriq-duart-0.dtsi"
376392 /include/ "qoriq-duart-1.dtsi"
377393 /include/ "qoriq-gpio-0.dtsi"
arch/powerpc/include/asm/jump_label.h+1−1
@@ -50,7 +50,7 @@ l_yes: · 49 unmodified lines
5050 1098: nop; \
5151 .pushsection __jump_table, "aw"; \
5252 .long 1098b - ., LABEL - .; \
53− FTR_ENTRY_LONG KEY; \
53+ FTR_ENTRY_LONG KEY - .; \
5454 .popsection
5555 #endif
5656
arch/powerpc/include/asm/kvm_host.h+1−0
@@ -51,6 +51,7 @@ · 50 unmodified lines
5151 /* PPC-specific vcpu->requests bit members */
5252 #define KVM_REQ_WATCHDOG KVM_ARCH_REQ(0)
5353 #define KVM_REQ_EPR_EXIT KVM_ARCH_REQ(1)
54+#define KVM_REQ_PENDING_TIMER KVM_ARCH_REQ(2)
5455
5556 #include <linux/mmu_notifier.h>
5657
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/kernel/signal_64.c+4−5
@@ -902,6 +902,10 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 901 unmodified lines
902902 unsafe_copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set), badframe_block);
903903 user_write_access_end();
904904
905+ /* Save the siginfo outside of the unsafe block. */
906+ if (copy_siginfo_to_user(&frame->info, &ksig->info))
907+ goto badframe;
908+
905909 /* Make sure signal handler doesn't get spurious FP exceptions */
906910 tsk->thread.fp_state.fpscr = 0;
907911
@@ -915,11 +919,6 @@ int handle_rt_signal64(struct ksignal *ksig, sigset_t *set, · 7 unmodified lines
915919 regs->nip = (unsigned long) &frame->tramp[0];
916920 }
917921
918−
919− /* Save the siginfo outside of the unsafe block. */
920− if (copy_siginfo_to_user(&frame->info, &ksig->info))
921− goto badframe;
922−
923922 /* Allocate a dummy caller frame for the signal handler. */
924923 newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
925924 err |= put_user(regs->gpr[1], (unsigned long __user *)newsp);
arch/powerpc/kvm/book3s_hv.c+1−2
@@ -3936,7 +3936,7 @@ static void kvmppc_vcore_blocked(struct kvmppc_vcore *vc) · 3935 unmodified lines
39363936 break;
39373937 }
39383938 cur = ktime_get();
3939− } while (single_task_running() && ktime_before(cur, stop));
3939+ } while (kvm_vcpu_can_poll(cur, stop));
39403940
39413941 spin_lock(&vc->lock);
39423942 vc->vcore_state = VCORE_INACTIVE;
@@ -4455,7 +4455,6 @@ static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu) · 512 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/powerpc/mm/mem.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <asm/machdep.h>
2121 #include <asm/rtas.h>
2222 #include <asm/kasan.h>
23+#include <asm/sparsemem.h>
2324 #include <asm/svm.h>
2425
2526 #include <mm/mmu_decl.h>
arch/powerpc/perf/core-book3s.c+1−1
@@ -2254,7 +2254,7 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs) · 2253 unmodified lines
22542254 bool use_siar = regs_use_siar(regs);
22552255 unsigned long siar = mfspr(SPRN_SIAR);
22562256
2257− if (ppmu->flags & PPMU_P10_DD1) {
2257+ if (ppmu && (ppmu->flags & PPMU_P10_DD1)) {
22582258 if (siar)
22592259 return siar;
22602260 else
arch/riscv/Kconfig+10−9
@@ -34,6 +34,7 @@ config RISCV · 33 unmodified lines
3434 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
3535 select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT
3636 select ARCH_SUPPORTS_HUGETLBFS if MMU
37+ select ARCH_USE_MEMTEST
3738 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
3839 select ARCH_WANT_FRAME_POINTERS
3940 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
@@ -60,11 +61,11 @@ config RISCV · 20 unmodified lines
6061 select GENERIC_TIME_VSYSCALL if MMU && 64BIT
6162 select HANDLE_DOMAIN_IRQ
6263 select HAVE_ARCH_AUDITSYSCALL
63− select HAVE_ARCH_JUMP_LABEL
64− 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
6566 select HAVE_ARCH_KASAN if MMU && 64BIT
6667 select HAVE_ARCH_KASAN_VMALLOC if MMU && 64BIT
67− select HAVE_ARCH_KGDB
68+ select HAVE_ARCH_KGDB if !XIP_KERNEL
6869 select HAVE_ARCH_KGDB_QXFER_PKT
6970 select HAVE_ARCH_MMAP_RND_BITS if MMU
7071 select HAVE_ARCH_SECCOMP_FILTER
@@ -79,9 +80,9 @@ config RISCV · 8 unmodified lines
7980 select HAVE_GCC_PLUGINS
8081 select HAVE_GENERIC_VDSO if MMU && 64BIT
8182 select HAVE_IRQ_TIME_ACCOUNTING
82− select HAVE_KPROBES
83− select HAVE_KPROBES_ON_FTRACE
84− 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
8586 select HAVE_PCI
8687 select HAVE_PERF_EVENTS
8788 select HAVE_PERF_REGS
@@ -230,11 +231,11 @@ config ARCH_RV64I · 142 unmodified lines
230231 bool "RV64I"
231232 select 64BIT
232233 select ARCH_SUPPORTS_INT128 if CC_HAS_INT128 && GCC_VERSION >= 50000
233− 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)
234235 select HAVE_DYNAMIC_FTRACE_WITH_REGS if HAVE_DYNAMIC_FTRACE
235− select HAVE_FTRACE_MCOUNT_RECORD
236+ select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
236237 select HAVE_FUNCTION_GRAPH_TRACER
237− select HAVE_FUNCTION_TRACER
238+ select HAVE_FUNCTION_TRACER if !XIP_KERNEL
238239 select SWIOTLB if MMU
239240
240241 endchoice
arch/riscv/Kconfig.socs+1−0
@@ -14,6 +14,7 @@ config SOC_SIFIVE · 13 unmodified lines
1414 select CLK_SIFIVE
1515 select CLK_SIFIVE_PRCI
1616 select SIFIVE_PLIC
17+ select RISCV_ERRATA_ALTERNATIVE
1718 select ERRATA_SIFIVE
1819 help
1920 This enables support for SiFive SoC platform hardware.
arch/riscv/Makefile+10−1
@@ -16,7 +16,7 @@ ifeq ($(CONFIG_DYNAMIC_FTRACE),y) · 15 unmodified lines
1616 CC_FLAGS_FTRACE := -fpatchable-function-entry=8
1717 endif
1818
19−ifeq ($(CONFIG_64BIT)$(CONFIG_CMODEL_MEDLOW),yy)
19+ifeq ($(CONFIG_CMODEL_MEDLOW),y)
2020 KBUILD_CFLAGS_MODULE += -mcmodel=medany
2121 endif
2222
@@ -38,6 +38,15 @@ else · 15 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/boot/dts/sifive/fu740-c000.dtsi+1−1
@@ -273,7 +273,7 @@ · 272 unmodified lines
273273 cache-size = <2097152>;
274274 cache-unified;
275275 interrupt-parent = <&plic0>;
276− interrupts = <19 20 21 22>;
276+ interrupts = <19 21 22 20>;
277277 reg = <0x0 0x2010000 0x0 0x1000>;
278278 };
279279 gpio: gpio@10060000 {
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/include/asm/kexec.h+2−2
@@ -42,8 +42,8 @@ struct kimage_arch { · 41 unmodified lines
4242 unsigned long fdt_addr;
4343 };
4444
45−const extern unsigned char riscv_kexec_relocate[];
46−const extern unsigned int riscv_kexec_relocate_size;
45+extern const unsigned char riscv_kexec_relocate[];
46+extern const unsigned int riscv_kexec_relocate_size;
4747
4848 typedef void (*riscv_kexec_method)(unsigned long first_ind_entry,
4949 unsigned long jump_addr,
arch/riscv/include/asm/pgtable.h+2−3
@@ -30,9 +30,8 @@ · 29 unmodified lines
3030
3131 #define BPF_JIT_REGION_SIZE (SZ_128M)
3232 #ifdef CONFIG_64BIT
33−/* KASLR should leave at least 128MB for BPF after the kernel */
34−#define BPF_JIT_REGION_START PFN_ALIGN((unsigned long)&_end)
35−#define BPF_JIT_REGION_END (BPF_JIT_REGION_START + BPF_JIT_REGION_SIZE)
33+#define BPF_JIT_REGION_START (BPF_JIT_REGION_END - BPF_JIT_REGION_SIZE)
34+#define BPF_JIT_REGION_END (MODULES_END)
3635 #else
3736 #define BPF_JIT_REGION_START (PAGE_OFFSET - BPF_JIT_REGION_SIZE)
3837 #define BPF_JIT_REGION_END (VMALLOC_END)
arch/riscv/kernel/machine_kexec.c+6−5
@@ -14,8 +14,9 @@ · 13 unmodified lines
1414 #include <asm/set_memory.h> /* For set_memory_x() */
1515 #include <linux/compiler.h> /* For unreachable() */
1616 #include <linux/cpu.h> /* For cpu_down() */
17+#include <linux/reboot.h>
1718
18−/**
19+/*
1920 * kexec_image_info - Print received image details
2021 */
2122 static void
@@ -39,7 +40,7 @@ kexec_image_info(const struct kimage *image) · 17 unmodified lines
3940 }
4041 }
4142
42−/**
43+/*
4344 * machine_kexec_prepare - Initialize kexec
4445 *
4546 * This function is called from do_kexec_load, when the user has
@@ -100,7 +101,7 @@ machine_kexec_prepare(struct kimage *image) · 54 unmodified lines
100101 }
101102
102103
103−/**
104+/*
104105 * machine_kexec_cleanup - Cleanup any leftovers from
105106 * machine_kexec_prepare
106107 *
@@ -135,7 +136,7 @@ void machine_shutdown(void) · 28 unmodified lines
135136 #endif
136137 }
137138
138−/**
139+/*
139140 * machine_crash_shutdown - Prepare to kexec after a kernel crash
140141 *
141142 * This function is called by crash_kexec just before machine_kexec
@@ -151,7 +152,7 @@ machine_crash_shutdown(struct pt_regs *regs) · 9 unmodified lines
151152 pr_info("Starting crashdump kernel...\n");
152153 }
153154
154−/**
155+/*
155156 * machine_kexec - Jump to the loaded kimage
156157 *
157158 * This function is called by kernel_kexec which is called by the
arch/riscv/kernel/probes/kprobes.c+2−0
@@ -84,6 +84,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) · 83 unmodified lines
8484 return 0;
8585 }
8686
87+#ifdef CONFIG_MMU
8788 void *alloc_insn_page(void)
8889 {
8990 return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END,
@@ -91,6 +92,7 @@ void *alloc_insn_page(void) · 1 unmodified line
9192 VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
9293 __builtin_return_address(0));
9394 }
95+#endif
9496
9597 /* install breakpoint in text */
9698 void __kprobes arch_arm_kprobe(struct kprobe *p)
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/stacktrace.c+7−7
@@ -27,10 +27,10 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, · 26 unmodified lines
2727 fp = frame_pointer(regs);
2828 sp = user_stack_pointer(regs);
2929 pc = instruction_pointer(regs);
30− } else if (task == NULL || task == current) {
31− fp = (unsigned long)__builtin_frame_address(0);
32− sp = sp_in_global;
33− pc = (unsigned long)walk_stackframe;
30+ } else if (task == current) {
31+ fp = (unsigned long)__builtin_frame_address(1);
32+ sp = (unsigned long)__builtin_frame_address(0);
33+ pc = (unsigned long)__builtin_return_address(0);
3434 } else {
3535 /* task blocked in __switch_to */
3636 fp = task->thread.s[0];
@@ -106,15 +106,15 @@ static bool print_trace_address(void *arg, unsigned long pc) · 69 unmodified lines
106106 return true;
107107 }
108108
109−void dump_backtrace(struct pt_regs *regs, struct task_struct *task,
109+noinline void dump_backtrace(struct pt_regs *regs, struct task_struct *task,
110110 const char *loglvl)
111111 {
112− pr_cont("%sCall Trace:\n", loglvl);
113112 walk_stackframe(task, regs, print_trace_address, (void *)loglvl);
114113 }
115114
116115 void show_stack(struct task_struct *task, unsigned long *sp, const char *loglvl)
117116 {
117+ pr_cont("%sCall Trace:\n", loglvl);
118118 dump_backtrace(NULL, task, loglvl);
119119 }
120120
@@ -139,7 +139,7 @@ unsigned long get_wchan(struct task_struct *task) · 18 unmodified lines
139139
140140 #ifdef CONFIG_STACKTRACE
141141
142−void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
142+noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
143143 struct task_struct *task, struct pt_regs *regs)
144144 {
145145 walk_stackframe(task, regs, consume_entry, cookie);
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/riscv/mm/kasan_init.c+5−5
@@ -169,7 +169,7 @@ static void __init kasan_shallow_populate(void *start, void *end) · 168 unmodified lines
169169
170170 void __init kasan_init(void)
171171 {
172− phys_addr_t _start, _end;
172+ phys_addr_t p_start, p_end;
173173 u64 i;
174174
175175 /*
@@ -189,9 +189,9 @@ void __init kasan_init(void) · 13 unmodified lines
189189 (void *)kasan_mem_to_shadow((void *)VMALLOC_END));
190190
191191 /* Populate the linear mapping */
192− for_each_mem_range(i, &_start, &_end) {
193− void *start = (void *)__va(_start);
194− void *end = (void *)__va(_end);
192+ for_each_mem_range(i, &p_start, &p_end) {
193+ void *start = (void *)__va(p_start);
194+ void *end = (void *)__va(p_end);
195195
196196 if (start >= end)
197197 break;
@@ -201,7 +201,7 @@ void __init kasan_init(void) · 3 unmodified lines
201201
202202 /* Populate kernel, BPF, modules mapping */
203203 kasan_populate(kasan_mem_to_shadow((const void *)MODULES_VADDR),
204− kasan_mem_to_shadow((const void *)BPF_JIT_REGION_END));
204+ kasan_mem_to_shadow((const void *)MODULES_VADDR + SZ_2G));
205205
206206 for (i = 0; i < PTRS_PER_PTE; i++)
207207 set_pte(&kasan_early_shadow_pte[i],
arch/s390/kernel/entry.S+2−2
@@ -651,9 +651,9 @@ ENDPROC(stack_overflow) · 650 unmodified lines
651651 .Lcleanup_sie_mcck:
652652 larl %r13,.Lsie_entry
653653 slgr %r9,%r13
654− larl %r13,.Lsie_skip
654+ lghi %r13,.Lsie_skip - .Lsie_entry
655655 clgr %r9,%r13
656− jh .Lcleanup_sie_int
656+ jhe .Lcleanup_sie_int
657657 oi __LC_CPU_FLAGS+7, _CIF_MCCK_GUEST
658658 .Lcleanup_sie_int:
659659 BPENTER __SF_SIE_FLAGS(%r15),(_TIF_ISOLATE_BP|_TIF_ISOLATE_BP_GUEST)
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+10−10
@@ -578,19 +578,19 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) · 577 unmodified lines
578578 * PKRU state is switched eagerly because it needs to be valid before we
579579 * return to userland e.g. for a copy_to_user() operation.
580580 */
581− if (current->mm) {
581+ if (!(current->flags & PF_KTHREAD)) {
582+ /*
583+ * If the PKRU bit in xsave.header.xfeatures is not set,
584+ * then the PKRU component was in init state, which means
585+ * XRSTOR will set PKRU to 0. If the bit is not set then
586+ * get_xsave_addr() will return NULL because the PKRU value
587+ * in memory is not valid. This means pkru_val has to be
588+ * set to 0 and not to init_pkru_value.
589+ */
582590 pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU);
583− if (pk)
584− pkru_val = pk->pkru;
591+ pkru_val = pk ? pk->pkru : 0;
585592 }
586593 __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();
594594 }
595595
596596 #endif /* _ASM_X86_FPU_INTERNAL_H */
arch/x86/include/asm/kvm-x86-ops.h+1−0
@@ -99,6 +99,7 @@ KVM_X86_OP_NULL(post_block) · 98 unmodified lines
9999 KVM_X86_OP_NULL(vcpu_blocking)
100100 KVM_X86_OP_NULL(vcpu_unblocking)
101101 KVM_X86_OP_NULL(update_pi_irte)
102+KVM_X86_OP_NULL(start_assignment)
102103 KVM_X86_OP_NULL(apicv_post_state_restore)
103104 KVM_X86_OP_NULL(dy_apicv_has_pending_interrupt)
104105 KVM_X86_OP_NULL(set_hv_timer)
arch/x86/include/asm/kvm_host.h+1−0
@@ -1352,6 +1352,7 @@ struct kvm_x86_ops { · 1351 unmodified lines
13521352
13531353 int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq,
13541354 uint32_t guest_irq, bool set);
1355+ void (*start_assignment)(struct kvm *kvm);
13551356 void (*apicv_post_state_restore)(struct kvm_vcpu *vcpu);
13561357 bool (*dy_apicv_has_pending_interrupt)(struct kvm_vcpu *vcpu);
13571358
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/cpu/sgx/virt.c+1−0
@@ -212,6 +212,7 @@ static int sgx_vepc_release(struct inode *inode, struct file *file) · 211 unmodified lines
212212 list_splice_tail(&secs_pages, &zombie_secs_pages);
213213 mutex_unlock(&zombie_secs_pages_lock);
214214
215+ xa_destroy(&vepc->page_array);
215216 kfree(vepc);
216217
217218 return 0;
arch/x86/kernel/fpu/signal.c+35−19
@@ -307,13 +307,17 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 306 unmodified lines
307307 return 0;
308308 }
309309
310− if (!access_ok(buf, size))
311− return -EACCES;
310+ if (!access_ok(buf, size)) {
311+ ret = -EACCES;
312+ goto out;
313+ }
312314
313− if (!static_cpu_has(X86_FEATURE_FPU))
314− return fpregs_soft_set(current, NULL,
315− 0, sizeof(struct user_i387_ia32_struct),
316− NULL, buf) != 0;
315+ if (!static_cpu_has(X86_FEATURE_FPU)) {
316+ ret = fpregs_soft_set(current, NULL, 0,
317+ sizeof(struct user_i387_ia32_struct),
318+ NULL, buf);
319+ goto out;
320+ }
317321
318322 if (use_xsave()) {
319323 struct _fpx_sw_bytes fx_sw_user;
@@ -369,6 +373,25 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 49 unmodified lines
369373 fpregs_unlock();
370374 return 0;
371375 }
376+
377+ /*
378+ * The above did an FPU restore operation, restricted to
379+ * the user portion of the registers, and failed, but the
380+ * microcode might have modified the FPU registers
381+ * nevertheless.
382+ *
383+ * If the FPU registers do not belong to current, then
384+ * invalidate the FPU register state otherwise the task might
385+ * preempt current and return to user space with corrupted
386+ * FPU registers.
387+ *
388+ * In case current owns the FPU registers then no further
389+ * action is required. The fixup below will handle it
390+ * correctly.
391+ */
392+ if (test_thread_flag(TIF_NEED_FPU_LOAD))
393+ __cpu_invalidate_fpregs_state();
394+
372395 fpregs_unlock();
373396 } else {
374397 /*
@@ -377,7 +400,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 2 unmodified lines
377400 */
378401 ret = __copy_from_user(&env, buf, sizeof(env));
379402 if (ret)
380− goto err_out;
403+ goto out;
381404 envp = &env;
382405 }
383406
@@ -405,16 +428,9 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 21 unmodified lines
405428 if (use_xsave() && !fx_only) {
406429 u64 init_bv = xfeatures_mask_user() & ~user_xfeatures;
407430
408− if (using_compacted_format()) {
409− ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx);
410− } else {
411− ret = __copy_from_user(&fpu->state.xsave, buf_fx, state_size);
412−
413− if (!ret && state_size > offsetof(struct xregs_state, header))
414− ret = validate_user_xstate_header(&fpu->state.xsave.header);
415− }
431+ ret = copy_user_to_xstate(&fpu->state.xsave, buf_fx);
416432 if (ret)
417− goto err_out;
433+ goto out;
418434
419435 sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures,
420436 fx_only);
@@ -434,7 +450,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 13 unmodified lines
434450 ret = __copy_from_user(&fpu->state.fxsave, buf_fx, state_size);
435451 if (ret) {
436452 ret = -EFAULT;
437− goto err_out;
453+ goto out;
438454 }
439455
440456 sanitize_restored_user_xstate(&fpu->state, envp, user_xfeatures,
@@ -452,7 +468,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 11 unmodified lines
452468 } else {
453469 ret = __copy_from_user(&fpu->state.fsave, buf_fx, state_size);
454470 if (ret)
455− goto err_out;
471+ goto out;
456472
457473 fpregs_lock();
458474 ret = copy_kernel_to_fregs_err(&fpu->state.fsave);
@@ -463,7 +479,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size) · 4 unmodified lines
463479 fpregs_deactivate(fpu);
464480 fpregs_unlock();
465481
466−err_out:
482+out:
467483 if (ret)
468484 fpu__clear_user_states(fpu);
469485 return ret;
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/cpuid.c+1−0
@@ -655,6 +655,7 @@ static int __do_cpuid_func_emulated(struct kvm_cpuid_array *array, u32 func) · 654 unmodified lines
655655 if (kvm_cpu_cap_has(X86_FEATURE_RDTSCP))
656656 entry->ecx = F(RDPID);
657657 ++array->nent;
658+ break;
658659 default:
659660 break;
660661 }
arch/x86/kvm/emulate.c+3−2
@@ -5111,7 +5111,7 @@ done: · 5110 unmodified lines
51115111 return rc;
51125112 }
51135113
5114−int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len)
5114+int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int emulation_type)
51155115 {
51165116 int rc = X86EMUL_CONTINUE;
51175117 int mode = ctxt->mode;
@@ -5322,7 +5322,8 @@ done_prefixes: · 204 unmodified lines
53225322
53235323 ctxt->execute = opcode.u.execute;
53245324
5325− if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD)))
5325+ if (unlikely(emulation_type & EMULTYPE_TRAP_UD) &&
5326+ likely(!(ctxt->d & EmulateOnUD)))
53265327 return EMULATION_FAILED;
53275328
53285329 if (unlikely(ctxt->d &
arch/x86/kvm/hyperv.c+8−0
@@ -1172,6 +1172,7 @@ void kvm_hv_invalidate_tsc_page(struct kvm *kvm) · 1171 unmodified lines
11721172 {
11731173 struct kvm_hv *hv = to_kvm_hv(kvm);
11741174 u64 gfn;
1175+ int idx;
11751176
11761177 if (hv->hv_tsc_page_status == HV_TSC_PAGE_BROKEN ||
11771178 hv->hv_tsc_page_status == HV_TSC_PAGE_UNSET ||
@@ -1190,9 +1191,16 @@ void kvm_hv_invalidate_tsc_page(struct kvm *kvm) · 12 unmodified lines
11901191 gfn = hv->hv_tsc_page >> HV_X64_MSR_TSC_REFERENCE_ADDRESS_SHIFT;
11911192
11921193 hv->tsc_ref.tsc_sequence = 0;
1194+
1195+ /*
1196+ * Take the srcu lock as memslots will be accessed to check the gfn
1197+ * cache generation against the memslots generation.
1198+ */
1199+ idx = srcu_read_lock(&kvm->srcu);
11931200 if (kvm_write_guest(kvm, gfn_to_gpa(gfn),
11941201 &hv->tsc_ref, sizeof(hv->tsc_ref.tsc_sequence)))
11951202 hv->hv_tsc_page_status = HV_TSC_PAGE_BROKEN;
1203+ srcu_read_unlock(&kvm->srcu, idx);
11961204
11971205 out_unlock:
11981206 mutex_unlock(&hv->hv_lock);
arch/x86/kvm/kvm_emulate.h+1−2
@@ -314,7 +314,6 @@ struct x86_emulate_ctxt { · 313 unmodified lines
314314 int interruptibility;
315315
316316 bool perm_ok; /* do not check permissions if true */
317− bool ud; /* inject an #UD if host doesn't support insn */
318317 bool tf; /* TF value before instruction (after for syscall/sysret) */
319318
320319 bool have_exception;
@@ -491,7 +490,7 @@ enum x86_intercept { · 170 unmodified lines
491490 #define X86EMUL_MODE_HOST X86EMUL_MODE_PROT64
492491 #endif
493492
494−int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len);
493+int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len, int emulation_type);
495494 bool x86_page_table_writing_insn(struct x86_emulate_ctxt *ctxt);
496495 #define EMULATION_FAILED -1
497496 #define EMULATION_OK 0
arch/x86/kvm/lapic.c+26−10
@@ -1410,6 +1410,9 @@ int kvm_lapic_reg_read(struct kvm_lapic *apic, u32 offset, int len, · 1409 unmodified lines
14101410 if (!apic_x2apic_mode(apic))
14111411 valid_reg_mask |= APIC_REG_MASK(APIC_ARBPRI);
14121412
1413+ if (alignment + len > 4)
1414+ return 1;
1415+
14131416 if (offset > 0x3f0 || !(valid_reg_mask & APIC_REG_MASK(offset)))
14141417 return 1;
14151418
@@ -1494,6 +1497,15 @@ static void limit_periodic_timer_frequency(struct kvm_lapic *apic) · 78 unmodified lines
14941497
14951498 static void cancel_hv_timer(struct kvm_lapic *apic);
14961499
1500+static void cancel_apic_timer(struct kvm_lapic *apic)
1501+{
1502+ hrtimer_cancel(&apic->lapic_timer.timer);
1503+ preempt_disable();
1504+ if (apic->lapic_timer.hv_timer_in_use)
1505+ cancel_hv_timer(apic);
1506+ preempt_enable();
1507+}
1508+
14971509 static void apic_update_lvtt(struct kvm_lapic *apic)
14981510 {
14991511 u32 timer_mode = kvm_lapic_get_reg(apic, APIC_LVTT) &
@@ -1502,11 +1514,7 @@ static void apic_update_lvtt(struct kvm_lapic *apic) · 2 unmodified lines
15021514 if (apic->lapic_timer.timer_mode != timer_mode) {
15031515 if (apic_lvtt_tscdeadline(apic) != (timer_mode ==
15041516 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();
1517+ cancel_apic_timer(apic);
15101518 kvm_lapic_set_reg(apic, APIC_TMICT, 0);
15111519 apic->lapic_timer.period = 0;
15121520 apic->lapic_timer.tscdeadline = 0;
@@ -1598,11 +1606,19 @@ static void __kvm_wait_lapic_expire(struct kvm_vcpu *vcpu) · 85 unmodified lines
15981606 guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc());
15991607 apic->lapic_timer.advance_expire_delta = guest_tsc - tsc_deadline;
16001608
1609+ if (lapic_timer_advance_dynamic) {
1610+ adjust_lapic_timer_advance(vcpu, apic->lapic_timer.advance_expire_delta);
1611+ /*
1612+ * If the timer fired early, reread the TSC to account for the
1613+ * overhead of the above adjustment to avoid waiting longer
1614+ * than is necessary.
1615+ */
1616+ if (guest_tsc < tsc_deadline)
1617+ guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc());
1618+ }
1619+
16011620 if (guest_tsc < tsc_deadline)
16021621 __wait_lapic_expire(vcpu, tsc_deadline - guest_tsc);
1603−
1604− if (lapic_timer_advance_dynamic)
1605− adjust_lapic_timer_advance(vcpu, apic->lapic_timer.advance_expire_delta);
16061622 }
16071623
16081624 void kvm_wait_lapic_expire(struct kvm_vcpu *vcpu)
@@ -1661,7 +1677,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn) · 52 unmodified lines
16611677 }
16621678
16631679 atomic_inc(&apic->lapic_timer.pending);
1664− kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu);
1680+ kvm_make_request(KVM_REQ_UNBLOCK, vcpu);
16651681 if (from_timer_fn)
16661682 kvm_vcpu_kick(vcpu);
16671683 }
@@ -2084,7 +2100,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) · 416 unmodified lines
20842100 if (apic_lvtt_tscdeadline(apic))
20852101 break;
20862102
2087− hrtimer_cancel(&apic->lapic_timer.timer);
2103+ cancel_apic_timer(apic);
20882104 kvm_lapic_set_reg(apic, APIC_TMICT, val);
20892105 start_apic_timer(apic);
20902106 break;
arch/x86/kvm/mmu/mmu.c+25−1
@@ -4739,9 +4739,33 @@ static void init_kvm_softmmu(struct kvm_vcpu *vcpu) · 4738 unmodified lines
47394739 context->inject_page_fault = kvm_inject_page_fault;
47404740 }
47414741
4742+static union kvm_mmu_role kvm_calc_nested_mmu_role(struct kvm_vcpu *vcpu)
4743+{
4744+ union kvm_mmu_role role = kvm_calc_shadow_root_page_role_common(vcpu, false);
4745+
4746+ /*
4747+ * Nested MMUs are used only for walking L2's gva->gpa, they never have
4748+ * shadow pages of their own and so "direct" has no meaning. Set it
4749+ * to "true" to try to detect bogus usage of the nested MMU.
4750+ */
4751+ role.base.direct = true;
4752+
4753+ if (!is_paging(vcpu))
4754+ role.base.level = 0;
4755+ else if (is_long_mode(vcpu))
4756+ role.base.level = is_la57_mode(vcpu) ? PT64_ROOT_5LEVEL :
4757+ PT64_ROOT_4LEVEL;
4758+ else if (is_pae(vcpu))
4759+ role.base.level = PT32E_ROOT_LEVEL;
4760+ else
4761+ role.base.level = PT32_ROOT_LEVEL;
4762+
4763+ return role;
4764+}
4765+
47424766 static void init_kvm_nested_mmu(struct kvm_vcpu *vcpu)
47434767 {
4744− union kvm_mmu_role new_role = kvm_calc_mmu_role_common(vcpu, false);
4768+ union kvm_mmu_role new_role = kvm_calc_nested_mmu_role(vcpu);
47454769 struct kvm_mmu *g_context = &vcpu->arch.nested_mmu;
47464770
47474771 if (new_role.as_u64 == g_context->mmu_role.as_u64)
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/mmu/tdp_mmu.c+3−3
@@ -1192,9 +1192,9 @@ bool kvm_tdp_mmu_set_spte_gfn(struct kvm *kvm, struct kvm_gfn_range *range) · 1191 unmodified lines
11921192 }
11931193
11941194 /*
1195− * Remove write access from all the SPTEs mapping GFNs [start, end). If
1196− * skip_4k is set, SPTEs that map 4k pages, will not be write-protected.
1197− * Returns true if an SPTE has been changed and the TLBs need to be flushed.
1195+ * Remove write access from all SPTEs at or above min_level that map GFNs
1196+ * [start, end). Returns true if an SPTE has been changed and the TLBs need to
1197+ * be flushed.
11981198 */
11991199 static bool wrprot_gfn_range(struct kvm *kvm, struct kvm_mmu_page *root,
12001200 gfn_t start, gfn_t end, int min_level)
arch/x86/kvm/svm/avic.c+5−7
@@ -28,10 +28,8 @@ · 27 unmodified lines
2828 #include "svm.h"
2929
3030 /* enable / disable AVIC */
31−int avic;
32−#ifdef CONFIG_X86_LOCAL_APIC
33−module_param(avic, int, S_IRUGO);
34−#endif
31+bool avic;
32+module_param(avic, bool, S_IRUGO);
3533
3634 #define SVM_AVIC_DOORBELL 0xc001011b
3735
@@ -223,7 +221,7 @@ static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, · 185 unmodified lines
223221 return &avic_physical_id_table[index];
224222 }
225223
226−/**
224+/*
227225 * Note:
228226 * AVIC hardware walks the nested page table to check permissions,
229227 * but does not use the SPA address specified in the leaf page
@@ -766,7 +764,7 @@ out: · 536 unmodified lines
766764 return ret;
767765 }
768766
769−/**
767+/*
770768 * Note:
771769 * The HW cannot support posting multicast/broadcast
772770 * interrupts to a vCPU. So, we still use legacy interrupt
@@ -1007,7 +1005,7 @@ void avic_vcpu_put(struct kvm_vcpu *vcpu) · 234 unmodified lines
10071005 WRITE_ONCE(*(svm->avic_physical_id_cache), entry);
10081006 }
10091007
1010−/**
1008+/*
10111009 * This function is called during VCPU halt/unhalt.
10121010 */
10131011 static void avic_set_running(struct kvm_vcpu *vcpu, bool is_run)
arch/x86/kvm/svm/sev.c+17−9
@@ -199,9 +199,19 @@ static void sev_asid_free(struct kvm_sev_info *sev) · 198 unmodified lines
199199 sev->misc_cg = NULL;
200200 }
201201
202−static void sev_unbind_asid(struct kvm *kvm, unsigned int handle)
202+static void sev_decommission(unsigned int handle)
203203 {
204204 struct sev_data_decommission decommission;
205+
206+ if (!handle)
207+ return;
208+
209+ decommission.handle = handle;
210+ sev_guest_decommission(&decommission, NULL);
211+}
212+
213+static void sev_unbind_asid(struct kvm *kvm, unsigned int handle)
214+{
205215 struct sev_data_deactivate deactivate;
206216
207217 if (!handle)
@@ -214,9 +224,7 @@ static void sev_unbind_asid(struct kvm *kvm, unsigned int handle) · 6 unmodified lines
214224 sev_guest_deactivate(&deactivate, NULL);
215225 up_read(&sev_deactivate_lock);
216226
217− /* decommission handle */
218− decommission.handle = handle;
219− sev_guest_decommission(&decommission, NULL);
227+ sev_decommission(handle);
220228 }
221229
222230 static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
@@ -341,8 +349,10 @@ static int sev_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp) · 118 unmodified lines
341349
342350 /* Bind ASID to this guest */
343351 ret = sev_bind_asid(kvm, start.handle, error);
344− if (ret)
352+ if (ret) {
353+ sev_decommission(start.handle);
345354 goto e_free_session;
355+ }
346356
347357 /* return handle to userspace */
348358 params.handle = start.handle;
@@ -1103,10 +1113,9 @@ __sev_send_start_query_session_length(struct kvm *kvm, struct kvm_sev_cmd *argp, · 754 unmodified lines
11031113 struct sev_data_send_start data;
11041114 int ret;
11051115
1116+ memset(&data, 0, sizeof(data));
11061117 data.handle = sev->handle;
11071118 ret = sev_issue_cmd(kvm, SEV_CMD_SEND_START, &data, &argp->error);
1108− if (ret < 0)
1109− return ret;
11101119
11111120 params->session_len = data.session_len;
11121121 if (copy_to_user((void __user *)(uintptr_t)argp->data, params,
@@ -1215,10 +1224,9 @@ __sev_send_update_data_query_lengths(struct kvm *kvm, struct kvm_sev_cmd *argp, · 102 unmodified lines
12151224 struct sev_data_send_update_data data;
12161225 int ret;
12171226
1227+ memset(&data, 0, sizeof(data));
12181228 data.handle = sev->handle;
12191229 ret = sev_issue_cmd(kvm, SEV_CMD_SEND_UPDATE_DATA, &data, &argp->error);
1220− if (ret < 0)
1221− return ret;
12221230
12231231 params->hdr_len = data.hdr_len;
12241232 params->trans_len = data.trans_len;
arch/x86/kvm/svm/svm.c+1−3
@@ -1010,9 +1010,7 @@ static __init int svm_hardware_setup(void) · 1009 unmodified lines
10101010 }
10111011
10121012 if (avic) {
1013− if (!npt_enabled ||
1014− !boot_cpu_has(X86_FEATURE_AVIC) ||
1015− !IS_ENABLED(CONFIG_X86_LOCAL_APIC)) {
1013+ if (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC)) {
10161014 avic = false;
10171015 } else {
10181016 pr_info("AVIC enabled\n");
arch/x86/kvm/svm/svm.h+1−1
@@ -480,7 +480,7 @@ extern struct kvm_x86_nested_ops svm_nested_ops; · 479 unmodified lines
480480
481481 #define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL
482482
483−extern int avic;
483+extern bool avic;
484484
485485 static inline void avic_update_vapic_bar(struct vcpu_svm *svm, u64 data)
486486 {
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/vmx/capabilities.h+1−2
@@ -90,8 +90,7 @@ static inline bool cpu_has_vmx_preemption_timer(void) · 89 unmodified lines
9090
9191 static inline bool cpu_has_vmx_posted_intr(void)
9292 {
93− return IS_ENABLED(CONFIG_X86_LOCAL_APIC) &&
94− vmcs_config.pin_based_exec_ctrl & PIN_BASED_POSTED_INTR;
93+ return vmcs_config.pin_based_exec_ctrl & PIN_BASED_POSTED_INTR;
9594 }
9695
9796 static inline bool cpu_has_load_ia32_efer(void)
arch/x86/kvm/vmx/posted_intr.c+14−0
@@ -237,6 +237,20 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) · 236 unmodified lines
237237 }
238238
239239
240+/*
241+ * Bail out of the block loop if the VM has an assigned
242+ * device, but the blocking vCPU didn't reconfigure the
243+ * PI.NV to the wakeup vector, i.e. the assigned device
244+ * came along after the initial check in pi_pre_block().
245+ */
246+void vmx_pi_start_assignment(struct kvm *kvm)
247+{
248+ if (!irq_remapping_cap(IRQ_POSTING_CAP))
249+ return;
250+
251+ kvm_make_all_cpus_request(kvm, KVM_REQ_UNBLOCK);
252+}
253+
240254 /*
241255 * pi_update_irte - set IRTE for Posted-Interrupts
242256 *
arch/x86/kvm/vmx/posted_intr.h+1−0
@@ -95,5 +95,6 @@ void __init pi_init_cpu(int cpu); · 94 unmodified lines
9595 bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu);
9696 int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq,
9797 bool set);
98+void vmx_pi_start_assignment(struct kvm *kvm);
9899
99100 #endif /* __KVM_X86_VMX_POSTED_INTR_H */
arch/x86/kvm/vmx/vmx.c+4−3
@@ -4843,7 +4843,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 4842 unmodified lines
48434843 struct vcpu_vmx *vmx = to_vmx(vcpu);
48444844 struct kvm_run *kvm_run = vcpu->run;
48454845 u32 intr_info, ex_no, error_code;
4846− unsigned long cr2, rip, dr6;
4846+ unsigned long cr2, dr6;
48474847 u32 vect_info;
48484848
48494849 vect_info = vmx->idt_vectoring_info;
@@ -4933,8 +4933,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu) · 83 unmodified lines
49334933 vmx->vcpu.arch.event_exit_inst_len =
49344934 vmcs_read32(VM_EXIT_INSTRUCTION_LEN);
49354935 kvm_run->exit_reason = KVM_EXIT_DEBUG;
4936− rip = kvm_rip_read(vcpu);
4937− kvm_run->debug.arch.pc = vmcs_readl(GUEST_CS_BASE) + rip;
4936+ kvm_run->debug.arch.pc = kvm_get_linear_rip(vcpu);
49384937 kvm_run->debug.arch.exception = ex_no;
49394938 break;
49404939 case AC_VECTOR:
@@ -6248,6 +6247,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu) · 1307 unmodified lines
62486247 switch (kvm_get_apic_mode(vcpu)) {
62496248 case LAPIC_MODE_INVALID:
62506249 WARN_ONCE(true, "Invalid local APIC state");
6250+ break;
62516251 case LAPIC_MODE_DISABLED:
62526252 break;
62536253 case LAPIC_MODE_XAPIC:
@@ -7721,6 +7721,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = { · 1467 unmodified lines
77217721 .nested_ops = &vmx_nested_ops,
77227722
77237723 .update_pi_irte = pi_update_irte,
7724+ .start_assignment = vmx_pi_start_assignment,
77247725
77257726 #ifdef CONFIG_X86_64
77267727 .set_hv_timer = vmx_set_hv_timer,
arch/x86/kvm/x86.c+37−15
@@ -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,10 +3114,14 @@ 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);
3123+ } else {
3124+ st->preempted = 0;
31083125 }
31093126
31103127 vcpu->arch.st.preempted = 0;
@@ -7089,7 +7106,10 @@ static unsigned emulator_get_hflags(struct x86_emulate_ctxt *ctxt) · 3978 unmodified lines
70897106
70907107 static void emulator_set_hflags(struct x86_emulate_ctxt *ctxt, unsigned emul_flags)
70917108 {
7092− emul_to_vcpu(ctxt)->arch.hflags = emul_flags;
7109+ struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt);
7110+
7111+ vcpu->arch.hflags = emul_flags;
7112+ kvm_mmu_reset_context(vcpu);
70937113 }
70947114
70957115 static int emulator_pre_leave_smm(struct x86_emulate_ctxt *ctxt,
@@ -7226,6 +7246,11 @@ static void init_emulate_ctxt(struct kvm_vcpu *vcpu) · 130 unmodified lines
72267246 BUILD_BUG_ON(HF_SMM_MASK != X86EMUL_SMM_MASK);
72277247 BUILD_BUG_ON(HF_SMM_INSIDE_NMI_MASK != X86EMUL_SMM_INSIDE_NMI_MASK);
72287248
7249+ ctxt->interruptibility = 0;
7250+ ctxt->have_exception = false;
7251+ ctxt->exception.vector = -1;
7252+ ctxt->perm_ok = false;
7253+
72297254 init_decode_cache(ctxt);
72307255 vcpu->arch.emulate_regs_need_sync_from_vcpu = false;
72317256 }
@@ -7561,14 +7586,7 @@ int x86_decode_emulated_instruction(struct kvm_vcpu *vcpu, int emulation_type, · 329 unmodified lines
75617586 kvm_vcpu_check_breakpoint(vcpu, &r))
75627587 return r;
75637588
7564− ctxt->interruptibility = 0;
7565− ctxt->have_exception = false;
7566− ctxt->exception.vector = -1;
7567− ctxt->perm_ok = false;
7568−
7569− ctxt->ud = emulation_type & EMULTYPE_TRAP_UD;
7570−
7571− r = x86_decode_insn(ctxt, insn, insn_len);
7589+ r = x86_decode_insn(ctxt, insn, insn_len, emulation_type);
75727590
75737591 trace_kvm_emulate_insn_start(vcpu);
75747592 ++vcpu->stat.insn_emulation;
@@ -8243,6 +8261,7 @@ void kvm_arch_exit(void) · 668 unmodified lines
82438261 kvm_x86_ops.hardware_enable = NULL;
82448262 kvm_mmu_module_exit();
82458263 free_percpu(user_return_msrs);
8264+ kmem_cache_destroy(x86_emulator_cache);
82468265 kmem_cache_destroy(x86_fpu_cache);
82478266 #ifdef CONFIG_KVM_XEN
82488267 static_key_deferred_flush(&kvm_xen_enabled);
@@ -8360,6 +8379,9 @@ static void kvm_sched_yield(struct kvm_vcpu *vcpu, unsigned long dest_id) · 111 unmodified lines
83608379
83618380 vcpu->stat.directed_yield_attempted++;
83628381
8382+ if (single_task_running())
8383+ goto no_yield;
8384+
83638385 rcu_read_lock();
83648386 map = rcu_dereference(vcpu->kvm->arch.apic_map);
83658387
@@ -9496,7 +9518,7 @@ static int vcpu_run(struct kvm_vcpu *vcpu) · 1130 unmodified lines
94969518 if (r <= 0)
94979519 break;
94989520
9499− kvm_clear_request(KVM_REQ_PENDING_TIMER, vcpu);
9521+ kvm_clear_request(KVM_REQ_UNBLOCK, vcpu);
95009522 if (kvm_cpu_has_pending_timer(vcpu))
95019523 kvm_inject_pending_timer_irqs(vcpu);
95029524
@@ -10115,8 +10137,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, · 612 unmodified lines
1011510137 kvm_update_dr7(vcpu);
1011610138
1011710139 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
10118− vcpu->arch.singlestep_rip = kvm_rip_read(vcpu) +
10119− get_segment_base(vcpu, VCPU_SREG_CS);
10140+ vcpu->arch.singlestep_rip = kvm_get_linear_rip(vcpu);
1012010141
1012110142 /*
1012210143 * Trigger an rflags update that will inject or remove the trace
@@ -11499,7 +11520,8 @@ bool kvm_arch_can_dequeue_async_page_present(struct kvm_vcpu *vcpu) · 1376 unmodified lines
1149911520
1150011521 void kvm_arch_start_assignment(struct kvm *kvm)
1150111522 {
11502− atomic_inc(&kvm->arch.assigned_device_count);
11523+ if (atomic_inc_return(&kvm->arch.assigned_device_count) == 1)
11524+ static_call_cond(kvm_x86_start_assignment)(kvm);
1150311525 }
1150411526 EXPORT_SYMBOL_GPL(kvm_arch_start_assignment);
1150511527
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/ioremap.c+3−1
@@ -118,7 +118,9 @@ static void __ioremap_check_other(resource_size_t addr, struct ioremap_desc *des · 117 unmodified lines
118118 if (!IS_ENABLED(CONFIG_EFI))
119119 return;
120120
121− if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA)
121+ if (efi_mem_type(addr) == EFI_RUNTIME_SERVICES_DATA ||
122+ (efi_mem_type(addr) == EFI_BOOT_SERVICES_DATA &&
123+ efi_mem_attributes(addr) & EFI_MEMORY_RUNTIME))
122124 desc->flags |= IORES_MAP_ENCRYPTED;
123125 }
124126
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/mm/numa.c+7−1
@@ -254,7 +254,13 @@ int __init numa_cleanup_meminfo(struct numa_meminfo *mi) · 253 unmodified lines
254254
255255 /* make sure all non-reserved blocks are inside the limits */
256256 bi->start = max(bi->start, low);
257− bi->end = min(bi->end, high);
257+
258+ /* preserve info for non-RAM areas above 'max_pfn': */
259+ if (bi->end > high) {
260+ numa_add_memblk_to(bi->nid, high, bi->end,
261+ &numa_reserved_meminfo);
262+ bi->end = high;
263+ }
258264
259265 /* and there's no empty block */
260266 if (bi->start >= bi->end)
arch/x86/pci/fixup.c+44−0
@@ -779,4 +779,48 @@ DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1571, pci_amd_enable_64bit_bar); · 778 unmodified lines
779779 DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x15b1, pci_amd_enable_64bit_bar);
780780 DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1601, pci_amd_enable_64bit_bar);
781781
782+#define RS690_LOWER_TOP_OF_DRAM2 0x30
783+#define RS690_LOWER_TOP_OF_DRAM2_VALID 0x1
784+#define RS690_UPPER_TOP_OF_DRAM2 0x31
785+#define RS690_HTIU_NB_INDEX 0xA8
786+#define RS690_HTIU_NB_INDEX_WR_ENABLE 0x100
787+#define RS690_HTIU_NB_DATA 0xAC
788+
789+/*
790+ * Some BIOS implementations support RAM above 4GB, but do not configure the
791+ * PCI host to respond to bus master accesses for these addresses. These
792+ * implementations set the TOP_OF_DRAM_SLOT1 register correctly, so PCI DMA
793+ * works as expected for addresses below 4GB.
794+ *
795+ * Reference: "AMD RS690 ASIC Family Register Reference Guide" (pg. 2-57)
796+ * https://www.amd.com/system/files/TechDocs/43372_rs690_rrg_3.00o.pdf
797+ */
798+static void rs690_fix_64bit_dma(struct pci_dev *pdev)
799+{
800+ u32 val = 0;
801+ phys_addr_t top_of_dram = __pa(high_memory - 1) + 1;
802+
803+ if (top_of_dram <= (1ULL << 32))
804+ return;
805+
806+ pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX,
807+ RS690_LOWER_TOP_OF_DRAM2);
808+ pci_read_config_dword(pdev, RS690_HTIU_NB_DATA, &val);
809+
810+ if (val)
811+ return;
812+
813+ pci_info(pdev, "Adjusting top of DRAM to %pa for 64-bit DMA support\n", &top_of_dram);
814+
815+ pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX,
816+ RS690_UPPER_TOP_OF_DRAM2 | RS690_HTIU_NB_INDEX_WR_ENABLE);
817+ pci_write_config_dword(pdev, RS690_HTIU_NB_DATA, top_of_dram >> 32);
818+
819+ pci_write_config_dword(pdev, RS690_HTIU_NB_INDEX,
820+ RS690_LOWER_TOP_OF_DRAM2 | RS690_HTIU_NB_INDEX_WR_ENABLE);
821+ pci_write_config_dword(pdev, RS690_HTIU_NB_DATA,
822+ top_of_dram | RS690_LOWER_TOP_OF_DRAM2_VALID);
823+}
824+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7910, rs690_fix_64bit_dma);
825+
782826 #endif
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/acpi_apd.c+1−0
@@ -226,6 +226,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { · 225 unmodified lines
226226 { "AMDI0010", APD_ADDR(wt_i2c_desc) },
227227 { "AMD0020", APD_ADDR(cz_uart_desc) },
228228 { "AMDI0020", APD_ADDR(cz_uart_desc) },
229+ { "AMDI0022", APD_ADDR(cz_uart_desc) },
229230 { "AMD0030", },
230231 { "AMD0040", APD_ADDR(fch_misc_desc)},
231232 { "HYGO0010", APD_ADDR(wt_i2c_desc) },
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/internal.h+2−2
@@ -134,7 +134,7 @@ int acpi_power_init(void); · 133 unmodified lines
134134 void acpi_power_resources_list_free(struct list_head *list);
135135 int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
136136 struct list_head *list);
137−int acpi_add_power_resource(acpi_handle handle);
137+struct acpi_device *acpi_add_power_resource(acpi_handle handle);
138138 void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
139139 int acpi_power_wakeup_list_init(struct list_head *list, int *system_level);
140140 int acpi_device_sleep_wake(struct acpi_device *dev,
@@ -142,7 +142,7 @@ int acpi_device_sleep_wake(struct acpi_device *dev, · 1 unmodified line
142142 int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
143143 int acpi_power_on_resources(struct acpi_device *device, int state);
144144 int acpi_power_transition(struct acpi_device *device, int state);
145−void acpi_turn_off_unused_power_resources(void);
145+void acpi_turn_off_unused_power_resources(bool init);
146146
147147 /* --------------------------------------------------------------------------
148148 Device Power Management
drivers/acpi/power.c+46−13
@@ -52,6 +52,7 @@ struct acpi_power_resource { · 51 unmodified lines
5252 u32 system_level;
5353 u32 order;
5454 unsigned int ref_count;
55+ unsigned int users;
5556 bool wakeup_enabled;
5657 struct mutex resource_lock;
5758 struct list_head dependents;
@@ -147,6 +148,7 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, · 89 unmodified lines
147148
148149 for (i = start; i < package->package.count; i++) {
149150 union acpi_object *element = &package->package.elements[i];
151+ struct acpi_device *rdev;
150152 acpi_handle rhandle;
151153
152154 if (element->type != ACPI_TYPE_LOCAL_REFERENCE) {
@@ -163,13 +165,16 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start, · 10 unmodified lines
163165 if (acpi_power_resource_is_dup(package, start, i))
164166 continue;
165167
166− err = acpi_add_power_resource(rhandle);
167− if (err)
168+ rdev = acpi_add_power_resource(rhandle);
169+ if (!rdev) {
170+ err = -ENODEV;
168171 break;
169−
172+ }
170173 err = acpi_power_resources_list_add(rhandle, list);
171174 if (err)
172175 break;
176+
177+ to_power_resource(rdev)->users++;
173178 }
174179 if (err)
175180 acpi_power_resources_list_free(list);
@@ -907,7 +912,7 @@ static void acpi_power_add_resource_to_list(struct acpi_power_resource *resource · 731 unmodified lines
907912 mutex_unlock(&power_resource_list_lock);
908913 }
909914
910−int acpi_add_power_resource(acpi_handle handle)
915+struct acpi_device *acpi_add_power_resource(acpi_handle handle)
911916 {
912917 struct acpi_power_resource *resource;
913918 struct acpi_device *device = NULL;
@@ -918,11 +923,11 @@ int acpi_add_power_resource(acpi_handle handle) · 4 unmodified lines
918923
919924 acpi_bus_get_device(handle, &device);
920925 if (device)
921− return 0;
926+ return device;
922927
923928 resource = kzalloc(sizeof(*resource), GFP_KERNEL);
924929 if (!resource)
925− return -ENOMEM;
930+ return NULL;
926931
927932 device = &resource->device;
928933 acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER);
@@ -959,11 +964,11 @@ int acpi_add_power_resource(acpi_handle handle) · 30 unmodified lines
959964
960965 acpi_power_add_resource_to_list(resource);
961966 acpi_device_add_finalize(device);
962− return 0;
967+ return device;
963968
964969 err:
965970 acpi_release_power_resource(&device->dev);
966− return result;
971+ return NULL;
967972 }
968973
969974 #ifdef CONFIG_ACPI_SLEEP
@@ -997,7 +1002,38 @@ void acpi_resume_power_resources(void) · 27 unmodified lines
9971002 }
9981003 #endif
9991004
1000−void acpi_turn_off_unused_power_resources(void)
1005+static void acpi_power_turn_off_if_unused(struct acpi_power_resource *resource,
1006+ bool init)
1007+{
1008+ if (resource->ref_count > 0)
1009+ return;
1010+
1011+ if (init) {
1012+ if (resource->users > 0)
1013+ return;
1014+ } else {
1015+ int result, state;
1016+
1017+ result = acpi_power_get_state(resource->device.handle, &state);
1018+ if (result || state == ACPI_POWER_RESOURCE_STATE_OFF)
1019+ return;
1020+ }
1021+
1022+ dev_info(&resource->device.dev, "Turning OFF\n");
1023+ __acpi_power_off(resource);
1024+}
1025+
1026+/**
1027+ * acpi_turn_off_unused_power_resources - Turn off power resources not in use.
1028+ * @init: Control switch.
1029+ *
1030+ * If @ainit is set, unconditionally turn off all of the ACPI power resources
1031+ * without any users.
1032+ *
1033+ * Otherwise, turn off all ACPI power resources without active references (that
1034+ * is, the ones that should be "off" at the moment) that are "on".
1035+ */
1036+void acpi_turn_off_unused_power_resources(bool init)
10011037 {
10021038 struct acpi_power_resource *resource;
10031039
@@ -1006,10 +1042,7 @@ void acpi_turn_off_unused_power_resources(void) · 2 unmodified lines
10061042 list_for_each_entry_reverse(resource, &acpi_power_resource_list, list_node) {
10071043 mutex_lock(&resource->resource_lock);
10081044
1009− if (!resource->ref_count) {
1010− dev_info(&resource->device.dev, "Turning OFF\n");
1011− __acpi_power_off(resource);
1012− }
1045+ acpi_power_turn_off_if_unused(resource, init);
10131046
10141047 mutex_unlock(&resource->resource_lock);
10151048 }
drivers/acpi/scan.c+1−1
@@ -2360,7 +2360,7 @@ int __init acpi_scan_init(void) · 2359 unmodified lines
23602360 }
23612361 }
23622362
2363− acpi_turn_off_unused_power_resources();
2363+ acpi_turn_off_unused_power_resources(true);
23642364
23652365 acpi_scan_initialized = true;
23662366
drivers/acpi/sleep.c+2−4
@@ -504,7 +504,7 @@ static void acpi_pm_start(u32 acpi_state) · 503 unmodified lines
504504 */
505505 static void acpi_pm_end(void)
506506 {
507− acpi_turn_off_unused_power_resources();
507+ acpi_turn_off_unused_power_resources(false);
508508 acpi_scan_lock_release();
509509 /*
510510 * This is necessary in case acpi_pm_finish() is not called during a
@@ -1009,10 +1009,8 @@ static void acpi_sleep_hibernate_setup(void) · 498 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/core.c+36−32
@@ -194,6 +194,17 @@ int device_links_read_lock_held(void) · 193 unmodified lines
194194 {
195195 return srcu_read_lock_held(&device_links_srcu);
196196 }
197+
198+static void device_link_synchronize_removal(void)
199+{
200+ synchronize_srcu(&device_links_srcu);
201+}
202+
203+static void device_link_remove_from_lists(struct device_link *link)
204+{
205+ list_del_rcu(&link->s_node);
206+ list_del_rcu(&link->c_node);
207+}
197208 #else /* !CONFIG_SRCU */
198209 static DECLARE_RWSEM(device_links_lock);
199210
@@ -224,6 +235,16 @@ int device_links_read_lock_held(void) · 24 unmodified lines
224235 return lockdep_is_held(&device_links_lock);
225236 }
226237 #endif
238+
239+static inline void device_link_synchronize_removal(void)
240+{
241+}
242+
243+static void device_link_remove_from_lists(struct device_link *link)
244+{
245+ list_del(&link->s_node);
246+ list_del(&link->c_node);
247+}
227248 #endif /* !CONFIG_SRCU */
228249
229250 static bool device_is_ancestor(struct device *dev, struct device *target)
@@ -445,8 +466,13 @@ static struct attribute *devlink_attrs[] = { · 215 unmodified lines
445466 };
446467 ATTRIBUTE_GROUPS(devlink);
447468
448−static void device_link_free(struct device_link *link)
469+static void device_link_release_fn(struct work_struct *work)
449470 {
471+ struct device_link *link = container_of(work, struct device_link, rm_work);
472+
473+ /* Ensure that all references to the link object have been dropped. */
474+ device_link_synchronize_removal();
475+
450476 while (refcount_dec_not_one(&link->rpm_active))
451477 pm_runtime_put(link->supplier);
452478
@@ -455,24 +481,19 @@ static void device_link_free(struct device_link *link) · 2 unmodified lines
455481 kfree(link);
456482 }
457483
458−#ifdef CONFIG_SRCU
459−static void __device_link_free_srcu(struct rcu_head *rhead)
460−{
461− device_link_free(container_of(rhead, struct device_link, rcu_head));
462−}
463−
464484 static void devlink_dev_release(struct device *dev)
465485 {
466486 struct device_link *link = to_devlink(dev);
467487
468− call_srcu(&device_links_srcu, &link->rcu_head, __device_link_free_srcu);
469−}
470−#else
471−static void devlink_dev_release(struct device *dev)
472−{
473− device_link_free(to_devlink(dev));
488+ INIT_WORK(&link->rm_work, device_link_release_fn);
489+ /*
490+ * It may take a while to complete this work because of the SRCU
491+ * synchronization in device_link_release_fn() and if the consumer or
492+ * supplier devices get deleted when it runs, so put it into the "long"
493+ * workqueue.
494+ */
495+ queue_work(system_long_wq, &link->rm_work);
474496 }
475−#endif
476497
477498 static struct class devlink_class = {
478499 .name = "devlink",
@@ -846,7 +867,6 @@ out: · 367 unmodified lines
846867 }
847868 EXPORT_SYMBOL_GPL(device_link_add);
848869
849−#ifdef CONFIG_SRCU
850870 static void __device_link_del(struct kref *kref)
851871 {
852872 struct device_link *link = container_of(kref, struct device_link, kref);
@@ -856,25 +876,9 @@ static void __device_link_del(struct kref *kref) · 3 unmodified lines
856876
857877 pm_runtime_drop_link(link);
858878
859− list_del_rcu(&link->s_node);
860− list_del_rcu(&link->c_node);
861− device_unregister(&link->link_dev);
862−}
863−#else /* !CONFIG_SRCU */
864−static void __device_link_del(struct kref *kref)
865−{
866− struct device_link *link = container_of(kref, struct device_link, kref);
867−
868− dev_info(link->consumer, "Dropping the link to %s\n",
869− dev_name(link->supplier));
870−
871− pm_runtime_drop_link(link);
872−
873− list_del(&link->s_node);
874− list_del(&link->c_node);
879+ device_link_remove_from_lists(link);
875880 device_unregister(&link->link_dev);
876881 }
877−#endif /* !CONFIG_SRCU */
878882
879883 static void device_link_put_kref(struct device_link *link)
880884 {
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/cpufreq/Kconfig.arm+0−10
@@ -19,16 +19,6 @@ config ACPI_CPPC_CPUFREQ · 18 unmodified lines
1919
2020 If in doubt, say N.
2121
22−config ACPI_CPPC_CPUFREQ_FIE
23− bool "Frequency Invariance support for CPPC cpufreq driver"
24− depends on ACPI_CPPC_CPUFREQ && GENERIC_ARCH_TOPOLOGY
25− default y
26− help
27− This extends frequency invariance support in the CPPC cpufreq driver,
28− by using CPPC delivered and reference performance counters.
29−
30− If in doubt, say N.
31−
3222 config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM
3323 tristate "Allwinner nvmem based SUN50I CPUFreq driver"
3424 depends on ARCH_SUNXI
drivers/cpufreq/cppc_cpufreq.c+12−233
@@ -10,18 +10,14 @@ · 9 unmodified lines
1010
1111 #define pr_fmt(fmt) "CPPC Cpufreq:" fmt
1212
13−#include <linux/arch_topology.h>
1413 #include <linux/kernel.h>
1514 #include <linux/module.h>
1615 #include <linux/delay.h>
1716 #include <linux/cpu.h>
1817 #include <linux/cpufreq.h>
1918 #include <linux/dmi.h>
20−#include <linux/irq_work.h>
21−#include <linux/kthread.h>
2219 #include <linux/time.h>
2320 #include <linux/vmalloc.h>
24−#include <uapi/linux/sched/types.h>
2521
2622 #include <asm/unaligned.h>
2723
@@ -61,204 +57,6 @@ static struct cppc_workaround_oem_info wa_info[] = { · 33 unmodified lines
6157 }
6258 };
6359
64−#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
65−
66−/* Frequency invariance support */
67−struct cppc_freq_invariance {
68− int cpu;
69− struct irq_work irq_work;
70− struct kthread_work work;
71− struct cppc_perf_fb_ctrs prev_perf_fb_ctrs;
72− struct cppc_cpudata *cpu_data;
73−};
74−
75−static DEFINE_PER_CPU(struct cppc_freq_invariance, cppc_freq_inv);
76−static struct kthread_worker *kworker_fie;
77−static bool fie_disabled;
78−
79−static struct cpufreq_driver cppc_cpufreq_driver;
80−static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu);
81−static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data,
82− struct cppc_perf_fb_ctrs fb_ctrs_t0,
83− struct cppc_perf_fb_ctrs fb_ctrs_t1);
84−
85−/**
86− * cppc_scale_freq_workfn - CPPC arch_freq_scale updater for frequency invariance
87− * @work: The work item.
88− *
89− * The CPPC driver register itself with the topology core to provide its own
90− * implementation (cppc_scale_freq_tick()) of topology_scale_freq_tick() which
91− * gets called by the scheduler on every tick.
92− *
93− * Note that the arch specific counters have higher priority than CPPC counters,
94− * if available, though the CPPC driver doesn't need to have any special
95− * handling for that.
96− *
97− * On an invocation of cppc_scale_freq_tick(), we schedule an irq work (since we
98− * reach here from hard-irq context), which then schedules a normal work item
99− * and cppc_scale_freq_workfn() updates the per_cpu arch_freq_scale variable
100− * based on the counter updates since the last tick.
101− */
102−static void cppc_scale_freq_workfn(struct kthread_work *work)
103−{
104− struct cppc_freq_invariance *cppc_fi;
105− struct cppc_perf_fb_ctrs fb_ctrs = {0};
106− struct cppc_cpudata *cpu_data;
107− unsigned long local_freq_scale;
108− u64 perf;
109−
110− cppc_fi = container_of(work, struct cppc_freq_invariance, work);
111− cpu_data = cppc_fi->cpu_data;
112−
113− if (cppc_get_perf_ctrs(cppc_fi->cpu, &fb_ctrs)) {
114− pr_warn("%s: failed to read perf counters\n", __func__);
115− return;
116− }
117−
118− cppc_fi->prev_perf_fb_ctrs = fb_ctrs;
119− perf = cppc_perf_from_fbctrs(cpu_data, cppc_fi->prev_perf_fb_ctrs,
120− fb_ctrs);
121−
122− perf <<= SCHED_CAPACITY_SHIFT;
123− local_freq_scale = div64_u64(perf, cpu_data->perf_caps.highest_perf);
124− if (WARN_ON(local_freq_scale > 1024))
125− local_freq_scale = 1024;
126−
127− per_cpu(arch_freq_scale, cppc_fi->cpu) = local_freq_scale;
128−}
129−
130−static void cppc_irq_work(struct irq_work *irq_work)
131−{
132− struct cppc_freq_invariance *cppc_fi;
133−
134− cppc_fi = container_of(irq_work, struct cppc_freq_invariance, irq_work);
135− kthread_queue_work(kworker_fie, &cppc_fi->work);
136−}
137−
138−static void cppc_scale_freq_tick(void)
139−{
140− struct cppc_freq_invariance *cppc_fi = &per_cpu(cppc_freq_inv, smp_processor_id());
141−
142− /*
143− * cppc_get_perf_ctrs() can potentially sleep, call that from the right
144− * context.
145− */
146− irq_work_queue(&cppc_fi->irq_work);
147−}
148−
149−static struct scale_freq_data cppc_sftd = {
150− .source = SCALE_FREQ_SOURCE_CPPC,
151− .set_freq_scale = cppc_scale_freq_tick,
152−};
153−
154−static void cppc_freq_invariance_policy_init(struct cpufreq_policy *policy,
155− struct cppc_cpudata *cpu_data)
156−{
157− struct cppc_perf_fb_ctrs fb_ctrs = {0};
158− struct cppc_freq_invariance *cppc_fi;
159− int i, ret;
160−
161− if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate)
162− return;
163−
164− if (fie_disabled)
165− return;
166−
167− for_each_cpu(i, policy->cpus) {
168− cppc_fi = &per_cpu(cppc_freq_inv, i);
169− cppc_fi->cpu = i;
170− cppc_fi->cpu_data = cpu_data;
171− kthread_init_work(&cppc_fi->work, cppc_scale_freq_workfn);
172− init_irq_work(&cppc_fi->irq_work, cppc_irq_work);
173−
174− ret = cppc_get_perf_ctrs(i, &fb_ctrs);
175− if (ret) {
176− pr_warn("%s: failed to read perf counters: %d\n",
177− __func__, ret);
178− fie_disabled = true;
179− } else {
180− cppc_fi->prev_perf_fb_ctrs = fb_ctrs;
181− }
182− }
183−}
184−
185−static void __init cppc_freq_invariance_init(void)
186−{
187− struct sched_attr attr = {
188− .size = sizeof(struct sched_attr),
189− .sched_policy = SCHED_DEADLINE,
190− .sched_nice = 0,
191− .sched_priority = 0,
192− /*
193− * Fake (unused) bandwidth; workaround to "fix"
194− * priority inheritance.
195− */
196− .sched_runtime = 1000000,
197− .sched_deadline = 10000000,
198− .sched_period = 10000000,
199− };
200− int ret;
201−
202− if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate)
203− return;
204−
205− if (fie_disabled)
206− return;
207−
208− kworker_fie = kthread_create_worker(0, "cppc_fie");
209− if (IS_ERR(kworker_fie))
210− return;
211−
212− ret = sched_setattr_nocheck(kworker_fie->task, &attr);
213− if (ret) {
214− pr_warn("%s: failed to set SCHED_DEADLINE: %d\n", __func__,
215− ret);
216− kthread_destroy_worker(kworker_fie);
217− return;
218− }
219−
220− /* Register for freq-invariance */
221− topology_set_scale_freq_source(&cppc_sftd, cpu_present_mask);
222−}
223−
224−static void cppc_freq_invariance_exit(void)
225−{
226− struct cppc_freq_invariance *cppc_fi;
227− int i;
228−
229− if (cppc_cpufreq_driver.get == hisi_cppc_cpufreq_get_rate)
230− return;
231−
232− if (fie_disabled)
233− return;
234−
235− topology_clear_scale_freq_source(SCALE_FREQ_SOURCE_CPPC, cpu_present_mask);
236−
237− for_each_possible_cpu(i) {
238− cppc_fi = &per_cpu(cppc_freq_inv, i);
239− irq_work_sync(&cppc_fi->irq_work);
240− }
241−
242− kthread_destroy_worker(kworker_fie);
243− kworker_fie = NULL;
244−}
245−
246−#else
247−static inline void
248−cppc_freq_invariance_policy_init(struct cpufreq_policy *policy,
249− struct cppc_cpudata *cpu_data)
250−{
251−}
252−
253−static inline void cppc_freq_invariance_init(void)
254−{
255−}
256−
257−static inline void cppc_freq_invariance_exit(void)
258−{
259−}
260−#endif /* CONFIG_ACPI_CPPC_CPUFREQ_FIE */
261−
26260 /* Callback function used to retrieve the max frequency from DMI */
26361 static void cppc_find_dmi_mhz(const struct dmi_header *dm, void *private)
26462 {
@@ -547,12 +345,9 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy) · 282 unmodified lines
547345 cpu_data->perf_ctrls.desired_perf = caps->highest_perf;
548346
549347 ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls);
550− if (ret) {
348+ if (ret)
551349 pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n",
552350 caps->highest_perf, cpu, ret);
553− } else {
554− cppc_freq_invariance_policy_init(policy, cpu_data);
555− }
556351
557352 return ret;
558353 }
@@ -565,12 +360,12 @@ static inline u64 get_delta(u64 t1, u64 t0) · 6 unmodified lines
565360 return (u32)t1 - (u32)t0;
566361 }
567362
568−static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data,
569− struct cppc_perf_fb_ctrs fb_ctrs_t0,
570− struct cppc_perf_fb_ctrs fb_ctrs_t1)
363+static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu_data,
364+ struct cppc_perf_fb_ctrs fb_ctrs_t0,
365+ struct cppc_perf_fb_ctrs fb_ctrs_t1)
571366 {
572367 u64 delta_reference, delta_delivered;
573− u64 reference_perf;
368+ u64 reference_perf, delivered_perf;
574369
575370 reference_perf = fb_ctrs_t0.reference_perf;
576371
@@ -579,21 +374,12 @@ static int cppc_perf_from_fbctrs(struct cppc_cpudata *cpu_data, · 2 unmodified lines
579374 delta_delivered = get_delta(fb_ctrs_t1.delivered,
580375 fb_ctrs_t0.delivered);
581376
582− /* Check to avoid divide-by zero and invalid delivered_perf */
583− if (!delta_reference || !delta_delivered)
584− return cpu_data->perf_ctrls.desired_perf;
585−
586− return (reference_perf * delta_delivered) / delta_reference;
587−}
588−
589−static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu_data,
590− struct cppc_perf_fb_ctrs fb_ctrs_t0,
591− struct cppc_perf_fb_ctrs fb_ctrs_t1)
592−{
593− u64 delivered_perf;
594−
595− delivered_perf = cppc_perf_from_fbctrs(cpu_data, fb_ctrs_t0,
596− fb_ctrs_t1);
377+ /* Check to avoid divide-by zero */
378+ if (delta_reference || delta_delivered)
379+ delivered_perf = (reference_perf * delta_delivered) /
380+ delta_reference;
381+ else
382+ delivered_perf = cpu_data->perf_ctrls.desired_perf;
597383
598384 return cppc_cpufreq_perf_to_khz(cpu_data, delivered_perf);
599385 }
@@ -718,8 +504,6 @@ static void cppc_check_hisi_workaround(void) · 118 unmodified lines
718504
719505 static int __init cppc_cpufreq_init(void)
720506 {
721− int ret;
722−
723507 if ((acpi_disabled) || !acpi_cpc_valid())
724508 return -ENODEV;
725509
@@ -727,11 +511,7 @@ static int __init cppc_cpufreq_init(void) · 1 unmodified line
727511
728512 cppc_check_hisi_workaround();
729513
730− ret = cpufreq_register_driver(&cppc_cpufreq_driver);
731− if (!ret)
732− cppc_freq_invariance_init();
733−
734− return ret;
514+ return cpufreq_register_driver(&cppc_cpufreq_driver);
735515 }
736516
737517 static inline void free_cpu_data(void)
@@ -748,7 +528,6 @@ static inline void free_cpu_data(void) · 10 unmodified lines
748528
749529 static void __exit cppc_cpufreq_exit(void)
750530 {
751− cppc_freq_invariance_exit();
752531 cpufreq_unregister_driver(&cppc_cpufreq_driver);
753532
754533 free_cpu_data();
drivers/dma/Kconfig+2−0
@@ -59,6 +59,7 @@ config DMA_OF · 58 unmodified lines
5959 #devices
6060 config ALTERA_MSGDMA
6161 tristate "Altera / Intel mSGDMA Engine"
62+ depends on HAS_IOMEM
6263 select DMA_ENGINE
6364 help
6465 Enable support for Altera / Intel mSGDMA controller.
@@ -701,6 +702,7 @@ config XILINX_ZYNQMP_DMA · 636 unmodified lines
701702
702703 config XILINX_ZYNQMP_DPDMA
703704 tristate "Xilinx DPDMA Engine"
705+ depends on HAS_IOMEM && OF
704706 select DMA_ENGINE
705707 select DMA_VIRTUAL_CHANNELS
706708 help
drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c+3−0
@@ -332,6 +332,7 @@ static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev) · 331 unmodified lines
332332 }
333333
334334 if (priv->dpdmai_attr.version.major > DPDMAI_VER_MAJOR) {
335+ err = -EINVAL;
335336 dev_err(dev, "DPDMAI major version mismatch\n"
336337 "Found %u.%u, supported version is %u.%u\n",
337338 priv->dpdmai_attr.version.major,
@@ -341,6 +342,7 @@ static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev) · 3 unmodified lines
341342 }
342343
343344 if (priv->dpdmai_attr.version.minor > DPDMAI_VER_MINOR) {
345+ err = -EINVAL;
344346 dev_err(dev, "DPDMAI minor version mismatch\n"
345347 "Found %u.%u, supported version is %u.%u\n",
346348 priv->dpdmai_attr.version.major,
@@ -475,6 +477,7 @@ static int __cold dpaa2_qdma_dpio_setup(struct dpaa2_qdma_priv *priv) · 128 unmodified lines
475477 ppriv->store =
476478 dpaa2_io_store_create(DPAA2_QDMA_STORE_SIZE, dev);
477479 if (!ppriv->store) {
480+ err = -ENOMEM;
478481 dev_err(dev, "dpaa2_io_store_create() failed\n");
479482 goto err_store;
480483 }
drivers/dma/idxd/cdev.c+1−0
@@ -110,6 +110,7 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp) · 109 unmodified lines
110110 pasid = iommu_sva_get_pasid(sva);
111111 if (pasid == IOMMU_PASID_INVALID) {
112112 iommu_sva_unbind_device(sva);
113+ rc = -EINVAL;
113114 goto failed;
114115 }
115116
drivers/dma/idxd/init.c+62−5
@@ -168,6 +168,32 @@ static int idxd_setup_interrupts(struct idxd_device *idxd) · 167 unmodified lines
168168 return rc;
169169 }
170170
171+static void idxd_cleanup_interrupts(struct idxd_device *idxd)
172+{
173+ struct pci_dev *pdev = idxd->pdev;
174+ struct idxd_irq_entry *irq_entry;
175+ int i, msixcnt;
176+
177+ msixcnt = pci_msix_vec_count(pdev);
178+ if (msixcnt <= 0)
179+ return;
180+
181+ irq_entry = &idxd->irq_entries[0];
182+ free_irq(irq_entry->vector, irq_entry);
183+
184+ for (i = 1; i < msixcnt; i++) {
185+
186+ irq_entry = &idxd->irq_entries[i];
187+ if (idxd->hw.cmd_cap & BIT(IDXD_CMD_RELEASE_INT_HANDLE))
188+ idxd_device_release_int_handle(idxd, idxd->int_handles[i],
189+ IDXD_IRQ_MSIX);
190+ free_irq(irq_entry->vector, irq_entry);
191+ }
192+
193+ idxd_mask_error_interrupts(idxd);
194+ pci_free_irq_vectors(pdev);
195+}
196+
171197 static int idxd_setup_wqs(struct idxd_device *idxd)
172198 {
173199 struct device *dev = &idxd->pdev->dev;
@@ -242,6 +268,7 @@ static int idxd_setup_engines(struct idxd_device *idxd) · 68 unmodified lines
242268 engine->idxd = idxd;
243269 device_initialize(&engine->conf_dev);
244270 engine->conf_dev.parent = &idxd->conf_dev;
271+ engine->conf_dev.bus = &dsa_bus_type;
245272 engine->conf_dev.type = &idxd_engine_device_type;
246273 rc = dev_set_name(&engine->conf_dev, "engine%d.%d", idxd->id, engine->id);
247274 if (rc < 0) {
@@ -303,6 +330,19 @@ static int idxd_setup_groups(struct idxd_device *idxd) · 55 unmodified lines
303330 return rc;
304331 }
305332
333+static void idxd_cleanup_internals(struct idxd_device *idxd)
334+{
335+ int i;
336+
337+ for (i = 0; i < idxd->max_groups; i++)
338+ put_device(&idxd->groups[i]->conf_dev);
339+ for (i = 0; i < idxd->max_engines; i++)
340+ put_device(&idxd->engines[i]->conf_dev);
341+ for (i = 0; i < idxd->max_wqs; i++)
342+ put_device(&idxd->wqs[i]->conf_dev);
343+ destroy_workqueue(idxd->wq);
344+}
345+
306346 static int idxd_setup_internals(struct idxd_device *idxd)
307347 {
308348 struct device *dev = &idxd->pdev->dev;
@@ -531,12 +571,12 @@ static int idxd_probe(struct idxd_device *idxd) · 222 unmodified lines
531571 dev_dbg(dev, "Loading RO device config\n");
532572 rc = idxd_device_load_config(idxd);
533573 if (rc < 0)
534− goto err;
574+ goto err_config;
535575 }
536576
537577 rc = idxd_setup_interrupts(idxd);
538578 if (rc)
539− goto err;
579+ goto err_config;
540580
541581 dev_dbg(dev, "IDXD interrupt setup complete.\n");
542582
@@ -549,6 +589,8 @@ static int idxd_probe(struct idxd_device *idxd) · 6 unmodified lines
549589 dev_dbg(dev, "IDXD device %d probed successfully\n", idxd->id);
550590 return 0;
551591
592+ err_config:
593+ idxd_cleanup_internals(idxd);
552594 err:
553595 if (device_pasid_enabled(idxd))
554596 idxd_disable_system_pasid(idxd);
@@ -556,6 +598,18 @@ static int idxd_probe(struct idxd_device *idxd) · 1 unmodified line
556598 return rc;
557599 }
558600
601+static void idxd_cleanup(struct idxd_device *idxd)
602+{
603+ struct device *dev = &idxd->pdev->dev;
604+
605+ perfmon_pmu_remove(idxd);
606+ idxd_cleanup_interrupts(idxd);
607+ idxd_cleanup_internals(idxd);
608+ if (device_pasid_enabled(idxd))
609+ idxd_disable_system_pasid(idxd);
610+ iommu_dev_disable_feature(dev, IOMMU_DEV_FEAT_SVA);
611+}
612+
559613 static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
560614 {
561615 struct device *dev = &pdev->dev;
@@ -608,7 +662,7 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 46 unmodified lines
608662 rc = idxd_register_devices(idxd);
609663 if (rc) {
610664 dev_err(dev, "IDXD sysfs setup failed\n");
611− goto err;
665+ goto err_dev_register;
612666 }
613667
614668 idxd->state = IDXD_DEV_CONF_READY;
@@ -618,6 +672,8 @@ static int idxd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 3 unmodified lines
618672
619673 return 0;
620674
675+ err_dev_register:
676+ idxd_cleanup(idxd);
621677 err:
622678 pci_iounmap(pdev, idxd->reg_base);
623679 err_iomap:
@@ -745,12 +801,12 @@ static int __init idxd_init_module(void) · 121 unmodified lines
745801 * If the CPU does not support MOVDIR64B or ENQCMDS, there's no point in
746802 * enumerating the device. We can not utilize it.
747803 */
748− if (!boot_cpu_has(X86_FEATURE_MOVDIR64B)) {
804+ if (!cpu_feature_enabled(X86_FEATURE_MOVDIR64B)) {
749805 pr_warn("idxd driver failed to load without MOVDIR64B.\n");
750806 return -ENODEV;
751807 }
752808
753− if (!boot_cpu_has(X86_FEATURE_ENQCMD))
809+ if (!cpu_feature_enabled(X86_FEATURE_ENQCMD))
754810 pr_warn("Platform does not have ENQCMD(S) support.\n");
755811 else
756812 support_enqcmd = true;
@@ -787,6 +843,7 @@ module_init(idxd_init_module); · 30 unmodified lines
787843
788844 static void __exit idxd_exit_module(void)
789845 {
846+ idxd_unregister_driver();
790847 pci_unregister_driver(&idxd_pci_driver);
791848 idxd_cdev_remove();
792849 idxd_unregister_bus_type();
drivers/dma/ipu/ipu_irq.c+1−1
@@ -230,7 +230,7 @@ out: · 229 unmodified lines
230230 }
231231
232232 /**
233− * ipu_irq_map() - map an IPU interrupt source to an IRQ number
233+ * ipu_irq_unmap() - unmap an IPU interrupt source
234234 * @source: interrupt source bit position (see ipu_irq_map())
235235 * @return: 0 or negative error code
236236 */
drivers/dma/mediatek/mtk-uart-apdma.c+14−13
@@ -131,10 +131,7 @@ static unsigned int mtk_uart_apdma_read(struct mtk_chan *c, unsigned int reg) · 130 unmodified lines
131131
132132 static void mtk_uart_apdma_desc_free(struct virt_dma_desc *vd)
133133 {
134− struct dma_chan *chan = vd->tx.chan;
135− struct mtk_chan *c = to_mtk_uart_apdma_chan(chan);
136−
137− kfree(c->desc);
134+ kfree(container_of(vd, struct mtk_uart_apdma_desc, vd));
138135 }
139136
140137 static void mtk_uart_apdma_start_tx(struct mtk_chan *c)
@@ -207,14 +204,9 @@ static void mtk_uart_apdma_start_rx(struct mtk_chan *c) · 66 unmodified lines
207204
208205 static void mtk_uart_apdma_tx_handler(struct mtk_chan *c)
209206 {
210− struct mtk_uart_apdma_desc *d = c->desc;
211−
212207 mtk_uart_apdma_write(c, VFF_INT_FLAG, VFF_TX_INT_CLR_B);
213208 mtk_uart_apdma_write(c, VFF_INT_EN, VFF_INT_EN_CLR_B);
214209 mtk_uart_apdma_write(c, VFF_EN, VFF_EN_CLR_B);
215−
216− list_del(&d->vd.node);
217− vchan_cookie_complete(&d->vd);
218210 }
219211
220212 static void mtk_uart_apdma_rx_handler(struct mtk_chan *c)
@@ -245,9 +237,17 @@ static void mtk_uart_apdma_rx_handler(struct mtk_chan *c) · 24 unmodified lines
245237
246238 c->rx_status = d->avail_len - cnt;
247239 mtk_uart_apdma_write(c, VFF_RPT, wg);
240+}
248241
249− list_del(&d->vd.node);
250− vchan_cookie_complete(&d->vd);
242+static void mtk_uart_apdma_chan_complete_handler(struct mtk_chan *c)
243+{
244+ struct mtk_uart_apdma_desc *d = c->desc;
245+
246+ if (d) {
247+ list_del(&d->vd.node);
248+ vchan_cookie_complete(&d->vd);
249+ c->desc = NULL;
250+ }
251251 }
252252
253253 static irqreturn_t mtk_uart_apdma_irq_handler(int irq, void *dev_id)
@@ -261,6 +261,7 @@ static irqreturn_t mtk_uart_apdma_irq_handler(int irq, void *dev_id) · 7 unmodified lines
261261 mtk_uart_apdma_rx_handler(c);
262262 else if (c->dir == DMA_MEM_TO_DEV)
263263 mtk_uart_apdma_tx_handler(c);
264+ mtk_uart_apdma_chan_complete_handler(c);
264265 spin_unlock_irqrestore(&c->vc.lock, flags);
265266
266267 return IRQ_HANDLED;
@@ -348,7 +349,7 @@ static struct dma_async_tx_descriptor *mtk_uart_apdma_prep_slave_sg · 81 unmodified lines
348349 return NULL;
349350
350351 /* Now allocate and setup the descriptor */
351− d = kzalloc(sizeof(*d), GFP_ATOMIC);
352+ d = kzalloc(sizeof(*d), GFP_NOWAIT);
352353 if (!d)
353354 return NULL;
354355
@@ -366,7 +367,7 @@ static void mtk_uart_apdma_issue_pending(struct dma_chan *chan) · 11 unmodified lines
366367 unsigned long flags;
367368
368369 spin_lock_irqsave(&c->vc.lock, flags);
369− if (vchan_issue_pending(&c->vc)) {
370+ if (vchan_issue_pending(&c->vc) && !c->desc) {
370371 vd = vchan_next_desc(&c->vc);
371372 c->desc = to_mtk_uart_apdma_desc(&vd->tx);
372373
drivers/dma/pl330.c+4−2
@@ -2694,13 +2694,15 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( · 2693 unmodified lines
26942694 for (i = 0; i < len / period_len; i++) {
26952695 desc = pl330_get_desc(pch);
26962696 if (!desc) {
2697+ unsigned long iflags;
2698+
26972699 dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n",
26982700 __func__, __LINE__);
26992701
27002702 if (!first)
27012703 return NULL;
27022704
2703− spin_lock_irqsave(&pl330->pool_lock, flags);
2705+ spin_lock_irqsave(&pl330->pool_lock, iflags);
27042706
27052707 while (!list_empty(&first->node)) {
27062708 desc = list_entry(first->node.next,
@@ -2710,7 +2712,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic( · 3 unmodified lines
27102712
27112713 list_move_tail(&first->node, &pl330->desc_pool);
27122714
2713− spin_unlock_irqrestore(&pl330->pool_lock, flags);
2715+ spin_unlock_irqrestore(&pl330->pool_lock, iflags);
27142716
27152717 return NULL;
27162718 }
drivers/dma/qcom/Kconfig+1−0
@@ -33,6 +33,7 @@ config QCOM_GPI_DMA · 32 unmodified lines
3333
3434 config QCOM_HIDMA_MGMT
3535 tristate "Qualcomm Technologies HIDMA Management support"
36+ depends on HAS_IOMEM
3637 select DMA_ENGINE
3738 help
3839 Enable support for the Qualcomm Technologies HIDMA Management.
drivers/dma/sf-pdma/Kconfig+1−0
@@ -1,5 +1,6 @@
11 config SF_PDMA
22 tristate "Sifive PDMA controller driver"
3+ depends on HAS_IOMEM
34 select DMA_ENGINE
45 select DMA_VIRTUAL_CHANNELS
56 help
drivers/dma/sh/rcar-dmac.c+1−1
@@ -1913,7 +1913,7 @@ static int rcar_dmac_probe(struct platform_device *pdev) · 1912 unmodified lines
19131913
19141914 /* Enable runtime PM and initialize the device. */
19151915 pm_runtime_enable(&pdev->dev);
1916− ret = pm_runtime_get_sync(&pdev->dev);
1916+ ret = pm_runtime_resume_and_get(&pdev->dev);
19171917 if (ret < 0) {
19181918 dev_err(&pdev->dev, "runtime PM get sync failed (%d)\n", ret);
19191919 return ret;
drivers/dma/ste_dma40.c+3−0
@@ -3675,6 +3675,9 @@ static int __init d40_probe(struct platform_device *pdev) · 3674 unmodified lines
36753675
36763676 kfree(base->lcla_pool.base_unaligned);
36773677
3678+ if (base->lcpa_base)
3679+ iounmap(base->lcpa_base);
3680+
36783681 if (base->phy_lcpa)
36793682 release_mem_region(base->phy_lcpa,
36803683 base->lcpa_size);
drivers/dma/stm32-mdma.c+2−2
@@ -1452,7 +1452,7 @@ static int stm32_mdma_alloc_chan_resources(struct dma_chan *c) · 1451 unmodified lines
14521452 return -ENOMEM;
14531453 }
14541454
1455− ret = pm_runtime_get_sync(dmadev->ddev.dev);
1455+ ret = pm_runtime_resume_and_get(dmadev->ddev.dev);
14561456 if (ret < 0)
14571457 return ret;
14581458
@@ -1718,7 +1718,7 @@ static int stm32_mdma_pm_suspend(struct device *dev) · 259 unmodified lines
17181718 u32 ccr, id;
17191719 int ret;
17201720
1721− ret = pm_runtime_get_sync(dev);
1721+ ret = pm_runtime_resume_and_get(dev);
17221722 if (ret < 0)
17231723 return ret;
17241724
drivers/dma/xilinx/xilinx_dpdma.c+28−3
@@ -113,6 +113,7 @@ · 112 unmodified lines
113113 #define XILINX_DPDMA_CH_VDO 0x020
114114 #define XILINX_DPDMA_CH_PYLD_SZ 0x024
115115 #define XILINX_DPDMA_CH_DESC_ID 0x028
116+#define XILINX_DPDMA_CH_DESC_ID_MASK GENMASK(15, 0)
116117
117118 /* DPDMA descriptor fields */
118119 #define XILINX_DPDMA_DESC_CONTROL_PREEMBLE 0xa5
@@ -866,7 +867,8 @@ static void xilinx_dpdma_chan_queue_transfer(struct xilinx_dpdma_chan *chan) · 747 unmodified lines
866867 * will be used, but it should be enough.
867868 */
868869 list_for_each_entry(sw_desc, &desc->descriptors, node)
869− sw_desc->hw.desc_id = desc->vdesc.tx.cookie;
870+ sw_desc->hw.desc_id = desc->vdesc.tx.cookie
871+ & XILINX_DPDMA_CH_DESC_ID_MASK;
870872
871873 sw_desc = list_first_entry(&desc->descriptors,
872874 struct xilinx_dpdma_sw_desc, node);
@@ -1086,7 +1088,8 @@ static void xilinx_dpdma_chan_vsync_irq(struct xilinx_dpdma_chan *chan) · 213 unmodified lines
10861088 if (!chan->running || !pending)
10871089 goto out;
10881090
1089− desc_id = dpdma_read(chan->reg, XILINX_DPDMA_CH_DESC_ID);
1091+ desc_id = dpdma_read(chan->reg, XILINX_DPDMA_CH_DESC_ID)
1092+ & XILINX_DPDMA_CH_DESC_ID_MASK;
10901093
10911094 /* If the retrigger raced with vsync, retry at the next frame. */
10921095 sw_desc = list_first_entry(&pending->descriptors,
@@ -1459,7 +1462,7 @@ static void xilinx_dpdma_enable_irq(struct xilinx_dpdma_device *xdev) · 366 unmodified lines
14591462 */
14601463 static void xilinx_dpdma_disable_irq(struct xilinx_dpdma_device *xdev)
14611464 {
1462− dpdma_write(xdev->reg, XILINX_DPDMA_IDS, XILINX_DPDMA_INTR_ERR_ALL);
1465+ dpdma_write(xdev->reg, XILINX_DPDMA_IDS, XILINX_DPDMA_INTR_ALL);
14631466 dpdma_write(xdev->reg, XILINX_DPDMA_EIDS, XILINX_DPDMA_EINTR_ALL);
14641467 }
14651468
@@ -1596,6 +1599,26 @@ static struct dma_chan *of_dma_xilinx_xlate(struct of_phandle_args *dma_spec, · 130 unmodified lines
15961599 return dma_get_slave_channel(&xdev->chan[chan_id]->vchan.chan);
15971600 }
15981601
1602+static void dpdma_hw_init(struct xilinx_dpdma_device *xdev)
1603+{
1604+ unsigned int i;
1605+ void __iomem *reg;
1606+
1607+ /* Disable all interrupts */
1608+ xilinx_dpdma_disable_irq(xdev);
1609+
1610+ /* Stop all channels */
1611+ for (i = 0; i < ARRAY_SIZE(xdev->chan); i++) {
1612+ reg = xdev->reg + XILINX_DPDMA_CH_BASE
1613+ + XILINX_DPDMA_CH_OFFSET * i;
1614+ dpdma_clr(reg, XILINX_DPDMA_CH_CNTL, XILINX_DPDMA_CH_CNTL_ENABLE);
1615+ }
1616+
1617+ /* Clear the interrupt status registers */
1618+ dpdma_write(xdev->reg, XILINX_DPDMA_ISR, XILINX_DPDMA_INTR_ALL);
1619+ dpdma_write(xdev->reg, XILINX_DPDMA_EISR, XILINX_DPDMA_EINTR_ALL);
1620+}
1621+
15991622 static int xilinx_dpdma_probe(struct platform_device *pdev)
16001623 {
16011624 struct xilinx_dpdma_device *xdev;
@@ -1622,6 +1645,8 @@ static int xilinx_dpdma_probe(struct platform_device *pdev) · 20 unmodified lines
16221645 if (IS_ERR(xdev->reg))
16231646 return PTR_ERR(xdev->reg);
16241647
1648+ dpdma_hw_init(xdev);
1649+
16251650 xdev->irq = platform_get_irq(pdev, 0);
16261651 if (xdev->irq < 0) {
16271652 dev_err(xdev->dev, "failed to get platform irq\n");
drivers/dma/xilinx/zynqmp_dma.c+1−1
@@ -468,7 +468,7 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan) · 467 unmodified lines
468468 struct zynqmp_dma_desc_sw *desc;
469469 int i, ret;
470470
471− ret = pm_runtime_get_sync(chan->dev);
471+ ret = pm_runtime_resume_and_get(chan->dev);
472472 if (ret < 0)
473473 return ret;
474474
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/drm_auth.c+2−1
@@ -315,9 +315,10 @@ int drm_master_open(struct drm_file *file_priv) · 314 unmodified lines
315315 void drm_master_release(struct drm_file *file_priv)
316316 {
317317 struct drm_device *dev = file_priv->minor->dev;
318− struct drm_master *master = file_priv->master;
318+ struct drm_master *master;
319319
320320 mutex_lock(&dev->master_mutex);
321+ master = file_priv->master;
321322 if (file_priv->magic)
322323 idr_remove(&file_priv->master->magic_map, file_priv->magic);
323324
drivers/gpu/drm/drm_ioctl.c+5−4
@@ -117,17 +117,18 @@ int drm_getunique(struct drm_device *dev, void *data, · 116 unmodified lines
117117 struct drm_file *file_priv)
118118 {
119119 struct drm_unique *u = data;
120− struct drm_master *master = file_priv->master;
120+ struct drm_master *master;
121121
122− mutex_lock(&master->dev->master_mutex);
122+ mutex_lock(&dev->master_mutex);
123+ master = file_priv->master;
123124 if (u->unique_len >= master->unique_len) {
124125 if (copy_to_user(u->unique, master->unique, master->unique_len)) {
125− mutex_unlock(&master->dev->master_mutex);
126+ mutex_unlock(&dev->master_mutex);
126127 return -EFAULT;
127128 }
128129 }
129130 u->unique_len = master->unique_len;
130− mutex_unlock(&master->dev->master_mutex);
131+ mutex_unlock(&dev->master_mutex);
131132
132133 return 0;
133134 }
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/meson/meson_drv.c+5−4
@@ -474,11 +474,12 @@ static int meson_probe_remote(struct platform_device *pdev, · 473 unmodified lines
474474 static void meson_drv_shutdown(struct platform_device *pdev)
475475 {
476476 struct meson_drm *priv = dev_get_drvdata(&pdev->dev);
477− struct drm_device *drm = priv->drm;
478477
479− DRM_DEBUG_DRIVER("\n");
480− drm_kms_helper_poll_fini(drm);
481− drm_atomic_helper_shutdown(drm);
478+ if (!priv)
479+ return;
480+
481+ drm_kms_helper_poll_fini(priv->drm);
482+ drm_atomic_helper_shutdown(priv->drm);
482483 }
483484
484485 static int meson_drv_probe(struct platform_device *pdev)
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
@@ -1240,6 +1240,13 @@ static struct drm_gem_object *_msm_gem_new(struct drm_device *dev, · 1239 unmodified lines
12401240
12411241 to_msm_bo(obj)->vram_node = &vma->node;
12421242
1243+ /* Call chain get_pages() -> update_inactive() tries to
1244+ * access msm_obj->mm_list, but it is not initialized yet.
1245+ * To avoid NULL pointer dereference error, initialize
1246+ * mm_list to be empty.
1247+ */
1248+ INIT_LIST_HEAD(&msm_obj->mm_list);
1249+
12431250 msm_gem_lock(obj);
12441251 pages = get_pages(obj);
12451252 msm_gem_unlock(obj);
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
@@ -1139,7 +1139,10 @@ int ttm_bo_swapout(struct ttm_buffer_object *bo, struct ttm_operation_ctx *ctx, · 1138 unmodified lines
11391139 if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL))
11401140 return -EBUSY;
11411141
1142− if (!ttm_bo_get_unless_zero(bo)) {
1142+ if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) ||
1143+ bo->ttm->page_flags & TTM_PAGE_FLAG_SG ||
1144+ bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED ||
1145+ !ttm_bo_get_unless_zero(bo)) {
11431146 if (locked)
11441147 dma_resv_unlock(bo->base.resv);
11451148 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 ||
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/Kconfig+1−1
@@ -647,7 +647,7 @@ config I2C_HIGHLANDER · 646 unmodified lines
647647
648648 config I2C_HISI
649649 tristate "HiSilicon I2C controller"
650− depends on ARM64 || COMPILE_TEST
650+ depends on (ARM64 && ACPI) || COMPILE_TEST
651651 help
652652 Say Y here if you want to have Hisilicon I2C controller support
653653 available on the Kunpeng Server.
drivers/i2c/busses/i2c-ali1563.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-only
2−/**
2+/*
33 * i2c-ali1563.c - i2c driver for the ALi 1563 Southbridge
44 *
55 * Copyright (C) 2004 Patrick Mochel
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-cadence.c+1−1
@@ -144,7 +144,7 @@ enum cdns_i2c_mode { · 143 unmodified lines
144144 };
145145
146146 /**
147− * enum cdns_i2c_slave_mode - Slave state when I2C is operating in slave mode
147+ * enum cdns_i2c_slave_state - Slave state when I2C is operating in slave mode
148148 *
149149 * @CDNS_I2C_SLAVE_STATE_IDLE: I2C slave idle
150150 * @CDNS_I2C_SLAVE_STATE_SEND: I2C slave sending data to master
drivers/i2c/busses/i2c-designware-master.c+1−1
@@ -165,7 +165,7 @@ static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) · 164 unmodified lines
165165 }
166166
167167 /**
168− * i2c_dw_init() - Initialize the designware I2C master hardware
168+ * i2c_dw_init_master() - Initialize the designware I2C master hardware
169169 * @dev: device private data
170170 *
171171 * This functions configures and enables the I2C master.
drivers/i2c/busses/i2c-eg20t.c+2−1
@@ -148,7 +148,7 @@ struct i2c_algo_pch_data { · 147 unmodified lines
148148
149149 /**
150150 * struct adapter_info - This structure holds the adapter information for the
151− PCH i2c controller
151+ * PCH i2c controller
152152 * @pch_data: stores a list of i2c_algo_pch_data
153153 * @pch_i2c_suspended: specifies whether the system is suspended or not
154154 * perhaps with more lines and words.
@@ -358,6 +358,7 @@ static void pch_i2c_repstart(struct i2c_algo_pch_data *adap) · 203 unmodified lines
358358 /**
359359 * pch_i2c_writebytes() - write data to I2C bus in normal mode
360360 * @i2c_adap: Pointer to the struct i2c_adapter.
361+ * @msgs: Pointer to the i2c message structure.
361362 * @last: specifies whether last message or not.
362363 * In the case of compound mode it will be 1 for last message,
363364 * otherwise 0.
drivers/i2c/busses/i2c-i801.c+2−4
@@ -395,11 +395,9 @@ static int i801_check_post(struct i801_priv *priv, int status) · 394 unmodified lines
395395 dev_err(&priv->pci_dev->dev, "Transaction timeout\n");
396396 /* try to stop the current command */
397397 dev_dbg(&priv->pci_dev->dev, "Terminating the current operation\n");
398− outb_p(inb_p(SMBHSTCNT(priv)) | SMBHSTCNT_KILL,
399− SMBHSTCNT(priv));
398+ outb_p(SMBHSTCNT_KILL, SMBHSTCNT(priv));
400399 usleep_range(1000, 2000);
401− outb_p(inb_p(SMBHSTCNT(priv)) & (~SMBHSTCNT_KILL),
402− SMBHSTCNT(priv));
400+ outb_p(0, SMBHSTCNT(priv));
403401
404402 /* Check if it worked */
405403 status = inb_p(SMBHSTSTS(priv));
drivers/i2c/busses/i2c-icy.c+0−1
@@ -123,7 +123,6 @@ static int icy_probe(struct zorro_dev *z, · 122 unmodified lines
123123 {
124124 struct icy_i2c *i2c;
125125 struct i2c_algo_pcf_data *algo_data;
126− struct fwnode_handle *new_fwnode;
127126 struct i2c_board_info ltc2990_info = {
128127 .type = "ltc2990",
129128 .swnode = &icy_ltc2990_node,
drivers/i2c/busses/i2c-mpc.c+79−2
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919
2020 #include <linux/clk.h>
2121 #include <linux/io.h>
22+#include <linux/iopoll.h>
2223 #include <linux/fsl_devices.h>
2324 #include <linux/i2c.h>
2425 #include <linux/interrupt.h>
@@ -45,6 +46,7 @@ · 20 unmodified lines
4546 #define CCR_MTX 0x10
4647 #define CCR_TXAK 0x08
4748 #define CCR_RSTA 0x04
49+#define CCR_RSVD 0x02
4850
4951 #define CSR_MCF 0x80
5052 #define CSR_MAAS 0x40
@@ -97,7 +99,7 @@ struct mpc_i2c { · 46 unmodified lines
9799 u32 block;
98100 int rc;
99101 int expect_rxack;
100−
102+ bool has_errata_A004447;
101103 };
102104
103105 struct mpc_i2c_divider {
@@ -136,6 +138,75 @@ static void mpc_i2c_fixup(struct mpc_i2c *i2c) · 32 unmodified lines
136138 }
137139 }
138140
141+static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int mask)
142+{
143+ void __iomem *addr = i2c->base + MPC_I2C_SR;
144+ u8 val;
145+
146+ return readb_poll_timeout(addr, val, val & mask, 0, 100);
147+}
148+
149+/*
150+ * Workaround for Erratum A004447. From the P2040CE Rev Q
151+ *
152+ * 1. Set up the frequency divider and sampling rate.
153+ * 2. I2CCR - a0h
154+ * 3. Poll for I2CSR[MBB] to get set.
155+ * 4. If I2CSR[MAL] is set (an indication that SDA is stuck low), then go to
156+ * step 5. If MAL is not set, then go to step 13.
157+ * 5. I2CCR - 00h
158+ * 6. I2CCR - 22h
159+ * 7. I2CCR - a2h
160+ * 8. Poll for I2CSR[MBB] to get set.
161+ * 9. Issue read to I2CDR.
162+ * 10. Poll for I2CSR[MIF] to be set.
163+ * 11. I2CCR - 82h
164+ * 12. Workaround complete. Skip the next steps.
165+ * 13. Issue read to I2CDR.
166+ * 14. Poll for I2CSR[MIF] to be set.
167+ * 15. I2CCR - 80h
168+ */
169+static void mpc_i2c_fixup_A004447(struct mpc_i2c *i2c)
170+{
171+ int ret;
172+ u32 val;
173+
174+ writeccr(i2c, CCR_MEN | CCR_MSTA);
175+ ret = i2c_mpc_wait_sr(i2c, CSR_MBB);
176+ if (ret) {
177+ dev_err(i2c->dev, "timeout waiting for CSR_MBB\n");
178+ return;
179+ }
180+
181+ val = readb(i2c->base + MPC_I2C_SR);
182+
183+ if (val & CSR_MAL) {
184+ writeccr(i2c, 0x00);
185+ writeccr(i2c, CCR_MSTA | CCR_RSVD);
186+ writeccr(i2c, CCR_MEN | CCR_MSTA | CCR_RSVD);
187+ ret = i2c_mpc_wait_sr(i2c, CSR_MBB);
188+ if (ret) {
189+ dev_err(i2c->dev, "timeout waiting for CSR_MBB\n");
190+ return;
191+ }
192+ val = readb(i2c->base + MPC_I2C_DR);
193+ ret = i2c_mpc_wait_sr(i2c, CSR_MIF);
194+ if (ret) {
195+ dev_err(i2c->dev, "timeout waiting for CSR_MIF\n");
196+ return;
197+ }
198+ writeccr(i2c, CCR_MEN | CCR_RSVD);
199+ } else {
200+ val = readb(i2c->base + MPC_I2C_DR);
201+ ret = i2c_mpc_wait_sr(i2c, CSR_MIF);
202+ if (ret) {
203+ dev_err(i2c->dev, "timeout waiting for CSR_MIF\n");
204+ return;
205+ }
206+ writeccr(i2c, CCR_MEN);
207+ }
208+}
209+
139210 #if defined(CONFIG_PPC_MPC52xx) || defined(CONFIG_PPC_MPC512x)
140211 static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = {
141212 {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23},
@@ -670,7 +741,10 @@ static int fsl_i2c_bus_recovery(struct i2c_adapter *adap) · 528 unmodified lines
670741 {
671742 struct mpc_i2c *i2c = i2c_get_adapdata(adap);
672743
673− mpc_i2c_fixup(i2c);
744+ if (i2c->has_errata_A004447)
745+ mpc_i2c_fixup_A004447(i2c);
746+ else
747+ mpc_i2c_fixup(i2c);
674748
675749 return 0;
676750 }
@@ -767,6 +841,9 @@ static int fsl_i2c_probe(struct platform_device *op) · 90 unmodified lines
767841 }
768842 dev_info(i2c->dev, "timeout %u us\n", mpc_ops.timeout * 1000000 / HZ);
769843
844+ if (of_property_read_bool(op->dev.of_node, "fsl,i2c-erratum-a004447"))
845+ i2c->has_errata_A004447 = true;
846+
770847 i2c->adap = mpc_ops;
771848 scnprintf(i2c->adap.name, sizeof(i2c->adap.name),
772849 "MPC adapter (%s)", of_node_full_name(op->dev.of_node));
drivers/i2c/busses/i2c-mt65xx.c+5−0
@@ -479,6 +479,11 @@ static void mtk_i2c_clock_disable(struct mtk_i2c *i2c) · 478 unmodified lines
479479 static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
480480 {
481481 u16 control_reg;
482+ u16 intr_stat_reg;
483+
484+ mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START);
485+ intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT);
486+ mtk_i2c_writew(i2c, intr_stat_reg, OFFSET_INTR_STAT);
482487
483488 if (i2c->dev_comp->apdma_sync) {
484489 writel(I2C_DMA_WARM_RST, i2c->pdmabase + OFFSET_RST);
drivers/i2c/busses/i2c-nomadik.c+1−1
@@ -159,7 +159,7 @@ struct i2c_nmk_client { · 158 unmodified lines
159159 * @clk_freq: clock frequency for the operation mode
160160 * @tft: Tx FIFO Threshold in bytes
161161 * @rft: Rx FIFO Threshold in bytes
162− * @timeout Slave response timeout (ms)
162+ * @timeout: Slave response timeout (ms)
163163 * @sm: speed mode
164164 * @stop: stop condition.
165165 * @xfer_complete: acknowledge completion for a I2C message.
drivers/i2c/busses/i2c-ocores.c+4−4
@@ -250,7 +250,7 @@ static irqreturn_t ocores_isr(int irq, void *dev_id) · 249 unmodified lines
250250 }
251251
252252 /**
253− * Process timeout event
253+ * ocores_process_timeout() - Process timeout event
254254 * @i2c: ocores I2C device instance
255255 */
256256 static void ocores_process_timeout(struct ocores_i2c *i2c)
@@ -264,7 +264,7 @@ static void ocores_process_timeout(struct ocores_i2c *i2c) · 7 unmodified lines
264264 }
265265
266266 /**
267− * Wait until something change in a given register
267+ * ocores_wait() - Wait until something change in a given register
268268 * @i2c: ocores I2C device instance
269269 * @reg: register to query
270270 * @mask: bitmask to apply on register value
@@ -296,7 +296,7 @@ static int ocores_wait(struct ocores_i2c *i2c, · 25 unmodified lines
296296 }
297297
298298 /**
299− * Wait until is possible to process some data
299+ * ocores_poll_wait() - Wait until is possible to process some data
300300 * @i2c: ocores I2C device instance
301301 *
302302 * Used when the device is in polling mode (interrupts disabled).
@@ -334,7 +334,7 @@ static int ocores_poll_wait(struct ocores_i2c *i2c) · 31 unmodified lines
334334 }
335335
336336 /**
337− * It handles an IRQ-less transfer
337+ * ocores_process_polling() - It handles an IRQ-less transfer
338338 * @i2c: ocores I2C device instance
339339 *
340340 * Even if IRQ are disabled, the I2C OpenCore IP behavior is exactly the same
drivers/i2c/busses/i2c-pnx.c+4−4
@@ -138,7 +138,7 @@ static inline void i2c_pnx_arm_timer(struct i2c_pnx_algo_data *alg_data) · 137 unmodified lines
138138 /**
139139 * i2c_pnx_start - start a device
140140 * @slave_addr: slave address
141− * @adap: pointer to adapter structure
141+ * @alg_data: pointer to local driver data structure
142142 *
143143 * Generate a START signal in the desired mode.
144144 */
@@ -194,7 +194,7 @@ static int i2c_pnx_start(unsigned char slave_addr, · 49 unmodified lines
194194
195195 /**
196196 * i2c_pnx_stop - stop a device
197− * @adap: pointer to I2C adapter structure
197+ * @alg_data: pointer to local driver data structure
198198 *
199199 * Generate a STOP signal to terminate the master transaction.
200200 */
@@ -223,7 +223,7 @@ static void i2c_pnx_stop(struct i2c_pnx_algo_data *alg_data) · 22 unmodified lines
223223
224224 /**
225225 * i2c_pnx_master_xmit - transmit data to slave
226− * @adap: pointer to I2C adapter structure
226+ * @alg_data: pointer to local driver data structure
227227 *
228228 * Sends one byte of data to the slave
229229 */
@@ -293,7 +293,7 @@ static int i2c_pnx_master_xmit(struct i2c_pnx_algo_data *alg_data) · 63 unmodified lines
293293
294294 /**
295295 * i2c_pnx_master_rcv - receive data from slave
296− * @adap: pointer to I2C adapter structure
296+ * @alg_data: pointer to local driver data structure
297297 *
298298 * Reads one byte data from the slave
299299 */
drivers/i2c/busses/i2c-qcom-geni.c+21−2
@@ -100,7 +100,7 @@ static const struct geni_i2c_err_log gi2c_log[] = { · 99 unmodified lines
100100 [GP_IRQ0] = {-EIO, "Unknown I2C err GP_IRQ0"},
101101 [NACK] = {-ENXIO, "NACK: slv unresponsive, check its power/reset-ln"},
102102 [GP_IRQ2] = {-EIO, "Unknown I2C err GP IRQ2"},
103− [BUS_PROTO] = {-EPROTO, "Bus proto err, noisy/unepxected start/stop"},
103+ [BUS_PROTO] = {-EPROTO, "Bus proto err, noisy/unexpected start/stop"},
104104 [ARB_LOST] = {-EAGAIN, "Bus arbitration lost, clock line undriveable"},
105105 [GP_IRQ5] = {-EIO, "Unknown I2C err GP IRQ5"},
106106 [GENI_OVERRUN] = {-EIO, "Cmd overrun, check GENI cmd-state machine"},
@@ -650,6 +650,14 @@ static int geni_i2c_remove(struct platform_device *pdev) · 543 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-s3c2410.c+3−0
@@ -480,7 +480,10 @@ static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) · 479 unmodified lines
480480 * forces us to send a new START
481481 * when we change direction
482482 */
483+ dev_dbg(i2c->dev,
484+ "missing START before write->read\n");
483485 s3c24xx_i2c_stop(i2c, -EINVAL);
486+ break;
484487 }
485488
486489 goto retry_write;
drivers/i2c/busses/i2c-sh_mobile.c+1−1
@@ -807,7 +807,7 @@ static const struct sh_mobile_dt_config r8a7740_dt_config = { · 806 unmodified lines
807807 static const struct of_device_id sh_mobile_i2c_dt_ids[] = {
808808 { .compatible = "renesas,iic-r8a73a4", .data = &fast_clock_dt_config },
809809 { .compatible = "renesas,iic-r8a7740", .data = &r8a7740_dt_config },
810− { .compatible = "renesas,iic-r8a774c0", .data = &fast_clock_dt_config },
810+ { .compatible = "renesas,iic-r8a774c0", .data = &v2_freq_calc_dt_config },
811811 { .compatible = "renesas,iic-r8a7790", .data = &v2_freq_calc_dt_config },
812812 { .compatible = "renesas,iic-r8a7791", .data = &v2_freq_calc_dt_config },
813813 { .compatible = "renesas,iic-r8a7792", .data = &v2_freq_calc_dt_config },
drivers/i2c/busses/i2c-st.c+2−2
@@ -524,7 +524,7 @@ static void st_i2c_handle_write(struct st_i2c_dev *i2c_dev) · 523 unmodified lines
524524 }
525525
526526 /**
527− * st_i2c_handle_write() - Handle FIFO enmpty interrupt in case of read
527+ * st_i2c_handle_read() - Handle FIFO empty interrupt in case of read
528528 * @i2c_dev: Controller's private data
529529 */
530530 static void st_i2c_handle_read(struct st_i2c_dev *i2c_dev)
@@ -558,7 +558,7 @@ static void st_i2c_handle_read(struct st_i2c_dev *i2c_dev) · 27 unmodified lines
558558 }
559559
560560 /**
561− * st_i2c_isr() - Interrupt routine
561+ * st_i2c_isr_thread() - Interrupt routine
562562 * @irq: interrupt number
563563 * @data: Controller's private data
564564 */
drivers/i2c/busses/i2c-stm32f4.c+1−1
@@ -313,7 +313,7 @@ static int stm32f4_i2c_wait_free_bus(struct stm32f4_i2c_dev *i2c_dev) · 312 unmodified lines
313313 }
314314
315315 /**
316− * stm32f4_i2c_write_ byte() - Write a byte in the data register
316+ * stm32f4_i2c_write_byte() - Write a byte in the data register
317317 * @i2c_dev: Controller's private data
318318 * @byte: Data to write in the register
319319 */
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/i2c/muxes/i2c-arb-gpio-challenge.c+2−2
@@ -34,7 +34,7 @@ struct i2c_arbitrator_data { · 33 unmodified lines
3434 };
3535
3636
37−/**
37+/*
3838 * i2c_arbitrator_select - claim the I2C bus
3939 *
4040 * Use the GPIO-based signalling protocol; return -EBUSY if we fail.
@@ -77,7 +77,7 @@ static int i2c_arbitrator_select(struct i2c_mux_core *muxc, u32 chan) · 36 unmodified lines
7777 return -EBUSY;
7878 }
7979
80−/**
80+/*
8181 * i2c_arbitrator_deselect - release the I2C bus
8282 *
8383 * Release the I2C bus using the GPIO-based signalling protocol.
drivers/iio/adc/ad7124.c+20−16
@@ -771,6 +771,13 @@ static int ad7124_of_parse_channel_config(struct iio_dev *indio_dev, · 770 unmodified lines
771771 if (ret)
772772 goto err;
773773
774+ if (channel >= indio_dev->num_channels) {
775+ dev_err(indio_dev->dev.parent,
776+ "Channel index >= number of channels\n");
777+ ret = -EINVAL;
778+ goto err;
779+ }
780+
774781 ret = of_property_read_u32_array(child, "diff-channels",
775782 ain, 2);
776783 if (ret)
@@ -850,6 +857,11 @@ static int ad7124_setup(struct ad7124_state *st) · 73 unmodified lines
850857 return ret;
851858 }
852859
860+static void ad7124_reg_disable(void *r)
861+{
862+ regulator_disable(r);
863+}
864+
853865 static int ad7124_probe(struct spi_device *spi)
854866 {
855867 const struct ad7124_chip_info *info;
@@ -895,17 +907,20 @@ static int ad7124_probe(struct spi_device *spi) · 39 unmodified lines
895907 ret = regulator_enable(st->vref[i]);
896908 if (ret)
897909 return ret;
910+
911+ ret = devm_add_action_or_reset(&spi->dev, ad7124_reg_disable,
912+ st->vref[i]);
913+ if (ret)
914+ return ret;
898915 }
899916
900917 st->mclk = devm_clk_get(&spi->dev, "mclk");
901− if (IS_ERR(st->mclk)) {
902− ret = PTR_ERR(st->mclk);
903− goto error_regulator_disable;
904− }
918+ if (IS_ERR(st->mclk))
919+ return PTR_ERR(st->mclk);
905920
906921 ret = clk_prepare_enable(st->mclk);
907922 if (ret < 0)
908− goto error_regulator_disable;
923+ return ret;
909924
910925 ret = ad7124_soft_reset(st);
911926 if (ret < 0)
@@ -935,11 +950,6 @@ error_remove_trigger: · 23 unmodified lines
935950 ad_sd_cleanup_buffer_and_trigger(indio_dev);
936951 error_clk_disable_unprepare:
937952 clk_disable_unprepare(st->mclk);
938−error_regulator_disable:
939− for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) {
940− if (!IS_ERR_OR_NULL(st->vref[i]))
941− regulator_disable(st->vref[i]);
942− }
943953
944954 return ret;
945955 }
@@ -948,17 +958,11 @@ static int ad7124_remove(struct spi_device *spi) · 2 unmodified lines
948958 {
949959 struct iio_dev *indio_dev = spi_get_drvdata(spi);
950960 struct ad7124_state *st = iio_priv(indio_dev);
951− int i;
952961
953962 iio_device_unregister(indio_dev);
954963 ad_sd_cleanup_buffer_and_trigger(indio_dev);
955964 clk_disable_unprepare(st->mclk);
956965
957− for (i = ARRAY_SIZE(st->vref) - 1; i >= 0; i--) {
958− if (!IS_ERR_OR_NULL(st->vref[i]))
959− regulator_disable(st->vref[i]);
960− }
961−
962966 return 0;
963967 }
964968
drivers/iio/adc/ad7192.c+10−9
@@ -912,7 +912,7 @@ static int ad7192_probe(struct spi_device *spi) · 911 unmodified lines
912912 {
913913 struct ad7192_state *st;
914914 struct iio_dev *indio_dev;
915− int ret, voltage_uv = 0;
915+ int ret;
916916
917917 if (!spi->irq) {
918918 dev_err(&spi->dev, "no IRQ?\n");
@@ -949,15 +949,12 @@ static int ad7192_probe(struct spi_device *spi) · 30 unmodified lines
949949 goto error_disable_avdd;
950950 }
951951
952− voltage_uv = regulator_get_voltage(st->avdd);
953−
954− if (voltage_uv > 0) {
955− st->int_vref_mv = voltage_uv / 1000;
956− } else {
957− ret = voltage_uv;
952+ ret = regulator_get_voltage(st->avdd);
953+ if (ret < 0) {
958954 dev_err(&spi->dev, "Device tree error, reference voltage undefined\n");
959955 goto error_disable_avdd;
960956 }
957+ st->int_vref_mv = ret / 1000;
961958
962959 spi_set_drvdata(spi, indio_dev);
963960 st->chip_info = of_device_get_match_data(&spi->dev);
@@ -1014,7 +1011,9 @@ static int ad7192_probe(struct spi_device *spi) · 50 unmodified lines
10141011 return 0;
10151012
10161013 error_disable_clk:
1017− clk_disable_unprepare(st->mclk);
1014+ if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 ||
1015+ st->clock_sel == AD7192_CLK_EXT_MCLK2)
1016+ clk_disable_unprepare(st->mclk);
10181017 error_remove_trigger:
10191018 ad_sd_cleanup_buffer_and_trigger(indio_dev);
10201019 error_disable_dvdd:
@@ -1031,7 +1030,9 @@ static int ad7192_remove(struct spi_device *spi) · 10 unmodified lines
10311030 struct ad7192_state *st = iio_priv(indio_dev);
10321031
10331032 iio_device_unregister(indio_dev);
1034− clk_disable_unprepare(st->mclk);
1033+ if (st->clock_sel == AD7192_CLK_EXT_MCLK1_2 ||
1034+ st->clock_sel == AD7192_CLK_EXT_MCLK2)
1035+ clk_disable_unprepare(st->mclk);
10351036 ad_sd_cleanup_buffer_and_trigger(indio_dev);
10361037
10371038 regulator_disable(st->dvdd);
drivers/iio/adc/ad7768-1.c+6−2
@@ -167,6 +167,10 @@ struct ad7768_state { · 166 unmodified lines
167167 * transfer buffers to live in their own cache lines.
168168 */
169169 union {
170+ struct {
171+ __be32 chan;
172+ s64 timestamp;
173+ } scan;
170174 __be32 d32;
171175 u8 d8[2];
172176 } data ____cacheline_aligned;
@@ -469,11 +473,11 @@ static irqreturn_t ad7768_trigger_handler(int irq, void *p) · 296 unmodified lines
469473
470474 mutex_lock(&st->lock);
471475
472− ret = spi_read(st->spi, &st->data.d32, 3);
476+ ret = spi_read(st->spi, &st->data.scan.chan, 3);
473477 if (ret < 0)
474478 goto err_unlock;
475479
476− iio_push_to_buffers_with_timestamp(indio_dev, &st->data.d32,
480+ iio_push_to_buffers_with_timestamp(indio_dev, &st->data.scan,
477481 iio_get_time_ns(indio_dev));
478482
479483 iio_trigger_notify_done(indio_dev->trig);
drivers/iio/adc/ad7793.c+1−0
@@ -279,6 +279,7 @@ static int ad7793_setup(struct iio_dev *indio_dev, · 278 unmodified lines
279279 id &= AD7793_ID_MASK;
280280
281281 if (id != st->chip_info->id) {
282+ ret = -ENODEV;
282283 dev_err(&st->sd.spi->dev, "device ID query failed\n");
283284 goto out;
284285 }
drivers/iio/adc/ad7923.c+3−1
@@ -59,8 +59,10 @@ struct ad7923_state { · 58 unmodified lines
5959 /*
6060 * DMA (thus cache coherency maintenance) requires the
6161 * transfer buffers to live in their own cache lines.
62+ * Ensure rx_buf can be directly used in iio_push_to_buffers_with_timetamp
63+ * Length = 8 channels + 4 extra for 8 byte timestamp
6264 */
63− __be16 rx_buf[4] ____cacheline_aligned;
65+ __be16 rx_buf[12] ____cacheline_aligned;
6466 __be16 tx_buf[4];
6567 };
6668
drivers/iio/dac/ad5770r.c+11−5
@@ -524,23 +524,29 @@ static int ad5770r_channel_config(struct ad5770r_state *st) · 523 unmodified lines
524524 device_for_each_child_node(&st->spi->dev, child) {
525525 ret = fwnode_property_read_u32(child, "num", &num);
526526 if (ret)
527− return ret;
528− if (num >= AD5770R_MAX_CHANNELS)
529− return -EINVAL;
527+ goto err_child_out;
528+ if (num >= AD5770R_MAX_CHANNELS) {
529+ ret = -EINVAL;
530+ goto err_child_out;
531+ }
530532
531533 ret = fwnode_property_read_u32_array(child,
532534 "adi,range-microamp",
533535 tmp, 2);
534536 if (ret)
535− return ret;
537+ goto err_child_out;
536538
537539 min = tmp[0] / 1000;
538540 max = tmp[1] / 1000;
539541 ret = ad5770r_store_output_range(st, min, max, num);
540542 if (ret)
541− return ret;
543+ goto err_child_out;
542544 }
543545
546+ return 0;
547+
548+err_child_out:
549+ fwnode_handle_put(child);
544550 return ret;
545551 }
546552
drivers/iio/gyro/fxas21002c_core.c+2−0
@@ -399,6 +399,7 @@ static int fxas21002c_temp_get(struct fxas21002c_data *data, int *val) · 398 unmodified lines
399399 ret = regmap_field_read(data->regmap_fields[F_TEMP], &temp);
400400 if (ret < 0) {
401401 dev_err(dev, "failed to read temp: %d\n", ret);
402+ fxas21002c_pm_put(data);
402403 goto data_unlock;
403404 }
404405
@@ -432,6 +433,7 @@ static int fxas21002c_axis_get(struct fxas21002c_data *data, · 27 unmodified lines
432433 &axis_be, sizeof(axis_be));
433434 if (ret < 0) {
434435 dev_err(dev, "failed to read axis: %d: %d\n", index, ret);
436+ fxas21002c_pm_put(data);
435437 goto data_unlock;
436438 }
437439
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+4−4
@@ -743,10 +743,10 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev) · 742 unmodified lines
743743 ent->xlt = (1 << ent->order) * sizeof(struct mlx5_mtt) /
744744 MLX5_IB_UMR_OCTOWORD;
745745 ent->access_mode = MLX5_MKC_ACCESS_MODE_MTT;
746− if ((dev->mdev->profile->mask & MLX5_PROF_MASK_MR_CACHE) &&
746+ if ((dev->mdev->profile.mask & MLX5_PROF_MASK_MR_CACHE) &&
747747 !dev->is_rep && mlx5_core_is_pf(dev->mdev) &&
748748 mlx5_ib_can_load_pas_with_umr(dev, 0))
749− ent->limit = dev->mdev->profile->mr_cache[i].limit;
749+ ent->limit = dev->mdev->profile.mr_cache[i].limit;
750750 else
751751 ent->limit = 0;
752752 spin_lock_irq(&ent->lock);
@@ -1940,8 +1940,8 @@ int mlx5_ib_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) · 1187 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/interconnect/qcom/bcm-voter.c+3−1
@@ -1,6 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0
22 /*
3− * Copyright (c) 2020, The Linux Foundation. All rights reserved.
3+ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
44 */
55
66 #include <asm/div64.h>
@@ -205,6 +205,7 @@ struct bcm_voter *of_bcm_voter_get(struct device *dev, const char *name) · 198 unmodified lines
205205 }
206206 mutex_unlock(&bcm_voter_lock);
207207
208+ of_node_put(node);
208209 return voter;
209210 }
210211 EXPORT_SYMBOL_GPL(of_bcm_voter_get);
@@ -362,6 +363,7 @@ static const struct of_device_id bcm_voter_of_match[] = { · 151 unmodified lines
362363 { .compatible = "qcom,bcm-voter" },
363364 { }
364365 };
366+MODULE_DEVICE_TABLE(of, bcm_voter_of_match);
365367
366368 static struct platform_driver qcom_icc_bcm_voter_driver = {
367369 .probe = qcom_icc_bcm_voter_probe,
drivers/iommu/amd/iommu.c+3−1
@@ -884,7 +884,7 @@ static inline u64 build_inv_address(u64 address, size_t size) · 883 unmodified lines
884884 * The msb-bit must be clear on the address. Just set all the
885885 * lower bits.
886886 */
887− address |= 1ull << (msb_diff - 1);
887+ address |= (1ull << msb_diff) - 1;
888888 }
889889
890890 /* Clear bits 11:0 */
@@ -1714,6 +1714,8 @@ static void amd_iommu_probe_finalize(struct device *dev) · 823 unmodified lines
17141714 domain = iommu_get_domain_for_dev(dev);
17151715 if (domain->type == IOMMU_DOMAIN_DMA)
17161716 iommu_setup_dma_ops(dev, IOVA_START_PFN << PAGE_SHIFT, 0);
1717+ else
1718+ set_dma_ops(dev, NULL);
17171719 }
17181720
17191721 static void amd_iommu_release_device(struct device *dev)
drivers/iommu/intel/dmar.c+3−1
@@ -1142,7 +1142,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) · 1141 unmodified lines
11421142
11431143 err = iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL);
11441144 if (err)
1145− goto err_unmap;
1145+ goto err_sysfs;
11461146 }
11471147
11481148 drhd->iommu = iommu;
@@ -1150,6 +1150,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd) · 1 unmodified line
11501150
11511151 return 0;
11521152
1153+err_sysfs:
1154+ iommu_device_sysfs_remove(&iommu->iommu);
11531155 err_unmap:
11541156 unmap_iommu(iommu);
11551157 error_free_seq_id:
drivers/iommu/intel/iommu.c+7−2
@@ -2525,9 +2525,9 @@ static int domain_setup_first_level(struct intel_iommu *iommu, · 2524 unmodified lines
25252525 struct device *dev,
25262526 u32 pasid)
25272527 {
2528− int flags = PASID_FLAG_SUPERVISOR_MODE;
25292528 struct dma_pte *pgd = domain->pgd;
25302529 int agaw, level;
2530+ int flags = 0;
25312531
25322532 /*
25332533 * Skip top levels of page tables for iommu which has
@@ -2543,7 +2543,10 @@ static int domain_setup_first_level(struct intel_iommu *iommu, · 9 unmodified lines
25432543 if (level != 4 && level != 5)
25442544 return -EINVAL;
25452545
2546− flags |= (level == 5) ? PASID_FLAG_FL5LP : 0;
2546+ if (pasid != PASID_RID2PASID)
2547+ flags |= PASID_FLAG_SUPERVISOR_MODE;
2548+ if (level == 5)
2549+ flags |= PASID_FLAG_FL5LP;
25472550
25482551 if (domain->domain.type == IOMMU_DOMAIN_UNMANAGED)
25492552 flags |= PASID_FLAG_PAGE_SNOOP;
@@ -4606,6 +4609,8 @@ static int auxiliary_link_device(struct dmar_domain *domain, · 2056 unmodified lines
46064609
46074610 if (!sinfo) {
46084611 sinfo = kzalloc(sizeof(*sinfo), GFP_ATOMIC);
4612+ if (!sinfo)
4613+ return -ENOMEM;
46094614 sinfo->domain = domain;
46104615 sinfo->pdev = dev;
46114616 list_add(&sinfo->link_phys, &info->subdevices);
drivers/iommu/intel/pasid.c+2−1
@@ -699,7 +699,8 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, · 698 unmodified lines
699699 * Since it is a second level only translation setup, we should
700700 * set SRE bit as well (addresses are expected to be GPAs).
701701 */
702− pasid_set_sre(pte);
702+ if (pasid != PASID_RID2PASID)
703+ pasid_set_sre(pte);
703704 pasid_set_present(pte);
704705 pasid_flush_caches(iommu, pte, pasid, did);
705706
drivers/iommu/virtio-iommu.c+1−0
@@ -1136,6 +1136,7 @@ static struct virtio_device_id id_table[] = { · 1135 unmodified lines
11361136 { VIRTIO_ID_IOMMU, VIRTIO_DEV_ANY_ID },
11371137 { 0 },
11381138 };
1139+MODULE_DEVICE_TABLE(virtio, id_table);
11391140
11401141 static struct virtio_driver virtio_iommu_drv = {
11411142 .driver.name = KBUILD_MODNAME,
drivers/irqchip/irq-gic-v3.c+35−1
@@ -642,11 +642,45 @@ static inline void gic_handle_nmi(u32 irqnr, struct pt_regs *regs) · 641 unmodified lines
642642 nmi_exit();
643643 }
644644
645+static u32 do_read_iar(struct pt_regs *regs)
646+{
647+ u32 iar;
648+
649+ if (gic_supports_nmi() && unlikely(!interrupts_enabled(regs))) {
650+ u64 pmr;
651+
652+ /*
653+ * We were in a context with IRQs disabled. However, the
654+ * entry code has set PMR to a value that allows any
655+ * interrupt to be acknowledged, and not just NMIs. This can
656+ * lead to surprising effects if the NMI has been retired in
657+ * the meantime, and that there is an IRQ pending. The IRQ
658+ * would then be taken in NMI context, something that nobody
659+ * wants to debug twice.
660+ *
661+ * Until we sort this, drop PMR again to a level that will
662+ * actually only allow NMIs before reading IAR, and then
663+ * restore it to what it was.
664+ */
665+ pmr = gic_read_pmr();
666+ gic_pmr_mask_irqs();
667+ isb();
668+
669+ iar = gic_read_iar();
670+
671+ gic_write_pmr(pmr);
672+ } else {
673+ iar = gic_read_iar();
674+ }
675+
676+ return iar;
677+}
678+
645679 static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs)
646680 {
647681 u32 irqnr;
648682
649− irqnr = gic_read_iar();
683+ irqnr = do_read_iar(regs);
650684
651685 /* Check for special IDs first */
652686 if ((irqnr >= 1020 && irqnr <= 1023))
drivers/isdn/hardware/mISDN/netjet.c+0−1
@@ -1100,7 +1100,6 @@ nj_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 1099 unmodified lines
11001100 card->typ = NETJET_S_TJ300;
11011101
11021102 card->base = pci_resource_start(pdev, 0);
1103− card->irq = pdev->irq;
11041103 pci_set_drvdata(pdev, card);
11051104 err = setup_instance(card);
11061105 if (err)
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/md/dm-snap.c+2−1
@@ -859,7 +859,8 @@ static uint32_t __minimum_chunk_size(struct origin *o) · 858 unmodified lines
859859
860860 if (o)
861861 list_for_each_entry(snap, &o->snapshots, list)
862− chunk_size = min(chunk_size, snap->store->chunk_size);
862+ chunk_size = min_not_zero(chunk_size,
863+ snap->store->chunk_size);
863864
864865 return (uint32_t) chunk_size;
865866 }
drivers/md/dm-verity-verify-sig.c+1−1
@@ -15,7 +15,7 @@ · 14 unmodified lines
1515 #define DM_VERITY_VERIFY_ERR(s) DM_VERITY_ROOT_HASH_VERIFICATION " " s
1616
1717 static bool require_signatures;
18−module_param(require_signatures, bool, false);
18+module_param(require_signatures, bool, 0444);
1919 MODULE_PARM_DESC(require_signatures,
2020 "Verify the roothash of dm-verity hash tree");
2121
drivers/md/raid5.c+0−2
@@ -5311,8 +5311,6 @@ static int in_chunk_boundary(struct mddev *mddev, struct bio *bio) · 5310 unmodified lines
53115311 unsigned int chunk_sectors;
53125312 unsigned int bio_sectors = bio_sectors(bio);
53135313
5314− WARN_ON_ONCE(bio->bi_bdev->bd_partno);
5315−
53165314 chunk_sectors = min(conf->chunk_sectors, conf->prev_chunk_sectors);
53175315 return chunk_sectors >=
53185316 ((sector & (chunk_sectors - 1)) + bio_sectors);
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/misc/kgdbts.c+2−1
@@ -101,8 +101,9 @@ · 100 unmodified lines
101101 printk(KERN_INFO a); \
102102 } while (0)
103103 #define v2printk(a...) do { \
104− if (verbose > 1) \
104+ if (verbose > 1) { \
105105 printk(KERN_INFO a); \
106+ } \
106107 touch_nmi_watchdog(); \
107108 } while (0)
108109 #define eprintk(a...) do { \
drivers/misc/mei/interrupt.c+3−0
@@ -277,6 +277,9 @@ static int mei_cl_irq_read(struct mei_cl *cl, struct mei_cl_cb *cb, · 276 unmodified lines
277277 return ret;
278278 }
279279
280+ pm_runtime_mark_last_busy(dev->dev);
281+ pm_request_autosuspend(dev->dev);
282+
280283 list_move_tail(&cb->list, &cl->rd_pending);
281284
282285 return 0;
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/mtd/nand/raw/cs553x_nand.c+11−1
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/module.h>
1919 #include <linux/delay.h>
2020 #include <linux/mtd/mtd.h>
21+#include <linux/mtd/nand-ecc-sw-hamming.h>
2122 #include <linux/mtd/rawnand.h>
2223 #include <linux/mtd/partitions.h>
2324 #include <linux/iopoll.h>
@@ -240,6 +241,15 @@ static int cs_calculate_ecc(struct nand_chip *this, const u_char *dat, · 216 unmodified lines
240241 return 0;
241242 }
242243
244+static int cs553x_ecc_correct(struct nand_chip *chip,
245+ unsigned char *buf,
246+ unsigned char *read_ecc,
247+ unsigned char *calc_ecc)
248+{
249+ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
250+ chip->ecc.size, false);
251+}
252+
243253 static struct cs553x_nand_controller *controllers[4];
244254
245255 static int cs553x_attach_chip(struct nand_chip *chip)
@@ -251,7 +261,7 @@ static int cs553x_attach_chip(struct nand_chip *chip) · 5 unmodified lines
251261 chip->ecc.bytes = 3;
252262 chip->ecc.hwctl = cs_enable_hwecc;
253263 chip->ecc.calculate = cs_calculate_ecc;
254− chip->ecc.correct = rawnand_sw_hamming_correct;
264+ chip->ecc.correct = cs553x_ecc_correct;
255265 chip->ecc.strength = 1;
256266
257267 return 0;
drivers/mtd/nand/raw/fsmc_nand.c+11−1
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/sched.h>
2626 #include <linux/types.h>
2727 #include <linux/mtd/mtd.h>
28+#include <linux/mtd/nand-ecc-sw-hamming.h>
2829 #include <linux/mtd/rawnand.h>
2930 #include <linux/platform_device.h>
3031 #include <linux/of.h>
@@ -432,6 +433,15 @@ static int fsmc_read_hwecc_ecc1(struct nand_chip *chip, const u8 *data, · 401 unmodified lines
432433 return 0;
433434 }
434435
436+static int fsmc_correct_ecc1(struct nand_chip *chip,
437+ unsigned char *buf,
438+ unsigned char *read_ecc,
439+ unsigned char *calc_ecc)
440+{
441+ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
442+ chip->ecc.size, false);
443+}
444+
435445 /* Count the number of 0's in buff upto a max of max_bits */
436446 static int count_written_bits(u8 *buff, int size, int max_bits)
437447 {
@@ -917,7 +927,7 @@ static int fsmc_nand_attach_chip(struct nand_chip *nand) · 479 unmodified lines
917927 case NAND_ECC_ENGINE_TYPE_ON_HOST:
918928 dev_info(host->dev, "Using 1-bit HW ECC scheme\n");
919929 nand->ecc.calculate = fsmc_read_hwecc_ecc1;
920− nand->ecc.correct = rawnand_sw_hamming_correct;
930+ nand->ecc.correct = fsmc_correct_ecc1;
921931 nand->ecc.hwctl = fsmc_enable_hwecc;
922932 nand->ecc.bytes = 3;
923933 nand->ecc.strength = 1;
drivers/mtd/nand/raw/lpc32xx_slc.c+14−1
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 #include <linux/of.h>
2828 #include <linux/of_gpio.h>
2929 #include <linux/mtd/lpc32xx_slc.h>
30+#include <linux/mtd/nand-ecc-sw-hamming.h>
3031
3132 #define LPC32XX_MODNAME "lpc32xx-nand"
3233
@@ -344,6 +345,18 @@ static int lpc32xx_nand_ecc_calculate(struct nand_chip *chip, · 311 unmodified lines
344345 return 0;
345346 }
346347
348+/*
349+ * Corrects the data
350+ */
351+static int lpc32xx_nand_ecc_correct(struct nand_chip *chip,
352+ unsigned char *buf,
353+ unsigned char *read_ecc,
354+ unsigned char *calc_ecc)
355+{
356+ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
357+ chip->ecc.size, false);
358+}
359+
347360 /*
348361 * Read a single byte from NAND device
349362 */
@@ -802,7 +815,7 @@ static int lpc32xx_nand_attach_chip(struct nand_chip *chip) · 452 unmodified lines
802815 chip->ecc.write_oob = lpc32xx_nand_write_oob_syndrome;
803816 chip->ecc.read_oob = lpc32xx_nand_read_oob_syndrome;
804817 chip->ecc.calculate = lpc32xx_nand_ecc_calculate;
805− chip->ecc.correct = rawnand_sw_hamming_correct;
818+ chip->ecc.correct = lpc32xx_nand_ecc_correct;
806819 chip->ecc.hwctl = lpc32xx_nand_ecc_enable;
807820
808821 /*
drivers/mtd/nand/raw/ndfc.c+11−1
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/mtd/ndfc.h>
2323 #include <linux/slab.h>
2424 #include <linux/mtd/mtd.h>
25+#include <linux/mtd/nand-ecc-sw-hamming.h>
2526 #include <linux/of_address.h>
2627 #include <linux/of_platform.h>
2728 #include <asm/io.h>
@@ -100,6 +101,15 @@ static int ndfc_calculate_ecc(struct nand_chip *chip, · 72 unmodified lines
100101 return 0;
101102 }
102103
104+static int ndfc_correct_ecc(struct nand_chip *chip,
105+ unsigned char *buf,
106+ unsigned char *read_ecc,
107+ unsigned char *calc_ecc)
108+{
109+ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
110+ chip->ecc.size, false);
111+}
112+
103113 /*
104114 * Speedups for buffer read/write/verify
105115 *
@@ -145,7 +155,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, · 39 unmodified lines
145155 chip->controller = &ndfc->ndfc_control;
146156 chip->legacy.read_buf = ndfc_read_buf;
147157 chip->legacy.write_buf = ndfc_write_buf;
148− chip->ecc.correct = rawnand_sw_hamming_correct;
158+ chip->ecc.correct = ndfc_correct_ecc;
149159 chip->ecc.hwctl = ndfc_enable_hwecc;
150160 chip->ecc.calculate = ndfc_calculate_ecc;
151161 chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
drivers/mtd/nand/raw/sharpsl.c+11−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/module.h>
1212 #include <linux/delay.h>
1313 #include <linux/mtd/mtd.h>
14+#include <linux/mtd/nand-ecc-sw-hamming.h>
1415 #include <linux/mtd/rawnand.h>
1516 #include <linux/mtd/partitions.h>
1617 #include <linux/mtd/sharpsl.h>
@@ -96,6 +97,15 @@ static int sharpsl_nand_calculate_ecc(struct nand_chip *chip, · 79 unmodified lines
9697 return readb(sharpsl->io + ECCCNTR) != 0;
9798 }
9899
100+static int sharpsl_nand_correct_ecc(struct nand_chip *chip,
101+ unsigned char *buf,
102+ unsigned char *read_ecc,
103+ unsigned char *calc_ecc)
104+{
105+ return ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
106+ chip->ecc.size, false);
107+}
108+
99109 static int sharpsl_attach_chip(struct nand_chip *chip)
100110 {
101111 if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST)
@@ -106,7 +116,7 @@ static int sharpsl_attach_chip(struct nand_chip *chip) · 4 unmodified lines
106116 chip->ecc.strength = 1;
107117 chip->ecc.hwctl = sharpsl_nand_enable_hwecc;
108118 chip->ecc.calculate = sharpsl_nand_calculate_ecc;
109− chip->ecc.correct = rawnand_sw_hamming_correct;
119+ chip->ecc.correct = sharpsl_nand_correct_ecc;
110120
111121 return 0;
112122 }
drivers/mtd/nand/raw/tmio_nand.c+5−3
@@ -34,6 +34,7 @@ · 33 unmodified lines
3434 #include <linux/interrupt.h>
3535 #include <linux/ioport.h>
3636 #include <linux/mtd/mtd.h>
37+#include <linux/mtd/nand-ecc-sw-hamming.h>
3738 #include <linux/mtd/rawnand.h>
3839 #include <linux/mtd/partitions.h>
3940 #include <linux/slab.h>
@@ -292,11 +293,12 @@ static int tmio_nand_correct_data(struct nand_chip *chip, unsigned char *buf, · 252 unmodified lines
292293 int r0, r1;
293294
294295 /* assume ecc.size = 512 and ecc.bytes = 6 */
295− r0 = rawnand_sw_hamming_correct(chip, buf, read_ecc, calc_ecc);
296+ r0 = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
297+ chip->ecc.size, false);
296298 if (r0 < 0)
297299 return r0;
298− r1 = rawnand_sw_hamming_correct(chip, buf + 256, read_ecc + 3,
299− calc_ecc + 3);
300+ r1 = ecc_sw_hamming_correct(buf + 256, read_ecc + 3, calc_ecc + 3,
301+ chip->ecc.size, false);
300302 if (r1 < 0)
301303 return r1;
302304 return r0 + r1;
drivers/mtd/nand/raw/txx9ndfmc.c+3−2
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/platform_device.h>
1414 #include <linux/delay.h>
1515 #include <linux/mtd/mtd.h>
16+#include <linux/mtd/nand-ecc-sw-hamming.h>
1617 #include <linux/mtd/rawnand.h>
1718 #include <linux/mtd/partitions.h>
1819 #include <linux/io.h>
@@ -193,8 +194,8 @@ static int txx9ndfmc_correct_data(struct nand_chip *chip, unsigned char *buf, · 174 unmodified lines
193194 int stat;
194195
195196 for (eccsize = chip->ecc.size; eccsize > 0; eccsize -= 256) {
196− stat = rawnand_sw_hamming_correct(chip, buf, read_ecc,
197− calc_ecc);
197+ stat = ecc_sw_hamming_correct(buf, read_ecc, calc_ecc,
198+ chip->ecc.size, false);
198199 if (stat < 0)
199200 return stat;
200201 corrected += stat;
drivers/mtd/parsers/ofpart_core.c+14−12
@@ -57,20 +57,22 @@ static int parse_fixed_partitions(struct mtd_info *master, · 56 unmodified lines
5757 if (!mtd_node)
5858 return 0;
5959
60− ofpart_node = of_get_child_by_name(mtd_node, "partitions");
61− if (!ofpart_node && !master->parent) {
62− /*
63− * We might get here even when ofpart isn't used at all (e.g.,
64− * when using another parser), so don't be louder than
65− * KERN_DEBUG
66− */
67− pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n",
68− master->name, mtd_node);
60+ if (!master->parent) { /* Master */
61+ ofpart_node = of_get_child_by_name(mtd_node, "partitions");
62+ if (!ofpart_node) {
63+ /*
64+ * We might get here even when ofpart isn't used at all (e.g.,
65+ * when using another parser), so don't be louder than
66+ * KERN_DEBUG
67+ */
68+ pr_debug("%s: 'partitions' subnode not found on %pOF. Trying to parse direct subnodes as partitions.\n",
69+ master->name, mtd_node);
70+ ofpart_node = mtd_node;
71+ dedicated = false;
72+ }
73+ } else { /* Partition */
6974 ofpart_node = mtd_node;
70− dedicated = false;
7175 }
72− if (!ofpart_node)
73− return 0;
7476
7577 of_id = of_match_node(parse_ofpart_match_table, ofpart_node);
7678 if (dedicated && !of_id) {
drivers/net/appletalk/cops.c+2−2
@@ -327,6 +327,8 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) · 326 unmodified lines
327327 break;
328328 }
329329
330+ dev->base_addr = ioaddr;
331+
330332 /* Reserve any actual interrupt. */
331333 if (dev->irq) {
332334 retval = request_irq(dev->irq, cops_interrupt, 0, dev->name, dev);
@@ -334,8 +336,6 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) · 1 unmodified line
334336 goto err_out;
335337 }
336338
337− dev->base_addr = ioaddr;
338−
339339 lp = netdev_priv(dev);
340340 spin_lock_init(&lp->lock);
341341
drivers/net/bonding/bond_main.c+1−1
@@ -1526,6 +1526,7 @@ static struct slave *bond_alloc_slave(struct bonding *bond, · 1525 unmodified lines
15261526
15271527 slave->bond = bond;
15281528 slave->dev = slave_dev;
1529+ INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);
15291530
15301531 if (bond_kobj_init(slave))
15311532 return NULL;
@@ -1538,7 +1539,6 @@ static struct slave *bond_alloc_slave(struct bonding *bond, · 6 unmodified lines
15381539 return NULL;
15391540 }
15401541 }
1541− INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work);
15421542
15431543 return slave;
15441544 }
drivers/net/caif/caif_serial.c+1−0
@@ -350,6 +350,7 @@ static int ldisc_open(struct tty_struct *tty) · 349 unmodified lines
350350 rtnl_lock();
351351 result = register_netdevice(dev);
352352 if (result) {
353+ tty_kref_put(tty);
353354 rtnl_unlock();
354355 free_netdev(dev);
355356 return -ENODEV;
drivers/net/can/usb/mcba_usb.c+15−2
@@ -82,6 +82,8 @@ struct mcba_priv { · 81 unmodified lines
8282 bool can_ka_first_pass;
8383 bool can_speed_check;
8484 atomic_t free_ctx_cnt;
85+ void *rxbuf[MCBA_MAX_RX_URBS];
86+ dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS];
8587 };
8688
8789 /* CAN frame */
@@ -633,6 +635,7 @@ static int mcba_usb_start(struct mcba_priv *priv) · 545 unmodified lines
633635 for (i = 0; i < MCBA_MAX_RX_URBS; i++) {
634636 struct urb *urb = NULL;
635637 u8 *buf;
638+ dma_addr_t buf_dma;
636639
637640 /* create a URB, and a buffer for it */
638641 urb = usb_alloc_urb(0, GFP_KERNEL);
@@ -642,7 +645,7 @@ static int mcba_usb_start(struct mcba_priv *priv) · 3 unmodified lines
642645 }
643646
644647 buf = usb_alloc_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE,
645− GFP_KERNEL, &urb->transfer_dma);
648+ GFP_KERNEL, &buf_dma);
646649 if (!buf) {
647650 netdev_err(netdev, "No memory left for USB buffer\n");
648651 usb_free_urb(urb);
@@ -661,11 +664,14 @@ static int mcba_usb_start(struct mcba_priv *priv) · 12 unmodified lines
661664 if (err) {
662665 usb_unanchor_urb(urb);
663666 usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE,
664− buf, urb->transfer_dma);
667+ buf, buf_dma);
665668 usb_free_urb(urb);
666669 break;
667670 }
668671
672+ priv->rxbuf[i] = buf;
673+ priv->rxbuf_dma[i] = buf_dma;
674+
669675 /* Drop reference, USB core will take care of freeing it */
670676 usb_free_urb(urb);
671677 }
@@ -708,7 +714,14 @@ static int mcba_usb_open(struct net_device *netdev) · 36 unmodified lines
708714
709715 static void mcba_urb_unlink(struct mcba_priv *priv)
710716 {
717+ int i;
718+
711719 usb_kill_anchored_urbs(&priv->rx_submitted);
720+
721+ for (i = 0; i < MCBA_MAX_RX_URBS; ++i)
722+ usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE,
723+ priv->rxbuf[i], priv->rxbuf_dma[i]);
724+
712725 usb_kill_anchored_urbs(&priv->tx_submitted);
713726 }
714727
drivers/net/dsa/bcm_sf2.c+2−3
@@ -821,11 +821,9 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, · 820 unmodified lines
821821 bcm_sf2_sw_mac_link_set(ds, port, interface, true);
822822
823823 if (port != core_readl(priv, CORE_IMP0_PRT_ID)) {
824− u32 reg_rgmii_ctrl;
824+ u32 reg_rgmii_ctrl = 0;
825825 u32 reg, offset;
826826
827− reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port);
828−
829827 if (priv->type == BCM4908_DEVICE_ID ||
830828 priv->type == BCM7445_DEVICE_ID)
831829 offset = CORE_STS_OVERRIDE_GMIIP_PORT(port);
@@ -836,6 +834,7 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port, · 4 unmodified lines
836834 interface == PHY_INTERFACE_MODE_RGMII_TXID ||
837835 interface == PHY_INTERFACE_MODE_MII ||
838836 interface == PHY_INTERFACE_MODE_REVMII) {
837+ reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port);
839838 reg = reg_readl(priv, reg_rgmii_ctrl);
840839 reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN);
841840
drivers/net/dsa/microchip/ksz9477.c+1−0
@@ -1530,6 +1530,7 @@ static const struct ksz_chip_data ksz9477_switch_chips[] = { · 1529 unmodified lines
15301530 .num_statics = 16,
15311531 .cpu_ports = 0x7F, /* can be configured as cpu port */
15321532 .port_cnt = 7, /* total physical port count */
1533+ .phy_errata_9477 = true,
15331534 },
15341535 };
15351536
drivers/net/dsa/mt7530.c+0−8
@@ -1262,14 +1262,6 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) · 1261 unmodified lines
12621262 {
12631263 struct mt7530_priv *priv = ds->priv;
12641264
1265− /* The real fabric path would be decided on the membership in the
1266− * entry of VLAN table. PCR_MATRIX set up here with ALL_MEMBERS
1267− * means potential VLAN can be consisting of certain subset of all
1268− * ports.
1269− */
1270− mt7530_rmw(priv, MT7530_PCR_P(port),
1271− PCR_MATRIX_MASK, PCR_MATRIX(MT7530_ALL_MEMBERS));
1272−
12731265 /* Trapped into security mode allows packet forwarding through VLAN
12741266 * table lookup. CPU port is set to fallback mode to let untagged
12751267 * frames pass through.
drivers/net/dsa/ocelot/felix_vsc9959.c+10−5
@@ -1227,12 +1227,17 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, · 1226 unmodified lines
12271227 if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX)
12281228 return -ERANGE;
12291229
1230− /* Set port num and disable ALWAYS_GUARD_BAND_SCH_Q, which means set
1231− * guard band to be implemented for nonschedule queues to schedule
1232− * queues transition.
1230+ /* Enable guard band. The switch will schedule frames without taking
1231+ * their length into account. Thus we'll always need to enable the
1232+ * guard band which reserves the time of a maximum sized frame at the
1233+ * end of the time window.
1234+ *
1235+ * Although the ALWAYS_GUARD_BAND_SCH_Q bit is global for all ports, we
1236+ * need to set PORT_NUM, because subsequent writes to PARAM_CFG_REG_n
1237+ * operate on the port number.
12331238 */
1234− ocelot_rmw(ocelot,
1235− QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port),
1239+ ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port) |
1240+ QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q,
12361241 QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M |
12371242 QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q,
12381243 QSYS_TAS_PARAM_CFG_CTRL);
drivers/net/dsa/sja1105/sja1105_dynamic_config.c+19−4
@@ -167,9 +167,10 @@ enum sja1105_hostcmd { · 166 unmodified lines
167167 SJA1105_HOSTCMD_INVALIDATE = 4,
168168 };
169169
170+/* Command and entry overlap */
170171 static void
171−sja1105_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
172− enum packing_op op)
172+sja1105et_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
173+ enum packing_op op)
173174 {
174175 const int size = SJA1105_SIZE_DYN_CMD;
175176
@@ -179,6 +180,20 @@ sja1105_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd, · 3 unmodified lines
179180 sja1105_packing(buf, &cmd->index, 9, 0, size, op);
180181 }
181182
183+/* Command and entry are separate */
184+static void
185+sja1105pqrs_vl_lookup_cmd_packing(void *buf, struct sja1105_dyn_cmd *cmd,
186+ enum packing_op op)
187+{
188+ u8 *p = buf + SJA1105_SIZE_VL_LOOKUP_ENTRY;
189+ const int size = SJA1105_SIZE_DYN_CMD;
190+
191+ sja1105_packing(p, &cmd->valid, 31, 31, size, op);
192+ sja1105_packing(p, &cmd->errors, 30, 30, size, op);
193+ sja1105_packing(p, &cmd->rdwrset, 29, 29, size, op);
194+ sja1105_packing(p, &cmd->index, 9, 0, size, op);
195+}
196+
182197 static size_t sja1105et_vl_lookup_entry_packing(void *buf, void *entry_ptr,
183198 enum packing_op op)
184199 {
@@ -641,7 +656,7 @@ static size_t sja1105pqrs_cbs_entry_packing(void *buf, void *entry_ptr, · 456 unmodified lines
641656 const struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN] = {
642657 [BLK_IDX_VL_LOOKUP] = {
643658 .entry_packing = sja1105et_vl_lookup_entry_packing,
644− .cmd_packing = sja1105_vl_lookup_cmd_packing,
659+ .cmd_packing = sja1105et_vl_lookup_cmd_packing,
645660 .access = OP_WRITE,
646661 .max_entry_count = SJA1105_MAX_VL_LOOKUP_COUNT,
647662 .packed_size = SJA1105ET_SIZE_VL_LOOKUP_DYN_CMD,
@@ -725,7 +740,7 @@ const struct sja1105_dynamic_table_ops sja1105et_dyn_ops[BLK_IDX_MAX_DYN] = { · 77 unmodified lines
725740 const struct sja1105_dynamic_table_ops sja1105pqrs_dyn_ops[BLK_IDX_MAX_DYN] = {
726741 [BLK_IDX_VL_LOOKUP] = {
727742 .entry_packing = sja1105_vl_lookup_entry_packing,
728− .cmd_packing = sja1105_vl_lookup_cmd_packing,
743+ .cmd_packing = sja1105pqrs_vl_lookup_cmd_packing,
729744 .access = (OP_READ | OP_WRITE),
730745 .max_entry_count = SJA1105_MAX_VL_LOOKUP_COUNT,
731746 .packed_size = SJA1105PQRS_SIZE_VL_LOOKUP_DYN_CMD,
drivers/net/dsa/sja1105/sja1105_main.c+51−23
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include "sja1105_tas.h"
2727
2828 #define SJA1105_UNKNOWN_MULTICAST 0x010000000000ull
29+#define SJA1105_DEFAULT_VLAN (VLAN_N_VID - 1)
2930
3031 static const struct dsa_switch_ops sja1105_switch_ops;
3132
@@ -207,6 +208,7 @@ static int sja1105_init_mii_settings(struct sja1105_private *priv, · 175 unmodified lines
207208 default:
208209 dev_err(dev, "Unsupported PHY mode %s!\n",
209210 phy_modes(ports[i].phy_mode));
211+ return -EINVAL;
210212 }
211213
212214 /* Even though the SerDes port is able to drive SGMII autoneg
@@ -321,6 +323,13 @@ static int sja1105_init_l2_lookup_params(struct sja1105_private *priv) · 108 unmodified lines
321323 return 0;
322324 }
323325
326+/* Set up a default VLAN for untagged traffic injected from the CPU
327+ * using management routes (e.g. STP, PTP) as opposed to tag_8021q.
328+ * All DT-defined ports are members of this VLAN, and there are no
329+ * restrictions on forwarding (since the CPU selects the destination).
330+ * Frames from this VLAN will always be transmitted as untagged, and
331+ * neither the bridge nor the 8021q module cannot create this VLAN ID.
332+ */
324333 static int sja1105_init_static_vlan(struct sja1105_private *priv)
325334 {
326335 struct sja1105_table *table;
@@ -330,17 +339,13 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 3 unmodified lines
330339 .vmemb_port = 0,
331340 .vlan_bc = 0,
332341 .tag_port = 0,
333− .vlanid = 1,
342+ .vlanid = SJA1105_DEFAULT_VLAN,
334343 };
335344 struct dsa_switch *ds = priv->ds;
336345 int port;
337346
338347 table = &priv->static_config.tables[BLK_IDX_VLAN_LOOKUP];
339348
340− /* The static VLAN table will only contain the initial pvid of 1.
341− * All other VLANs are to be configured through dynamic entries,
342− * and kept in the static configuration table as backing memory.
343− */
344349 if (table->entry_count) {
345350 kfree(table->entries);
346351 table->entry_count = 0;
@@ -353,9 +358,6 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 6 unmodified lines
353358
354359 table->entry_count = 1;
355360
356− /* VLAN 1: all DT-defined ports are members; no restrictions on
357− * forwarding; always transmit as untagged.
358− */
359361 for (port = 0; port < ds->num_ports; port++) {
360362 struct sja1105_bridge_vlan *v;
361363
@@ -366,15 +368,12 @@ static int sja1105_init_static_vlan(struct sja1105_private *priv) · 4 unmodified lines
366368 pvid.vlan_bc |= BIT(port);
367369 pvid.tag_port &= ~BIT(port);
368370
369− /* Let traffic that don't need dsa_8021q (e.g. STP, PTP) be
370− * transmitted as untagged.
371− */
372371 v = kzalloc(sizeof(*v), GFP_KERNEL);
373372 if (!v)
374373 return -ENOMEM;
375374
376375 v->port = port;
377− v->vid = 1;
376+ v->vid = SJA1105_DEFAULT_VLAN;
378377 v->untagged = true;
379378 if (dsa_is_cpu_port(ds, port))
380379 v->pvid = true;
@@ -2817,11 +2816,22 @@ static int sja1105_vlan_add_one(struct dsa_switch *ds, int port, u16 vid, · 2436 unmodified lines
28172816 bool pvid = flags & BRIDGE_VLAN_INFO_PVID;
28182817 struct sja1105_bridge_vlan *v;
28192818
2820− list_for_each_entry(v, vlan_list, list)
2821− if (v->port == port && v->vid == vid &&
2822− v->untagged == untagged && v->pvid == pvid)
2819+ list_for_each_entry(v, vlan_list, list) {
2820+ if (v->port == port && v->vid == vid) {
28232821 /* Already added */
2824− return 0;
2822+ if (v->untagged == untagged && v->pvid == pvid)
2823+ /* Nothing changed */
2824+ return 0;
2825+
2826+ /* It's the same VLAN, but some of the flags changed
2827+ * and the user did not bother to delete it first.
2828+ * Update it and trigger sja1105_build_vlan_table.
2829+ */
2830+ v->untagged = untagged;
2831+ v->pvid = pvid;
2832+ return 1;
2833+ }
2834+ }
28252835
28262836 v = kzalloc(sizeof(*v), GFP_KERNEL);
28272837 if (!v) {
@@ -2976,13 +2986,13 @@ static int sja1105_setup(struct dsa_switch *ds) · 148 unmodified lines
29762986 rc = sja1105_static_config_load(priv, ports);
29772987 if (rc < 0) {
29782988 dev_err(ds->dev, "Failed to load static config: %d\n", rc);
2979− return rc;
2989+ goto out_ptp_clock_unregister;
29802990 }
29812991 /* Configure the CGU (PHY link modes and speeds) */
29822992 rc = sja1105_clocking_setup(priv);
29832993 if (rc < 0) {
29842994 dev_err(ds->dev, "Failed to configure MII clocking: %d\n", rc);
2985− return rc;
2995+ goto out_static_config_free;
29862996 }
29872997 /* On SJA1105, VLAN filtering per se is always enabled in hardware.
29882998 * The only thing we can do to disable it is lie about what the 802.1Q
@@ -3003,7 +3013,7 @@ static int sja1105_setup(struct dsa_switch *ds) · 14 unmodified lines
30033013
30043014 rc = sja1105_devlink_setup(ds);
30053015 if (rc < 0)
3006− return rc;
3016+ goto out_static_config_free;
30073017
30083018 /* The DSA/switchdev model brings up switch ports in standalone mode by
30093019 * default, and that means vlan_filtering is 0 since they're not under
@@ -3012,6 +3022,17 @@ static int sja1105_setup(struct dsa_switch *ds) · 2 unmodified lines
30123022 rtnl_lock();
30133023 rc = sja1105_setup_8021q_tagging(ds, true);
30143024 rtnl_unlock();
3025+ if (rc)
3026+ goto out_devlink_teardown;
3027+
3028+ return 0;
3029+
3030+out_devlink_teardown:
3031+ sja1105_devlink_teardown(ds);
3032+out_ptp_clock_unregister:
3033+ sja1105_ptp_clock_unregister(ds);
3034+out_static_config_free:
3035+ sja1105_static_config_free(&priv->static_config);
30153036
30163037 return rc;
30173038 }
@@ -3646,8 +3667,10 @@ static int sja1105_probe(struct spi_device *spi) · 628 unmodified lines
36463667 priv->cbs = devm_kcalloc(dev, priv->info->num_cbs_shapers,
36473668 sizeof(struct sja1105_cbs_entry),
36483669 GFP_KERNEL);
3649− if (!priv->cbs)
3650− return -ENOMEM;
3670+ if (!priv->cbs) {
3671+ rc = -ENOMEM;
3672+ goto out_unregister_switch;
3673+ }
36513674 }
36523675
36533676 /* Connections between dsa_port and sja1105_port */
@@ -3672,7 +3695,7 @@ static int sja1105_probe(struct spi_device *spi) · 18 unmodified lines
36723695 dev_err(ds->dev,
36733696 "failed to create deferred xmit thread: %d\n",
36743697 rc);
3675− goto out;
3698+ goto out_destroy_workers;
36763699 }
36773700 skb_queue_head_init(&sp->xmit_queue);
36783701 sp->xmit_tpid = ETH_P_SJA1105;
@@ -3682,7 +3705,8 @@ static int sja1105_probe(struct spi_device *spi) · 3 unmodified lines
36823705 }
36833706
36843707 return 0;
3685−out:
3708+
3709+out_destroy_workers:
36863710 while (port-- > 0) {
36873711 struct sja1105_port *sp = &priv->ports[port];
36883712
@@ -3691,6 +3715,10 @@ out: · 2 unmodified lines
36913715
36923716 kthread_destroy_worker(sp->xmit_worker);
36933717 }
3718+
3719+out_unregister_switch:
3720+ dsa_unregister_switch(ds);
3721+
36943722 return rc;
36953723 }
36963724
drivers/net/ethernet/amazon/ena/ena_netdev.c+28−26
@@ -236,36 +236,48 @@ static int ena_xdp_io_poll(struct napi_struct *napi, int budget) · 235 unmodified lines
236236 static int ena_xdp_tx_map_frame(struct ena_ring *xdp_ring,
237237 struct ena_tx_buffer *tx_info,
238238 struct xdp_frame *xdpf,
239− void **push_hdr,
240− u32 *push_len)
239+ struct ena_com_tx_ctx *ena_tx_ctx)
241240 {
242241 struct ena_adapter *adapter = xdp_ring->adapter;
243242 struct ena_com_buf *ena_buf;
244− dma_addr_t dma = 0;
243+ int push_len = 0;
244+ dma_addr_t dma;
245+ void *data;
245246 u32 size;
246247
247248 tx_info->xdpf = xdpf;
249+ data = tx_info->xdpf->data;
248250 size = tx_info->xdpf->len;
249− ena_buf = tx_info->bufs;
250251
251− /* llq push buffer */
252− *push_len = min_t(u32, size, xdp_ring->tx_max_header_size);
253− *push_hdr = tx_info->xdpf->data;
252+ if (xdp_ring->tx_mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV) {
253+ /* Designate part of the packet for LLQ */
254+ push_len = min_t(u32, size, xdp_ring->tx_max_header_size);
255+
256+ ena_tx_ctx->push_header = data;
257+
258+ size -= push_len;
259+ data += push_len;
260+ }
261+
262+ ena_tx_ctx->header_len = push_len;
254263
255− if (size - *push_len > 0) {
264+ if (size > 0) {
256265 dma = dma_map_single(xdp_ring->dev,
257− *push_hdr + *push_len,
258− size - *push_len,
266+ data,
267+ size,
259268 DMA_TO_DEVICE);
260269 if (unlikely(dma_mapping_error(xdp_ring->dev, dma)))
261270 goto error_report_dma_error;
262271
263− tx_info->map_linear_data = 1;
264− tx_info->num_of_bufs = 1;
265− }
272+ tx_info->map_linear_data = 0;
266273
267− ena_buf->paddr = dma;
268− ena_buf->len = size;
274+ ena_buf = tx_info->bufs;
275+ ena_buf->paddr = dma;
276+ ena_buf->len = size;
277+
278+ ena_tx_ctx->ena_bufs = ena_buf;
279+ ena_tx_ctx->num_bufs = tx_info->num_of_bufs = 1;
280+ }
269281
270282 return 0;
271283
@@ -274,10 +286,6 @@ error_report_dma_error: · 2 unmodified lines
274286 &xdp_ring->syncp);
275287 netif_warn(adapter, tx_queued, adapter->netdev, "Failed to map xdp buff\n");
276288
277− xdp_return_frame_rx_napi(tx_info->xdpf);
278− tx_info->xdpf = NULL;
279− tx_info->num_of_bufs = 0;
280−
281289 return -EINVAL;
282290 }
283291
@@ -289,8 +297,6 @@ static int ena_xdp_xmit_frame(struct ena_ring *xdp_ring, · 5 unmodified lines
289297 struct ena_com_tx_ctx ena_tx_ctx = {};
290298 struct ena_tx_buffer *tx_info;
291299 u16 next_to_use, req_id;
292− void *push_hdr;
293− u32 push_len;
294300 int rc;
295301
296302 next_to_use = xdp_ring->next_to_use;
@@ -298,15 +304,11 @@ static int ena_xdp_xmit_frame(struct ena_ring *xdp_ring, · 1 unmodified line
298304 tx_info = &xdp_ring->tx_buffer_info[req_id];
299305 tx_info->num_of_bufs = 0;
300306
301− rc = ena_xdp_tx_map_frame(xdp_ring, tx_info, xdpf, &push_hdr, &push_len);
307+ rc = ena_xdp_tx_map_frame(xdp_ring, tx_info, xdpf, &ena_tx_ctx);
302308 if (unlikely(rc))
303309 return rc;
304310
305− ena_tx_ctx.ena_bufs = tx_info->bufs;
306− ena_tx_ctx.push_header = push_hdr;
307− ena_tx_ctx.num_bufs = tx_info->num_of_bufs;
308311 ena_tx_ctx.req_id = req_id;
309− ena_tx_ctx.header_len = push_len;
310312
311313 rc = ena_xmit_common(dev,
312314 xdp_ring,
drivers/net/ethernet/atheros/alx/main.c+1−0
@@ -1849,6 +1849,7 @@ out_free_netdev: · 1848 unmodified lines
18491849 free_netdev(netdev);
18501850 out_pci_release:
18511851 pci_release_mem_regions(pdev);
1852+ pci_disable_pcie_error_reporting(pdev);
18521853 out_pci_disable:
18531854 pci_disable_device(pdev);
18541855 return err;
drivers/net/ethernet/broadcom/bnx2.c+1−1
@@ -8247,9 +8247,9 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev) · 8246 unmodified lines
82478247 BNX2_WR(bp, PCI_COMMAND, reg);
82488248 } else if ((BNX2_CHIP_ID(bp) == BNX2_CHIP_ID_5706_A1) &&
82498249 !(bp->flags & BNX2_FLAG_PCIX)) {
8250−
82518250 dev_err(&pdev->dev,
82528251 "5706 A1 can only be used in a PCIX bus, aborting\n");
8252+ rc = -EPERM;
82538253 goto err_out_unmap;
82548254 }
82558255
drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c+3−1
@@ -1223,8 +1223,10 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, · 1222 unmodified lines
12231223 goto failed;
12241224
12251225 /* SR-IOV capability was enabled but there are no VFs*/
1226− if (iov->total == 0)
1226+ if (iov->total == 0) {
1227+ err = -EINVAL;
12271228 goto failed;
1229+ }
12281230
12291231 iov->nr_virtfn = min_t(u16, iov->total, num_vfs_param);
12301232
drivers/net/ethernet/broadcom/bnxt/bnxt.c+117−29
@@ -282,7 +282,8 @@ static bool bnxt_vf_pciid(enum board_idx idx) · 281 unmodified lines
282282 {
283283 return (idx == NETXTREME_C_VF || idx == NETXTREME_E_VF ||
284284 idx == NETXTREME_S_VF || idx == NETXTREME_C_VF_HV ||
285− idx == NETXTREME_E_VF_HV || idx == NETXTREME_E_P5_VF);
285+ idx == NETXTREME_E_VF_HV || idx == NETXTREME_E_P5_VF ||
286+ idx == NETXTREME_E_P5_VF_HV);
286287 }
287288
288289 #define DB_CP_REARM_FLAGS (DB_KEY_CP | DB_IDX_VALID)
@@ -6932,17 +6933,10 @@ ctx_err: · 6643 unmodified lines
69326933 static void bnxt_hwrm_set_pg_attr(struct bnxt_ring_mem_info *rmem, u8 *pg_attr,
69336934 __le64 *pg_dir)
69346935 {
6935− u8 pg_size = 0;
6936−
69376936 if (!rmem->nr_pages)
69386937 return;
69396938
6940− if (BNXT_PAGE_SHIFT == 13)
6941− pg_size = 1 << 4;
6942− else if (BNXT_PAGE_SIZE == 16)
6943− pg_size = 2 << 4;
6944−
6945− *pg_attr = pg_size;
6939+ BNXT_SET_CTX_PAGE_ATTR(*pg_attr);
69466940 if (rmem->depth >= 1) {
69476941 if (rmem->depth == 2)
69486942 *pg_attr |= 2;
@@ -7314,7 +7308,7 @@ skip_rdma: · 365 unmodified lines
73147308 entries_sp = ctx->vnic_max_vnic_entries + ctx->qp_max_l2_entries +
73157309 2 * (extra_qps + ctx->qp_min_qp1_entries) + min;
73167310 entries_sp = roundup(entries_sp, ctx->tqm_entries_multiple);
7317− entries = ctx->qp_max_l2_entries + extra_qps + ctx->qp_min_qp1_entries;
7311+ entries = ctx->qp_max_l2_entries + 2 * (extra_qps + ctx->qp_min_qp1_entries);
73187312 entries = roundup(entries, ctx->tqm_entries_multiple);
73197313 entries = clamp_t(u32, entries, min, ctx->tqm_max_entries_per_ring);
73207314 for (i = 0; i < ctx->tqm_fp_rings_count + 1; i++) {
@@ -10785,37 +10779,125 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) · 3464 unmodified lines
1078510779 return rc;
1078610780 }
1078710781
10782+static bool bnxt_exthdr_check(struct bnxt *bp, struct sk_buff *skb, int nw_off,
10783+ u8 **nextp)
10784+{
10785+ struct ipv6hdr *ip6h = (struct ipv6hdr *)(skb->data + nw_off);
10786+ int hdr_count = 0;
10787+ u8 *nexthdr;
10788+ int start;
10789+
10790+ /* Check that there are at most 2 IPv6 extension headers, no
10791+ * fragment header, and each is <= 64 bytes.
10792+ */
10793+ start = nw_off + sizeof(*ip6h);
10794+ nexthdr = &ip6h->nexthdr;
10795+ while (ipv6_ext_hdr(*nexthdr)) {
10796+ struct ipv6_opt_hdr *hp;
10797+ int hdrlen;
10798+
10799+ if (hdr_count >= 3 || *nexthdr == NEXTHDR_NONE ||
10800+ *nexthdr == NEXTHDR_FRAGMENT)
10801+ return false;
10802+ hp = __skb_header_pointer(NULL, start, sizeof(*hp), skb->data,
10803+ skb_headlen(skb), NULL);
10804+ if (!hp)
10805+ return false;
10806+ if (*nexthdr == NEXTHDR_AUTH)
10807+ hdrlen = ipv6_authlen(hp);
10808+ else
10809+ hdrlen = ipv6_optlen(hp);
10810+
10811+ if (hdrlen > 64)
10812+ return false;
10813+ nexthdr = &hp->nexthdr;
10814+ start += hdrlen;
10815+ hdr_count++;
10816+ }
10817+ if (nextp) {
10818+ /* Caller will check inner protocol */
10819+ if (skb->encapsulation) {
10820+ *nextp = nexthdr;
10821+ return true;
10822+ }
10823+ *nextp = NULL;
10824+ }
10825+ /* Only support TCP/UDP for non-tunneled ipv6 and inner ipv6 */
10826+ return *nexthdr == IPPROTO_TCP || *nexthdr == IPPROTO_UDP;
10827+}
10828+
10829+/* For UDP, we can only handle 1 Vxlan port and 1 Geneve port. */
10830+static bool bnxt_udp_tunl_check(struct bnxt *bp, struct sk_buff *skb)
10831+{
10832+ struct udphdr *uh = udp_hdr(skb);
10833+ __be16 udp_port = uh->dest;
10834+
10835+ if (udp_port != bp->vxlan_port && udp_port != bp->nge_port)
10836+ return false;
10837+ if (skb->inner_protocol_type == ENCAP_TYPE_ETHER) {
10838+ struct ethhdr *eh = inner_eth_hdr(skb);
10839+
10840+ switch (eh->h_proto) {
10841+ case htons(ETH_P_IP):
10842+ return true;
10843+ case htons(ETH_P_IPV6):
10844+ return bnxt_exthdr_check(bp, skb,
10845+ skb_inner_network_offset(skb),
10846+ NULL);
10847+ }
10848+ }
10849+ return false;
10850+}
10851+
10852+static bool bnxt_tunl_check(struct bnxt *bp, struct sk_buff *skb, u8 l4_proto)
10853+{
10854+ switch (l4_proto) {
10855+ case IPPROTO_UDP:
10856+ return bnxt_udp_tunl_check(bp, skb);
10857+ case IPPROTO_IPIP:
10858+ return true;
10859+ case IPPROTO_GRE: {
10860+ switch (skb->inner_protocol) {
10861+ default:
10862+ return false;
10863+ case htons(ETH_P_IP):
10864+ return true;
10865+ case htons(ETH_P_IPV6):
10866+ fallthrough;
10867+ }
10868+ }
10869+ case IPPROTO_IPV6:
10870+ /* Check ext headers of inner ipv6 */
10871+ return bnxt_exthdr_check(bp, skb, skb_inner_network_offset(skb),
10872+ NULL);
10873+ }
10874+ return false;
10875+}
10876+
1078810877 static netdev_features_t bnxt_features_check(struct sk_buff *skb,
1078910878 struct net_device *dev,
1079010879 netdev_features_t features)
1079110880 {
10792− struct bnxt *bp;
10793− __be16 udp_port;
10794− u8 l4_proto = 0;
10881+ struct bnxt *bp = netdev_priv(dev);
10882+ u8 *l4_proto;
1079510883
1079610884 features = vlan_features_check(skb, features);
10797− if (!skb->encapsulation)
10798− return features;
10799−
1080010885 switch (vlan_get_protocol(skb)) {
1080110886 case htons(ETH_P_IP):
10802− l4_proto = ip_hdr(skb)->protocol;
10887+ if (!skb->encapsulation)
10888+ return features;
10889+ l4_proto = &ip_hdr(skb)->protocol;
10890+ if (bnxt_tunl_check(bp, skb, *l4_proto))
10891+ return features;
1080310892 break;
1080410893 case htons(ETH_P_IPV6):
10805− l4_proto = ipv6_hdr(skb)->nexthdr;
10894+ if (!bnxt_exthdr_check(bp, skb, skb_network_offset(skb),
10895+ &l4_proto))
10896+ break;
10897+ if (!l4_proto || bnxt_tunl_check(bp, skb, *l4_proto))
10898+ return features;
1080610899 break;
10807− default:
10808− return features;
1080910900 }
10810−
10811− if (l4_proto != IPPROTO_UDP)
10812− return features;
10813−
10814− bp = netdev_priv(dev);
10815− /* For UDP, we can only handle 1 Vxlan port and 1 Geneve port. */
10816− udp_port = udp_hdr(skb)->dest;
10817− if (udp_port == bp->vxlan_port || udp_port == bp->nge_port)
10818− return features;
1081910901 return features & ~(NETIF_F_CSUM_MASK | NETIF_F_GSO_MASK);
1082010902 }
1082110903
@@ -11668,6 +11750,8 @@ static void bnxt_fw_init_one_p3(struct bnxt *bp) · 846 unmodified lines
1166811750 bnxt_hwrm_coal_params_qcaps(bp);
1166911751 }
1167011752
11753+static int bnxt_probe_phy(struct bnxt *bp, bool fw_dflt);
11754+
1167111755 static int bnxt_fw_init_one(struct bnxt *bp)
1167211756 {
1167311757 int rc;
@@ -11682,6 +11766,9 @@ static int bnxt_fw_init_one(struct bnxt *bp) · 8 unmodified lines
1168211766 netdev_err(bp->dev, "Firmware init phase 2 failed\n");
1168311767 return rc;
1168411768 }
11769+ rc = bnxt_probe_phy(bp, false);
11770+ if (rc)
11771+ return rc;
1168511772 rc = bnxt_approve_mac(bp, bp->dev->dev_addr, false);
1168611773 if (rc)
1168711774 return rc;
@@ -13073,6 +13160,7 @@ init_err_pci_clean: · 1385 unmodified lines
1307313160 bnxt_hwrm_func_drv_unrgtr(bp);
1307413161 bnxt_free_hwrm_short_cmd_req(bp);
1307513162 bnxt_free_hwrm_resources(bp);
13163+ bnxt_ethtool_free(bp);
1307613164 kfree(bp->fw_health);
1307713165 bp->fw_health = NULL;
1307813166 bnxt_cleanup_pci(bp);
drivers/net/ethernet/broadcom/bnxt/bnxt.h+10−0
@@ -1457,6 +1457,16 @@ struct bnxt_ctx_pg_info { · 1456 unmodified lines
14571457
14581458 #define BNXT_BACKING_STORE_CFG_LEGACY_LEN 256
14591459
1460+#define BNXT_SET_CTX_PAGE_ATTR(attr) \
1461+do { \
1462+ if (BNXT_PAGE_SIZE == 0x2000) \
1463+ attr = FUNC_BACKING_STORE_CFG_REQ_SRQ_PG_SIZE_PG_8K; \
1464+ else if (BNXT_PAGE_SIZE == 0x10000) \
1465+ attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_64K; \
1466+ else \
1467+ attr = FUNC_BACKING_STORE_CFG_REQ_QPC_PG_SIZE_PG_4K; \
1468+} while (0)
1469+
14601470 struct bnxt_ctx_mem_info {
14611471 u32 qp_max_entries;
14621472 u16 qp_min_qp1_entries;
drivers/net/ethernet/cadence/macb_main.c+3−0
@@ -2867,6 +2867,9 @@ static struct net_device_stats *gem_get_stats(struct macb *bp) · 2866 unmodified lines
28672867 struct gem_stats *hwstat = &bp->hw_stats.gem;
28682868 struct net_device_stats *nstat = &bp->dev->stats;
28692869
2870+ if (!netif_running(bp->dev))
2871+ return nstat;
2872+
28702873 gem_update_stats(bp);
28712874
28722875 nstat->rx_errors = (hwstat->rx_frame_check_sequence_errors +
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_ethtool.c+35−13
@@ -1337,13 +1337,27 @@ static int cxgb4_ethtool_flash_phy(struct net_device *netdev, · 1336 unmodified lines
13371337 return ret;
13381338 }
13391339
1340− spin_lock_bh(&adap->win0_lock);
1340+ /* We have to RESET the chip/firmware because we need the
1341+ * chip in uninitialized state for loading new PHY image.
1342+ * Otherwise, the running firmware will only store the PHY
1343+ * image in local RAM which will be lost after next reset.
1344+ */
1345+ ret = t4_fw_reset(adap, adap->mbox, PIORSTMODE_F | PIORST_F);
1346+ if (ret < 0) {
1347+ dev_err(adap->pdev_dev,
1348+ "Set FW to RESET for flashing PHY FW failed. ret: %d\n",
1349+ ret);
1350+ return ret;
1351+ }
1352+
13411353 ret = t4_load_phy_fw(adap, MEMWIN_NIC, NULL, data, size);
1342− spin_unlock_bh(&adap->win0_lock);
1343− if (ret)
1344− dev_err(adap->pdev_dev, "Failed to load PHY FW\n");
1354+ if (ret < 0) {
1355+ dev_err(adap->pdev_dev, "Failed to load PHY FW. ret: %d\n",
1356+ ret);
1357+ return ret;
1358+ }
13451359
1346− return ret;
1360+ return 0;
13471361 }
13481362
13491363 static int cxgb4_ethtool_flash_fw(struct net_device *netdev,
@@ -1610,16 +1624,14 @@ static struct filter_entry *cxgb4_get_filter_entry(struct adapter *adap, · 260 unmodified lines
16101624 u32 ftid)
16111625 {
16121626 struct tid_info *t = &adap->tids;
1613− struct filter_entry *f;
16141627
1615− if (ftid < t->nhpftids)
1616− f = &adap->tids.hpftid_tab[ftid];
1617− else if (ftid < t->nftids)
1618− f = &adap->tids.ftid_tab[ftid - t->nhpftids];
1619− else
1620− f = lookup_tid(&adap->tids, ftid);
1628+ if (ftid >= t->hpftid_base && ftid < t->hpftid_base + t->nhpftids)
1629+ return &t->hpftid_tab[ftid - t->hpftid_base];
16211630
1622− return f;
1631+ if (ftid >= t->ftid_base && ftid < t->ftid_base + t->nftids)
1632+ return &t->ftid_tab[ftid - t->ftid_base];
1633+
1634+ return lookup_tid(t, ftid);
16231635 }
16241636
16251637 static void cxgb4_fill_filter_rule(struct ethtool_rx_flow_spec *fs,
@@ -1826,6 +1838,11 @@ static int cxgb4_ntuple_del_filter(struct net_device *dev, · 200 unmodified lines
18261838 filter_id = filter_info->loc_array[cmd->fs.location];
18271839 f = cxgb4_get_filter_entry(adapter, filter_id);
18281840
1841+ if (f->fs.prio)
1842+ filter_id -= adapter->tids.hpftid_base;
1843+ else if (!f->fs.hash)
1844+ filter_id -= (adapter->tids.ftid_base - adapter->tids.nhpftids);
1845+
18291846 ret = cxgb4_flow_rule_destroy(dev, f->fs.tc_prio, &f->fs, filter_id);
18301847 if (ret)
18311848 goto err;
@@ -1885,6 +1902,11 @@ static int cxgb4_ntuple_set_filter(struct net_device *netdev, · 53 unmodified lines
18851902
18861903 filter_info = &adapter->ethtool_filters->port[pi->port_id];
18871904
1905+ if (fs.prio)
1906+ tid += adapter->tids.hpftid_base;
1907+ else if (!fs.hash)
1908+ tid += (adapter->tids.ftid_base - adapter->tids.nhpftids);
1909+
18881910 filter_info->loc_array[cmd->fs.location] = tid;
18891911 set_bit(cmd->fs.location, filter_info->bmap);
18901912 filter_info->in_use++;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c+2−2
@@ -198,7 +198,7 @@ static void set_nat_params(struct adapter *adap, struct filter_entry *f, · 197 unmodified lines
198198 WORD_MASK, f->fs.nat_lip[3] |
199199 f->fs.nat_lip[2] << 8 |
200200 f->fs.nat_lip[1] << 16 |
201− (u64)f->fs.nat_lip[0] << 25, 1);
201+ (u64)f->fs.nat_lip[0] << 24, 1);
202202 }
203203 }
204204
@@ -1042,7 +1042,7 @@ void clear_all_filters(struct adapter *adapter) · 837 unmodified lines
10421042 cxgb4_del_filter(dev, f->tid, &f->fs);
10431043 }
10441044
1045− sb = t4_read_reg(adapter, LE_DB_SRVR_START_INDEX_A);
1045+ sb = adapter->tids.stid_base;
10461046 for (i = 0; i < sb; i++) {
10471047 f = (struct filter_entry *)adapter->tids.tid_tab[i];
10481048
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+3−5
@@ -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;
@@ -4424,10 +4424,8 @@ static int adap_init0_phy(struct adapter *adap) · 1535 unmodified lines
44244424
44254425 /* Load PHY Firmware onto adapter.
44264426 */
4427− spin_lock_bh(&adap->win0_lock);
44284427 ret = t4_load_phy_fw(adap, MEMWIN_NIC, phy_info->phy_fw_version,
44294428 (u8 *)phyf->data, phyf->size);
4430− spin_unlock_bh(&adap->win0_lock);
44314429 if (ret < 0)
44324430 dev_err(adap->pdev_dev, "PHY Firmware transfer error %d\n",
44334431 -ret);
@@ -6480,9 +6478,9 @@ static void cxgb4_ktls_dev_del(struct net_device *netdev, · 2046 unmodified lines
64806478
64816479 adap->uld[CXGB4_ULD_KTLS].tlsdev_ops->tls_dev_del(netdev, tls_ctx,
64826480 direction);
6483− cxgb4_set_ktls_feature(adap, FW_PARAMS_PARAM_DEV_KTLS_HW_DISABLE);
64846481
64856482 out_unlock:
6483+ cxgb4_set_ktls_feature(adap, FW_PARAMS_PARAM_DEV_KTLS_HW_DISABLE);
64866484 mutex_unlock(&uld_mutex);
64876485 }
64886486
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/chelsio/cxgb4/t4_hw.c+29−17
@@ -3060,16 +3060,19 @@ int t4_read_flash(struct adapter *adapter, unsigned int addr, · 3059 unmodified lines
30603060 * @addr: the start address to write
30613061 * @n: length of data to write in bytes
30623062 * @data: the data to write
3063+ * @byte_oriented: whether to store data as bytes or as words
30633064 *
30643065 * Writes up to a page of data (256 bytes) to the serial flash starting
30653066 * at the given address. All the data must be written to the same page.
3067+ * If @byte_oriented is set the write data is stored as byte stream
3068+ * (i.e. matches what on disk), otherwise in big-endian.
30663069 */
30673070 static int t4_write_flash(struct adapter *adapter, unsigned int addr,
3068− unsigned int n, const u8 *data)
3071+ unsigned int n, const u8 *data, bool byte_oriented)
30693072 {
3070− int ret;
3071− u32 buf[64];
30723073 unsigned int i, c, left, val, offset = addr & 0xff;
3074+ u32 buf[64];
3075+ int ret;
30733076
30743077 if (addr >= adapter->params.sf_size || offset + n > SF_PAGE_SIZE)
30753078 return -EINVAL;
@@ -3080,10 +3083,14 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 4 unmodified lines
30803083 (ret = sf1_write(adapter, 4, 1, 1, val)) != 0)
30813084 goto unlock;
30823085
3083− for (left = n; left; left -= c) {
3086+ for (left = n; left; left -= c, data += c) {
30843087 c = min(left, 4U);
3085− for (val = 0, i = 0; i < c; ++i)
3086− val = (val << 8) + *data++;
3088+ for (val = 0, i = 0; i < c; ++i) {
3089+ if (byte_oriented)
3090+ val = (val << 8) + data[i];
3091+ else
3092+ val = (val << 8) + data[c - i - 1];
3093+ }
30873094
30883095 ret = sf1_write(adapter, c, c != left, 1, val);
30893096 if (ret)
@@ -3096,7 +3103,8 @@ static int t4_write_flash(struct adapter *adapter, unsigned int addr, · 6 unmodified lines
30963103 t4_write_reg(adapter, SF_OP_A, 0); /* unlock SF */
30973104
30983105 /* Read the page to verify the write succeeded */
3099− ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf, 1);
3106+ ret = t4_read_flash(adapter, addr & ~0xff, ARRAY_SIZE(buf), buf,
3107+ byte_oriented);
31003108 if (ret)
31013109 return ret;
31023110
@@ -3692,7 +3700,7 @@ int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size) · 589 unmodified lines
36923700 */
36933701 memcpy(first_page, fw_data, SF_PAGE_SIZE);
36943702 ((struct fw_hdr *)first_page)->fw_ver = cpu_to_be32(0xffffffff);
3695− ret = t4_write_flash(adap, fw_start, SF_PAGE_SIZE, first_page);
3703+ ret = t4_write_flash(adap, fw_start, SF_PAGE_SIZE, first_page, true);
36963704 if (ret)
36973705 goto out;
36983706
@@ -3700,14 +3708,14 @@ int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size) · 1 unmodified line
37003708 for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) {
37013709 addr += SF_PAGE_SIZE;
37023710 fw_data += SF_PAGE_SIZE;
3703− ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data);
3711+ ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data, true);
37043712 if (ret)
37053713 goto out;
37063714 }
37073715
3708− ret = t4_write_flash(adap,
3709− fw_start + offsetof(struct fw_hdr, fw_ver),
3710− sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver);
3716+ ret = t4_write_flash(adap, fw_start + offsetof(struct fw_hdr, fw_ver),
3717+ sizeof(hdr->fw_ver), (const u8 *)&hdr->fw_ver,
3718+ true);
37113719 out:
37123720 if (ret)
37133721 dev_err(adap->pdev_dev, "firmware download failed, error %d\n",
@@ -3812,9 +3820,11 @@ int t4_load_phy_fw(struct adapter *adap, int win, · 98 unmodified lines
38123820 /* Copy the supplied PHY Firmware image to the adapter memory location
38133821 * allocated by the adapter firmware.
38143822 */
3823+ spin_lock_bh(&adap->win0_lock);
38153824 ret = t4_memory_rw(adap, win, mtype, maddr,
38163825 phy_fw_size, (__be32 *)phy_fw_data,
38173826 T4_MEMORY_WRITE);
3827+ spin_unlock_bh(&adap->win0_lock);
38183828 if (ret)
38193829 return ret;
38203830
@@ -10208,7 +10218,7 @@ int t4_load_cfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) · 6387 unmodified lines
1020810218 n = size - i;
1020910219 else
1021010220 n = SF_PAGE_SIZE;
10211− ret = t4_write_flash(adap, addr, n, cfg_data);
10221+ ret = t4_write_flash(adap, addr, n, cfg_data, true);
1021210222 if (ret)
1021310223 goto out;
1021410224
@@ -10677,13 +10687,14 @@ int t4_load_boot(struct adapter *adap, u8 *boot_data, · 462 unmodified lines
1067710687 for (size -= SF_PAGE_SIZE; size; size -= SF_PAGE_SIZE) {
1067810688 addr += SF_PAGE_SIZE;
1067910689 boot_data += SF_PAGE_SIZE;
10680− ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, boot_data);
10690+ ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, boot_data,
10691+ false);
1068110692 if (ret)
1068210693 goto out;
1068310694 }
1068410695
1068510696 ret = t4_write_flash(adap, boot_sector, SF_PAGE_SIZE,
10686− (const u8 *)header);
10697+ (const u8 *)header, false);
1068710698
1068810699 out:
1068910700 if (ret)
@@ -10758,7 +10769,7 @@ int t4_load_bootcfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) · 68 unmodified lines
1075810769 for (i = 0; i < size; i += SF_PAGE_SIZE) {
1075910770 n = min_t(u32, size - i, SF_PAGE_SIZE);
1076010771
10761− ret = t4_write_flash(adap, addr, n, cfg_data);
10772+ ret = t4_write_flash(adap, addr, n, cfg_data, false);
1076210773 if (ret)
1076310774 goto out;
1076410775
@@ -10770,7 +10781,8 @@ int t4_load_bootcfg(struct adapter *adap, const u8 *cfg_data, unsigned int size) · 5 unmodified lines
1077010781 for (i = 0; i < npad; i++) {
1077110782 u8 data = 0;
1077210783
10773− ret = t4_write_flash(adap, cfg_addr + size + i, 1, &data);
10784+ ret = t4_write_flash(adap, cfg_addr + size + i, 1, &data,
10785+ false);
1077410786 if (ret)
1077510787 goto out;
1077610788 }
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c+79−1
@@ -59,6 +59,7 @@ static int chcr_get_nfrags_to_send(struct sk_buff *skb, u32 start, u32 len) · 58 unmodified lines
5959 }
6060
6161 static int chcr_init_tcb_fields(struct chcr_ktls_info *tx_info);
62+static void clear_conn_resources(struct chcr_ktls_info *tx_info);
6263 /*
6364 * chcr_ktls_save_keys: calculate and save crypto keys.
6465 * @tx_info - driver specific tls info.
@@ -364,10 +365,14 @@ static void chcr_ktls_dev_del(struct net_device *netdev, · 299 unmodified lines
364365 chcr_get_ktls_tx_context(tls_ctx);
365366 struct chcr_ktls_info *tx_info = tx_ctx->chcr_info;
366367 struct ch_ktls_port_stats_debug *port_stats;
368+ struct chcr_ktls_uld_ctx *u_ctx;
367369
368370 if (!tx_info)
369371 return;
370372
373+ u_ctx = tx_info->adap->uld[CXGB4_ULD_KTLS].handle;
374+ if (u_ctx && u_ctx->detach)
375+ return;
371376 /* clear l2t entry */
372377 if (tx_info->l2te)
373378 cxgb4_l2t_release(tx_info->l2te);
@@ -384,6 +389,8 @@ static void chcr_ktls_dev_del(struct net_device *netdev, · 10 unmodified lines
384389 if (tx_info->tid != -1) {
385390 cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan,
386391 tx_info->tid, tx_info->ip_family);
392+
393+ xa_erase(&u_ctx->tid_list, tx_info->tid);
387394 }
388395
389396 port_stats = &tx_info->adap->ch_ktls_stats.ktls_port[tx_info->port_id];
@@ -411,6 +418,7 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk, · 21 unmodified lines
411418 struct tls_context *tls_ctx = tls_get_ctx(sk);
412419 struct ch_ktls_port_stats_debug *port_stats;
413420 struct chcr_ktls_ofld_ctx_tx *tx_ctx;
421+ struct chcr_ktls_uld_ctx *u_ctx;
414422 struct chcr_ktls_info *tx_info;
415423 struct dst_entry *dst;
416424 struct adapter *adap;
@@ -425,6 +433,7 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk, · 8 unmodified lines
425433 adap = pi->adapter;
426434 port_stats = &adap->ch_ktls_stats.ktls_port[pi->port_id];
427435 atomic64_inc(&port_stats->ktls_tx_connection_open);
436+ u_ctx = adap->uld[CXGB4_ULD_KTLS].handle;
428437
429438 if (direction == TLS_OFFLOAD_CTX_DIR_RX) {
430439 pr_err("not expecting for RX direction\n");
@@ -434,6 +443,9 @@ static int chcr_ktls_dev_add(struct net_device *netdev, struct sock *sk, · 3 unmodified lines
434443 if (tx_ctx->chcr_info)
435444 goto out;
436445
446+ if (u_ctx && u_ctx->detach)
447+ goto out;
448+
437449 tx_info = kvzalloc(sizeof(*tx_info), GFP_KERNEL);
438450 if (!tx_info)
439451 goto out;
@@ -569,6 +581,8 @@ free_tid: · 129 unmodified lines
569581 cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan,
570582 tx_info->tid, tx_info->ip_family);
571583
584+ xa_erase(&u_ctx->tid_list, tx_info->tid);
585+
572586 put_module:
573587 /* release module refcount */
574588 module_put(THIS_MODULE);
@@ -633,8 +647,12 @@ static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap, · 58 unmodified lines
633647 {
634648 const struct cpl_act_open_rpl *p = (void *)input;
635649 struct chcr_ktls_info *tx_info = NULL;
650+ struct chcr_ktls_ofld_ctx_tx *tx_ctx;
651+ struct chcr_ktls_uld_ctx *u_ctx;
636652 unsigned int atid, tid, status;
653+ struct tls_context *tls_ctx;
637654 struct tid_info *t;
655+ int ret = 0;
638656
639657 tid = GET_TID(p);
640658 status = AOPEN_STATUS_G(ntohl(p->atid_status));
@@ -666,14 +684,29 @@ static int chcr_ktls_cpl_act_open_rpl(struct adapter *adap, · 25 unmodified lines
666684 if (!status) {
667685 tx_info->tid = tid;
668686 cxgb4_insert_tid(t, tx_info, tx_info->tid, tx_info->ip_family);
687+ /* Adding tid */
688+ tls_ctx = tls_get_ctx(tx_info->sk);
689+ tx_ctx = chcr_get_ktls_tx_context(tls_ctx);
690+ u_ctx = adap->uld[CXGB4_ULD_KTLS].handle;
691+ if (u_ctx) {
692+ ret = xa_insert_bh(&u_ctx->tid_list, tid, tx_ctx,
693+ GFP_NOWAIT);
694+ if (ret < 0) {
695+ pr_err("%s: Failed to allocate tid XA entry = %d\n",
696+ __func__, tx_info->tid);
697+ tx_info->open_state = CH_KTLS_OPEN_FAILURE;
698+ goto out;
699+ }
700+ }
669701 tx_info->open_state = CH_KTLS_OPEN_SUCCESS;
670702 } else {
671703 tx_info->open_state = CH_KTLS_OPEN_FAILURE;
672704 }
705+out:
673706 spin_unlock(&tx_info->lock);
674707
675708 complete(&tx_info->completion);
676− return 0;
709+ return ret;
677710 }
678711
679712 /*
@@ -2090,6 +2123,8 @@ static void *chcr_ktls_uld_add(const struct cxgb4_lld_info *lldi) · 1410 unmodified lines
20902123 goto out;
20912124 }
20922125 u_ctx->lldi = *lldi;
2126+ u_ctx->detach = false;
2127+ xa_init_flags(&u_ctx->tid_list, XA_FLAGS_LOCK_BH);
20932128 out:
20942129 return u_ctx;
20952130 }
@@ -2123,6 +2158,45 @@ static int chcr_ktls_uld_rx_handler(void *handle, const __be64 *rsp, · 27 unmodified lines
21232158 return 0;
21242159 }
21252160
2161+static void clear_conn_resources(struct chcr_ktls_info *tx_info)
2162+{
2163+ /* clear l2t entry */
2164+ if (tx_info->l2te)
2165+ cxgb4_l2t_release(tx_info->l2te);
2166+
2167+#if IS_ENABLED(CONFIG_IPV6)
2168+ /* clear clip entry */
2169+ if (tx_info->ip_family == AF_INET6)
2170+ cxgb4_clip_release(tx_info->netdev, (const u32 *)
2171+ &tx_info->sk->sk_v6_rcv_saddr,
2172+ 1);
2173+#endif
2174+
2175+ /* clear tid */
2176+ if (tx_info->tid != -1)
2177+ cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan,
2178+ tx_info->tid, tx_info->ip_family);
2179+}
2180+
2181+static void ch_ktls_reset_all_conn(struct chcr_ktls_uld_ctx *u_ctx)
2182+{
2183+ struct ch_ktls_port_stats_debug *port_stats;
2184+ struct chcr_ktls_ofld_ctx_tx *tx_ctx;
2185+ struct chcr_ktls_info *tx_info;
2186+ unsigned long index;
2187+
2188+ xa_for_each(&u_ctx->tid_list, index, tx_ctx) {
2189+ tx_info = tx_ctx->chcr_info;
2190+ clear_conn_resources(tx_info);
2191+ port_stats = &tx_info->adap->ch_ktls_stats.ktls_port[tx_info->port_id];
2192+ atomic64_inc(&port_stats->ktls_tx_connection_close);
2193+ kvfree(tx_info);
2194+ tx_ctx->chcr_info = NULL;
2195+ /* release module refcount */
2196+ module_put(THIS_MODULE);
2197+ }
2198+}
2199+
21262200 static int chcr_ktls_uld_state_change(void *handle, enum cxgb4_state new_state)
21272201 {
21282202 struct chcr_ktls_uld_ctx *u_ctx = handle;
@@ -2139,7 +2213,10 @@ static int chcr_ktls_uld_state_change(void *handle, enum cxgb4_state new_state) · 10 unmodified lines
21392213 case CXGB4_STATE_DETACH:
21402214 pr_info("%s: Down\n", pci_name(u_ctx->lldi.pdev));
21412215 mutex_lock(&dev_mutex);
2216+ u_ctx->detach = true;
21422217 list_del(&u_ctx->entry);
2218+ ch_ktls_reset_all_conn(u_ctx);
2219+ xa_destroy(&u_ctx->tid_list);
21432220 mutex_unlock(&dev_mutex);
21442221 break;
21452222 default:
@@ -2178,6 +2255,7 @@ static void __exit chcr_ktls_exit(void) · 32 unmodified lines
21782255 adap = pci_get_drvdata(u_ctx->lldi.pdev);
21792256 memset(&adap->ch_ktls_stats, 0, sizeof(adap->ch_ktls_stats));
21802257 list_del(&u_ctx->entry);
2258+ xa_destroy(&u_ctx->tid_list);
21812259 kfree(u_ctx);
21822260 }
21832261 mutex_unlock(&dev_mutex);
drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.h+2−0
@@ -75,6 +75,8 @@ struct chcr_ktls_ofld_ctx_tx { · 74 unmodified lines
7575 struct chcr_ktls_uld_ctx {
7676 struct list_head entry;
7777 struct cxgb4_lld_info lldi;
78+ struct xarray tid_list;
79+ bool detach;
7880 };
7981
8082 static inline struct chcr_ktls_ofld_ctx_tx *
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c+4−2
@@ -1564,8 +1564,10 @@ found_ok_skb: · 1563 unmodified lines
15641564 cerr = put_cmsg(msg, SOL_TLS, TLS_GET_RECORD_TYPE,
15651565 sizeof(thdr->type), &thdr->type);
15661566
1567− if (cerr && thdr->type != TLS_RECORD_TYPE_DATA)
1568− return -EIO;
1567+ if (cerr && thdr->type != TLS_RECORD_TYPE_DATA) {
1568+ copied = -EIO;
1569+ break;
1570+ }
15691571 /* don't send tls header, skip copy */
15701572 goto skip_copy;
15711573 }
drivers/net/ethernet/ec_bhf.c+3−1
@@ -576,10 +576,12 @@ static void ec_bhf_remove(struct pci_dev *dev) · 575 unmodified lines
576576 struct ec_bhf_priv *priv = netdev_priv(net_dev);
577577
578578 unregister_netdev(net_dev);
579− free_netdev(net_dev);
580579
581580 pci_iounmap(dev, priv->dma_io);
582581 pci_iounmap(dev, priv->io);
582+
583+ free_netdev(net_dev);
584+
583585 pci_release_regions(dev);
584586 pci_clear_master(dev);
585587 pci_disable_device(dev);
drivers/net/ethernet/emulex/benet/be_main.c+1−0
@@ -5897,6 +5897,7 @@ drv_cleanup: · 5896 unmodified lines
58975897 unmap_bars:
58985898 be_unmap_pci_bars(adapter);
58995899 free_netdev:
5900+ pci_disable_pcie_error_reporting(pdev);
59005901 free_netdev(netdev);
59015902 rel_reg:
59025903 pci_release_regions(pdev);
drivers/net/ethernet/freescale/fec_main.c+19−5
@@ -1662,7 +1662,7 @@ static int fec_enet_rx_napi(struct napi_struct *napi, int budget) · 1661 unmodified lines
16621662 }
16631663
16641664 /* ------------------------------------------------------------------------- */
1665−static void fec_get_mac(struct net_device *ndev)
1665+static int fec_get_mac(struct net_device *ndev)
16661666 {
16671667 struct fec_enet_private *fep = netdev_priv(ndev);
16681668 unsigned char *iap, tmpaddr[ETH_ALEN];
@@ -1685,6 +1685,8 @@ static void fec_get_mac(struct net_device *ndev) · 16 unmodified lines
16851685 ret = of_get_mac_address(np, tmpaddr);
16861686 if (!ret)
16871687 iap = tmpaddr;
1688+ else if (ret == -EPROBE_DEFER)
1689+ return ret;
16881690 }
16891691 }
16901692
@@ -1723,7 +1725,7 @@ static void fec_get_mac(struct net_device *ndev) · 32 unmodified lines
17231725 eth_hw_addr_random(ndev);
17241726 dev_info(&fep->pdev->dev, "Using random MAC address: %pM\n",
17251727 ndev->dev_addr);
1726− return;
1728+ return 0;
17271729 }
17281730
17291731 memcpy(ndev->dev_addr, iap, ETH_ALEN);
@@ -1731,6 +1733,8 @@ static void fec_get_mac(struct net_device *ndev) · 1 unmodified line
17311733 /* Adjust MAC if using macaddr */
17321734 if (iap == macaddr)
17331735 ndev->dev_addr[ETH_ALEN-1] = macaddr[ETH_ALEN-1] + fep->dev_id;
1736+
1737+ return 0;
17341738 }
17351739
17361740 /* ------------------------------------------------------------------------- */
@@ -3290,7 +3294,9 @@ static int fec_enet_init(struct net_device *ndev) · 1553 unmodified lines
32903294 return ret;
32913295 }
32923296
3293− fec_enet_alloc_queue(ndev);
3297+ ret = fec_enet_alloc_queue(ndev);
3298+ if (ret)
3299+ return ret;
32943300
32953301 bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize;
32963302
@@ -3298,11 +3304,15 @@ static int fec_enet_init(struct net_device *ndev) · 1 unmodified line
32983304 cbd_base = dmam_alloc_coherent(&fep->pdev->dev, bd_size, &bd_dma,
32993305 GFP_KERNEL);
33003306 if (!cbd_base) {
3301− return -ENOMEM;
3307+ ret = -ENOMEM;
3308+ goto free_queue_mem;
33023309 }
33033310
33043311 /* Get the Ethernet address */
3305− fec_get_mac(ndev);
3312+ ret = fec_get_mac(ndev);
3313+ if (ret)
3314+ goto free_queue_mem;
3315+
33063316 /* make sure MAC we just acquired is programmed into the hw */
33073317 fec_set_mac_address(ndev, NULL);
33083318
@@ -3376,6 +3386,10 @@ static int fec_enet_init(struct net_device *ndev) · 67 unmodified lines
33763386 fec_enet_update_ethtool_stats(ndev);
33773387
33783388 return 0;
3389+
3390+free_queue_mem:
3391+ fec_enet_free_queue(ndev);
3392+ return ret;
33793393 }
33803394
33813395 #ifdef CONFIG_OF
drivers/net/ethernet/freescale/fec_ptp.c+5−3
@@ -215,15 +215,13 @@ static u64 fec_ptp_read(const struct cyclecounter *cc) · 214 unmodified lines
215215 {
216216 struct fec_enet_private *fep =
217217 container_of(cc, struct fec_enet_private, cc);
218− const struct platform_device_id *id_entry =
219− platform_get_device_id(fep->pdev);
220218 u32 tempval;
221219
222220 tempval = readl(fep->hwp + FEC_ATIME_CTRL);
223221 tempval |= FEC_T_CTRL_CAPTURE;
224222 writel(tempval, fep->hwp + FEC_ATIME_CTRL);
225223
226− if (id_entry->driver_data & FEC_QUIRK_BUG_CAPTURE)
224+ if (fep->quirks & FEC_QUIRK_BUG_CAPTURE)
227225 udelay(1);
228226
229227 return readl(fep->hwp + FEC_ATIME);
@@ -604,6 +602,10 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx) · 374 unmodified lines
604602 fep->ptp_caps.enable = fec_ptp_enable;
605603
606604 fep->cycle_speed = clk_get_rate(fep->clk_ptp);
605+ if (!fep->cycle_speed) {
606+ fep->cycle_speed = NSEC_PER_SEC;
607+ dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n");
608+ }
607609 fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
608610
609611 spin_lock_init(&fep->tmreg_lock);
drivers/net/ethernet/google/gve/gve_main.c+12−9
@@ -180,7 +180,7 @@ static int gve_napi_poll(struct napi_struct *napi, int budget) · 179 unmodified lines
180180 /* Double check we have no extra work.
181181 * Ensure unmask synchronizes with checking for work.
182182 */
183− dma_rmb();
183+ mb();
184184 if (block->tx)
185185 reschedule |= gve_tx_poll(block, -1);
186186 if (block->rx)
@@ -220,6 +220,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv) · 33 unmodified lines
220220 int vecs_left = new_num_ntfy_blks % 2;
221221
222222 priv->num_ntfy_blks = new_num_ntfy_blks;
223+ priv->mgmt_msix_idx = priv->num_ntfy_blks;
223224 priv->tx_cfg.max_queues = min_t(int, priv->tx_cfg.max_queues,
224225 vecs_per_type);
225226 priv->rx_cfg.max_queues = min_t(int, priv->rx_cfg.max_queues,
@@ -300,20 +301,22 @@ static void gve_free_notify_blocks(struct gve_priv *priv) · 74 unmodified lines
300301 {
301302 int i;
302303
303− /* Free the irqs */
304− for (i = 0; i < priv->num_ntfy_blks; i++) {
305− struct gve_notify_block *block = &priv->ntfy_blocks[i];
306− int msix_idx = i;
304+ if (priv->msix_vectors) {
305+ /* Free the irqs */
306+ for (i = 0; i < priv->num_ntfy_blks; i++) {
307+ struct gve_notify_block *block = &priv->ntfy_blocks[i];
308+ int msix_idx = i;
307309
308− irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector,
309− NULL);
310− free_irq(priv->msix_vectors[msix_idx].vector, block);
310+ irq_set_affinity_hint(priv->msix_vectors[msix_idx].vector,
311+ NULL);
312+ free_irq(priv->msix_vectors[msix_idx].vector, block);
313+ }
314+ free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
311315 }
312316 dma_free_coherent(&priv->pdev->dev,
313317 priv->num_ntfy_blks * sizeof(*priv->ntfy_blocks),
314318 priv->ntfy_blocks, priv->ntfy_block_bus);
315319 priv->ntfy_blocks = NULL;
316− free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
317320 pci_disable_msix(priv->pdev);
318321 kvfree(priv->msix_vectors);
319322 priv->msix_vectors = NULL;
drivers/net/ethernet/google/gve/gve_tx.c+7−3
@@ -212,10 +212,11 @@ static int gve_tx_alloc_ring(struct gve_priv *priv, int idx) · 211 unmodified lines
212212 tx->dev = &priv->pdev->dev;
213213 if (!tx->raw_addressing) {
214214 tx->tx_fifo.qpl = gve_assign_tx_qpl(priv);
215−
215+ if (!tx->tx_fifo.qpl)
216+ goto abort_with_desc;
216217 /* map Tx FIFO */
217218 if (gve_tx_fifo_init(priv, &tx->tx_fifo))
218− goto abort_with_desc;
219+ goto abort_with_qpl;
219220 }
220221
221222 tx->q_resources =
@@ -236,6 +237,9 @@ static int gve_tx_alloc_ring(struct gve_priv *priv, int idx) · 14 unmodified lines
236237 abort_with_fifo:
237238 if (!tx->raw_addressing)
238239 gve_tx_fifo_release(priv, &tx->tx_fifo);
240+abort_with_qpl:
241+ if (!tx->raw_addressing)
242+ gve_unassign_qpl(priv, tx->tx_fifo.qpl->id);
239243 abort_with_desc:
240244 dma_free_coherent(hdev, bytes, tx->desc, tx->bus);
241245 tx->desc = NULL;
@@ -589,7 +593,7 @@ netdev_tx_t gve_tx(struct sk_buff *skb, struct net_device *dev) · 347 unmodified lines
589593 struct gve_tx_ring *tx;
590594 int nsegs;
591595
592− WARN(skb_get_queue_mapping(skb) > priv->tx_cfg.num_queues,
596+ WARN(skb_get_queue_mapping(skb) >= priv->tx_cfg.num_queues,
593597 "skb queue index out of range");
594598 tx = &priv->tx[skb_get_queue_mapping(skb)];
595599 if (unlikely(gve_maybe_stop_tx(tx, skb))) {
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c+3−3
@@ -192,7 +192,7 @@ static int hns_nic_get_link_ksettings(struct net_device *net_dev, · 191 unmodified lines
192192 }
193193
194194 /**
195− *hns_nic_set_link_settings - implement ethtool set link ksettings
195+ *hns_nic_set_link_ksettings - implement ethtool set link ksettings
196196 *@net_dev: net_device
197197 *@cmd: ethtool_link_ksettings
198198 *retuen 0 - success , negative --fail
@@ -827,7 +827,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch) · 628 unmodified lines
827827 }
828828
829829 /**
830− * get_ethtool_stats - get detail statistics.
830+ * hns_get_ethtool_stats - get detail statistics.
831831 * @netdev: net device
832832 * @stats: statistics info.
833833 * @data: statistics data.
@@ -885,7 +885,7 @@ static void hns_get_ethtool_stats(struct net_device *netdev, · 51 unmodified lines
885885 }
886886
887887 /**
888− * get_strings: Return a set of strings that describe the requested objects
888+ * hns_get_strings: Return a set of strings that describe the requested objects
889889 * @netdev: net device
890890 * @stringset: string set ID.
891891 * @data: objects data.
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c+51−59
@@ -264,22 +264,17 @@ static void hns3_vector_coalesce_init(struct hns3_enet_tqp_vector *tqp_vector, · 263 unmodified lines
264264 struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev);
265265 struct hns3_enet_coalesce *tx_coal = &tqp_vector->tx_group.coal;
266266 struct hns3_enet_coalesce *rx_coal = &tqp_vector->rx_group.coal;
267+ struct hns3_enet_coalesce *ptx_coal = &priv->tx_coal;
268+ struct hns3_enet_coalesce *prx_coal = &priv->rx_coal;
267269
268− /* initialize the configuration for interrupt coalescing.
269− * 1. GL (Interrupt Gap Limiter)
270− * 2. RL (Interrupt Rate Limiter)
271− * 3. QL (Interrupt Quantity Limiter)
272− *
273− * Default: enable interrupt coalescing self-adaptive and GL
274− */
275− tx_coal->adapt_enable = 1;
276− rx_coal->adapt_enable = 1;
270+ tx_coal->adapt_enable = ptx_coal->adapt_enable;
271+ rx_coal->adapt_enable = prx_coal->adapt_enable;
277272
278− tx_coal->int_gl = HNS3_INT_GL_50K;
279− rx_coal->int_gl = HNS3_INT_GL_50K;
273+ tx_coal->int_gl = ptx_coal->int_gl;
274+ rx_coal->int_gl = prx_coal->int_gl;
280275
281− rx_coal->flow_level = HNS3_FLOW_LOW;
282− tx_coal->flow_level = HNS3_FLOW_LOW;
276+ rx_coal->flow_level = prx_coal->flow_level;
277+ tx_coal->flow_level = ptx_coal->flow_level;
283278
284279 /* device version above V3(include V3), GL can configure 1us
285280 * unit, so uses 1us unit.
@@ -294,8 +289,8 @@ static void hns3_vector_coalesce_init(struct hns3_enet_tqp_vector *tqp_vector, · 8 unmodified lines
294289 rx_coal->ql_enable = 1;
295290 tx_coal->int_ql_max = ae_dev->dev_specs.int_ql_max;
296291 rx_coal->int_ql_max = ae_dev->dev_specs.int_ql_max;
297− tx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG;
298− rx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG;
292+ tx_coal->int_ql = ptx_coal->int_ql;
293+ rx_coal->int_ql = prx_coal->int_ql;
299294 }
300295 }
301296
@@ -846,8 +841,6 @@ static bool hns3_tunnel_csum_bug(struct sk_buff *skb) · 544 unmodified lines
846841 l4.udp->dest == htons(4790))))
847842 return false;
848843
849− skb_checksum_help(skb);
850−
851844 return true;
852845 }
853846
@@ -924,8 +917,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, · 70 unmodified lines
924917 /* the stack computes the IP header already,
925918 * driver calculate l4 checksum when not TSO.
926919 */
927− skb_checksum_help(skb);
928− return 0;
920+ return skb_checksum_help(skb);
929921 }
930922
931923 hns3_set_outer_l2l3l4(skb, ol4_proto, ol_type_vlan_len_msec);
@@ -970,7 +962,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, · 38 unmodified lines
970962 break;
971963 case IPPROTO_UDP:
972964 if (hns3_tunnel_csum_bug(skb))
973− break;
965+ return skb_checksum_help(skb);
974966
975967 hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4CS_B, 1);
976968 hns3_set_field(*type_cs_vlan_tso, HNS3_TXD_L4T_S,
@@ -995,8 +987,7 @@ static int hns3_set_l2l3l4(struct sk_buff *skb, u8 ol4_proto, · 18 unmodified lines
995987 /* the stack computes the IP header already,
996988 * driver calculate l4 checksum when not TSO.
997989 */
998− skb_checksum_help(skb);
999− return 0;
990+ return skb_checksum_help(skb);
1000991 }
1001992
1002993 return 0;
@@ -3844,6 +3835,34 @@ map_ring_fail: · 2841 unmodified lines
38443835 return ret;
38453836 }
38463837
3838+static void hns3_nic_init_coal_cfg(struct hns3_nic_priv *priv)
3839+{
3840+ struct hnae3_ae_dev *ae_dev = pci_get_drvdata(priv->ae_handle->pdev);
3841+ struct hns3_enet_coalesce *tx_coal = &priv->tx_coal;
3842+ struct hns3_enet_coalesce *rx_coal = &priv->rx_coal;
3843+
3844+ /* initialize the configuration for interrupt coalescing.
3845+ * 1. GL (Interrupt Gap Limiter)
3846+ * 2. RL (Interrupt Rate Limiter)
3847+ * 3. QL (Interrupt Quantity Limiter)
3848+ *
3849+ * Default: enable interrupt coalescing self-adaptive and GL
3850+ */
3851+ tx_coal->adapt_enable = 1;
3852+ rx_coal->adapt_enable = 1;
3853+
3854+ tx_coal->int_gl = HNS3_INT_GL_50K;
3855+ rx_coal->int_gl = HNS3_INT_GL_50K;
3856+
3857+ rx_coal->flow_level = HNS3_FLOW_LOW;
3858+ tx_coal->flow_level = HNS3_FLOW_LOW;
3859+
3860+ if (ae_dev->dev_specs.int_ql_max) {
3861+ tx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG;
3862+ rx_coal->int_ql = HNS3_INT_QL_DEFAULT_CFG;
3863+ }
3864+}
3865+
38473866 static int hns3_nic_alloc_vector_data(struct hns3_nic_priv *priv)
38483867 {
38493868 struct hnae3_handle *h = priv->ae_handle;
@@ -4295,6 +4314,8 @@ static int hns3_client_init(struct hnae3_handle *handle) · 445 unmodified lines
42954314 goto out_get_ring_cfg;
42964315 }
42974316
4317+ hns3_nic_init_coal_cfg(priv);
4318+
42984319 ret = hns3_nic_alloc_vector_data(priv);
42994320 if (ret) {
43004321 ret = -ENOMEM;
@@ -4317,12 +4338,6 @@ static int hns3_client_init(struct hnae3_handle *handle) · 16 unmodified lines
43174338 if (ret)
43184339 goto out_init_phy;
43194340
4320− ret = register_netdev(netdev);
4321− if (ret) {
4322− dev_err(priv->dev, "probe register netdev fail!\n");
4323− goto out_reg_netdev_fail;
4324− }
4325−
43264341 /* the device can work without cpu rmap, only aRFS needs it */
43274342 ret = hns3_set_rx_cpu_rmap(netdev);
43284343 if (ret)
@@ -4355,17 +4370,23 @@ static int hns3_client_init(struct hnae3_handle *handle) · 26 unmodified lines
43554370 if (ae_dev->dev_version >= HNAE3_DEVICE_VERSION_V3)
43564371 set_bit(HNAE3_PFLAG_LIMIT_PROMISC, &handle->supported_pflags);
43574372
4373+ ret = register_netdev(netdev);
4374+ if (ret) {
4375+ dev_err(priv->dev, "probe register netdev fail!\n");
4376+ goto out_reg_netdev_fail;
4377+ }
4378+
43584379 if (netif_msg_drv(handle))
43594380 hns3_info_show(priv);
43604381
43614382 return ret;
43624383
4384+out_reg_netdev_fail:
4385+ hns3_dbg_uninit(handle);
43634386 out_client_start:
43644387 hns3_free_rx_cpu_rmap(netdev);
43654388 hns3_nic_uninit_irq(priv);
43664389 out_init_irq_fail:
4367− unregister_netdev(netdev);
4368−out_reg_netdev_fail:
43694390 hns3_uninit_phy(netdev);
43704391 out_init_phy:
43714392 hns3_uninit_all_ring(priv);
@@ -4571,31 +4592,6 @@ int hns3_nic_reset_all_ring(struct hnae3_handle *h) · 199 unmodified lines
45714592 return 0;
45724593 }
45734594
4574−static void hns3_store_coal(struct hns3_nic_priv *priv)
4575−{
4576− /* ethtool only support setting and querying one coal
4577− * configuration for now, so save the vector 0' coal
4578− * configuration here in order to restore it.
4579− */
4580− memcpy(&priv->tx_coal, &priv->tqp_vector[0].tx_group.coal,
4581− sizeof(struct hns3_enet_coalesce));
4582− memcpy(&priv->rx_coal, &priv->tqp_vector[0].rx_group.coal,
4583− sizeof(struct hns3_enet_coalesce));
4584−}
4585−
4586−static void hns3_restore_coal(struct hns3_nic_priv *priv)
4587−{
4588− u16 vector_num = priv->vector_num;
4589− int i;
4590−
4591− for (i = 0; i < vector_num; i++) {
4592− memcpy(&priv->tqp_vector[i].tx_group.coal, &priv->tx_coal,
4593− sizeof(struct hns3_enet_coalesce));
4594− memcpy(&priv->tqp_vector[i].rx_group.coal, &priv->rx_coal,
4595− sizeof(struct hns3_enet_coalesce));
4596− }
4597−}
4598−
45994595 static int hns3_reset_notify_down_enet(struct hnae3_handle *handle)
46004596 {
46014597 struct hnae3_knic_private_info *kinfo = &handle->kinfo;
@@ -4654,8 +4650,6 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) · 52 unmodified lines
46544650 if (ret)
46554651 goto err_put_ring;
46564652
4657− hns3_restore_coal(priv);
4658−
46594653 ret = hns3_nic_init_vector_data(priv);
46604654 if (ret)
46614655 goto err_dealloc_vector;
@@ -4721,8 +4715,6 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) · 59 unmodified lines
47214715
47224716 hns3_nic_uninit_vector_data(priv);
47234717
4724− hns3_store_coal(priv);
4725−
47264718 hns3_nic_dealloc_vector_data(priv);
47274719
47284720 hns3_uninit_all_ring(priv);
drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c+23−41
@@ -1134,50 +1134,32 @@ static void hns3_get_channels(struct net_device *netdev, · 1133 unmodified lines
11341134 h->ae_algo->ops->get_channels(h, ch);
11351135 }
11361136
1137−static int hns3_get_coalesce_per_queue(struct net_device *netdev, u32 queue,
1138− struct ethtool_coalesce *cmd)
1137+static int hns3_get_coalesce(struct net_device *netdev,
1138+ struct ethtool_coalesce *cmd)
11391139 {
1140− struct hns3_enet_tqp_vector *tx_vector, *rx_vector;
11411140 struct hns3_nic_priv *priv = netdev_priv(netdev);
1141+ struct hns3_enet_coalesce *tx_coal = &priv->tx_coal;
1142+ struct hns3_enet_coalesce *rx_coal = &priv->rx_coal;
11421143 struct hnae3_handle *h = priv->ae_handle;
1143− u16 queue_num = h->kinfo.num_tqps;
11441144
11451145 if (hns3_nic_resetting(netdev))
11461146 return -EBUSY;
11471147
1148− if (queue >= queue_num) {
1149− netdev_err(netdev,
1150− "Invalid queue value %u! Queue max id=%u\n",
1151− queue, queue_num - 1);
1152− return -EINVAL;
1153− }
1154−
1155− tx_vector = priv->ring[queue].tqp_vector;
1156− rx_vector = priv->ring[queue_num + queue].tqp_vector;
1148+ cmd->use_adaptive_tx_coalesce = tx_coal->adapt_enable;
1149+ cmd->use_adaptive_rx_coalesce = rx_coal->adapt_enable;
11571150
1158− cmd->use_adaptive_tx_coalesce =
1159− tx_vector->tx_group.coal.adapt_enable;
1160− cmd->use_adaptive_rx_coalesce =
1161− rx_vector->rx_group.coal.adapt_enable;
1162−
1163− cmd->tx_coalesce_usecs = tx_vector->tx_group.coal.int_gl;
1164− cmd->rx_coalesce_usecs = rx_vector->rx_group.coal.int_gl;
1151+ cmd->tx_coalesce_usecs = tx_coal->int_gl;
1152+ cmd->rx_coalesce_usecs = rx_coal->int_gl;
11651153
11661154 cmd->tx_coalesce_usecs_high = h->kinfo.int_rl_setting;
11671155 cmd->rx_coalesce_usecs_high = h->kinfo.int_rl_setting;
11681156
1169− cmd->tx_max_coalesced_frames = tx_vector->tx_group.coal.int_ql;
1170− cmd->rx_max_coalesced_frames = rx_vector->rx_group.coal.int_ql;
1157+ cmd->tx_max_coalesced_frames = tx_coal->int_ql;
1158+ cmd->rx_max_coalesced_frames = rx_coal->int_ql;
11711159
11721160 return 0;
11731161 }
11741162
1175−static int hns3_get_coalesce(struct net_device *netdev,
1176− struct ethtool_coalesce *cmd)
1177−{
1178− return hns3_get_coalesce_per_queue(netdev, 0, cmd);
1179−}
1180−
11811163 static int hns3_check_gl_coalesce_para(struct net_device *netdev,
11821164 struct ethtool_coalesce *cmd)
11831165 {
@@ -1292,19 +1274,7 @@ static int hns3_check_coalesce_para(struct net_device *netdev, · 108 unmodified lines
12921274 return ret;
12931275 }
12941276
1295− ret = hns3_check_ql_coalesce_param(netdev, cmd);
1296− if (ret)
1297− return ret;
1298−
1299− if (cmd->use_adaptive_tx_coalesce == 1 ||
1300− cmd->use_adaptive_rx_coalesce == 1) {
1301− netdev_info(netdev,
1302− "adaptive-tx=%u and adaptive-rx=%u, tx_usecs or rx_usecs will changed dynamically.\n",
1303− cmd->use_adaptive_tx_coalesce,
1304− cmd->use_adaptive_rx_coalesce);
1305− }
1306−
1307− return 0;
1277+ return hns3_check_ql_coalesce_param(netdev, cmd);
13081278 }
13091279
13101280 static void hns3_set_coalesce_per_queue(struct net_device *netdev,
@@ -1350,6 +1320,9 @@ static int hns3_set_coalesce(struct net_device *netdev, · 39 unmodified lines
13501320 struct ethtool_coalesce *cmd)
13511321 {
13521322 struct hnae3_handle *h = hns3_get_handle(netdev);
1323+ struct hns3_nic_priv *priv = netdev_priv(netdev);
1324+ struct hns3_enet_coalesce *tx_coal = &priv->tx_coal;
1325+ struct hns3_enet_coalesce *rx_coal = &priv->rx_coal;
13531326 u16 queue_num = h->kinfo.num_tqps;
13541327 int ret;
13551328 int i;
@@ -1364,6 +1337,15 @@ static int hns3_set_coalesce(struct net_device *netdev, · 8 unmodified lines
13641337 h->kinfo.int_rl_setting =
13651338 hns3_rl_round_down(cmd->rx_coalesce_usecs_high);
13661339
1340+ tx_coal->adapt_enable = cmd->use_adaptive_tx_coalesce;
1341+ rx_coal->adapt_enable = cmd->use_adaptive_rx_coalesce;
1342+
1343+ tx_coal->int_gl = cmd->tx_coalesce_usecs;
1344+ rx_coal->int_gl = cmd->rx_coalesce_usecs;
1345+
1346+ tx_coal->int_ql = cmd->tx_max_coalesced_frames;
1347+ rx_coal->int_ql = cmd->rx_max_coalesced_frames;
1348+
13671349 for (i = 0; i < queue_num; i++)
13681350 hns3_set_coalesce_per_queue(netdev, cmd, i);
13691351
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c+3−1
@@ -710,7 +710,6 @@ void hclge_mbx_handler(struct hclge_dev *hdev) · 709 unmodified lines
710710 unsigned int flag;
711711 int ret = 0;
712712
713− memset(&resp_msg, 0, sizeof(resp_msg));
714713 /* handle all the mailbox requests in the queue */
715714 while (!hclge_cmd_crq_empty(&hdev->hw)) {
716715 if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) {
@@ -738,6 +737,9 @@ void hclge_mbx_handler(struct hclge_dev *hdev) · 21 unmodified lines
738737
739738 trace_hclge_pf_mbx_get(hdev, req);
740739
740+ /* clear the resp_msg before processing every mailbox message */
741+ memset(&resp_msg, 0, sizeof(resp_msg));
742+
741743 switch (req->msg.code) {
742744 case HCLGE_MBX_MAP_RING_TO_VECTOR:
743745 ret = hclge_map_unmap_ring_to_vf_vector(vport, true,
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+22−8
@@ -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);
@@ -1705,12 +1717,13 @@ setup_rings: · 1411 unmodified lines
17051717 * ice_vsi_cfg_txqs - Configure the VSI for Tx
17061718 * @vsi: the VSI being configured
17071719 * @rings: Tx ring array to be configured
1720+ * @count: number of Tx ring array elements
17081721 *
17091722 * Return 0 on success and a negative value on error
17101723 * Configure the Tx VSI for operation.
17111724 */
17121725 static int
1713−ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings)
1726+ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings, u16 count)
17141727 {
17151728 struct ice_aqc_add_tx_qgrp *qg_buf;
17161729 u16 q_idx = 0;
@@ -1722,7 +1735,7 @@ ice_vsi_cfg_txqs(struct ice_vsi *vsi, struct ice_ring **rings) · 5 unmodified lines
17221735
17231736 qg_buf->num_txqs = 1;
17241737
1725− for (q_idx = 0; q_idx < vsi->num_txq; q_idx++) {
1738+ for (q_idx = 0; q_idx < count; q_idx++) {
17261739 err = ice_vsi_cfg_txq(vsi, rings[q_idx], qg_buf);
17271740 if (err)
17281741 goto err_cfg_txqs;
@@ -1742,7 +1755,7 @@ err_cfg_txqs: · 13 unmodified lines
17421755 */
17431756 int ice_vsi_cfg_lan_txqs(struct ice_vsi *vsi)
17441757 {
1745− return ice_vsi_cfg_txqs(vsi, vsi->tx_rings);
1758+ return ice_vsi_cfg_txqs(vsi, vsi->tx_rings, vsi->num_txq);
17461759 }
17471760
17481761 /**
@@ -1757,7 +1770,7 @@ int ice_vsi_cfg_xdp_txqs(struct ice_vsi *vsi) · 8 unmodified lines
17571770 int ret;
17581771 int i;
17591772
1760− ret = ice_vsi_cfg_txqs(vsi, vsi->xdp_rings);
1773+ ret = ice_vsi_cfg_txqs(vsi, vsi->xdp_rings, vsi->num_xdp_txq);
17611774 if (ret)
17621775 return ret;
17631776
@@ -1997,17 +2010,18 @@ int ice_vsi_stop_all_rx_rings(struct ice_vsi *vsi) · 233 unmodified lines
19972010 * @rst_src: reset source
19982011 * @rel_vmvf_num: Relative ID of VF/VM
19992012 * @rings: Tx ring array to be stopped
2013+ * @count: number of Tx ring array elements
20002014 */
20012015 static int
20022016 ice_vsi_stop_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
2003− u16 rel_vmvf_num, struct ice_ring **rings)
2017+ u16 rel_vmvf_num, struct ice_ring **rings, u16 count)
20042018 {
20052019 u16 q_idx;
20062020
20072021 if (vsi->num_txq > ICE_LAN_TXQ_MAX_QDIS)
20082022 return -EINVAL;
20092023
2010− for (q_idx = 0; q_idx < vsi->num_txq; q_idx++) {
2024+ for (q_idx = 0; q_idx < count; q_idx++) {
20112025 struct ice_txq_meta txq_meta = { };
20122026 int status;
20132027
@@ -2035,7 +2049,7 @@ int · 21 unmodified lines
20352049 ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src,
20362050 u16 rel_vmvf_num)
20372051 {
2038− return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings);
2052+ return ice_vsi_stop_tx_rings(vsi, rst_src, rel_vmvf_num, vsi->tx_rings, vsi->num_txq);
20392053 }
20402054
20412055 /**
@@ -2044,7 +2058,7 @@ ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, · 2 unmodified lines
20442058 */
20452059 int ice_vsi_stop_xdp_tx_rings(struct ice_vsi *vsi)
20462060 {
2047− return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings);
2061+ return ice_vsi_stop_tx_rings(vsi, ICE_NO_RESET, 0, vsi->xdp_rings, vsi->num_xdp_txq);
20482062 }
20492063
20502064 /**
drivers/net/ethernet/intel/ice/ice_main.c+15−0
@@ -2555,6 +2555,20 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog, · 2554 unmodified lines
25552555 return (ret || xdp_ring_err) ? -ENOMEM : 0;
25562556 }
25572557
2558+/**
2559+ * ice_xdp_safe_mode - XDP handler for safe mode
2560+ * @dev: netdevice
2561+ * @xdp: XDP command
2562+ */
2563+static int ice_xdp_safe_mode(struct net_device __always_unused *dev,
2564+ struct netdev_bpf *xdp)
2565+{
2566+ NL_SET_ERR_MSG_MOD(xdp->extack,
2567+ "Please provide working DDP firmware package in order to use XDP\n"
2568+ "Refer to Documentation/networking/device_drivers/ethernet/intel/ice.rst");
2569+ return -EOPNOTSUPP;
2570+}
2571+
25582572 /**
25592573 * ice_xdp - implements XDP handler
25602574 * @dev: netdevice
@@ -6937,6 +6951,7 @@ static const struct net_device_ops ice_netdev_safe_mode_ops = { · 4376 unmodified lines
69376951 .ndo_change_mtu = ice_change_mtu,
69386952 .ndo_get_stats64 = ice_get_stats64,
69396953 .ndo_tx_timeout = ice_tx_timeout,
6954+ .ndo_bpf = ice_xdp_safe_mode,
69406955 };
69416956
69426957 static const struct net_device_ops ice_netdev_ops = {
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_sriov.c+7−9
@@ -467,12 +467,16 @@ static int ixgbe_set_vf_vlan(struct ixgbe_adapter *adapter, int add, int vid, · 466 unmodified lines
467467 return err;
468468 }
469469
470−static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
470+static int ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 max_frame, u32 vf)
471471 {
472472 struct ixgbe_hw *hw = &adapter->hw;
473− int max_frame = msgbuf[1];
474473 u32 max_frs;
475474
475+ if (max_frame < ETH_MIN_MTU || max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) {
476+ e_err(drv, "VF max_frame %d out of range\n", max_frame);
477+ return -EINVAL;
478+ }
479+
476480 /*
477481 * For 82599EB we have to keep all PFs and VFs operating with
478482 * the same max_frame value in order to avoid sending an oversize
@@ -533,12 +537,6 @@ static s32 ixgbe_set_vf_lpe(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) · 54 unmodified lines
533537 }
534538 }
535539
536− /* MTU < 68 is an error and causes problems on some kernels */
537− if (max_frame > IXGBE_MAX_JUMBO_FRAME_SIZE) {
538− e_err(drv, "VF max_frame %d out of range\n", max_frame);
539− return -EINVAL;
540− }
541−
542540 /* pull current max frame size from hardware */
543541 max_frs = IXGBE_READ_REG(hw, IXGBE_MAXFRS);
544542 max_frs &= IXGBE_MHADD_MFS_MASK;
@@ -1249,7 +1247,7 @@ static int ixgbe_rcv_msg_from_vf(struct ixgbe_adapter *adapter, u32 vf) · 704 unmodified lines
12491247 retval = ixgbe_set_vf_vlan_msg(adapter, msgbuf, vf);
12501248 break;
12511249 case IXGBE_VF_SET_LPE:
1252− retval = ixgbe_set_vf_lpe(adapter, msgbuf, vf);
1250+ retval = ixgbe_set_vf_lpe(adapter, msgbuf[1], vf);
12531251 break;
12541252 case IXGBE_VF_SET_MACVLAN:
12551253 retval = ixgbe_set_vf_macvlan_msg(adapter, msgbuf, vf);
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/korina.c+6−6
@@ -1315,23 +1315,23 @@ static int korina_probe(struct platform_device *pdev) · 1314 unmodified lines
13151315 lp->tx_irq = platform_get_irq_byname(pdev, "tx");
13161316
13171317 p = devm_platform_ioremap_resource_byname(pdev, "emac");
1318− if (!p) {
1318+ if (IS_ERR(p)) {
13191319 printk(KERN_ERR DRV_NAME ": cannot remap registers\n");
1320− return -ENOMEM;
1320+ return PTR_ERR(p);
13211321 }
13221322 lp->eth_regs = p;
13231323
13241324 p = devm_platform_ioremap_resource_byname(pdev, "dma_rx");
1325− if (!p) {
1325+ if (IS_ERR(p)) {
13261326 printk(KERN_ERR DRV_NAME ": cannot remap Rx DMA registers\n");
1327− return -ENOMEM;
1327+ return PTR_ERR(p);
13281328 }
13291329 lp->rx_dma_regs = p;
13301330
13311331 p = devm_platform_ioremap_resource_byname(pdev, "dma_tx");
1332− if (!p) {
1332+ if (IS_ERR(p)) {
13331333 printk(KERN_ERR DRV_NAME ": cannot remap Tx DMA registers\n");
1334− return -ENOMEM;
1334+ return PTR_ERR(p);
13351335 }
13361336 lp->tx_dma_regs = p;
13371337
drivers/net/ethernet/lantiq_xrx200.c+11−6
@@ -154,6 +154,8 @@ static int xrx200_close(struct net_device *net_dev) · 153 unmodified lines
154154
155155 static int xrx200_alloc_skb(struct xrx200_chan *ch)
156156 {
157+ struct sk_buff *skb = ch->skb[ch->dma.desc];
158+ dma_addr_t mapping;
157159 int ret = 0;
158160
159161 ch->skb[ch->dma.desc] = netdev_alloc_skb_ip_align(ch->priv->net_dev,
@@ -163,16 +165,18 @@ static int xrx200_alloc_skb(struct xrx200_chan *ch) · 3 unmodified lines
163165 goto skip;
164166 }
165167
166− ch->dma.desc_base[ch->dma.desc].addr = dma_map_single(ch->priv->dev,
167− ch->skb[ch->dma.desc]->data, XRX200_DMA_DATA_LEN,
168− DMA_FROM_DEVICE);
169− if (unlikely(dma_mapping_error(ch->priv->dev,
170− ch->dma.desc_base[ch->dma.desc].addr))) {
168+ mapping = dma_map_single(ch->priv->dev, ch->skb[ch->dma.desc]->data,
169+ XRX200_DMA_DATA_LEN, DMA_FROM_DEVICE);
170+ if (unlikely(dma_mapping_error(ch->priv->dev, mapping))) {
171171 dev_kfree_skb_any(ch->skb[ch->dma.desc]);
172+ ch->skb[ch->dma.desc] = skb;
172173 ret = -ENOMEM;
173174 goto skip;
174175 }
175176
177+ ch->dma.desc_base[ch->dma.desc].addr = mapping;
178+ /* Make sure the address is written before we give it to HW */
179+ wmb();
176180 skip:
177181 ch->dma.desc_base[ch->dma.desc].ctl =
178182 LTQ_DMA_OWN | LTQ_DMA_RX_OFFSET(NET_IP_ALIGN) |
@@ -196,6 +200,7 @@ static int xrx200_hw_receive(struct xrx200_chan *ch) · 17 unmodified lines
196200 ch->dma.desc %= LTQ_DESC_NUM;
197201
198202 if (ret) {
203+ net_dev->stats.rx_dropped++;
199204 netdev_err(net_dev, "failed to allocate new rx buffer\n");
200205 return ret;
201206 }
@@ -348,8 +353,8 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr) · 146 unmodified lines
348353 struct xrx200_chan *ch = ptr;
349354
350355 if (napi_schedule_prep(&ch->napi)) {
351− __napi_schedule(&ch->napi);
352356 ltq_dma_disable_irq(&ch->dma);
357+ __napi_schedule(&ch->napi);
353358 }
354359
355360 ltq_dma_ack_irq(&ch->dma);
drivers/net/ethernet/marvell/mvpp2/mvpp2.h+22−0
@@ -993,6 +993,14 @@ enum mvpp22_ptp_packet_format { · 992 unmodified lines
993993
994994 #define MVPP2_DESC_DMA_MASK DMA_BIT_MASK(40)
995995
996+/* Buffer header info bits */
997+#define MVPP2_B_HDR_INFO_MC_ID_MASK 0xfff
998+#define MVPP2_B_HDR_INFO_MC_ID(info) ((info) & MVPP2_B_HDR_INFO_MC_ID_MASK)
999+#define MVPP2_B_HDR_INFO_LAST_OFFS 12
1000+#define MVPP2_B_HDR_INFO_LAST_MASK BIT(12)
1001+#define MVPP2_B_HDR_INFO_IS_LAST(info) \
1002+ (((info) & MVPP2_B_HDR_INFO_LAST_MASK) >> MVPP2_B_HDR_INFO_LAST_OFFS)
1003+
9961004 struct mvpp2_tai;
9971005
9981006 /* Definitions */
@@ -1002,6 +1010,20 @@ struct mvpp2_rss_table { · 3 unmodified lines
10021010 u32 indir[MVPP22_RSS_TABLE_ENTRIES];
10031011 };
10041012
1013+struct mvpp2_buff_hdr {
1014+ __le32 next_phys_addr;
1015+ __le32 next_dma_addr;
1016+ __le16 byte_count;
1017+ __le16 info;
1018+ __le16 reserved1; /* bm_qset (for future use, BM) */
1019+ u8 next_phys_addr_high;
1020+ u8 next_dma_addr_high;
1021+ __le16 reserved2;
1022+ __le16 reserved3;
1023+ __le16 reserved4;
1024+ __le16 reserved5;
1025+};
1026+
10051027 /* Shared Packet Processor resources */
10061028 struct mvpp2 {
10071029 /* Shared registers' base addresses */
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+45−9
@@ -3839,6 +3839,35 @@ mvpp2_run_xdp(struct mvpp2_port *port, struct mvpp2_rx_queue *rxq, · 3838 unmodified lines
38393839 return ret;
38403840 }
38413841
3842+static void mvpp2_buff_hdr_pool_put(struct mvpp2_port *port, struct mvpp2_rx_desc *rx_desc,
3843+ int pool, u32 rx_status)
3844+{
3845+ phys_addr_t phys_addr, phys_addr_next;
3846+ dma_addr_t dma_addr, dma_addr_next;
3847+ struct mvpp2_buff_hdr *buff_hdr;
3848+
3849+ phys_addr = mvpp2_rxdesc_dma_addr_get(port, rx_desc);
3850+ dma_addr = mvpp2_rxdesc_cookie_get(port, rx_desc);
3851+
3852+ do {
3853+ buff_hdr = (struct mvpp2_buff_hdr *)phys_to_virt(phys_addr);
3854+
3855+ phys_addr_next = le32_to_cpu(buff_hdr->next_phys_addr);
3856+ dma_addr_next = le32_to_cpu(buff_hdr->next_dma_addr);
3857+
3858+ if (port->priv->hw_version >= MVPP22) {
3859+ phys_addr_next |= ((u64)buff_hdr->next_phys_addr_high << 32);
3860+ dma_addr_next |= ((u64)buff_hdr->next_dma_addr_high << 32);
3861+ }
3862+
3863+ mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
3864+
3865+ phys_addr = phys_addr_next;
3866+ dma_addr = dma_addr_next;
3867+
3868+ } while (!MVPP2_B_HDR_INFO_IS_LAST(le16_to_cpu(buff_hdr->info)));
3869+}
3870+
38423871 /* Main rx processing */
38433872 static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi,
38443873 int rx_todo, struct mvpp2_rx_queue *rxq)
@@ -3885,14 +3914,6 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, · 40 unmodified lines
38853914 MVPP2_RXD_BM_POOL_ID_OFFS;
38863915 bm_pool = &port->priv->bm_pools[pool];
38873916
3888− /* In case of an error, release the requested buffer pointer
3889− * to the Buffer Manager. This request process is controlled
3890− * by the hardware, and the information about the buffer is
3891− * comprised by the RX descriptor.
3892− */
3893− if (rx_status & MVPP2_RXD_ERR_SUMMARY)
3894− goto err_drop_frame;
3895−
38963917 if (port->priv->percpu_pools) {
38973918 pp = port->priv->page_pool[pool];
38983919 dma_dir = page_pool_get_dma_dir(pp);
@@ -3904,6 +3925,18 @@ static int mvpp2_rx(struct mvpp2_port *port, struct napi_struct *napi, · 5 unmodified lines
39043925 rx_bytes + MVPP2_MH_SIZE,
39053926 dma_dir);
39063927
3928+ /* Buffer header not supported */
3929+ if (rx_status & MVPP2_RXD_BUF_HDR)
3930+ goto err_drop_frame;
3931+
3932+ /* In case of an error, release the requested buffer pointer
3933+ * to the Buffer Manager. This request process is controlled
3934+ * by the hardware, and the information about the buffer is
3935+ * comprised by the RX descriptor.
3936+ */
3937+ if (rx_status & MVPP2_RXD_ERR_SUMMARY)
3938+ goto err_drop_frame;
3939+
39073940 /* Prefetch header */
39083941 prefetch(data);
39093942
@@ -3985,7 +4018,10 @@ err_drop_frame: · 75 unmodified lines
39854018 dev->stats.rx_errors++;
39864019 mvpp2_rx_error(port, rx_desc);
39874020 /* Return the buffer to the pool */
3988− mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
4021+ if (rx_status & MVPP2_RXD_BUF_HDR)
4022+ mvpp2_buff_hdr_pool_put(port, rx_desc, pool, rx_status);
4023+ else
4024+ mvpp2_bm_pool_put(port, pool, dma_addr, phys_addr);
39894025 }
39904026
39914027 rcu_read_unlock();
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c+4−0
@@ -786,6 +786,10 @@ static int otx2_set_rxfh_context(struct net_device *dev, const u32 *indir, · 785 unmodified lines
786786 if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
787787 return -EOPNOTSUPP;
788788
789+ if (*rss_context != ETH_RXFH_CONTEXT_ALLOC &&
790+ *rss_context >= MAX_RSS_GROUPS)
791+ return -EINVAL;
792+
789793 rss = &pfvf->hw.rss_info;
790794
791795 if (!rss->enable) {
drivers/net/ethernet/mediatek/mtk_eth_soc.c+52−25
@@ -681,32 +681,53 @@ static int mtk_set_mac_address(struct net_device *dev, void *p) · 680 unmodified lines
681681 void mtk_stats_update_mac(struct mtk_mac *mac)
682682 {
683683 struct mtk_hw_stats *hw_stats = mac->hw_stats;
684− unsigned int base = MTK_GDM1_TX_GBCNT;
685− u64 stats;
686−
687− base += hw_stats->reg_offset;
684+ struct mtk_eth *eth = mac->hw;
688685
689686 u64_stats_update_begin(&hw_stats->syncp);
690687
691− hw_stats->rx_bytes += mtk_r32(mac->hw, base);
692− stats = mtk_r32(mac->hw, base + 0x04);
693− if (stats)
694− hw_stats->rx_bytes += (stats << 32);
695− hw_stats->rx_packets += mtk_r32(mac->hw, base + 0x08);
696− hw_stats->rx_overflow += mtk_r32(mac->hw, base + 0x10);
697− hw_stats->rx_fcs_errors += mtk_r32(mac->hw, base + 0x14);
698− hw_stats->rx_short_errors += mtk_r32(mac->hw, base + 0x18);
699− hw_stats->rx_long_errors += mtk_r32(mac->hw, base + 0x1c);
700− hw_stats->rx_checksum_errors += mtk_r32(mac->hw, base + 0x20);
701− hw_stats->rx_flow_control_packets +=
702− mtk_r32(mac->hw, base + 0x24);
703− hw_stats->tx_skip += mtk_r32(mac->hw, base + 0x28);
704− hw_stats->tx_collisions += mtk_r32(mac->hw, base + 0x2c);
705− hw_stats->tx_bytes += mtk_r32(mac->hw, base + 0x30);
706− stats = mtk_r32(mac->hw, base + 0x34);
707− if (stats)
708− hw_stats->tx_bytes += (stats << 32);
709− hw_stats->tx_packets += mtk_r32(mac->hw, base + 0x38);
688+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628)) {
689+ hw_stats->tx_packets += mtk_r32(mac->hw, MT7628_SDM_TPCNT);
690+ hw_stats->tx_bytes += mtk_r32(mac->hw, MT7628_SDM_TBCNT);
691+ hw_stats->rx_packets += mtk_r32(mac->hw, MT7628_SDM_RPCNT);
692+ hw_stats->rx_bytes += mtk_r32(mac->hw, MT7628_SDM_RBCNT);
693+ hw_stats->rx_checksum_errors +=
694+ mtk_r32(mac->hw, MT7628_SDM_CS_ERR);
695+ } else {
696+ unsigned int offs = hw_stats->reg_offset;
697+ u64 stats;
698+
699+ hw_stats->rx_bytes += mtk_r32(mac->hw,
700+ MTK_GDM1_RX_GBCNT_L + offs);
701+ stats = mtk_r32(mac->hw, MTK_GDM1_RX_GBCNT_H + offs);
702+ if (stats)
703+ hw_stats->rx_bytes += (stats << 32);
704+ hw_stats->rx_packets +=
705+ mtk_r32(mac->hw, MTK_GDM1_RX_GPCNT + offs);
706+ hw_stats->rx_overflow +=
707+ mtk_r32(mac->hw, MTK_GDM1_RX_OERCNT + offs);
708+ hw_stats->rx_fcs_errors +=
709+ mtk_r32(mac->hw, MTK_GDM1_RX_FERCNT + offs);
710+ hw_stats->rx_short_errors +=
711+ mtk_r32(mac->hw, MTK_GDM1_RX_SERCNT + offs);
712+ hw_stats->rx_long_errors +=
713+ mtk_r32(mac->hw, MTK_GDM1_RX_LENCNT + offs);
714+ hw_stats->rx_checksum_errors +=
715+ mtk_r32(mac->hw, MTK_GDM1_RX_CERCNT + offs);
716+ hw_stats->rx_flow_control_packets +=
717+ mtk_r32(mac->hw, MTK_GDM1_RX_FCCNT + offs);
718+ hw_stats->tx_skip +=
719+ mtk_r32(mac->hw, MTK_GDM1_TX_SKIPCNT + offs);
720+ hw_stats->tx_collisions +=
721+ mtk_r32(mac->hw, MTK_GDM1_TX_COLCNT + offs);
722+ hw_stats->tx_bytes +=
723+ mtk_r32(mac->hw, MTK_GDM1_TX_GBCNT_L + offs);
724+ stats = mtk_r32(mac->hw, MTK_GDM1_TX_GBCNT_H + offs);
725+ if (stats)
726+ hw_stats->tx_bytes += (stats << 32);
727+ hw_stats->tx_packets +=
728+ mtk_r32(mac->hw, MTK_GDM1_TX_GPCNT + offs);
729+ }
730+
710731 u64_stats_update_end(&hw_stats->syncp);
711732 }
712733
@@ -2423,7 +2444,8 @@ static void mtk_dim_rx(struct work_struct *work) · 1710 unmodified lines
24232444 val |= cur << MTK_PDMA_DELAY_RX_PINT_SHIFT;
24242445
24252446 mtk_w32(eth, val, MTK_PDMA_DELAY_INT);
2426− mtk_w32(eth, val, MTK_QDMA_DELAY_INT);
2447+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
2448+ mtk_w32(eth, val, MTK_QDMA_DELAY_INT);
24272449
24282450 spin_unlock_bh(&eth->dim_lock);
24292451
@@ -2452,7 +2474,8 @@ static void mtk_dim_tx(struct work_struct *work) · 22 unmodified lines
24522474 val |= cur << MTK_PDMA_DELAY_TX_PINT_SHIFT;
24532475
24542476 mtk_w32(eth, val, MTK_PDMA_DELAY_INT);
2455− mtk_w32(eth, val, MTK_QDMA_DELAY_INT);
2477+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
2478+ mtk_w32(eth, val, MTK_QDMA_DELAY_INT);
24562479
24572480 spin_unlock_bh(&eth->dim_lock);
24582481
@@ -2480,6 +2503,10 @@ static int mtk_hw_init(struct mtk_eth *eth) · 21 unmodified lines
24802503 goto err_disable_pm;
24812504 }
24822505
2506+ /* set interrupt delays based on current Net DIM sample */
2507+ mtk_dim_rx(&eth->rx_dim.work);
2508+ mtk_dim_tx(&eth->tx_dim.work);
2509+
24832510 /* disable delay and normal interrupt */
24842511 mtk_tx_irq_disable(eth, ~0);
24852512 mtk_rx_irq_disable(eth, ~0);
drivers/net/ethernet/mediatek/mtk_eth_soc.h+22−2
@@ -278,8 +278,21 @@ · 277 unmodified lines
278278 /* QDMA FQ Free Page Buffer Length Register */
279279 #define MTK_QDMA_FQ_BLEN 0x1B2C
280280
281−/* GMA1 Received Good Byte Count Register */
282−#define MTK_GDM1_TX_GBCNT 0x2400
281+/* GMA1 counter / statics register */
282+#define MTK_GDM1_RX_GBCNT_L 0x2400
283+#define MTK_GDM1_RX_GBCNT_H 0x2404
284+#define MTK_GDM1_RX_GPCNT 0x2408
285+#define MTK_GDM1_RX_OERCNT 0x2410
286+#define MTK_GDM1_RX_FERCNT 0x2414
287+#define MTK_GDM1_RX_SERCNT 0x2418
288+#define MTK_GDM1_RX_LENCNT 0x241c
289+#define MTK_GDM1_RX_CERCNT 0x2420
290+#define MTK_GDM1_RX_FCCNT 0x2424
291+#define MTK_GDM1_TX_SKIPCNT 0x2428
292+#define MTK_GDM1_TX_COLCNT 0x242c
293+#define MTK_GDM1_TX_GBCNT_L 0x2430
294+#define MTK_GDM1_TX_GBCNT_H 0x2434
295+#define MTK_GDM1_TX_GPCNT 0x2438
283296 #define MTK_STAT_OFFSET 0x40
284297
285298 /* QDMA descriptor txd4 */
@@ -502,6 +515,13 @@ · 216 unmodified lines
502515 #define MT7628_SDM_MAC_ADRL (MT7628_SDM_OFFSET + 0x0c)
503516 #define MT7628_SDM_MAC_ADRH (MT7628_SDM_OFFSET + 0x10)
504517
518+/* Counter / stat register */
519+#define MT7628_SDM_TPCNT (MT7628_SDM_OFFSET + 0x100)
520+#define MT7628_SDM_TBCNT (MT7628_SDM_OFFSET + 0x104)
521+#define MT7628_SDM_RPCNT (MT7628_SDM_OFFSET + 0x108)
522+#define MT7628_SDM_RBCNT (MT7628_SDM_OFFSET + 0x10c)
523+#define MT7628_SDM_CS_ERR (MT7628_SDM_OFFSET + 0x110)
524+
505525 struct mtk_rx_dma {
506526 unsigned int rxd1;
507527 unsigned int rxd2;
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c+1−3
@@ -2027,8 +2027,6 @@ static int mlx4_en_set_tunable(struct net_device *dev, · 2026 unmodified lines
20272027 return ret;
20282028 }
20292029
2030−#define MLX4_EEPROM_PAGE_LEN 256
2031−
20322030 static int mlx4_en_get_module_info(struct net_device *dev,
20332031 struct ethtool_modinfo *modinfo)
20342032 {
@@ -2063,7 +2061,7 @@ static int mlx4_en_get_module_info(struct net_device *dev, · 28 unmodified lines
20632061 break;
20642062 case MLX4_MODULE_ID_SFP:
20652063 modinfo->type = ETH_MODULE_SFF_8472;
2066− modinfo->eeprom_len = MLX4_EEPROM_PAGE_LEN;
2064+ modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
20672065 break;
20682066 default:
20692067 return -EINVAL;
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/mlx4/port.c+103−4
@@ -1973,6 +1973,7 @@ EXPORT_SYMBOL(mlx4_get_roce_gid_from_slave); · 1972 unmodified lines
19731973 #define I2C_ADDR_LOW 0x50
19741974 #define I2C_ADDR_HIGH 0x51
19751975 #define I2C_PAGE_SIZE 256
1976+#define I2C_HIGH_PAGE_SIZE 128
19761977
19771978 /* Module Info Data */
19781979 struct mlx4_cable_info {
@@ -2026,6 +2027,88 @@ static inline const char *cable_info_mad_err_str(u16 mad_status) · 47 unmodified lines
20262027 return "Unknown Error";
20272028 }
20282029
2030+static int mlx4_get_module_id(struct mlx4_dev *dev, u8 port, u8 *module_id)
2031+{
2032+ struct mlx4_cmd_mailbox *inbox, *outbox;
2033+ struct mlx4_mad_ifc *inmad, *outmad;
2034+ struct mlx4_cable_info *cable_info;
2035+ int ret;
2036+
2037+ inbox = mlx4_alloc_cmd_mailbox(dev);
2038+ if (IS_ERR(inbox))
2039+ return PTR_ERR(inbox);
2040+
2041+ outbox = mlx4_alloc_cmd_mailbox(dev);
2042+ if (IS_ERR(outbox)) {
2043+ mlx4_free_cmd_mailbox(dev, inbox);
2044+ return PTR_ERR(outbox);
2045+ }
2046+
2047+ inmad = (struct mlx4_mad_ifc *)(inbox->buf);
2048+ outmad = (struct mlx4_mad_ifc *)(outbox->buf);
2049+
2050+ inmad->method = 0x1; /* Get */
2051+ inmad->class_version = 0x1;
2052+ inmad->mgmt_class = 0x1;
2053+ inmad->base_version = 0x1;
2054+ inmad->attr_id = cpu_to_be16(0xFF60); /* Module Info */
2055+
2056+ cable_info = (struct mlx4_cable_info *)inmad->data;
2057+ cable_info->dev_mem_address = 0;
2058+ cable_info->page_num = 0;
2059+ cable_info->i2c_addr = I2C_ADDR_LOW;
2060+ cable_info->size = cpu_to_be16(1);
2061+
2062+ ret = mlx4_cmd_box(dev, inbox->dma, outbox->dma, port, 3,
2063+ MLX4_CMD_MAD_IFC, MLX4_CMD_TIME_CLASS_C,
2064+ MLX4_CMD_NATIVE);
2065+ if (ret)
2066+ goto out;
2067+
2068+ if (be16_to_cpu(outmad->status)) {
2069+ /* Mad returned with bad status */
2070+ ret = be16_to_cpu(outmad->status);
2071+ mlx4_warn(dev,
2072+ "MLX4_CMD_MAD_IFC Get Module ID attr(%x) port(%d) i2c_addr(%x) offset(%d) size(%d): Response Mad Status(%x) - %s\n",
2073+ 0xFF60, port, I2C_ADDR_LOW, 0, 1, ret,
2074+ cable_info_mad_err_str(ret));
2075+ ret = -ret;
2076+ goto out;
2077+ }
2078+ cable_info = (struct mlx4_cable_info *)outmad->data;
2079+ *module_id = cable_info->data[0];
2080+out:
2081+ mlx4_free_cmd_mailbox(dev, inbox);
2082+ mlx4_free_cmd_mailbox(dev, outbox);
2083+ return ret;
2084+}
2085+
2086+static void mlx4_sfp_eeprom_params_set(u8 *i2c_addr, u8 *page_num, u16 *offset)
2087+{
2088+ *i2c_addr = I2C_ADDR_LOW;
2089+ *page_num = 0;
2090+
2091+ if (*offset < I2C_PAGE_SIZE)
2092+ return;
2093+
2094+ *i2c_addr = I2C_ADDR_HIGH;
2095+ *offset -= I2C_PAGE_SIZE;
2096+}
2097+
2098+static void mlx4_qsfp_eeprom_params_set(u8 *i2c_addr, u8 *page_num, u16 *offset)
2099+{
2100+ /* Offsets 0-255 belong to page 0.
2101+ * Offsets 256-639 belong to pages 01, 02, 03.
2102+ * For example, offset 400 is page 02: 1 + (400 - 256) / 128 = 2
2103+ */
2104+ if (*offset < I2C_PAGE_SIZE)
2105+ *page_num = 0;
2106+ else
2107+ *page_num = 1 + (*offset - I2C_PAGE_SIZE) / I2C_HIGH_PAGE_SIZE;
2108+ *i2c_addr = I2C_ADDR_LOW;
2109+ *offset -= *page_num * I2C_HIGH_PAGE_SIZE;
2110+}
2111+
20292112 /**
20302113 * mlx4_get_module_info - Read cable module eeprom data
20312114 * @dev: mlx4_dev.
@@ -2045,12 +2128,30 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, · 13 unmodified lines
20452128 struct mlx4_cmd_mailbox *inbox, *outbox;
20462129 struct mlx4_mad_ifc *inmad, *outmad;
20472130 struct mlx4_cable_info *cable_info;
2048− u16 i2c_addr;
2131+ u8 module_id, i2c_addr, page_num;
20492132 int ret;
20502133
20512134 if (size > MODULE_INFO_MAX_READ)
20522135 size = MODULE_INFO_MAX_READ;
20532136
2137+ ret = mlx4_get_module_id(dev, port, &module_id);
2138+ if (ret)
2139+ return ret;
2140+
2141+ switch (module_id) {
2142+ case MLX4_MODULE_ID_SFP:
2143+ mlx4_sfp_eeprom_params_set(&i2c_addr, &page_num, &offset);
2144+ break;
2145+ case MLX4_MODULE_ID_QSFP:
2146+ case MLX4_MODULE_ID_QSFP_PLUS:
2147+ case MLX4_MODULE_ID_QSFP28:
2148+ mlx4_qsfp_eeprom_params_set(&i2c_addr, &page_num, &offset);
2149+ break;
2150+ default:
2151+ mlx4_err(dev, "Module ID not recognized: %#x\n", module_id);
2152+ return -EINVAL;
2153+ }
2154+
20542155 inbox = mlx4_alloc_cmd_mailbox(dev);
20552156 if (IS_ERR(inbox))
20562157 return PTR_ERR(inbox);
@@ -2076,11 +2177,9 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, · 19 unmodified lines
20762177 */
20772178 size -= offset + size - I2C_PAGE_SIZE;
20782179
2079− i2c_addr = I2C_ADDR_LOW;
2080−
20812180 cable_info = (struct mlx4_cable_info *)inmad->data;
20822181 cable_info->dev_mem_address = cpu_to_be16(offset);
2083− cable_info->page_num = 0;
2182+ cable_info->page_num = page_num;
20842183 cable_info->i2c_addr = i2c_addr;
20852184 cable_info->size = cpu_to_be16(size);
20862185
drivers/net/ethernet/mellanox/mlx5/core/dev.c+19−0
@@ -303,6 +303,7 @@ int mlx5_attach_device(struct mlx5_core_dev *dev) · 302 unmodified lines
303303 int ret = 0, i;
304304
305305 mutex_lock(&mlx5_intf_mutex);
306+ priv->flags &= ~MLX5_PRIV_FLAGS_DETACH;
306307 for (i = 0; i < ARRAY_SIZE(mlx5_adev_devices); i++) {
307308 if (!priv->adev[i]) {
308309 bool is_supported = false;
@@ -320,6 +321,16 @@ int mlx5_attach_device(struct mlx5_core_dev *dev) · 11 unmodified lines
320321 }
321322 } else {
322323 adev = &priv->adev[i]->adev;
324+
325+ /* Pay attention that this is not PCI driver that
326+ * mlx5_core_dev is connected, but auxiliary driver.
327+ *
328+ * Here we can race of module unload with devlink
329+ * reload, but we don't need to take extra lock because
330+ * we are holding global mlx5_intf_mutex.
331+ */
332+ if (!adev->dev.driver)
333+ continue;
323334 adrv = to_auxiliary_drv(adev->dev.driver);
324335
325336 if (adrv->resume)
@@ -350,6 +361,10 @@ void mlx5_detach_device(struct mlx5_core_dev *dev) · 24 unmodified lines
350361 continue;
351362
352363 adev = &priv->adev[i]->adev;
364+ /* Auxiliary driver was unbind manually through sysfs */
365+ if (!adev->dev.driver)
366+ goto skip_suspend;
367+
353368 adrv = to_auxiliary_drv(adev->dev.driver);
354369
355370 if (adrv->suspend) {
@@ -357,9 +372,11 @@ void mlx5_detach_device(struct mlx5_core_dev *dev) · 1 unmodified line
357372 continue;
358373 }
359374
375+skip_suspend:
360376 del_adev(&priv->adev[i]->adev);
361377 priv->adev[i] = NULL;
362378 }
379+ priv->flags |= MLX5_PRIV_FLAGS_DETACH;
363380 mutex_unlock(&mlx5_intf_mutex);
364381 }
365382
@@ -448,6 +465,8 @@ int mlx5_rescan_drivers_locked(struct mlx5_core_dev *dev) · 82 unmodified lines
448465 struct mlx5_priv *priv = &dev->priv;
449466
450467 lockdep_assert_held(&mlx5_intf_mutex);
468+ if (priv->flags & MLX5_PRIV_FLAGS_DETACH)
469+ return 0;
451470
452471 delete_drivers(dev);
453472 if (priv->flags & MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV)
drivers/net/ethernet/mellanox/mlx5/core/en/devlink.c+2−0
@@ -64,6 +64,8 @@ struct devlink_port *mlx5e_get_devlink_port(struct net_device *dev) · 63 unmodified lines
6464 struct mlx5e_priv *priv = netdev_priv(dev);
6565 struct devlink_port *port;
6666
67+ if (!netif_device_present(dev))
68+ return NULL;
6769 port = mlx5e_devlink_get_dl_port(priv);
6870 if (port->registered)
6971 return port;
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c+0−1
@@ -1,7 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
22 // Copyright (c) 2020 Mellanox Technologies
33
4−#include <linux/ptp_classify.h>
54 #include "en/ptp.h"
65 #include "en/txrx.h"
76 #include "en/params.h"
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.h+22−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66
77 #include "en.h"
88 #include "en_stats.h"
9+#include <linux/ptp_classify.h>
910
1011 struct mlx5e_ptpsq {
1112 struct mlx5e_txqsq txqsq;
@@ -43,6 +44,27 @@ struct mlx5e_ptp { · 31 unmodified lines
4344 DECLARE_BITMAP(state, MLX5E_PTP_STATE_NUM_STATES);
4445 };
4546
47+static inline bool mlx5e_use_ptpsq(struct sk_buff *skb)
48+{
49+ struct flow_keys fk;
50+
51+ if (!(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))
52+ return false;
53+
54+ if (!skb_flow_dissect_flow_keys(skb, &fk, 0))
55+ return false;
56+
57+ if (fk.basic.n_proto == htons(ETH_P_1588))
58+ return true;
59+
60+ if (fk.basic.n_proto != htons(ETH_P_IP) &&
61+ fk.basic.n_proto != htons(ETH_P_IPV6))
62+ return false;
63+
64+ return (fk.basic.ip_proto == IPPROTO_UDP &&
65+ fk.ports.dst == htons(PTP_EV_PORT));
66+}
67+
4668 int mlx5e_ptp_open(struct mlx5e_priv *priv, struct mlx5e_params *params,
4769 u8 lag_port, struct mlx5e_ptp **cp);
4870 void mlx5e_ptp_close(struct mlx5e_ptp *c);
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bond.c+2−0
@@ -223,6 +223,8 @@ static void mlx5e_rep_changelowerstate_event(struct net_device *netdev, void *pt · 222 unmodified lines
223223 rpriv = priv->ppriv;
224224 fwd_vport_num = rpriv->rep->vport;
225225 lag_dev = netdev_master_upper_dev_get(netdev);
226+ if (!lag_dev)
227+ return;
226228
227229 netdev_dbg(netdev, "lag_dev(%s)'s slave vport(%d) is txable(%d)\n",
228230 lag_dev->name, fwd_vport_num, net_lag_port_dev_txable(netdev));
drivers/net/ethernet/mellanox/mlx5/core/en/rep/neigh.c+6−9
@@ -129,10 +129,9 @@ static void mlx5e_rep_neigh_update(struct work_struct *work) · 128 unmodified lines
129129 work);
130130 struct mlx5e_neigh_hash_entry *nhe = update_work->nhe;
131131 struct neighbour *n = update_work->n;
132+ struct mlx5e_encap_entry *e = NULL;
132133 bool neigh_connected, same_dev;
133− struct mlx5e_encap_entry *e;
134134 unsigned char ha[ETH_ALEN];
135− struct mlx5e_priv *priv;
136135 u8 nud_state, dead;
137136
138137 rtnl_lock();
@@ -156,14 +155,12 @@ static void mlx5e_rep_neigh_update(struct work_struct *work) · 17 unmodified lines
156155 if (!same_dev)
157156 goto out;
158157
159− list_for_each_entry(e, &nhe->encap_list, encap_list) {
160− if (!mlx5e_encap_take(e))
161− continue;
158+ /* mlx5e_get_next_init_encap() releases previous encap before returning
159+ * the next one.
160+ */
161+ while ((e = mlx5e_get_next_init_encap(nhe, e)) != NULL)
162+ mlx5e_rep_update_flows(netdev_priv(e->out_dev), e, neigh_connected, ha);
162163
163− priv = netdev_priv(e->out_dev);
164− mlx5e_rep_update_flows(priv, e, neigh_connected, ha);
165− mlx5e_encap_put(priv, e);
166− }
167164 out:
168165 rtnl_unlock();
169166 mlx5e_release_neigh_update_work(update_work);
drivers/net/ethernet/mellanox/mlx5/core/en/rep/tc.c+2−6
@@ -94,13 +94,9 @@ void mlx5e_rep_update_flows(struct mlx5e_priv *priv, · 93 unmodified lines
9494
9595 ASSERT_RTNL();
9696
97− /* wait for encap to be fully initialized */
98− wait_for_completion(&e->res_ready);
99−
10097 mutex_lock(&esw->offloads.encap_tbl_lock);
10198 encap_connected = !!(e->flags & MLX5_ENCAP_ENTRY_VALID);
102− if (e->compl_result < 0 || (encap_connected == neigh_connected &&
103− ether_addr_equal(e->h_dest, ha)))
99+ if (encap_connected == neigh_connected && ether_addr_equal(e->h_dest, ha))
104100 goto unlock;
105101
106102 mlx5e_take_all_encap_flows(e, &flow_list);
@@ -626,7 +622,7 @@ static bool mlx5e_restore_skb(struct sk_buff *skb, u32 chain, u32 reg_c1, · 519 unmodified lines
626622 struct mlx5_eswitch *esw;
627623 u32 zone_restore_id;
628624
629− tc_skb_ext = skb_ext_add(skb, TC_SKB_EXT);
625+ tc_skb_ext = tc_skb_ext_alloc(skb);
630626 if (!tc_skb_ext) {
631627 WARN_ON(1);
632628 return false;
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c+31−4
@@ -251,9 +251,12 @@ static void mlx5e_take_all_route_decap_flows(struct mlx5e_route_entry *r, · 250 unmodified lines
251251 mlx5e_take_tmp_flow(flow, flow_list, 0);
252252 }
253253
254+typedef bool (match_cb)(struct mlx5e_encap_entry *);
255+
254256 static struct mlx5e_encap_entry *
255−mlx5e_get_next_valid_encap(struct mlx5e_neigh_hash_entry *nhe,
256− struct mlx5e_encap_entry *e)
257+mlx5e_get_next_matching_encap(struct mlx5e_neigh_hash_entry *nhe,
258+ struct mlx5e_encap_entry *e,
259+ match_cb match)
257260 {
258261 struct mlx5e_encap_entry *next = NULL;
259262
@@ -288,7 +291,7 @@ retry: · 28 unmodified lines
288291 /* wait for encap to be fully initialized */
289292 wait_for_completion(&next->res_ready);
290293 /* continue searching if encap entry is not in valid state after completion */
291− if (!(next->flags & MLX5_ENCAP_ENTRY_VALID)) {
294+ if (!match(next)) {
292295 e = next;
293296 goto retry;
294297 }
@@ -296,6 +299,30 @@ retry: · 1 unmodified line
296299 return next;
297300 }
298301
302+static bool mlx5e_encap_valid(struct mlx5e_encap_entry *e)
303+{
304+ return e->flags & MLX5_ENCAP_ENTRY_VALID;
305+}
306+
307+static struct mlx5e_encap_entry *
308+mlx5e_get_next_valid_encap(struct mlx5e_neigh_hash_entry *nhe,
309+ struct mlx5e_encap_entry *e)
310+{
311+ return mlx5e_get_next_matching_encap(nhe, e, mlx5e_encap_valid);
312+}
313+
314+static bool mlx5e_encap_initialized(struct mlx5e_encap_entry *e)
315+{
316+ return e->compl_result >= 0;
317+}
318+
319+struct mlx5e_encap_entry *
320+mlx5e_get_next_init_encap(struct mlx5e_neigh_hash_entry *nhe,
321+ struct mlx5e_encap_entry *e)
322+{
323+ return mlx5e_get_next_matching_encap(nhe, e, mlx5e_encap_initialized);
324+}
325+
299326 void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
300327 {
301328 struct mlx5e_neigh *m_neigh = &nhe->m_neigh;
@@ -1505,7 +1532,7 @@ mlx5e_init_fib_work_ipv4(struct mlx5e_priv *priv, · 1203 unmodified lines
15051532
15061533 fen_info = container_of(info, struct fib_entry_notifier_info, info);
15071534 fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev;
1508− if (fib_dev->netdev_ops != &mlx5e_netdev_ops ||
1535+ if (!fib_dev || fib_dev->netdev_ops != &mlx5e_netdev_ops ||
15091536 fen_info->dst_len != 32)
15101537 return NULL;
15111538
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c+0−3
@@ -532,9 +532,6 @@ void mlx5e_ipsec_build_netdev(struct mlx5e_priv *priv) · 531 unmodified lines
532532 struct mlx5_core_dev *mdev = priv->mdev;
533533 struct net_device *netdev = priv->netdev;
534534
535− if (!priv->ipsec)
536− return;
537−
538535 if (!(mlx5_accel_ipsec_device_caps(mdev) & MLX5_ACCEL_IPSEC_CAP_ESP) ||
539536 !MLX5_CAP_ETH(mdev, swp)) {
540537 mlx5_core_dbg(mdev, "mlx5e: ESP and SWP offload not supported\n");
drivers/net/ethernet/mellanox/mlx5/core/en_arfs.c+1−1
@@ -356,7 +356,7 @@ err: · 355 unmodified lines
356356
357357 int mlx5e_arfs_create_tables(struct mlx5e_priv *priv)
358358 {
359− int err = 0;
359+ int err = -ENOMEM;
360360 int i;
361361
362362 if (!(priv->netdev->hw_features & NETIF_F_NTUPLE))
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_fs.c+1−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/ipv6.h>
3636 #include <linux/tcp.h>
3737 #include <linux/mlx5/fs.h>
38+#include <linux/mlx5/mpfs.h>
3839 #include "en.h"
3940 #include "en_rep.h"
4041 #include "lib/mpfs.h"
drivers/net/ethernet/mellanox/mlx5/core/en_main.c+81−33
@@ -889,10 +889,13 @@ err_free_rq: · 888 unmodified lines
889889 void mlx5e_activate_rq(struct mlx5e_rq *rq)
890890 {
891891 set_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);
892− if (rq->icosq)
892+ if (rq->icosq) {
893893 mlx5e_trigger_irq(rq->icosq);
894− else
894+ } else {
895+ local_bh_disable();
895896 napi_schedule(rq->cq.napi);
897+ local_bh_enable();
898+ }
896899 }
897900
898901 void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
@@ -2697,13 +2700,11 @@ static int mlx5e_update_netdev_queues(struct mlx5e_priv *priv) · 1798 unmodified lines
26972700 int err;
26982701
26992702 old_num_txqs = netdev->real_num_tx_queues;
2700− old_ntc = netdev->num_tc;
2703+ old_ntc = netdev->num_tc ? : 1;
27012704
27022705 nch = priv->channels.params.num_channels;
27032706 ntc = priv->channels.params.num_tc;
27042707 num_rxqs = nch * priv->profile->rq_groups;
2705− if (priv->channels.params.ptp_rx)
2706− num_rxqs++;
27072708
27082709 mlx5e_netdev_set_tcs(netdev, nch, ntc);
27092710
@@ -3855,6 +3856,16 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, · 1145 unmodified lines
38553856 netdev_warn(netdev, "Disabling rxhash, not supported when CQE compress is active\n");
38563857 }
38573858
3859+ if (mlx5e_is_uplink_rep(priv)) {
3860+ features &= ~NETIF_F_HW_TLS_RX;
3861+ if (netdev->features & NETIF_F_HW_TLS_RX)
3862+ netdev_warn(netdev, "Disabling hw_tls_rx, not supported in switchdev mode\n");
3863+
3864+ features &= ~NETIF_F_HW_TLS_TX;
3865+ if (netdev->features & NETIF_F_HW_TLS_TX)
3866+ netdev_warn(netdev, "Disabling hw_tls_tx, not supported in switchdev mode\n");
3867+ }
3868+
38583869 mutex_unlock(&priv->state_lock);
38593870
38603871 return features;
@@ -3971,11 +3982,45 @@ int mlx5e_ptp_rx_manage_fs_ctx(struct mlx5e_priv *priv, void *ctx) · 110 unmodified lines
39713982 return mlx5e_ptp_rx_manage_fs(priv, set);
39723983 }
39733984
3974−int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
3985+static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filter)
3986+{
3987+ bool rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def;
3988+ int err;
3989+
3990+ if (!rx_filter)
3991+ /* Reset CQE compression to Admin default */
3992+ return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def);
3993+
3994+ if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS))
3995+ return 0;
3996+
3997+ /* Disable CQE compression */
3998+ netdev_warn(priv->netdev, "Disabling RX cqe compression\n");
3999+ err = mlx5e_modify_rx_cqe_compression_locked(priv, false);
4000+ if (err)
4001+ netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err);
4002+
4003+ return err;
4004+}
4005+
4006+static int mlx5e_hwstamp_config_ptp_rx(struct mlx5e_priv *priv, bool ptp_rx)
39754007 {
39764008 struct mlx5e_params new_params;
4009+
4010+ if (ptp_rx == priv->channels.params.ptp_rx)
4011+ return 0;
4012+
4013+ new_params = priv->channels.params;
4014+ new_params.ptp_rx = ptp_rx;
4015+ return mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx,
4016+ &new_params.ptp_rx, true);
4017+}
4018+
4019+int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr)
4020+{
39774021 struct hwtstamp_config config;
39784022 bool rx_cqe_compress_def;
4023+ bool ptp_rx;
39794024 int err;
39804025
39814026 if (!MLX5_CAP_GEN(priv->mdev, device_frequency_khz) ||
@@ -3995,13 +4040,12 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) · 13 unmodified lines
39954040 }
39964041
39974042 mutex_lock(&priv->state_lock);
3998− new_params = priv->channels.params;
39994043 rx_cqe_compress_def = priv->channels.params.rx_cqe_compress_def;
40004044
40014045 /* RX HW timestamp */
40024046 switch (config.rx_filter) {
40034047 case HWTSTAMP_FILTER_NONE:
4004− new_params.ptp_rx = false;
4048+ ptp_rx = false;
40054049 break;
40064050 case HWTSTAMP_FILTER_ALL:
40074051 case HWTSTAMP_FILTER_SOME:
@@ -4018,24 +4062,25 @@ int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr) · 10 unmodified lines
40184062 case HWTSTAMP_FILTER_PTP_V2_SYNC:
40194063 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
40204064 case HWTSTAMP_FILTER_NTP_ALL:
4021− new_params.ptp_rx = rx_cqe_compress_def;
40224065 config.rx_filter = HWTSTAMP_FILTER_ALL;
4066+ /* ptp_rx is set if both HW TS is set and CQE
4067+ * compression is set
4068+ */
4069+ ptp_rx = rx_cqe_compress_def;
40234070 break;
40244071 default:
4025− mutex_unlock(&priv->state_lock);
4026− return -ERANGE;
4072+ err = -ERANGE;
4073+ goto err_unlock;
40274074 }
40284075
4029− if (new_params.ptp_rx == priv->channels.params.ptp_rx)
4030− goto out;
4076+ if (!priv->profile->rx_ptp_support)
4077+ err = mlx5e_hwstamp_config_no_ptp_rx(priv,
4078+ config.rx_filter != HWTSTAMP_FILTER_NONE);
4079+ else
4080+ err = mlx5e_hwstamp_config_ptp_rx(priv, ptp_rx);
4081+ if (err)
4082+ goto err_unlock;
40314083
4032− err = mlx5e_safe_switch_params(priv, &new_params, mlx5e_ptp_rx_manage_fs_ctx,
4033− &new_params.ptp_rx, true);
4034− if (err) {
4035− mutex_unlock(&priv->state_lock);
4036− return err;
4037− }
4038−out:
40394084 memcpy(&priv->tstamp, &config, sizeof(config));
40404085 mutex_unlock(&priv->state_lock);
40414086
@@ -4044,6 +4089,9 @@ out: · 2 unmodified lines
40444089
40454090 return copy_to_user(ifr->ifr_data, &config,
40464091 sizeof(config)) ? -EFAULT : 0;
4092+err_unlock:
4093+ mutex_unlock(&priv->state_lock);
4094+ return err;
40474095 }
40484096
40494097 int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr)
@@ -4774,22 +4822,15 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) · 724 unmodified lines
47744822 }
47754823
47764824 if (mlx5_vxlan_allowed(mdev->vxlan) || mlx5_geneve_tx_allowed(mdev)) {
4777− netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL |
4778− NETIF_F_GSO_UDP_TUNNEL_CSUM;
4779− netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL |
4780− NETIF_F_GSO_UDP_TUNNEL_CSUM;
4781− netdev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM;
4782− netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL |
4783− NETIF_F_GSO_UDP_TUNNEL_CSUM;
4825+ netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
4826+ netdev->hw_enc_features |= NETIF_F_GSO_UDP_TUNNEL;
4827+ netdev->vlan_features |= NETIF_F_GSO_UDP_TUNNEL;
47844828 }
47854829
47864830 if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_GRE)) {
4787− netdev->hw_features |= NETIF_F_GSO_GRE |
4788− NETIF_F_GSO_GRE_CSUM;
4789− netdev->hw_enc_features |= NETIF_F_GSO_GRE |
4790− NETIF_F_GSO_GRE_CSUM;
4791− netdev->gso_partial_features |= NETIF_F_GSO_GRE |
4792− NETIF_F_GSO_GRE_CSUM;
4831+ netdev->hw_features |= NETIF_F_GSO_GRE;
4832+ netdev->hw_enc_features |= NETIF_F_GSO_GRE;
4833+ netdev->gso_partial_features |= NETIF_F_GSO_GRE;
47934834 }
47944835
47954836 if (mlx5e_tunnel_proto_supported_tx(mdev, IPPROTO_IPIP)) {
@@ -5229,6 +5270,11 @@ static void mlx5e_update_features(struct net_device *netdev) · 433 unmodified lines
52295270 rtnl_unlock();
52305271 }
52315272
5273+static void mlx5e_reset_channels(struct net_device *netdev)
5274+{
5275+ netdev_reset_tc(netdev);
5276+}
5277+
52325278 int mlx5e_attach_netdev(struct mlx5e_priv *priv)
52335279 {
52345280 const bool take_rtnl = priv->netdev->reg_state == NETREG_REGISTERED;
@@ -5283,6 +5329,7 @@ err_cleanup_tx: · 48 unmodified lines
52835329 profile->cleanup_tx(priv);
52845330
52855331 out:
5332+ mlx5e_reset_channels(priv->netdev);
52865333 set_bit(MLX5E_STATE_DESTROYING, &priv->state);
52875334 cancel_work_sync(&priv->update_stats_work);
52885335 return err;
@@ -5300,6 +5347,7 @@ void mlx5e_detach_netdev(struct mlx5e_priv *priv) · 11 unmodified lines
53005347
53015348 profile->cleanup_rx(priv);
53025349 profile->cleanup_tx(priv);
5350+ mlx5e_reset_channels(priv->netdev);
53035351 cancel_work_sync(&priv->update_stats_work);
53045352 }
53055353
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c+32−7
@@ -1322,10 +1322,10 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 1321 unmodified lines
13221322 struct netlink_ext_ack *extack)
13231323 {
13241324 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
1325− struct net_device *out_dev, *encap_dev = NULL;
13261325 struct mlx5e_tc_flow_parse_attr *parse_attr;
13271326 struct mlx5_flow_attr *attr = flow->attr;
13281327 bool vf_tun = false, encap_valid = true;
1328+ struct net_device *encap_dev = NULL;
13291329 struct mlx5_esw_flow_attr *esw_attr;
13301330 struct mlx5_fc *counter = NULL;
13311331 struct mlx5e_rep_priv *rpriv;
@@ -1371,16 +1371,22 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 39 unmodified lines
13711371 esw_attr = attr->esw_attr;
13721372
13731373 for (out_index = 0; out_index < MLX5_MAX_FLOW_FWD_VPORTS; out_index++) {
1374+ struct net_device *out_dev;
13741375 int mirred_ifindex;
13751376
13761377 if (!(esw_attr->dests[out_index].flags & MLX5_ESW_DEST_ENCAP))
13771378 continue;
13781379
13791380 mirred_ifindex = parse_attr->mirred_ifindex[out_index];
1380− out_dev = __dev_get_by_index(dev_net(priv->netdev),
1381− mirred_ifindex);
1381+ out_dev = dev_get_by_index(dev_net(priv->netdev), mirred_ifindex);
1382+ if (!out_dev) {
1383+ NL_SET_ERR_MSG_MOD(extack, "Requested mirred device not found");
1384+ err = -ENODEV;
1385+ goto err_out;
1386+ }
13821387 err = mlx5e_attach_encap(priv, flow, out_dev, out_index,
13831388 extack, &encap_dev, &encap_valid);
1389+ dev_put(out_dev);
13841390 if (err)
13851391 goto err_out;
13861392
@@ -1393,6 +1399,12 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, · 6 unmodified lines
13931399 esw_attr->dests[out_index].mdev = out_priv->mdev;
13941400 }
13951401
1402+ if (vf_tun && esw_attr->out_count > 1) {
1403+ NL_SET_ERR_MSG_MOD(extack, "VF tunnel encap with mirroring is not supported");
1404+ err = -EOPNOTSUPP;
1405+ goto err_out;
1406+ }
1407+
13961408 err = mlx5_eswitch_add_vlan_action(esw, attr);
13971409 if (err)
13981410 goto err_out;
@@ -2003,11 +2015,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 604 unmodified lines
20032015 misc_parameters_3);
20042016 struct flow_rule *rule = flow_cls_offload_flow_rule(f);
20052017 struct flow_dissector *dissector = rule->match.dissector;
2018+ enum fs_flow_table_type fs_type;
20062019 u16 addr_type = 0;
20072020 u8 ip_proto = 0;
20082021 u8 *match_level;
20092022 int err;
20102023
2024+ fs_type = mlx5e_is_eswitch_flow(flow) ? FS_FT_FDB : FS_FT_NIC_RX;
20112025 match_level = outer_match_level;
20122026
20132027 if (dissector->used_keys &
@@ -2133,6 +2147,13 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, · 119 unmodified lines
21332147 if (match.mask->vlan_id ||
21342148 match.mask->vlan_priority ||
21352149 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+
21362157 if (match.key->vlan_tpid == htons(ETH_P_8021AD)) {
21372158 MLX5_SET(fte_match_set_misc, misc_c,
21382159 outer_second_svlan_tag, 1);
@@ -3526,8 +3547,12 @@ static int add_vlan_push_action(struct mlx5e_priv *priv, · 1387 unmodified lines
35263547 if (err)
35273548 return err;
35283549
3529− *out_dev = dev_get_by_index_rcu(dev_net(vlan_dev),
3530− dev_get_iflink(vlan_dev));
3550+ rcu_read_lock();
3551+ *out_dev = dev_get_by_index_rcu(dev_net(vlan_dev), dev_get_iflink(vlan_dev));
3552+ rcu_read_unlock();
3553+ if (!*out_dev)
3554+ return -ENODEV;
3555+
35313556 if (is_vlan_dev(*out_dev))
35323557 err = add_vlan_push_action(priv, attr, out_dev, action);
35333558
@@ -4740,7 +4765,7 @@ static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv, · 1206 unmodified lines
47404765 list_for_each_entry_safe(hpe, tmp, &init_wait_list, dead_peer_wait_list) {
47414766 wait_for_completion(&hpe->res_ready);
47424767 if (!IS_ERR_OR_NULL(hpe->hp) && hpe->peer_vhca_id == peer_vhca_id)
4743− hpe->hp->pair->peer_gone = true;
4768+ mlx5_core_hairpin_clear_dead_peer(hpe->hp->pair);
47444769
47454770 mlx5e_hairpin_put(priv, hpe);
47464771 }
@@ -5074,7 +5099,7 @@ bool mlx5e_tc_update_skb(struct mlx5_cqe64 *cqe, · 327 unmodified lines
50745099
50755100 if (mapped_obj.type == MLX5_MAPPED_OBJ_CHAIN) {
50765101 chain = mapped_obj.chain;
5077− tc_skb_ext = skb_ext_add(skb, TC_SKB_EXT);
5102+ tc_skb_ext = tc_skb_ext_alloc(skb);
50785103 if (WARN_ON(!tc_skb_ext))
50795104 return false;
50805105
drivers/net/ethernet/mellanox/mlx5/core/en_tc.h+3−0
@@ -178,6 +178,9 @@ void mlx5e_take_all_encap_flows(struct mlx5e_encap_entry *e, struct list_head *f · 177 unmodified lines
178178 void mlx5e_put_flow_list(struct mlx5e_priv *priv, struct list_head *flow_list);
179179
180180 struct mlx5e_neigh_hash_entry;
181+struct mlx5e_encap_entry *
182+mlx5e_get_next_init_encap(struct mlx5e_neigh_hash_entry *nhe,
183+ struct mlx5e_encap_entry *e);
181184 void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe);
182185
183186 void mlx5e_tc_reoffload_flows_work(struct work_struct *work);
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c+3−22
@@ -32,7 +32,6 @@ · 31 unmodified lines
3232
3333 #include <linux/tcp.h>
3434 #include <linux/if_vlan.h>
35−#include <linux/ptp_classify.h>
3635 #include <net/geneve.h>
3736 #include <net/dsfield.h>
3837 #include "en.h"
@@ -67,24 +66,6 @@ static inline int mlx5e_get_dscp_up(struct mlx5e_priv *priv, struct sk_buff *skb · 28 unmodified lines
6766 }
6867 #endif
6968
70−static bool mlx5e_use_ptpsq(struct sk_buff *skb)
71−{
72− struct flow_keys fk;
73−
74− if (!skb_flow_dissect_flow_keys(skb, &fk, 0))
75− return false;
76−
77− if (fk.basic.n_proto == htons(ETH_P_1588))
78− return true;
79−
80− if (fk.basic.n_proto != htons(ETH_P_IP) &&
81− fk.basic.n_proto != htons(ETH_P_IPV6))
82− return false;
83−
84− return (fk.basic.ip_proto == IPPROTO_UDP &&
85− fk.ports.dst == htons(PTP_EV_PORT));
86−}
87−
8869 static u16 mlx5e_select_ptpsq(struct net_device *dev, struct sk_buff *skb)
8970 {
9071 struct mlx5e_priv *priv = netdev_priv(dev);
@@ -145,9 +126,9 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb, · 54 unmodified lines
145126 }
146127
147128 ptp_channel = READ_ONCE(priv->channels.ptp);
148− if (unlikely(ptp_channel) &&
149− test_bit(MLX5E_PTP_STATE_TX, ptp_channel->state) &&
150− mlx5e_use_ptpsq(skb))
129+ if (unlikely(ptp_channel &&
130+ test_bit(MLX5E_PTP_STATE_TX, ptp_channel->state) &&
131+ mlx5e_use_ptpsq(skb)))
151132 return mlx5e_select_ptpsq(dev, skb);
152133
153134 txq_ix = netdev_pick_tx(dev, skb, NULL);
drivers/net/ethernet/mellanox/mlx5/core/eq.c+4−2
@@ -136,7 +136,7 @@ static int mlx5_eq_comp_int(struct notifier_block *nb, · 135 unmodified lines
136136
137137 eqe = next_eqe_sw(eq);
138138 if (!eqe)
139− return 0;
139+ goto out;
140140
141141 do {
142142 struct mlx5_core_cq *cq;
@@ -161,6 +161,8 @@ static int mlx5_eq_comp_int(struct notifier_block *nb, · 18 unmodified lines
161161 ++eq->cons_index;
162162
163163 } while ((++num_eqes < MLX5_EQ_POLLING_BUDGET) && (eqe = next_eqe_sw(eq)));
164+
165+out:
164166 eq_update_ci(eq, 1);
165167
166168 if (cqn != -1)
@@ -248,9 +250,9 @@ static int mlx5_eq_async_int(struct notifier_block *nb, · 81 unmodified lines
248250 ++eq->cons_index;
249251
250252 } while ((++num_eqes < MLX5_EQ_POLLING_BUDGET) && (eqe = next_eqe_sw(eq)));
251− eq_update_ci(eq, 1);
252253
253254 out:
255+ eq_update_ci(eq, 1);
254256 mlx5_eq_async_int_unlock(eq_async, recovery, &flags);
255257
256258 return unlikely(recovery) ? num_eqes : 0;
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+7−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/mlx5/mlx5_ifc.h>
3636 #include <linux/mlx5/vport.h>
3737 #include <linux/mlx5/fs.h>
38+#include <linux/mlx5/mpfs.h>
3839 #include "esw/acl/lgcy.h"
3940 #include "esw/legacy.h"
4041 #include "mlx5_core.h"
@@ -1053,6 +1054,12 @@ int mlx5_esw_vport_enable(struct mlx5_eswitch *esw, u16 vport_num, · 1012 unmodified lines
10531054 goto err_vhca_mapping;
10541055 }
10551056
1057+ /* External controller host PF has factory programmed MAC.
1058+ * Read it from the device.
1059+ */
1060+ if (mlx5_core_is_ecpf(esw->dev) && vport_num == MLX5_VPORT_PF)
1061+ mlx5_query_nic_vport_mac_address(esw->dev, vport_num, true, vport->info.mac);
1062+
10561063 esw_vport_change_handle_locked(vport);
10571064
10581065 esw->enabled_vports++;
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/eswitch_offloads_termtbl.c+26−35
@@ -65,7 +65,7 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev, · 64 unmodified lines
6565 {
6666 struct mlx5_flow_table_attr ft_attr = {};
6767 struct mlx5_flow_namespace *root_ns;
68− int err;
68+ int err, err2;
6969
7070 root_ns = mlx5_get_flow_namespace(dev, MLX5_FLOW_NAMESPACE_FDB);
7171 if (!root_ns) {
@@ -76,33 +76,34 @@ mlx5_eswitch_termtbl_create(struct mlx5_core_dev *dev, · 4 unmodified lines
7676 /* As this is the terminating action then the termination table is the
7777 * same prio as the slow path
7878 */
79− ft_attr.flags = MLX5_FLOW_TABLE_TERMINATION |
79+ ft_attr.flags = MLX5_FLOW_TABLE_TERMINATION | MLX5_FLOW_TABLE_UNMANAGED |
8080 MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT;
81− ft_attr.prio = FDB_SLOW_PATH;
81+ ft_attr.prio = FDB_TC_OFFLOAD;
8282 ft_attr.max_fte = 1;
83+ ft_attr.level = 1;
8384 ft_attr.autogroup.max_num_groups = 1;
8485 tt->termtbl = mlx5_create_auto_grouped_flow_table(root_ns, &ft_attr);
8586 if (IS_ERR(tt->termtbl)) {
86− esw_warn(dev, "Failed to create termination table (error %d)\n",
87− IS_ERR(tt->termtbl));
88− return -EOPNOTSUPP;
87+ err = PTR_ERR(tt->termtbl);
88+ esw_warn(dev, "Failed to create termination table, err %pe\n", tt->termtbl);
89+ return err;
8990 }
9091
9192 tt->rule = mlx5_add_flow_rules(tt->termtbl, NULL, flow_act,
9293 &tt->dest, 1);
9394 if (IS_ERR(tt->rule)) {
94− esw_warn(dev, "Failed to create termination table rule (error %d)\n",
95− IS_ERR(tt->rule));
95+ err = PTR_ERR(tt->rule);
96+ esw_warn(dev, "Failed to create termination table rule, err %pe\n", tt->rule);
9697 goto add_flow_err;
9798 }
9899 return 0;
99100
100101 add_flow_err:
101− err = mlx5_destroy_flow_table(tt->termtbl);
102− if (err)
103− esw_warn(dev, "Failed to destroy termination table\n");
102+ err2 = mlx5_destroy_flow_table(tt->termtbl);
103+ if (err2)
104+ esw_warn(dev, "Failed to destroy termination table, err %d\n", err2);
104105
105− return -EOPNOTSUPP;
106+ return err;
106107 }
107108
108109 static struct mlx5_termtbl_handle *
@@ -172,19 +173,6 @@ mlx5_eswitch_termtbl_put(struct mlx5_eswitch *esw, · 63 unmodified lines
172173 }
173174 }
174175
175−static bool mlx5_eswitch_termtbl_is_encap_reformat(struct mlx5_pkt_reformat *rt)
176−{
177− switch (rt->reformat_type) {
178− case MLX5_REFORMAT_TYPE_L2_TO_VXLAN:
179− case MLX5_REFORMAT_TYPE_L2_TO_NVGRE:
180− case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL:
181− case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL:
182− return true;
183− default:
184− return false;
185− }
186−}
187−
188176 static void
189177 mlx5_eswitch_termtbl_actions_move(struct mlx5_flow_act *src,
190178 struct mlx5_flow_act *dst)
@@ -202,14 +190,6 @@ mlx5_eswitch_termtbl_actions_move(struct mlx5_flow_act *src, · 11 unmodified lines
202190 memset(&src->vlan[1], 0, sizeof(src->vlan[1]));
203191 }
204192 }
205−
206− if (src->action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT &&
207− mlx5_eswitch_termtbl_is_encap_reformat(src->pkt_reformat)) {
208− src->action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
209− dst->action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
210− dst->pkt_reformat = src->pkt_reformat;
211− src->pkt_reformat = NULL;
212− }
213193 }
214194
215195 static bool mlx5_eswitch_offload_is_uplink_port(const struct mlx5_eswitch *esw,
@@ -238,6 +218,7 @@ mlx5_eswitch_termtbl_required(struct mlx5_eswitch *esw, · 22 unmodified lines
238218 int i;
239219
240220 if (!MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, termination_table) ||
221+ !MLX5_CAP_ESW_FLOWTABLE_FDB(esw->dev, ignore_flow_level) ||
241222 attr->flags & MLX5_ESW_ATTR_FLAG_SLOW_PATH ||
242223 !mlx5_eswitch_offload_is_uplink_port(esw, spec))
243224 return false;
@@ -279,12 +260,19 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw, · 35 unmodified lines
279260 if (dest[i].type != MLX5_FLOW_DESTINATION_TYPE_VPORT)
280261 continue;
281262
263+ if (attr->dests[num_vport_dests].flags & MLX5_ESW_DEST_ENCAP) {
264+ term_tbl_act.action |= MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
265+ term_tbl_act.pkt_reformat = attr->dests[num_vport_dests].pkt_reformat;
266+ } else {
267+ term_tbl_act.action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
268+ term_tbl_act.pkt_reformat = NULL;
269+ }
270+
282271 /* get the terminating table for the action list */
283272 tt = mlx5_eswitch_termtbl_get_create(esw, &term_tbl_act,
284273 &dest[i], attr);
285274 if (IS_ERR(tt)) {
286− esw_warn(esw->dev, "Failed to get termination table (error %d)\n",
287− IS_ERR(tt));
275+ esw_warn(esw->dev, "Failed to get termination table, err %pe\n", tt);
288276 goto revert_changes;
289277 }
290278 attr->dests[num_vport_dests].termtbl = tt;
@@ -301,6 +289,9 @@ mlx5_eswitch_add_termtbl_rule(struct mlx5_eswitch *esw, · 10 unmodified lines
301289 goto revert_changes;
302290
303291 /* create the FTE */
292+ flow_act->action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT;
293+ flow_act->pkt_reformat = NULL;
294+ flow_act->flags |= FLOW_ACT_IGNORE_FLOW_LEVEL;
304295 rule = mlx5_add_flow_rules(fdb, spec, flow_act, dest, num_dest);
305296 if (IS_ERR(rule))
306297 goto revert_changes;
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/lag_mp.c+6−0
@@ -307,6 +307,11 @@ int mlx5_lag_mp_init(struct mlx5_lag *ldev) · 306 unmodified lines
307307 struct lag_mp *mp = &ldev->lag_mp;
308308 int err;
309309
310+ /* always clear mfi, as it might become stale when a route delete event
311+ * has been missed
312+ */
313+ mp->mfi = NULL;
314+
310315 if (mp->fib_nb.notifier_call)
311316 return 0;
312317
@@ -335,4 +340,5 @@ void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev) · 22 unmodified lines
335340 unregister_fib_notifier(&init_net, &mp->fib_nb);
336341 destroy_workqueue(mp->wq);
337342 mp->fib_nb.notifier_call = NULL;
343+ mp->mfi = NULL;
338344 }
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/lib/mpfs.c+3−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <linux/etherdevice.h>
3434 #include <linux/mlx5/driver.h>
3535 #include <linux/mlx5/mlx5_ifc.h>
36+#include <linux/mlx5/mpfs.h>
3637 #include <linux/mlx5/eswitch.h>
3738 #include "mlx5_core.h"
3839 #include "lib/mpfs.h"
@@ -175,6 +176,7 @@ out: · 136 unmodified lines
175176 mutex_unlock(&mpfs->lock);
176177 return err;
177178 }
179+EXPORT_SYMBOL(mlx5_mpfs_add_mac);
178180
179181 int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac)
180182 {
@@ -206,3 +208,4 @@ unlock: · 25 unmodified lines
206208 mutex_unlock(&mpfs->lock);
207209 return err;
208210 }
211+EXPORT_SYMBOL(mlx5_mpfs_del_mac);
drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.h+1−4
@@ -84,12 +84,9 @@ struct l2addr_node { · 83 unmodified lines
8484 #ifdef CONFIG_MLX5_MPFS
8585 int mlx5_mpfs_init(struct mlx5_core_dev *dev);
8686 void mlx5_mpfs_cleanup(struct mlx5_core_dev *dev);
87−int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac);
88−int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac);
8987 #else /* #ifndef CONFIG_MLX5_MPFS */
9088 static inline int mlx5_mpfs_init(struct mlx5_core_dev *dev) { return 0; }
9189 static inline void mlx5_mpfs_cleanup(struct mlx5_core_dev *dev) {}
92−static inline int mlx5_mpfs_add_mac(struct mlx5_core_dev *dev, u8 *mac) { return 0; }
93−static inline int mlx5_mpfs_del_mac(struct mlx5_core_dev *dev, u8 *mac) { return 0; }
9490 #endif
91+
9592 #endif
drivers/net/ethernet/mellanox/mlx5/core/main.c+7−7
@@ -503,7 +503,7 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev, void *set_ctx) · 502 unmodified lines
503503
504504 static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)
505505 {
506− struct mlx5_profile *prof = dev->profile;
506+ struct mlx5_profile *prof = &dev->profile;
507507 void *set_hca_cap;
508508 int err;
509509
@@ -524,11 +524,11 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx) · 14 unmodified lines
524524 to_fw_pkey_sz(dev, 128));
525525
526526 /* Check log_max_qp from HCA caps to set in current profile */
527− if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < profile[prof_sel].log_max_qp) {
527+ if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) {
528528 mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n",
529− profile[prof_sel].log_max_qp,
529+ prof->log_max_qp,
530530 MLX5_CAP_GEN_MAX(dev, log_max_qp));
531− profile[prof_sel].log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
531+ prof->log_max_qp = MLX5_CAP_GEN_MAX(dev, log_max_qp);
532532 }
533533 if (prof->mask & MLX5_PROF_MASK_QP_SIZE)
534534 MLX5_SET(cmd_hca_cap, set_hca_cap, log_max_qp,
@@ -1161,7 +1161,7 @@ static int mlx5_load(struct mlx5_core_dev *dev) · 626 unmodified lines
11611161 err = mlx5_core_set_hca_defaults(dev);
11621162 if (err) {
11631163 mlx5_core_err(dev, "Failed to set hca defaults\n");
1164− goto err_sriov;
1164+ goto err_set_hca;
11651165 }
11661166
11671167 mlx5_vhca_event_start(dev);
@@ -1194,6 +1194,7 @@ err_ec: · 26 unmodified lines
11941194 mlx5_sf_hw_table_destroy(dev);
11951195 err_vhca:
11961196 mlx5_vhca_event_stop(dev);
1197+err_set_hca:
11971198 mlx5_cleanup_fs(dev);
11981199 err_fs:
11991200 mlx5_accel_tls_cleanup(dev);
@@ -1381,8 +1382,7 @@ int mlx5_mdev_init(struct mlx5_core_dev *dev, int profile_idx) · 181 unmodified lines
13811382 struct mlx5_priv *priv = &dev->priv;
13821383 int err;
13831384
1384− dev->profile = &profile[profile_idx];
1385−
1385+ memcpy(&dev->profile, &profile[profile_idx], sizeof(dev->profile));
13861386 INIT_LIST_HEAD(&priv->ctx_list);
13871387 spin_lock_init(&priv->ctx_lock);
13881388 mutex_init(&dev->intf_state_mutex);
drivers/net/ethernet/mellanox/mlx5/core/mr.c+1−1
@@ -54,7 +54,7 @@ int mlx5_core_create_mkey(struct mlx5_core_dev *dev, · 53 unmodified lines
5454 mkey_index = MLX5_GET(create_mkey_out, lout, mkey_index);
5555 mkey->iova = MLX5_GET64(mkc, mkc, start_addr);
5656 mkey->size = MLX5_GET64(mkc, mkc, len);
57− mkey->key |= mlx5_idx_to_mkey(mkey_index);
57+ mkey->key = (u32)mlx5_mkey_variant(mkey->key) | mlx5_idx_to_mkey(mkey_index);
5858 mkey->pd = MLX5_GET(mkc, mkc, pd);
5959 init_waitqueue_head(&mkey->wait);
6060
drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c+17−5
@@ -95,9 +95,10 @@ int mlx5_get_default_msix_vec_count(struct mlx5_core_dev *dev, int num_vfs) · 94 unmodified lines
9595 int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id,
9696 int msix_vec_count)
9797 {
98− int sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
98+ int query_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out);
99+ int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
100+ void *hca_cap = NULL, *query_cap = NULL, *cap;
99101 int num_vf_msix, min_msix, max_msix;
100− void *hca_cap, *cap;
101102 int ret;
102103
103104 num_vf_msix = MLX5_CAP_GEN_MAX(dev, num_total_dynamic_vf_msix);
@@ -116,11 +117,20 @@ int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id, · 12 unmodified lines
116117 if (msix_vec_count > max_msix)
117118 return -EOVERFLOW;
118119
119− hca_cap = kzalloc(sz, GFP_KERNEL);
120− if (!hca_cap)
121− return -ENOMEM;
120+ query_cap = kzalloc(query_sz, GFP_KERNEL);
121+ hca_cap = kzalloc(set_sz, GFP_KERNEL);
122+ if (!hca_cap || !query_cap) {
123+ ret = -ENOMEM;
124+ goto out;
125+ }
126+
127+ ret = mlx5_vport_get_other_func_cap(dev, function_id, query_cap);
128+ if (ret)
129+ goto out;
122130
123131 cap = MLX5_ADDR_OF(set_hca_cap_in, hca_cap, capability);
132+ memcpy(cap, MLX5_ADDR_OF(query_hca_cap_out, query_cap, capability),
133+ MLX5_UN_SZ_BYTES(hca_cap_union));
124134 MLX5_SET(cmd_hca_cap, cap, dynamic_msix_table_size, msix_vec_count);
125135
126136 MLX5_SET(set_hca_cap_in, hca_cap, opcode, MLX5_CMD_OP_SET_HCA_CAP);
@@ -130,7 +140,9 @@ int mlx5_set_msix_vec_count(struct mlx5_core_dev *dev, int function_id, · 3 unmodified lines
130140 MLX5_SET(set_hca_cap_in, hca_cap, op_mod,
131141 MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE << 1);
132142 ret = mlx5_cmd_exec_in(dev, set_hca_cap, hca_cap);
143+out:
133144 kfree(hca_cap);
145+ kfree(query_cap);
134146 return ret;
135147 }
136148
drivers/net/ethernet/mellanox/mlx5/core/rdma.c+3−0
@@ -156,6 +156,9 @@ void mlx5_rdma_enable_roce(struct mlx5_core_dev *dev) · 155 unmodified lines
156156 {
157157 int err;
158158
159+ if (!MLX5_CAP_GEN(dev, roce))
160+ return;
161+
159162 err = mlx5_nic_vport_enable_roce(dev);
160163 if (err) {
161164 mlx5_core_err(dev, "Failed to enable RoCE: %d\n", err);
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c+1−0
@@ -163,6 +163,7 @@ mlx5_sf_dev_state_change_handler(struct notifier_block *nb, unsigned long event_ · 162 unmodified lines
163163 sf_index = event->function_id - base_id;
164164 sf_dev = xa_load(&table->devices, sf_index);
165165 switch (event->new_vhca_state) {
166+ case MLX5_VHCA_STATE_INVALID:
166167 case MLX5_VHCA_STATE_ALLOCATED:
167168 if (sf_dev)
168169 mlx5_sf_dev_del(table->dev, sf_dev, sf_index);
drivers/net/ethernet/mellanox/mlx5/core/sf/devlink.c+11−7
@@ -136,10 +136,10 @@ static enum devlink_port_fn_state mlx5_sf_to_devlink_state(u8 hw_state) · 135 unmodified lines
136136 switch (hw_state) {
137137 case MLX5_VHCA_STATE_ACTIVE:
138138 case MLX5_VHCA_STATE_IN_USE:
139− case MLX5_VHCA_STATE_TEARDOWN_REQUEST:
140139 return DEVLINK_PORT_FN_STATE_ACTIVE;
141140 case MLX5_VHCA_STATE_INVALID:
142141 case MLX5_VHCA_STATE_ALLOCATED:
142+ case MLX5_VHCA_STATE_TEARDOWN_REQUEST:
143143 default:
144144 return DEVLINK_PORT_FN_STATE_INACTIVE;
145145 }
@@ -192,14 +192,17 @@ sf_err: · 46 unmodified lines
192192 return err;
193193 }
194194
195−static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf)
195+static int mlx5_sf_activate(struct mlx5_core_dev *dev, struct mlx5_sf *sf,
196+ struct netlink_ext_ack *extack)
196197 {
197198 int err;
198199
199200 if (mlx5_sf_is_active(sf))
200201 return 0;
201− if (sf->hw_state != MLX5_VHCA_STATE_ALLOCATED)
202− return -EINVAL;
202+ if (sf->hw_state != MLX5_VHCA_STATE_ALLOCATED) {
203+ NL_SET_ERR_MSG_MOD(extack, "SF is inactivated but it is still attached");
204+ return -EBUSY;
205+ }
203206
204207 err = mlx5_cmd_sf_enable_hca(dev, sf->hw_fn_id);
205208 if (err)
@@ -226,7 +229,8 @@ static int mlx5_sf_deactivate(struct mlx5_core_dev *dev, struct mlx5_sf *sf) · 20 unmodified lines
226229
227230 static int mlx5_sf_state_set(struct mlx5_core_dev *dev, struct mlx5_sf_table *table,
228231 struct mlx5_sf *sf,
229− enum devlink_port_fn_state state)
232+ enum devlink_port_fn_state state,
233+ struct netlink_ext_ack *extack)
230234 {
231235 int err = 0;
232236
@@ -234,7 +238,7 @@ static int mlx5_sf_state_set(struct mlx5_core_dev *dev, struct mlx5_sf_table *ta · 1 unmodified line
234238 if (state == mlx5_sf_to_devlink_state(sf->hw_state))
235239 goto out;
236240 if (state == DEVLINK_PORT_FN_STATE_ACTIVE)
237− err = mlx5_sf_activate(dev, sf);
241+ err = mlx5_sf_activate(dev, sf, extack);
238242 else if (state == DEVLINK_PORT_FN_STATE_INACTIVE)
239243 err = mlx5_sf_deactivate(dev, sf);
240244 else
@@ -265,7 +269,7 @@ int mlx5_devlink_sf_port_fn_state_set(struct devlink *devlink, struct devlink_po · 24 unmodified lines
265269 goto out;
266270 }
267271
268− err = mlx5_sf_state_set(dev, table, sf, state);
272+ err = mlx5_sf_state_set(dev, table, sf, state, extack);
269273 out:
270274 mlx5_sf_table_put(table);
271275 return err;
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/mellanox/mlx5/core/steering/dr_ste_v1.c+16−10
@@ -694,7 +694,11 @@ static int dr_ste_v1_set_action_decap_l3_list(void *data, · 693 unmodified lines
694694 if (hw_action_sz / DR_STE_ACTION_DOUBLE_SZ < DR_STE_DECAP_L3_ACTION_NUM)
695695 return -EINVAL;
696696
697− memcpy(padded_data, data, data_sz);
697+ inline_data_sz =
698+ MLX5_FLD_SZ_BYTES(ste_double_action_insert_with_inline_v1, inline_data);
699+
700+ /* Add an alignment padding */
701+ memcpy(padded_data + data_sz % inline_data_sz, data, data_sz);
698702
699703 /* Remove L2L3 outer headers */
700704 MLX5_SET(ste_single_action_remove_header_v1, hw_action, action_id,
@@ -706,32 +710,34 @@ static int dr_ste_v1_set_action_decap_l3_list(void *data, · 5 unmodified lines
706710 hw_action += DR_STE_ACTION_DOUBLE_SZ;
707711 used_actions++; /* Remove and NOP are a single double action */
708712
709− inline_data_sz =
710− MLX5_FLD_SZ_BYTES(ste_double_action_insert_with_inline_v1, inline_data);
713+ /* Point to the last dword of the header */
714+ data_ptr += (data_sz / inline_data_sz) * inline_data_sz;
711715
712− /* Add the new header inline + 2 extra bytes */
716+ /* Add the new header using inline action 4Byte at a time, the header
717+ * is added in reversed order to the beginning of the packet to avoid
718+ * incorrect parsing by the HW. Since header is 14B or 18B an extra
719+ * two bytes are padded and later removed.
720+ */
713721 for (i = 0; i < data_sz / inline_data_sz + 1; i++) {
714722 void *addr_inline;
715723
716724 MLX5_SET(ste_double_action_insert_with_inline_v1, hw_action, action_id,
717725 DR_STE_V1_ACTION_ID_INSERT_INLINE);
718726 /* The hardware expects here offset to words (2 bytes) */
719− MLX5_SET(ste_double_action_insert_with_inline_v1, hw_action, start_offset,
720− i * 2);
727+ MLX5_SET(ste_double_action_insert_with_inline_v1, hw_action, start_offset, 0);
721728
722729 /* Copy bytes one by one to avoid endianness problem */
723730 addr_inline = MLX5_ADDR_OF(ste_double_action_insert_with_inline_v1,
724731 hw_action, inline_data);
725− memcpy(addr_inline, data_ptr, inline_data_sz);
732+ memcpy(addr_inline, data_ptr - i * inline_data_sz, inline_data_sz);
726733 hw_action += DR_STE_ACTION_DOUBLE_SZ;
727− data_ptr += inline_data_sz;
728734 used_actions++;
729735 }
730736
731− /* Remove 2 extra bytes */
737+ /* Remove first 2 extra bytes */
732738 MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, action_id,
733739 DR_STE_V1_ACTION_ID_REMOVE_BY_SIZE);
734− MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, start_offset, data_sz / 2);
740+ MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, start_offset, 0);
735741 /* The hardware expects here size in words (2 bytes) */
736742 MLX5_SET(ste_single_action_remove_header_size_v1, hw_action, remove_size, 1);
737743 used_actions++;
drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h+5−4
@@ -124,10 +124,11 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action); · 123 unmodified lines
124124 static inline bool
125125 mlx5dr_is_supported(struct mlx5_core_dev *dev)
126126 {
127− return MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner) ||
128− (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner_v2) &&
129− (MLX5_CAP_GEN(dev, steering_format_version) <=
130− MLX5_STEERING_FORMAT_CONNECTX_6DX));
127+ return MLX5_CAP_GEN(dev, roce) &&
128+ (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner) ||
129+ (MLX5_CAP_ESW_FLOWTABLE_FDB(dev, sw_owner_v2) &&
130+ (MLX5_CAP_GEN(dev, steering_format_version) <=
131+ MLX5_STEERING_FORMAT_CONNECTX_6DX)));
131132 }
132133
133134 /* buddy functions & structure */
drivers/net/ethernet/mellanox/mlx5/core/transobj.c+24−6
@@ -424,6 +424,15 @@ err_modify_sq: · 423 unmodified lines
424424 return err;
425425 }
426426
427+static void mlx5_hairpin_unpair_peer_sq(struct mlx5_hairpin *hp)
428+{
429+ int i;
430+
431+ for (i = 0; i < hp->num_channels; i++)
432+ mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY,
433+ MLX5_SQC_STATE_RST, 0, 0);
434+}
435+
427436 static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp)
428437 {
429438 int i;
@@ -432,13 +441,9 @@ static void mlx5_hairpin_unpair_queues(struct mlx5_hairpin *hp) · 2 unmodified lines
432441 for (i = 0; i < hp->num_channels; i++)
433442 mlx5_hairpin_modify_rq(hp->func_mdev, hp->rqn[i], MLX5_RQC_STATE_RDY,
434443 MLX5_RQC_STATE_RST, 0, 0);
435−
436444 /* unset peer SQs */
437− if (hp->peer_gone)
438− return;
439− for (i = 0; i < hp->num_channels; i++)
440− mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY,
441− MLX5_SQC_STATE_RST, 0, 0);
445+ if (!hp->peer_gone)
446+ mlx5_hairpin_unpair_peer_sq(hp);
442447 }
443448
444449 struct mlx5_hairpin *
@@ -485,3 +490,16 @@ void mlx5_core_hairpin_destroy(struct mlx5_hairpin *hp) · 40 unmodified lines
485490 mlx5_hairpin_destroy_queues(hp);
486491 kfree(hp);
487492 }
493+
494+void mlx5_core_hairpin_clear_dead_peer(struct mlx5_hairpin *hp)
495+{
496+ int i;
497+
498+ mlx5_hairpin_unpair_peer_sq(hp);
499+
500+ /* destroy peer SQ */
501+ for (i = 0; i < hp->num_channels; i++)
502+ mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]);
503+
504+ hp->peer_gone = true;
505+}
drivers/net/ethernet/mellanox/mlx5/core/vport.c+0−2
@@ -465,8 +465,6 @@ int mlx5_modify_nic_vport_node_guid(struct mlx5_core_dev *mdev, · 464 unmodified lines
465465 void *in;
466466 int err;
467467
468− if (!vport)
469− return -EINVAL;
470468 if (!MLX5_CAP_GEN(mdev, vport_group_manager))
471469 return -EACCES;
472470
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c+4−2
@@ -693,7 +693,8 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz) · 692 unmodified lines
693693 MLXSW_THERMAL_TRIP_MASK,
694694 module_tz,
695695 &mlxsw_thermal_module_ops,
696− NULL, 0, 0);
696+ NULL, 0,
697+ module_tz->parent->polling_delay);
697698 if (IS_ERR(module_tz->tzdev)) {
698699 err = PTR_ERR(module_tz->tzdev);
699700 return err;
@@ -815,7 +816,8 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz) · 115 unmodified lines
815816 MLXSW_THERMAL_TRIP_MASK,
816817 gearbox_tz,
817818 &mlxsw_thermal_gearbox_ops,
818− NULL, 0, 0);
819+ NULL, 0,
820+ gearbox_tz->parent->polling_delay);
819821 if (IS_ERR(gearbox_tz->tzdev))
820822 return PTR_ERR(gearbox_tz->tzdev);
821823
drivers/net/ethernet/mellanox/mlxsw/reg.h+1−1
@@ -3907,7 +3907,7 @@ MLXSW_ITEM32(reg, qeec, max_shaper_bs, 0x1C, 0, 6); · 3906 unmodified lines
39073907 #define MLXSW_REG_QEEC_HIGHEST_SHAPER_BS 25
39083908 #define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP1 5
39093909 #define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP2 11
3910−#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3 5
3910+#define MLXSW_REG_QEEC_LOWEST_SHAPER_BS_SP3 11
39113911
39123912 static inline void mlxsw_reg_qeec_pack(char *payload, u8 local_port,
39133913 enum mlxsw_reg_qeec_hr hr, u8 index,
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c+4−1
@@ -1332,6 +1332,7 @@ __mlxsw_sp_qdisc_ets_graft(struct mlxsw_sp_port *mlxsw_sp_port, · 1331 unmodified lines
13321332 u8 band, u32 child_handle)
13331333 {
13341334 struct mlxsw_sp_qdisc *old_qdisc;
1335+ u32 parent;
13351336
13361337 if (band < mlxsw_sp_qdisc->num_classes &&
13371338 mlxsw_sp_qdisc->qdiscs[band].handle == child_handle)
@@ -1352,7 +1353,9 @@ __mlxsw_sp_qdisc_ets_graft(struct mlxsw_sp_port *mlxsw_sp_port, · 14 unmodified lines
13521353 if (old_qdisc)
13531354 mlxsw_sp_qdisc_destroy(mlxsw_sp_port, old_qdisc);
13541355
1355− mlxsw_sp_qdisc = mlxsw_sp_qdisc->ops->find_class(mlxsw_sp_qdisc, band);
1356+ parent = TC_H_MAKE(mlxsw_sp_qdisc->handle, band + 1);
1357+ mlxsw_sp_qdisc = mlxsw_sp_qdisc->ops->find_class(mlxsw_sp_qdisc,
1358+ parent);
13561359 if (!WARN_ON(!mlxsw_sp_qdisc))
13571360 mlxsw_sp_qdisc_destroy(mlxsw_sp_port, mlxsw_sp_qdisc);
13581361
drivers/net/ethernet/microchip/encx24j600.c+1−1
@@ -1,5 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0-or-later
2−/**
2+/*
33 * Microchip ENCX24J600 ethernet driver
44 *
55 * Copyright (C) 2015 Gridpoint
drivers/net/ethernet/microchip/encx24j600_hw.h+1−1
@@ -1,5 +1,5 @@
11 /* SPDX-License-Identifier: GPL-2.0 */
2−/**
2+/*
33 * encx24j600_hw.h: Register definitions
44 *
55 */
drivers/net/ethernet/mscc/ocelot.c+5−0
@@ -379,6 +379,7 @@ static u32 ocelot_read_eq_avail(struct ocelot *ocelot, int port) · 378 unmodified lines
379379
380380 int ocelot_port_flush(struct ocelot *ocelot, int port)
381381 {
382+ unsigned int pause_ena;
382383 int err, val;
383384
384385 /* Disable dequeuing from the egress queues */
@@ -387,6 +388,7 @@ int ocelot_port_flush(struct ocelot *ocelot, int port) · 2 unmodified lines
387388 QSYS_PORT_MODE, port);
388389
389390 /* Disable flow control */
391+ ocelot_fields_read(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, &pause_ena);
390392 ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, 0);
391393
392394 /* Disable priority flow control */
@@ -422,6 +424,9 @@ int ocelot_port_flush(struct ocelot *ocelot, int port) · 29 unmodified lines
422424 /* Clear flushing again. */
423425 ocelot_rmw_gix(ocelot, 0, REW_PORT_CFG_FLUSH_ENA, REW_PORT_CFG, port);
424426
427+ /* Re-enable flow control */
428+ ocelot_fields_write(ocelot, port, SYS_PAUSE_CFG_PAUSE_ENA, pause_ena);
429+
425430 return err;
426431 }
427432 EXPORT_SYMBOL(ocelot_port_flush);
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/pensando/Kconfig+1−0
@@ -20,6 +20,7 @@ if NET_VENDOR_PENSANDO · 19 unmodified lines
2020 config IONIC
2121 tristate "Pensando Ethernet IONIC Support"
2222 depends on 64BIT && PCI
23+ depends on PTP_1588_CLOCK || !PTP_1588_CLOCK
2324 select NET_DEVLINK
2425 select DIMLIB
2526 help
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c+2−0
@@ -1602,6 +1602,8 @@ err_out_free_netdev: · 1601 unmodified lines
16021602 free_netdev(netdev);
16031603
16041604 err_out_free_res:
1605+ if (NX_IS_REVISION_P3(pdev->revision))
1606+ pci_disable_pcie_error_reporting(pdev);
16051607 pci_release_regions(pdev);
16061608
16071609 err_out_disable_pdev:
drivers/net/ethernet/qlogic/qed/qed_dcbx.c+3−1
@@ -1266,9 +1266,11 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn, · 1265 unmodified lines
12661266 p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_STATIC;
12671267
12681268 p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled;
1269+ BUILD_BUG_ON(sizeof(dcbx_info->operational.params) !=
1270+ sizeof(p_hwfn->p_dcbx_info->set.config.params));
12691271 memcpy(&p_hwfn->p_dcbx_info->set.config.params,
12701272 &dcbx_info->operational.params,
1271− sizeof(struct qed_dcbx_admin_params));
1273+ sizeof(p_hwfn->p_dcbx_info->set.config.params));
12721274 p_hwfn->p_dcbx_info->set.config.valid = true;
12731275
12741276 memcpy(params, &p_hwfn->p_dcbx_info->set, sizeof(struct qed_dcbx_set));
drivers/net/ethernet/qlogic/qla3xxx.c+1−1
@@ -114,7 +114,7 @@ static int ql_sem_spinlock(struct ql3_adapter *qdev, · 113 unmodified lines
114114 value = readl(&port_regs->CommonRegs.semaphoreReg);
115115 if ((value & (sem_mask >> 16)) == sem_bits)
116116 return 0;
117− ssleep(1);
117+ mdelay(1000);
118118 } while (--seconds);
119119 return -1;
120120 }
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c+1−0
@@ -2690,6 +2690,7 @@ err_out_free_hw_res: · 2689 unmodified lines
26902690 kfree(ahw);
26912691
26922692 err_out_free_res:
2693+ pci_disable_pcie_error_reporting(pdev);
26932694 pci_release_regions(pdev);
26942695
26952696 err_out_disable_pdev:
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c+9−9
@@ -126,24 +126,24 @@ static void rmnet_get_stats64(struct net_device *dev, · 125 unmodified lines
126126 struct rtnl_link_stats64 *s)
127127 {
128128 struct rmnet_priv *priv = netdev_priv(dev);
129− struct rmnet_vnd_stats total_stats;
129+ struct rmnet_vnd_stats total_stats = { };
130130 struct rmnet_pcpu_stats *pcpu_ptr;
131+ struct rmnet_vnd_stats snapshot;
131132 unsigned int cpu, start;
132133
133− memset(&total_stats, 0, sizeof(struct rmnet_vnd_stats));
134−
135134 for_each_possible_cpu(cpu) {
136135 pcpu_ptr = per_cpu_ptr(priv->pcpu_stats, cpu);
137136
138137 do {
139138 start = u64_stats_fetch_begin_irq(&pcpu_ptr->syncp);
140− total_stats.rx_pkts += pcpu_ptr->stats.rx_pkts;
141− total_stats.rx_bytes += pcpu_ptr->stats.rx_bytes;
142− total_stats.tx_pkts += pcpu_ptr->stats.tx_pkts;
143− total_stats.tx_bytes += pcpu_ptr->stats.tx_bytes;
139+ snapshot = pcpu_ptr->stats; /* struct assignment */
144140 } while (u64_stats_fetch_retry_irq(&pcpu_ptr->syncp, start));
145141
146− total_stats.tx_drops += pcpu_ptr->stats.tx_drops;
142+ total_stats.rx_pkts += snapshot.rx_pkts;
143+ total_stats.rx_bytes += snapshot.rx_bytes;
144+ total_stats.tx_pkts += snapshot.tx_pkts;
145+ total_stats.tx_bytes += snapshot.tx_bytes;
146+ total_stats.tx_drops += snapshot.tx_drops;
147147 }
148148
149149 s->rx_packets = total_stats.rx_pkts;
@@ -354,4 +354,4 @@ int rmnet_vnd_update_dev_mtu(struct rmnet_port *port, · 204 unmodified lines
354354 }
355355
356356 return 0;
357−}
357+}
drivers/net/ethernet/realtek/r8169_main.c+1−1
@@ -1671,7 +1671,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data) · 1670 unmodified lines
16711671 {
16721672 switch(stringset) {
16731673 case ETH_SS_STATS:
1674− memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings));
1674+ memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings));
16751675 break;
16761676 }
16771677 }
drivers/net/ethernet/renesas/sh_eth.c+1−1
@@ -2287,7 +2287,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data) · 2286 unmodified lines
22872287 {
22882288 switch (stringset) {
22892289 case ETH_SS_STATS:
2290− memcpy(data, *sh_eth_gstrings_stats,
2290+ memcpy(data, sh_eth_gstrings_stats,
22912291 sizeof(sh_eth_gstrings_stats));
22922292 break;
22932293 }
drivers/net/ethernet/sfc/nic.c+1−0
@@ -90,6 +90,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx) · 89 unmodified lines
9090 efx->pci_dev->irq);
9191 goto fail1;
9292 }
93+ efx->irqs_hooked = true;
9394 return 0;
9495 }
9596
drivers/net/ethernet/stmicro/stmmac/dwmac1000.h+4−4
@@ -76,10 +76,10 @@ enum power_event { · 75 unmodified lines
7676 #define LPI_CTRL_STATUS_TLPIEN 0x00000001 /* Transmit LPI Entry */
7777
7878 /* GMAC HW ADDR regs */
79−#define GMAC_ADDR_HIGH(reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \
80− (reg * 8))
81−#define GMAC_ADDR_LOW(reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \
82− (reg * 8))
79+#define GMAC_ADDR_HIGH(reg) ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \
80+ 0x00000040 + (reg * 8))
81+#define GMAC_ADDR_LOW(reg) ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \
82+ 0x00000044 + (reg * 8))
8383 #define GMAC_MAX_PERFECT_ADDRESSES 1
8484
8585 #define GMAC_PCS_BASE 0x000000c0 /* PCS register base */
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+25−13
@@ -1196,7 +1196,6 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) · 1195 unmodified lines
11961196 */
11971197 static int stmmac_init_phy(struct net_device *dev)
11981198 {
1199− struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
12001199 struct stmmac_priv *priv = netdev_priv(dev);
12011200 struct device_node *node;
12021201 int ret;
@@ -1222,8 +1221,12 @@ static int stmmac_init_phy(struct net_device *dev) · 19 unmodified lines
12221221 ret = phylink_connect_phy(priv->phylink, phydev);
12231222 }
12241223
1225− phylink_ethtool_get_wol(priv->phylink, &wol);
1226− device_set_wakeup_capable(priv->device, !!wol.supported);
1224+ if (!priv->plat->pmt) {
1225+ struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL };
1226+
1227+ phylink_ethtool_get_wol(priv->phylink, &wol);
1228+ device_set_wakeup_capable(priv->device, !!wol.supported);
1229+ }
12271230
12281231 return ret;
12291232 }
@@ -1237,8 +1240,9 @@ static int stmmac_phy_setup(struct stmmac_priv *priv) · 7 unmodified lines
12371240 priv->phylink_config.dev = &priv->dev->dev;
12381241 priv->phylink_config.type = PHYLINK_NETDEV;
12391242 priv->phylink_config.pcs_poll = true;
1240− priv->phylink_config.ovr_an_inband =
1241− 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;
12421246
12431247 if (!fwnode)
12441248 fwnode = dev_fwnode(priv->device);
@@ -5888,12 +5892,21 @@ static int stmmac_set_mac_address(struct net_device *ndev, void *addr) · 4643 unmodified lines
58885892 struct stmmac_priv *priv = netdev_priv(ndev);
58895893 int ret = 0;
58905894
5895+ ret = pm_runtime_get_sync(priv->device);
5896+ if (ret < 0) {
5897+ pm_runtime_put_noidle(priv->device);
5898+ return ret;
5899+ }
5900+
58915901 ret = eth_mac_addr(ndev, addr);
58925902 if (ret)
5893− return ret;
5903+ goto set_mac_error;
58945904
58955905 stmmac_set_umac_addr(priv, priv->hw, ndev->dev_addr, 0);
58965906
5907+set_mac_error:
5908+ pm_runtime_put(priv->device);
5909+
58975910 return ret;
58985911 }
58995912
@@ -6188,12 +6201,6 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid · 288 unmodified lines
61886201 bool is_double = false;
61896202 int ret;
61906203
6191− ret = pm_runtime_get_sync(priv->device);
6192− if (ret < 0) {
6193− pm_runtime_put_noidle(priv->device);
6194− return ret;
6195− }
6196−
61976204 if (be16_to_cpu(proto) == ETH_P_8021AD)
61986205 is_double = true;
61996206
@@ -6219,6 +6226,12 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi · 19 unmodified lines
62196226 bool is_double = false;
62206227 int ret;
62216228
6229+ ret = pm_runtime_get_sync(priv->device);
6230+ if (ret < 0) {
6231+ pm_runtime_put_noidle(priv->device);
6232+ return ret;
6233+ }
6234+
62226235 if (be16_to_cpu(proto) == ETH_P_8021AD)
62236236 is_double = true;
62246237
@@ -7036,7 +7049,6 @@ error_mdio_register: · 811 unmodified lines
70367049 stmmac_napi_del(ndev);
70377050 error_hw_init:
70387051 destroy_workqueue(priv->wq);
7039− stmmac_bus_clks_config(priv, false);
70407052 bitmap_free(priv->af_xdp_zc_qps);
70417053
70427054 return ret;
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c+2−0
@@ -622,6 +622,8 @@ error_pclk_get: · 621 unmodified lines
622622 void stmmac_remove_config_dt(struct platform_device *pdev,
623623 struct plat_stmmacenet_data *plat)
624624 {
625+ clk_disable_unprepare(plat->stmmac_clk);
626+ clk_disable_unprepare(plat->pclk);
625627 of_node_put(plat->phy_node);
626628 of_node_put(plat->mdio_node);
627629 }
drivers/net/ethernet/ti/netcp_core.c+2−2
@@ -1350,8 +1350,8 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe) · 1349 unmodified lines
13501350 tx_pipe->dma_queue = knav_queue_open(name, tx_pipe->dma_queue_id,
13511351 KNAV_QUEUE_SHARED);
13521352 if (IS_ERR(tx_pipe->dma_queue)) {
1353− dev_err(dev, "Could not open DMA queue for channel \"%s\": %d\n",
1354− name, ret);
1353+ dev_err(dev, "Could not open DMA queue for channel \"%s\": %pe\n",
1354+ name, tx_pipe->dma_queue);
13551355 ret = PTR_ERR(tx_pipe->dma_queue);
13561356 goto err;
13571357 }
drivers/net/ethernet/xilinx/ll_temac_main.c+24−3
@@ -774,12 +774,15 @@ static void temac_start_xmit_done(struct net_device *ndev) · 773 unmodified lines
774774 stat = be32_to_cpu(cur_p->app0);
775775
776776 while (stat & STS_CTRL_APP0_CMPLT) {
777+ /* Make sure that the other fields are read after bd is
778+ * released by dma
779+ */
780+ rmb();
777781 dma_unmap_single(ndev->dev.parent, be32_to_cpu(cur_p->phys),
778782 be32_to_cpu(cur_p->len), DMA_TO_DEVICE);
779783 skb = (struct sk_buff *)ptr_from_txbd(cur_p);
780784 if (skb)
781785 dev_consume_skb_irq(skb);
782− cur_p->app0 = 0;
783786 cur_p->app1 = 0;
784787 cur_p->app2 = 0;
785788 cur_p->app3 = 0;
@@ -788,6 +791,12 @@ static void temac_start_xmit_done(struct net_device *ndev) · 2 unmodified lines
788791 ndev->stats.tx_packets++;
789792 ndev->stats.tx_bytes += be32_to_cpu(cur_p->len);
790793
794+ /* app0 must be visible last, as it is used to flag
795+ * availability of the bd
796+ */
797+ smp_mb();
798+ cur_p->app0 = 0;
799+
791800 lp->tx_bd_ci++;
792801 if (lp->tx_bd_ci >= lp->tx_bd_num)
793802 lp->tx_bd_ci = 0;
@@ -814,6 +823,9 @@ static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag) · 20 unmodified lines
814823 if (cur_p->app0)
815824 return NETDEV_TX_BUSY;
816825
826+ /* Make sure to read next bd app0 after this one */
827+ rmb();
828+
817829 tail++;
818830 if (tail >= lp->tx_bd_num)
819831 tail = 0;
@@ -849,7 +861,7 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 29 unmodified lines
849861 smp_mb();
850862
851863 /* Space might have just been freed - check again */
852− if (temac_check_tx_bd_space(lp, num_frag))
864+ if (temac_check_tx_bd_space(lp, num_frag + 1))
853865 return NETDEV_TX_BUSY;
854866
855867 netif_wake_queue(ndev);
@@ -876,7 +888,6 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 20 unmodified lines
876888 return NETDEV_TX_OK;
877889 }
878890 cur_p->phys = cpu_to_be32(skb_dma_addr);
879− ptr_to_txbd((void *)skb, cur_p);
880891
881892 for (ii = 0; ii < num_frag; ii++) {
882893 if (++lp->tx_bd_tail >= lp->tx_bd_num)
@@ -915,6 +926,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 32 unmodified lines
915926 }
916927 cur_p->app0 |= cpu_to_be32(STS_CTRL_APP0_EOP);
917928
929+ /* Mark last fragment with skb address, so it can be consumed
930+ * in temac_start_xmit_done()
931+ */
932+ ptr_to_txbd((void *)skb, cur_p);
933+
918934 tail_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail;
919935 lp->tx_bd_tail++;
920936 if (lp->tx_bd_tail >= lp->tx_bd_num)
@@ -926,6 +942,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) · 5 unmodified lines
926942 wmb();
927943 lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
928944
945+ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) {
946+ netdev_info(ndev, "%s -> netif_stop_queue\n", __func__);
947+ netif_stop_queue(ndev);
948+ }
949+
929950 return NETDEV_TX_OK;
930951 }
931952
drivers/net/hamradio/mkiss.c+1−0
@@ -799,6 +799,7 @@ static void mkiss_close(struct tty_struct *tty) · 798 unmodified lines
799799 ax->tty = NULL;
800800
801801 unregister_netdev(ax->dev);
802+ free_netdev(ax->dev);
802803 }
803804
804805 /* Perform I/O control on an active ax25 channel. */
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/ipa/ipa.h+2−0
@@ -58,6 +58,7 @@ enum ipa_flag { · 57 unmodified lines
5858 * @mem_virt: Virtual address of IPA-local memory space
5959 * @mem_offset: Offset from @mem_virt used for access to IPA memory
6060 * @mem_size: Total size (bytes) of memory at @mem_virt
61+ * @mem_count: Number of entries in the mem array
6162 * @mem: Array of IPA-local memory region descriptors
6263 * @imem_iova: I/O virtual address of IPA region in IMEM
6364 * @imem_size: Size of IMEM region
@@ -103,6 +104,7 @@ struct ipa { · 39 unmodified lines
103104 void *mem_virt;
104105 u32 mem_offset;
105106 u32 mem_size;
107+ u32 mem_count;
106108 const struct ipa_mem *mem;
107109
108110 unsigned long imem_iova;
drivers/net/ipa/ipa_mem.c+2−1
@@ -180,7 +180,7 @@ int ipa_mem_config(struct ipa *ipa) · 179 unmodified lines
180180 * for the region, write "canary" values in the space prior to
181181 * the region's base address.
182182 */
183− for (mem_id = 0; mem_id < IPA_MEM_COUNT; mem_id++) {
183+ for (mem_id = 0; mem_id < ipa->mem_count; mem_id++) {
184184 const struct ipa_mem *mem = &ipa->mem[mem_id];
185185 u16 canary_count;
186186 __le32 *canary;
@@ -487,6 +487,7 @@ int ipa_mem_init(struct ipa *ipa, const struct ipa_mem_data *mem_data) · 300 unmodified lines
487487 ipa->mem_size = resource_size(res);
488488
489489 /* The ipa->mem[] array is indexed by enum ipa_mem_id values */
490+ ipa->mem_count = mem_data->local_count;
490491 ipa->mem = mem_data->local;
491492
492493 ret = ipa_imem_init(ipa, mem_data->imem_addr, mem_data->imem_size);
drivers/net/mdio/mdio-octeon.c+0−2
@@ -71,7 +71,6 @@ static int octeon_mdiobus_probe(struct platform_device *pdev) · 70 unmodified lines
7171
7272 return 0;
7373 fail_register:
74− mdiobus_free(bus->mii_bus);
7574 smi_en.u64 = 0;
7675 oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
7776 return err;
@@ -85,7 +84,6 @@ static int octeon_mdiobus_remove(struct platform_device *pdev) · 7 unmodified lines
8584 bus = platform_get_drvdata(pdev);
8685
8786 mdiobus_unregister(bus->mii_bus);
88− mdiobus_free(bus->mii_bus);
8987 smi_en.u64 = 0;
9088 oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
9189 return 0;
drivers/net/mdio/mdio-thunder.c+0−1
@@ -126,7 +126,6 @@ static void thunder_mdiobus_pci_remove(struct pci_dev *pdev) · 125 unmodified lines
126126 continue;
127127
128128 mdiobus_unregister(bus->mii_bus);
129− mdiobus_free(bus->mii_bus);
130129 oct_mdio_writeq(0, bus->register_base + SMI_EN);
131130 }
132131 pci_release_regions(pdev);
drivers/net/mhi/net.c+1−1
@@ -49,7 +49,7 @@ static int mhi_ndo_stop(struct net_device *ndev) · 48 unmodified lines
4949 return 0;
5050 }
5151
52−static int mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev)
52+static netdev_tx_t mhi_ndo_xmit(struct sk_buff *skb, struct net_device *ndev)
5353 {
5454 struct mhi_net_dev *mhi_netdev = netdev_priv(ndev);
5555 const struct mhi_net_proto *proto = mhi_netdev->proto;
drivers/net/phy/dp83867.c+1−5
@@ -826,16 +826,12 @@ static int dp83867_phy_reset(struct phy_device *phydev) · 825 unmodified lines
826826 {
827827 int err;
828828
829− err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESET);
829+ err = phy_write(phydev, DP83867_CTRL, DP83867_SW_RESTART);
830830 if (err < 0)
831831 return err;
832832
833833 usleep_range(10, 20);
834834
835− /* After reset FORCE_LINK_GOOD bit is set. Although the
836− * default value should be unset. Disable FORCE_LINK_GOOD
837− * for the phy to work properly.
838− */
839835 return phy_modify(phydev, MII_DP83867_PHYCTRL,
840836 DP83867_PHYCR_FORCE_LINK_GOOD, 0);
841837 }
drivers/net/phy/mdio_bus.c+2−1
@@ -607,7 +607,8 @@ void mdiobus_unregister(struct mii_bus *bus) · 606 unmodified lines
607607 struct mdio_device *mdiodev;
608608 int i;
609609
610− BUG_ON(bus->state != MDIOBUS_REGISTERED);
610+ if (WARN_ON_ONCE(bus->state != MDIOBUS_REGISTERED))
611+ return;
611612 bus->state = MDIOBUS_UNREGISTERED;
612613
613614 for (i = 0; i < PHY_MAX_ADDR; i++) {
drivers/net/usb/cdc_eem.c+2−2
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626 * for transport over USB using a simpler USB device model than the
2727 * previous CDC "Ethernet Control Model" (ECM, or "CDC Ethernet").
2828 *
29− * For details, see www.usb.org/developers/devclass_docs/CDC_EEM10.pdf
29+ * For details, see https://usb.org/sites/default/files/CDC_EEM10.pdf
3030 *
3131 * This version has been tested with GIGAntIC WuaoW SIM Smart Card on 2.6.24,
3232 * 2.6.27 and 2.6.30rc2 kernel.
@@ -123,10 +123,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb, · 90 unmodified lines
123123 }
124124
125125 skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
126+ dev_kfree_skb_any(skb);
126127 if (!skb2)
127128 return NULL;
128129
129− dev_kfree_skb_any(skb);
130130 skb = skb2;
131131
132132 done:
drivers/net/usb/cdc_ncm.c+1−1
@@ -1880,7 +1880,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb) · 1879 unmodified lines
18801880 static const struct driver_info cdc_ncm_info = {
18811881 .description = "CDC NCM",
18821882 .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
1883− | FLAG_LINK_INTR,
1883+ | FLAG_LINK_INTR | FLAG_ETHER,
18841884 .bind = cdc_ncm_bind,
18851885 .unbind = cdc_ncm_unbind,
18861886 .manage_power = usbnet_manage_power,
drivers/net/usb/hso.c+22−23
@@ -1689,7 +1689,7 @@ static int hso_serial_tiocmset(struct tty_struct *tty, · 1688 unmodified lines
16891689 spin_unlock_irqrestore(&serial->serial_lock, flags);
16901690
16911691 return usb_control_msg(serial->parent->usb,
1692− usb_rcvctrlpipe(serial->parent->usb, 0), 0x22,
1692+ usb_sndctrlpipe(serial->parent->usb, 0), 0x22,
16931693 0x21, val, if_num, NULL, 0,
16941694 USB_CTRL_SET_TIMEOUT);
16951695 }
@@ -2436,7 +2436,7 @@ static int hso_rfkill_set_block(void *data, bool blocked) · 740 unmodified lines
24362436 if (hso_dev->usb_gone)
24372437 rv = 0;
24382438 else
2439− rv = usb_control_msg(hso_dev->usb, usb_rcvctrlpipe(hso_dev->usb, 0),
2439+ rv = usb_control_msg(hso_dev->usb, usb_sndctrlpipe(hso_dev->usb, 0),
24402440 enabled ? 0x82 : 0x81, 0x40, 0, 0, NULL, 0,
24412441 USB_CTRL_SET_TIMEOUT);
24422442 mutex_unlock(&hso_dev->mutex);
@@ -2618,32 +2618,31 @@ static struct hso_device *hso_create_bulk_serial_device( · 175 unmodified lines
26182618 num_urbs = 2;
26192619 serial->tiocmget = kzalloc(sizeof(struct hso_tiocmget),
26202620 GFP_KERNEL);
2621+ if (!serial->tiocmget)
2622+ goto exit;
26212623 serial->tiocmget->serial_state_notification
26222624 = kzalloc(sizeof(struct hso_serial_state_notification),
26232625 GFP_KERNEL);
2624− /* it isn't going to break our heart if serial->tiocmget
2625− * allocation fails don't bother checking this.
2626− */
2627− if (serial->tiocmget && serial->tiocmget->serial_state_notification) {
2628− tiocmget = serial->tiocmget;
2629− tiocmget->endp = hso_get_ep(interface,
2630− USB_ENDPOINT_XFER_INT,
2631− USB_DIR_IN);
2632− if (!tiocmget->endp) {
2633− dev_err(&interface->dev, "Failed to find INT IN ep\n");
2634− goto exit;
2635− }
2636−
2637− tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
2638− if (tiocmget->urb) {
2639− mutex_init(&tiocmget->mutex);
2640− init_waitqueue_head(&tiocmget->waitq);
2641− } else
2642− hso_free_tiomget(serial);
2626+ if (!serial->tiocmget->serial_state_notification)
2627+ goto exit;
2628+ tiocmget = serial->tiocmget;
2629+ tiocmget->endp = hso_get_ep(interface,
2630+ USB_ENDPOINT_XFER_INT,
2631+ USB_DIR_IN);
2632+ if (!tiocmget->endp) {
2633+ dev_err(&interface->dev, "Failed to find INT IN ep\n");
2634+ goto exit;
26432635 }
2644− }
2645− else
2636+
2637+ tiocmget->urb = usb_alloc_urb(0, GFP_KERNEL);
2638+ if (!tiocmget->urb)
2639+ goto exit;
2640+
2641+ mutex_init(&tiocmget->mutex);
2642+ init_waitqueue_head(&tiocmget->waitq);
2643+ } else {
26462644 num_urbs = 1;
2645+ }
26472646
26482647 if (hso_serial_common_create(serial, num_urbs, BULK_URB_RX_SIZE,
26492648 BULK_URB_TX_SIZE))
drivers/net/usb/lan78xx.c+1−0
@@ -1645,6 +1645,7 @@ static const struct ethtool_ops lan78xx_ethtool_ops = { · 1644 unmodified lines
16451645 .get_strings = lan78xx_get_strings,
16461646 .get_wol = lan78xx_get_wol,
16471647 .set_wol = lan78xx_set_wol,
1648+ .get_ts_info = ethtool_op_get_ts_info,
16481649 .get_eee = lan78xx_get_eee,
16491650 .set_eee = lan78xx_set_eee,
16501651 .get_pauseparam = lan78xx_get_pause,
drivers/net/usb/qmi_wwan.c+1−1
@@ -575,7 +575,7 @@ static int qmi_wwan_rx_fixup(struct usbnet *dev, struct sk_buff *skb) · 574 unmodified lines
575575
576576 if (info->flags & QMI_WWAN_FLAG_PASS_THROUGH) {
577577 skb->protocol = htons(ETH_P_MAP);
578− return (netif_rx(skb) == NET_RX_SUCCESS);
578+ return 1;
579579 }
580580
581581 switch (skb->data[0] & 0xf0) {
drivers/net/usb/r8152.c+38−6
@@ -8107,6 +8107,37 @@ static void r8156b_init(struct r8152 *tp) · 8106 unmodified lines
81078107 tp->coalesce = 15000; /* 15 us */
81088108 }
81098109
8110+static bool rtl_check_vendor_ok(struct usb_interface *intf)
8111+{
8112+ struct usb_host_interface *alt = intf->cur_altsetting;
8113+ struct usb_endpoint_descriptor *in, *out, *intr;
8114+
8115+ if (usb_find_common_endpoints(alt, &in, &out, &intr, NULL) < 0) {
8116+ dev_err(&intf->dev, "Expected endpoints are not found\n");
8117+ return false;
8118+ }
8119+
8120+ /* Check Rx endpoint address */
8121+ if (usb_endpoint_num(in) != 1) {
8122+ dev_err(&intf->dev, "Invalid Rx endpoint address\n");
8123+ return false;
8124+ }
8125+
8126+ /* Check Tx endpoint address */
8127+ if (usb_endpoint_num(out) != 2) {
8128+ dev_err(&intf->dev, "Invalid Tx endpoint address\n");
8129+ return false;
8130+ }
8131+
8132+ /* Check interrupt endpoint address */
8133+ if (usb_endpoint_num(intr) != 3) {
8134+ dev_err(&intf->dev, "Invalid interrupt endpoint address\n");
8135+ return false;
8136+ }
8137+
8138+ return true;
8139+}
8140+
81108141 static bool rtl_vendor_mode(struct usb_interface *intf)
81118142 {
81128143 struct usb_host_interface *alt = intf->cur_altsetting;
@@ -8115,12 +8146,15 @@ static bool rtl_vendor_mode(struct usb_interface *intf) · 2 unmodified lines
81158146 int i, num_configs;
81168147
81178148 if (alt->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC)
8118− return true;
8149+ return rtl_check_vendor_ok(intf);
81198150
81208151 /* The vendor mode is not always config #1, so to find it out. */
81218152 udev = interface_to_usbdev(intf);
81228153 c = udev->config;
81238154 num_configs = udev->descriptor.bNumConfigurations;
8155+ if (num_configs < 2)
8156+ return false;
8157+
81248158 for (i = 0; i < num_configs; (i++, c++)) {
81258159 struct usb_interface_descriptor *desc = NULL;
81268160
@@ -8135,7 +8169,8 @@ static bool rtl_vendor_mode(struct usb_interface *intf) · 8 unmodified lines
81358169 }
81368170 }
81378171
8138− WARN_ON_ONCE(i == num_configs);
8172+ if (i == num_configs)
8173+ dev_err(&intf->dev, "Unexpected Device\n");
81398174
81408175 return false;
81418176 }
@@ -8643,7 +8678,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data) · 501 unmodified lines
86438678 {
86448679 switch (stringset) {
86458680 case ETH_SS_STATS:
8646− memcpy(data, *rtl8152_gstrings, sizeof(rtl8152_gstrings));
8681+ memcpy(data, rtl8152_gstrings, sizeof(rtl8152_gstrings));
86478682 break;
86488683 }
86498684 }
@@ -9381,9 +9416,6 @@ static int rtl8152_probe(struct usb_interface *intf, · 731 unmodified lines
93819416 if (!rtl_vendor_mode(intf))
93829417 return -ENODEV;
93839418
9384− if (intf->cur_altsetting->desc.bNumEndpoints < 3)
9385− return -ENODEV;
9386−
93879419 usb_reset_device(udev);
93889420 netdev = alloc_etherdev(sizeof(struct r8152));
93899421 if (!netdev) {
drivers/net/usb/smsc75xx.c+9−3
@@ -1483,7 +1483,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) · 1482 unmodified lines
14831483 ret = smsc75xx_wait_ready(dev, 0);
14841484 if (ret < 0) {
14851485 netdev_warn(dev->net, "device not ready in smsc75xx_bind\n");
1486− return ret;
1486+ goto free_pdata;
14871487 }
14881488
14891489 smsc75xx_init_mac_address(dev);
@@ -1492,7 +1492,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) · 2 unmodified lines
14921492 ret = smsc75xx_reset(dev);
14931493 if (ret < 0) {
14941494 netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret);
1495− return ret;
1495+ goto cancel_work;
14961496 }
14971497
14981498 dev->net->netdev_ops = &smsc75xx_netdev_ops;
@@ -1502,6 +1502,13 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf) · 3 unmodified lines
15021502 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
15031503 dev->net->max_mtu = MAX_SINGLE_PACKET_SIZE;
15041504 return 0;
1505+
1506+cancel_work:
1507+ cancel_work_sync(&pdata->set_multicast);
1508+free_pdata:
1509+ kfree(pdata);
1510+ dev->data[0] = 0;
1511+ return ret;
15051512 }
15061513
15071514 static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf)
@@ -1511,7 +1518,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf) · 3 unmodified lines
15111518 cancel_work_sync(&pdata->set_multicast);
15121519 netif_dbg(dev, ifdown, dev->net, "free pdata\n");
15131520 kfree(pdata);
1514− pdata = NULL;
15151521 dev->data[0] = 0;
15161522 }
15171523 }
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/vrf.c+2−4
@@ -1183,9 +1183,6 @@ static int vrf_dev_init(struct net_device *dev) · 1182 unmodified lines
11831183
11841184 dev->flags = IFF_MASTER | IFF_NOARP;
11851185
1186− /* MTU is irrelevant for VRF device; set to 64k similar to lo */
1187− dev->mtu = 64 * 1024;
1188−
11891186 /* similarly, oper state is irrelevant; set to up to avoid confusion */
11901187 dev->operstate = IF_OPER_UP;
11911188 netdev_lockdep_set_classes(dev);
@@ -1685,7 +1682,8 @@ static void vrf_setup(struct net_device *dev) · 493 unmodified lines
16851682 * which breaks networking.
16861683 */
16871684 dev->min_mtu = IPV6_MIN_MTU;
1688− dev->max_mtu = ETH_MAX_MTU;
1685+ dev->max_mtu = IP6_MAX_MTU;
1686+ dev->mtu = dev->max_mtu;
16891687 }
16901688
16911689 static int vrf_validate(struct nlattr *tb[], struct nlattr *data[],
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/ath/ath10k/htt.h+1−0
@@ -845,6 +845,7 @@ enum htt_security_types { · 844 unmodified lines
845845
846846 #define ATH10K_HTT_TXRX_PEER_SECURITY_MAX 2
847847 #define ATH10K_TXRX_NUM_EXT_TIDS 19
848+#define ATH10K_TXRX_NON_QOS_TID 16
848849
849850 enum htt_security_flags {
850851 #define HTT_SECURITY_TYPE_MASK 0x7F
drivers/net/wireless/ath/ath10k/htt_rx.c+191−10
@@ -1746,16 +1746,97 @@ static void ath10k_htt_rx_h_csum_offload(struct sk_buff *msdu) · 1745 unmodified lines
17461746 msdu->ip_summed = ath10k_htt_rx_get_csum_state(msdu);
17471747 }
17481748
1749+static u64 ath10k_htt_rx_h_get_pn(struct ath10k *ar, struct sk_buff *skb,
1750+ u16 offset,
1751+ enum htt_rx_mpdu_encrypt_type enctype)
1752+{
1753+ struct ieee80211_hdr *hdr;
1754+ u64 pn = 0;
1755+ u8 *ehdr;
1756+
1757+ hdr = (struct ieee80211_hdr *)(skb->data + offset);
1758+ ehdr = skb->data + offset + ieee80211_hdrlen(hdr->frame_control);
1759+
1760+ if (enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2) {
1761+ pn = ehdr[0];
1762+ pn |= (u64)ehdr[1] << 8;
1763+ pn |= (u64)ehdr[4] << 16;
1764+ pn |= (u64)ehdr[5] << 24;
1765+ pn |= (u64)ehdr[6] << 32;
1766+ pn |= (u64)ehdr[7] << 40;
1767+ }
1768+ return pn;
1769+}
1770+
1771+static bool ath10k_htt_rx_h_frag_multicast_check(struct ath10k *ar,
1772+ struct sk_buff *skb,
1773+ u16 offset)
1774+{
1775+ struct ieee80211_hdr *hdr;
1776+
1777+ hdr = (struct ieee80211_hdr *)(skb->data + offset);
1778+ return !is_multicast_ether_addr(hdr->addr1);
1779+}
1780+
1781+static bool ath10k_htt_rx_h_frag_pn_check(struct ath10k *ar,
1782+ struct sk_buff *skb,
1783+ u16 peer_id,
1784+ u16 offset,
1785+ enum htt_rx_mpdu_encrypt_type enctype)
1786+{
1787+ struct ath10k_peer *peer;
1788+ union htt_rx_pn_t *last_pn, new_pn = {0};
1789+ struct ieee80211_hdr *hdr;
1790+ bool more_frags;
1791+ u8 tid, frag_number;
1792+ u32 seq;
1793+
1794+ peer = ath10k_peer_find_by_id(ar, peer_id);
1795+ if (!peer) {
1796+ ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid peer for frag pn check\n");
1797+ return false;
1798+ }
1799+
1800+ hdr = (struct ieee80211_hdr *)(skb->data + offset);
1801+ if (ieee80211_is_data_qos(hdr->frame_control))
1802+ tid = ieee80211_get_tid(hdr);
1803+ else
1804+ tid = ATH10K_TXRX_NON_QOS_TID;
1805+
1806+ last_pn = &peer->frag_tids_last_pn[tid];
1807+ new_pn.pn48 = ath10k_htt_rx_h_get_pn(ar, skb, offset, enctype);
1808+ more_frags = ieee80211_has_morefrags(hdr->frame_control);
1809+ frag_number = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
1810+ seq = (__le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_SEQ) >> 4;
1811+
1812+ if (frag_number == 0) {
1813+ last_pn->pn48 = new_pn.pn48;
1814+ peer->frag_tids_seq[tid] = seq;
1815+ } else {
1816+ if (seq != peer->frag_tids_seq[tid])
1817+ return false;
1818+
1819+ if (new_pn.pn48 != last_pn->pn48 + 1)
1820+ return false;
1821+
1822+ last_pn->pn48 = new_pn.pn48;
1823+ }
1824+
1825+ return true;
1826+}
1827+
17491828 static void ath10k_htt_rx_h_mpdu(struct ath10k *ar,
17501829 struct sk_buff_head *amsdu,
17511830 struct ieee80211_rx_status *status,
17521831 bool fill_crypt_header,
17531832 u8 *rx_hdr,
1754− enum ath10k_pkt_rx_err *err)
1833+ enum ath10k_pkt_rx_err *err,
1834+ u16 peer_id,
1835+ bool frag)
17551836 {
17561837 struct sk_buff *first;
17571838 struct sk_buff *last;
1758− struct sk_buff *msdu;
1839+ struct sk_buff *msdu, *temp;
17591840 struct htt_rx_desc *rxd;
17601841 struct ieee80211_hdr *hdr;
17611842 enum htt_rx_mpdu_encrypt_type enctype;
@@ -1768,6 +1849,7 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, · 6 unmodified lines
17681849 bool is_decrypted;
17691850 bool is_mgmt;
17701851 u32 attention;
1852+ bool frag_pn_check = true, multicast_check = true;
17711853
17721854 if (skb_queue_empty(amsdu))
17731855 return;
@@ -1866,7 +1948,37 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, · 92 unmodified lines
18661948 }
18671949
18681950 skb_queue_walk(amsdu, msdu) {
1951+ if (frag && !fill_crypt_header && is_decrypted &&
1952+ enctype == HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2)
1953+ frag_pn_check = ath10k_htt_rx_h_frag_pn_check(ar,
1954+ msdu,
1955+ peer_id,
1956+ 0,
1957+ enctype);
1958+
1959+ if (frag)
1960+ multicast_check = ath10k_htt_rx_h_frag_multicast_check(ar,
1961+ msdu,
1962+ 0);
1963+
1964+ if (!frag_pn_check || !multicast_check) {
1965+ /* Discard the fragment with invalid PN or multicast DA
1966+ */
1967+ temp = msdu->prev;
1968+ __skb_unlink(msdu, amsdu);
1969+ dev_kfree_skb_any(msdu);
1970+ msdu = temp;
1971+ frag_pn_check = true;
1972+ multicast_check = true;
1973+ continue;
1974+ }
1975+
18691976 ath10k_htt_rx_h_csum_offload(msdu);
1977+
1978+ if (frag && !fill_crypt_header &&
1979+ enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
1980+ status->flag &= ~RX_FLAG_MMIC_STRIPPED;
1981+
18701982 ath10k_htt_rx_h_undecap(ar, msdu, status, first_hdr, enctype,
18711983 is_decrypted);
18721984
@@ -1884,6 +1996,11 @@ static void ath10k_htt_rx_h_mpdu(struct ath10k *ar, · 11 unmodified lines
18841996
18851997 hdr = (void *)msdu->data;
18861998 hdr->frame_control &= ~__cpu_to_le16(IEEE80211_FCTL_PROTECTED);
1999+
2000+ if (frag && !fill_crypt_header &&
2001+ enctype == HTT_RX_MPDU_ENCRYPT_TKIP_WPA)
2002+ status->flag &= ~RX_FLAG_IV_STRIPPED &
2003+ ~RX_FLAG_MMIC_STRIPPED;
18872004 }
18882005 }
18892006
@@ -1991,14 +2108,62 @@ static void ath10k_htt_rx_h_unchain(struct ath10k *ar, · 101 unmodified lines
19912108 ath10k_unchain_msdu(amsdu, unchain_cnt);
19922109 }
19932110
2111+static bool ath10k_htt_rx_validate_amsdu(struct ath10k *ar,
2112+ struct sk_buff_head *amsdu)
2113+{
2114+ u8 *subframe_hdr;
2115+ struct sk_buff *first;
2116+ bool is_first, is_last;
2117+ struct htt_rx_desc *rxd;
2118+ struct ieee80211_hdr *hdr;
2119+ size_t hdr_len, crypto_len;
2120+ enum htt_rx_mpdu_encrypt_type enctype;
2121+ int bytes_aligned = ar->hw_params.decap_align_bytes;
2122+
2123+ first = skb_peek(amsdu);
2124+
2125+ rxd = (void *)first->data - sizeof(*rxd);
2126+ hdr = (void *)rxd->rx_hdr_status;
2127+
2128+ is_first = !!(rxd->msdu_end.common.info0 &
2129+ __cpu_to_le32(RX_MSDU_END_INFO0_FIRST_MSDU));
2130+ is_last = !!(rxd->msdu_end.common.info0 &
2131+ __cpu_to_le32(RX_MSDU_END_INFO0_LAST_MSDU));
2132+
2133+ /* Return in case of non-aggregated msdu */
2134+ if (is_first && is_last)
2135+ return true;
2136+
2137+ /* First msdu flag is not set for the first msdu of the list */
2138+ if (!is_first)
2139+ return false;
2140+
2141+ enctype = MS(__le32_to_cpu(rxd->mpdu_start.info0),
2142+ RX_MPDU_START_INFO0_ENCRYPT_TYPE);
2143+
2144+ hdr_len = ieee80211_hdrlen(hdr->frame_control);
2145+ crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype);
2146+
2147+ subframe_hdr = (u8 *)hdr + round_up(hdr_len, bytes_aligned) +
2148+ crypto_len;
2149+
2150+ /* Validate if the amsdu has a proper first subframe.
2151+ * There are chances a single msdu can be received as amsdu when
2152+ * the unauthenticated amsdu flag of a QoS header
2153+ * gets flipped in non-SPP AMSDU's, in such cases the first
2154+ * subframe has llc/snap header in place of a valid da.
2155+ * return false if the da matches rfc1042 pattern
2156+ */
2157+ if (ether_addr_equal(subframe_hdr, rfc1042_header))
2158+ return false;
2159+
2160+ return true;
2161+}
2162+
19942163 static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar,
19952164 struct sk_buff_head *amsdu,
19962165 struct ieee80211_rx_status *rx_status)
19972166 {
1998− /* FIXME: It might be a good idea to do some fuzzy-testing to drop
1999− * invalid/dangerous frames.
2000− */
2001−
20022167 if (!rx_status->freq) {
20032168 ath10k_dbg(ar, ATH10K_DBG_HTT, "no channel configured; ignoring frame(s)!\n");
20042169 return false;
@@ -2009,6 +2174,11 @@ static bool ath10k_htt_rx_amsdu_allowed(struct ath10k *ar, · 4 unmodified lines
20092174 return false;
20102175 }
20112176
2177+ if (!ath10k_htt_rx_validate_amsdu(ar, amsdu)) {
2178+ ath10k_dbg(ar, ATH10K_DBG_HTT, "invalid amsdu received\n");
2179+ return false;
2180+ }
2181+
20122182 return true;
20132183 }
20142184
@@ -2071,7 +2241,8 @@ static int ath10k_htt_rx_handle_amsdu(struct ath10k_htt *htt) · 56 unmodified lines
20712241 ath10k_htt_rx_h_unchain(ar, &amsdu, &drop_cnt, &unchain_cnt);
20722242
20732243 ath10k_htt_rx_h_filter(ar, &amsdu, rx_status, &drop_cnt_filter);
2074− ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err);
2244+ ath10k_htt_rx_h_mpdu(ar, &amsdu, rx_status, true, first_hdr, &err, 0,
2245+ false);
20752246 msdus_to_queue = skb_queue_len(&amsdu);
20762247 ath10k_htt_rx_h_enqueue(ar, &amsdu, rx_status);
20772248
@@ -2204,6 +2375,11 @@ static bool ath10k_htt_rx_proc_rx_ind_hl(struct ath10k_htt *htt, · 126 unmodified lines
22042375 fw_desc = &rx->fw_desc;
22052376 rx_desc_len = fw_desc->len;
22062377
2378+ if (fw_desc->u.bits.discard) {
2379+ ath10k_dbg(ar, ATH10K_DBG_HTT, "htt discard mpdu\n");
2380+ goto err;
2381+ }
2382+
22072383 /* I have not yet seen any case where num_mpdu_ranges > 1.
22082384 * qcacld does not seem handle that case either, so we introduce the
22092385 * same limitiation here as well.
@@ -2509,6 +2685,13 @@ static bool ath10k_htt_rx_proc_rx_frag_ind_hl(struct ath10k_htt *htt, · 299 unmodified lines
25092685 rx_desc = (struct htt_hl_rx_desc *)(skb->data + tot_hdr_len);
25102686 rx_desc_info = __le32_to_cpu(rx_desc->info);
25112687
2688+ hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len);
2689+
2690+ if (is_multicast_ether_addr(hdr->addr1)) {
2691+ /* Discard the fragment with multicast DA */
2692+ goto err;
2693+ }
2694+
25122695 if (!MS(rx_desc_info, HTT_RX_DESC_HL_INFO_ENCRYPTED)) {
25132696 spin_unlock_bh(&ar->data_lock);
25142697 return ath10k_htt_rx_proc_rx_ind_hl(htt, &resp->rx_ind_hl, skb,
@@ -2516,8 +2699,6 @@ static bool ath10k_htt_rx_proc_rx_frag_ind_hl(struct ath10k_htt *htt, · 1 unmodified line
25162699 HTT_RX_NON_TKIP_MIC);
25172700 }
25182701
2519− hdr = (struct ieee80211_hdr *)((u8 *)rx_desc + rx_hl->fw_desc.len);
2520−
25212702 if (ieee80211_has_retry(hdr->frame_control))
25222703 goto err;
25232704
@@ -3027,7 +3208,7 @@ static int ath10k_htt_rx_in_ord_ind(struct ath10k *ar, struct sk_buff *skb) · 503 unmodified lines
30273208 ath10k_htt_rx_h_ppdu(ar, &amsdu, status, vdev_id);
30283209 ath10k_htt_rx_h_filter(ar, &amsdu, status, NULL);
30293210 ath10k_htt_rx_h_mpdu(ar, &amsdu, status, false, NULL,
3030− NULL);
3211+ NULL, peer_id, frag);
30313212 ath10k_htt_rx_h_enqueue(ar, &amsdu, status);
30323213 break;
30333214 case -EAGAIN:
drivers/net/wireless/ath/ath10k/rx_desc.h+13−1
@@ -1282,7 +1282,19 @@ struct fw_rx_desc_base { · 1281 unmodified lines
12821282 #define FW_RX_DESC_UDP (1 << 6)
12831283
12841284 struct fw_rx_desc_hl {
1285− u8 info0;
1285+ union {
1286+ struct {
1287+ u8 discard:1,
1288+ forward:1,
1289+ any_err:1,
1290+ dup_err:1,
1291+ reserved:1,
1292+ inspect:1,
1293+ extension:2;
1294+ } bits;
1295+ u8 info0;
1296+ } u;
1297+
12861298 u8 version;
12871299 u8 len;
12881300 u8 flags;
drivers/net/wireless/ath/ath11k/dp_rx.c+34−0
@@ -260,6 +260,16 @@ static void ath11k_dp_rxdesc_set_msdu_len(struct ath11k_base *ab, · 259 unmodified lines
260260 ab->hw_params.hw_ops->rx_desc_set_msdu_len(desc, len);
261261 }
262262
263+static bool ath11k_dp_rx_h_attn_is_mcbc(struct ath11k_base *ab,
264+ struct hal_rx_desc *desc)
265+{
266+ struct rx_attention *attn = ath11k_dp_rx_get_attention(ab, desc);
267+
268+ return ath11k_dp_rx_h_msdu_end_first_msdu(ab, desc) &&
269+ (!!FIELD_GET(RX_ATTENTION_INFO1_MCAST_BCAST,
270+ __le32_to_cpu(attn->info1)));
271+}
272+
263273 static void ath11k_dp_service_mon_ring(struct timer_list *t)
264274 {
265275 struct ath11k_base *ab = from_timer(ab, t, mon_reap_timer);
@@ -852,6 +862,24 @@ static void ath11k_dp_rx_frags_cleanup(struct dp_rx_tid *rx_tid, bool rel_link_d · 586 unmodified lines
852862 __skb_queue_purge(&rx_tid->rx_frags);
853863 }
854864
865+void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer)
866+{
867+ struct dp_rx_tid *rx_tid;
868+ int i;
869+
870+ lockdep_assert_held(&ar->ab->base_lock);
871+
872+ for (i = 0; i <= IEEE80211_NUM_TIDS; i++) {
873+ rx_tid = &peer->rx_tid[i];
874+
875+ spin_unlock_bh(&ar->ab->base_lock);
876+ del_timer_sync(&rx_tid->frag_timer);
877+ spin_lock_bh(&ar->ab->base_lock);
878+
879+ ath11k_dp_rx_frags_cleanup(rx_tid, true);
880+ }
881+}
882+
855883 void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer)
856884 {
857885 struct dp_rx_tid *rx_tid;
@@ -3450,6 +3478,7 @@ static int ath11k_dp_rx_frag_h_mpdu(struct ath11k *ar, · 2592 unmodified lines
34503478 u8 tid;
34513479 int ret = 0;
34523480 bool more_frags;
3481+ bool is_mcbc;
34533482
34543483 rx_desc = (struct hal_rx_desc *)msdu->data;
34553484 peer_id = ath11k_dp_rx_h_mpdu_start_peer_id(ar->ab, rx_desc);
@@ -3457,6 +3486,11 @@ static int ath11k_dp_rx_frag_h_mpdu(struct ath11k *ar, · 1 unmodified line
34573486 seqno = ath11k_dp_rx_h_mpdu_start_seq_no(ar->ab, rx_desc);
34583487 frag_no = ath11k_dp_rx_h_mpdu_start_frag_no(ar->ab, msdu);
34593488 more_frags = ath11k_dp_rx_h_mpdu_start_more_frags(ar->ab, msdu);
3489+ is_mcbc = ath11k_dp_rx_h_attn_is_mcbc(ar->ab, rx_desc);
3490+
3491+ /* Multicast/Broadcast fragments are not expected */
3492+ if (is_mcbc)
3493+ return -EINVAL;
34603494
34613495 if (!ath11k_dp_rx_h_mpdu_start_seq_ctrl_valid(ar->ab, rx_desc) ||
34623496 !ath11k_dp_rx_h_mpdu_start_fc_valid(ar->ab, rx_desc) ||
drivers/net/wireless/ath/ath11k/dp_rx.h+1−0
@@ -49,6 +49,7 @@ int ath11k_dp_peer_rx_pn_replay_config(struct ath11k_vif *arvif, · 48 unmodified lines
4949 const u8 *peer_addr,
5050 enum set_key_cmd key_cmd,
5151 struct ieee80211_key_conf *key);
52+void ath11k_peer_frags_flush(struct ath11k *ar, struct ath11k_peer *peer);
5253 void ath11k_peer_rx_tid_cleanup(struct ath11k *ar, struct ath11k_peer *peer);
5354 void ath11k_peer_rx_tid_delete(struct ath11k *ar,
5455 struct ath11k_peer *peer, u8 tid);
drivers/net/wireless/ath/ath11k/mac.c+6−0
@@ -2779,6 +2779,12 @@ static int ath11k_mac_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, · 2778 unmodified lines
27792779 */
27802780 spin_lock_bh(&ab->base_lock);
27812781 peer = ath11k_peer_find(ab, arvif->vdev_id, peer_addr);
2782+
2783+ /* flush the fragments cache during key (re)install to
2784+ * ensure all frags in the new frag list belong to the same key.
2785+ */
2786+ if (peer && cmd == SET_KEY)
2787+ ath11k_peer_frags_flush(ar, peer);
27822788 spin_unlock_bh(&ab->base_lock);
27832789
27842790 if (!peer) {
drivers/net/wireless/mac80211_hwsim.c+5−0
@@ -1693,8 +1693,13 @@ static int mac80211_hwsim_start(struct ieee80211_hw *hw) · 1692 unmodified lines
16931693 static void mac80211_hwsim_stop(struct ieee80211_hw *hw)
16941694 {
16951695 struct mac80211_hwsim_data *data = hw->priv;
1696+
16961697 data->started = false;
16971698 hrtimer_cancel(&data->beacon_timer);
1699+
1700+ while (!skb_queue_empty(&data->pending))
1701+ ieee80211_free_txskb(hw, skb_dequeue(&data->pending));
1702+
16981703 wiphy_dbg(hw->wiphy, "%s\n", __func__);
16991704 }
17001705
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/nfc/nfcmrvl/fw_dnld.h+1−1
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * Marvell NFC driver: Firmware downloader
33 *
44 * Copyright (C) 2015, Marvell International Ltd.
drivers/nfc/nfcmrvl/i2c.c+1−1
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * Marvell NFC-over-I2C driver: I2C interface related functions
33 *
44 * Copyright (C) 2015, Marvell International Ltd.
drivers/nfc/nfcmrvl/nfcmrvl.h+1−1
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * Marvell NFC driver
33 *
44 * Copyright (C) 2014-2015, Marvell International Ltd.
drivers/nfc/nfcmrvl/spi.c+1−1
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * Marvell NFC-over-SPI driver: SPI interface related functions
33 *
44 * Copyright (C) 2015, Marvell International Ltd.
drivers/nfc/nfcmrvl/uart.c+1−1
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * Marvell NFC-over-UART driver
33 *
44 * Copyright (C) 2015, Marvell International Ltd.
drivers/nfc/nfcmrvl/usb.c+1−1
@@ -1,4 +1,4 @@
1−/**
1+/*
22 * Marvell NFC-over-USB driver: USB interface related functions
33 *
44 * Copyright (C) 2014, Marvell International Ltd.
drivers/nvme/host/Kconfig+2−1
@@ -71,7 +71,8 @@ config NVME_FC · 70 unmodified lines
7171 config NVME_TCP
7272 tristate "NVM Express over Fabrics TCP host driver"
7373 depends on INET
74− depends on BLK_DEV_NVME
74+ depends on BLOCK
75+ select NVME_CORE
7576 select NVME_FABRICS
7677 select CRYPTO
7778 select CRYPTO_CRC32C
drivers/nvme/host/core.c+3−1
@@ -3485,8 +3485,10 @@ int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device, · 3484 unmodified lines
34853485 cdev_init(cdev, fops);
34863486 cdev->owner = owner;
34873487 ret = cdev_device_add(cdev, cdev_device);
3488− if (ret)
3488+ if (ret) {
3489+ put_device(cdev_device);
34893490 ida_simple_remove(&nvme_ns_chr_minor_ida, minor);
3491+ }
34903492 return ret;
34913493 }
34923494
drivers/nvme/host/fabrics.c+5−0
@@ -336,6 +336,11 @@ static void nvmf_log_connect_error(struct nvme_ctrl *ctrl, · 335 unmodified lines
336336 cmd->connect.recfmt);
337337 break;
338338
339+ case NVME_SC_HOST_PATH_ERROR:
340+ dev_err(ctrl->device,
341+ "Connect command failed: host path error\n");
342+ break;
343+
339344 default:
340345 dev_err(ctrl->device,
341346 "Connect command failed, error wo/DNR bit: %d\n",
drivers/nvme/host/fc.c+17−8
@@ -3107,6 +3107,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 3106 unmodified lines
31073107 if (ctrl->ctrl.icdoff) {
31083108 dev_err(ctrl->ctrl.device, "icdoff %d is not supported!\n",
31093109 ctrl->ctrl.icdoff);
3110+ ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
31103111 goto out_disconnect_admin_queue;
31113112 }
31123113
@@ -3114,6 +3115,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 1 unmodified line
31143115 if (!(ctrl->ctrl.sgls & ((1 << 0) | (1 << 1)))) {
31153116 dev_err(ctrl->ctrl.device,
31163117 "Mandatory sgls are not supported!\n");
3118+ ret = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
31173119 goto out_disconnect_admin_queue;
31183120 }
31193121
@@ -3280,11 +3282,13 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) · 160 unmodified lines
32803282 if (ctrl->ctrl.state != NVME_CTRL_CONNECTING)
32813283 return;
32823284
3283− if (portptr->port_state == FC_OBJSTATE_ONLINE)
3285+ if (portptr->port_state == FC_OBJSTATE_ONLINE) {
32843286 dev_info(ctrl->ctrl.device,
32853287 "NVME-FC{%d}: reset: Reconnect attempt failed (%d)\n",
32863288 ctrl->cnum, status);
3287− else if (time_after_eq(jiffies, rport->dev_loss_end))
3289+ if (status > 0 && (status & NVME_SC_DNR))
3290+ recon = false;
3291+ } else if (time_after_eq(jiffies, rport->dev_loss_end))
32883292 recon = false;
32893293
32903294 if (recon && nvmf_should_reconnect(&ctrl->ctrl)) {
@@ -3298,12 +3302,17 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) · 7 unmodified lines
32983302
32993303 queue_delayed_work(nvme_wq, &ctrl->connect_work, recon_delay);
33003304 } else {
3301− if (portptr->port_state == FC_OBJSTATE_ONLINE)
3302− dev_warn(ctrl->ctrl.device,
3303− "NVME-FC{%d}: Max reconnect attempts (%d) "
3304− "reached.\n",
3305− ctrl->cnum, ctrl->ctrl.nr_reconnects);
3306− else
3305+ if (portptr->port_state == FC_OBJSTATE_ONLINE) {
3306+ if (status > 0 && (status & NVME_SC_DNR))
3307+ dev_warn(ctrl->ctrl.device,
3308+ "NVME-FC{%d}: reconnect failure\n",
3309+ ctrl->cnum);
3310+ else
3311+ dev_warn(ctrl->ctrl.device,
3312+ "NVME-FC{%d}: Max reconnect attempts "
3313+ "(%d) reached.\n",
3314+ ctrl->cnum, ctrl->ctrl.nr_reconnects);
3315+ } else
33073316 dev_warn(ctrl->ctrl.device,
33083317 "NVME-FC{%d}: dev_loss_tmo (%d) expired "
33093318 "while waiting for remoteport connectivity.\n",
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+27−21
@@ -388,10 +388,10 @@ static void nvmet_keep_alive_timer(struct work_struct *work) · 387 unmodified lines
388388 {
389389 struct nvmet_ctrl *ctrl = container_of(to_delayed_work(work),
390390 struct nvmet_ctrl, ka_work);
391− bool cmd_seen = ctrl->cmd_seen;
391+ bool reset_tbkas = ctrl->reset_tbkas;
392392
393− ctrl->cmd_seen = false;
394− if (cmd_seen) {
393+ ctrl->reset_tbkas = false;
394+ if (reset_tbkas) {
395395 pr_debug("ctrl %d reschedule traffic based keep-alive timer\n",
396396 ctrl->cntlid);
397397 schedule_delayed_work(&ctrl->ka_work, ctrl->kato * HZ);
@@ -804,6 +804,13 @@ void nvmet_sq_destroy(struct nvmet_sq *sq) · 406 unmodified lines
804804 percpu_ref_exit(&sq->ref);
805805
806806 if (ctrl) {
807+ /*
808+ * The teardown flow may take some time, and the host may not
809+ * send us keep-alive during this period, hence reset the
810+ * traffic based keep-alive timer so we don't trigger a
811+ * controller teardown as a result of a keep-alive expiration.
812+ */
813+ ctrl->reset_tbkas = true;
807814 nvmet_ctrl_put(ctrl);
808815 sq->ctrl = NULL; /* allows reusing the queue later */
809816 }
@@ -952,7 +959,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, · 142 unmodified lines
952959 }
953960
954961 if (sq->ctrl)
955− sq->ctrl->cmd_seen = true;
962+ sq->ctrl->reset_tbkas = true;
956963
957964 return true;
958965
@@ -998,19 +1005,23 @@ static unsigned int nvmet_data_transfer_len(struct nvmet_req *req) · 39 unmodified lines
9981005 return req->transfer_len - req->metadata_len;
9991006 }
10001007
1001−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)
10021010 {
1003− req->sg = pci_p2pmem_alloc_sgl(req->p2p_dev, &req->sg_cnt,
1011+ req->sg = pci_p2pmem_alloc_sgl(p2p_dev, &req->sg_cnt,
10041012 nvmet_data_transfer_len(req));
10051013 if (!req->sg)
10061014 goto out_err;
10071015
10081016 if (req->metadata_len) {
1009− req->metadata_sg = pci_p2pmem_alloc_sgl(req->p2p_dev,
1017+ req->metadata_sg = pci_p2pmem_alloc_sgl(p2p_dev,
10101018 &req->metadata_sg_cnt, req->metadata_len);
10111019 if (!req->metadata_sg)
10121020 goto out_free_sg;
10131021 }
1022+
1023+ req->p2p_dev = p2p_dev;
1024+
10141025 return 0;
10151026 out_free_sg:
10161027 pci_p2pmem_free_sgl(req->p2p_dev, req->sg);
@@ -1018,25 +1029,19 @@ out_err: · 1 unmodified line
10181029 return -ENOMEM;
10191030 }
10201031
1021−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)
10221033 {
1023− if (!IS_ENABLED(CONFIG_PCI_P2PDMA))
1024− return false;
1025−
1026− if (req->sq->ctrl && req->sq->qid && req->ns) {
1027− req->p2p_dev = radix_tree_lookup(&req->sq->ctrl->p2p_ns_map,
1028− req->ns->nsid);
1029− if (req->p2p_dev)
1030− return true;
1031− }
1032−
1033− req->p2p_dev = NULL;
1034− 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);
10351038 }
10361039
10371040 int nvmet_req_alloc_sgls(struct nvmet_req *req)
10381041 {
1039− 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))
10401045 return 0;
10411046
10421047 req->sg = sgl_alloc(nvmet_data_transfer_len(req), GFP_KERNEL,
@@ -1065,6 +1070,7 @@ void nvmet_req_free_sgls(struct nvmet_req *req) · 22 unmodified lines
10651070 pci_p2pmem_free_sgl(req->p2p_dev, req->sg);
10661071 if (req->metadata_sg)
10671072 pci_p2pmem_free_sgl(req->p2p_dev, req->metadata_sg);
1073+ req->p2p_dev = NULL;
10681074 } else {
10691075 sgl_free(req->sg);
10701076 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/nvme/target/nvmet.h+1−1
@@ -167,7 +167,7 @@ struct nvmet_ctrl { · 166 unmodified lines
167167 struct nvmet_subsys *subsys;
168168 struct nvmet_sq **sqs;
169169
170− bool cmd_seen;
170+ bool reset_tbkas;
171171
172172 struct mutex lock;
173173 u64 cap;
drivers/nvme/target/tcp.c+1−1
@@ -550,7 +550,7 @@ static void nvmet_tcp_queue_response(struct nvmet_req *req) · 549 unmodified lines
550550 * nvmet_req_init is completed.
551551 */
552552 if (queue->rcv_state == NVMET_TCP_RECV_PDU &&
553− len && len < cmd->req.port->inline_data_size &&
553+ len && len <= cmd->req.port->inline_data_size &&
554554 nvme_is_write(cmd->req.cmd))
555555 return;
556556 }
drivers/pci/controller/dwc/Makefile+2−1
@@ -18,6 +18,7 @@ obj-$(CONFIG_PCIE_INTEL_GW) += pcie-intel-gw.o · 17 unmodified lines
1818 obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
1919 obj-$(CONFIG_PCIE_HISI_STB) += pcie-histb.o
2020 obj-$(CONFIG_PCI_MESON) += pci-meson.o
21+obj-$(CONFIG_PCIE_TEGRA194) += pcie-tegra194.o
2122 obj-$(CONFIG_PCIE_UNIPHIER) += pcie-uniphier.o
2223 obj-$(CONFIG_PCIE_UNIPHIER_EP) += pcie-uniphier-ep.o
2324
@@ -38,6 +39,6 @@ ifdef CONFIG_ACPI · 14 unmodified lines
3839 ifdef CONFIG_PCI_QUIRKS
3940 obj-$(CONFIG_ARM64) += pcie-al.o
4041 obj-$(CONFIG_ARM64) += pcie-hisi.o
41−obj-$(CONFIG_ARM64) += pcie-tegra194.o
42+obj-$(CONFIG_ARM64) += pcie-tegra194-acpi.o
4243 endif
4344 endif
drivers/pci/controller/dwc/pcie-tegra194-acpi.c+108−0
@@ -0,0 +1,108 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+/*
3+ * ACPI quirks for Tegra194 PCIe host controller
4+ *
5+ * Copyright (C) 2021 NVIDIA Corporation.
6+ *
7+ * Author: Vidya Sagar <vidyas@nvidia.com>
8+ */
9+
10+#include <linux/pci.h>
11+#include <linux/pci-acpi.h>
12+#include <linux/pci-ecam.h>
13+
14+#include "pcie-designware.h"
15+
16+struct tegra194_pcie_ecam {
17+ void __iomem *config_base;
18+ void __iomem *iatu_base;
19+ void __iomem *dbi_base;
20+};
21+
22+static int tegra194_acpi_init(struct pci_config_window *cfg)
23+{
24+ struct device *dev = cfg->parent;
25+ struct tegra194_pcie_ecam *pcie_ecam;
26+
27+ pcie_ecam = devm_kzalloc(dev, sizeof(*pcie_ecam), GFP_KERNEL);
28+ if (!pcie_ecam)
29+ return -ENOMEM;
30+
31+ pcie_ecam->config_base = cfg->win;
32+ pcie_ecam->iatu_base = cfg->win + SZ_256K;
33+ pcie_ecam->dbi_base = cfg->win + SZ_512K;
34+ cfg->priv = pcie_ecam;
35+
36+ return 0;
37+}
38+
39+static void atu_reg_write(struct tegra194_pcie_ecam *pcie_ecam, int index,
40+ u32 val, u32 reg)
41+{
42+ u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index);
43+
44+ writel(val, pcie_ecam->iatu_base + offset + reg);
45+}
46+
47+static void program_outbound_atu(struct tegra194_pcie_ecam *pcie_ecam,
48+ int index, int type, u64 cpu_addr,
49+ u64 pci_addr, u64 size)
50+{
51+ atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr),
52+ PCIE_ATU_LOWER_BASE);
53+ atu_reg_write(pcie_ecam, index, upper_32_bits(cpu_addr),
54+ PCIE_ATU_UPPER_BASE);
55+ atu_reg_write(pcie_ecam, index, lower_32_bits(pci_addr),
56+ PCIE_ATU_LOWER_TARGET);
57+ atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr + size - 1),
58+ PCIE_ATU_LIMIT);
59+ atu_reg_write(pcie_ecam, index, upper_32_bits(pci_addr),
60+ PCIE_ATU_UPPER_TARGET);
61+ atu_reg_write(pcie_ecam, index, type, PCIE_ATU_CR1);
62+ atu_reg_write(pcie_ecam, index, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
63+}
64+
65+static void __iomem *tegra194_map_bus(struct pci_bus *bus,
66+ unsigned int devfn, int where)
67+{
68+ struct pci_config_window *cfg = bus->sysdata;
69+ struct tegra194_pcie_ecam *pcie_ecam = cfg->priv;
70+ u32 busdev;
71+ int type;
72+
73+ if (bus->number < cfg->busr.start || bus->number > cfg->busr.end)
74+ return NULL;
75+
76+ if (bus->number == cfg->busr.start) {
77+ if (PCI_SLOT(devfn) == 0)
78+ return pcie_ecam->dbi_base + where;
79+ else
80+ return NULL;
81+ }
82+
83+ busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) |
84+ PCIE_ATU_FUNC(PCI_FUNC(devfn));
85+
86+ if (bus->parent->number == cfg->busr.start) {
87+ if (PCI_SLOT(devfn) == 0)
88+ type = PCIE_ATU_TYPE_CFG0;
89+ else
90+ return NULL;
91+ } else {
92+ type = PCIE_ATU_TYPE_CFG1;
93+ }
94+
95+ program_outbound_atu(pcie_ecam, 0, type, cfg->res.start, busdev,
96+ SZ_256K);
97+
98+ return pcie_ecam->config_base + where;
99+}
100+
101+const struct pci_ecam_ops tegra194_pcie_ops = {
102+ .init = tegra194_acpi_init,
103+ .pci_ops = {
104+ .map_bus = tegra194_map_bus,
105+ .read = pci_generic_config_read,
106+ .write = pci_generic_config_write,
107+ }
108+};
drivers/pci/controller/dwc/pcie-tegra194.c+18−120
@@ -22,8 +22,6 @@ · 21 unmodified lines
2222 #include <linux/of_irq.h>
2323 #include <linux/of_pci.h>
2424 #include <linux/pci.h>
25−#include <linux/pci-acpi.h>
26−#include <linux/pci-ecam.h>
2725 #include <linux/phy/phy.h>
2826 #include <linux/pinctrl/consumer.h>
2927 #include <linux/platform_device.h>
@@ -247,24 +245,6 @@ static const unsigned int pcie_gen_freq[] = { · 217 unmodified lines
247245 GEN4_CORE_CLK_FREQ
248246 };
249247
250−static const u32 event_cntr_ctrl_offset[] = {
251− 0x1d8,
252− 0x1a8,
253− 0x1a8,
254− 0x1a8,
255− 0x1c4,
256− 0x1d8
257−};
258−
259−static const u32 event_cntr_data_offset[] = {
260− 0x1dc,
261− 0x1ac,
262− 0x1ac,
263− 0x1ac,
264− 0x1c8,
265− 0x1dc
266−};
267−
268248 struct tegra_pcie_dw {
269249 struct device *dev;
270250 struct resource *appl_res;
@@ -313,104 +293,6 @@ struct tegra_pcie_dw_of_data { · 42 unmodified lines
313293 enum dw_pcie_device_mode mode;
314294 };
315295
316−#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
317−struct tegra194_pcie_ecam {
318− void __iomem *config_base;
319− void __iomem *iatu_base;
320− void __iomem *dbi_base;
321−};
322−
323−static int tegra194_acpi_init(struct pci_config_window *cfg)
324−{
325− struct device *dev = cfg->parent;
326− struct tegra194_pcie_ecam *pcie_ecam;
327−
328− pcie_ecam = devm_kzalloc(dev, sizeof(*pcie_ecam), GFP_KERNEL);
329− if (!pcie_ecam)
330− return -ENOMEM;
331−
332− pcie_ecam->config_base = cfg->win;
333− pcie_ecam->iatu_base = cfg->win + SZ_256K;
334− pcie_ecam->dbi_base = cfg->win + SZ_512K;
335− cfg->priv = pcie_ecam;
336−
337− return 0;
338−}
339−
340−static void atu_reg_write(struct tegra194_pcie_ecam *pcie_ecam, int index,
341− u32 val, u32 reg)
342−{
343− u32 offset = PCIE_GET_ATU_OUTB_UNR_REG_OFFSET(index);
344−
345− writel(val, pcie_ecam->iatu_base + offset + reg);
346−}
347−
348−static void program_outbound_atu(struct tegra194_pcie_ecam *pcie_ecam,
349− int index, int type, u64 cpu_addr,
350− u64 pci_addr, u64 size)
351−{
352− atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr),
353− PCIE_ATU_LOWER_BASE);
354− atu_reg_write(pcie_ecam, index, upper_32_bits(cpu_addr),
355− PCIE_ATU_UPPER_BASE);
356− atu_reg_write(pcie_ecam, index, lower_32_bits(pci_addr),
357− PCIE_ATU_LOWER_TARGET);
358− atu_reg_write(pcie_ecam, index, lower_32_bits(cpu_addr + size - 1),
359− PCIE_ATU_LIMIT);
360− atu_reg_write(pcie_ecam, index, upper_32_bits(pci_addr),
361− PCIE_ATU_UPPER_TARGET);
362− atu_reg_write(pcie_ecam, index, type, PCIE_ATU_CR1);
363− atu_reg_write(pcie_ecam, index, PCIE_ATU_ENABLE, PCIE_ATU_CR2);
364−}
365−
366−static void __iomem *tegra194_map_bus(struct pci_bus *bus,
367− unsigned int devfn, int where)
368−{
369− struct pci_config_window *cfg = bus->sysdata;
370− struct tegra194_pcie_ecam *pcie_ecam = cfg->priv;
371− u32 busdev;
372− int type;
373−
374− if (bus->number < cfg->busr.start || bus->number > cfg->busr.end)
375− return NULL;
376−
377− if (bus->number == cfg->busr.start) {
378− if (PCI_SLOT(devfn) == 0)
379− return pcie_ecam->dbi_base + where;
380− else
381− return NULL;
382− }
383−
384− busdev = PCIE_ATU_BUS(bus->number) | PCIE_ATU_DEV(PCI_SLOT(devfn)) |
385− PCIE_ATU_FUNC(PCI_FUNC(devfn));
386−
387− if (bus->parent->number == cfg->busr.start) {
388− if (PCI_SLOT(devfn) == 0)
389− type = PCIE_ATU_TYPE_CFG0;
390− else
391− return NULL;
392− } else {
393− type = PCIE_ATU_TYPE_CFG1;
394− }
395−
396− program_outbound_atu(pcie_ecam, 0, type, cfg->res.start, busdev,
397− SZ_256K);
398−
399− return pcie_ecam->config_base + where;
400−}
401−
402−const struct pci_ecam_ops tegra194_pcie_ops = {
403− .init = tegra194_acpi_init,
404− .pci_ops = {
405− .map_bus = tegra194_map_bus,
406− .read = pci_generic_config_read,
407− .write = pci_generic_config_write,
408− }
409−};
410−#endif /* defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS) */
411−
412−#ifdef CONFIG_PCIE_TEGRA194
413−
414296 static inline struct tegra_pcie_dw *to_tegra_pcie(struct dw_pcie *pci)
415297 {
416298 return container_of(pci, struct tegra_pcie_dw, pci);
@@ -694,6 +576,24 @@ static struct pci_ops tegra_pci_ops = { · 277 unmodified lines
694576 };
695577
696578 #if defined(CONFIG_PCIEASPM)
579+static const u32 event_cntr_ctrl_offset[] = {
580+ 0x1d8,
581+ 0x1a8,
582+ 0x1a8,
583+ 0x1a8,
584+ 0x1c4,
585+ 0x1d8
586+};
587+
588+static const u32 event_cntr_data_offset[] = {
589+ 0x1dc,
590+ 0x1ac,
591+ 0x1ac,
592+ 0x1ac,
593+ 0x1c8,
594+ 0x1dc
595+};
596+
697597 static void disable_aspm_l11(struct tegra_pcie_dw *pcie)
698598 {
699599 u32 val;
@@ -2411,5 +2311,3 @@ MODULE_DEVICE_TABLE(of, tegra_pcie_dw_of_match); · 1711 unmodified lines
24112311 MODULE_AUTHOR("Vidya Sagar <vidyas@nvidia.com>");
24122312 MODULE_DESCRIPTION("NVIDIA PCIe host controller driver");
24132313 MODULE_LICENSE("GPL v2");
2414−
2415−#endif /* CONFIG_PCIE_TEGRA194 */
drivers/pci/controller/pci-aardvark.c+40−9
@@ -514,7 +514,7 @@ static int advk_pcie_wait_pio(struct advk_pcie *pcie) · 513 unmodified lines
514514 udelay(PIO_RETRY_DELAY);
515515 }
516516
517− dev_err(dev, "config read/write timed out\n");
517+ dev_err(dev, "PIO read/write transfer time out\n");
518518 return -ETIMEDOUT;
519519 }
520520
@@ -657,6 +657,35 @@ static bool advk_pcie_valid_device(struct advk_pcie *pcie, struct pci_bus *bus, · 136 unmodified lines
657657 return true;
658658 }
659659
660+static bool advk_pcie_pio_is_running(struct advk_pcie *pcie)
661+{
662+ struct device *dev = &pcie->pdev->dev;
663+
664+ /*
665+ * Trying to start a new PIO transfer when previous has not completed
666+ * cause External Abort on CPU which results in kernel panic:
667+ *
668+ * SError Interrupt on CPU0, code 0xbf000002 -- SError
669+ * Kernel panic - not syncing: Asynchronous SError Interrupt
670+ *
671+ * Functions advk_pcie_rd_conf() and advk_pcie_wr_conf() are protected
672+ * by raw_spin_lock_irqsave() at pci_lock_config() level to prevent
673+ * concurrent calls at the same time. But because PIO transfer may take
674+ * about 1.5s when link is down or card is disconnected, it means that
675+ * advk_pcie_wait_pio() does not always have to wait for completion.
676+ *
677+ * Some versions of ARM Trusted Firmware handles this External Abort at
678+ * EL3 level and mask it to prevent kernel panic. Relevant TF-A commit:
679+ * https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=3c7dcdac5c50
680+ */
681+ if (advk_readl(pcie, PIO_START)) {
682+ dev_err(dev, "Previous PIO read/write transfer is still running\n");
683+ return true;
684+ }
685+
686+ return false;
687+}
688+
660689 static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,
661690 int where, int size, u32 *val)
662691 {
@@ -673,9 +702,10 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, · 10 unmodified lines
673702 return pci_bridge_emul_conf_read(&pcie->bridge, where,
674703 size, val);
675704
676− /* Start PIO */
677− advk_writel(pcie, 0, PIO_START);
678− advk_writel(pcie, 1, PIO_ISR);
705+ if (advk_pcie_pio_is_running(pcie)) {
706+ *val = 0xffffffff;
707+ return PCIBIOS_SET_FAILED;
708+ }
679709
680710 /* Program the control register */
681711 reg = advk_readl(pcie, PIO_CTRL);
@@ -694,7 +724,8 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn, · 12 unmodified lines
694724 /* Program the data strobe */
695725 advk_writel(pcie, 0xf, PIO_WR_DATA_STRB);
696726
697− /* Start the transfer */
727+ /* Clear PIO DONE ISR and start the transfer */
728+ advk_writel(pcie, 1, PIO_ISR);
698729 advk_writel(pcie, 1, PIO_START);
699730
700731 ret = advk_pcie_wait_pio(pcie);
@@ -734,9 +765,8 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · 33 unmodified lines
734765 if (where % size)
735766 return PCIBIOS_SET_FAILED;
736767
737− /* Start PIO */
738− advk_writel(pcie, 0, PIO_START);
739− advk_writel(pcie, 1, PIO_ISR);
768+ if (advk_pcie_pio_is_running(pcie))
769+ return PCIBIOS_SET_FAILED;
740770
741771 /* Program the control register */
742772 reg = advk_readl(pcie, PIO_CTRL);
@@ -763,7 +793,8 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · 20 unmodified lines
763793 /* Program the data strobe */
764794 advk_writel(pcie, data_strobe, PIO_WR_DATA_STRB);
765795
766− /* Start the transfer */
796+ /* Clear PIO DONE ISR and start the transfer */
797+ advk_writel(pcie, 1, PIO_ISR);
767798 advk_writel(pcie, 1, PIO_START);
768799
769800 ret = advk_pcie_wait_pio(pcie);
drivers/pci/of.c+9−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 {
@@ -346,6 +353,8 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, · 237 unmodified lines
346353 dev_warn(dev, "More than one I/O resource converted for %pOF. CPU base address for old range lost!\n",
347354 dev_node);
348355 *io_base = range.cpu_addr;
356+ } else if (resource_type(res) == IORESOURCE_MEM) {
357+ res->flags &= ~IORESOURCE_MEM_64;
349358 }
350359
351360 pci_add_resource_offset(resources, res, res->start - range.pci_addr);
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/pci/quirks.c+92−1
@@ -3546,6 +3546,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev) · 3545 unmodified lines
35463546 dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
35473547 }
35483548
3549+/*
3550+ * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be
3551+ * prevented for those affected devices.
3552+ */
3553+static void quirk_nvidia_no_bus_reset(struct pci_dev *dev)
3554+{
3555+ if ((dev->device & 0xffc0) == 0x2340)
3556+ quirk_no_bus_reset(dev);
3557+}
3558+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
3559+ quirk_nvidia_no_bus_reset);
3560+
35493561 /*
35503562 * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset.
35513563 * The device will throw a Link Down error on AER-capable systems and
@@ -3566,6 +3578,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset); · 14 unmodified lines
35663578 */
35673579 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CAVIUM, 0xa100, quirk_no_bus_reset);
35683580
3581+/*
3582+ * Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS
3583+ * automatically disables LTSSM when Secondary Bus Reset is received and
3584+ * the device stops working. Prevent bus reset for these devices. With
3585+ * this change, the device can be assigned to VMs with VFIO, but it will
3586+ * leak state between VMs. Reference
3587+ * https://e2e.ti.com/support/processors/f/791/t/954382
3588+ */
3589+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0xb005, quirk_no_bus_reset);
3590+
35693591 static void quirk_no_pm_reset(struct pci_dev *dev)
35703592 {
35713593 /*
@@ -3901,6 +3923,69 @@ static int delay_250ms_after_flr(struct pci_dev *dev, int probe) · 329 unmodified lines
39013923 return 0;
39023924 }
39033925
3926+#define PCI_DEVICE_ID_HINIC_VF 0x375E
3927+#define HINIC_VF_FLR_TYPE 0x1000
3928+#define HINIC_VF_FLR_CAP_BIT (1UL << 30)
3929+#define HINIC_VF_OP 0xE80
3930+#define HINIC_VF_FLR_PROC_BIT (1UL << 18)
3931+#define HINIC_OPERATION_TIMEOUT 15000 /* 15 seconds */
3932+
3933+/* Device-specific reset method for Huawei Intelligent NIC virtual functions */
3934+static int reset_hinic_vf_dev(struct pci_dev *pdev, int probe)
3935+{
3936+ unsigned long timeout;
3937+ void __iomem *bar;
3938+ u32 val;
3939+
3940+ if (probe)
3941+ return 0;
3942+
3943+ bar = pci_iomap(pdev, 0, 0);
3944+ if (!bar)
3945+ return -ENOTTY;
3946+
3947+ /* Get and check firmware capabilities */
3948+ val = ioread32be(bar + HINIC_VF_FLR_TYPE);
3949+ if (!(val & HINIC_VF_FLR_CAP_BIT)) {
3950+ pci_iounmap(pdev, bar);
3951+ return -ENOTTY;
3952+ }
3953+
3954+ /* Set HINIC_VF_FLR_PROC_BIT for the start of FLR */
3955+ val = ioread32be(bar + HINIC_VF_OP);
3956+ val = val | HINIC_VF_FLR_PROC_BIT;
3957+ iowrite32be(val, bar + HINIC_VF_OP);
3958+
3959+ pcie_flr(pdev);
3960+
3961+ /*
3962+ * The device must recapture its Bus and Device Numbers after FLR
3963+ * in order generate Completions. Issue a config write to let the
3964+ * device capture this information.
3965+ */
3966+ pci_write_config_word(pdev, PCI_VENDOR_ID, 0);
3967+
3968+ /* Firmware clears HINIC_VF_FLR_PROC_BIT when reset is complete */
3969+ timeout = jiffies + msecs_to_jiffies(HINIC_OPERATION_TIMEOUT);
3970+ do {
3971+ val = ioread32be(bar + HINIC_VF_OP);
3972+ if (!(val & HINIC_VF_FLR_PROC_BIT))
3973+ goto reset_complete;
3974+ msleep(20);
3975+ } while (time_before(jiffies, timeout));
3976+
3977+ val = ioread32be(bar + HINIC_VF_OP);
3978+ if (!(val & HINIC_VF_FLR_PROC_BIT))
3979+ goto reset_complete;
3980+
3981+ pci_warn(pdev, "Reset dev timeout, FLR ack reg: %#010x\n", val);
3982+
3983+reset_complete:
3984+ pci_iounmap(pdev, bar);
3985+
3986+ return 0;
3987+}
3988+
39043989 static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
39053990 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF,
39063991 reset_intel_82599_sfp_virtfn },
@@ -3913,6 +3998,8 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = { · 6 unmodified lines
39133998 { PCI_VENDOR_ID_INTEL, 0x0a54, delay_250ms_after_flr },
39143999 { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
39154000 reset_chelsio_generic_dev },
4001+ { PCI_VENDOR_ID_HUAWEI, PCI_DEVICE_ID_HINIC_VF,
4002+ reset_hinic_vf_dev },
39164003 { 0 }
39174004 };
39184005
@@ -4753,6 +4840,8 @@ static const struct pci_dev_acs_enabled { · 834 unmodified lines
47534840 { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs },
47544841 { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs },
47554842 { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs },
4843+ /* Broadcom multi-function device */
4844+ { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs },
47564845 { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs },
47574846 /* Amazon Annapurna Labs */
47584847 { PCI_VENDOR_ID_AMAZON_ANNAPURNA_LABS, 0x0031, pci_quirk_al_acs },
@@ -5154,7 +5243,8 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, 0x0422, quirk_no_ext_tags); · 395 unmodified lines
51545243 static void quirk_amd_harvest_no_ats(struct pci_dev *pdev)
51555244 {
51565245 if ((pdev->device == 0x7312 && pdev->revision != 0x00) ||
5157− (pdev->device == 0x7340 && pdev->revision != 0xc5))
5246+ (pdev->device == 0x7340 && pdev->revision != 0xc5) ||
5247+ (pdev->device == 0x7341 && pdev->revision != 0x00))
51585248 return;
51595249
51605250 if (pdev->device == 0x15d8) {
@@ -5181,6 +5271,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x6900, quirk_amd_harvest_no_ats); · 20 unmodified lines
51815271 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7312, quirk_amd_harvest_no_ats);
51825272 /* AMD Navi14 dGPU */
51835273 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7340, quirk_amd_harvest_no_ats);
5274+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x7341, quirk_amd_harvest_no_ats);
51845275 /* AMD Raven platform iGPU */
51855276 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x15d8, quirk_amd_harvest_no_ats);
51865277 #endif /* CONFIG_PCI_ATS */
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/ptp/ptp_clock.c+3−3
@@ -63,7 +63,7 @@ static void enqueue_external_timestamp(struct timestamp_event_queue *queue, · 62 unmodified lines
6363 spin_unlock_irqrestore(&queue->lock, flags);
6464 }
6565
66−s32 scaled_ppm_to_ppb(long ppm)
66+long scaled_ppm_to_ppb(long ppm)
6767 {
6868 /*
6969 * The 'freq' field in the 'struct timex' is in parts per
@@ -80,7 +80,7 @@ s32 scaled_ppm_to_ppb(long ppm) · 10 unmodified lines
8080 s64 ppb = 1 + ppm;
8181 ppb *= 125;
8282 ppb >>= 13;
83− return (s32) ppb;
83+ return (long) ppb;
8484 }
8585 EXPORT_SYMBOL(scaled_ppm_to_ppb);
8686
@@ -138,7 +138,7 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) · 51 unmodified lines
138138 delta = ktime_to_ns(kt);
139139 err = ops->adjtime(ops, delta);
140140 } else if (tx->modes & ADJ_FREQUENCY) {
141− s32 ppb = scaled_ppm_to_ppb(tx->freq);
141+ long ppb = scaled_ppm_to_ppb(tx->freq);
142142 if (ppb > ops->max_adj || ppb < -ops->max_adj)
143143 return -ERANGE;
144144 if (ops->adjfine)
drivers/ptp/ptp_ocp.c+3−1
@@ -324,7 +324,7 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 323 unmodified lines
324324 if (!bp->base) {
325325 dev_err(&pdev->dev, "io_remap bar0\n");
326326 err = -ENOMEM;
327− goto out;
327+ goto out_release_regions;
328328 }
329329 bp->reg = bp->base + OCP_REGISTER_OFFSET;
330330 bp->tod = bp->base + TOD_REGISTER_OFFSET;
@@ -347,6 +347,8 @@ ptp_ocp_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 16 unmodified lines
347347 return 0;
348348
349349 out:
350+ pci_iounmap(pdev, bp->base);
351+out_release_regions:
350352 pci_release_regions(pdev);
351353 out_disable:
352354 pci_disable_device(pdev);
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/s390/block/dasd_diag.c+7−1
@@ -642,12 +642,18 @@ static void dasd_diag_setup_blk_queue(struct dasd_block *block) · 641 unmodified lines
642642 blk_queue_segment_boundary(q, PAGE_SIZE - 1);
643643 }
644644
645+static int dasd_diag_pe_handler(struct dasd_device *device,
646+ __u8 tbvpm, __u8 fcsecpm)
647+{
648+ return dasd_generic_verify_path(device, tbvpm);
649+}
650+
645651 static struct dasd_discipline dasd_diag_discipline = {
646652 .owner = THIS_MODULE,
647653 .name = "DIAG",
648654 .ebcname = "DIAG",
649655 .check_device = dasd_diag_check_device,
650− .verify_path = dasd_generic_verify_path,
656+ .pe_handler = dasd_diag_pe_handler,
651657 .fill_geometry = dasd_diag_fill_geometry,
652658 .setup_blk_queue = dasd_diag_setup_blk_queue,
653659 .start_IO = dasd_start_diag,
drivers/s390/block/dasd_fba.c+7−1
@@ -794,13 +794,19 @@ static void dasd_fba_setup_blk_queue(struct dasd_block *block) · 793 unmodified lines
794794 blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
795795 }
796796
797+static int dasd_fba_pe_handler(struct dasd_device *device,
798+ __u8 tbvpm, __u8 fcsecpm)
799+{
800+ return dasd_generic_verify_path(device, tbvpm);
801+}
802+
797803 static struct dasd_discipline dasd_fba_discipline = {
798804 .owner = THIS_MODULE,
799805 .name = "FBA ",
800806 .ebcname = "FBA ",
801807 .check_device = dasd_fba_check_characteristics,
802808 .do_analysis = dasd_fba_do_analysis,
803− .verify_path = dasd_generic_verify_path,
809+ .pe_handler = dasd_fba_pe_handler,
804810 .setup_blk_queue = dasd_fba_setup_blk_queue,
805811 .fill_geometry = dasd_fba_fill_geometry,
806812 .start_IO = dasd_start_IO,
drivers/s390/block/dasd_int.h+0−1
@@ -297,7 +297,6 @@ struct dasd_discipline { · 296 unmodified lines
297297 * e.g. verify that new path is compatible with the current
298298 * configuration.
299299 */
300− int (*verify_path)(struct dasd_device *, __u8);
301300 int (*pe_handler)(struct dasd_device *, __u8, __u8);
302301
303302 /*
drivers/s390/cio/vfio_ccw_cp.c+4−0
@@ -638,6 +638,10 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb) · 637 unmodified lines
638638 static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 1);
639639 int ret;
640640
641+ /* this is an error in the caller */
642+ if (cp->initialized)
643+ return -EBUSY;
644+
641645 /*
642646 * We only support prefetching the channel program. We assume all channel
643647 * programs executed by supported guests likewise support prefetching.
drivers/s390/cio/vfio_ccw_drv.c+10−2
@@ -86,6 +86,7 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) · 85 unmodified lines
8686 struct vfio_ccw_private *private;
8787 struct irb *irb;
8888 bool is_final;
89+ bool cp_is_finished = false;
8990
9091 private = container_of(work, struct vfio_ccw_private, io_work);
9192 irb = &private->irb;
@@ -94,14 +95,21 @@ static void vfio_ccw_sch_io_todo(struct work_struct *work) · 2 unmodified lines
9495 (SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT));
9596 if (scsw_is_solicited(&irb->scsw)) {
9697 cp_update_scsw(&private->cp, &irb->scsw);
97− if (is_final && private->state == VFIO_CCW_STATE_CP_PENDING)
98+ if (is_final && private->state == VFIO_CCW_STATE_CP_PENDING) {
9899 cp_free(&private->cp);
100+ cp_is_finished = true;
101+ }
99102 }
100103 mutex_lock(&private->io_mutex);
101104 memcpy(private->io_region->irb_area, irb, sizeof(*irb));
102105 mutex_unlock(&private->io_mutex);
103106
104− if (private->mdev && is_final)
107+ /*
108+ * Reset to IDLE only if processing of a channel program
109+ * has finished. Do not overwrite a possible processing
110+ * state if the final interrupt was for HSCH or CSCH.
111+ */
112+ if (private->mdev && cp_is_finished)
105113 private->state = VFIO_CCW_STATE_IDLE;
106114
107115 if (private->io_trigger)
drivers/s390/cio/vfio_ccw_fsm.c+1−0
@@ -318,6 +318,7 @@ static void fsm_io_request(struct vfio_ccw_private *private, · 317 unmodified lines
318318 }
319319
320320 err_out:
321+ private->state = VFIO_CCW_STATE_IDLE;
321322 trace_vfio_ccw_fsm_io_request(scsw->cmd.fctl, schid,
322323 io_region->ret_code, errstr);
323324 }
drivers/s390/cio/vfio_ccw_ops.c+0−2
@@ -279,8 +279,6 @@ static ssize_t vfio_ccw_mdev_write_io_region(struct vfio_ccw_private *private, · 278 unmodified lines
279279 }
280280
281281 vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_IO_REQ);
282− if (region->ret_code != 0)
283− private->state = VFIO_CCW_STATE_IDLE;
284282 ret = (region->ret_code != 0) ? region->ret_code : count;
285283
286284 out_unlock:
drivers/s390/crypto/ap_queue.c+9−2
@@ -135,12 +135,13 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq) · 134 unmodified lines
135135 {
136136 struct ap_queue_status status;
137137 struct ap_message *ap_msg;
138+ bool found = false;
138139
139140 status = ap_dqap(aq->qid, &aq->reply->psmid,
140141 aq->reply->msg, aq->reply->len);
141142 switch (status.response_code) {
142143 case AP_RESPONSE_NORMAL:
143− aq->queue_count--;
144+ aq->queue_count = max_t(int, 0, aq->queue_count - 1);
144145 if (aq->queue_count > 0)
145146 mod_timer(&aq->timeout,
146147 jiffies + aq->request_timeout);
@@ -150,8 +151,14 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq) · 3 unmodified lines
150151 list_del_init(&ap_msg->list);
151152 aq->pendingq_count--;
152153 ap_msg->receive(aq, ap_msg, aq->reply);
154+ found = true;
153155 break;
154156 }
157+ if (!found) {
158+ AP_DBF_WARN("%s unassociated reply psmid=0x%016llx on 0x%02x.%04x\n",
159+ __func__, aq->reply->psmid,
160+ AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid));
161+ }
155162 fallthrough;
156163 case AP_RESPONSE_NO_PENDING_REPLY:
157164 if (!status.queue_empty || aq->queue_count <= 0)
@@ -232,7 +239,7 @@ static enum ap_sm_wait ap_sm_write(struct ap_queue *aq) · 74 unmodified lines
232239 ap_msg->flags & AP_MSG_FLAG_SPECIAL);
233240 switch (status.response_code) {
234241 case AP_RESPONSE_NORMAL:
235− aq->queue_count++;
242+ aq->queue_count = max_t(int, 1, aq->queue_count + 1);
236243 if (aq->queue_count == 1)
237244 mod_timer(&aq->timeout, jiffies + aq->request_timeout);
238245 list_move_tail(&ap_msg->list, &aq->pendingq);
drivers/scsi/aic7xxx/aicasm/aicasm_gram.y+0−1
@@ -58,7 +58,6 @@ · 57 unmodified lines
5858 #include "aicasm_symbol.h"
5959 #include "aicasm_insformat.h"
6060
61−int yylineno;
6261 char *yyfilename;
6362 char stock_prefix[] = "aic_";
6463 char *prefix = stock_prefix;
drivers/scsi/aic7xxx/aicasm/aicasm_symbol.h+1−1
@@ -108,7 +108,7 @@ struct macro_arg { · 107 unmodified lines
108108 regex_t arg_regex;
109109 char *replacement_text;
110110 };
111−STAILQ_HEAD(macro_arg_list, macro_arg) args;
111+STAILQ_HEAD(macro_arg_list, macro_arg);
112112
113113 struct macro_info {
114114 struct macro_arg_list args;
drivers/scsi/aic7xxx/scsi_message.h+11−0
@@ -3,6 +3,17 @@ · 2 unmodified lines
33 * $FreeBSD: src/sys/cam/scsi/scsi_message.h,v 1.2 2000/05/01 20:21:29 peter Exp $
44 */
55
6+/* Messages (1 byte) */ /* I/T (M)andatory or (O)ptional */
7+#define MSG_SAVEDATAPOINTER 0x02 /* O/O */
8+#define MSG_RESTOREPOINTERS 0x03 /* O/O */
9+#define MSG_DISCONNECT 0x04 /* O/O */
10+#define MSG_MESSAGE_REJECT 0x07 /* M/M */
11+#define MSG_NOOP 0x08 /* M/M */
12+
13+/* Messages (2 byte) */
14+#define MSG_SIMPLE_Q_TAG 0x20 /* O/O */
15+#define MSG_IGN_WIDE_RESIDUE 0x23 /* O/O */
16+
617 /* Identify message */ /* M/M */
718 #define MSG_IDENTIFYFLAG 0x80
819 #define MSG_IDENTIFY_DISCFLAG 0x40
drivers/scsi/bnx2fc/bnx2fc_io.c+1−0
@@ -1220,6 +1220,7 @@ int bnx2fc_eh_abort(struct scsi_cmnd *sc_cmd) · 1219 unmodified lines
12201220 was a result from the ABTS request rather than the CLEANUP
12211221 request */
12221222 set_bit(BNX2FC_FLAG_IO_CLEANUP, &io_req->req_flags);
1223+ rc = FAILED;
12231224 goto done;
12241225 }
12251226
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c+4−4
@@ -4811,14 +4811,14 @@ hisi_sas_v3_destroy_irqs(struct pci_dev *pdev, struct hisi_hba *hisi_hba) · 4810 unmodified lines
48114811 {
48124812 int i;
48134813
4814− free_irq(pci_irq_vector(pdev, 1), hisi_hba);
4815− free_irq(pci_irq_vector(pdev, 2), hisi_hba);
4816− free_irq(pci_irq_vector(pdev, 11), hisi_hba);
4814+ devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 1), hisi_hba);
4815+ devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 2), hisi_hba);
4816+ devm_free_irq(&pdev->dev, pci_irq_vector(pdev, 11), hisi_hba);
48174817 for (i = 0; i < hisi_hba->cq_nvecs; i++) {
48184818 struct hisi_sas_cq *cq = &hisi_hba->cq[i];
48194819 int nr = hisi_sas_intr_conv ? 16 : 16 + i;
48204820
4821− free_irq(pci_irq_vector(pdev, nr), cq);
4821+ devm_free_irq(&pdev->dev, pci_irq_vector(pdev, nr), cq);
48224822 }
48234823 pci_free_irq_vectors(pdev);
48244824 }
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/libsas/sas_port.c+2−2
@@ -25,7 +25,7 @@ static bool phy_is_wideport_member(struct asd_sas_port *port, struct asd_sas_phy · 24 unmodified lines
2525
2626 static void sas_resume_port(struct asd_sas_phy *phy)
2727 {
28− struct domain_device *dev;
28+ struct domain_device *dev, *n;
2929 struct asd_sas_port *port = phy->port;
3030 struct sas_ha_struct *sas_ha = phy->ha;
3131 struct sas_internal *si = to_sas_internal(sas_ha->core.shost->transportt);
@@ -44,7 +44,7 @@ static void sas_resume_port(struct asd_sas_phy *phy) · 12 unmodified lines
4444 * 1/ presume every device came back
4545 * 2/ force the next revalidation to check all expander phys
4646 */
47− list_for_each_entry(dev, &port->dev_list, dev_list_node) {
47+ list_for_each_entry_safe(dev, n, &port->dev_list, dev_list_node) {
4848 int i, rc;
4949
5050 rc = sas_notify_lldd_dev_found(dev);
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/qla2xxx/qla_target.c+2−0
@@ -1563,10 +1563,12 @@ void qlt_stop_phase2(struct qla_tgt *tgt) · 1562 unmodified lines
15631563 return;
15641564 }
15651565
1566+ mutex_lock(&tgt->ha->optrom_mutex);
15661567 mutex_lock(&vha->vha_tgt.tgt_mutex);
15671568 tgt->tgt_stop = 0;
15681569 tgt->tgt_stopped = 1;
15691570 mutex_unlock(&vha->vha_tgt.tgt_mutex);
1571+ mutex_unlock(&tgt->ha->optrom_mutex);
15701572
15711573 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf00c, "Stop of tgt %p finished\n",
15721574 tgt);
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/scsi/vmw_pvscsi.c+7−1
@@ -585,7 +585,13 @@ static void pvscsi_complete_request(struct pvscsi_adapter *adapter, · 584 unmodified lines
585585 case BTSTAT_SUCCESS:
586586 case BTSTAT_LINKED_COMMAND_COMPLETED:
587587 case BTSTAT_LINKED_COMMAND_COMPLETED_WITH_FLAG:
588− /* If everything went fine, let's move on.. */
588+ /*
589+ * Commands like INQUIRY may transfer less data than
590+ * requested by the initiator via bufflen. Set residual
591+ * count to make upper layer aware of the actual amount
592+ * of data returned.
593+ */
594+ scsi_set_resid(cmd, scsi_bufflen(cmd) - e->dataLen);
589595 cmd->result = (DID_OK << 16);
590596 break;
591597
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/soundwire/qcom.c+10−2
@@ -1150,8 +1150,16 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl) · 1149 unmodified lines
11501150
11511151 ret = of_property_read_u8_array(np, "qcom,ports-block-pack-mode",
11521152 bp_mode, nports);
1153− if (ret)
1154− return ret;
1153+ if (ret) {
1154+ u32 version;
1155+
1156+ ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &version);
1157+
1158+ if (version <= 0x01030000)
1159+ memset(bp_mode, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
1160+ else
1161+ return ret;
1162+ }
11551163
11561164 memset(hstart, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
11571165 of_property_read_u8_array(np, "qcom,ports-hstart", hstart, nports);
drivers/spi/Kconfig+1−1
@@ -65,7 +65,7 @@ config SPI_ALTERA · 64 unmodified lines
6565 This is the driver for the Altera SPI Controller.
6666
6767 config SPI_ALTERA_CORE
68− tristate "Altera SPI Controller core code"
68+ tristate "Altera SPI Controller core code" if COMPILE_TEST
6969 select REGMAP
7070 help
7171 "The core code for the Altera SPI Controller"
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-dspi.c+3−1
@@ -1375,11 +1375,13 @@ poll_mode: · 1374 unmodified lines
13751375 ret = spi_register_controller(ctlr);
13761376 if (ret != 0) {
13771377 dev_err(&pdev->dev, "Problem registering DSPI ctlr\n");
1378− goto out_free_irq;
1378+ goto out_release_dma;
13791379 }
13801380
13811381 return ret;
13821382
1383+out_release_dma:
1384+ dspi_release_dma(dspi);
13831385 out_free_irq:
13841386 if (dspi->irq)
13851387 free_irq(dspi->irq, dspi);
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-sc18is602.c+8−1
@@ -174,7 +174,7 @@ static int sc18is602_setup_transfer(struct sc18is602 *hw, u32 hz, u8 mode) · 173 unmodified lines
174174 static int sc18is602_check_transfer(struct spi_device *spi,
175175 struct spi_transfer *t, int tlen)
176176 {
177− if (t && t->len + tlen > SC18IS602_BUFSIZ)
177+ if (t && t->len + tlen > SC18IS602_BUFSIZ + 1)
178178 return -EINVAL;
179179
180180 return 0;
@@ -219,6 +219,11 @@ static int sc18is602_transfer_one(struct spi_master *master, · 38 unmodified lines
219219 return status;
220220 }
221221
222+static size_t sc18is602_max_transfer_size(struct spi_device *spi)
223+{
224+ return SC18IS602_BUFSIZ;
225+}
226+
222227 static int sc18is602_setup(struct spi_device *spi)
223228 {
224229 struct sc18is602 *hw = spi_master_get_devdata(spi->master);
@@ -293,6 +298,8 @@ static int sc18is602_probe(struct i2c_client *client, · 68 unmodified lines
293298 master->bits_per_word_mask = SPI_BPW_MASK(8);
294299 master->setup = sc18is602_setup;
295300 master->transfer_one_message = sc18is602_transfer_one;
301+ master->max_transfer_size = sc18is602_max_transfer_size;
302+ master->max_message_size = sc18is602_max_transfer_size;
296303 master->dev.of_node = np;
297304 master->min_speed_hz = hw->freq / 128;
298305 master->max_speed_hz = hw->freq / 4;
drivers/spi/spi-sprd.c+1−0
@@ -1068,6 +1068,7 @@ static const struct of_device_id sprd_spi_of_match[] = { · 1067 unmodified lines
10681068 { .compatible = "sprd,sc9860-spi", },
10691069 { /* sentinel */ }
10701070 };
1071+MODULE_DEVICE_TABLE(of, sprd_spi_of_match);
10711072
10721073 static struct platform_driver sprd_spi_driver = {
10731074 .driver = {
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+8−8
@@ -367,7 +367,7 @@ static int zynq_qspi_config_op(struct zynq_qspi *xqspi, struct spi_device *spi) · 366 unmodified lines
367367 }
368368
369369 /**
370− * zynq_qspi_setup - Configure the QSPI controller
370+ * zynq_qspi_setup_op - Configure the QSPI controller
371371 * @spi: Pointer to the spi_device structure
372372 *
373373 * Sets the operational mode of QSPI controller for the next QSPI transfer, baud
@@ -528,18 +528,17 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, · 154 unmodified lines
528528 struct zynq_qspi *xqspi = spi_controller_get_devdata(mem->spi->master);
529529 int err = 0, i;
530530 u8 *tmpbuf;
531− u8 opcode = op->cmd.opcode;
532531
533532 dev_dbg(xqspi->dev, "cmd:%#x mode:%d.%d.%d.%d\n",
534− opcode, op->cmd.buswidth, op->addr.buswidth,
533+ op->cmd.opcode, op->cmd.buswidth, op->addr.buswidth,
535534 op->dummy.buswidth, op->data.buswidth);
536535
537536 zynq_qspi_chipselect(mem->spi, true);
538537 zynq_qspi_config_op(xqspi, mem->spi);
539538
540− if (op->cmd.nbytes) {
539+ if (op->cmd.opcode) {
541540 reinit_completion(&xqspi->data_completion);
542− xqspi->txbuf = &opcode;
541+ xqspi->txbuf = (u8 *)&op->cmd.opcode;
543542 xqspi->rxbuf = NULL;
544543 xqspi->tx_bytes = op->cmd.nbytes;
545544 xqspi->rx_bytes = op->cmd.nbytes;
@@ -679,14 +678,14 @@ static int zynq_qspi_probe(struct platform_device *pdev) · 133 unmodified lines
679678 xqspi->irq = platform_get_irq(pdev, 0);
680679 if (xqspi->irq <= 0) {
681680 ret = -ENXIO;
682− goto remove_master;
681+ goto clk_dis_all;
683682 }
684683 ret = devm_request_irq(&pdev->dev, xqspi->irq, zynq_qspi_irq,
685684 0, pdev->name, xqspi);
686685 if (ret != 0) {
687686 ret = -ENXIO;
688687 dev_err(&pdev->dev, "request_irq failed\n");
689− goto remove_master;
688+ goto clk_dis_all;
690689 }
691690
692691 ret = of_property_read_u32(np, "num-cs",
@@ -694,8 +693,9 @@ static int zynq_qspi_probe(struct platform_device *pdev) · 1 unmodified line
694693 if (ret < 0) {
695694 ctlr->num_chipselect = 1;
696695 } else if (num_cs > ZYNQ_QSPI_MAX_NUM_CS) {
696+ ret = -EINVAL;
697697 dev_err(&pdev->dev, "only 2 chip selects are available\n");
698− goto remove_master;
698+ goto clk_dis_all;
699699 } else {
700700 ctlr->num_chipselect = num_cs;
701701 }
drivers/spi/spi.c+38−13
@@ -47,10 +47,6 @@ static void spidev_release(struct device *dev) · 46 unmodified lines
4747 {
4848 struct spi_device *spi = to_spi_device(dev);
4949
50− /* spi controllers may cleanup for released devices */
51− if (spi->controller->cleanup)
52− spi->controller->cleanup(spi);
53−
5450 spi_controller_put(spi->controller);
5551 kfree(spi->driver_override);
5652 kfree(spi);
@@ -558,6 +554,12 @@ static int spi_dev_check(struct device *dev, void *data) · 501 unmodified lines
558554 return 0;
559555 }
560556
557+static void spi_cleanup(struct spi_device *spi)
558+{
559+ if (spi->controller->cleanup)
560+ spi->controller->cleanup(spi);
561+}
562+
561563 /**
562564 * spi_add_device - Add spi_device allocated with spi_alloc_device
563565 * @spi: spi_device to register
@@ -622,11 +624,13 @@ int spi_add_device(struct spi_device *spi) · 58 unmodified lines
622624
623625 /* Device may be bound to an active driver when this returns */
624626 status = device_add(&spi->dev);
625− if (status < 0)
627+ if (status < 0) {
626628 dev_err(dev, "can't add %s, status %d\n",
627629 dev_name(&spi->dev), status);
628− else
630+ spi_cleanup(spi);
631+ } else {
629632 dev_dbg(dev, "registered child %s\n", dev_name(&spi->dev));
633+ }
630634
631635 done:
632636 mutex_unlock(&spi_add_lock);
@@ -717,7 +721,9 @@ void spi_unregister_device(struct spi_device *spi) · 84 unmodified lines
717721 if (ACPI_COMPANION(&spi->dev))
718722 acpi_device_clear_enumerated(ACPI_COMPANION(&spi->dev));
719723 device_remove_software_node(&spi->dev);
720− device_unregister(&spi->dev);
724+ device_del(&spi->dev);
725+ spi_cleanup(spi);
726+ put_device(&spi->dev);
721727 }
722728 EXPORT_SYMBOL_GPL(spi_unregister_device);
723729
@@ -814,15 +820,29 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force) · 90 unmodified lines
814820
815821 if (spi->cs_gpiod || gpio_is_valid(spi->cs_gpio)) {
816822 if (!(spi->mode & SPI_NO_CS)) {
817− if (spi->cs_gpiod)
818− /* polarity handled by gpiolib */
819− gpiod_set_value_cansleep(spi->cs_gpiod, activate);
820− else
823+ if (spi->cs_gpiod) {
824+ /*
825+ * Historically ACPI has no means of the GPIO polarity and
826+ * thus the SPISerialBus() resource defines it on the per-chip
827+ * basis. In order to avoid a chain of negations, the GPIO
828+ * polarity is considered being Active High. Even for the cases
829+ * when _DSD() is involved (in the updated versions of ACPI)
830+ * the GPIO CS polarity must be defined Active High to avoid
831+ * ambiguity. That's why we use enable, that takes SPI_CS_HIGH
832+ * into account.
833+ */
834+ if (has_acpi_companion(&spi->dev))
835+ gpiod_set_value_cansleep(spi->cs_gpiod, !enable);
836+ else
837+ /* Polarity handled by GPIO library */
838+ gpiod_set_value_cansleep(spi->cs_gpiod, activate);
839+ } else {
821840 /*
822841 * invert the enable line, as active low is
823842 * default for SPI.
824843 */
825844 gpio_set_value_cansleep(spi->cs_gpio, !enable);
845+ }
826846 }
827847 /* Some SPI masters need both GPIO CS & slave_select */
828848 if ((spi->controller->flags & SPI_MASTER_GPIO_SS) &&
@@ -3451,9 +3471,12 @@ int spi_set_cs_timing(struct spi_device *spi, struct spi_delay *setup, · 2622 unmodified lines
34513471
34523472 if (spi->controller->set_cs_timing &&
34533473 !(spi->cs_gpiod || gpio_is_valid(spi->cs_gpio))) {
3474+ mutex_lock(&spi->controller->io_mutex);
3475+
34543476 if (spi->controller->auto_runtime_pm) {
34553477 status = pm_runtime_get_sync(parent);
34563478 if (status < 0) {
3479+ mutex_unlock(&spi->controller->io_mutex);
34573480 pm_runtime_put_noidle(parent);
34583481 dev_err(&spi->controller->dev, "Failed to power device: %d\n",
34593482 status);
@@ -3464,11 +3487,13 @@ int spi_set_cs_timing(struct spi_device *spi, struct spi_delay *setup, · 4 unmodified lines
34643487 hold, inactive);
34653488 pm_runtime_mark_last_busy(parent);
34663489 pm_runtime_put_autosuspend(parent);
3467− return status;
34683490 } else {
3469− return spi->controller->set_cs_timing(spi, setup, hold,
3491+ status = spi->controller->set_cs_timing(spi, setup, hold,
34703492 inactive);
34713493 }
3494+
3495+ mutex_unlock(&spi->controller->io_mutex);
3496+ return status;
34723497 }
34733498
34743499 if ((setup && setup->unit == SPI_DELAY_UNIT_SCK) ||
drivers/staging/emxx_udc/emxx_udc.c+2−2
@@ -2064,7 +2064,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, · 2063 unmodified lines
20642064 struct nbu2ss_ep *ep,
20652065 int status)
20662066 {
2067− struct nbu2ss_req *req;
2067+ struct nbu2ss_req *req, *n;
20682068
20692069 /* Endpoint Disable */
20702070 _nbu2ss_epn_exit(udc, ep);
@@ -2076,7 +2076,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, · 5 unmodified lines
20762076 return 0;
20772077
20782078 /* called with irqs blocked */
2079− list_for_each_entry(req, &ep->queue, queue) {
2079+ list_for_each_entry_safe(req, n, &ep->queue, queue) {
20802080 _nbu2ss_ep_done(ep, req, status);
20812081 }
20822082
drivers/staging/iio/cdc/ad7746.c+0−1
@@ -700,7 +700,6 @@ static int ad7746_probe(struct i2c_client *client, · 699 unmodified lines
700700 indio_dev->num_channels = ARRAY_SIZE(ad7746_channels);
701701 else
702702 indio_dev->num_channels = ARRAY_SIZE(ad7746_channels) - 2;
703− indio_dev->num_channels = ARRAY_SIZE(ad7746_channels);
704703 indio_dev->modes = INDIO_DIRECT_MODE;
705704
706705 if (pdata) {
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+3−3
@@ -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_;
@@ -2284,7 +2284,7 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str · 186 unmodified lines
22842284 mon_wdev->iftype = NL80211_IFTYPE_MONITOR;
22852285 mon_ndev->ieee80211_ptr = mon_wdev;
22862286
2287− ret = register_netdevice(mon_ndev);
2287+ ret = cfg80211_register_netdevice(mon_ndev);
22882288 if (ret) {
22892289 goto out;
22902290 }
@@ -2360,7 +2360,7 @@ static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy, · 69 unmodified lines
23602360 adapter = rtw_netdev_priv(ndev);
23612361 pwdev_priv = adapter_wdev_data(adapter);
23622362
2363− unregister_netdevice(ndev);
2363+ cfg80211_unregister_netdevice(ndev);
23642364
23652365 if (ndev == pwdev_priv->pmon_ndev) {
23662366 pwdev_priv->pmon_ndev = NULL;
drivers/target/target_core_iblock.c+2−2
@@ -204,11 +204,11 @@ static struct se_dev_plug *iblock_plug_device(struct se_device *se_dev) · 203 unmodified lines
204204 struct iblock_dev_plug *ib_dev_plug;
205205
206206 /*
207− * Each se_device has a per cpu work this can be run from. Wwe
207+ * Each se_device has a per cpu work this can be run from. We
208208 * shouldn't have multiple threads on the same cpu calling this
209209 * at the same time.
210210 */
211− ib_dev_plug = &ib_dev->ibd_plug[smp_processor_id()];
211+ ib_dev_plug = &ib_dev->ibd_plug[raw_smp_processor_id()];
212212 if (test_and_set_bit(IBD_PLUGF_PLUGGED, &ib_dev_plug->flags))
213213 return NULL;
214214
drivers/target/target_core_transport.c+2−4
@@ -1416,7 +1416,7 @@ void __target_init_cmd( · 1415 unmodified lines
14161416 cmd->orig_fe_lun = unpacked_lun;
14171417
14181418 if (!(cmd->se_cmd_flags & SCF_USE_CPUID))
1419− cmd->cpuid = smp_processor_id();
1419+ cmd->cpuid = raw_smp_processor_id();
14201420
14211421 cmd->state_active = false;
14221422 }
@@ -3121,9 +3121,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop, · 1698 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/target/target_core_user.c+7−5
@@ -516,8 +516,10 @@ static inline int tcmu_get_empty_block(struct tcmu_dev *udev, · 515 unmodified lines
516516 dpi = dbi * udev->data_pages_per_blk;
517517 /* Count the number of already allocated pages */
518518 xas_set(&xas, dpi);
519+ rcu_read_lock();
519520 for (cnt = 0; xas_next(&xas) && cnt < page_cnt;)
520521 cnt++;
522+ rcu_read_unlock();
521523
522524 for (i = cnt; i < page_cnt; i++) {
523525 /* try to get new page from the mm */
@@ -699,11 +701,10 @@ static inline void tcmu_copy_data(struct tcmu_dev *udev, · 175 unmodified lines
699701 struct scatterlist *sg, unsigned int sg_nents,
700702 struct iovec **iov, size_t data_len)
701703 {
702− XA_STATE(xas, &udev->data_pages, 0);
703704 /* start value of dbi + 1 must not be a valid dbi */
704705 int dbi = -2;
705706 size_t page_remaining, cp_len;
706− int page_cnt, page_inx;
707+ int page_cnt, page_inx, dpi;
707708 struct sg_mapping_iter sg_iter;
708709 unsigned int sg_flags;
709710 struct page *page;
@@ -726,9 +727,10 @@ static inline void tcmu_copy_data(struct tcmu_dev *udev, · 16 unmodified lines
726727 if (page_cnt > udev->data_pages_per_blk)
727728 page_cnt = udev->data_pages_per_blk;
728729
729− xas_set(&xas, dbi * udev->data_pages_per_blk);
730− for (page_inx = 0; page_inx < page_cnt && data_len; page_inx++) {
731− page = xas_next(&xas);
730+ dpi = dbi * udev->data_pages_per_blk;
731+ for (page_inx = 0; page_inx < page_cnt && data_len;
732+ page_inx++, dpi++) {
733+ page = xa_load(&udev->data_pages, dpi);
732734
733735 if (direction == TCMU_DATA_AREA_TO_SG)
734736 flush_dcache_page(page);
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/int340x_thermal/int340x_thermal_zone.c+4−0
@@ -237,6 +237,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, · 236 unmodified lines
237237 if (ACPI_FAILURE(status))
238238 trip_cnt = 0;
239239 else {
240+ int i;
241+
240242 int34x_thermal_zone->aux_trips =
241243 kcalloc(trip_cnt,
242244 sizeof(*int34x_thermal_zone->aux_trips),
@@ -247,6 +249,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev, · 4 unmodified lines
247249 }
248250 trip_mask = BIT(trip_cnt) - 1;
249251 int34x_thermal_zone->aux_trip_nr = trip_cnt;
252+ for (i = 0; i < trip_cnt; ++i)
253+ int34x_thermal_zone->aux_trips[i] = THERMAL_TEMP_INVALID;
250254 }
251255
252256 trip_cnt = int340x_thermal_read_trips(int34x_thermal_zone);
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/thermal/intel/x86_pkg_temp_thermal.c+1−1
@@ -166,7 +166,7 @@ static int sys_get_trip_temp(struct thermal_zone_device *tzd, · 165 unmodified lines
166166 if (thres_reg_value)
167167 *temp = zonedev->tj_max - thres_reg_value * 1000;
168168 else
169− *temp = 0;
169+ *temp = THERMAL_TEMP_INVALID;
170170 pr_debug("sys_get_trip_temp %d\n", *temp);
171171
172172 return 0;
drivers/thermal/qcom/qcom-spmi-adc-tm5.c+1−1
@@ -441,7 +441,7 @@ static int adc_tm5_get_dt_channel_data(struct adc_tm5_chip *adc_tm, · 440 unmodified lines
441441
442442 if (args.args_count != 1 || args.args[0] >= ADC5_MAX_CHANNEL) {
443443 dev_err(dev, "%s: invalid ADC channel number %d\n", name, chan);
444− return ret;
444+ return -EINVAL;
445445 }
446446 channel->adc_channel = args.args[0];
447447
drivers/thermal/ti-soc-thermal/ti-bandgap.c+1−1
@@ -770,7 +770,7 @@ static int ti_bandgap_tshut_init(struct ti_bandgap *bgp, · 769 unmodified lines
770770 }
771771
772772 /**
773− * ti_bandgap_alert_init() - setup and initialize talert handling
773+ * ti_bandgap_talert_init() - setup and initialize talert handling
774774 * @bgp: pointer to struct ti_bandgap
775775 * @pdev: pointer to device struct platform_device
776776 *
drivers/thunderbolt/dma_port.c+6−5
@@ -366,15 +366,15 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, · 365 unmodified lines
366366 void *buf, size_t size)
367367 {
368368 unsigned int retries = DMA_PORT_RETRIES;
369− unsigned int offset;
370−
371− offset = address & 3;
372− address = address & ~3;
373369
374370 do {
375− u32 nbytes = min_t(u32, size, MAIL_DATA_DWORDS * 4);
371+ unsigned int offset;
372+ size_t nbytes;
376373 int ret;
377374
375+ offset = address & 3;
376+ nbytes = min_t(size_t, size + offset, MAIL_DATA_DWORDS * 4);
377+
378378 ret = dma_port_flash_read_block(dma, address, dma->buf,
379379 ALIGN(nbytes, 4));
380380 if (ret) {
@@ -386,6 +386,7 @@ int dma_port_flash_read(struct tb_dma_port *dma, unsigned int address, · 5 unmodified lines
386386 return ret;
387387 }
388388
389+ nbytes -= offset;
389390 memcpy(buf, dma->buf + offset, nbytes);
390391
391392 size -= nbytes;
drivers/thunderbolt/usb4.c+5−4
@@ -68,15 +68,15 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size, · 67 unmodified lines
6868 unsigned int retries = USB4_DATA_RETRIES;
6969 unsigned int offset;
7070
71− offset = address & 3;
72− address = address & ~3;
73−
7471 do {
75− size_t nbytes = min_t(size_t, size, USB4_DATA_DWORDS * 4);
7672 unsigned int dwaddress, dwords;
7773 u8 data[USB4_DATA_DWORDS * 4];
74+ size_t nbytes;
7875 int ret;
7976
77+ offset = address & 3;
78+ nbytes = min_t(size_t, size + offset, USB4_DATA_DWORDS * 4);
79+
8080 dwaddress = address / 4;
8181 dwords = ALIGN(nbytes, 4) / 4;
8282
@@ -87,6 +87,7 @@ static int usb4_do_read_data(u16 address, void *buf, size_t size, · 4 unmodified lines
8787 return ret;
8888 }
8989
90+ nbytes -= offset;
9091 memcpy(buf, data + offset, nbytes);
9192
9293 size -= nbytes;
drivers/tty/serial/8250/8250.h+17−15
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 * Copyright (C) 2001 Russell King.
88 */
99
10+#include <linux/bits.h>
1011 #include <linux/serial_8250.h>
1112 #include <linux/serial_reg.h>
1213 #include <linux/dmaengine.h>
@@ -70,24 +71,25 @@ struct serial8250_config { · 57 unmodified lines
7071 unsigned int flags;
7172 };
7273
73−#define UART_CAP_FIFO (1 << 8) /* UART has FIFO */
74−#define UART_CAP_EFR (1 << 9) /* UART has EFR */
75−#define UART_CAP_SLEEP (1 << 10) /* UART has IER sleep */
76−#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */
77−#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */
78−#define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */
79−#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */
80−#define UART_CAP_RPM (1 << 15) /* Runtime PM is active while idle */
81−#define UART_CAP_IRDA (1 << 16) /* UART supports IrDA line discipline */
82−#define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks:
74+#define UART_CAP_FIFO BIT(8) /* UART has FIFO */
75+#define UART_CAP_EFR BIT(9) /* UART has EFR */
76+#define UART_CAP_SLEEP BIT(10) /* UART has IER sleep */
77+#define UART_CAP_AFE BIT(11) /* MCR-based hw flow control */
78+#define UART_CAP_UUE BIT(12) /* UART needs IER bit 6 set (Xscale) */
79+#define UART_CAP_RTOIE BIT(13) /* UART needs IER bit 4 set (Xscale, Tegra) */
80+#define UART_CAP_HFIFO BIT(14) /* UART has a "hidden" FIFO */
81+#define UART_CAP_RPM BIT(15) /* Runtime PM is active while idle */
82+#define UART_CAP_IRDA BIT(16) /* UART supports IrDA line discipline */
83+#define UART_CAP_MINI BIT(17) /* Mini UART on BCM283X family lacks:
8384 * STOP PARITY EPAR SPAR WLEN5 WLEN6
8485 */
8586
86−#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
87−#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
88−#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
89−#define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */
90−#define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */
87+#define UART_BUG_QUOT BIT(0) /* UART has buggy quot LSB */
88+#define UART_BUG_TXEN BIT(1) /* UART has buggy TX IIR status */
89+#define UART_BUG_NOMSR BIT(2) /* UART has buggy MSR status bits (Au1x00) */
90+#define UART_BUG_THRE BIT(3) /* UART has buggy THRE reassertion */
91+#define UART_BUG_PARITY BIT(4) /* UART mishandles parity if FIFO enabled */
92+#define UART_BUG_TXRACE BIT(5) /* UART Tx fails to set remote DR */
9193
9294
9395 #ifdef CONFIG_SERIAL_8250_SHARE_IRQ
drivers/tty/serial/8250/8250_aspeed_vuart.c+1−0
@@ -437,6 +437,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) · 436 unmodified lines
437437 port.port.status = UPSTAT_SYNC_FIFO;
438438 port.port.dev = &pdev->dev;
439439 port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
440+ port.bugs |= UART_BUG_TXRACE;
440441
441442 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
442443 if (rc < 0)
drivers/tty/serial/8250/8250_dw.c+1−0
@@ -714,6 +714,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = { · 713 unmodified lines
714714 { "APMC0D08", 0},
715715 { "AMD0020", 0 },
716716 { "AMDI0020", 0 },
717+ { "AMDI0022", 0 },
717718 { "BRCM2032", 0 },
718719 { "HISI0031", 0 },
719720 { },
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/tty/serial/8250/8250_pci.c+35−12
@@ -56,6 +56,8 @@ struct serial_private { · 55 unmodified lines
5656 int line[];
5757 };
5858
59+#define PCI_DEVICE_ID_HPE_PCI_SERIAL 0x37e
60+
5961 static const struct pci_device_id pci_use_msi[] = {
6062 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
6163 0xA000, 0x1000) },
@@ -63,6 +65,8 @@ static const struct pci_device_id pci_use_msi[] = { · 1 unmodified line
6365 0xA000, 0x1000) },
6466 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
6567 0xA000, 0x1000) },
68+ { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
69+ PCI_ANY_ID, PCI_ANY_ID) },
6670 { }
6771 };
6872
@@ -1997,6 +2001,16 @@ static struct pci_serial_quirk pci_serial_quirks[] = { · 1928 unmodified lines
19972001 .init = pci_hp_diva_init,
19982002 .setup = pci_hp_diva_setup,
19992003 },
2004+ /*
2005+ * HPE PCI serial device
2006+ */
2007+ {
2008+ .vendor = PCI_VENDOR_ID_HP_3PAR,
2009+ .device = PCI_DEVICE_ID_HPE_PCI_SERIAL,
2010+ .subvendor = PCI_ANY_ID,
2011+ .subdevice = PCI_ANY_ID,
2012+ .setup = pci_hp_diva_setup,
2013+ },
20002014 /*
20012015 * Intel
20022016 */
@@ -3944,21 +3958,26 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) · 1941 unmodified lines
39443958 uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
39453959 uart.port.uartclk = board->base_baud * 16;
39463960
3947− if (pci_match_id(pci_use_msi, dev)) {
3948− dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n");
3949− pci_set_master(dev);
3950− rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
3961+ if (board->flags & FL_NOIRQ) {
3962+ uart.port.irq = 0;
39513963 } else {
3952− dev_dbg(&dev->dev, "Using legacy interrupts\n");
3953− rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY);
3954− }
3955− if (rc < 0) {
3956− kfree(priv);
3957− priv = ERR_PTR(rc);
3958− goto err_deinit;
3964+ if (pci_match_id(pci_use_msi, dev)) {
3965+ dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n");
3966+ pci_set_master(dev);
3967+ rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
3968+ } else {
3969+ dev_dbg(&dev->dev, "Using legacy interrupts\n");
3970+ rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY);
3971+ }
3972+ if (rc < 0) {
3973+ kfree(priv);
3974+ priv = ERR_PTR(rc);
3975+ goto err_deinit;
3976+ }
3977+
3978+ uart.port.irq = pci_irq_vector(dev, 0);
39593979 }
39603980
3961− uart.port.irq = pci_irq_vector(dev, 0);
39623981 uart.port.dev = &dev->dev;
39633982
39643983 for (i = 0; i < nr_ports; i++) {
@@ -4973,6 +4992,10 @@ static const struct pci_device_id serial_pci_tbl[] = { · 1008 unmodified lines
49734992 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
49744993 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
49754994 pbn_b2_1_115200 },
4995+ /* HPE PCI serial device */
4996+ { PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
4997+ PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4998+ pbn_b1_1_115200 },
49764999
49775000 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
49785001 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
drivers/tty/serial/8250/8250_port.c+12−0
@@ -1809,6 +1809,18 @@ void serial8250_tx_chars(struct uart_8250_port *up) · 1808 unmodified lines
18091809 count = up->tx_loadsz;
18101810 do {
18111811 serial_out(up, UART_TX, xmit->buf[xmit->tail]);
1812+ if (up->bugs & UART_BUG_TXRACE) {
1813+ /*
1814+ * The Aspeed BMC virtual UARTs have a bug where data
1815+ * may get stuck in the BMC's Tx FIFO from bursts of
1816+ * writes on the APB interface.
1817+ *
1818+ * Delay back-to-back writes by a read cycle to avoid
1819+ * stalling the VUART. Read a register that won't have
1820+ * side-effects and discard the result.
1821+ */
1822+ serial_in(up, UART_SCR);
1823+ }
18121824 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
18131825 port->icount.tx++;
18141826 if (uart_circ_empty(xmit))
drivers/tty/serial/rp2.c+17−35
@@ -195,7 +195,6 @@ struct rp2_card { · 194 unmodified lines
195195 void __iomem *bar0;
196196 void __iomem *bar1;
197197 spinlock_t card_lock;
198− struct completion fw_loaded;
199198 };
200199
201200 #define RP_ID(prod) PCI_VDEVICE(RP, (prod))
@@ -662,17 +661,10 @@ static void rp2_remove_ports(struct rp2_card *card) · 460 unmodified lines
662661 card->initialized_ports = 0;
663662 }
664663
665−static void rp2_fw_cb(const struct firmware *fw, void *context)
664+static int rp2_load_firmware(struct rp2_card *card, const struct firmware *fw)
666665 {
667− struct rp2_card *card = context;
668666 resource_size_t phys_base;
669− int i, rc = -ENOENT;
670−
671− if (!fw) {
672− dev_err(&card->pdev->dev, "cannot find '%s' firmware image\n",
673− RP2_FW_NAME);
674− goto no_fw;
675− }
667+ int i, rc = 0;
676668
677669 phys_base = pci_resource_start(card->pdev, 1);
678670
@@ -718,23 +710,13 @@ static void rp2_fw_cb(const struct firmware *fw, void *context) · 39 unmodified lines
718710 card->initialized_ports++;
719711 }
720712
721− release_firmware(fw);
722−no_fw:
723− /*
724− * rp2_fw_cb() is called from a workqueue long after rp2_probe()
725− * has already returned success. So if something failed here,
726− * we'll just leave the now-dormant device in place until somebody
727− * unbinds it.
728− */
729− if (rc)
730− dev_warn(&card->pdev->dev, "driver initialization failed\n");
731−
732− complete(&card->fw_loaded);
713+ return rc;
733714 }
734715
735716 static int rp2_probe(struct pci_dev *pdev,
736717 const struct pci_device_id *id)
737718 {
719+ const struct firmware *fw;
738720 struct rp2_card *card;
739721 struct rp2_uart_port *ports;
740722 void __iomem * const *bars;
@@ -745,7 +727,6 @@ static int rp2_probe(struct pci_dev *pdev, · 4 unmodified lines
745727 return -ENOMEM;
746728 pci_set_drvdata(pdev, card);
747729 spin_lock_init(&card->card_lock);
748− init_completion(&card->fw_loaded);
749730
750731 rc = pcim_enable_device(pdev);
751732 if (rc)
@@ -778,21 +759,23 @@ static int rp2_probe(struct pci_dev *pdev, · 26 unmodified lines
778759 return -ENOMEM;
779760 card->ports = ports;
780761
781− rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt,
782− IRQF_SHARED, DRV_NAME, card);
783− if (rc)
762+ rc = request_firmware(&fw, RP2_FW_NAME, &pdev->dev);
763+ if (rc < 0) {
764+ dev_err(&pdev->dev, "cannot find '%s' firmware image\n",
765+ RP2_FW_NAME);
784766 return rc;
767+ }
785768
786− /*
787− * Only catastrophic errors (e.g. ENOMEM) are reported here.
788− * If the FW image is missing, we'll find out in rp2_fw_cb()
789− * and print an error message.
790− */
791− rc = request_firmware_nowait(THIS_MODULE, 1, RP2_FW_NAME, &pdev->dev,
792− GFP_KERNEL, card, rp2_fw_cb);
769+ rc = rp2_load_firmware(card, fw);
770+
771+ release_firmware(fw);
772+ if (rc < 0)
773+ return rc;
774+
775+ rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt,
776+ IRQF_SHARED, DRV_NAME, card);
793777 if (rc)
794778 return rc;
795− dev_dbg(&pdev->dev, "waiting for firmware blob...\n");
796779
797780 return 0;
798781 }
@@ -801,7 +784,6 @@ static void rp2_remove(struct pci_dev *pdev) · 2 unmodified lines
801784 {
802785 struct rp2_card *card = pci_get_drvdata(pdev);
803786
804− wait_for_completion(&card->fw_loaded);
805787 rp2_remove_ports(card);
806788 }
807789
drivers/tty/serial/serial-tegra.c+1−1
@@ -338,7 +338,7 @@ static void tegra_uart_fifo_reset(struct tegra_uart_port *tup, u8 fcr_bits) · 337 unmodified lines
338338
339339 do {
340340 lsr = tegra_uart_read(tup, UART_LSR);
341− if ((lsr | UART_LSR_TEMT) && !(lsr & UART_LSR_DR))
341+ if ((lsr & UART_LSR_TEMT) && !(lsr & UART_LSR_DR))
342342 break;
343343 udelay(1);
344344 } while (--tmout);
drivers/tty/serial/serial_core.c+5−3
@@ -863,9 +863,11 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, · 862 unmodified lines
863863 goto check_and_exit;
864864 }
865865
866− retval = security_locked_down(LOCKDOWN_TIOCSSERIAL);
867− if (retval && (change_irq || change_port))
868− goto exit;
866+ if (change_irq || change_port) {
867+ retval = security_locked_down(LOCKDOWN_TIOCSSERIAL);
868+ if (retval)
869+ goto exit;
870+ }
869871
870872 /*
871873 * Ask the low level driver to verify the settings.
drivers/tty/serial/sh-sci.c+2−2
@@ -1023,10 +1023,10 @@ static int scif_set_rtrg(struct uart_port *port, int rx_trig) · 1022 unmodified lines
10231023 {
10241024 unsigned int bits;
10251025
1026+ if (rx_trig >= port->fifosize)
1027+ rx_trig = port->fifosize - 1;
10261028 if (rx_trig < 1)
10271029 rx_trig = 1;
1028− if (rx_trig >= port->fifosize)
1029− rx_trig = port->fifosize;
10301030
10311031 /* HSCIF can be set to an arbitrary level. */
10321032 if (sci_getreg(port, HSRTRGR)->size) {
drivers/usb/cdns3/cdns3-gadget.c+6−6
@@ -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:
@@ -3268,8 +3266,10 @@ static int __cdns3_gadget_init(struct cdns *cdns) · 1207 unmodified lines
32683266 pm_runtime_get_sync(cdns->dev);
32693267
32703268 ret = cdns3_gadget_start(cdns);
3271− if (ret)
3269+ if (ret) {
3270+ pm_runtime_put_sync(cdns->dev);
32723271 return ret;
3272+ }
32733273
32743274 /*
32753275 * Because interrupt line can be shared with other components in
drivers/usb/cdns3/cdnsp-gadget.c+7−7
@@ -422,17 +422,17 @@ unmap: · 421 unmodified lines
422422 int cdnsp_ep_dequeue(struct cdnsp_ep *pep, struct cdnsp_request *preq)
423423 {
424424 struct cdnsp_device *pdev = pep->pdev;
425− int ret;
425+ int ret_stop = 0;
426+ int ret_rem;
426427
427428 trace_cdnsp_request_dequeue(preq);
428429
429− if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING) {
430− ret = cdnsp_cmd_stop_ep(pdev, pep);
431− if (ret)
432− return ret;
433− }
430+ if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING)
431+ ret_stop = cdnsp_cmd_stop_ep(pdev, pep);
432+
433+ ret_rem = cdnsp_remove_request(pdev, preq, pep);
434434
435− return cdnsp_remove_request(pdev, preq, pep);
435+ return ret_rem ? ret_rem : ret_stop;
436436 }
437437
438438 static void cdnsp_zero_in_ctx(struct cdnsp_device *pdev)
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/chipidea/udc.c+1−0
@@ -2061,6 +2061,7 @@ static int udc_start(struct ci_hdrc *ci) · 2060 unmodified lines
20612061 ci->gadget.name = ci->platdata->name;
20622062 ci->gadget.otg_caps = otg_caps;
20632063 ci->gadget.sg_supported = 1;
2064+ ci->gadget.irq = ci->irq;
20642065
20652066 if (ci->platdata->flags & CI_HDRC_REQUIRES_ALIGNED_DMA)
20662067 ci->gadget.quirk_avoids_skb_reserve = 1;
drivers/usb/chipidea/usbmisc_imx.c+14−2
@@ -686,6 +686,16 @@ static int imx7d_charger_secondary_detection(struct imx_usbmisc_data *data) · 685 unmodified lines
686686 int val;
687687 unsigned long flags;
688688
689+ /* Clear VDATSRCENB0 to disable VDP_SRC and IDM_SNK required by BC 1.2 spec */
690+ spin_lock_irqsave(&usbmisc->lock, flags);
691+ val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
692+ val &= ~MX7D_USB_OTG_PHY_CFG2_CHRG_VDATSRCENB0;
693+ writel(val, usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
694+ spin_unlock_irqrestore(&usbmisc->lock, flags);
695+
696+ /* TVDMSRC_DIS */
697+ msleep(20);
698+
689699 /* VDM_SRC is connected to D- and IDP_SINK is connected to D+ */
690700 spin_lock_irqsave(&usbmisc->lock, flags);
691701 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
@@ -695,7 +705,8 @@ static int imx7d_charger_secondary_detection(struct imx_usbmisc_data *data) · 3 unmodified lines
695705 usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
696706 spin_unlock_irqrestore(&usbmisc->lock, flags);
697707
698− usleep_range(1000, 2000);
708+ /* TVDMSRC_ON */
709+ msleep(40);
699710
700711 /*
701712 * Per BC 1.2, check voltage of D+:
@@ -798,7 +809,8 @@ static int imx7d_charger_primary_detection(struct imx_usbmisc_data *data) · 96 unmodified lines
798809 usbmisc->base + MX7D_USB_OTG_PHY_CFG2);
799810 spin_unlock_irqrestore(&usbmisc->lock, flags);
800811
801− usleep_range(1000, 2000);
812+ /* TVDPSRC_ON */
813+ msleep(40);
802814
803815 /* Check if D- is less than VDAT_REF to determine an SDP per BC 1.2 */
804816 val = readl(usbmisc->base + MX7D_USB_OTG_PHY_STATUS);
drivers/usb/core/devio.c+8−3
@@ -1218,7 +1218,12 @@ static int do_proc_bulk(struct usb_dev_state *ps, · 1217 unmodified lines
12181218 ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
12191219 if (ret)
12201220 return ret;
1221− tbuf = kmalloc(len1, GFP_KERNEL);
1221+
1222+ /*
1223+ * len1 can be almost arbitrarily large. Don't WARN if it's
1224+ * too big, just fail the request.
1225+ */
1226+ tbuf = kmalloc(len1, GFP_KERNEL | __GFP_NOWARN);
12221227 if (!tbuf) {
12231228 ret = -ENOMEM;
12241229 goto done;
@@ -1696,7 +1701,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 471 unmodified lines
16961701 if (num_sgs) {
16971702 as->urb->sg = kmalloc_array(num_sgs,
16981703 sizeof(struct scatterlist),
1699− GFP_KERNEL);
1704+ GFP_KERNEL | __GFP_NOWARN);
17001705 if (!as->urb->sg) {
17011706 ret = -ENOMEM;
17021707 goto error;
@@ -1731,7 +1736,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb · 28 unmodified lines
17311736 (uurb_start - as->usbm->vm_start);
17321737 } else {
17331738 as->urb->transfer_buffer = kmalloc(uurb->buffer_length,
1734− GFP_KERNEL);
1739+ GFP_KERNEL | __GFP_NOWARN);
17351740 if (!as->urb->transfer_buffer) {
17361741 ret = -ENOMEM;
17371742 goto error;
drivers/usb/core/hub.c+7−0
@@ -41,6 +41,8 @@ · 40 unmodified lines
4141 #define USB_VENDOR_GENESYS_LOGIC 0x05e3
4242 #define USB_VENDOR_SMSC 0x0424
4343 #define USB_PRODUCT_USB5534B 0x5534
44+#define USB_VENDOR_CYPRESS 0x04b4
45+#define USB_PRODUCT_CY7C65632 0x6570
4446 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
4547 #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
4648
@@ -5697,6 +5699,11 @@ static const struct usb_device_id hub_id_table[] = { · 5650 unmodified lines
56975699 .idProduct = USB_PRODUCT_USB5534B,
56985700 .bInterfaceClass = USB_CLASS_HUB,
56995701 .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
5702+ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
5703+ | USB_DEVICE_ID_MATCH_PRODUCT,
5704+ .idVendor = USB_VENDOR_CYPRESS,
5705+ .idProduct = USB_PRODUCT_CY7C65632,
5706+ .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
57005707 { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
57015708 | USB_DEVICE_ID_MATCH_INT_CLASS,
57025709 .idVendor = USB_VENDOR_GENESYS_LOGIC,
drivers/usb/dwc3/core.c+1−7
@@ -1671,8 +1671,8 @@ static int dwc3_remove(struct platform_device *pdev) · 1670 unmodified lines
16711671
16721672 pm_runtime_get_sync(&pdev->dev);
16731673
1674− dwc3_debugfs_exit(dwc);
16751674 dwc3_core_exit_mode(dwc);
1675+ dwc3_debugfs_exit(dwc);
16761676
16771677 dwc3_core_exit(dwc);
16781678 dwc3_ulpi_exit(dwc);
@@ -1690,11 +1690,6 @@ static int dwc3_remove(struct platform_device *pdev) · 11 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+19−12
@@ -1244,6 +1244,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, · 1243 unmodified lines
12441244 req->start_sg = sg_next(s);
12451245
12461246 req->num_queued_sgs++;
1247+ req->num_pending_sgs--;
12471248
12481249 /*
12491250 * The number of pending SG entries may not correspond to the
@@ -1251,7 +1252,7 @@ static int dwc3_prepare_trbs_sg(struct dwc3_ep *dep, · 1 unmodified line
12511252 * don't include unused SG entries.
12521253 */
12531254 if (length == 0) {
1254− req->num_pending_sgs -= req->request.num_mapped_sgs - req->num_queued_sgs;
1255+ req->num_pending_sgs = 0;
12551256 break;
12561257 }
12571258
@@ -2260,13 +2261,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 1002 unmodified lines
22602261 }
22612262
22622263 /*
2263− * Synchronize any pending event handling before executing the controller
2264− * halt routine.
2264+ * Synchronize and disable any further event handling while controller
2265+ * is being enabled/disabled.
22652266 */
2266− if (!is_on) {
2267− dwc3_gadget_disable_irq(dwc);
2268− synchronize_irq(dwc->irq_gadget);
2269− }
2267+ disable_irq(dwc->irq_gadget);
22702268
22712269 spin_lock_irqsave(&dwc->lock, flags);
22722270
@@ -2304,6 +2302,8 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) · 31 unmodified lines
23042302
23052303 ret = dwc3_gadget_run_stop(dwc, is_on, false);
23062304 spin_unlock_irqrestore(&dwc->lock, flags);
2305+ enable_irq(dwc->irq_gadget);
2306+
23072307 pm_runtime_put(dwc->dev);
23082308
23092309 return ret;
@@ -2753,6 +2753,8 @@ static int dwc3_gadget_init_endpoint(struct dwc3 *dwc, u8 epnum) · 443 unmodified lines
27532753 INIT_LIST_HEAD(&dep->started_list);
27542754 INIT_LIST_HEAD(&dep->cancelled_list);
27552755
2756+ dwc3_debugfs_create_endpoint_dir(dep);
2757+
27562758 return 0;
27572759 }
27582760
@@ -2796,6 +2798,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc) · 37 unmodified lines
27962798 list_del(&dep->endpoint.ep_list);
27972799 }
27982800
2801+ debugfs_remove_recursive(debugfs_lookup(dep->name, dwc->root));
27992802 kfree(dep);
28002803 }
28012804 }
@@ -2873,15 +2876,15 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep, · 71 unmodified lines
28732876 struct dwc3_trb *trb = &dep->trb_pool[dep->trb_dequeue];
28742877 struct scatterlist *sg = req->sg;
28752878 struct scatterlist *s;
2876− unsigned int pending = req->num_pending_sgs;
2879+ unsigned int num_queued = req->num_queued_sgs;
28772880 unsigned int i;
28782881 int ret = 0;
28792882
2880− for_each_sg(sg, s, pending, i) {
2883+ for_each_sg(sg, s, num_queued, i) {
28812884 trb = &dep->trb_pool[dep->trb_dequeue];
28822885
28832886 req->sg = sg_next(s);
2884− req->num_pending_sgs--;
2887+ req->num_queued_sgs--;
28852888
28862889 ret = dwc3_gadget_ep_reclaim_completed_trb(dep, req,
28872890 trb, event, status, true);
@@ -2904,7 +2907,7 @@ static int dwc3_gadget_ep_reclaim_trb_linear(struct dwc3_ep *dep, · 16 unmodified lines
29042907
29052908 static bool dwc3_gadget_ep_request_completed(struct dwc3_request *req)
29062909 {
2907− return req->num_pending_sgs == 0;
2910+ return req->num_pending_sgs == 0 && req->num_queued_sgs == 0;
29082911 }
29092912
29102913 static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep,
@@ -2913,7 +2916,7 @@ static int dwc3_gadget_ep_cleanup_completed_request(struct dwc3_ep *dep, · 2 unmodified lines
29132916 {
29142917 int ret;
29152918
2916− if (req->num_pending_sgs)
2919+ if (req->request.num_mapped_sgs)
29172920 ret = dwc3_gadget_ep_reclaim_trb_sg(dep, req, event,
29182921 status);
29192922 else
@@ -4045,6 +4048,7 @@ err5: · 1125 unmodified lines
40454048 dwc3_gadget_free_endpoints(dwc);
40464049 err4:
40474050 usb_put_gadget(dwc->gadget);
4051+ dwc->gadget = NULL;
40484052 err3:
40494053 dma_free_coherent(dwc->sysdev, DWC3_BOUNCE_SIZE, dwc->bounce,
40504054 dwc->bounce_addr);
@@ -4064,6 +4068,9 @@ err0: · 13 unmodified lines
40644068
40654069 void dwc3_gadget_exit(struct dwc3 *dwc)
40664070 {
4071+ if (!dwc->gadget)
4072+ return;
4073+
40674074 usb_del_gadget(dwc->gadget);
40684075 dwc3_gadget_free_endpoints(dwc);
40694076 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/gadget/udc/renesas_usb3.c+3−2
@@ -1488,7 +1488,7 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep, · 1487 unmodified lines
14881488 struct renesas_usb3_request *usb3_req)
14891489 {
14901490 struct renesas_usb3 *usb3 = usb3_ep_to_usb3(usb3_ep);
1491− struct renesas_usb3_request *usb3_req_first = usb3_get_request(usb3_ep);
1491+ struct renesas_usb3_request *usb3_req_first;
14921492 unsigned long flags;
14931493 int ret = -EAGAIN;
14941494 u32 enable_bits = 0;
@@ -1496,7 +1496,8 @@ static void usb3_start_pipen(struct renesas_usb3_ep *usb3_ep, · 1 unmodified line
14961496 spin_lock_irqsave(&usb3->lock, flags);
14971497 if (usb3_ep->halt || usb3_ep->started)
14981498 goto out;
1499− if (usb3_req != usb3_req_first)
1499+ usb3_req_first = __usb3_get_request(usb3_ep);
1500+ if (!usb3_req_first || usb3_req != usb3_req_first)
15001501 goto out;
15011502
15021503 if (usb3_pn_change(usb3, usb3_ep->num) < 0)
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-ring.c+7−7
@@ -828,14 +828,10 @@ static void xhci_giveback_invalidated_tds(struct xhci_virt_ep *ep) · 827 unmodified lines
828828 list_for_each_entry_safe(td, tmp_td, &ep->cancelled_td_list,
829829 cancelled_td_list) {
830830
831− /*
832− * Doesn't matter what we pass for status, since the core will
833− * just overwrite it (because the URB has been unlinked).
834− */
835831 ring = xhci_urb_to_transfer_ring(ep->xhci, td->urb);
836832
837833 if (td->cancel_status == TD_CLEARED)
838− xhci_td_cleanup(ep->xhci, td, ring, 0);
834+ xhci_td_cleanup(ep->xhci, td, ring, td->status);
839835
840836 if (ep->xhci->xhc_state & XHCI_STATE_DYING)
841837 return;
@@ -937,14 +933,18 @@ static int xhci_invalidate_cancelled_tds(struct xhci_virt_ep *ep) · 95 unmodified lines
937933 continue;
938934 }
939935 /*
940− * If ring stopped on the TD we need to cancel, then we have to
936+ * If a ring stopped on the TD we need to cancel then we have to
941937 * move the xHC endpoint ring dequeue pointer past this TD.
938+ * Rings halted due to STALL may show hw_deq is past the stalled
939+ * TD, but still require a set TR Deq command to flush xHC cache.
942940 */
943941 hw_deq = xhci_get_hw_deq(xhci, ep->vdev, ep->ep_index,
944942 td->urb->stream_id);
945943 hw_deq &= ~0xf;
946944
947− if (trb_in_td(xhci, td->start_seg, td->first_trb,
945+ if (td->cancel_status == TD_HALTED) {
946+ cached_td = td;
947+ } else if (trb_in_td(xhci, td->start_seg, td->first_trb,
948948 td->last_trb, hw_deq, false)) {
949949 switch (td->cancel_status) {
950950 case TD_CLEARED: /* TD is already no-op */
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/misc/trancevibrator.c+2−2
@@ -61,9 +61,9 @@ static ssize_t speed_store(struct device *dev, struct device_attribute *attr, · 60 unmodified lines
6161 /* Set speed */
6262 retval = usb_control_msg(tv->udev, usb_sndctrlpipe(tv->udev, 0),
6363 0x01, /* vendor request: set speed */
64− USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER,
64+ USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
6565 tv->speed, /* speed value */
66− 0, NULL, 0, USB_CTRL_GET_TIMEOUT);
66+ 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
6767 if (retval) {
6868 tv->speed = old;
6969 dev_dbg(&tv->udev->dev, "retval = %d\n", retval);
drivers/usb/misc/uss720.c+1−0
@@ -736,6 +736,7 @@ static int uss720_probe(struct usb_interface *intf, · 735 unmodified lines
736736 parport_announce_port(pp);
737737
738738 usb_set_intfdata(intf, pp);
739+ usb_put_dev(usbdev);
739740 return 0;
740741
741742 probe_abort:
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+4−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) },
@@ -1034,6 +1035,9 @@ static const struct usb_device_id id_table_combined[] = { · 417 unmodified lines
10341035 /* Sienna devices */
10351036 { USB_DEVICE(FTDI_VID, FTDI_SIENNA_PID) },
10361037 { USB_DEVICE(ECHELON_VID, ECHELON_U20_PID) },
1038+ /* IDS GmbH devices */
1039+ { USB_DEVICE(IDS_VID, IDS_SI31A_PID) },
1040+ { USB_DEVICE(IDS_VID, IDS_CM31A_PID) },
10371041 /* U-Blox devices */
10381042 { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ZED_PID) },
10391043 { USB_DEVICE(UBLOX_VID, UBLOX_C099F9P_ODIN_PID) },
drivers/usb/serial/ftdi_sio_ids.h+8−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)
@@ -1567,6 +1568,13 @@ · 980 unmodified lines
15671568 #define UNJO_VID 0x22B7
15681569 #define UNJO_ISODEBUG_V1_PID 0x150D
15691570
1571+/*
1572+ * IDS GmbH
1573+ */
1574+#define IDS_VID 0x2CAF
1575+#define IDS_SI31A_PID 0x13A2
1576+#define IDS_CM31A_PID 0x13A3
1577+
15701578 /*
15711579 * U-Blox products (http://www.u-blox.com).
15721580 */
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/option.c+4−0
@@ -1240,6 +1240,10 @@ static const struct usb_device_id option_ids[] = { · 1239 unmodified lines
12401240 .driver_info = NCTRL(0) | RSVD(1) },
12411241 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1901, 0xff), /* Telit LN940 (MBIM) */
12421242 .driver_info = NCTRL(0) },
1243+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7010, 0xff), /* Telit LE910-S1 (RNDIS) */
1244+ .driver_info = NCTRL(2) },
1245+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */
1246+ .driver_info = NCTRL(2) },
12431247 { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */
12441248 .driver_info = NCTRL(0) | ZLP },
12451249 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */
drivers/usb/serial/pl2303.c+1−0
@@ -113,6 +113,7 @@ static const struct usb_device_id id_table[] = { · 112 unmodified lines
113113 { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
114114 { USB_DEVICE(SANWA_VENDOR_ID, SANWA_PRODUCT_ID) },
115115 { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) },
116+ { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530GC_PRODUCT_ID) },
116117 { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) },
117118 { USB_DEVICE(AT_VENDOR_ID, AT_VTKIT3_PRODUCT_ID) },
118119 { } /* Terminating entry */
drivers/usb/serial/pl2303.h+1−0
@@ -158,6 +158,7 @@ · 157 unmodified lines
158158 /* ADLINK ND-6530 RS232,RS485 and RS422 adapter */
159159 #define ADLINK_VENDOR_ID 0x0b63
160160 #define ADLINK_ND6530_PRODUCT_ID 0x6530
161+#define ADLINK_ND6530GC_PRODUCT_ID 0x653a
161162
162163 /* SMART USB Serial Adapter */
163164 #define SMART_VENDOR_ID 0x0b8c
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/serial/ti_usb_3410_5052.c+3−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 /* Vendor and product ids */
3838 #define TI_VENDOR_ID 0x0451
3939 #define IBM_VENDOR_ID 0x04b3
40+#define STARTECH_VENDOR_ID 0x14b0
4041 #define TI_3410_PRODUCT_ID 0x3410
4142 #define IBM_4543_PRODUCT_ID 0x4543
4243 #define IBM_454B_PRODUCT_ID 0x454b
@@ -370,6 +371,7 @@ static const struct usb_device_id ti_id_table_3410[] = { · 327 unmodified lines
370371 { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) },
371372 { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) },
372373 { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) },
374+ { USB_DEVICE(STARTECH_VENDOR_ID, TI_3410_PRODUCT_ID) },
373375 { } /* terminator */
374376 };
375377
@@ -408,6 +410,7 @@ static const struct usb_device_id ti_id_table_combined[] = { · 32 unmodified lines
408410 { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1131_PRODUCT_ID) },
409411 { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1150_PRODUCT_ID) },
410412 { USB_DEVICE(MXU1_VENDOR_ID, MXU1_1151_PRODUCT_ID) },
413+ { USB_DEVICE(STARTECH_VENDOR_ID, TI_3410_PRODUCT_ID) },
411414 { } /* terminator */
412415 };
413416
drivers/usb/typec/mux.c+5−4
@@ -191,6 +191,7 @@ static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id, · 190 unmodified lines
191191 bool match;
192192 int nval;
193193 u16 *val;
194+ int ret;
194195 int i;
195196
196197 /*
@@ -218,10 +219,10 @@ static void *typec_mux_match(struct fwnode_handle *fwnode, const char *id, · 21 unmodified lines
218219 if (!val)
219220 return ERR_PTR(-ENOMEM);
220221
221− nval = fwnode_property_read_u16_array(fwnode, "svid", val, nval);
222− if (nval < 0) {
222+ ret = fwnode_property_read_u16_array(fwnode, "svid", val, nval);
223+ if (ret < 0) {
223224 kfree(val);
224− return ERR_PTR(nval);
225+ return ERR_PTR(ret);
225226 }
226227
227228 for (i = 0; i < nval; i++) {
@@ -238,7 +239,7 @@ find_mux: · 10 unmodified lines
238239 dev = class_find_device(&typec_mux_class, NULL, fwnode,
239240 mux_fwnode_match);
240241
241− return dev ? to_typec_switch(dev) : ERR_PTR(-EPROBE_DEFER);
242+ return dev ? to_typec_mux(dev) : ERR_PTR(-EPROBE_DEFER);
242243 }
243244
244245 /**
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+107−43
@@ -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,33 +1549,43 @@ 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]));
1553− /* 6.4.4.3.1: Only respond as UFP (device) */
1554− if (port->data_role == TYPEC_DEVICE &&
1555+ svdm_version = PD_VDO_SVDM_VER(p[0]);
1556+ }
1557+
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) &&
15551565 port->nr_snk_vdo) {
1556− /*
1557− * Product Type DFP and Connector Type are not defined in SVDM
1558− * version 1.0 and shall be set to zero.
1559− */
1560− if (typec_get_negotiated_svdm_version(typec) < SVDM_VER_2_0)
1561− response[1] = port->snk_vdo[0] & ~IDH_DFP_MASK
1562− & ~IDH_CONN_MASK;
1563− else
1564− response[1] = port->snk_vdo[0];
1565− for (i = 1; i < port->nr_snk_vdo; i++)
1566− response[i + 1] = port->snk_vdo[i];
1567− 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+ }
15681576 }
15691577 break;
15701578 case CMD_DISCOVER_SVID:
1579+ port->ams = DISCOVER_SVIDS;
15711580 break;
15721581 case CMD_DISCOVER_MODES:
1582+ port->ams = DISCOVER_MODES;
15731583 break;
15741584 case CMD_ENTER_MODE:
1585+ port->ams = DFP_TO_UFP_ENTER_MODE;
15751586 break;
15761587 case CMD_EXIT_MODE:
1588+ port->ams = DFP_TO_UFP_EXIT_MODE;
15771589 break;
15781590 case CMD_ATTENTION:
15791591 /* Attention command does not have response */
@@ -1930,6 +1942,9 @@ static void vdm_run_state_machine(struct tcpm_port *port) · 350 unmodified lines
19301942 tcpm_log(port, "VDM Tx error, retry");
19311943 port->vdm_retries++;
19321944 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 {
19331948 tcpm_ams_finish(port);
19341949 }
19351950 break;
@@ -2176,20 +2191,25 @@ static void tcpm_handle_alert(struct tcpm_port *port, const __le32 *payload, · 240 unmodified lines
21762191
21772192 if (!type) {
21782193 tcpm_log(port, "Alert message received with no type");
2194+ tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP);
21792195 return;
21802196 }
21812197
21822198 /* Just handling non-battery alerts for now */
21832199 if (!(type & USB_PD_ADO_TYPE_BATT_STATUS_CHANGE)) {
2184− switch (port->state) {
2185− case SRC_READY:
2186− 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;
21872209 tcpm_set_state(port, GET_STATUS_SEND, 0);
2188− break;
2189− default:
2190− tcpm_queue_message(port, PD_MSG_CTRL_WAIT);
2191− break;
21922210 }
2211+ } else {
2212+ tcpm_queue_message(port, PD_MSG_CTRL_NOT_SUPP);
21932213 }
21942214 }
21952215
@@ -2287,6 +2307,12 @@ static void tcpm_pd_data_request(struct tcpm_port *port, · 91 unmodified lines
22872307 bool frs_enable;
22882308 int ret;
22892309
2310+ if (tcpm_vdm_ams(port) && type != PD_DATA_VENDOR_DEF) {
2311+ port->vdm_state = VDM_STATE_ERR_BUSY;
2312+ tcpm_ams_finish(port);
2313+ mod_vdm_delayed_work(port, 0);
2314+ }
2315+
22902316 switch (type) {
22912317 case PD_DATA_SOURCE_CAP:
22922318 for (i = 0; i < cnt; i++)
@@ -2417,14 +2443,22 @@ static void tcpm_pd_data_request(struct tcpm_port *port, · 124 unmodified lines
24172443 NONE_AMS);
24182444 break;
24192445 case PD_DATA_VENDOR_DEF:
2420− tcpm_handle_vdm_request(port, msg->payload, cnt);
2446+ if (tcpm_vdm_ams(port) || port->nr_snk_vdo)
2447+ tcpm_handle_vdm_request(port, msg->payload, cnt);
2448+ else if (port->negotiated_rev > PD_REV20)
2449+ tcpm_pd_handle_msg(port, PD_MSG_CTRL_NOT_SUPP, NONE_AMS);
24212450 break;
24222451 case PD_DATA_BIST:
24232452 port->bist_request = le32_to_cpu(msg->payload[0]);
24242453 tcpm_pd_handle_state(port, BIST_RX, BIST, 0);
24252454 break;
24262455 case PD_DATA_ALERT:
2427− 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);
24282462 break;
24292463 case PD_DATA_BATT_STATUS:
24302464 case PD_DATA_GET_COUNTRY_INFO:

111 more lines aren’t shown here.

drivers/usb/typec/tcpm/wcove.c+1−1

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

drivers/usb/typec/ucsi/ucsi.c+2−1

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

drivers/vdpa/mlx5/net/mlx5_vnet.c+18−1

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

drivers/vfio/pci/Kconfig+1−0

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

drivers/vfio/pci/vfio_pci_config.c+1−1

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

drivers/vfio/platform/vfio_platform_common.c+1−1

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

drivers/vfio/vfio_iommu_type1.c+1−1

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

drivers/video/fbdev/core/fb_defio.c+35−0

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

drivers/video/fbdev/core/fbmem.c+4−0

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

drivers/video/fbdev/hgafb.c+1−1

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

fs/afs/cmservice.c+5−0

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

fs/afs/dir.c+3−1

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

fs/afs/fsclient.c+4−0

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

fs/afs/main.c+2−2

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

fs/afs/vlclient.c+1−0

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

fs/afs/write.c+9−6

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

fs/btrfs/block-group.c+4−4

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

fs/btrfs/compression.c+12−5

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

fs/btrfs/disk-io.c+18−8

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

fs/btrfs/extent-tree.c+1−1

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

fs/btrfs/file-item.c+81−27

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

fs/btrfs/file.c+2−2

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

fs/btrfs/inode.c+18−1

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

fs/btrfs/reflink.c+22−16

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

fs/btrfs/tree-log.c+29−8

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

fs/btrfs/zoned.c+18−5

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

fs/cifs/cifs_ioctl.h+19−6

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

fs/cifs/cifspdu.h+2−1

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

fs/cifs/ioctl.c+105−38

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

fs/cifs/smb2pdu.c+7−0

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

fs/cifs/trace.h+17−12

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

fs/coredump.c+1−1

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

fs/debugfs/file.c+1−1

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

fs/debugfs/inode.c+6−3

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

fs/ext4/extents.c+23−20

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

fs/ext4/fast_commit.c+90−80

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

fs/ext4/fast_commit.h+0−19

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

fs/ext4/ialloc.c+4−2

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

fs/ext4/mballoc.c+1−1

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

fs/ext4/namei.c+4−2

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

fs/ext4/super.c+9−2

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

fs/ext4/sysfs.c+4−0

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

fs/gfs2/file.c+4−1

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

fs/gfs2/glock.c+24−4

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

fs/gfs2/glops.c+1−1

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

fs/gfs2/log.c+3−3

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

fs/gfs2/log.h+1−0

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

fs/gfs2/lops.c+6−1

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

fs/gfs2/lops.h+1−0

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

fs/gfs2/util.c+1−0

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

fs/hugetlbfs/inode.c+1−0

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

fs/io-wq.c+15−14

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

fs/io-wq.h+1−1

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

fs/io_uring.c+43−15

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

fs/netfs/Kconfig+1−1

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

fs/netfs/read_helper.c+1−1

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

fs/nfs/client.c+1−1

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

fs/nfs/filelayout/filelayout.c+1−1

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

fs/nfs/namespace.c+1−1

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

fs/nfs/nfs4_fs.h+1−0

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

fs/nfs/nfs4client.c+1−1

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

fs/nfs/nfs4file.c+1−1

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

fs/nfs/nfs4proc.c+32−9

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

fs/nfs/nfstrace.h+0−4

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

fs/nfs/pagelist.c+6−14

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

fs/nfs/pnfs.c+8−9

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

fs/nfs/super.c+1−1

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

fs/notify/fanotify/fanotify_user.c+26−8

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

fs/notify/fdinfo.c+1−1

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

fs/ocfs2/file.c+50−5

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

fs/proc/base.c+13−0

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

fs/xfs/libxfs/xfs_ag_resv.c+15−3

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

fs/xfs/libxfs/xfs_bmap.c+0−12

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

fs/xfs/libxfs/xfs_inode_buf.c+42−4

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

fs/xfs/libxfs/xfs_trans_inode.c+17−0

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

fs/xfs/xfs_inode.c+29−0

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

fs/xfs/xfs_ioctl.c+34−67

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

fs/xfs/xfs_message.h+2−0

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

include/asm-generic/vmlinux.lds.h+1−0

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

include/dt-bindings/usb/pd.h+76−13

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

include/linux/arch_topology.h+0−1

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

include/linux/avf/virtchnl.h+1−0

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

include/linux/cgroup-defs.h+3−3

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

include/linux/cgroup.h+1−1

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

include/linux/compiler_attributes.h+1−0

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

include/linux/device.h+2−4

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

include/linux/entry-kvm.h+2−1

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

include/linux/fanotify.h+4−0

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

include/linux/fb.h+3−0

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

include/linux/hid.h+1−2

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

include/linux/host1x.h+24−6

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

include/linux/huge_mm.h+7−1

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

include/linux/hugetlb.h+8−0

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

include/linux/init.h+2−1

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

include/linux/kvm_host.h+16−2

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

include/linux/mfd/rohm-bd70528.h+1−3

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

include/linux/mfd/rohm-bd71828.h+5−5

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

include/linux/mlx4/device.h+1−0

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

include/linux/mlx5/driver.h+26−22

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

include/linux/mlx5/mlx5_ifc.h+2−0

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

include/linux/mlx5/mpfs.h+18−0

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

include/linux/mlx5/transobj.h+1−0

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

include/linux/mm.h+3−0

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

include/linux/mm_types.h+20−7

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

include/linux/pci.h+2−0

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

include/linux/pgtable.h+8−0

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

include/linux/phy.h+5−0

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

include/linux/platform_data/ti-sysc.h+1−0

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

include/linux/ptp_clock_kernel.h+1−1

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

include/linux/rmap.h+1−0

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

include/linux/rtsx_pci.h+2−0

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

include/linux/sched.h+8−0

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

include/linux/socket.h+0−2

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

include/linux/spi/spi.h+2−2

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

include/linux/sunrpc/xprt.h+2−0

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

include/linux/swapops.h+11−4

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

include/linux/tick.h+7−0

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

include/linux/usb/pd.h+1−1

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

include/linux/usb/pd_ext_sdb.h+0−4

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

include/net/caif/caif_dev.h+1−1

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

include/net/caif/cfcnfg.h+1−1

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

include/net/caif/cfserl.h+1−0

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

include/net/cfg80211.h+2−2

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

include/net/mac80211.h+7−2

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

include/net/net_namespace.h+13−1

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

include/net/netfilter/nf_flow_table.h+0−1

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

include/net/netfilter/nf_tables.h+0−6

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

include/net/nfc/nci_core.h+1−0

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

include/net/pkt_cls.h+11−0

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

include/net/pkt_sched.h+1−6

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

include/net/sch_generic.h+34−1

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

include/net/sock.h+16−5

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

include/net/tls.h+9−1

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

include/sound/soc-dai.h+1−1

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

include/uapi/asm-generic/unistd.h+1−2

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

include/uapi/linux/in.h+3−0

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

include/uapi/linux/input-event-codes.h+1−0

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

include/uapi/linux/io_uring.h+10−9

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

include/uapi/linux/kvm.h+3−2

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

include/uapi/linux/virtio_ids.h+1−1

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

init/Kconfig+1−40

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

init/main.c+1−1

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

kernel/bpf/Kconfig+89−0

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

kernel/bpf/bpf_lsm.c+2−0

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

kernel/bpf/btf.c+12−0

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

kernel/bpf/helpers.c+24−18

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

kernel/bpf/ringbuf.c+11−13

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

kernel/bpf/syscall.c+2−1

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

kernel/bpf/verifier.c+118−44

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

kernel/cgroup/cgroup-v1.c+5−1

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

kernel/cgroup/cgroup.c+9−12

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

kernel/cgroup/cpuset.c+1−1

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

kernel/cgroup/rdma.c+1−1

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

kernel/cgroup/rstat.c+1−1

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

kernel/crash_core.c+1−0

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

kernel/entry/common.c+3−2

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

kernel/events/core.c+2−0

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

kernel/irq_work.c+0−3

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

kernel/printk/printk_safe.c+1−1

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

kernel/sched/core.c+0−1

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

kernel/sched/debug.c+2−1

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

kernel/sched/fair.c+42−30

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

kernel/sched/pelt.h+1−10

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

kernel/seccomp.c+16−14

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

kernel/sysctl.c+24−5

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

kernel/time/tick-sched.c+1−0

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

kernel/trace/bpf_trace.c+12−20

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

kernel/trace/ftrace.c+7−1

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

kernel/trace/trace.c+1−12

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

kernel/trace/trace_clock.c+3−3

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

kernel/workqueue.c+10−2

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

lib/crc64.c+1−1

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

lib/percpu-refcount.c+3−3

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

mm/debug_vm_pgtable.c+2−2

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

mm/huge_memory.c+29−27

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

mm/hugetlb.c+125−26

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

mm/internal.h+39−14

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

mm/kasan/init.c+2−2

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

mm/kfence/core.c+3−3

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

mm/memory-failure.c+33−3

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

mm/memory.c+45−0

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

mm/migrate.c+1−0

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

mm/page_alloc.c+2−0

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

mm/page_vma_mapped.c+17−10

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

mm/pgtable-generic.c+2−3

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

mm/rmap.c+27−12

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

mm/slab_common.c+1−2

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

mm/slub.c+16−21

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

mm/sparse.c+11−2

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

mm/swapfile.c+1−1

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

mm/truncate.c+19−24

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

net/Kconfig+0−27

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

net/appletalk/aarp.c+1−1

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

net/batman-adv/bat_iv_ogm.c+3−1

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

net/bluetooth/hci_core.c+6−1

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

net/bluetooth/hci_sock.c+2−2

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

net/bluetooth/smp.c+3−3

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

net/bridge/br_private.h+2−2

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

net/bridge/br_vlan_tunnel.c+24−14

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

net/caif/caif_dev.c+9−4

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

net/caif/caif_usb.c+13−1

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

net/caif/cfcnfg.c+11−5

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

net/caif/cfserl.c+5−0

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

net/can/bcm.c+49−13

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

net/can/isotp.c+81−29

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

net/can/j1939/transport.c+40−14

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

net/can/raw.c+48−14

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

net/compat.c+1−1

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

net/core/dev.c+24−5

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

net/core/devlink.c+2−2

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

net/core/fib_rules.c+1−1

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

net/core/filter.c+1−0

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

net/core/neighbour.c+1−0

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

net/core/net_namespace.c+13−7

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

net/core/rtnetlink.c+4−0

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

net/core/skbuff.c+3−1

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

net/core/sock.c+16−8

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

net/dsa/master.c+3−2

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

net/dsa/slave.c+7−5

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

net/dsa/tag_8021q.c+1−1

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

net/ethtool/eeprom.c+1−1

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

net/ethtool/ioctl.c+5−5

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

net/ethtool/stats.c+1−1

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

net/ethtool/strset.c+2−0

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

net/hsr/hsr_device.c+2−0

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

net/hsr/hsr_forward.c+21−9

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

net/hsr/hsr_forward.h+4−4

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

net/hsr/hsr_main.h+2−2

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

net/hsr/hsr_slave.c+5−6

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

net/ieee802154/nl-mac.c+6−4

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

net/ieee802154/nl-phy.c+3−1

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

net/ieee802154/nl802154.c+5−4

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

net/ipv4/af_inet.c+2−2

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

net/ipv4/bpf_tcp_ca.c+2−0

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

net/ipv4/cipso_ipv4.c+1−0

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

net/ipv4/devinet.c+1−1

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

net/ipv4/icmp.c+7−0

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

net/ipv4/igmp.c+1−0

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

net/ipv4/ipconfig.c+8−5

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

net/ipv4/ping.c+7−5

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

net/ipv4/route.c+14−1

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

net/ipv4/udp.c+10−0

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

net/ipv6/addrconf.c+1−1

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

net/ipv6/mcast.c+0−3

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

net/ipv6/netfilter/nft_fib_ipv6.c+18−4

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

net/ipv6/reassembly.c+3−1

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

net/ipv6/route.c+6−2

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

net/ipv6/sit.c+3−0

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

net/ipv6/udp.c+3−0

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

net/mac80211/debugfs.c+9−2

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

net/mac80211/ieee80211_i.h+14−24

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

net/mac80211/iface.c+15−15

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

net/mac80211/key.c+7−0

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

net/mac80211/key.h+2−0

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

net/mac80211/main.c+6−1

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

net/mac80211/mlme.c+8−0

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

net/mac80211/rc80211_minstrel_ht.c+1−1

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

net/mac80211/rx.c+119−38

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

net/mac80211/scan.c+16−5

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

net/mac80211/sta_info.c+5−1

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

net/mac80211/sta_info.h+32−1

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

net/mac80211/tx.c+36−16

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

net/mac80211/util.c+11−13

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

net/mac80211/wpa.c+9−4

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

net/mptcp/options.c+3−2

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

net/mptcp/pm_netlink.c+4−4

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

net/mptcp/protocol.c+59−29

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

net/mptcp/protocol.h+2−2

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

net/mptcp/sockopt.c+2−2

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

net/mptcp/subflow.c+90−92

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

net/netfilter/ipvs/ip_vs_ctl.c+1−1

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

net/netfilter/nf_conntrack_proto.c+1−1

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

net/netfilter/nf_flow_table_core.c+1−2

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

net/netfilter/nf_flow_table_offload.c+4−3

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

net/netfilter/nf_synproxy_core.c+5−0

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

net/netfilter/nf_tables_api.c+100−69

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

net/netfilter/nfnetlink_cthelper.c+6−2

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

net/netfilter/nft_ct.c+1−1

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

net/netfilter/nft_set_pipapo.c+2−2

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

net/netfilter/nft_set_pipapo.h+2−0

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

net/netfilter/nft_set_pipapo_avx2.c+3−0

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

net/netlink/af_netlink.c+4−2

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

net/nfc/llcp_sock.c+2−0

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

net/nfc/nci/core.c+1−0

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

net/nfc/nci/hci.c+5−0

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

net/nfc/rawsock.c+1−1

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

net/openvswitch/meter.c+8−0

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

net/packet/af_packet.c+31−20

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

net/qrtr/qrtr.c+1−1

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

net/rds/connection.c+17−6

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

net/rds/recv.c+1−1

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

net/rds/tcp.c+2−2

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

net/rds/tcp.h+2−1

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

net/rds/tcp_listen.c+6−0

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

net/sched/act_ct.c+17−14

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

net/sched/cls_api.c+1−1

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

net/sched/sch_cake.c+11−7

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

net/sched/sch_dsmark.c+2−1

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

net/sched/sch_fq_pie.c+13−6

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

net/sched/sch_generic.c+48−2

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

net/sched/sch_htb.c+4−4

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

net/sctp/socket.c+1−0

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

net/sctp/sysctl.c+1−1

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

net/smc/smc_ism.c+10−1

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

net/socket.c+0−13

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

net/sunrpc/clnt.c+0−7

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

net/sunrpc/xprt.c+32−8

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

net/sunrpc/xprtrdma/rpc_rdma.c+18−9

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

net/sunrpc/xprtrdma/transport.c+6−6

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

net/sunrpc/xprtrdma/verbs.c+15−3

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

net/sunrpc/xprtrdma/xprt_rdma.h+1−0

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

net/sunrpc/xprtsock.c+2−0

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

net/tipc/core.c+4−2

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

net/tipc/core.h+3−7

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

net/tipc/discover.c+2−2

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

net/tipc/link.c+5−0

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

net/tipc/link.h+1−0

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

net/tipc/msg.c+2−7

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

net/tipc/net.c+3−12

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

net/tipc/node.c+6−6

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

net/tipc/socket.c+4−1

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

net/tipc/udp_media.c+2−0

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

net/tls/tls_device.c+49−11

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

net/tls/tls_device_fallback.c+7−0

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

net/tls/tls_main.c+1−0

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

net/tls/tls_sw.c+6−5

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

net/unix/af_unix.c+4−3

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

net/wireless/Makefile+1−1

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

net/wireless/core.c+5−8

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

net/wireless/pmsr.c+14−2

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

net/wireless/sysfs.c+4−0

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

net/wireless/util.c+8−2

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

net/x25/af_x25.c+1−1

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

samples/bpf/xdpsock_user.c+1−1

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

samples/vfio-mdev/mdpy-fb.c+9−4

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

scripts/Makefile.modfinal+1−1

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

scripts/link-vmlinux.sh+1−1

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

scripts/recordmcount.h+10−5

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

sound/core/control_led.c+26−7

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

sound/core/seq/seq_timer.c+9−1

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

sound/core/timer.c+2−1

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

sound/firewire/amdtp-stream.c+1−1

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

sound/hda/intel-dsp-config.c+4−0

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

sound/pci/hda/hda_codec.c+5−0

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

sound/pci/hda/hda_generic.c+1−0

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

sound/pci/hda/hda_intel.c+3−0

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

sound/pci/hda/patch_cirrus.c+3−4

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

sound/pci/hda/patch_realtek.c+62−1

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

sound/soc/amd/raven/acp3x-pcm-dma.c+0−10

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

sound/soc/amd/raven/acp3x.h+1−0

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

sound/soc/amd/raven/pci-acp3x.c+15−0

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

sound/soc/codecs/ak5558.c+1−1

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

sound/soc/codecs/cs35l32.c+3−0

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

sound/soc/codecs/cs35l33.c+1−0

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

sound/soc/codecs/cs35l34.c+3−0

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

sound/soc/codecs/cs42l42.c+3−0

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

sound/soc/codecs/cs42l56.c+6−1

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

sound/soc/codecs/cs42l73.c+3−0

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

sound/soc/codecs/cs53l30.c+3−0

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

sound/soc/codecs/da7219.c+1−4

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

sound/soc/codecs/lpass-rx-macro.c+1−0

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

sound/soc/codecs/lpass-tx-macro.c+1−0

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

sound/soc/codecs/max98088.c+11−2

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

sound/soc/codecs/rt5659.c+21−5

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

sound/soc/codecs/rt5682-sdw.c+2−1

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

sound/soc/codecs/rt711-sdca.c+2−2

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

sound/soc/codecs/sti-sas.c+1−0

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

sound/soc/codecs/tas2562.h+7−7

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

sound/soc/fsl/Kconfig+1−0

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

sound/soc/fsl/fsl-asoc-card.c+1−0

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

sound/soc/generic/audio-graph-card.c+29−28

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

sound/soc/generic/simple-card.c+83−85

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

sound/soc/intel/boards/bytcr_rt5640.c+25−0

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

sound/soc/qcom/lpass-cpu.c+80−11

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

sound/soc/qcom/lpass.h+4−0

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

sound/soc/soc-core.c+2−0

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

sound/soc/soc-topology.c+3−3

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

sound/soc/sof/intel/hda-dai.c+5−0

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

sound/soc/sof/pm.c+1−0

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

sound/soc/stm/stm32_sai_sub.c+1−4

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

sound/usb/format.c+1−1

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

sound/usb/mixer_quirks.c+1−1

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

sound/usb/mixer_scarlett_gen2.c+51−30

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

sound/usb/mixer_scarlett_gen2.h+1−1

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

tools/arch/mips/include/uapi/asm/perf_regs.h+40−0

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

tools/arch/x86/include/asm/disabled-features.h+2−5

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

tools/arch/x86/include/uapi/asm/kvm.h+2−0

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

tools/bootconfig/include/linux/bootconfig.h+4−0

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

tools/bootconfig/main.c+1−0

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

tools/bpf/bpftool/Documentation/bpftool-cgroup.rst+3−1

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

tools/bpf/bpftool/Documentation/bpftool-prog.rst+1−1

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

tools/bpf/bpftool/bash-completion/bpftool+3−3

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

tools/bpf/bpftool/cgroup.c+2−1

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

tools/bpf/bpftool/prog.c+1−1

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

tools/include/uapi/asm-generic/unistd.h+1−2

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

tools/include/uapi/linux/fs.h+1−1

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

tools/include/uapi/linux/in.h+3−0

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

tools/include/uapi/linux/kvm.h+3−2

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

tools/include/uapi/linux/perf_event.h+1−1

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

tools/lib/bpf/libbpf.c+3−0

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

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

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

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

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

tools/objtool/arch/x86/decode.c+4−0

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

tools/objtool/elf.c+24−1

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

tools/perf/Documentation/perf-intel-pt.txt+3−3

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

tools/perf/Documentation/perf-script.txt+4−3

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

tools/perf/Makefile.config+0−1

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

tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl+1−1

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

tools/perf/arch/powerpc/entry/syscalls/syscall.tbl+1−1

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

tools/perf/arch/s390/entry/syscalls/syscall.tbl+1−1

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

tools/perf/arch/x86/entry/syscalls/syscall_64.tbl+1−1

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

tools/perf/builtin-buildid-list.c+3−0

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

tools/perf/builtin-record.c+6−0

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

tools/perf/builtin-stat.c+10−3

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

tools/perf/check-headers.sh+1−0

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

tools/perf/perf.c+2−2

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

tools/perf/pmu-events/arch/powerpc/power10/cache.json+20−10

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

tools/perf/pmu-events/arch/powerpc/power10/floating_point.json+1−1

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

tools/perf/pmu-events/arch/powerpc/power10/frontend.json+77−47

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

tools/perf/pmu-events/arch/powerpc/power10/locks.json+2−2

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

tools/perf/pmu-events/arch/powerpc/power10/marked.json+28−33

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

tools/perf/pmu-events/arch/powerpc/power10/memory.json+37−42

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

tools/perf/pmu-events/arch/powerpc/power10/others.json+54−79

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

tools/perf/pmu-events/arch/powerpc/power10/pipeline.json+65−70

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

tools/perf/pmu-events/arch/powerpc/power10/pmc.json+4−4

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

tools/perf/pmu-events/arch/powerpc/power10/translation.json+11−11

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

tools/perf/pmu-events/jevents.c+1−1

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

tools/perf/scripts/python/exported-sql-viewer.py+9−3

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

tools/perf/tests/attr/base-record+1−1

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

tools/perf/tests/pfm.c+2−2

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

tools/perf/tests/shell/stat_bpf_counters.sh+2−2

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

tools/perf/trace/beauty/include/linux/socket.h+0−2

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

tools/perf/util/bpf_counter.c+6−4

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

tools/perf/util/dwarf-aux.c+6−2

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

tools/perf/util/env.c+1−0

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

tools/perf/util/event.h+1−1

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

tools/perf/util/evlist.c+0−3

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

tools/perf/util/evsel.c+1−0

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

tools/perf/util/evsel.h+2−2

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

tools/perf/util/intel-pt-decoder/intel-pt-decoder.c+5−1

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

tools/perf/util/intel-pt.c+4−2

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

tools/perf/util/machine.c+2−1

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

tools/perf/util/metricgroup.c+8−6

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

tools/perf/util/parse-events.c+11−2

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

tools/perf/util/parse-events.l+1−0

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

tools/perf/util/perf_api_probe.c+10−0

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

tools/perf/util/perf_api_probe.h+1−0

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

tools/perf/util/pfm.c+10−1

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

tools/perf/util/probe-finder.c+3−0

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

tools/perf/util/session.c+1−0

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

tools/perf/util/stat-display.c+3−5

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

tools/perf/util/symbol-elf.c+1−0

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

tools/testing/selftests/bpf/network_helpers.c+1−1

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

tools/testing/selftests/bpf/network_helpers.h+1−0

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

tools/testing/selftests/bpf/prog_tests/ringbuf.c+48−1

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

tools/testing/selftests/bpf/prog_tests/tc_redirect.c+785−0

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

tools/testing/selftests/bpf/progs/test_tc_neigh.c+10−23

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

tools/testing/selftests/bpf/progs/test_tc_neigh_fib.c+6−3

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

tools/testing/selftests/bpf/progs/test_tc_peer.c+37−19

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

tools/testing/selftests/bpf/test_tc_redirect.sh+0−216

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

tools/testing/selftests/bpf/test_verifier.c+1−1

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

tools/testing/selftests/bpf/verifier/and.c+2−0

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

tools/testing/selftests/bpf/verifier/bounds.c+14−0

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

tools/testing/selftests/bpf/verifier/dead_code.c+2−0

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

tools/testing/selftests/bpf/verifier/jmp32.c+22−0

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

tools/testing/selftests/bpf/verifier/jset.c+6−4

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

tools/testing/selftests/bpf/verifier/stack_ptr.c+0−2

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

tools/testing/selftests/bpf/verifier/unpriv.c+2−0

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

tools/testing/selftests/bpf/verifier/value_ptr_arith.c+4−11

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

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

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

tools/testing/selftests/kvm/Makefile+2−1

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

tools/testing/selftests/kvm/demand_paging_test.c+109−65

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

tools/testing/selftests/kvm/hardware_disable_test.c+31−1

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

tools/testing/selftests/kvm/include/kvm_util.h+9−5

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

tools/testing/selftests/kvm/include/test_util.h+12−0

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

tools/testing/selftests/kvm/kvm_page_table_test.c+1−1

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

tools/testing/selftests/kvm/lib/kvm_util.c+263−67

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

tools/testing/selftests/kvm/lib/kvm_util_internal.h+15−2

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

tools/testing/selftests/kvm/lib/perf_test_util.c+4−2

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

tools/testing/selftests/kvm/lib/rbtree.c+1−0

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

tools/testing/selftests/kvm/lib/test_util.c+35−16

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

tools/testing/selftests/kvm/lib/x86_64/processor.c+4−12

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

tools/testing/selftests/kvm/memslot_modification_stress_test.c+11−7

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

tools/testing/selftests/kvm/memslot_perf_test.c+1037−0

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

tools/testing/selftests/kvm/x86_64/get_cpuid_test.c+5−0

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

tools/testing/selftests/kvm/x86_64/get_msr_index_features.c+2−6

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

tools/testing/selftests/nci/.gitignore+1−0

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

tools/testing/selftests/net/fib_tests.sh+25−0

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

tools/testing/selftests/net/icmp.sh+74−0

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

tools/testing/selftests/net/mptcp/mptcp_connect.sh+17−7

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

tools/testing/selftests/net/udpgro_fwd.sh+1−1

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

tools/testing/selftests/net/veth.sh+3−2

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

tools/testing/selftests/netfilter/Makefile+1−1

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

tools/testing/selftests/netfilter/nft_fib.sh+221−0

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

tools/testing/selftests/proc/.gitignore+1−0

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

tools/testing/selftests/tc-testing/tc-tests/qdiscs/fq_pie.json+4−4

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

tools/testing/selftests/wireguard/netns.sh+1−0

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

tools/testing/selftests/wireguard/qemu/kernel.config+0−1

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

virt/kvm/kvm_main.c+4−2

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

virt/lib/irqbypass.c+6−10

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