History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Cross-merge networking fixes after downstream PR. No conflicts or adjacent changes.

Jakub Kicinski committed 2 years ago

Commit cf244462 parents cacfd6b 41b9fb3413 files · +4264 −2285Browse files

Unified · Split

413 files
  1. CREDITS +13 −0
  2. Documentation/ABI/testing/sysfs-class-net-queues +11 −11
  3. Documentation/ABI/testing/sysfs-platform-silicom +1 −0
  4. Documentation/accel/introduction.rst +2 −2
  5. Documentation/admin-guide/kernel-parameters.rst +0 −5
  6. Documentation/admin-guide/kernel-per-CPU-kthreads.rst +6 −10
  7. Documentation/dev-tools/kunit/usage.rst +17 −2
  8. Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml +3 −3
  9. Documentation/devicetree/bindings/media/cnm,wave521c.yaml +2 −2
  10. Documentation/netlink/specs/rt_link.yaml +10 −0
  11. Documentation/sphinx/templates/kernel-toc.html +3 −1
  12. MAINTAINERS +11 −12
  13. Makefile +8 −8
  14. arch/Kconfig +1 −0
  15. arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-bletchley.dts +2 −2
  16. arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400.dts +2 −2
  17. arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts +1 −1
  18. arch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi +2 −2
  19. arch/arm/boot/dts/nxp/imx/imx6ull-phytec-tauri.dtsi +1 −1
  20. arch/arm/boot/dts/nxp/imx/imx7d-flex-concentrator.dts +1 −1
  21. arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi +1 −0
  22. arch/arm/boot/dts/ti/omap/am335x-moxa-uc-2100-common.dtsi +1 −1
  23. arch/arm64/boot/dts/exynos/google/gs101.dtsi +1 −1
  24. arch/arm64/boot/dts/freescale/imx8mm-phygate-tauri-l.dts +1 −1
  25. arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx.dtsi +1 −1
  26. arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi +1 −1
  27. arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +1 −1
  28. arch/arm64/boot/dts/freescale/imx8mp-venice-gw72xx.dtsi +1 −1
  29. arch/arm64/boot/dts/freescale/imx8mp-venice-gw73xx.dtsi +1 −1
  30. arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts +1 −1
  31. arch/arm64/boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts +1 −1
  32. arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +1 −1
  33. arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +1 −1
  34. arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts +1 −1
  35. arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi +1 −1
  36. arch/loongarch/include/asm/kvm_vcpu.h +2 −2
  37. arch/loongarch/kernel/smp.c +0 −1
  38. arch/loongarch/kvm/mmu.c +2 −2
  39. arch/loongarch/mm/tlb.c +10 −6
  40. arch/m68k/Makefile +2 −2
  41. arch/mips/alchemy/common/prom.c +1 −0
  42. arch/mips/alchemy/common/setup.c +1 −3
  43. arch/mips/bcm63xx/boards/board_bcm963xx.c +1 −1
  44. arch/mips/bcm63xx/dev-rng.c +1 −1
  45. arch/mips/bcm63xx/dev-uart.c +1 −0
  46. arch/mips/bcm63xx/dev-wdt.c +1 −1
  47. arch/mips/bcm63xx/irq.c +1 −1
  48. arch/mips/bcm63xx/setup.c +1 −1
  49. arch/mips/bcm63xx/timer.c +1 −1
  50. arch/mips/cobalt/setup.c +0 −3
  51. arch/mips/fw/arc/memory.c +1 −1
  52. arch/mips/include/asm/mach-au1x00/au1000.h +3 −0
  53. arch/mips/include/asm/mach-cobalt/cobalt.h +3 −0
  54. arch/mips/kernel/elf.c +6 −0
  55. arch/mips/kernel/traps.c +7 −1
  56. arch/mips/lantiq/prom.c +3 −4
  57. arch/mips/loongson64/init.c +3 −0
  58. arch/mips/loongson64/numa.c +2 −0
  59. arch/mips/sgi-ip27/Makefile +1 −1
  60. arch/mips/sgi-ip27/ip27-berr.c +3 −1
  61. arch/mips/sgi-ip27/ip27-common.h +2 −0
  62. arch/mips/sgi-ip27/ip27-hubio.c +0 −185
  63. arch/mips/sgi-ip27/ip27-irq.c +2 −0
  64. arch/mips/sgi-ip27/ip27-memory.c +1 −0
  65. arch/mips/sgi-ip27/ip27-nmi.c +8 −17
  66. arch/mips/sgi-ip30/ip30-console.c +1 −0
  67. arch/mips/sgi-ip30/ip30-setup.c +1 −0
  68. arch/mips/sgi-ip32/crime.c +4 −2
  69. arch/mips/sgi-ip32/ip32-berr.c +2 −0
  70. arch/mips/sgi-ip32/ip32-common.h +15 −0
  71. arch/mips/sgi-ip32/ip32-irq.c +2 −4
  72. arch/mips/sgi-ip32/ip32-memory.c +1 −0
  73. arch/mips/sgi-ip32/ip32-reset.c +2 −0
  74. arch/mips/sgi-ip32/ip32-setup.c +1 −2
  75. arch/parisc/Kconfig +0 −1
  76. arch/parisc/Makefile +2 −2
  77. arch/parisc/include/asm/assembly.h +1 −0
  78. arch/parisc/include/asm/extable.h +64 −0
  79. arch/parisc/include/asm/special_insns.h +4 −2
  80. arch/parisc/include/asm/uaccess.h +7 −41
  81. arch/parisc/kernel/cache.c +7 −3
  82. arch/parisc/kernel/drivers.c +4 −1
  83. arch/parisc/kernel/unaligned.c +22 −22
  84. arch/parisc/kernel/vmlinux.lds.S +1 −1
  85. arch/parisc/mm/fault.c +8 −3
  86. arch/riscv/boot/dts/sophgo/sg2042.dtsi +48 −32
  87. arch/um/Makefile +3 −1
  88. arch/x86/Makefile +5 −5
  89. arch/x86/include/asm/cpufeatures.h +1 −3
  90. arch/x86/include/asm/intel-family.h +2 −0
  91. arch/x86/include/asm/kmsan.h +16 −1
  92. arch/x86/include/asm/syscall_wrapper.h +21 −4
  93. arch/x86/kernel/alternative.c +1 −1
  94. arch/x86/kernel/cpu/amd.c +24 −4
  95. block/blk-map.c +10 −3
  96. block/ioctl.c +0 −2
  97. block/partitions/core.c +5 −0
  98. drivers/accel/ivpu/ivpu_debugfs.c +16 −4
  99. drivers/accel/ivpu/ivpu_drv.c +71 −55
  100. drivers/accel/ivpu/ivpu_drv.h +3 −2
  101. drivers/accel/ivpu/ivpu_gem.c +52 −90
  102. drivers/accel/ivpu/ivpu_gem.h +1 −2
  103. drivers/accel/ivpu/ivpu_hw_37xx.c +4 −10
  104. drivers/accel/ivpu/ivpu_hw_40xx.c +23 −6
  105. drivers/accel/ivpu/ivpu_ipc.c +2 −4
  106. drivers/accel/ivpu/ivpu_job.c +73 −87
  107. drivers/accel/ivpu/ivpu_job.h +1 −2
  108. drivers/accel/ivpu/ivpu_mmu.c +15 −7
  109. drivers/accel/ivpu/ivpu_mmu.h +1 −0
  110. drivers/accel/ivpu/ivpu_mmu_context.c +9 −0
  111. drivers/accel/ivpu/ivpu_pm.c +35 −17
  112. drivers/accel/ivpu/ivpu_pm.h +4 −2
  113. drivers/ata/ahci.c +28 −6
  114. drivers/ata/ahci.h +1 −0
  115. drivers/ata/libata-sata.c +1 −1
  116. drivers/block/aoe/aoeblk.c +4 −1
  117. drivers/cpufreq/amd-pstate.c +3 −4
  118. drivers/cpufreq/intel_pstate.c +34 −21
  119. drivers/crypto/caam/caamalg_qi2.c +5 −2
  120. drivers/crypto/caam/caamhash.c +5 −2
  121. drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c +1 −0
  122. drivers/cxl/core/region.c +2 −2
  123. drivers/cxl/pci.c +15 −11
  124. drivers/firewire/core-device.c +13 −5
  125. drivers/firmware/arm_ffa/driver.c +57 −28
  126. drivers/firmware/arm_scmi/clock.c +2 −3
  127. drivers/firmware/arm_scmi/common.h +1 −0
  128. drivers/firmware/arm_scmi/mailbox.c +14 −0
  129. drivers/firmware/arm_scmi/perf.c +18 −5
  130. drivers/firmware/arm_scmi/raw_mode.c +8 −4
  131. drivers/firmware/arm_scmi/shmem.c +7 −1
  132. drivers/firmware/sysfb.c +1 −1
  133. drivers/gpio/gpio-eic-sprd.c +28 −4
  134. drivers/gpio/gpiolib-acpi.c +14 −0
  135. drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c +8 −0
  136. drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +16 −1
  137. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 −1
  138. drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 −1
  139. drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 −1
  140. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 −0
  141. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +1 −0
  142. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +10 −11
  143. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c +4 −1
  144. drivers/gpu/drm/amd/display/dc/dc.h +1 −0
  145. drivers/gpu/drm/amd/display/dc/dc_types.h +5 −0
  146. drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +8 −1
  147. drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c +2 −2
  148. drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h +47 −0
  149. drivers/gpu/drm/amd/display/modules/power/power_helpers.c +5 −0
  150. drivers/gpu/drm/amd/display/modules/power/power_helpers.h +1 −0
  151. drivers/gpu/drm/amd/include/amd_shared.h +1 −0
  152. drivers/gpu/drm/amd/include/amdgpu_reg_state.h +1 −1
  153. drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +4 −10
  154. drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +2 −0
  155. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +2 −0
  156. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +52 −2
  157. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 −2
  158. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +52 −2
  159. drivers/gpu/drm/bridge/analogix/anx7625.c +6 −1
  160. drivers/gpu/drm/bridge/analogix/anx7625.h +2 −0
  161. drivers/gpu/drm/bridge/parade-ps8640.c +23 −0
  162. drivers/gpu/drm/bridge/samsung-dsim.c +2 −30
  163. drivers/gpu/drm/bridge/sii902x.c +29 −13
  164. drivers/gpu/drm/display/drm_dp_mst_topology.c +2 −0
  165. drivers/gpu/drm/exynos/exynos5433_drm_decon.c +2 −2
  166. drivers/gpu/drm/exynos/exynos_drm_fimd.c +3 −3
  167. drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 −1
  168. drivers/gpu/drm/i915/Makefile +0 −1
  169. drivers/gpu/drm/i915/display/icl_dsi.c +1 −2
  170. drivers/gpu/drm/i915/display/intel_psr.c +12 −2
  171. drivers/gpu/drm/nouveau/nouveau_fence.c +5 −23
  172. drivers/gpu/drm/nouveau/nouveau_fence.h +1 −4
  173. drivers/gpu/drm/panel/Kconfig +2 −0
  174. drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c +1 −1
  175. drivers/gpu/drm/panel/panel-simple.c +2 −0
  176. drivers/gpu/drm/scheduler/sched_main.c +7 −8
  177. drivers/gpu/drm/tests/drm_mm_test.c +4 −1
  178. drivers/gpu/drm/ttm/ttm_device.c +9 −3
  179. drivers/gpu/drm/v3d/v3d_submit.c +28 −7
  180. drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h +5 −6
  181. drivers/gpu/drm/xe/tests/xe_wa_test.c +0 −3
  182. drivers/gpu/drm/xe/xe_device.c +1 −1
  183. drivers/gpu/drm/xe/xe_dma_buf.c +1 −1
  184. drivers/gpu/drm/xe/xe_hwmon.c +1 −1
  185. drivers/gpu/drm/xe/xe_migrate.c +7 −7
  186. drivers/gpu/drm/xe/xe_mmio.c +2 −2
  187. drivers/gpu/drm/xe/xe_vm.c +14 −9
  188. drivers/hid/bpf/hid_bpf_dispatch.c +74 −27
  189. drivers/hid/bpf/hid_bpf_dispatch.h +2 −2
  190. drivers/hid/bpf/hid_bpf_jmp_table.c +20 −20
  191. drivers/hid/hid-ids.h +3 −0
  192. drivers/hid/hid-logitech-hidpp.c +2 −0
  193. drivers/hid/hid-nvidia-shield.c +4 −0
  194. drivers/hid/hid-steam.c +18 −18
  195. drivers/hid/hidraw.c +5 −2
  196. drivers/hid/i2c-hid/i2c-hid-core.c +5 −1
  197. drivers/hid/i2c-hid/i2c-hid-of.c +1 −0
  198. drivers/md/raid1.c +1 −1
  199. drivers/media/common/videobuf2/videobuf2-core.c +1 −1
  200. drivers/media/common/videobuf2/videobuf2-v4l2.c +26 −29
  201. drivers/media/platform/chips-media/wave5/wave5-vpu.c +1 −1
  202. drivers/net/dsa/mt7530.c +1 −2
  203. drivers/net/dsa/mv88e6xxx/chip.c +1 −1
  204. drivers/net/dsa/qca/qca8k-8xxx.c +1 −2
  205. drivers/net/ethernet/amd/pds_core/adminq.c +48 −16
  206. drivers/net/ethernet/amd/pds_core/core.c +36 −10
  207. drivers/net/ethernet/amd/pds_core/core.h +1 −1
  208. drivers/net/ethernet/amd/pds_core/debugfs.c +4 −0
  209. drivers/net/ethernet/amd/pds_core/dev.c +8 −8
  210. drivers/net/ethernet/amd/pds_core/devlink.c +2 −1
  211. drivers/net/ethernet/amd/pds_core/fw.c +3 −0
  212. drivers/net/ethernet/amd/pds_core/main.c +22 −4
  213. drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +1 −1
  214. drivers/net/ethernet/google/gve/gve_rx.c +4 −4
  215. drivers/net/ethernet/intel/e1000e/e1000.h +20 −0
  216. drivers/net/ethernet/intel/e1000e/ptp.c +15 −7
  217. drivers/net/ethernet/intel/idpf/virtchnl2.h +1 −1
  218. drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +2 −1
  219. drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +0 −1
  220. drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 −2
  221. drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +3 −4
  222. drivers/net/ethernet/mediatek/mtk_eth_soc.c +4 −1
  223. drivers/net/ethernet/microchip/lan966x/lan966x_port.c +3 −2
  224. drivers/net/ethernet/netronome/nfp/flower/conntrack.c +43 −3
  225. drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +4 −0
  226. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 −0
  227. drivers/net/hyperv/netvsc.c +4 −1
  228. drivers/net/phy/mediatek-ge-soc.c +81 −66
  229. drivers/net/xen-netback/netback.c +40 −44
  230. drivers/platform/mellanox/mlxbf-pmc.c +2 −2
  231. drivers/platform/mellanox/mlxbf-tmfifo.c +67 −0
  232. drivers/platform/x86/amd/pmf/Kconfig +1 −0
  233. drivers/platform/x86/amd/pmf/spc.c +36 −0
  234. drivers/platform/x86/amd/pmf/tee-if.c +3 −1
  235. drivers/platform/x86/intel/ifs/load.c +2 −1
  236. drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c +41 −41
  237. drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h +16 −16
  238. drivers/platform/x86/intel/wmi/sbl-fw-update.c +2 −2
  239. drivers/platform/x86/p2sb.c +140 −42
  240. drivers/platform/x86/touchscreen_dmi.c +35 −0
  241. drivers/platform/x86/wmi.c +112 −69
  242. drivers/regulator/max5970-regulator.c +1 −1
  243. drivers/regulator/pwm-regulator.c +43 −0
  244. drivers/regulator/ti-abb-regulator.c +19 −3
  245. drivers/scsi/initio.c +1 −2
  246. drivers/scsi/isci/request.c +1 −1
  247. drivers/scsi/scsi_error.c +4 −4
  248. drivers/scsi/scsi_lib.c +1 −1
  249. drivers/scsi/scsi_priv.h +1 −1
  250. drivers/scsi/storvsc_drv.c +7 −5
  251. drivers/scsi/virtio_scsi.c +0 −2
  252. drivers/soc/apple/mailbox.c +3 −3
  253. drivers/spi/spi-bcm-qspi.c +2 −2
  254. drivers/spi/spi-cadence.c +9 −8
  255. drivers/spi/spi-cs42l43.c +4 −1
  256. drivers/spi/spi-hisi-sfc-v3xx.c +5 −0
  257. drivers/spi/spi-imx.c +2 −2
  258. drivers/spi/spi-intel-pci.c +1 −1
  259. drivers/spi/spi-sh-msiof.c +8 −8
  260. drivers/spi/spi.c +4 −0
  261. drivers/thermal/intel/intel_powerclamp.c +0 −32
  262. fs/bcachefs/alloc_background.c +1 −1
  263. fs/bcachefs/btree_locking.c +2 −2
  264. fs/bcachefs/debug.c +1 −1
  265. fs/bcachefs/fs-io.c +1 −1
  266. fs/bcachefs/fsck.c +12 −11
  267. fs/bcachefs/journal.c +1 −1
  268. fs/bcachefs/journal_io.c +2 −1
  269. fs/bcachefs/str_hash.h +15 −7
  270. fs/bcachefs/util.c +5 −5
  271. fs/bcachefs/util.h +2 −2
  272. fs/erofs/compress.h +2 −3
  273. fs/erofs/decompressor.c +3 −2
  274. fs/erofs/decompressor_deflate.c +13 −6
  275. fs/erofs/decompressor_lzma.c +12 −5
  276. fs/erofs/fscache.c +1 −1
  277. fs/erofs/inode.c +1 −1
  278. fs/erofs/utils.c +1 −1
  279. fs/erofs/zdata.c +54 −44
  280. fs/exfat/inode.c +3 −4
  281. fs/hugetlbfs/inode.c +1 −1
  282. fs/jfs/jfs_dmap.c +1 −7
  283. fs/smb/client/cached_dir.c +20 −4
  284. fs/smb/client/cifsencrypt.c +1 −1
  285. fs/smb/client/cifsfs.c +14 −3
  286. fs/smb/client/cifsglob.h +13 −1
  287. fs/smb/client/file.c +5 −4
  288. fs/smb/client/inode.c +5 −3
  289. fs/smb/client/readdir.c +1 −1
  290. fs/smb/client/smb2inode.c +27 −6
  291. fs/smb/client/smb2ops.c +127 −14
  292. fs/smb/client/smb2pdu.c +237 −28
  293. fs/smb/client/smb2proto.h +5 −0
  294. fs/smb/client/smbencrypt.c +0 −7
  295. fs/smb/client/transport.c +12 −2
  296. fs/smb/server/ksmbd_netlink.h +2 −1
  297. fs/smb/server/transport_ipc.c +2 −2
  298. fs/smb/server/transport_tcp.c +2 −0
  299. fs/tracefs/event_inode.c +0 −38
  300. fs/tracefs/internal.h +0 −1
  301. fs/xfs/xfs_super.c +17 −10
  302. include/linux/hid_bpf.h +0 −11
  303. include/linux/libata.h +1 −1
  304. include/linux/lsm_hook_defs.h +2 −2
  305. include/linux/mman.h +1 −0
  306. include/linux/mmzone.h +3 −3
  307. include/linux/netfilter/ipset/ip_set.h +4 −0
  308. include/linux/spi/spi.h +1 −1
  309. include/linux/syscalls.h +1 −0
  310. include/net/af_unix.h +14 −6
  311. include/net/ip.h +1 −1
  312. include/net/netfilter/nf_tables.h +2 −0
  313. include/uapi/drm/ivpu_accel.h +20 −5
  314. io_uring/opdef.c +0 −1
  315. io_uring/openclose.c +4 −0
  316. kernel/events/uprobes.c +1 −1
  317. kernel/futex/core.c +12 −3
  318. kernel/futex/pi.c +8 −3
  319. kernel/irq/irqdesc.c +1 −1
  320. kernel/time/clocksource.c +24 −1
  321. kernel/time/tick-sched.c +5 −0
  322. kernel/trace/trace_events_trigger.c +4 −2
  323. lib/kunit/device.c +2 −2
  324. lib/kunit/executor.c +4 −0
  325. lib/kunit/kunit-test.c +1 −1
  326. lib/kunit/test.c +11 −3
  327. lib/stackdepot.c +263 −110
  328. mm/huge_memory.c +14 −4
  329. mm/memblock.c +3 −0
  330. mm/memcontrol.c +25 −4
  331. mm/memory-failure.c +1 −1
  332. mm/memory.c +1 −1
  333. mm/mmap.c +4 −2
  334. mm/page-writeback.c +1 −1
  335. mm/readahead.c +2 −2
  336. mm/userfaultfd.c +13 −2
  337. net/batman-adv/multicast.c +3 −0
  338. net/bridge/br_multicast.c +15 −5
  339. net/bridge/br_private.h +2 −2
  340. net/devlink/port.c +1 −1
  341. net/hsr/hsr_device.c +2 −2
  342. net/ipv4/ip_output.c +6 −6
  343. net/ipv4/ip_sockglue.c +4 −2
  344. net/ipv4/ipmr.c +1 −1
  345. net/ipv4/raw.c +1 −1
  346. net/ipv4/tcp.c +11 −1
  347. net/ipv4/udp.c +1 −1
  348. net/ipv6/addrconf_core.c +14 −7
  349. net/ipv6/ip6_tunnel.c +18 −3
  350. net/llc/af_llc.c +2 −0
  351. net/mptcp/protocol.c +0 −3
  352. net/netfilter/ipset/ip_set_bitmap_gen.h +11 −3
  353. net/netfilter/ipset/ip_set_core.c +28 −9
  354. net/netfilter/ipset/ip_set_hash_gen.h +12 −3
  355. net/netfilter/ipset/ip_set_list_set.c +10 −3
  356. net/netfilter/nf_conntrack_proto_sctp.c +1 −1
  357. net/netfilter/nf_conntrack_proto_tcp.c +6 −4
  358. net/netfilter/nf_log.c +4 −3
  359. net/netfilter/nf_tables_api.c +9 −5
  360. net/netfilter/nft_ct.c +24 −0
  361. net/netfilter/nft_tunnel.c +1 −0
  362. net/nfc/nci/core.c +4 −0
  363. net/smc/smc_core.c +9 −3
  364. net/sunrpc/svc.c +2 −2
  365. net/unix/af_unix.c +6 −8
  366. net/unix/diag.c +1 −1
  367. scripts/Makefile.defconf +4 −4
  368. scripts/kconfig/symbol.c +3 −1
  369. scripts/mod/modpost.c +3 −12
  370. scripts/mod/modpost.h +1 −5
  371. scripts/package/kernel.spec +11 −11
  372. security/security.c +40 −5
  373. tools/power/cpupower/bench/Makefile +1 −1
  374. tools/testing/cxl/Kbuild +2 −0
  375. tools/testing/cxl/test/Kbuild +2 −0
  376. tools/testing/nvdimm/Kbuild +2 −0
  377. tools/testing/selftests/drivers/net/bonding/lag_lib.sh +11 −0
  378. tools/testing/selftests/drivers/net/team/config +3 −1
  379. tools/testing/selftests/hid/tests/test_wacom_generic.py +4 −4
  380. tools/testing/selftests/livepatch/functions.sh +17 −20
  381. tools/testing/selftests/mm/charge_reserved_hugetlb.sh +1 −1
  382. tools/testing/selftests/mm/ksm_tests.c +1 −1
  383. tools/testing/selftests/mm/map_hugetlb.c +7 −0
  384. tools/testing/selftests/mm/mremap_test.c +14 −13
  385. tools/testing/selftests/mm/va_high_addr_switch.sh +6 −0
  386. tools/testing/selftests/mm/write_hugetlb_memory.sh +1 −1
  387. tools/testing/selftests/net/Makefile +5 −4
  388. tools/testing/selftests/net/config +16 −0
  389. tools/testing/selftests/net/forwarding/Makefile +1 −1
  390. tools/testing/selftests/net/lib.sh +4 −1
  391. tools/testing/selftests/net/mptcp/config +3 −0
  392. tools/testing/selftests/net/mptcp/mptcp_join.sh +11 −16
  393. tools/testing/selftests/net/mptcp/mptcp_lib.sh +1 −1
  394. tools/testing/selftests/net/mptcp/settings +1 −1
  395. tools/testing/selftests/net/mptcp/simult_flows.sh +4 −4
  396. tools/testing/selftests/net/net_helper.sh +0 −0
  397. tools/testing/selftests/net/pmtu.sh +9 −9
  398. tools/testing/selftests/net/setup_loopback.sh +0 −0
  399. tools/testing/selftests/net/setup_veth.sh +1 −1
  400. tools/testing/selftests/net/tcp_ao/config +10 −0
  401. tools/testing/selftests/net/tcp_ao/key-management.c +26 −20
  402. tools/testing/selftests/net/tcp_ao/lib/sock.c +8 −4
  403. tools/testing/selftests/net/tcp_ao/rst.c +90 −48
  404. tools/testing/selftests/net/tcp_ao/settings +1 −0
  405. tools/testing/selftests/net/udpgro.sh +2 −2
  406. tools/testing/selftests/net/udpgro_bench.sh +2 −2
  407. tools/testing/selftests/net/udpgro_frglist.sh +3 −3
  408. tools/testing/selftests/net/udpgro_fwd.sh +5 −3
  409. tools/testing/selftests/net/veth.sh +2 −2
  410. tools/testing/selftests/net/xdp_dummy.c +13 −0
  411. tools/testing/selftests/rseq/basic_percpu_ops_test.c +12 −2
  412. tools/testing/selftests/rseq/param_test.c +16 −6
  413. tools/testing/selftests/seccomp/seccomp_benchmark.c +64 −40
CREDITS+13−0
@@ -2161,6 +2161,19 @@ N: Mike Kravetz · 2160 unmodified lines
21612161 E: mike.kravetz@oracle.com
21622162 D: Maintenance and development of the hugetlb subsystem
21632163
2164+N: Seth Jennings
2165+E: sjenning@redhat.com
2166+D: Creation and maintenance of zswap
2167+
2168+N: Dan Streetman
2169+E: ddstreet@ieee.org
2170+D: Maintenance and development of zswap
2171+D: Creation and maintenance of the zpool API
2172+
2173+N: Vitaly Wool
2174+E: vitaly.wool@konsulko.com
2175+D: Maintenance and development of zswap
2176+
21642177 N: Andreas S. Krebs
21652178 E: akrebs@altavista.net
21662179 D: CYPRESS CY82C693 chipset IDE, Digital's PC-Alpha 164SX boards
Documentation/ABI/testing/sysfs-class-net-queues+11−11
@@ -1,4 +1,4 @@
1−What: /sys/class/<iface>/queues/rx-<queue>/rps_cpus
1+What: /sys/class/net/<iface>/queues/rx-<queue>/rps_cpus
22 Date: March 2010
33 KernelVersion: 2.6.35
44 Contact: netdev@vger.kernel.org
@@ -8,7 +8,7 @@ Description: · 3 unmodified lines
88 network device queue. Possible values depend on the number
99 of available CPU(s) in the system.
1010
11−What: /sys/class/<iface>/queues/rx-<queue>/rps_flow_cnt
11+What: /sys/class/net/<iface>/queues/rx-<queue>/rps_flow_cnt
1212 Date: April 2010
1313 KernelVersion: 2.6.35
1414 Contact: netdev@vger.kernel.org
@@ -16,7 +16,7 @@ Description: · 1 unmodified line
1616 Number of Receive Packet Steering flows being currently
1717 processed by this particular network device receive queue.
1818
19−What: /sys/class/<iface>/queues/tx-<queue>/tx_timeout
19+What: /sys/class/net/<iface>/queues/tx-<queue>/tx_timeout
2020 Date: November 2011
2121 KernelVersion: 3.3
2222 Contact: netdev@vger.kernel.org
@@ -24,7 +24,7 @@ Description: · 1 unmodified line
2424 Indicates the number of transmit timeout events seen by this
2525 network interface transmit queue.
2626
27−What: /sys/class/<iface>/queues/tx-<queue>/tx_maxrate
27+What: /sys/class/net/<iface>/queues/tx-<queue>/tx_maxrate
2828 Date: March 2015
2929 KernelVersion: 4.1
3030 Contact: netdev@vger.kernel.org
@@ -32,7 +32,7 @@ Description: · 1 unmodified line
3232 A Mbps max-rate set for the queue, a value of zero means disabled,
3333 default is disabled.
3434
35−What: /sys/class/<iface>/queues/tx-<queue>/xps_cpus
35+What: /sys/class/net/<iface>/queues/tx-<queue>/xps_cpus
3636 Date: November 2010
3737 KernelVersion: 2.6.38
3838 Contact: netdev@vger.kernel.org
@@ -42,7 +42,7 @@ Description: · 3 unmodified lines
4242 network device transmit queue. Possible values depend on the
4343 number of available CPU(s) in the system.
4444
45−What: /sys/class/<iface>/queues/tx-<queue>/xps_rxqs
45+What: /sys/class/net/<iface>/queues/tx-<queue>/xps_rxqs
4646 Date: June 2018
4747 KernelVersion: 4.18.0
4848 Contact: netdev@vger.kernel.org
@@ -53,7 +53,7 @@ Description: · 4 unmodified lines
5353 number of available receive queue(s) in the network device.
5454 Default is disabled.
5555
56−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time
56+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/hold_time
5757 Date: November 2011
5858 KernelVersion: 3.3
5959 Contact: netdev@vger.kernel.org
@@ -62,7 +62,7 @@ Description: · 2 unmodified lines
6262 of this particular network device transmit queue.
6363 Default value is 1000.
6464
65−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/inflight
65+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/inflight
6666 Date: November 2011
6767 KernelVersion: 3.3
6868 Contact: netdev@vger.kernel.org
@@ -70,7 +70,7 @@ Description: · 1 unmodified line
7070 Indicates the number of bytes (objects) in flight on this
7171 network device transmit queue.
7272
73−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit
73+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit
7474 Date: November 2011
7575 KernelVersion: 3.3
7676 Contact: netdev@vger.kernel.org
@@ -79,7 +79,7 @@ Description: · 2 unmodified lines
7979 on this network device transmit queue. This value is clamped
8080 to be within the bounds defined by limit_max and limit_min.
8181
82−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max
82+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_max
8383 Date: November 2011
8484 KernelVersion: 3.3
8585 Contact: netdev@vger.kernel.org
@@ -88,7 +88,7 @@ Description: · 2 unmodified lines
8888 queued on this network device transmit queue. See
8989 include/linux/dynamic_queue_limits.h for the default value.
9090
91−What: /sys/class/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min
91+What: /sys/class/net/<iface>/queues/tx-<queue>/byte_queue_limits/limit_min
9292 Date: November 2011
9393 KernelVersion: 3.3
9494 Contact: netdev@vger.kernel.org
Documentation/ABI/testing/sysfs-platform-silicom+1−0
@@ -10,6 +10,7 @@ What: /sys/devices/platform/silicom-platform/power_cycle · 9 unmodified lines
1010 Date: November 2023
1111 KernelVersion: 6.7
1212 Contact: Henry Shi <henrys@silicom-usa.com>
13+Description:
1314 This file allow user to power cycle the platform.
1415 Default value is 0; when set to 1, it powers down
1516 the platform, waits 5 seconds, then powers on the
Documentation/accel/introduction.rst+2−2
@@ -101,8 +101,8 @@ External References · 100 unmodified lines
101101 email threads
102102 -------------
103103
104−* `Initial discussion on the New subsystem for acceleration devices <https://lkml.org/lkml/2022/7/31/83>`_ - Oded Gabbay (2022)
105−* `patch-set to add the new subsystem <https://lkml.org/lkml/2022/10/22/544>`_ - Oded Gabbay (2022)
104+* `Initial discussion on the New subsystem for acceleration devices <https://lore.kernel.org/lkml/CAFCwf11=9qpNAepL7NL+YAV_QO=Wv6pnWPhKHKAepK3fNn+2Dg@mail.gmail.com/>`_ - Oded Gabbay (2022)
105+* `patch-set to add the new subsystem <https://lore.kernel.org/lkml/20221022214622.18042-1-ogabbay@kernel.org/>`_ - Oded Gabbay (2022)
106106
107107 Conference talks
108108 ----------------
Documentation/admin-guide/kernel-parameters.rst+0−5
@@ -218,8 +218,3 @@ bytes respectively. Such letter suffixes can also be entirely omitted: · 217 unmodified lines
218218
219219 .. include:: kernel-parameters.txt
220220 :literal:
221−
222−Todo
223−----
224−
225− Add more DRM drivers.
Documentation/admin-guide/kernel-per-CPU-kthreads.rst+6−10
@@ -243,13 +243,9 @@ To reduce its OS jitter, do any of the following: · 242 unmodified lines
243243 3. Do any of the following needed to avoid jitter that your
244244 application cannot tolerate:
245245
246− a. Build your kernel with CONFIG_SLUB=y rather than
247− CONFIG_SLAB=y, thus avoiding the slab allocator's periodic
248− use of each CPU's workqueues to run its cache_reap()
249− function.
250− b. Avoid using oprofile, thus avoiding OS jitter from
246+ a. Avoid using oprofile, thus avoiding OS jitter from
251247 wq_sync_buffer().
252− c. Limit your CPU frequency so that a CPU-frequency
248+ b. Limit your CPU frequency so that a CPU-frequency
253249 governor is not required, possibly enlisting the aid of
254250 special heatsinks or other cooling technologies. If done
255251 correctly, and if you CPU architecture permits, you should
@@ -259,7 +255,7 @@ To reduce its OS jitter, do any of the following: · 3 unmodified lines
259255
260256 WARNING: Please check your CPU specifications to
261257 make sure that this is safe on your particular system.
262− d. As of v3.18, Christoph Lameter's on-demand vmstat workers
258+ c. As of v3.18, Christoph Lameter's on-demand vmstat workers
263259 commit prevents OS jitter due to vmstat_update() on
264260 CONFIG_SMP=y systems. Before v3.18, is not possible
265261 to entirely get rid of the OS jitter, but you can
@@ -274,7 +270,7 @@ To reduce its OS jitter, do any of the following: · 8 unmodified lines
274270 (based on an earlier one from Gilad Ben-Yossef) that
275271 reduces or even eliminates vmstat overhead for some
276272 workloads at https://lore.kernel.org/r/00000140e9dfd6bd-40db3d4f-c1be-434f-8132-7820f81bb586-000000@email.amazonses.com.
277− e. If running on high-end powerpc servers, build with
273+ d. If running on high-end powerpc servers, build with
278274 CONFIG_PPC_RTAS_DAEMON=n. This prevents the RTAS
279275 daemon from running on each CPU every second or so.
280276 (This will require editing Kconfig files and will defeat
@@ -282,12 +278,12 @@ To reduce its OS jitter, do any of the following: · 1 unmodified line
282278 due to the rtas_event_scan() function.
283279 WARNING: Please check your CPU specifications to
284280 make sure that this is safe on your particular system.
285− f. If running on Cell Processor, build your kernel with
281+ e. If running on Cell Processor, build your kernel with
286282 CBE_CPUFREQ_SPU_GOVERNOR=n to avoid OS jitter from
287283 spu_gov_work().
288284 WARNING: Please check your CPU specifications to
289285 make sure that this is safe on your particular system.
290− g. If running on PowerMAC, build your kernel with
286+ f. If running on PowerMAC, build your kernel with
291287 CONFIG_PMAC_RACKMETER=n to disable the CPU-meter,
292288 avoiding OS jitter from rackmeter_do_timer().
293289
Documentation/dev-tools/kunit/usage.rst+17−2
@@ -671,8 +671,23 @@ Testing Static Functions · 670 unmodified lines
671671 ------------------------
672672
673673 If we do not want to expose functions or variables for testing, one option is to
674−conditionally ``#include`` the test file at the end of your .c file. For
675−example:
674+conditionally export the used symbol. For example:
675+
676+.. code-block:: c
677+
678+ /* In my_file.c */
679+
680+ VISIBLE_IF_KUNIT int do_interesting_thing();
681+ EXPORT_SYMBOL_IF_KUNIT(do_interesting_thing);
682+
683+ /* In my_file.h */
684+
685+ #if IS_ENABLED(CONFIG_KUNIT)
686+ int do_interesting_thing(void);
687+ #endif
688+
689+Alternatively, you could conditionally ``#include`` the test file at the end of
690+your .c file. For example:
676691
677692 .. code-block:: c
678693
Documentation/devicetree/bindings/display/samsung/samsung,exynos-mixer.yaml+3−3
@@ -85,7 +85,7 @@ allOf: · 84 unmodified lines
8585 clocks:
8686 minItems: 6
8787 maxItems: 6
88− regs:
88+ reg:
8989 minItems: 2
9090 maxItems: 2
9191
@@ -99,7 +99,7 @@ allOf: · 7 unmodified lines
9999 clocks:
100100 minItems: 4
101101 maxItems: 4
102− regs:
102+ reg:
103103 minItems: 2
104104 maxItems: 2
105105
@@ -116,7 +116,7 @@ allOf: · 10 unmodified lines
116116 clocks:
117117 minItems: 3
118118 maxItems: 3
119− regs:
119+ reg:
120120 minItems: 1
121121 maxItems: 1
122122
Documentation/devicetree/bindings/media/cnm,wave521c.yaml+2−2
@@ -17,7 +17,7 @@ properties: · 16 unmodified lines
1717 compatible:
1818 items:
1919 - enum:
20− - ti,k3-j721s2-wave521c
20+ - ti,j721s2-wave521c
2121 - const: cnm,wave521c
2222
2323 reg:
@@ -53,7 +53,7 @@ additionalProperties: false · 29 unmodified lines
5353 examples:
5454 - |
5555 vpu: video-codec@12345678 {
56− compatible = "ti,k3-j721s2-wave521c", "cnm,wave521c";
56+ compatible = "ti,j721s2-wave521c", "cnm,wave521c";
5757 reg = <0x12345678 0x1000>;
5858 clocks = <&clks 42>;
5959 interrupts = <42>;
Documentation/netlink/specs/rt_link.yaml+10−0
@@ -942,6 +942,10 @@ attribute-sets: · 941 unmodified lines
942942 -
943943 name: gro-ipv4-max-size
944944 type: u32
945+ -
946+ name: dpll-pin
947+ type: nest
948+ nested-attributes: link-dpll-pin-attrs
945949 -
946950 name: af-spec-attrs
947951 attributes:
@@ -1627,6 +1631,12 @@ attribute-sets: · 679 unmodified lines
16271631 -
16281632 name: used
16291633 type: u8
1634+ -
1635+ name: link-dpll-pin-attrs
1636+ attributes:
1637+ -
1638+ name: id
1639+ type: u32
16301640
16311641 sub-messages:
16321642 -
Documentation/sphinx/templates/kernel-toc.html+3−1
@@ -12,5 +12,7 @@ · 11 unmodified lines
1212 <script type="text/javascript"> <!--
1313 var sbar = document.getElementsByClassName("sphinxsidebar")[0];
1414 let currents = document.getElementsByClassName("current")
15− sbar.scrollTop = currents[currents.length - 1].offsetTop;
15+ if (currents.length) {
16+ sbar.scrollTop = currents[currents.length - 1].offsetTop;
17+ }
1618 --> </script>
MAINTAINERS+11−12
@@ -3168,10 +3168,10 @@ F: drivers/hwmon/asus-ec-sensors.c · 3167 unmodified lines
31683168
31693169 ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS
31703170 M: Corentin Chary <corentin.chary@gmail.com>
3171−L: acpi4asus-user@lists.sourceforge.net
3171+M: Luke D. Jones <luke@ljones.dev>
31723172 L: platform-driver-x86@vger.kernel.org
31733173 S: Maintained
3174−W: http://acpi4asus.sf.net
3174+W: https://asus-linux.org/
31753175 F: drivers/platform/x86/asus*.c
31763176 F: drivers/platform/x86/eeepc*.c
31773177
@@ -5961,7 +5961,6 @@ S: Maintained · 2783 unmodified lines
59615961 F: drivers/platform/x86/dell/dell-wmi-descriptor.c
59625962
59635963 DELL WMI HARDWARE PRIVACY SUPPORT
5964−M: Perry Yuan <Perry.Yuan@dell.com>
59655964 L: Dell.Client.Kernel@dell.com
59665965 L: platform-driver-x86@vger.kernel.org
59675966 S: Maintained
@@ -10287,7 +10286,7 @@ F: drivers/scsi/ibmvscsi/ibmvscsi* · 4319 unmodified lines
1028710286 F: include/scsi/viosrp.h
1028810287
1028910288 IBM Power Virtual SCSI Device Target Driver
10290−M: Michael Cyr <mikecyr@linux.ibm.com>
10289+M: Tyrel Datwyler <tyreld@linux.ibm.com>
1029110290 L: linux-scsi@vger.kernel.org
1029210291 L: target-devel@vger.kernel.org
1029310292 S: Supported
@@ -11729,6 +11728,7 @@ F: fs/smb/server/ · 1435 unmodified lines
1172911728 KERNEL UNIT TESTING FRAMEWORK (KUnit)
1173011729 M: Brendan Higgins <brendanhiggins@google.com>
1173111730 M: David Gow <davidgow@google.com>
11731+R: Rae Moar <rmoar@google.com>
1173211732 L: linux-kselftest@vger.kernel.org
1173311733 L: kunit-dev@googlegroups.com
1173411734 S: Maintained
@@ -12907,6 +12907,8 @@ M: Alejandro Colomar <alx@kernel.org> · 1172 unmodified lines
1290712907 L: linux-man@vger.kernel.org
1290812908 S: Maintained
1290912909 W: http://www.kernel.org/doc/man-pages
12910+T: git git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git
12911+T: git git://www.alejandro-colomar.es/src/alx/linux/man-pages/man-pages.git
1291012912
1291112913 MANAGEMENT COMPONENT TRANSPORT PROTOCOL (MCTP)
1291212914 M: Jeremy Kerr <jk@codeconstruct.com.au>
@@ -15182,6 +15184,7 @@ F: Documentation/networking/net_cachelines/net_device.rst · 2269 unmodified lines
1518215184 F: drivers/connector/
1518315185 F: drivers/net/
1518415186 F: include/dt-bindings/net/
15187+F: include/linux/cn_proc.h
1518515188 F: include/linux/etherdevice.h
1518615189 F: include/linux/fcdevice.h
1518715190 F: include/linux/fddidevice.h
@@ -15189,6 +15192,7 @@ F: include/linux/hippidevice.h · 1 unmodified line
1518915192 F: include/linux/if_*
1519015193 F: include/linux/inetdevice.h
1519115194 F: include/linux/netdevice.h
15195+F: include/uapi/linux/cn_proc.h
1519215196 F: include/uapi/linux/if_*
1519315197 F: include/uapi/linux/netdevice.h
1519415198 X: drivers/net/wireless/
@@ -18093,7 +18097,6 @@ F: drivers/net/ethernet/qualcomm/emac/ · 2898 unmodified lines
1809318097
1809418098 QUALCOMM ETHQOS ETHERNET DRIVER
1809518099 M: Vinod Koul <vkoul@kernel.org>
18096−R: Bhupesh Sharma <bhupesh.sharma@linaro.org>
1809718100 L: netdev@vger.kernel.org
1809818101 L: linux-arm-msm@vger.kernel.org
1809918102 S: Maintained
@@ -20561,6 +20564,7 @@ F: Documentation/translations/sp_SP/ · 2461 unmodified lines
2056120564
2056220565 SPARC + UltraSPARC (sparc/sparc64)
2056320566 M: "David S. Miller" <davem@davemloft.net>
20567+M: Andreas Larsson <andreas@gaisler.com>
2056420568 L: sparclinux@vger.kernel.org
2056520569 S: Maintained
2056620570 Q: http://patchwork.ozlabs.org/project/sparclinux/list/
@@ -24351,13 +24355,6 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs.git · 3784 unmodified lines
2435124355 F: Documentation/filesystems/zonefs.rst
2435224356 F: fs/zonefs/
2435324357
24354−ZPOOL COMPRESSED PAGE STORAGE API
24355−M: Dan Streetman <ddstreet@ieee.org>
24356−L: linux-mm@kvack.org
24357−S: Maintained
24358−F: include/linux/zpool.h
24359−F: mm/zpool.c
24360−
2436124358 ZR36067 VIDEO FOR LINUX DRIVER
2436224359 M: Corentin Labbe <clabbe@baylibre.com>
2436324360 L: mjpeg-users@lists.sourceforge.net
@@ -24409,7 +24406,9 @@ M: Nhat Pham <nphamcs@gmail.com> · 45 unmodified lines
2440924406 L: linux-mm@kvack.org
2441024407 S: Maintained
2441124408 F: Documentation/admin-guide/mm/zswap.rst
24409+F: include/linux/zpool.h
2441224410 F: include/linux/zswap.h
24411+F: mm/zpool.c
2441324412 F: mm/zswap.c
2441424413
2441524414 THE REST
Makefile+8−8
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 8
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
5+EXTRAVERSION = -rc2
66 NAME = Hurr durr I'ma ninja sloth
77
88 # *DOCUMENTATION*
@@ -294,15 +294,15 @@ may-sync-config := 1 · 285 unmodified lines
294294 single-build :=
295295
296296 ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
297− ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
297+ ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
298298 need-config :=
299− endif
299+ endif
300300 endif
301301
302302 ifneq ($(filter $(no-sync-config-targets), $(MAKECMDGOALS)),)
303− ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
303+ ifeq ($(filter-out $(no-sync-config-targets), $(MAKECMDGOALS)),)
304304 may-sync-config :=
305− endif
305+ endif
306306 endif
307307
308308 need-compiler := $(may-sync-config)
@@ -323,9 +323,9 @@ endif · 14 unmodified lines
323323 # We cannot build single targets and the others at the same time
324324 ifneq ($(filter $(single-targets), $(MAKECMDGOALS)),)
325325 single-build := 1
326− ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
326+ ifneq ($(filter-out $(single-targets), $(MAKECMDGOALS)),)
327327 mixed-build := 1
328− endif
328+ endif
329329 endif
330330
331331 # For "make -j clean all", "make -j mrproper defconfig all", etc.
@@ -1666,7 +1666,7 @@ help: · 1334 unmodified lines
16661666 @echo ' (sparse by default)'
16671667 @echo ' make C=2 [targets] Force check of all c source with $$CHECK'
16681668 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1669− @echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
1669+ @echo ' make W=n [targets] Enable extra build checks, n=1,2,3,c,e where'
16701670 @echo ' 1: warnings which may be relevant and do not occur too often'
16711671 @echo ' 2: warnings which occur quite often but may still be relevant'
16721672 @echo ' 3: more obscure warnings, can most likely be ignored'
arch/Kconfig+1−0
@@ -673,6 +673,7 @@ config SHADOW_CALL_STACK · 672 unmodified lines
673673 bool "Shadow Call Stack"
674674 depends on ARCH_SUPPORTS_SHADOW_CALL_STACK
675675 depends on DYNAMIC_FTRACE_WITH_ARGS || DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER
676+ depends on MMU
676677 help
677678 This option enables the compiler's Shadow Call Stack, which
678679 uses a shadow stack to protect function return addresses from
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-bletchley.dts+2−2
@@ -45,8 +45,8 @@ · 44 unmodified lines
4545 num-chipselects = <1>;
4646 cs-gpios = <&gpio0 ASPEED_GPIO(Z, 0) GPIO_ACTIVE_LOW>;
4747
48− tpmdev@0 {
49− compatible = "tcg,tpm_tis-spi";
48+ tpm@0 {
49+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
5050 spi-max-frequency = <33000000>;
5151 reg = <0>;
5252 };
arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-wedge400.dts+2−2
@@ -80,8 +80,8 @@ · 79 unmodified lines
8080 gpio-miso = <&gpio ASPEED_GPIO(R, 5) GPIO_ACTIVE_HIGH>;
8181 num-chipselects = <1>;
8282
83− tpmdev@0 {
84− compatible = "tcg,tpm_tis-spi";
83+ tpm@0 {
84+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
8585 spi-max-frequency = <33000000>;
8686 reg = <0>;
8787 };
arch/arm/boot/dts/aspeed/aspeed-bmc-opp-tacoma.dts+1−1
@@ -456,7 +456,7 @@ · 455 unmodified lines
456456 status = "okay";
457457
458458 tpm: tpm@2e {
459− compatible = "tcg,tpm-tis-i2c";
459+ compatible = "nuvoton,npct75x", "tcg,tpm-tis-i2c";
460460 reg = <0x2e>;
461461 };
462462 };
arch/arm/boot/dts/aspeed/ast2600-facebook-netbmc-common.dtsi+2−2
@@ -35,8 +35,8 @@ · 34 unmodified lines
3535 gpio-mosi = <&gpio0 ASPEED_GPIO(X, 4) GPIO_ACTIVE_HIGH>;
3636 gpio-miso = <&gpio0 ASPEED_GPIO(X, 5) GPIO_ACTIVE_HIGH>;
3737
38− tpmdev@0 {
39− compatible = "tcg,tpm_tis-spi";
38+ tpm@0 {
39+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
4040 spi-max-frequency = <33000000>;
4141 reg = <0>;
4242 };
arch/arm/boot/dts/nxp/imx/imx6ull-phytec-tauri.dtsi+1−1
@@ -116,7 +116,7 @@ · 115 unmodified lines
116116 tpm_tis: tpm@1 {
117117 pinctrl-names = "default";
118118 pinctrl-0 = <&pinctrl_tpm>;
119− compatible = "tcg,tpm_tis-spi";
119+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
120120 reg = <1>;
121121 spi-max-frequency = <20000000>;
122122 interrupt-parent = <&gpio5>;
arch/arm/boot/dts/nxp/imx/imx7d-flex-concentrator.dts+1−1
@@ -130,7 +130,7 @@ · 129 unmodified lines
130130 * TCG specification - Section 6.4.1 Clocking:
131131 * TPM shall support a SPI clock frequency range of 10-24 MHz.
132132 */
133− st33htph: tpm-tis@0 {
133+ st33htph: tpm@0 {
134134 compatible = "st,st33htpm-spi", "tcg,tpm_tis-spi";
135135 reg = <0>;
136136 spi-max-frequency = <24000000>;
arch/arm/boot/dts/samsung/exynos4212-tab3.dtsi+1−0
@@ -434,6 +434,7 @@ · 433 unmodified lines
434434 };
435435
436436 &fimd {
437+ samsung,invert-vclk;
437438 status = "okay";
438439 };
439440
arch/arm/boot/dts/ti/omap/am335x-moxa-uc-2100-common.dtsi+1−1
@@ -217,7 +217,7 @@ · 216 unmodified lines
217217 pinctrl-names = "default";
218218 pinctrl-0 = <&spi1_pins>;
219219
220− tpm_spi_tis@0 {
220+ tpm@0 {
221221 compatible = "tcg,tpm_tis-spi";
222222 reg = <0>;
223223 spi-max-frequency = <500000>;
arch/arm64/boot/dts/exynos/google/gs101.dtsi+1−1
@@ -289,7 +289,7 @@ · 288 unmodified lines
289289 #clock-cells = <1>;
290290 clocks = <&cmu_top CLK_DOUT_CMU_MISC_BUS>,
291291 <&cmu_top CLK_DOUT_CMU_MISC_SSS>;
292− clock-names = "dout_cmu_misc_bus", "dout_cmu_misc_sss";
292+ clock-names = "bus", "sss";
293293 };
294294
295295 watchdog_cl0: watchdog@10060000 {
arch/arm64/boot/dts/freescale/imx8mm-phygate-tauri-l.dts+1−1
@@ -120,7 +120,7 @@ · 119 unmodified lines
120120 };
121121
122122 tpm: tpm@1 {
123− compatible = "tcg,tpm_tis-spi";
123+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
124124 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
125125 interrupt-parent = <&gpio2>;
126126 pinctrl-names = "default";
arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx.dtsi+1−1
@@ -89,7 +89,7 @@ · 88 unmodified lines
8989 status = "okay";
9090
9191 tpm@1 {
92− compatible = "tcg,tpm_tis-spi";
92+ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi";
9393 reg = <0x1>;
9494 spi-max-frequency = <36000000>;
9595 };
arch/arm64/boot/dts/freescale/imx8mm-venice-gw73xx.dtsi+1−1
@@ -109,7 +109,7 @@ · 108 unmodified lines
109109 status = "okay";
110110
111111 tpm@1 {
112− compatible = "tcg,tpm_tis-spi";
112+ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi";
113113 reg = <0x1>;
114114 spi-max-frequency = <36000000>;
115115 };
arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts+1−1
@@ -234,7 +234,7 @@ · 233 unmodified lines
234234 status = "okay";
235235
236236 tpm: tpm@0 {
237− compatible = "infineon,slb9670";
237+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
238238 reg = <0>;
239239 pinctrl-names = "default";
240240 pinctrl-0 = <&pinctrl_tpm>;
arch/arm64/boot/dts/freescale/imx8mp-venice-gw72xx.dtsi+1−1
@@ -103,7 +103,7 @@ · 102 unmodified lines
103103 status = "okay";
104104
105105 tpm@1 {
106− compatible = "tcg,tpm_tis-spi";
106+ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi";
107107 reg = <0x1>;
108108 spi-max-frequency = <36000000>;
109109 };
arch/arm64/boot/dts/freescale/imx8mp-venice-gw73xx.dtsi+1−1
@@ -115,7 +115,7 @@ · 114 unmodified lines
115115 status = "okay";
116116
117117 tpm@1 {
118− compatible = "tcg,tpm_tis-spi";
118+ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi";
119119 reg = <0x1>;
120120 spi-max-frequency = <36000000>;
121121 };
arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts+1−1
@@ -196,7 +196,7 @@ · 195 unmodified lines
196196 status = "okay";
197197
198198 tpm@0 {
199− compatible = "tcg,tpm_tis-spi";
199+ compatible = "atmel,attpm20p", "tcg,tpm_tis-spi";
200200 reg = <0x0>;
201201 spi-max-frequency = <36000000>;
202202 };
arch/arm64/boot/dts/freescale/imx8mq-kontron-pitx-imx8m.dts+1−1
@@ -65,7 +65,7 @@ · 64 unmodified lines
6565 status = "okay";
6666
6767 tpm@0 {
68− compatible = "infineon,slb9670";
68+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
6969 reg = <0>;
7070 spi-max-frequency = <43000000>;
7171 };
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi+1−1
@@ -888,7 +888,7 @@ · 887 unmodified lines
888888 status = "okay";
889889 cs-gpios = <&pio 86 GPIO_ACTIVE_LOW>;
890890
891− cr50@0 {
891+ tpm@0 {
892892 compatible = "google,cr50";
893893 reg = <0>;
894894 spi-max-frequency = <1000000>;
arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi+1−1
@@ -1402,7 +1402,7 @@ · 1401 unmodified lines
14021402 pinctrl-names = "default";
14031403 pinctrl-0 = <&spi5_pins>;
14041404
1405− cr50@0 {
1405+ tpm@0 {
14061406 compatible = "google,cr50";
14071407 reg = <0>;
14081408 interrupts-extended = <&pio 171 IRQ_TYPE_EDGE_RISING>;
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts+1−1
@@ -70,7 +70,7 @@ · 69 unmodified lines
7070 &spi0 {
7171 status = "okay";
7272
73− cr50@0 {
73+ tpm@0 {
7474 compatible = "google,cr50";
7575 reg = <0>;
7676 interrupt-parent = <&gpio0>;
arch/arm64/boot/dts/rockchip/rk3399-gru-scarlet.dtsi+1−1
@@ -706,7 +706,7 @@ camera: &i2c7 { · 705 unmodified lines
706706 &spi2 {
707707 status = "okay";
708708
709− cr50@0 {
709+ tpm@0 {
710710 compatible = "google,cr50";
711711 reg = <0>;
712712 interrupt-parent = <&gpio1>;
arch/loongarch/include/asm/kvm_vcpu.h+2−2
@@ -60,7 +60,7 @@ int kvm_own_lsx(struct kvm_vcpu *vcpu); · 59 unmodified lines
6060 void kvm_save_lsx(struct loongarch_fpu *fpu);
6161 void kvm_restore_lsx(struct loongarch_fpu *fpu);
6262 #else
63−static inline int kvm_own_lsx(struct kvm_vcpu *vcpu) { }
63+static inline int kvm_own_lsx(struct kvm_vcpu *vcpu) { return -EINVAL; }
6464 static inline void kvm_save_lsx(struct loongarch_fpu *fpu) { }
6565 static inline void kvm_restore_lsx(struct loongarch_fpu *fpu) { }
6666 #endif
@@ -70,7 +70,7 @@ int kvm_own_lasx(struct kvm_vcpu *vcpu); · 3 unmodified lines
7070 void kvm_save_lasx(struct loongarch_fpu *fpu);
7171 void kvm_restore_lasx(struct loongarch_fpu *fpu);
7272 #else
73−static inline int kvm_own_lasx(struct kvm_vcpu *vcpu) { }
73+static inline int kvm_own_lasx(struct kvm_vcpu *vcpu) { return -EINVAL; }
7474 static inline void kvm_save_lasx(struct loongarch_fpu *fpu) { }
7575 static inline void kvm_restore_lasx(struct loongarch_fpu *fpu) { }
7676 #endif
arch/loongarch/kernel/smp.c+0−1
@@ -509,7 +509,6 @@ asmlinkage void start_secondary(void) · 508 unmodified lines
509509 sync_counter();
510510 cpu = raw_smp_processor_id();
511511 set_my_cpu_offset(per_cpu_offset(cpu));
512− rcutree_report_cpu_starting(cpu);
513512
514513 cpu_probe();
515514 constant_clockevent_init();
arch/loongarch/kvm/mmu.c+2−2
@@ -675,7 +675,7 @@ static bool fault_supports_huge_mapping(struct kvm_memory_slot *memslot, · 674 unmodified lines
675675 *
676676 * There are several ways to safely use this helper:
677677 *
678− * - Check mmu_invalidate_retry_hva() after grabbing the mapping level, before
678+ * - Check mmu_invalidate_retry_gfn() after grabbing the mapping level, before
679679 * consuming it. In this case, mmu_lock doesn't need to be held during the
680680 * lookup, but it does need to be held while checking the MMU notifier.
681681 *
@@ -855,7 +855,7 @@ retry: · 173 unmodified lines
855855
856856 /* Check if an invalidation has taken place since we got pfn */
857857 spin_lock(&kvm->mmu_lock);
858− if (mmu_invalidate_retry_hva(kvm, mmu_seq, hva)) {
858+ if (mmu_invalidate_retry_gfn(kvm, mmu_seq, gfn)) {
859859 /*
860860 * This can happen when mappings are changed asynchronously, but
861861 * also synchronously if a COW is triggered by
arch/loongarch/mm/tlb.c+10−6
@@ -284,12 +284,16 @@ static void setup_tlb_handler(int cpu) · 283 unmodified lines
284284 set_handler(EXCCODE_TLBNR * VECSIZE, handle_tlb_protect, VECSIZE);
285285 set_handler(EXCCODE_TLBNX * VECSIZE, handle_tlb_protect, VECSIZE);
286286 set_handler(EXCCODE_TLBPE * VECSIZE, handle_tlb_protect, VECSIZE);
287− }
287+ } else {
288+ int vec_sz __maybe_unused;
289+ void *addr __maybe_unused;
290+ struct page *page __maybe_unused;
291+
292+ /* Avoid lockdep warning */
293+ rcutree_report_cpu_starting(cpu);
294+
288295 #ifdef CONFIG_NUMA
289− else {
290− void *addr;
291− struct page *page;
292− const int vec_sz = sizeof(exception_handlers);
296+ vec_sz = sizeof(exception_handlers);
293297
294298 if (pcpu_handlers[cpu])
295299 return;
@@ -305,8 +309,8 @@ static void setup_tlb_handler(int cpu) · 9 unmodified lines
305309 csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_EENTRY);
306310 csr_write64(pcpu_handlers[cpu], LOONGARCH_CSR_MERRENTRY);
307311 csr_write64(pcpu_handlers[cpu] + 80*VECSIZE, LOONGARCH_CSR_TLBRENTRY);
308− }
309312 #endif
313+ }
310314 }
311315
312316 void tlb_init(int cpu)
arch/m68k/Makefile+2−2
@@ -15,10 +15,10 @@ · 14 unmodified lines
1515 KBUILD_DEFCONFIG := multi_defconfig
1616
1717 ifdef cross_compiling
18− ifeq ($(CROSS_COMPILE),)
18+ ifeq ($(CROSS_COMPILE),)
1919 CROSS_COMPILE := $(call cc-cross-prefix, \
2020 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
21− endif
21+ endif
2222 endif
2323
2424 #
arch/mips/alchemy/common/prom.c+1−0
@@ -40,6 +40,7 @@ · 39 unmodified lines
4040 #include <linux/string.h>
4141
4242 #include <asm/bootinfo.h>
43+#include <prom.h>
4344
4445 int prom_argc;
4546 char **prom_argv;
arch/mips/alchemy/common/setup.c+1−3
@@ -30,13 +30,11 @@ · 29 unmodified lines
3030 #include <linux/mm.h>
3131 #include <linux/dma-map-ops.h> /* for dma_default_coherent */
3232
33+#include <asm/bootinfo.h>
3334 #include <asm/mipsregs.h>
3435
3536 #include <au1000.h>
3637
37−extern void __init board_setup(void);
38−extern void __init alchemy_set_lpj(void);
39−
4038 static bool alchemy_dma_coherent(void)
4139 {
4240 switch (alchemy_get_cputype()) {
arch/mips/bcm63xx/boards/board_bcm963xx.c+1−1
@@ -702,7 +702,7 @@ static struct ssb_sprom bcm63xx_sprom = { · 701 unmodified lines
702702 .boardflags_hi = 0x0000,
703703 };
704704
705−int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
705+static int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
706706 {
707707 if (bus->bustype == SSB_BUSTYPE_PCI) {
708708 memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
arch/mips/bcm63xx/dev-rng.c+1−1
@@ -26,7 +26,7 @@ static struct platform_device bcm63xx_rng_device = { · 25 unmodified lines
2626 .resource = rng_resources,
2727 };
2828
29−int __init bcm63xx_rng_register(void)
29+static int __init bcm63xx_rng_register(void)
3030 {
3131 if (!BCMCPU_IS_6368())
3232 return -ENODEV;
arch/mips/bcm63xx/dev-uart.c+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 #include <linux/kernel.h>
1111 #include <linux/platform_device.h>
1212 #include <bcm63xx_cpu.h>
13+#include <bcm63xx_dev_uart.h>
1314
1415 static struct resource uart0_resources[] = {
1516 {
arch/mips/bcm63xx/dev-wdt.c+1−1
@@ -34,7 +34,7 @@ static struct platform_device bcm63xx_wdt_device = { · 33 unmodified lines
3434 },
3535 };
3636
37−int __init bcm63xx_wdt_register(void)
37+static int __init bcm63xx_wdt_register(void)
3838 {
3939 wdt_resources[0].start = bcm63xx_regset_address(RSET_WDT);
4040 wdt_resources[0].end = wdt_resources[0].start;
arch/mips/bcm63xx/irq.c+1−1
@@ -72,7 +72,7 @@ static inline int enable_irq_for_cpu(int cpu, struct irq_data *d, · 71 unmodified lines
7272 */
7373
7474 #define BUILD_IPIC_INTERNAL(width) \
75−void __dispatch_internal_##width(int cpu) \
75+static void __dispatch_internal_##width(int cpu) \
7676 { \
7777 u32 pending[width / 32]; \
7878 unsigned int src, tgt; \
arch/mips/bcm63xx/setup.c+1−1
@@ -159,7 +159,7 @@ void __init plat_mem_setup(void) · 158 unmodified lines
159159 board_setup();
160160 }
161161
162−int __init bcm63xx_register_devices(void)
162+static int __init bcm63xx_register_devices(void)
163163 {
164164 /* register gpiochip */
165165 bcm63xx_gpio_init();
arch/mips/bcm63xx/timer.c+1−1
@@ -178,7 +178,7 @@ int bcm63xx_timer_set(int id, int monotonic, unsigned int countdown_us) · 177 unmodified lines
178178
179179 EXPORT_SYMBOL(bcm63xx_timer_set);
180180
181−int bcm63xx_timer_init(void)
181+static int bcm63xx_timer_init(void)
182182 {
183183 int ret, irq;
184184 u32 reg;
arch/mips/cobalt/setup.c+0−3
@@ -23,9 +23,6 @@ · 22 unmodified lines
2323
2424 #include <cobalt.h>
2525
26−extern void cobalt_machine_restart(char *command);
27−extern void cobalt_machine_halt(void);
28−
2926 const char *get_system_type(void)
3027 {
3128 switch (cobalt_board_id) {
arch/mips/fw/arc/memory.c+1−1
@@ -37,7 +37,7 @@ static unsigned int nr_prom_mem __initdata; · 36 unmodified lines
3737 */
3838 #define ARC_PAGE_SHIFT 12
3939
40−struct linux_mdesc * __init ArcGetMemoryDescriptor(struct linux_mdesc *Current)
40+static struct linux_mdesc * __init ArcGetMemoryDescriptor(struct linux_mdesc *Current)
4141 {
4242 return (struct linux_mdesc *) ARC_CALL1(get_mdesc, Current);
4343 }
arch/mips/include/asm/mach-au1x00/au1000.h+3−0
@@ -597,6 +597,9 @@ · 596 unmodified lines
597597
598598 #include <asm/cpu.h>
599599
600+void alchemy_set_lpj(void);
601+void board_setup(void);
602+
600603 /* helpers to access the SYS_* registers */
601604 static inline unsigned long alchemy_rdsys(int regofs)
602605 {
arch/mips/include/asm/mach-cobalt/cobalt.h+3−0
@@ -19,4 +19,7 @@ extern int cobalt_board_id; · 18 unmodified lines
1919 #define COBALT_BRD_ID_QUBE2 0x5
2020 #define COBALT_BRD_ID_RAQ2 0x6
2121
22+void cobalt_machine_halt(void);
23+void cobalt_machine_restart(char *command);
24+
2225 #endif /* __ASM_COBALT_H */
arch/mips/kernel/elf.c+6−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111
1212 #include <asm/cpu-features.h>
1313 #include <asm/cpu-info.h>
14+#include <asm/fpu.h>
1415
1516 #ifdef CONFIG_MIPS_FP_SUPPORT
1617
@@ -309,6 +310,11 @@ void mips_set_personality_nan(struct arch_elf_state *state) · 292 unmodified lines
309310 struct cpuinfo_mips *c = &boot_cpu_data;
310311 struct task_struct *t = current;
311312
313+ /* Do this early so t->thread.fpu.fcr31 won't be clobbered in case
314+ * we are preempted before the lose_fpu(0) in start_thread.
315+ */
316+ lose_fpu(0);
317+
312318 t->thread.fpu.fcr31 = c->fpu_csr31;
313319 switch (state->nan_2008) {
314320 case 0:
arch/mips/kernel/traps.c+7−1
@@ -2007,7 +2007,13 @@ unsigned long vi_handlers[64]; · 2006 unmodified lines
20072007
20082008 void reserve_exception_space(phys_addr_t addr, unsigned long size)
20092009 {
2010− memblock_reserve(addr, size);
2010+ /*
2011+ * reserve exception space on CPUs other than CPU0
2012+ * is too late, since memblock is unavailable when APs
2013+ * up
2014+ */
2015+ if (smp_processor_id() == 0)
2016+ memblock_reserve(addr, size);
20112017 }
20122018
20132019 void __init *set_except_vector(int n, void *addr)
arch/mips/lantiq/prom.c+3−4
@@ -108,10 +108,9 @@ void __init prom_init(void) · 107 unmodified lines
108108 prom_init_cmdline();
109109
110110 #if defined(CONFIG_MIPS_MT_SMP)
111− if (cpu_has_mipsmt) {
112− lantiq_smp_ops = vsmp_smp_ops;
111+ lantiq_smp_ops = vsmp_smp_ops;
112+ if (cpu_has_mipsmt)
113113 lantiq_smp_ops.init_secondary = lantiq_init_secondary;
114− register_smp_ops(&lantiq_smp_ops);
115− }
114+ register_smp_ops(&lantiq_smp_ops);
116115 #endif
117116 }
arch/mips/loongson64/init.c+3−0
@@ -103,6 +103,9 @@ void __init szmem(unsigned int node) · 102 unmodified lines
103103 if (loongson_sysconf.vgabios_addr)
104104 memblock_reserve(virt_to_phys((void *)loongson_sysconf.vgabios_addr),
105105 SZ_256K);
106+ /* set nid for reserved memory */
107+ memblock_set_node((u64)node << 44, (u64)(node + 1) << 44,
108+ &memblock.reserved, node);
106109 }
107110
108111 #ifndef CONFIG_NUMA
arch/mips/loongson64/numa.c+2−0
@@ -132,6 +132,8 @@ static void __init node_mem_init(unsigned int node) · 131 unmodified lines
132132
133133 /* Reserve pfn range 0~node[0]->node_start_pfn */
134134 memblock_reserve(0, PAGE_SIZE * start_pfn);
135+ /* set nid for reserved memory on node 0 */
136+ memblock_set_node(0, 1ULL << 44, &memblock.reserved, 0);
135137 }
136138 }
137139
arch/mips/sgi-ip27/Makefile+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55
66 obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o \
77 ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o \
8− ip27-hubio.o ip27-xtalk.o
8+ ip27-xtalk.o
99
1010 obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
1111 obj-$(CONFIG_SMP) += ip27-smp.o
arch/mips/sgi-ip27/ip27-berr.c+3−1
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #include <asm/traps.h>
2323 #include <linux/uaccess.h>
2424
25+#include "ip27-common.h"
26+
2527 static void dump_hub_information(unsigned long errst0, unsigned long errst1)
2628 {
2729 static char *err_type[2][8] = {
@@ -57,7 +59,7 @@ static void dump_hub_information(unsigned long errst0, unsigned long errst1) · 29 unmodified lines
5759 [st0.pi_stat0_fmt.s0_err_type] ? : "invalid");
5860 }
5961
60−int ip27_be_handler(struct pt_regs *regs, int is_fixup)
62+static int ip27_be_handler(struct pt_regs *regs, int is_fixup)
6163 {
6264 unsigned long errst0, errst1;
6365 int data = regs->cp0_cause & 4;
arch/mips/sgi-ip27/ip27-common.h+2−0
@@ -10,6 +10,7 @@ extern void hub_rt_clock_event_init(void); · 9 unmodified lines
1010 extern void hub_rtc_init(nasid_t nasid);
1111 extern void install_cpu_nmi_handler(int slice);
1212 extern void install_ipi(void);
13+extern void ip27_be_init(void);
1314 extern void ip27_reboot_setup(void);
1415 extern const struct plat_smp_ops ip27_smp_ops;
1516 extern unsigned long node_getfirstfree(nasid_t nasid);
@@ -17,4 +18,5 @@ extern void per_cpu_init(void); · 1 unmodified line
1718 extern void replicate_kernel_text(void);
1819 extern void setup_replication_mask(void);
1920
21+
2022 #endif /* __IP27_COMMON_H */
arch/mips/sgi-ip27/ip27-hubio.c+0−185
@@ -1,185 +0,0 @@
1−// SPDX-License-Identifier: GPL-2.0-only
2−/*
3− * Copyright (C) 1992-1997, 2000-2003 Silicon Graphics, Inc.
4− * Copyright (C) 2004 Christoph Hellwig.
5− *
6− * Support functions for the HUB ASIC - mostly PIO mapping related.
7− */
8−
9−#include <linux/bitops.h>
10−#include <linux/string.h>
11−#include <linux/mmzone.h>
12−#include <asm/sn/addrs.h>
13−#include <asm/sn/arch.h>
14−#include <asm/sn/agent.h>
15−#include <asm/sn/io.h>
16−#include <asm/xtalk/xtalk.h>
17−
18−
19−static int force_fire_and_forget = 1;
20−
21−/**
22− * hub_pio_map - establish a HUB PIO mapping
23− *
24− * @nasid: nasid to perform PIO mapping on
25− * @widget: widget ID to perform PIO mapping for
26− * @xtalk_addr: xtalk_address that needs to be mapped
27− * @size: size of the PIO mapping
28− *
29− **/
30−unsigned long hub_pio_map(nasid_t nasid, xwidgetnum_t widget,
31− unsigned long xtalk_addr, size_t size)
32−{
33− unsigned i;
34−
35− /* use small-window mapping if possible */
36− if ((xtalk_addr % SWIN_SIZE) + size <= SWIN_SIZE)
37− return NODE_SWIN_BASE(nasid, widget) + (xtalk_addr % SWIN_SIZE);
38−
39− if ((xtalk_addr % BWIN_SIZE) + size > BWIN_SIZE) {
40− printk(KERN_WARNING "PIO mapping at hub %d widget %d addr 0x%lx"
41− " too big (%ld)\n",
42− nasid, widget, xtalk_addr, size);
43− return 0;
44− }
45−
46− xtalk_addr &= ~(BWIN_SIZE-1);
47− for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) {
48− if (test_and_set_bit(i, hub_data(nasid)->h_bigwin_used))
49− continue;
50−
51− /*
52− * The code below does a PIO write to setup an ITTE entry.
53− *
54− * We need to prevent other CPUs from seeing our updated
55− * memory shadow of the ITTE (in the piomap) until the ITTE
56− * entry is actually set up; otherwise, another CPU might
57− * attempt a PIO prematurely.
58− *
59− * Also, the only way we can know that an entry has been
60− * received by the hub and can be used by future PIO reads/
61− * writes is by reading back the ITTE entry after writing it.
62− *
63− * For these two reasons, we PIO read back the ITTE entry
64− * after we write it.
65− */
66− IIO_ITTE_PUT(nasid, i, HUB_PIO_MAP_TO_MEM, widget, xtalk_addr);
67− __raw_readq(IIO_ITTE_GET(nasid, i));
68−
69− return NODE_BWIN_BASE(nasid, widget) + (xtalk_addr % BWIN_SIZE);
70− }
71−
72− printk(KERN_WARNING "unable to establish PIO mapping for at"
73− " hub %d widget %d addr 0x%lx\n",
74− nasid, widget, xtalk_addr);
75− return 0;
76−}
77−
78−
79−/*
80− * hub_setup_prb(nasid, prbnum, credits, conveyor)
81− *
82− * Put a PRB into fire-and-forget mode if conveyor isn't set. Otherwise,
83− * put it into conveyor belt mode with the specified number of credits.
84− */
85−static void hub_setup_prb(nasid_t nasid, int prbnum, int credits)
86−{
87− union iprb_u prb;
88− int prb_offset;
89−
90− /*
91− * Get the current register value.
92− */
93− prb_offset = IIO_IOPRB(prbnum);
94− prb.iprb_regval = REMOTE_HUB_L(nasid, prb_offset);
95−
96− /*
97− * Clear out some fields.
98− */
99− prb.iprb_ovflow = 1;
100− prb.iprb_bnakctr = 0;
101− prb.iprb_anakctr = 0;
102−
103− /*
104− * Enable or disable fire-and-forget mode.
105− */
106− prb.iprb_ff = force_fire_and_forget ? 1 : 0;
107−
108− /*
109− * Set the appropriate number of PIO credits for the widget.
110− */
111− prb.iprb_xtalkctr = credits;
112−
113− /*
114− * Store the new value to the register.
115− */
116− REMOTE_HUB_S(nasid, prb_offset, prb.iprb_regval);
117−}
118−
119−/**
120− * hub_set_piomode - set pio mode for a given hub
121− *
122− * @nasid: physical node ID for the hub in question
123− *
124− * Put the hub into either "PIO conveyor belt" mode or "fire-and-forget" mode.
125− * To do this, we have to make absolutely sure that no PIOs are in progress
126− * so we turn off access to all widgets for the duration of the function.
127− *
128− * XXX - This code should really check what kind of widget we're talking
129− * to. Bridges can only handle three requests, but XG will do more.
130− * How many can crossbow handle to widget 0? We're assuming 1.
131− *
132− * XXX - There is a bug in the crossbow that link reset PIOs do not
133− * return write responses. The easiest solution to this problem is to
134− * leave widget 0 (xbow) in fire-and-forget mode at all times. This
135− * only affects pio's to xbow registers, which should be rare.
136− **/
137−static void hub_set_piomode(nasid_t nasid)
138−{
139− u64 ii_iowa;
140− union hubii_wcr_u ii_wcr;
141− unsigned i;
142−
143− ii_iowa = REMOTE_HUB_L(nasid, IIO_OUTWIDGET_ACCESS);
144− REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, 0);
145−
146− ii_wcr.wcr_reg_value = REMOTE_HUB_L(nasid, IIO_WCR);
147−
148− if (ii_wcr.iwcr_dir_con) {
149− /*
150− * Assume a bridge here.
151− */
152− hub_setup_prb(nasid, 0, 3);
153− } else {
154− /*
155− * Assume a crossbow here.
156− */
157− hub_setup_prb(nasid, 0, 1);
158− }
159−
160− /*
161− * XXX - Here's where we should take the widget type into
162− * when account assigning credits.
163− */
164− for (i = HUB_WIDGET_ID_MIN; i <= HUB_WIDGET_ID_MAX; i++)
165− hub_setup_prb(nasid, i, 3);
166−
167− REMOTE_HUB_S(nasid, IIO_OUTWIDGET_ACCESS, ii_iowa);
168−}
169−
170−/*
171− * hub_pio_init - PIO-related hub initialization
172− *
173− * @hub: hubinfo structure for our hub
174− */
175−void hub_pio_init(nasid_t nasid)
176−{
177− unsigned i;
178−
179− /* initialize big window piomaps for this hub */
180− bitmap_zero(hub_data(nasid)->h_bigwin_used, HUB_NUM_BIG_WINDOW);
181− for (i = 0; i < HUB_NUM_BIG_WINDOW; i++)
182− IIO_ITTE_DISABLE(nasid, i);
183−
184− hub_set_piomode(nasid);
185−}
arch/mips/sgi-ip27/ip27-irq.c+2−0
@@ -23,6 +23,8 @@ · 22 unmodified lines
2323 #include <asm/sn/intr.h>
2424 #include <asm/sn/irq_alloc.h>
2525
26+#include "ip27-common.h"
27+
2628 struct hub_irq_data {
2729 u64 *irq_mask[2];
2830 cpuid_t cpu;
arch/mips/sgi-ip27/ip27-memory.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #include <asm/page.h>
2424 #include <asm/pgalloc.h>
2525 #include <asm/sections.h>
26+#include <asm/sgialib.h>
2627
2728 #include <asm/sn/arch.h>
2829 #include <asm/sn/agent.h>
arch/mips/sgi-ip27/ip27-nmi.c+8−17
@@ -11,6 +11,8 @@ · 10 unmodified lines
1111 #include <asm/sn/arch.h>
1212 #include <asm/sn/agent.h>
1313
14+#include "ip27-common.h"
15+
1416 #if 0
1517 #define NODE_NUM_CPUS(n) CNODE_NUM_CPUS(n)
1618 #else
@@ -23,16 +25,7 @@ · 6 unmodified lines
2325 typedef unsigned long machreg_t;
2426
2527 static arch_spinlock_t nmi_lock = __ARCH_SPIN_LOCK_UNLOCKED;
26−
27−/*
28− * Let's see what else we need to do here. Set up sp, gp?
29− */
30−void nmi_dump(void)
31−{
32− void cont_nmi_dump(void);
33−
34− cont_nmi_dump();
35−}
28+static void nmi_dump(void);
3629
3730 void install_cpu_nmi_handler(int slice)
3831 {
@@ -53,7 +46,7 @@ void install_cpu_nmi_handler(int slice) · 14 unmodified lines
5346 * into the eframe format for the node under consideration.
5447 */
5548
56−void nmi_cpu_eframe_save(nasid_t nasid, int slice)
49+static void nmi_cpu_eframe_save(nasid_t nasid, int slice)
5750 {
5851 struct reg_struct *nr;
5952 int i;
@@ -129,7 +122,7 @@ void nmi_cpu_eframe_save(nasid_t nasid, int slice) · 69 unmodified lines
129122 pr_emerg("\n");
130123 }
131124
132−void nmi_dump_hub_irq(nasid_t nasid, int slice)
125+static void nmi_dump_hub_irq(nasid_t nasid, int slice)
133126 {
134127 u64 mask0, mask1, pend0, pend1;
135128
@@ -153,7 +146,7 @@ void nmi_dump_hub_irq(nasid_t nasid, int slice) · 17 unmodified lines
153146 * Copy the cpu registers which have been saved in the IP27prom format
154147 * into the eframe format for the node under consideration.
155148 */
156−void nmi_node_eframe_save(nasid_t nasid)
149+static void nmi_node_eframe_save(nasid_t nasid)
157150 {
158151 int slice;
159152
@@ -170,8 +163,7 @@ void nmi_node_eframe_save(nasid_t nasid) · 10 unmodified lines
170163 /*
171164 * Save the nmi cpu registers for all cpus in the system.
172165 */
173−void
174−nmi_eframes_save(void)
166+static void nmi_eframes_save(void)
175167 {
176168 nasid_t nasid;
177169
@@ -179,8 +171,7 @@ nmi_eframes_save(void) · 1 unmodified line
179171 nmi_node_eframe_save(nasid);
180172 }
181173
182−void
183−cont_nmi_dump(void)
174+static void nmi_dump(void)
184175 {
185176 #ifndef REAL_NMI_SIGNAL
186177 static atomic_t nmied_cpus = ATOMIC_INIT(0);
arch/mips/sgi-ip30/ip30-console.c+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 #include <linux/io.h>
44
55 #include <asm/sn/ioc3.h>
6+#include <asm/setup.h>
67
78 static inline struct ioc3_uartregs *console_uart(void)
89 {
arch/mips/sgi-ip30/ip30-setup.c+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 #include <linux/percpu.h>
1515 #include <linux/memblock.h>
1616
17+#include <asm/bootinfo.h>
1718 #include <asm/smp-ops.h>
1819 #include <asm/sgialib.h>
1920 #include <asm/time.h>
arch/mips/sgi-ip32/crime.c+4−2
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818 #include <asm/ip32/crime.h>
1919 #include <asm/ip32/mace.h>
2020
21+#include "ip32-common.h"
22+
2123 struct sgi_crime __iomem *crime;
2224 struct sgi_mace __iomem *mace;
2325
@@ -39,7 +41,7 @@ void __init crime_init(void) · 15 unmodified lines
3941 id, rev, field, (unsigned long) CRIME_BASE);
4042 }
4143
42−irqreturn_t crime_memerr_intr(unsigned int irq, void *dev_id)
44+irqreturn_t crime_memerr_intr(int irq, void *dev_id)
4345 {
4446 unsigned long stat, addr;
4547 int fatal = 0;
@@ -90,7 +92,7 @@ irqreturn_t crime_memerr_intr(unsigned int irq, void *dev_id) · 44 unmodified lines
9092 return IRQ_HANDLED;
9193 }
9294
93−irqreturn_t crime_cpuerr_intr(unsigned int irq, void *dev_id)
95+irqreturn_t crime_cpuerr_intr(int irq, void *dev_id)
9496 {
9597 unsigned long stat = crime->cpu_error_stat & CRIME_CPU_ERROR_MASK;
9698 unsigned long addr = crime->cpu_error_addr & CRIME_CPU_ERROR_ADDR_MASK;
arch/mips/sgi-ip32/ip32-berr.c+2−0
@@ -18,6 +18,8 @@ · 17 unmodified lines
1818 #include <asm/ptrace.h>
1919 #include <asm/tlbdebug.h>
2020
21+#include "ip32-common.h"
22+
2123 static int ip32_be_handler(struct pt_regs *regs, int is_fixup)
2224 {
2325 int data = regs->cp0_cause & 4;
arch/mips/sgi-ip32/ip32-common.h+15−0
@@ -0,0 +1,15 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+#ifndef __IP32_COMMON_H
4+#define __IP32_COMMON_H
5+
6+#include <linux/init.h>
7+#include <linux/interrupt.h>
8+
9+void __init crime_init(void);
10+irqreturn_t crime_memerr_intr(int irq, void *dev_id);
11+irqreturn_t crime_cpuerr_intr(int irq, void *dev_id);
12+void __init ip32_be_init(void);
13+void ip32_prepare_poweroff(void);
14+
15+#endif /* __IP32_COMMON_H */
arch/mips/sgi-ip32/ip32-irq.c+2−4
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828 #include <asm/ip32/mace.h>
2929 #include <asm/ip32/ip32_ints.h>
3030
31+#include "ip32-common.h"
32+
3133 /* issue a PIO read to make sure no PIO writes are pending */
3234 static inline void flush_crime_bus(void)
3335 {
@@ -107,10 +109,6 @@ static inline void flush_mace_bus(void) · 73 unmodified lines
107109 * is quite different anyway.
108110 */
109111
110−/* Some initial interrupts to set up */
111−extern irqreturn_t crime_memerr_intr(int irq, void *dev_id);
112−extern irqreturn_t crime_cpuerr_intr(int irq, void *dev_id);
113−
114112 /*
115113 * This is for pure CRIME interrupts - ie not MACE. The advantage?
116114 * We get to split the register in half and do faster lookups.
arch/mips/sgi-ip32/ip32-memory.c+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <asm/ip32/crime.h>
1616 #include <asm/bootinfo.h>
1717 #include <asm/page.h>
18+#include <asm/sgialib.h>
1819
1920 extern void crime_init(void);
2021
arch/mips/sgi-ip32/ip32-reset.c+2−0
@@ -29,6 +29,8 @@ · 28 unmodified lines
2929 #include <asm/ip32/crime.h>
3030 #include <asm/ip32/ip32_ints.h>
3131
32+#include "ip32-common.h"
33+
3234 #define POWERDOWN_TIMEOUT 120
3335 /*
3436 * Blink frequency during reboot grace period and when panicked.
arch/mips/sgi-ip32/ip32-setup.c+1−2
@@ -26,8 +26,7 @@ · 25 unmodified lines
2626 #include <asm/ip32/mace.h>
2727 #include <asm/ip32/ip32_ints.h>
2828
29−extern void ip32_be_init(void);
30−extern void crime_init(void);
29+#include "ip32-common.h"
3130
3231 #ifdef CONFIG_SGI_O2MACE_ETH
3332 /*
arch/parisc/Kconfig+0−1
@@ -25,7 +25,6 @@ config PARISC · 24 unmodified lines
2525 select RTC_DRV_GENERIC
2626 select INIT_ALL_POSSIBLE
2727 select BUG
28− select BUILDTIME_TABLE_SORT
2928 select HAVE_KERNEL_UNCOMPRESSED
3029 select HAVE_PCI
3130 select HAVE_PERF_EVENTS
arch/parisc/Makefile+2−2
@@ -50,12 +50,12 @@ export CROSS32CC · 49 unmodified lines
5050
5151 # Set default cross compiler for kernel build
5252 ifdef cross_compiling
53− ifeq ($(CROSS_COMPILE),)
53+ ifeq ($(CROSS_COMPILE),)
5454 CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
5555 CROSS_COMPILE := $(call cc-cross-prefix, \
5656 $(foreach a,$(CC_ARCHES), \
5757 $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
58− endif
58+ endif
5959 endif
6060
6161 ifdef CONFIG_DYNAMIC_FTRACE
arch/parisc/include/asm/assembly.h+1−0
@@ -576,6 +576,7 @@ · 575 unmodified lines
576576 .section __ex_table,"aw" ! \
577577 .align 4 ! \
578578 .word (fault_addr - .), (except_addr - .) ! \
579+ or %r0,%r0,%r0 ! \
579580 .previous
580581
581582
arch/parisc/include/asm/extable.h+64−0
@@ -0,0 +1,64 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+#ifndef __PARISC_EXTABLE_H
3+#define __PARISC_EXTABLE_H
4+
5+#include <asm/ptrace.h>
6+#include <linux/compiler.h>
7+
8+/*
9+ * The exception table consists of three addresses:
10+ *
11+ * - A relative address to the instruction that is allowed to fault.
12+ * - A relative address at which the program should continue (fixup routine)
13+ * - An asm statement which specifies which CPU register will
14+ * receive -EFAULT when an exception happens if the lowest bit in
15+ * the fixup address is set.
16+ *
17+ * Note: The register specified in the err_opcode instruction will be
18+ * modified at runtime if a fault happens. Register %r0 will be ignored.
19+ *
20+ * Since relative addresses are used, 32bit values are sufficient even on
21+ * 64bit kernel.
22+ */
23+
24+struct pt_regs;
25+int fixup_exception(struct pt_regs *regs);
26+
27+#define ARCH_HAS_RELATIVE_EXTABLE
28+struct exception_table_entry {
29+ int insn; /* relative address of insn that is allowed to fault. */
30+ int fixup; /* relative address of fixup routine */
31+ int err_opcode; /* sample opcode with register which holds error code */
32+};
33+
34+#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr, opcode )\
35+ ".section __ex_table,\"aw\"\n" \
36+ ".align 4\n" \
37+ ".word (" #fault_addr " - .), (" #except_addr " - .)\n" \
38+ opcode "\n" \
39+ ".previous\n"
40+
41+/*
42+ * ASM_EXCEPTIONTABLE_ENTRY_EFAULT() creates a special exception table entry
43+ * (with lowest bit set) for which the fault handler in fixup_exception() will
44+ * load -EFAULT on fault into the register specified by the err_opcode instruction,
45+ * and zeroes the target register in case of a read fault in get_user().
46+ */
47+#define ASM_EXCEPTIONTABLE_VAR(__err_var) \
48+ int __err_var = 0
49+#define ASM_EXCEPTIONTABLE_ENTRY_EFAULT( fault_addr, except_addr, register )\
50+ ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr + 1, "or %%r0,%%r0," register)
51+
52+static inline void swap_ex_entry_fixup(struct exception_table_entry *a,
53+ struct exception_table_entry *b,
54+ struct exception_table_entry tmp,
55+ int delta)
56+{
57+ a->fixup = b->fixup + delta;
58+ b->fixup = tmp.fixup - delta;
59+ a->err_opcode = b->err_opcode;
60+ b->err_opcode = tmp.err_opcode;
61+}
62+#define swap_ex_entry_fixup swap_ex_entry_fixup
63+
64+#endif
arch/parisc/include/asm/special_insns.h+4−2
@@ -8,7 +8,8 @@ · 7 unmodified lines
88 "copy %%r0,%0\n" \
99 "8:\tlpa %%r0(%1),%0\n" \
1010 "9:\n" \
11− ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \
11+ ASM_EXCEPTIONTABLE_ENTRY(8b, 9b, \
12+ "or %%r0,%%r0,%%r0") \
1213 : "=&r" (pa) \
1314 : "r" (va) \
1415 : "memory" \
@@ -22,7 +23,8 @@ · 7 unmodified lines
2223 "copy %%r0,%0\n" \
2324 "8:\tlpa %%r0(%%sr3,%1),%0\n" \
2425 "9:\n" \
25− ASM_EXCEPTIONTABLE_ENTRY(8b, 9b) \
26+ ASM_EXCEPTIONTABLE_ENTRY(8b, 9b, \
27+ "or %%r0,%%r0,%%r0") \
2628 : "=&r" (pa) \
2729 : "r" (va) \
2830 : "memory" \
arch/parisc/include/asm/uaccess.h+7−41
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 */
88 #include <asm/page.h>
99 #include <asm/cache.h>
10+#include <asm/extable.h>
1011
1112 #include <linux/bug.h>
1213 #include <linux/string.h>
@@ -26,37 +27,6 @@ · 13 unmodified lines
2627 #define STD_USER(sr, x, ptr) __put_user_asm(sr, "std", x, ptr)
2728 #endif
2829
29−/*
30− * The exception table contains two values: the first is the relative offset to
31− * the address of the instruction that is allowed to fault, and the second is
32− * the relative offset to the address of the fixup routine. Since relative
33− * addresses are used, 32bit values are sufficient even on 64bit kernel.
34− */
35−
36−#define ARCH_HAS_RELATIVE_EXTABLE
37−struct exception_table_entry {
38− int insn; /* relative address of insn that is allowed to fault. */
39− int fixup; /* relative address of fixup routine */
40−};
41−
42−#define ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr )\
43− ".section __ex_table,\"aw\"\n" \
44− ".align 4\n" \
45− ".word (" #fault_addr " - .), (" #except_addr " - .)\n\t" \
46− ".previous\n"
47−
48−/*
49− * ASM_EXCEPTIONTABLE_ENTRY_EFAULT() creates a special exception table entry
50− * (with lowest bit set) for which the fault handler in fixup_exception() will
51− * load -EFAULT into %r29 for a read or write fault, and zeroes the target
52− * register in case of a read fault in get_user().
53− */
54−#define ASM_EXCEPTIONTABLE_REG 29
55−#define ASM_EXCEPTIONTABLE_VAR(__variable) \
56− register long __variable __asm__ ("r29") = 0
57−#define ASM_EXCEPTIONTABLE_ENTRY_EFAULT( fault_addr, except_addr )\
58− ASM_EXCEPTIONTABLE_ENTRY( fault_addr, except_addr + 1)
59−
6030 #define __get_user_internal(sr, val, ptr) \
6131 ({ \
6232 ASM_EXCEPTIONTABLE_VAR(__gu_err); \
@@ -83,7 +53,7 @@ struct exception_table_entry { · 20 unmodified lines
8353 \
8454 __asm__("1: " ldx " 0(%%sr%2,%3),%0\n" \
8555 "9:\n" \
86− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
56+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b, "%1") \
8757 : "=r"(__gu_val), "+r"(__gu_err) \
8858 : "i"(sr), "r"(ptr)); \
8959 \
@@ -115,8 +85,8 @@ struct exception_table_entry { · 25 unmodified lines
11585 "1: ldw 0(%%sr%2,%3),%0\n" \
11686 "2: ldw 4(%%sr%2,%3),%R0\n" \
11787 "9:\n" \
118− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
119− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
88+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b, "%1") \
89+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b, "%1") \
12090 : "=&r"(__gu_tmp.l), "+r"(__gu_err) \
12191 : "i"(sr), "r"(ptr)); \
12292 \
@@ -174,7 +144,7 @@ struct exception_table_entry { · 51 unmodified lines
174144 __asm__ __volatile__ ( \
175145 "1: " stx " %1,0(%%sr%2,%3)\n" \
176146 "9:\n" \
177− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
147+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b, "%0") \
178148 : "+r"(__pu_err) \
179149 : "r"(x), "i"(sr), "r"(ptr))
180150
@@ -186,15 +156,14 @@ struct exception_table_entry { · 5 unmodified lines
186156 "1: stw %1,0(%%sr%2,%3)\n" \
187157 "2: stw %R1,4(%%sr%2,%3)\n" \
188158 "9:\n" \
189− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b) \
190− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b) \
159+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 9b, "%0") \
160+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 9b, "%0") \
191161 : "+r"(__pu_err) \
192162 : "r"(__val), "i"(sr), "r"(ptr)); \
193163 } while (0)
194164
195165 #endif /* !defined(CONFIG_64BIT) */
196166
197−
198167 /*
199168 * Complex access routines -- external declarations
200169 */
@@ -216,7 +185,4 @@ unsigned long __must_check raw_copy_from_user(void *dst, const void __user *src, · 15 unmodified lines
216185 #define INLINE_COPY_TO_USER
217186 #define INLINE_COPY_FROM_USER
218187
219−struct pt_regs;
220−int fixup_exception(struct pt_regs *regs);
221−
222188 #endif /* __PARISC_UACCESS_H */
arch/parisc/kernel/cache.c+7−3
@@ -58,7 +58,7 @@ int pa_serialize_tlb_flushes __ro_after_init; · 57 unmodified lines
5858
5959 struct pdc_cache_info cache_info __ro_after_init;
6060 #ifndef CONFIG_PA20
61−struct pdc_btlb_info btlb_info __ro_after_init;
61+struct pdc_btlb_info btlb_info;
6262 #endif
6363
6464 DEFINE_STATIC_KEY_TRUE(parisc_has_cache);
@@ -264,6 +264,10 @@ parisc_cache_init(void) · 199 unmodified lines
264264 icache_stride = CAFL_STRIDE(cache_info.ic_conf);
265265 #undef CAFL_STRIDE
266266
267+ /* stride needs to be non-zero, otherwise cache flushes will not work */
268+ WARN_ON(cache_info.dc_size && dcache_stride == 0);
269+ WARN_ON(cache_info.ic_size && icache_stride == 0);
270+
267271 if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) ==
268272 PDC_MODEL_NVA_UNSUPPORTED) {
269273 printk(KERN_WARNING "parisc_cache_init: Only equivalent aliasing supported!\n");
@@ -850,7 +854,7 @@ SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes, · 580 unmodified lines
850854 #endif
851855 " fic,m %3(%4,%0)\n"
852856 "2: sync\n"
853− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 2b)
857+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 2b, "%1")
854858 : "+r" (start), "+r" (error)
855859 : "r" (end), "r" (dcache_stride), "i" (SR_USER));
856860 }
@@ -865,7 +869,7 @@ SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes, · 8 unmodified lines
865869 #endif
866870 " fdc,m %3(%4,%0)\n"
867871 "2: sync\n"
868− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 2b)
872+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 2b, "%1")
869873 : "+r" (start), "+r" (error)
870874 : "r" (end), "r" (icache_stride), "i" (SR_USER));
871875 }
arch/parisc/kernel/drivers.c+4−1
@@ -742,7 +742,7 @@ parse_tree_node(struct device *parent, int index, struct hardware_path *modpath) · 741 unmodified lines
742742 };
743743
744744 if (device_for_each_child(parent, &recurse_data, descend_children))
745− { /* nothing */ };
745+ { /* nothing */ }
746746
747747 return d.dev;
748748 }
@@ -1004,6 +1004,9 @@ static __init int qemu_print_iodc_data(struct device *lin_dev, void *data) · 255 unmodified lines
10041004
10051005 pr_info("\n");
10061006
1007+ /* Prevent hung task messages when printing on serial console */
1008+ cond_resched();
1009+
10071010 pr_info("#define HPA_%08lx_DESCRIPTION \"%s\"\n",
10081011 hpa, parisc_hardware_description(&dev->id));
10091012
arch/parisc/kernel/unaligned.c+22−22
@@ -120,8 +120,8 @@ static int emulate_ldh(struct pt_regs *regs, int toreg) · 119 unmodified lines
120120 "2: ldbs 1(%%sr1,%3), %0\n"
121121 " depw %2, 23, 24, %0\n"
122122 "3: \n"
123− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b)
124− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b)
123+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b, "%1")
124+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b, "%1")
125125 : "+r" (val), "+r" (ret), "=&r" (temp1)
126126 : "r" (saddr), "r" (regs->isr) );
127127
@@ -152,8 +152,8 @@ static int emulate_ldw(struct pt_regs *regs, int toreg, int flop) · 24 unmodified lines
152152 " mtctl %2,11\n"
153153 " vshd %0,%3,%0\n"
154154 "3: \n"
155− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b)
156− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b)
155+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b, "%1")
156+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b, "%1")
157157 : "+r" (val), "+r" (ret), "=&r" (temp1), "=&r" (temp2)
158158 : "r" (saddr), "r" (regs->isr) );
159159
@@ -189,8 +189,8 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop) · 29 unmodified lines
189189 " mtsar %%r19\n"
190190 " shrpd %0,%%r20,%%sar,%0\n"
191191 "3: \n"
192− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b)
193− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b)
192+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b, "%1")
193+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b, "%1")
194194 : "=r" (val), "+r" (ret)
195195 : "0" (val), "r" (saddr), "r" (regs->isr)
196196 : "r19", "r20" );
@@ -209,9 +209,9 @@ static int emulate_ldd(struct pt_regs *regs, int toreg, int flop) · 12 unmodified lines
209209 " vshd %0,%R0,%0\n"
210210 " vshd %R0,%4,%R0\n"
211211 "4: \n"
212− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 4b)
213− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 4b)
214− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 4b)
212+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 4b, "%1")
213+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 4b, "%1")
214+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 4b, "%1")
215215 : "+r" (val), "+r" (ret), "+r" (saddr), "=&r" (shift), "=&r" (temp1)
216216 : "r" (regs->isr) );
217217 }
@@ -244,8 +244,8 @@ static int emulate_sth(struct pt_regs *regs, int frreg) · 26 unmodified lines
244244 "1: stb %1, 0(%%sr1, %3)\n"
245245 "2: stb %2, 1(%%sr1, %3)\n"
246246 "3: \n"
247− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b)
248− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b)
247+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b, "%0")
248+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b, "%0")
249249 : "+r" (ret), "=&r" (temp1)
250250 : "r" (val), "r" (regs->ior), "r" (regs->isr) );
251251
@@ -285,8 +285,8 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop) · 33 unmodified lines
285285 " stw %%r20,0(%%sr1,%2)\n"
286286 " stw %%r21,4(%%sr1,%2)\n"
287287 "3: \n"
288− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b)
289− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b)
288+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 3b, "%0")
289+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 3b, "%0")
290290 : "+r" (ret)
291291 : "r" (val), "r" (regs->ior), "r" (regs->isr)
292292 : "r19", "r20", "r21", "r22", "r1" );
@@ -329,10 +329,10 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 36 unmodified lines
329329 "3: std %%r20,0(%%sr1,%2)\n"
330330 "4: std %%r21,8(%%sr1,%2)\n"
331331 "5: \n"
332− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 5b)
333− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 5b)
334− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 5b)
335− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(4b, 5b)
332+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 5b, "%0")
333+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 5b, "%0")
334+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 5b, "%0")
335+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(4b, 5b, "%0")
336336 : "+r" (ret)
337337 : "r" (val), "r" (regs->ior), "r" (regs->isr)
338338 : "r19", "r20", "r21", "r22", "r1" );
@@ -357,11 +357,11 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) · 18 unmodified lines
357357 "4: stw %%r1,4(%%sr1,%2)\n"
358358 "5: stw %R1,8(%%sr1,%2)\n"
359359 "6: \n"
360− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 6b)
361− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 6b)
362− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 6b)
363− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(4b, 6b)
364− ASM_EXCEPTIONTABLE_ENTRY_EFAULT(5b, 6b)
360+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(1b, 6b, "%0")
361+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(2b, 6b, "%0")
362+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(3b, 6b, "%0")
363+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(4b, 6b, "%0")
364+ ASM_EXCEPTIONTABLE_ENTRY_EFAULT(5b, 6b, "%0")
365365 : "+r" (ret)
366366 : "r" (val), "r" (regs->ior), "r" (regs->isr)
367367 : "r19", "r20", "r21", "r1" );
arch/parisc/kernel/vmlinux.lds.S+1−1
@@ -127,7 +127,7 @@ SECTIONS · 126 unmodified lines
127127 }
128128 #endif
129129
130− RO_DATA(8)
130+ RO_DATA(PAGE_SIZE)
131131
132132 /* unwind info */
133133 . = ALIGN(4);
arch/parisc/mm/fault.c+8−3
@@ -150,11 +150,16 @@ int fixup_exception(struct pt_regs *regs) · 149 unmodified lines
150150 * Fix up get_user() and put_user().
151151 * ASM_EXCEPTIONTABLE_ENTRY_EFAULT() sets the least-significant
152152 * bit in the relative address of the fixup routine to indicate
153− * that gr[ASM_EXCEPTIONTABLE_REG] should be loaded with
154− * -EFAULT to report a userspace access error.
153+ * that the register encoded in the "or %r0,%r0,register"
154+ * opcode should be loaded with -EFAULT to report a userspace
155+ * access error.
155156 */
156157 if (fix->fixup & 1) {
157− regs->gr[ASM_EXCEPTIONTABLE_REG] = -EFAULT;
158+ int fault_error_reg = fix->err_opcode & 0x1f;
159+ if (!WARN_ON(!fault_error_reg))
160+ regs->gr[fault_error_reg] = -EFAULT;
161+ pr_debug("Unalignment fixup of register %d at %pS\n",
162+ fault_error_reg, (void*)regs->iaoq[0]);
158163
159164 /* zero target register for get_user() */
160165 if (parisc_acctyp(0, regs->iir) == VM_READ) {
arch/riscv/boot/dts/sophgo/sg2042.dtsi+48−32
@@ -93,144 +93,160 @@ · 92 unmodified lines
9393 <&cpu63_intc 3>;
9494 };
9595
96− clint_mtimer0: timer@70ac000000 {
96+ clint_mtimer0: timer@70ac004000 {
9797 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
98− reg = <0x00000070 0xac000000 0x00000000 0x00007ff8>;
98+ reg = <0x00000070 0xac004000 0x00000000 0x0000c000>;
99+ reg-names = "mtimecmp";
99100 interrupts-extended = <&cpu0_intc 7>,
100101 <&cpu1_intc 7>,
101102 <&cpu2_intc 7>,
102103 <&cpu3_intc 7>;
103104 };
104105
105− clint_mtimer1: timer@70ac010000 {
106+ clint_mtimer1: timer@70ac014000 {
106107 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
107− reg = <0x00000070 0xac010000 0x00000000 0x00007ff8>;
108+ reg = <0x00000070 0xac014000 0x00000000 0x0000c000>;
109+ reg-names = "mtimecmp";
108110 interrupts-extended = <&cpu4_intc 7>,
109111 <&cpu5_intc 7>,
110112 <&cpu6_intc 7>,
111113 <&cpu7_intc 7>;
112114 };
113115
114− clint_mtimer2: timer@70ac020000 {
116+ clint_mtimer2: timer@70ac024000 {
115117 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
116− reg = <0x00000070 0xac020000 0x00000000 0x00007ff8>;
118+ reg = <0x00000070 0xac024000 0x00000000 0x0000c000>;
119+ reg-names = "mtimecmp";
117120 interrupts-extended = <&cpu8_intc 7>,
118121 <&cpu9_intc 7>,
119122 <&cpu10_intc 7>,
120123 <&cpu11_intc 7>;
121124 };
122125
123− clint_mtimer3: timer@70ac030000 {
126+ clint_mtimer3: timer@70ac034000 {
124127 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
125− reg = <0x00000070 0xac030000 0x00000000 0x00007ff8>;
128+ reg = <0x00000070 0xac034000 0x00000000 0x0000c000>;
129+ reg-names = "mtimecmp";
126130 interrupts-extended = <&cpu12_intc 7>,
127131 <&cpu13_intc 7>,
128132 <&cpu14_intc 7>,
129133 <&cpu15_intc 7>;
130134 };
131135
132− clint_mtimer4: timer@70ac040000 {
136+ clint_mtimer4: timer@70ac044000 {
133137 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
134− reg = <0x00000070 0xac040000 0x00000000 0x00007ff8>;
138+ reg = <0x00000070 0xac044000 0x00000000 0x0000c000>;
139+ reg-names = "mtimecmp";
135140 interrupts-extended = <&cpu16_intc 7>,
136141 <&cpu17_intc 7>,
137142 <&cpu18_intc 7>,
138143 <&cpu19_intc 7>;
139144 };
140145
141− clint_mtimer5: timer@70ac050000 {
146+ clint_mtimer5: timer@70ac054000 {
142147 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
143− reg = <0x00000070 0xac050000 0x00000000 0x00007ff8>;
148+ reg = <0x00000070 0xac054000 0x00000000 0x0000c000>;
149+ reg-names = "mtimecmp";
144150 interrupts-extended = <&cpu20_intc 7>,
145151 <&cpu21_intc 7>,
146152 <&cpu22_intc 7>,
147153 <&cpu23_intc 7>;
148154 };
149155
150− clint_mtimer6: timer@70ac060000 {
156+ clint_mtimer6: timer@70ac064000 {
151157 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
152− reg = <0x00000070 0xac060000 0x00000000 0x00007ff8>;
158+ reg = <0x00000070 0xac064000 0x00000000 0x0000c000>;
159+ reg-names = "mtimecmp";
153160 interrupts-extended = <&cpu24_intc 7>,
154161 <&cpu25_intc 7>,
155162 <&cpu26_intc 7>,
156163 <&cpu27_intc 7>;
157164 };
158165
159− clint_mtimer7: timer@70ac070000 {
166+ clint_mtimer7: timer@70ac074000 {
160167 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
161− reg = <0x00000070 0xac070000 0x00000000 0x00007ff8>;
168+ reg = <0x00000070 0xac074000 0x00000000 0x0000c000>;
169+ reg-names = "mtimecmp";
162170 interrupts-extended = <&cpu28_intc 7>,
163171 <&cpu29_intc 7>,
164172 <&cpu30_intc 7>,
165173 <&cpu31_intc 7>;
166174 };
167175
168− clint_mtimer8: timer@70ac080000 {
176+ clint_mtimer8: timer@70ac084000 {
169177 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
170− reg = <0x00000070 0xac080000 0x00000000 0x00007ff8>;
178+ reg = <0x00000070 0xac084000 0x00000000 0x0000c000>;
179+ reg-names = "mtimecmp";
171180 interrupts-extended = <&cpu32_intc 7>,
172181 <&cpu33_intc 7>,
173182 <&cpu34_intc 7>,
174183 <&cpu35_intc 7>;
175184 };
176185
177− clint_mtimer9: timer@70ac090000 {
186+ clint_mtimer9: timer@70ac094000 {
178187 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
179− reg = <0x00000070 0xac090000 0x00000000 0x00007ff8>;
188+ reg = <0x00000070 0xac094000 0x00000000 0x0000c000>;
189+ reg-names = "mtimecmp";
180190 interrupts-extended = <&cpu36_intc 7>,
181191 <&cpu37_intc 7>,
182192 <&cpu38_intc 7>,
183193 <&cpu39_intc 7>;
184194 };
185195
186− clint_mtimer10: timer@70ac0a0000 {
196+ clint_mtimer10: timer@70ac0a4000 {
187197 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
188− reg = <0x00000070 0xac0a0000 0x00000000 0x00007ff8>;
198+ reg = <0x00000070 0xac0a4000 0x00000000 0x0000c000>;
199+ reg-names = "mtimecmp";
189200 interrupts-extended = <&cpu40_intc 7>,
190201 <&cpu41_intc 7>,
191202 <&cpu42_intc 7>,
192203 <&cpu43_intc 7>;
193204 };
194205
195− clint_mtimer11: timer@70ac0b0000 {
206+ clint_mtimer11: timer@70ac0b4000 {
196207 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
197− reg = <0x00000070 0xac0b0000 0x00000000 0x00007ff8>;
208+ reg = <0x00000070 0xac0b4000 0x00000000 0x0000c000>;
209+ reg-names = "mtimecmp";
198210 interrupts-extended = <&cpu44_intc 7>,
199211 <&cpu45_intc 7>,
200212 <&cpu46_intc 7>,
201213 <&cpu47_intc 7>;
202214 };
203215
204− clint_mtimer12: timer@70ac0c0000 {
216+ clint_mtimer12: timer@70ac0c4000 {
205217 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
206− reg = <0x00000070 0xac0c0000 0x00000000 0x00007ff8>;
218+ reg = <0x00000070 0xac0c4000 0x00000000 0x0000c000>;
219+ reg-names = "mtimecmp";
207220 interrupts-extended = <&cpu48_intc 7>,
208221 <&cpu49_intc 7>,
209222 <&cpu50_intc 7>,
210223 <&cpu51_intc 7>;
211224 };
212225
213− clint_mtimer13: timer@70ac0d0000 {
226+ clint_mtimer13: timer@70ac0d4000 {
214227 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
215− reg = <0x00000070 0xac0d0000 0x00000000 0x00007ff8>;
228+ reg = <0x00000070 0xac0d4000 0x00000000 0x0000c000>;
229+ reg-names = "mtimecmp";
216230 interrupts-extended = <&cpu52_intc 7>,
217231 <&cpu53_intc 7>,
218232 <&cpu54_intc 7>,
219233 <&cpu55_intc 7>;
220234 };
221235
222− clint_mtimer14: timer@70ac0e0000 {
236+ clint_mtimer14: timer@70ac0e4000 {
223237 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
224− reg = <0x00000070 0xac0e0000 0x00000000 0x00007ff8>;
238+ reg = <0x00000070 0xac0e4000 0x00000000 0x0000c000>;
239+ reg-names = "mtimecmp";
225240 interrupts-extended = <&cpu56_intc 7>,
226241 <&cpu57_intc 7>,
227242 <&cpu58_intc 7>,
228243 <&cpu59_intc 7>;
229244 };
230245
231− clint_mtimer15: timer@70ac0f0000 {
246+ clint_mtimer15: timer@70ac0f4000 {
232247 compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer";
233− reg = <0x00000070 0xac0f0000 0x00000000 0x00007ff8>;
248+ reg = <0x00000070 0xac0f4000 0x00000000 0x0000c000>;
249+ reg-names = "mtimecmp";
234250 interrupts-extended = <&cpu60_intc 7>,
235251 <&cpu61_intc 7>,
236252 <&cpu62_intc 7>,
arch/um/Makefile+3−1
@@ -115,7 +115,9 @@ archprepare: · 114 unmodified lines
115115 $(Q)$(MAKE) $(build)=$(HOST_DIR)/um include/generated/user_constants.h
116116
117117 LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
118−LINK-$(CONFIG_LD_SCRIPT_DYN) += $(call cc-option, -no-pie)
118+ifdef CONFIG_LD_SCRIPT_DYN
119+LINK-$(call gcc-min-version, 60100)$(CONFIG_CC_IS_CLANG) += -no-pie
120+endif
119121 LINK-$(CONFIG_LD_SCRIPT_DYN_RPATH) += -Wl,-rpath,/lib
120122
121123 CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
arch/x86/Makefile+5−5
@@ -112,13 +112,13 @@ ifeq ($(CONFIG_X86_32),y) · 111 unmodified lines
112112 # temporary until string.h is fixed
113113 KBUILD_CFLAGS += -ffreestanding
114114
115− ifeq ($(CONFIG_STACKPROTECTOR),y)
116− ifeq ($(CONFIG_SMP),y)
115+ ifeq ($(CONFIG_STACKPROTECTOR),y)
116+ ifeq ($(CONFIG_SMP),y)
117117 KBUILD_CFLAGS += -mstack-protector-guard-reg=fs -mstack-protector-guard-symbol=__stack_chk_guard
118− else
118+ else
119119 KBUILD_CFLAGS += -mstack-protector-guard=global
120− endif
121− endif
120+ endif
121+ endif
122122 else
123123 BITS := 64
124124 UTS_MACHINE := x86_64
arch/x86/include/asm/cpufeatures.h+1−3
@@ -81,10 +81,8 @@ · 80 unmodified lines
8181 #define X86_FEATURE_K6_MTRR ( 3*32+ 1) /* AMD K6 nonstandard MTRRs */
8282 #define X86_FEATURE_CYRIX_ARR ( 3*32+ 2) /* Cyrix ARRs (= MTRRs) */
8383 #define X86_FEATURE_CENTAUR_MCR ( 3*32+ 3) /* Centaur MCRs (= MTRRs) */
84−
85−/* CPU types for specific tunings: */
8684 #define X86_FEATURE_K8 ( 3*32+ 4) /* "" Opteron, Athlon64 */
87−/* FREE, was #define X86_FEATURE_K7 ( 3*32+ 5) "" Athlon */
85+#define X86_FEATURE_ZEN5 ( 3*32+ 5) /* "" CPU based on Zen5 microarchitecture */
8886 #define X86_FEATURE_P3 ( 3*32+ 6) /* "" P3 */
8987 #define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */
9088 #define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */
arch/x86/include/asm/intel-family.h+2−0
@@ -162,6 +162,8 @@ · 161 unmodified lines
162162 #define INTEL_FAM6_ATOM_CRESTMONT_X 0xAF /* Sierra Forest */
163163 #define INTEL_FAM6_ATOM_CRESTMONT 0xB6 /* Grand Ridge */
164164
165+#define INTEL_FAM6_ATOM_DARKMONT_X 0xDD /* Clearwater Forest */
166+
165167 /* Xeon Phi */
166168
167169 #define INTEL_FAM6_XEON_PHI_KNL 0x57 /* Knights Landing */
arch/x86/include/asm/kmsan.h+16−1
@@ -64,6 +64,7 @@ static inline bool kmsan_virt_addr_valid(void *addr) · 63 unmodified lines
6464 {
6565 unsigned long x = (unsigned long)addr;
6666 unsigned long y = x - __START_KERNEL_map;
67+ bool ret;
6768
6869 /* use the carry flag to determine if x was < __START_KERNEL_map */
6970 if (unlikely(x > y)) {
@@ -79,7 +80,21 @@ static inline bool kmsan_virt_addr_valid(void *addr) · 9 unmodified lines
7980 return false;
8081 }
8182
82− return pfn_valid(x >> PAGE_SHIFT);
83+ /*
84+ * pfn_valid() relies on RCU, and may call into the scheduler on exiting
85+ * the critical section. However, this would result in recursion with
86+ * KMSAN. Therefore, disable preemption here, and re-enable preemption
87+ * below while suppressing reschedules to avoid recursion.
88+ *
89+ * Note, this sacrifices occasionally breaking scheduling guarantees.
90+ * Although, a kernel compiled with KMSAN has already given up on any
91+ * performance guarantees due to being heavily instrumented.
92+ */
93+ preempt_disable();
94+ ret = pfn_valid(x >> PAGE_SHIFT);
95+ preempt_enable_no_resched();
96+
97+ return ret;
8398 }
8499
85100 #endif /* !MODULE */
arch/x86/include/asm/syscall_wrapper.h+21−4
@@ -58,12 +58,29 @@ extern long __ia32_sys_ni_syscall(const struct pt_regs *regs); · 57 unmodified lines
5858 ,,regs->di,,regs->si,,regs->dx \
5959 ,,regs->r10,,regs->r8,,regs->r9) \
6060
61+
62+/* SYSCALL_PT_ARGS is Adapted from s390x */
63+#define SYSCALL_PT_ARG6(m, t1, t2, t3, t4, t5, t6) \
64+ SYSCALL_PT_ARG5(m, t1, t2, t3, t4, t5), m(t6, (regs->bp))
65+#define SYSCALL_PT_ARG5(m, t1, t2, t3, t4, t5) \
66+ SYSCALL_PT_ARG4(m, t1, t2, t3, t4), m(t5, (regs->di))
67+#define SYSCALL_PT_ARG4(m, t1, t2, t3, t4) \
68+ SYSCALL_PT_ARG3(m, t1, t2, t3), m(t4, (regs->si))
69+#define SYSCALL_PT_ARG3(m, t1, t2, t3) \
70+ SYSCALL_PT_ARG2(m, t1, t2), m(t3, (regs->dx))
71+#define SYSCALL_PT_ARG2(m, t1, t2) \
72+ SYSCALL_PT_ARG1(m, t1), m(t2, (regs->cx))
73+#define SYSCALL_PT_ARG1(m, t1) m(t1, (regs->bx))
74+#define SYSCALL_PT_ARGS(x, ...) SYSCALL_PT_ARG##x(__VA_ARGS__)
75+
76+#define __SC_COMPAT_CAST(t, a) \
77+ (__typeof(__builtin_choose_expr(__TYPE_IS_L(t), 0, 0U))) \
78+ (unsigned int)a
79+
6180 /* Mapping of registers to parameters for syscalls on i386 */
6281 #define SC_IA32_REGS_TO_ARGS(x, ...) \
63− __MAP(x,__SC_ARGS \
64− ,,(unsigned int)regs->bx,,(unsigned int)regs->cx \
65− ,,(unsigned int)regs->dx,,(unsigned int)regs->si \
66− ,,(unsigned int)regs->di,,(unsigned int)regs->bp)
82+ SYSCALL_PT_ARGS(x, __SC_COMPAT_CAST, \
83+ __MAP(x, __SC_TYPE, __VA_ARGS__)) \
6784
6885 #define __SYS_STUB0(abi, name) \
6986 long __##abi##_##name(const struct pt_regs *regs); \
arch/x86/kernel/alternative.c+1−1
@@ -403,7 +403,7 @@ noinstr void BUG_func(void) · 402 unmodified lines
403403 {
404404 BUG();
405405 }
406−EXPORT_SYMBOL_GPL(BUG_func);
406+EXPORT_SYMBOL(BUG_func);
407407
408408 #define CALL_RIP_REL_OPCODE 0xff
409409 #define CALL_RIP_REL_MODRM 0x15
arch/x86/kernel/cpu/amd.c+24−4
@@ -538,7 +538,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) · 537 unmodified lines
538538
539539 /* Figure out Zen generations: */
540540 switch (c->x86) {
541− case 0x17: {
541+ case 0x17:
542542 switch (c->x86_model) {
543543 case 0x00 ... 0x2f:
544544 case 0x50 ... 0x5f:
@@ -554,8 +554,8 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) · 9 unmodified lines
554554 goto warn;
555555 }
556556 break;
557− }
558− case 0x19: {
557+
558+ case 0x19:
559559 switch (c->x86_model) {
560560 case 0x00 ... 0x0f:
561561 case 0x20 ... 0x5f:
@@ -569,7 +569,20 @@ static void bsp_init_amd(struct cpuinfo_x86 *c) · 7 unmodified lines
569569 goto warn;
570570 }
571571 break;
572− }
572+
573+ case 0x1a:
574+ switch (c->x86_model) {
575+ case 0x00 ... 0x0f:
576+ case 0x20 ... 0x2f:
577+ case 0x40 ... 0x4f:
578+ case 0x70 ... 0x7f:
579+ setup_force_cpu_cap(X86_FEATURE_ZEN5);
580+ break;
581+ default:
582+ goto warn;
583+ }
584+ break;
585+
573586 default:
574587 break;
575588 }
@@ -1039,6 +1052,11 @@ static void init_amd_zen4(struct cpuinfo_x86 *c) · 463 unmodified lines
10391052 msr_set_bit(MSR_ZEN4_BP_CFG, MSR_ZEN4_BP_CFG_SHARED_BTB_FIX_BIT);
10401053 }
10411054
1055+static void init_amd_zen5(struct cpuinfo_x86 *c)
1056+{
1057+ init_amd_zen_common();
1058+}
1059+
10421060 static void init_amd(struct cpuinfo_x86 *c)
10431061 {
10441062 u64 vm_cr;
@@ -1084,6 +1102,8 @@ static void init_amd(struct cpuinfo_x86 *c) · 39 unmodified lines
10841102 init_amd_zen3(c);
10851103 else if (boot_cpu_has(X86_FEATURE_ZEN4))
10861104 init_amd_zen4(c);
1105+ else if (boot_cpu_has(X86_FEATURE_ZEN5))
1106+ init_amd_zen5(c);
10871107
10881108 /*
10891109 * Enable workaround for FXSAVE leak on CPUs
block/blk-map.c+10−3
@@ -205,12 +205,19 @@ static int bio_copy_user_iov(struct request *rq, struct rq_map_data *map_data, · 204 unmodified lines
205205 /*
206206 * success
207207 */
208− if ((iov_iter_rw(iter) == WRITE &&
209− (!map_data || !map_data->null_mapped)) ||
210− (map_data && map_data->from_user)) {
208+ if (iov_iter_rw(iter) == WRITE &&
209+ (!map_data || !map_data->null_mapped)) {
211210 ret = bio_copy_from_iter(bio, iter);
212211 if (ret)
213212 goto cleanup;
213+ } else if (map_data && map_data->from_user) {
214+ struct iov_iter iter2 = *iter;
215+
216+ /* This is the copy-in part of SG_DXFER_TO_FROM_DEV. */
217+ iter2.data_source = ITER_SOURCE;
218+ ret = bio_copy_from_iter(bio, &iter2);
219+ if (ret)
220+ goto cleanup;
214221 } else {
215222 if (bmd->is_our_pages)
216223 zero_fill_bio(bio);
block/ioctl.c+0−2
@@ -20,8 +20,6 @@ static int blkpg_do_ioctl(struct block_device *bdev, · 19 unmodified lines
2020 struct blkpg_partition p;
2121 sector_t start, length;
2222
23− if (disk->flags & GENHD_FL_NO_PART)
24− return -EINVAL;
2523 if (!capable(CAP_SYS_ADMIN))
2624 return -EACCES;
2725 if (copy_from_user(&p, upart, sizeof(struct blkpg_partition)))
block/partitions/core.c+5−0
@@ -439,6 +439,11 @@ int bdev_add_partition(struct gendisk *disk, int partno, sector_t start, · 438 unmodified lines
439439 goto out;
440440 }
441441
442+ if (disk->flags & GENHD_FL_NO_PART) {
443+ ret = -EINVAL;
444+ goto out;
445+ }
446+
442447 if (partition_overlaps(disk, start, length, -1)) {
443448 ret = -EBUSY;
444449 goto out;
drivers/accel/ivpu/ivpu_debugfs.c+16−4
@@ -102,7 +102,7 @@ static int reset_pending_show(struct seq_file *s, void *v) · 101 unmodified lines
102102 {
103103 struct ivpu_device *vdev = seq_to_ivpu(s);
104104
105− seq_printf(s, "%d\n", atomic_read(&vdev->pm->in_reset));
105+ seq_printf(s, "%d\n", atomic_read(&vdev->pm->reset_pending));
106106 return 0;
107107 }
108108
@@ -130,7 +130,9 @@ dvfs_mode_fops_write(struct file *file, const char __user *user_buf, size_t size · 21 unmodified lines
130130
131131 fw->dvfs_mode = dvfs_mode;
132132
133− ivpu_pm_schedule_recovery(vdev);
133+ ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
134+ if (ret)
135+ return ret;
134136
135137 return size;
136138 }
@@ -190,7 +192,10 @@ fw_profiling_freq_fops_write(struct file *file, const char __user *user_buf, · 53 unmodified lines
190192 return ret;
191193
192194 ivpu_hw_profiling_freq_drive(vdev, enable);
193− ivpu_pm_schedule_recovery(vdev);
195+
196+ ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
197+ if (ret)
198+ return ret;
194199
195200 return size;
196201 }
@@ -301,11 +306,18 @@ static ssize_t · 104 unmodified lines
301306 ivpu_force_recovery_fn(struct file *file, const char __user *user_buf, size_t size, loff_t *pos)
302307 {
303308 struct ivpu_device *vdev = file->private_data;
309+ int ret;
304310
305311 if (!size)
306312 return -EINVAL;
307313
308− ivpu_pm_schedule_recovery(vdev);
314+ ret = ivpu_rpm_get(vdev);
315+ if (ret)
316+ return ret;
317+
318+ ivpu_pm_trigger_recovery(vdev, "debugfs");
319+ flush_work(&vdev->pm->recovery_work);
320+ ivpu_rpm_put(vdev);
309321 return size;
310322 }
311323
drivers/accel/ivpu/ivpu_drv.c+71−55
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/firmware.h>
77 #include <linux/module.h>
88 #include <linux/pci.h>
9+#include <linux/pm_runtime.h>
910
1011 #include <drm/drm_accel.h>
1112 #include <drm/drm_file.h>
@@ -17,6 +18,7 @@ · 5 unmodified lines
1718 #include "ivpu_debugfs.h"
1819 #include "ivpu_drv.h"
1920 #include "ivpu_fw.h"
21+#include "ivpu_fw_log.h"
2022 #include "ivpu_gem.h"
2123 #include "ivpu_hw.h"
2224 #include "ivpu_ipc.h"
@@ -65,22 +67,20 @@ struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv) · 42 unmodified lines
6567 return file_priv;
6668 }
6769
68−struct ivpu_file_priv *ivpu_file_priv_get_by_ctx_id(struct ivpu_device *vdev, unsigned long id)
70+static void file_priv_unbind(struct ivpu_device *vdev, struct ivpu_file_priv *file_priv)
6971 {
70− struct ivpu_file_priv *file_priv;
71−
72− xa_lock_irq(&vdev->context_xa);
73− file_priv = xa_load(&vdev->context_xa, id);
74− /* file_priv may still be in context_xa during file_priv_release() */
75− if (file_priv && !kref_get_unless_zero(&file_priv->ref))
76− file_priv = NULL;
77− xa_unlock_irq(&vdev->context_xa);
78−
79− if (file_priv)
80− ivpu_dbg(vdev, KREF, "file_priv get by id: ctx %u refcount %u\n",
81− file_priv->ctx.id, kref_read(&file_priv->ref));
82−
83− return file_priv;
72+ mutex_lock(&file_priv->lock);
73+ if (file_priv->bound) {
74+ ivpu_dbg(vdev, FILE, "file_priv unbind: ctx %u\n", file_priv->ctx.id);
75+
76+ ivpu_cmdq_release_all_locked(file_priv);
77+ ivpu_jsm_context_release(vdev, file_priv->ctx.id);
78+ ivpu_bo_unbind_all_bos_from_context(vdev, &file_priv->ctx);
79+ ivpu_mmu_user_context_fini(vdev, &file_priv->ctx);
80+ file_priv->bound = false;
81+ drm_WARN_ON(&vdev->drm, !xa_erase_irq(&vdev->context_xa, file_priv->ctx.id));
82+ }
83+ mutex_unlock(&file_priv->lock);
8484 }
8585
8686 static void file_priv_release(struct kref *ref)
@@ -88,13 +88,15 @@ static void file_priv_release(struct kref *ref) · 1 unmodified line
8888 struct ivpu_file_priv *file_priv = container_of(ref, struct ivpu_file_priv, ref);
8989 struct ivpu_device *vdev = file_priv->vdev;
9090
91− ivpu_dbg(vdev, FILE, "file_priv release: ctx %u\n", file_priv->ctx.id);
91+ ivpu_dbg(vdev, FILE, "file_priv release: ctx %u bound %d\n",
92+ file_priv->ctx.id, (bool)file_priv->bound);
93+
94+ pm_runtime_get_sync(vdev->drm.dev);
95+ mutex_lock(&vdev->context_list_lock);
96+ file_priv_unbind(vdev, file_priv);
97+ mutex_unlock(&vdev->context_list_lock);
98+ pm_runtime_put_autosuspend(vdev->drm.dev);
9299
93− ivpu_cmdq_release_all(file_priv);
94− ivpu_jsm_context_release(vdev, file_priv->ctx.id);
95− ivpu_bo_remove_all_bos_from_context(vdev, &file_priv->ctx);
96− ivpu_mmu_user_context_fini(vdev, &file_priv->ctx);
97− drm_WARN_ON(&vdev->drm, xa_erase_irq(&vdev->context_xa, file_priv->ctx.id) != file_priv);
98100 mutex_destroy(&file_priv->lock);
99101 kfree(file_priv);
100102 }
@@ -176,9 +178,6 @@ static int ivpu_get_param_ioctl(struct drm_device *dev, void *data, struct drm_f · 75 unmodified lines
176178 case DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS:
177179 args->value = vdev->hw->ranges.user.start;
178180 break;
179− case DRM_IVPU_PARAM_CONTEXT_PRIORITY:
180− args->value = file_priv->priority;
181− break;
182181 case DRM_IVPU_PARAM_CONTEXT_ID:
183182 args->value = file_priv->ctx.id;
184183 break;
@@ -218,17 +217,10 @@ static int ivpu_get_param_ioctl(struct drm_device *dev, void *data, struct drm_f · 33 unmodified lines
218217
219218 static int ivpu_set_param_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
220219 {
221− struct ivpu_file_priv *file_priv = file->driver_priv;
222220 struct drm_ivpu_param *args = data;
223221 int ret = 0;
224222
225223 switch (args->param) {
226− case DRM_IVPU_PARAM_CONTEXT_PRIORITY:
227− if (args->value <= DRM_IVPU_CONTEXT_PRIORITY_REALTIME)
228− file_priv->priority = args->value;
229− else
230− ret = -EINVAL;
231− break;
232224 default:
233225 ret = -EINVAL;
234226 }
@@ -241,50 +233,53 @@ static int ivpu_open(struct drm_device *dev, struct drm_file *file) · 6 unmodified lines
241233 struct ivpu_device *vdev = to_ivpu_device(dev);
242234 struct ivpu_file_priv *file_priv;
243235 u32 ctx_id;
244− void *old;
245− int ret;
236+ int idx, ret;
246237
247− ret = xa_alloc_irq(&vdev->context_xa, &ctx_id, NULL, vdev->context_xa_limit, GFP_KERNEL);
248− if (ret) {
249− ivpu_err(vdev, "Failed to allocate context id: %d\n", ret);
250− return ret;
251− }
238+ if (!drm_dev_enter(dev, &idx))
239+ return -ENODEV;
252240
253241 file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
254242 if (!file_priv) {
255243 ret = -ENOMEM;
256− goto err_xa_erase;
244+ goto err_dev_exit;
257245 }
258246
259247 file_priv->vdev = vdev;
260− file_priv->priority = DRM_IVPU_CONTEXT_PRIORITY_NORMAL;
248+ file_priv->bound = true;
261249 kref_init(&file_priv->ref);
262250 mutex_init(&file_priv->lock);
263251
252+ mutex_lock(&vdev->context_list_lock);
253+
254+ ret = xa_alloc_irq(&vdev->context_xa, &ctx_id, file_priv,
255+ vdev->context_xa_limit, GFP_KERNEL);
256+ if (ret) {
257+ ivpu_err(vdev, "Failed to allocate context id: %d\n", ret);
258+ goto err_unlock;
259+ }
260+
264261 ret = ivpu_mmu_user_context_init(vdev, &file_priv->ctx, ctx_id);
265262 if (ret)
266− goto err_mutex_destroy;
263+ goto err_xa_erase;
267264
268− old = xa_store_irq(&vdev->context_xa, ctx_id, file_priv, GFP_KERNEL);
269− if (xa_is_err(old)) {
270− ret = xa_err(old);
271− ivpu_err(vdev, "Failed to store context %u: %d\n", ctx_id, ret);
272− goto err_ctx_fini;
273− }
265+ mutex_unlock(&vdev->context_list_lock);
266+ drm_dev_exit(idx);
267+
268+ file->driver_priv = file_priv;
274269
275270 ivpu_dbg(vdev, FILE, "file_priv create: ctx %u process %s pid %d\n",
276271 ctx_id, current->comm, task_pid_nr(current));
277272
278− file->driver_priv = file_priv;
279273 return 0;
280274
281−err_ctx_fini:
282− ivpu_mmu_user_context_fini(vdev, &file_priv->ctx);
283−err_mutex_destroy:
284− mutex_destroy(&file_priv->lock);
285− kfree(file_priv);
286275 err_xa_erase:
287276 xa_erase_irq(&vdev->context_xa, ctx_id);
277+err_unlock:
278+ mutex_unlock(&vdev->context_list_lock);
279+ mutex_destroy(&file_priv->lock);
280+ kfree(file_priv);
281+err_dev_exit:
282+ drm_dev_exit(idx);
288283 return ret;
289284 }
290285
@@ -340,8 +335,6 @@ static int ivpu_wait_for_ready(struct ivpu_device *vdev) · 49 unmodified lines
340335
341336 if (!ret)
342337 ivpu_dbg(vdev, PM, "VPU ready message received successfully\n");
343− else
344− ivpu_hw_diagnose_failure(vdev);
345338
346339 return ret;
347340 }
@@ -369,6 +362,9 @@ int ivpu_boot(struct ivpu_device *vdev) · 21 unmodified lines
369362 ret = ivpu_wait_for_ready(vdev);
370363 if (ret) {
371364 ivpu_err(vdev, "Failed to boot the firmware: %d\n", ret);
365+ ivpu_hw_diagnose_failure(vdev);
366+ ivpu_mmu_evtq_dump(vdev);
367+ ivpu_fw_log_dump(vdev);
372368 return ret;
373369 }
374370
@@ -540,6 +536,10 @@ static int ivpu_dev_init(struct ivpu_device *vdev) · 165 unmodified lines
540536 lockdep_set_class(&vdev->submitted_jobs_xa.xa_lock, &submitted_jobs_xa_lock_class_key);
541537 INIT_LIST_HEAD(&vdev->bo_list);
542538
539+ ret = drmm_mutex_init(&vdev->drm, &vdev->context_list_lock);
540+ if (ret)
541+ goto err_xa_destroy;
542+
543543 ret = drmm_mutex_init(&vdev->drm, &vdev->bo_list_lock);
544544 if (ret)
545545 goto err_xa_destroy;
@@ -611,14 +611,30 @@ err_xa_destroy: · 65 unmodified lines
611611 return ret;
612612 }
613613
614+static void ivpu_bo_unbind_all_user_contexts(struct ivpu_device *vdev)
615+{
616+ struct ivpu_file_priv *file_priv;
617+ unsigned long ctx_id;
618+
619+ mutex_lock(&vdev->context_list_lock);
620+
621+ xa_for_each(&vdev->context_xa, ctx_id, file_priv)
622+ file_priv_unbind(vdev, file_priv);
623+
624+ mutex_unlock(&vdev->context_list_lock);
625+}
626+
614627 static void ivpu_dev_fini(struct ivpu_device *vdev)
615628 {
616629 ivpu_pm_disable(vdev);
617630 ivpu_shutdown(vdev);
618631 if (IVPU_WA(d3hot_after_power_off))
619632 pci_set_power_state(to_pci_dev(vdev->drm.dev), PCI_D3hot);
633+
634+ ivpu_jobs_abort_all(vdev);
620635 ivpu_job_done_consumer_fini(vdev);
621636 ivpu_pm_cancel_recovery(vdev);
637+ ivpu_bo_unbind_all_user_contexts(vdev);
622638
623639 ivpu_ipc_fini(vdev);
624640 ivpu_fw_fini(vdev);
drivers/accel/ivpu/ivpu_drv.h+3−2
@@ -56,6 +56,7 @@ · 55 unmodified lines
5656 #define IVPU_DBG_JSM BIT(10)
5757 #define IVPU_DBG_KREF BIT(11)
5858 #define IVPU_DBG_RPM BIT(12)
59+#define IVPU_DBG_MMU_MAP BIT(13)
5960
6061 #define ivpu_err(vdev, fmt, ...) \
6162 drm_err(&(vdev)->drm, "%s(): " fmt, __func__, ##__VA_ARGS__)
@@ -114,6 +115,7 @@ struct ivpu_device { · 52 unmodified lines
114115
115116 struct ivpu_mmu_context gctx;
116117 struct ivpu_mmu_context rctx;
118+ struct mutex context_list_lock; /* Protects user context addition/removal */
117119 struct xarray context_xa;
118120 struct xa_limit context_xa_limit;
119121
@@ -145,8 +147,8 @@ struct ivpu_file_priv { · 25 unmodified lines
145147 struct mutex lock; /* Protects cmdq */
146148 struct ivpu_cmdq *cmdq[IVPU_NUM_ENGINES];
147149 struct ivpu_mmu_context ctx;
148− u32 priority;
149150 bool has_mmu_faults;
151+ bool bound;
150152 };
151153
152154 extern int ivpu_dbg_mask;
@@ -162,7 +164,6 @@ extern bool ivpu_disable_mmu_cont_pages; · 9 unmodified lines
162164 extern int ivpu_test_mode;
163165
164166 struct ivpu_file_priv *ivpu_file_priv_get(struct ivpu_file_priv *file_priv);
165−struct ivpu_file_priv *ivpu_file_priv_get_by_ctx_id(struct ivpu_device *vdev, unsigned long id);
166167 void ivpu_file_priv_put(struct ivpu_file_priv **link);
167168
168169 int ivpu_boot(struct ivpu_device *vdev);
drivers/accel/ivpu/ivpu_gem.c+52−90
@@ -24,14 +24,11 @@ static const struct drm_gem_object_funcs ivpu_gem_funcs; · 23 unmodified lines
2424
2525 static inline void ivpu_dbg_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, const char *action)
2626 {
27− if (bo->ctx)
28− ivpu_dbg(vdev, BO, "%6s: size %zu has_pages %d dma_mapped %d handle %u ctx %d vpu_addr 0x%llx mmu_mapped %d\n",
29− action, ivpu_bo_size(bo), (bool)bo->base.pages, (bool)bo->base.sgt,
30− bo->handle, bo->ctx->id, bo->vpu_addr, bo->mmu_mapped);
31− else
32− ivpu_dbg(vdev, BO, "%6s: size %zu has_pages %d dma_mapped %d handle %u (not added to context)\n",
33− action, ivpu_bo_size(bo), (bool)bo->base.pages, (bool)bo->base.sgt,
34− bo->handle);
27+ ivpu_dbg(vdev, BO,
28+ "%6s: bo %8p vpu_addr %9llx size %8zu ctx %d has_pages %d dma_mapped %d mmu_mapped %d wc %d imported %d\n",
29+ action, bo, bo->vpu_addr, ivpu_bo_size(bo), bo->ctx ? bo->ctx->id : 0,
30+ (bool)bo->base.pages, (bool)bo->base.sgt, bo->mmu_mapped, bo->base.map_wc,
31+ (bool)bo->base.base.import_attach);
3532 }
3633
3734 /*
@@ -49,12 +46,7 @@ int __must_check ivpu_bo_pin(struct ivpu_bo *bo) · 11 unmodified lines
4946 mutex_lock(&bo->lock);
5047
5148 ivpu_dbg_bo(vdev, bo, "pin");
52−
53− if (!bo->ctx) {
54− ivpu_err(vdev, "vpu_addr not allocated for BO %d\n", bo->handle);
55− ret = -EINVAL;
56− goto unlock;
57− }
49+ drm_WARN_ON(&vdev->drm, !bo->ctx);
5850
5951 if (!bo->mmu_mapped) {
6052 struct sg_table *sgt = drm_gem_shmem_get_pages_sgt(&bo->base);
@@ -85,7 +77,10 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bo, struct ivpu_mmu_context *ctx, · 24 unmodified lines
8577 const struct ivpu_addr_range *range)
8678 {
8779 struct ivpu_device *vdev = ivpu_bo_to_vdev(bo);
88− int ret;
80+ int idx, ret;
81+
82+ if (!drm_dev_enter(&vdev->drm, &idx))
83+ return -ENODEV;
8984
9085 mutex_lock(&bo->lock);
9186
@@ -101,6 +96,8 @@ ivpu_bo_alloc_vpu_addr(struct ivpu_bo *bo, struct ivpu_mmu_context *ctx, · 9 unmodified lines
10196
10297 mutex_unlock(&bo->lock);
10398
99+ drm_dev_exit(idx);
100+
104101 return ret;
105102 }
106103
@@ -108,11 +105,7 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo) · 1 unmodified line
108105 {
109106 struct ivpu_device *vdev = ivpu_bo_to_vdev(bo);
110107
111− lockdep_assert_held(&bo->lock);
112−
113− ivpu_dbg_bo(vdev, bo, "unbind");
114−
115− /* TODO: dma_unmap */
108+ lockdep_assert(lockdep_is_held(&bo->lock) || !kref_read(&bo->base.base.refcount));
116109
117110 if (bo->mmu_mapped) {
118111 drm_WARN_ON(&vdev->drm, !bo->ctx);
@@ -124,19 +117,23 @@ static void ivpu_bo_unbind_locked(struct ivpu_bo *bo) · 5 unmodified lines
124117
125118 if (bo->ctx) {
126119 ivpu_mmu_context_remove_node(bo->ctx, &bo->mm_node);
127− bo->vpu_addr = 0;
128120 bo->ctx = NULL;
129121 }
130−}
131122
132−static void ivpu_bo_unbind(struct ivpu_bo *bo)
133−{
134− mutex_lock(&bo->lock);
135− ivpu_bo_unbind_locked(bo);
136− mutex_unlock(&bo->lock);
123+ if (bo->base.base.import_attach)
124+ return;
125+
126+ dma_resv_lock(bo->base.base.resv, NULL);
127+ if (bo->base.sgt) {
128+ dma_unmap_sgtable(vdev->drm.dev, bo->base.sgt, DMA_BIDIRECTIONAL, 0);
129+ sg_free_table(bo->base.sgt);
130+ kfree(bo->base.sgt);
131+ bo->base.sgt = NULL;
132+ }
133+ dma_resv_unlock(bo->base.base.resv);
137134 }
138135
139−void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx)
136+void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx)
140137 {
141138 struct ivpu_bo *bo;
142139
@@ -146,8 +143,10 @@ void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_m · 3 unmodified lines
146143 mutex_lock(&vdev->bo_list_lock);
147144 list_for_each_entry(bo, &vdev->bo_list, bo_list_node) {
148145 mutex_lock(&bo->lock);
149− if (bo->ctx == ctx)
146+ if (bo->ctx == ctx) {
147+ ivpu_dbg_bo(vdev, bo, "unbind");
150148 ivpu_bo_unbind_locked(bo);
149+ }
151150 mutex_unlock(&bo->lock);
152151 }
153152 mutex_unlock(&vdev->bo_list_lock);
@@ -199,9 +198,6 @@ ivpu_bo_create(struct ivpu_device *vdev, u64 size, u32 flags) · 45 unmodified lines
199198 list_add_tail(&bo->bo_list_node, &vdev->bo_list);
200199 mutex_unlock(&vdev->bo_list_lock);
201200
202− ivpu_dbg(vdev, BO, "create: vpu_addr 0x%llx size %zu flags 0x%x\n",
203− bo->vpu_addr, bo->base.base.size, flags);
204−
205201 return bo;
206202 }
207203
@@ -212,6 +208,12 @@ static int ivpu_bo_open(struct drm_gem_object *obj, struct drm_file *file) · 4 unmodified lines
212208 struct ivpu_bo *bo = to_ivpu_bo(obj);
213209 struct ivpu_addr_range *range;
214210
211+ if (bo->ctx) {
212+ ivpu_warn(vdev, "Can't add BO to ctx %u: already in ctx %u\n",
213+ file_priv->ctx.id, bo->ctx->id);
214+ return -EALREADY;
215+ }
216+
215217 if (bo->flags & DRM_IVPU_BO_SHAVE_MEM)
216218 range = &vdev->hw->ranges.shave;
217219 else if (bo->flags & DRM_IVPU_BO_DMA_MEM)
@@ -227,62 +229,24 @@ static void ivpu_bo_free(struct drm_gem_object *obj) · 9 unmodified lines
227229 struct ivpu_device *vdev = to_ivpu_device(obj->dev);
228230 struct ivpu_bo *bo = to_ivpu_bo(obj);
229231
232+ ivpu_dbg_bo(vdev, bo, "free");
233+
230234 mutex_lock(&vdev->bo_list_lock);
231235 list_del(&bo->bo_list_node);
232236 mutex_unlock(&vdev->bo_list_lock);
233237
234238 drm_WARN_ON(&vdev->drm, !dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ));
235239
236− ivpu_dbg_bo(vdev, bo, "free");
237−
238− ivpu_bo_unbind(bo);
240+ ivpu_bo_unbind_locked(bo);
239241 mutex_destroy(&bo->lock);
240242
241243 drm_WARN_ON(obj->dev, bo->base.pages_use_count > 1);
242244 drm_gem_shmem_free(&bo->base);
243245 }
244246
245−static const struct dma_buf_ops ivpu_bo_dmabuf_ops = {
246− .cache_sgt_mapping = true,
247− .attach = drm_gem_map_attach,
248− .detach = drm_gem_map_detach,
249− .map_dma_buf = drm_gem_map_dma_buf,
250− .unmap_dma_buf = drm_gem_unmap_dma_buf,
251− .release = drm_gem_dmabuf_release,
252− .mmap = drm_gem_dmabuf_mmap,
253− .vmap = drm_gem_dmabuf_vmap,
254− .vunmap = drm_gem_dmabuf_vunmap,
255−};
256−
257−static struct dma_buf *ivpu_bo_export(struct drm_gem_object *obj, int flags)
258−{
259− struct drm_device *dev = obj->dev;
260− struct dma_buf_export_info exp_info = {
261− .exp_name = KBUILD_MODNAME,
262− .owner = dev->driver->fops->owner,
263− .ops = &ivpu_bo_dmabuf_ops,
264− .size = obj->size,
265− .flags = flags,
266− .priv = obj,
267− .resv = obj->resv,
268− };
269− void *sgt;
270−
271− /*
272− * Make sure that pages are allocated and dma-mapped before exporting the bo.
273− * DMA-mapping is required if the bo will be imported to the same device.
274− */
275− sgt = drm_gem_shmem_get_pages_sgt(to_drm_gem_shmem_obj(obj));
276− if (IS_ERR(sgt))
277− return sgt;
278−
279− return drm_gem_dmabuf_export(dev, &exp_info);
280−}
281−
282247 static const struct drm_gem_object_funcs ivpu_gem_funcs = {
283248 .free = ivpu_bo_free,
284249 .open = ivpu_bo_open,
285− .export = ivpu_bo_export,
286250 .print_info = drm_gem_shmem_object_print_info,
287251 .pin = drm_gem_shmem_object_pin,
288252 .unpin = drm_gem_shmem_object_unpin,
@@ -315,11 +279,9 @@ int ivpu_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fi · 26 unmodified lines
315279 return PTR_ERR(bo);
316280 }
317281
318− ret = drm_gem_handle_create(file, &bo->base.base, &bo->handle);
319− if (!ret) {
282+ ret = drm_gem_handle_create(file, &bo->base.base, &args->handle);
283+ if (!ret)
320284 args->vpu_addr = bo->vpu_addr;
321− args->handle = bo->handle;
322− }
323285
324286 drm_gem_object_put(&bo->base.base);
325287
@@ -361,7 +323,9 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla · 35 unmodified lines
361323 if (ret)
362324 goto err_put;
363325
326+ dma_resv_lock(bo->base.base.resv, NULL);
364327 ret = drm_gem_shmem_vmap(&bo->base, &map);
328+ dma_resv_unlock(bo->base.base.resv);
365329 if (ret)
366330 goto err_put;
367331
@@ -376,7 +340,10 @@ void ivpu_bo_free_internal(struct ivpu_bo *bo) · 8 unmodified lines
376340 {
377341 struct iosys_map map = IOSYS_MAP_INIT_VADDR(bo->base.vaddr);
378342
343+ dma_resv_lock(bo->base.base.resv, NULL);
379344 drm_gem_shmem_vunmap(&bo->base, &map);
345+ dma_resv_unlock(bo->base.base.resv);
346+
380347 drm_gem_object_put(&bo->base.base);
381348 }
382349
@@ -432,19 +399,11 @@ int ivpu_bo_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file · 49 unmodified lines
432399
433400 static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p)
434401 {
435− unsigned long dma_refcount = 0;
436−
437402 mutex_lock(&bo->lock);
438403
439− if (bo->base.base.dma_buf && bo->base.base.dma_buf->file)
440− dma_refcount = atomic_long_read(&bo->base.base.dma_buf->file->f_count);
441−
442− drm_printf(p, "%-3u %-6d 0x%-12llx %-10lu 0x%-8x %-4u %-8lu",
443− bo->ctx->id, bo->handle, bo->vpu_addr, bo->base.base.size,
444− bo->flags, kref_read(&bo->base.base.refcount), dma_refcount);
445−
446− if (bo->base.base.import_attach)
447− drm_printf(p, " imported");
404+ drm_printf(p, "%-9p %-3u 0x%-12llx %-10lu 0x%-8x %-4u",
405+ bo, bo->ctx->id, bo->vpu_addr, bo->base.base.size,
406+ bo->flags, kref_read(&bo->base.base.refcount));
448407
449408 if (bo->base.pages)
450409 drm_printf(p, " has_pages");
@@ -452,6 +411,9 @@ static void ivpu_bo_print_info(struct ivpu_bo *bo, struct drm_printer *p) · 1 unmodified line
452411 if (bo->mmu_mapped)
453412 drm_printf(p, " mmu_mapped");
454413
414+ if (bo->base.base.import_attach)
415+ drm_printf(p, " imported");
416+
455417 drm_printf(p, "\n");
456418
457419 mutex_unlock(&bo->lock);
@@ -462,8 +424,8 @@ void ivpu_bo_list(struct drm_device *dev, struct drm_printer *p) · 4 unmodified lines
462424 struct ivpu_device *vdev = to_ivpu_device(dev);
463425 struct ivpu_bo *bo;
464426
465− drm_printf(p, "%-3s %-6s %-14s %-10s %-10s %-4s %-8s %s\n",
466− "ctx", "handle", "vpu_addr", "size", "flags", "refs", "dma_refs", "attribs");
427+ drm_printf(p, "%-9s %-3s %-14s %-10s %-10s %-4s %s\n",
428+ "bo", "ctx", "vpu_addr", "size", "flags", "refs", "attribs");
467429
468430 mutex_lock(&vdev->bo_list_lock);
469431 list_for_each_entry(bo, &vdev->bo_list, bo_list_node)
drivers/accel/ivpu/ivpu_gem.h+1−2
@@ -19,14 +19,13 @@ struct ivpu_bo { · 18 unmodified lines
1919
2020 struct mutex lock; /* Protects: ctx, mmu_mapped, vpu_addr */
2121 u64 vpu_addr;
22− u32 handle;
2322 u32 flags;
2423 u32 job_status; /* Valid only for command buffer */
2524 bool mmu_mapped;
2625 };
2726
2827 int ivpu_bo_pin(struct ivpu_bo *bo);
29−void ivpu_bo_remove_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx);
28+void ivpu_bo_unbind_all_bos_from_context(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx);
3029
3130 struct drm_gem_object *ivpu_gem_create_object(struct drm_device *dev, size_t size);
3231 struct ivpu_bo *ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 flags);
drivers/accel/ivpu/ivpu_hw_37xx.c+4−10
@@ -875,24 +875,18 @@ static void ivpu_hw_37xx_irq_disable(struct ivpu_device *vdev) · 874 unmodified lines
875875
876876 static void ivpu_hw_37xx_irq_wdt_nce_handler(struct ivpu_device *vdev)
877877 {
878− ivpu_err_ratelimited(vdev, "WDT NCE irq\n");
879−
880− ivpu_pm_schedule_recovery(vdev);
878+ ivpu_pm_trigger_recovery(vdev, "WDT NCE IRQ");
881879 }
882880
883881 static void ivpu_hw_37xx_irq_wdt_mss_handler(struct ivpu_device *vdev)
884882 {
885− ivpu_err_ratelimited(vdev, "WDT MSS irq\n");
886−
887883 ivpu_hw_wdt_disable(vdev);
888− ivpu_pm_schedule_recovery(vdev);
884+ ivpu_pm_trigger_recovery(vdev, "WDT MSS IRQ");
889885 }
890886
891887 static void ivpu_hw_37xx_irq_noc_firewall_handler(struct ivpu_device *vdev)
892888 {
893− ivpu_err_ratelimited(vdev, "NOC Firewall irq\n");
894−
895− ivpu_pm_schedule_recovery(vdev);
889+ ivpu_pm_trigger_recovery(vdev, "NOC Firewall IRQ");
896890 }
897891
898892 /* Handler for IRQs from VPU core (irqV) */
@@ -970,7 +964,7 @@ static bool ivpu_hw_37xx_irqb_handler(struct ivpu_device *vdev, int irq) · 71 unmodified lines
970964 REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, status);
971965
972966 if (schedule_recovery)
973− ivpu_pm_schedule_recovery(vdev);
967+ ivpu_pm_trigger_recovery(vdev, "Buttress IRQ");
974968
975969 return true;
976970 }
drivers/accel/ivpu/ivpu_hw_40xx.c+23−6
@@ -746,7 +746,7 @@ static int ivpu_hw_40xx_info_init(struct ivpu_device *vdev) · 745 unmodified lines
746746 return 0;
747747 }
748748
749−static int ivpu_hw_40xx_reset(struct ivpu_device *vdev)
749+static int ivpu_hw_40xx_ip_reset(struct ivpu_device *vdev)
750750 {
751751 int ret;
752752 u32 val;
@@ -768,6 +768,23 @@ static int ivpu_hw_40xx_reset(struct ivpu_device *vdev) · 15 unmodified lines
768768 return ret;
769769 }
770770
771+static int ivpu_hw_40xx_reset(struct ivpu_device *vdev)
772+{
773+ int ret = 0;
774+
775+ if (ivpu_hw_40xx_ip_reset(vdev)) {
776+ ivpu_err(vdev, "Failed to reset VPU IP\n");
777+ ret = -EIO;
778+ }
779+
780+ if (ivpu_pll_disable(vdev)) {
781+ ivpu_err(vdev, "Failed to disable PLL\n");
782+ ret = -EIO;
783+ }
784+
785+ return ret;
786+}
787+
771788 static int ivpu_hw_40xx_d0i3_enable(struct ivpu_device *vdev)
772789 {
773790 int ret;
@@ -913,7 +930,7 @@ static int ivpu_hw_40xx_power_down(struct ivpu_device *vdev) · 139 unmodified lines
913930
914931 ivpu_hw_40xx_save_d0i3_entry_timestamp(vdev);
915932
916− if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_reset(vdev))
933+ if (!ivpu_hw_40xx_is_idle(vdev) && ivpu_hw_40xx_ip_reset(vdev))
917934 ivpu_warn(vdev, "Failed to reset the VPU\n");
918935
919936 if (ivpu_pll_disable(vdev)) {
@@ -1032,18 +1049,18 @@ static void ivpu_hw_40xx_irq_disable(struct ivpu_device *vdev) · 112 unmodified lines
10321049 static void ivpu_hw_40xx_irq_wdt_nce_handler(struct ivpu_device *vdev)
10331050 {
10341051 /* TODO: For LNN hang consider engine reset instead of full recovery */
1035− ivpu_pm_schedule_recovery(vdev);
1052+ ivpu_pm_trigger_recovery(vdev, "WDT NCE IRQ");
10361053 }
10371054
10381055 static void ivpu_hw_40xx_irq_wdt_mss_handler(struct ivpu_device *vdev)
10391056 {
10401057 ivpu_hw_wdt_disable(vdev);
1041− ivpu_pm_schedule_recovery(vdev);
1058+ ivpu_pm_trigger_recovery(vdev, "WDT MSS IRQ");
10421059 }
10431060
10441061 static void ivpu_hw_40xx_irq_noc_firewall_handler(struct ivpu_device *vdev)
10451062 {
1046− ivpu_pm_schedule_recovery(vdev);
1063+ ivpu_pm_trigger_recovery(vdev, "NOC Firewall IRQ");
10471064 }
10481065
10491066 /* Handler for IRQs from VPU core (irqV) */
@@ -1137,7 +1154,7 @@ static bool ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq) · 87 unmodified lines
11371154 REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
11381155
11391156 if (schedule_recovery)
1140− ivpu_pm_schedule_recovery(vdev);
1157+ ivpu_pm_trigger_recovery(vdev, "Buttress IRQ");
11411158
11421159 return true;
11431160 }
drivers/accel/ivpu/ivpu_ipc.c+2−4
@@ -343,10 +343,8 @@ int ivpu_ipc_send_receive_active(struct ivpu_device *vdev, struct vpu_jsm_msg *r · 342 unmodified lines
343343 hb_ret = ivpu_ipc_send_receive_internal(vdev, &hb_req, VPU_JSM_MSG_QUERY_ENGINE_HB_DONE,
344344 &hb_resp, VPU_IPC_CHAN_ASYNC_CMD,
345345 vdev->timeout.jsm);
346− if (hb_ret == -ETIMEDOUT) {
347− ivpu_hw_diagnose_failure(vdev);
348− ivpu_pm_schedule_recovery(vdev);
349− }
346+ if (hb_ret == -ETIMEDOUT)
347+ ivpu_pm_trigger_recovery(vdev, "IPC timeout");
350348
351349 return ret;
352350 }
drivers/accel/ivpu/ivpu_job.c+73−87
@@ -112,22 +112,20 @@ static void ivpu_cmdq_release_locked(struct ivpu_file_priv *file_priv, u16 engin · 111 unmodified lines
112112 }
113113 }
114114
115−void ivpu_cmdq_release_all(struct ivpu_file_priv *file_priv)
115+void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv)
116116 {
117117 int i;
118118
119− mutex_lock(&file_priv->lock);
119+ lockdep_assert_held(&file_priv->lock);
120120
121121 for (i = 0; i < IVPU_NUM_ENGINES; i++)
122122 ivpu_cmdq_release_locked(file_priv, i);
123−
124− mutex_unlock(&file_priv->lock);
125123 }
126124
127125 /*
128126 * Mark the doorbell as unregistered and reset job queue pointers.
129127 * This function needs to be called when the VPU hardware is restarted
130− * and FW looses job queue state. The next time job queue is used it
128+ * and FW loses job queue state. The next time job queue is used it
131129 * will be registered again.
132130 */
133131 static void ivpu_cmdq_reset_locked(struct ivpu_file_priv *file_priv, u16 engine)
@@ -161,15 +159,13 @@ void ivpu_cmdq_reset_all_contexts(struct ivpu_device *vdev) · 27 unmodified lines
161159 struct ivpu_file_priv *file_priv;
162160 unsigned long ctx_id;
163161
164− xa_for_each(&vdev->context_xa, ctx_id, file_priv) {
165− file_priv = ivpu_file_priv_get_by_ctx_id(vdev, ctx_id);
166− if (!file_priv)
167− continue;
162+ mutex_lock(&vdev->context_list_lock);
168163
164+ xa_for_each(&vdev->context_xa, ctx_id, file_priv)
169165 ivpu_cmdq_reset_all(file_priv);
170166
171− ivpu_file_priv_put(&file_priv);
172− }
167+ mutex_unlock(&vdev->context_list_lock);
168+
173169 }
174170
175171 static int ivpu_cmdq_push_job(struct ivpu_cmdq *cmdq, struct ivpu_job *job)
@@ -243,60 +239,32 @@ static struct dma_fence *ivpu_fence_create(struct ivpu_device *vdev) · 67 unmodified lines
243239 return &fence->base;
244240 }
245241
246−static void job_get(struct ivpu_job *job, struct ivpu_job **link)
242+static void ivpu_job_destroy(struct ivpu_job *job)
247243 {
248244 struct ivpu_device *vdev = job->vdev;
249−
250− kref_get(&job->ref);
251− *link = job;
252−
253− ivpu_dbg(vdev, KREF, "Job get: id %u refcount %u\n", job->job_id, kref_read(&job->ref));
254−}
255−
256−static void job_release(struct kref *ref)
257−{
258− struct ivpu_job *job = container_of(ref, struct ivpu_job, ref);
259− struct ivpu_device *vdev = job->vdev;
260245 u32 i;
261246
247+ ivpu_dbg(vdev, JOB, "Job destroyed: id %3u ctx %2d engine %d",
248+ job->job_id, job->file_priv->ctx.id, job->engine_idx);
249+
262250 for (i = 0; i < job->bo_count; i++)
263251 if (job->bos[i])
264252 drm_gem_object_put(&job->bos[i]->base.base);
265253
266254 dma_fence_put(job->done_fence);
267255 ivpu_file_priv_put(&job->file_priv);
268−
269− ivpu_dbg(vdev, KREF, "Job released: id %u\n", job->job_id);
270256 kfree(job);
271−
272− /* Allow the VPU to get suspended, must be called after ivpu_file_priv_put() */
273− ivpu_rpm_put(vdev);
274−}
275−
276−static void job_put(struct ivpu_job *job)
277−{
278− struct ivpu_device *vdev = job->vdev;
279−
280− ivpu_dbg(vdev, KREF, "Job put: id %u refcount %u\n", job->job_id, kref_read(&job->ref));
281− kref_put(&job->ref, job_release);
282257 }
283258
284259 static struct ivpu_job *
285−ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count)
260+ivpu_job_create(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count)
286261 {
287262 struct ivpu_device *vdev = file_priv->vdev;
288263 struct ivpu_job *job;
289− int ret;
290−
291− ret = ivpu_rpm_get(vdev);
292− if (ret < 0)
293− return NULL;
294264
295265 job = kzalloc(struct_size(job, bos, bo_count), GFP_KERNEL);
296266 if (!job)
297− goto err_rpm_put;
298−
299− kref_init(&job->ref);
267+ return NULL;
300268
301269 job->vdev = vdev;
302270 job->engine_idx = engine_idx;
@@ -310,17 +278,14 @@ ivpu_create_job(struct ivpu_file_priv *file_priv, u32 engine_idx, u32 bo_count) · 7 unmodified lines
310278 job->file_priv = ivpu_file_priv_get(file_priv);
311279
312280 ivpu_dbg(vdev, JOB, "Job created: ctx %2d engine %d", file_priv->ctx.id, job->engine_idx);
313−
314281 return job;
315282
316283 err_free_job:
317284 kfree(job);
318−err_rpm_put:
319− ivpu_rpm_put(vdev);
320285 return NULL;
321286 }
322287
323−static int ivpu_job_done(struct ivpu_device *vdev, u32 job_id, u32 job_status)
288+static int ivpu_job_signal_and_destroy(struct ivpu_device *vdev, u32 job_id, u32 job_status)
324289 {
325290 struct ivpu_job *job;
326291
@@ -337,9 +302,10 @@ static int ivpu_job_done(struct ivpu_device *vdev, u32 job_id, u32 job_status) · 10 unmodified lines
337302 ivpu_dbg(vdev, JOB, "Job complete: id %3u ctx %2d engine %d status 0x%x\n",
338303 job->job_id, job->file_priv->ctx.id, job->engine_idx, job_status);
339304
305+ ivpu_job_destroy(job);
340306 ivpu_stop_job_timeout_detection(vdev);
341307
342− job_put(job);
308+ ivpu_rpm_put(vdev);
343309 return 0;
344310 }
345311
@@ -349,10 +315,10 @@ void ivpu_jobs_abort_all(struct ivpu_device *vdev) · 3 unmodified lines
349315 unsigned long id;
350316
351317 xa_for_each(&vdev->submitted_jobs_xa, id, job)
352− ivpu_job_done(vdev, id, VPU_JSM_STATUS_ABORTED);
318+ ivpu_job_signal_and_destroy(vdev, id, VPU_JSM_STATUS_ABORTED);
353319 }
354320
355−static int ivpu_direct_job_submission(struct ivpu_job *job)
321+static int ivpu_job_submit(struct ivpu_job *job)
356322 {
357323 struct ivpu_file_priv *file_priv = job->file_priv;
358324 struct ivpu_device *vdev = job->vdev;
@@ -360,53 +326,65 @@ static int ivpu_direct_job_submission(struct ivpu_job *job) · 1 unmodified line
360326 struct ivpu_cmdq *cmdq;
361327 int ret;
362328
329+ ret = ivpu_rpm_get(vdev);
330+ if (ret < 0)
331+ return ret;
332+
363333 mutex_lock(&file_priv->lock);
364334
365335 cmdq = ivpu_cmdq_acquire(job->file_priv, job->engine_idx);
366336 if (!cmdq) {
367− ivpu_warn(vdev, "Failed get job queue, ctx %d engine %d\n",
368− file_priv->ctx.id, job->engine_idx);
337+ ivpu_warn_ratelimited(vdev, "Failed get job queue, ctx %d engine %d\n",
338+ file_priv->ctx.id, job->engine_idx);
369339 ret = -EINVAL;
370− goto err_unlock;
340+ goto err_unlock_file_priv;
371341 }
372342
373343 job_id_range.min = FIELD_PREP(JOB_ID_CONTEXT_MASK, (file_priv->ctx.id - 1));
374344 job_id_range.max = job_id_range.min | JOB_ID_JOB_MASK;
375345
376− job_get(job, &job);
377− ret = xa_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, job_id_range, GFP_KERNEL);
346+ xa_lock(&vdev->submitted_jobs_xa);
347+ ret = __xa_alloc(&vdev->submitted_jobs_xa, &job->job_id, job, job_id_range, GFP_KERNEL);
378348 if (ret) {
379− ivpu_warn_ratelimited(vdev, "Failed to allocate job id: %d\n", ret);
380− goto err_job_put;
349+ ivpu_dbg(vdev, JOB, "Too many active jobs in ctx %d\n",
350+ file_priv->ctx.id);
351+ ret = -EBUSY;
352+ goto err_unlock_submitted_jobs_xa;
381353 }
382354
383355 ret = ivpu_cmdq_push_job(cmdq, job);
384356 if (ret)
385− goto err_xa_erase;
357+ goto err_erase_xa;
386358
387359 ivpu_start_job_timeout_detection(vdev);
388360
389− ivpu_dbg(vdev, JOB, "Job submitted: id %3u addr 0x%llx ctx %2d engine %d next %d\n",
390− job->job_id, job->cmd_buf_vpu_addr, file_priv->ctx.id,
391− job->engine_idx, cmdq->jobq->header.tail);
392−
393− if (ivpu_test_mode & IVPU_TEST_MODE_NULL_HW) {
394− ivpu_job_done(vdev, job->job_id, VPU_JSM_STATUS_SUCCESS);
361+ if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_HW)) {
395362 cmdq->jobq->header.head = cmdq->jobq->header.tail;
396363 wmb(); /* Flush WC buffer for jobq header */
397364 } else {
398365 ivpu_cmdq_ring_db(vdev, cmdq);
399366 }
400367
368+ ivpu_dbg(vdev, JOB, "Job submitted: id %3u ctx %2d engine %d addr 0x%llx next %d\n",
369+ job->job_id, file_priv->ctx.id, job->engine_idx,
370+ job->cmd_buf_vpu_addr, cmdq->jobq->header.tail);
371+
372+ xa_unlock(&vdev->submitted_jobs_xa);
373+
401374 mutex_unlock(&file_priv->lock);
375+
376+ if (unlikely(ivpu_test_mode & IVPU_TEST_MODE_NULL_HW))
377+ ivpu_job_signal_and_destroy(vdev, job->job_id, VPU_JSM_STATUS_SUCCESS);
378+
402379 return 0;
403380
404−err_xa_erase:
405− xa_erase(&vdev->submitted_jobs_xa, job->job_id);
406−err_job_put:
407− job_put(job);
408−err_unlock:
381+err_erase_xa:
382+ __xa_erase(&vdev->submitted_jobs_xa, job->job_id);
383+err_unlock_submitted_jobs_xa:
384+ xa_unlock(&vdev->submitted_jobs_xa);
385+err_unlock_file_priv:
409386 mutex_unlock(&file_priv->lock);
387+ ivpu_rpm_put(vdev);
410388 return ret;
411389 }
412390
@@ -488,6 +466,9 @@ int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 75 unmodified lines
488466 if (params->engine > DRM_IVPU_ENGINE_COPY)
489467 return -EINVAL;
490468
469+ if (params->priority > DRM_IVPU_JOB_PRIORITY_REALTIME)
470+ return -EINVAL;
471+
491472 if (params->buffer_count == 0 || params->buffer_count > JOB_MAX_BUFFER_COUNT)
492473 return -EINVAL;
493474
@@ -509,44 +490,49 @@ int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file) · 15 unmodified lines
509490 params->buffer_count * sizeof(u32));
510491 if (ret) {
511492 ret = -EFAULT;
512− goto free_handles;
493+ goto err_free_handles;
513494 }
514495
515496 if (!drm_dev_enter(&vdev->drm, &idx)) {
516497 ret = -ENODEV;
517− goto free_handles;
498+ goto err_free_handles;
518499 }
519500
520501 ivpu_dbg(vdev, JOB, "Submit ioctl: ctx %u buf_count %u\n",
521502 file_priv->ctx.id, params->buffer_count);
522503
523− job = ivpu_create_job(file_priv, params->engine, params->buffer_count);
504+ job = ivpu_job_create(file_priv, params->engine, params->buffer_count);
524505 if (!job) {
525506 ivpu_err(vdev, "Failed to create job\n");
526507 ret = -ENOMEM;
527− goto dev_exit;
508+ goto err_exit_dev;
528509 }
529510
530511 ret = ivpu_job_prepare_bos_for_submit(file, job, buf_handles, params->buffer_count,
531512 params->commands_offset);
532513 if (ret) {
533− ivpu_err(vdev, "Failed to prepare job, ret %d\n", ret);
534− goto job_put;
514+ ivpu_err(vdev, "Failed to prepare job: %d\n", ret);
515+ goto err_destroy_job;
535516 }
536517
537− ret = ivpu_direct_job_submission(job);
538− if (ret) {
539− dma_fence_signal(job->done_fence);
540− ivpu_err(vdev, "Failed to submit job to the HW, ret %d\n", ret);
541− }
518+ down_read(&vdev->pm->reset_lock);
519+ ret = ivpu_job_submit(job);
520+ up_read(&vdev->pm->reset_lock);
521+ if (ret)
522+ goto err_signal_fence;
542523
543−job_put:
544− job_put(job);
545−dev_exit:
546524 drm_dev_exit(idx);
547−free_handles:
548525 kfree(buf_handles);
526+ return ret;
549527
528+err_signal_fence:
529+ dma_fence_signal(job->done_fence);
530+err_destroy_job:
531+ ivpu_job_destroy(job);
532+err_exit_dev:
533+ drm_dev_exit(idx);
534+err_free_handles:
535+ kfree(buf_handles);
550536 return ret;
551537 }
552538
@@ -568,7 +554,7 @@ ivpu_job_done_callback(struct ivpu_device *vdev, struct ivpu_ipc_hdr *ipc_hdr, · 15 unmodified lines
568554 }
569555
570556 payload = (struct vpu_ipc_msg_payload_job_done *)&jsm_msg->payload;
571− ret = ivpu_job_done(vdev, payload->job_id, payload->job_status);
557+ ret = ivpu_job_signal_and_destroy(vdev, payload->job_id, payload->job_status);
572558 if (!ret && !xa_empty(&vdev->submitted_jobs_xa))
573559 ivpu_start_job_timeout_detection(vdev);
574560 }
drivers/accel/ivpu/ivpu_job.h+1−2
@@ -43,7 +43,6 @@ struct ivpu_cmdq { · 42 unmodified lines
4343 will update the job status
4444 */
4545 struct ivpu_job {
46− struct kref ref;
4746 struct ivpu_device *vdev;
4847 struct ivpu_file_priv *file_priv;
4948 struct dma_fence *done_fence;
@@ -56,7 +55,7 @@ struct ivpu_job { · 6 unmodified lines
5655
5756 int ivpu_submit_ioctl(struct drm_device *dev, void *data, struct drm_file *file);
5857
59−void ivpu_cmdq_release_all(struct ivpu_file_priv *file_priv);
58+void ivpu_cmdq_release_all_locked(struct ivpu_file_priv *file_priv);
6059 void ivpu_cmdq_reset_all_contexts(struct ivpu_device *vdev);
6160
6261 void ivpu_job_done_consumer_init(struct ivpu_device *vdev);
drivers/accel/ivpu/ivpu_mmu.c+15−7
@@ -7,6 +7,7 @@ · 6 unmodified lines
77 #include <linux/highmem.h>
88
99 #include "ivpu_drv.h"
10+#include "ivpu_hw.h"
1011 #include "ivpu_hw_reg_io.h"
1112 #include "ivpu_mmu.h"
1213 #include "ivpu_mmu_context.h"
@@ -518,6 +519,7 @@ static int ivpu_mmu_cmdq_sync(struct ivpu_device *vdev) · 505 unmodified lines
518519
519520 ivpu_err(vdev, "Timed out waiting for MMU consumer: %d, error: %s\n", ret,
520521 ivpu_mmu_cmdq_err_to_str(err));
522+ ivpu_hw_diagnose_failure(vdev);
521523 }
522524
523525 return ret;
@@ -885,7 +887,6 @@ static u32 *ivpu_mmu_get_event(struct ivpu_device *vdev) · 361 unmodified lines
885887
886888 void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev)
887889 {
888− bool schedule_recovery = false;
889890 u32 *event;
890891 u32 ssid;
891892
@@ -895,14 +896,21 @@ void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev) · 3 unmodified lines
895896 ivpu_mmu_dump_event(vdev, event);
896897
897898 ssid = FIELD_GET(IVPU_MMU_EVT_SSID_MASK, event[0]);
898− if (ssid == IVPU_GLOBAL_CONTEXT_MMU_SSID)
899− schedule_recovery = true;
900− else
901− ivpu_mmu_user_context_mark_invalid(vdev, ssid);
899+ if (ssid == IVPU_GLOBAL_CONTEXT_MMU_SSID) {
900+ ivpu_pm_trigger_recovery(vdev, "MMU event");
901+ return;
902+ }
903+
904+ ivpu_mmu_user_context_mark_invalid(vdev, ssid);
902905 }
906+}
903907
904− if (schedule_recovery)
905− ivpu_pm_schedule_recovery(vdev);
908+void ivpu_mmu_evtq_dump(struct ivpu_device *vdev)
909+{
910+ u32 *event;
911+
912+ while ((event = ivpu_mmu_get_event(vdev)) != NULL)
913+ ivpu_mmu_dump_event(vdev, event);
906914 }
907915
908916 void ivpu_mmu_irq_gerr_handler(struct ivpu_device *vdev)
drivers/accel/ivpu/ivpu_mmu.h+1−0
@@ -46,5 +46,6 @@ int ivpu_mmu_invalidate_tlb(struct ivpu_device *vdev, u16 ssid); · 45 unmodified lines
4646
4747 void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev);
4848 void ivpu_mmu_irq_gerr_handler(struct ivpu_device *vdev);
49+void ivpu_mmu_evtq_dump(struct ivpu_device *vdev);
4950
5051 #endif /* __IVPU_MMU_H__ */
drivers/accel/ivpu/ivpu_mmu_context.c+9−0
@@ -355,6 +355,9 @@ ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx, · 354 unmodified lines
355355 dma_addr_t dma_addr = sg_dma_address(sg) - sg->offset;
356356 size_t size = sg_dma_len(sg) + sg->offset;
357357
358+ ivpu_dbg(vdev, MMU_MAP, "Map ctx: %u dma_addr: 0x%llx vpu_addr: 0x%llx size: %lu\n",
359+ ctx->id, dma_addr, vpu_addr, size);
360+
358361 ret = ivpu_mmu_context_map_pages(vdev, ctx, vpu_addr, dma_addr, size, prot);
359362 if (ret) {
360363 ivpu_err(vdev, "Failed to map context pages\n");
@@ -366,6 +369,7 @@ ivpu_mmu_context_map_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ctx, · 5 unmodified lines
366369
367370 /* Ensure page table modifications are flushed from wc buffers to memory */
368371 wmb();
372+
369373 mutex_unlock(&ctx->lock);
370374
371375 ret = ivpu_mmu_invalidate_tlb(vdev, ctx->id);
@@ -388,14 +392,19 @@ ivpu_mmu_context_unmap_sgt(struct ivpu_device *vdev, struct ivpu_mmu_context *ct · 16 unmodified lines
388392 mutex_lock(&ctx->lock);
389393
390394 for_each_sgtable_dma_sg(sgt, sg, i) {
395+ dma_addr_t dma_addr = sg_dma_address(sg) - sg->offset;
391396 size_t size = sg_dma_len(sg) + sg->offset;
392397
398+ ivpu_dbg(vdev, MMU_MAP, "Unmap ctx: %u dma_addr: 0x%llx vpu_addr: 0x%llx size: %lu\n",
399+ ctx->id, dma_addr, vpu_addr, size);
400+
393401 ivpu_mmu_context_unmap_pages(ctx, vpu_addr, size);
394402 vpu_addr += size;
395403 }
396404
397405 /* Ensure page table modifications are flushed from wc buffers to memory */
398406 wmb();
407+
399408 mutex_unlock(&ctx->lock);
400409
401410 ret = ivpu_mmu_invalidate_tlb(vdev, ctx->id);
drivers/accel/ivpu/ivpu_pm.c+35−17
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include "ivpu_drv.h"
1414 #include "ivpu_hw.h"
1515 #include "ivpu_fw.h"
16+#include "ivpu_fw_log.h"
1617 #include "ivpu_ipc.h"
1718 #include "ivpu_job.h"
1819 #include "ivpu_jsm_msg.h"
@@ -111,6 +112,14 @@ static void ivpu_pm_recovery_work(struct work_struct *work) · 92 unmodified lines
111112 char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
112113 int ret;
113114
115+ ivpu_err(vdev, "Recovering the VPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter));
116+
117+ ret = pm_runtime_resume_and_get(vdev->drm.dev);
118+ if (ret)
119+ ivpu_err(vdev, "Failed to resume VPU: %d\n", ret);
120+
121+ ivpu_fw_log_dump(vdev);
122+
114123 retry:
115124 ret = pci_try_reset_function(to_pci_dev(vdev->drm.dev));
116125 if (ret == -EAGAIN && !drm_dev_is_unplugged(&vdev->drm)) {
@@ -122,11 +131,13 @@ retry: · 5 unmodified lines
122131 ivpu_err(vdev, "Failed to reset VPU: %d\n", ret);
123132
124133 kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt);
134+ pm_runtime_mark_last_busy(vdev->drm.dev);
135+ pm_runtime_put_autosuspend(vdev->drm.dev);
125136 }
126137
127−void ivpu_pm_schedule_recovery(struct ivpu_device *vdev)
138+void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason)
128139 {
129− struct ivpu_pm_info *pm = vdev->pm;
140+ ivpu_err(vdev, "Recovery triggered by %s\n", reason);
130141
131142 if (ivpu_disable_recovery) {
132143 ivpu_err(vdev, "Recovery not available when disable_recovery param is set\n");
@@ -138,10 +149,11 @@ void ivpu_pm_schedule_recovery(struct ivpu_device *vdev) · 5 unmodified lines
138149 return;
139150 }
140151
141− /* Schedule recovery if it's not in progress */
142− if (atomic_cmpxchg(&pm->in_reset, 0, 1) == 0) {
143− ivpu_hw_irq_disable(vdev);
144− queue_work(system_long_wq, &pm->recovery_work);
152+ /* Trigger recovery if it's not in progress */
153+ if (atomic_cmpxchg(&vdev->pm->reset_pending, 0, 1) == 0) {
154+ ivpu_hw_diagnose_failure(vdev);
155+ ivpu_hw_irq_disable(vdev); /* Disable IRQ early to protect from IRQ storm */
156+ queue_work(system_long_wq, &vdev->pm->recovery_work);
145157 }
146158 }
147159
@@ -149,12 +161,8 @@ static void ivpu_job_timeout_work(struct work_struct *work) · 1 unmodified line
149161 {
150162 struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, job_timeout_work.work);
151163 struct ivpu_device *vdev = pm->vdev;
152− unsigned long timeout_ms = ivpu_tdr_timeout_ms ? ivpu_tdr_timeout_ms : vdev->timeout.tdr;
153164
154− ivpu_err(vdev, "TDR detected, timeout %lu ms", timeout_ms);
155− ivpu_hw_diagnose_failure(vdev);
156−
157− ivpu_pm_schedule_recovery(vdev);
165+ ivpu_pm_trigger_recovery(vdev, "TDR");
158166 }
159167
160168 void ivpu_start_job_timeout_detection(struct ivpu_device *vdev)
@@ -227,6 +235,9 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev) · 66 unmodified lines
227235 bool hw_is_idle = true;
228236 int ret;
229237
238+ drm_WARN_ON(&vdev->drm, !xa_empty(&vdev->submitted_jobs_xa));
239+ drm_WARN_ON(&vdev->drm, work_pending(&vdev->pm->recovery_work));
240+
230241 ivpu_dbg(vdev, PM, "Runtime suspend..\n");
231242
232243 if (!ivpu_hw_is_idle(vdev) && vdev->pm->suspend_reschedule_counter) {
@@ -247,7 +258,8 @@ int ivpu_pm_runtime_suspend_cb(struct device *dev) · 14 unmodified lines
247258 ivpu_err(vdev, "Failed to set suspend VPU: %d\n", ret);
248259
249260 if (!hw_is_idle) {
250− ivpu_warn(vdev, "VPU failed to enter idle, force suspended.\n");
261+ ivpu_err(vdev, "VPU failed to enter idle, force suspended.\n");
262+ ivpu_fw_log_dump(vdev);
251263 ivpu_pm_prepare_cold_boot(vdev);
252264 } else {
253265 ivpu_pm_prepare_warm_boot(vdev);
@@ -308,11 +320,12 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev) · 54 unmodified lines
308320 {
309321 struct ivpu_device *vdev = pci_get_drvdata(pdev);
310322
311− pm_runtime_get_sync(vdev->drm.dev);
312−
313323 ivpu_dbg(vdev, PM, "Pre-reset..\n");
314324 atomic_inc(&vdev->pm->reset_counter);
315− atomic_set(&vdev->pm->in_reset, 1);
325+ atomic_set(&vdev->pm->reset_pending, 1);
326+
327+ pm_runtime_get_sync(vdev->drm.dev);
328+ down_write(&vdev->pm->reset_lock);
316329 ivpu_prepare_for_reset(vdev);
317330 ivpu_hw_reset(vdev);
318331 ivpu_pm_prepare_cold_boot(vdev);
@@ -329,9 +342,11 @@ void ivpu_pm_reset_done_cb(struct pci_dev *pdev) · 10 unmodified lines
329342 ret = ivpu_resume(vdev);
330343 if (ret)
331344 ivpu_err(vdev, "Failed to set RESUME state: %d\n", ret);
332− atomic_set(&vdev->pm->in_reset, 0);
345+ up_write(&vdev->pm->reset_lock);
346+ atomic_set(&vdev->pm->reset_pending, 0);
333347 ivpu_dbg(vdev, PM, "Post-reset done.\n");
334348
349+ pm_runtime_mark_last_busy(vdev->drm.dev);
335350 pm_runtime_put_autosuspend(vdev->drm.dev);
336351 }
337352
@@ -344,7 +359,10 @@ void ivpu_pm_init(struct ivpu_device *vdev) · 6 unmodified lines
344359 pm->vdev = vdev;
345360 pm->suspend_reschedule_counter = PM_RESCHEDULE_LIMIT;
346361
347− atomic_set(&pm->in_reset, 0);
362+ init_rwsem(&pm->reset_lock);
363+ atomic_set(&pm->reset_pending, 0);
364+ atomic_set(&pm->reset_counter, 0);
365+
348366 INIT_WORK(&pm->recovery_work, ivpu_pm_recovery_work);
349367 INIT_DELAYED_WORK(&pm->job_timeout_work, ivpu_job_timeout_work);
350368
drivers/accel/ivpu/ivpu_pm.h+4−2
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #ifndef __IVPU_PM_H__
77 #define __IVPU_PM_H__
88
9+#include <linux/rwsem.h>
910 #include <linux/types.h>
1011
1112 struct ivpu_device;
@@ -14,8 +15,9 @@ struct ivpu_pm_info { · 2 unmodified lines
1415 struct ivpu_device *vdev;
1516 struct delayed_work job_timeout_work;
1617 struct work_struct recovery_work;
17− atomic_t in_reset;
18+ struct rw_semaphore reset_lock;
1819 atomic_t reset_counter;
20+ atomic_t reset_pending;
1921 bool is_warmboot;
2022 u32 suspend_reschedule_counter;
2123 };
@@ -37,7 +39,7 @@ int __must_check ivpu_rpm_get(struct ivpu_device *vdev); · 15 unmodified lines
3739 int __must_check ivpu_rpm_get_if_active(struct ivpu_device *vdev);
3840 void ivpu_rpm_put(struct ivpu_device *vdev);
3941
40−void ivpu_pm_schedule_recovery(struct ivpu_device *vdev);
42+void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason);
4143 void ivpu_start_job_timeout_detection(struct ivpu_device *vdev);
4244 void ivpu_stop_job_timeout_detection(struct ivpu_device *vdev);
4345
drivers/ata/ahci.c+28−6
@@ -48,6 +48,7 @@ enum { · 47 unmodified lines
4848 enum board_ids {
4949 /* board IDs by feature in alphabetical order */
5050 board_ahci,
51+ board_ahci_43bit_dma,
5152 board_ahci_ign_iferr,
5253 board_ahci_low_power,
5354 board_ahci_no_debounce_delay,
@@ -128,6 +129,13 @@ static const struct ata_port_info ahci_port_info[] = { · 74 unmodified lines
128129 .udma_mask = ATA_UDMA6,
129130 .port_ops = &ahci_ops,
130131 },
132+ [board_ahci_43bit_dma] = {
133+ AHCI_HFLAGS (AHCI_HFLAG_43BIT_ONLY),
134+ .flags = AHCI_FLAG_COMMON,
135+ .pio_mask = ATA_PIO4,
136+ .udma_mask = ATA_UDMA6,
137+ .port_ops = &ahci_ops,
138+ },
131139 [board_ahci_ign_iferr] = {
132140 AHCI_HFLAGS (AHCI_HFLAG_IGN_IRQ_IF_ERR),
133141 .flags = AHCI_FLAG_COMMON,
@@ -597,11 +605,11 @@ static const struct pci_device_id ahci_pci_tbl[] = { · 463 unmodified lines
597605 { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
598606 { PCI_VDEVICE(PROMISE, 0x3781), board_ahci }, /* FastTrak TX8660 ahci-mode */
599607
600− /* Asmedia */
608+ /* ASMedia */
601609 { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */
602610 { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */
603− { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */
604− { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */
611+ { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci_43bit_dma }, /* ASM1061 */
612+ { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci_43bit_dma }, /* ASM1061/1062 */
605613 { PCI_VDEVICE(ASMEDIA, 0x0621), board_ahci }, /* ASM1061R */
606614 { PCI_VDEVICE(ASMEDIA, 0x0622), board_ahci }, /* ASM1062R */
607615 { PCI_VDEVICE(ASMEDIA, 0x0624), board_ahci }, /* ASM1062+JMB575 */
@@ -663,6 +671,11 @@ MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets"); · 55 unmodified lines
663671 static void ahci_pci_save_initial_config(struct pci_dev *pdev,
664672 struct ahci_host_priv *hpriv)
665673 {
674+ if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && pdev->device == 0x1166) {
675+ dev_info(&pdev->dev, "ASM1166 has only six ports\n");
676+ hpriv->saved_port_map = 0x3f;
677+ }
678+
666679 if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) {
667680 dev_info(&pdev->dev, "JMB361 has only one port\n");
668681 hpriv->saved_port_map = 1;
@@ -949,11 +962,20 @@ static int ahci_pci_device_resume(struct device *dev) · 280 unmodified lines
949962
950963 #endif /* CONFIG_PM */
951964
952−static int ahci_configure_dma_masks(struct pci_dev *pdev, int using_dac)
965+static int ahci_configure_dma_masks(struct pci_dev *pdev,
966+ struct ahci_host_priv *hpriv)
953967 {
954− const int dma_bits = using_dac ? 64 : 32;
968+ int dma_bits;
955969 int rc;
956970
971+ if (hpriv->cap & HOST_CAP_64) {
972+ dma_bits = 64;
973+ if (hpriv->flags & AHCI_HFLAG_43BIT_ONLY)
974+ dma_bits = 43;
975+ } else {
976+ dma_bits = 32;
977+ }
978+
957979 /*
958980 * If the device fixup already set the dma_mask to some non-standard
959981 * value, don't extend it here. This happens on STA2X11, for example.
@@ -1926,7 +1948,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 966 unmodified lines
19261948 ahci_gtf_filter_workaround(host);
19271949
19281950 /* initialize adapter */
1929− rc = ahci_configure_dma_masks(pdev, hpriv->cap & HOST_CAP_64);
1951+ rc = ahci_configure_dma_masks(pdev, hpriv);
19301952 if (rc)
19311953 return rc;
19321954
drivers/ata/ahci.h+1−0
@@ -247,6 +247,7 @@ enum { · 246 unmodified lines
247247 AHCI_HFLAG_SUSPEND_PHYS = BIT(26), /* handle PHYs during
248248 suspend/resume */
249249 AHCI_HFLAG_NO_SXS = BIT(28), /* SXS not supported */
250+ AHCI_HFLAG_43BIT_ONLY = BIT(29), /* 43bit DMA addr limit */
250251
251252 /* ap->flags bits */
252253
drivers/ata/libata-sata.c+1−1
@@ -784,7 +784,7 @@ bool sata_lpm_ignore_phy_events(struct ata_link *link) · 783 unmodified lines
784784 EXPORT_SYMBOL_GPL(sata_lpm_ignore_phy_events);
785785
786786 static const char *ata_lpm_policy_names[] = {
787− [ATA_LPM_UNKNOWN] = "max_performance",
787+ [ATA_LPM_UNKNOWN] = "keep_firmware_settings",
788788 [ATA_LPM_MAX_POWER] = "max_performance",
789789 [ATA_LPM_MED_POWER] = "medium_power",
790790 [ATA_LPM_MED_POWER_WITH_DIPM] = "med_power_with_dipm",
drivers/block/aoe/aoeblk.c+4−1
@@ -333,6 +333,7 @@ aoeblk_gdalloc(void *vp) · 332 unmodified lines
333333 struct gendisk *gd;
334334 mempool_t *mp;
335335 struct blk_mq_tag_set *set;
336+ sector_t ssize;
336337 ulong flags;
337338 int late = 0;
338339 int err;
@@ -396,7 +397,7 @@ aoeblk_gdalloc(void *vp) · 57 unmodified lines
396397 gd->minors = AOE_PARTITIONS;
397398 gd->fops = &aoe_bdops;
398399 gd->private_data = d;
399− set_capacity(gd, d->ssize);
400+ ssize = d->ssize;
400401 snprintf(gd->disk_name, sizeof gd->disk_name, "etherd/e%ld.%d",
401402 d->aoemajor, d->aoeminor);
402403
@@ -405,6 +406,8 @@ aoeblk_gdalloc(void *vp) · 2 unmodified lines
405406
406407 spin_unlock_irqrestore(&d->lock, flags);
407408
409+ set_capacity(gd, ssize);
410+
408411 err = device_add_disk(NULL, gd, aoe_attr_groups);
409412 if (err)
410413 goto out_disk_cleanup;
drivers/cpufreq/amd-pstate.c+3−4
@@ -1232,14 +1232,13 @@ static void amd_pstate_epp_update_limit(struct cpufreq_policy *policy) · 1231 unmodified lines
12321232 max_limit_perf = div_u64(policy->max * cpudata->highest_perf, cpudata->max_freq);
12331233 min_limit_perf = div_u64(policy->min * cpudata->highest_perf, cpudata->max_freq);
12341234
1235+ WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
1236+ WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
1237+
12351238 max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,
12361239 cpudata->max_limit_perf);
12371240 min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf,
12381241 cpudata->max_limit_perf);
1239−
1240− WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
1241− WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
1242−
12431242 value = READ_ONCE(cpudata->cppc_req_cached);
12441243
12451244 if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
drivers/cpufreq/intel_pstate.c+34−21
@@ -529,6 +529,30 @@ static int intel_pstate_cppc_get_scaling(int cpu) · 528 unmodified lines
529529 }
530530 #endif /* CONFIG_ACPI_CPPC_LIB */
531531
532+static int intel_pstate_freq_to_hwp_rel(struct cpudata *cpu, int freq,
533+ unsigned int relation)
534+{
535+ if (freq == cpu->pstate.turbo_freq)
536+ return cpu->pstate.turbo_pstate;
537+
538+ if (freq == cpu->pstate.max_freq)
539+ return cpu->pstate.max_pstate;
540+
541+ switch (relation) {
542+ case CPUFREQ_RELATION_H:
543+ return freq / cpu->pstate.scaling;
544+ case CPUFREQ_RELATION_C:
545+ return DIV_ROUND_CLOSEST(freq, cpu->pstate.scaling);
546+ }
547+
548+ return DIV_ROUND_UP(freq, cpu->pstate.scaling);
549+}
550+
551+static int intel_pstate_freq_to_hwp(struct cpudata *cpu, int freq)
552+{
553+ return intel_pstate_freq_to_hwp_rel(cpu, freq, CPUFREQ_RELATION_L);
554+}
555+
532556 /**
533557 * intel_pstate_hybrid_hwp_adjust - Calibrate HWP performance levels.
534558 * @cpu: Target CPU.
@@ -546,6 +570,7 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu) · 11 unmodified lines
546570 int perf_ctl_scaling = cpu->pstate.perf_ctl_scaling;
547571 int perf_ctl_turbo = pstate_funcs.get_turbo(cpu->cpu);
548572 int scaling = cpu->pstate.scaling;
573+ int freq;
549574
550575 pr_debug("CPU%d: perf_ctl_max_phys = %d\n", cpu->cpu, perf_ctl_max_phys);
551576 pr_debug("CPU%d: perf_ctl_turbo = %d\n", cpu->cpu, perf_ctl_turbo);
@@ -559,16 +584,16 @@ static void intel_pstate_hybrid_hwp_adjust(struct cpudata *cpu) · 7 unmodified lines
559584 cpu->pstate.max_freq = rounddown(cpu->pstate.max_pstate * scaling,
560585 perf_ctl_scaling);
561586
562− cpu->pstate.max_pstate_physical =
563− DIV_ROUND_UP(perf_ctl_max_phys * perf_ctl_scaling,
564− scaling);
587+ freq = perf_ctl_max_phys * perf_ctl_scaling;
588+ cpu->pstate.max_pstate_physical = intel_pstate_freq_to_hwp(cpu, freq);
565589
566− cpu->pstate.min_freq = cpu->pstate.min_pstate * perf_ctl_scaling;
590+ freq = cpu->pstate.min_pstate * perf_ctl_scaling;
591+ cpu->pstate.min_freq = freq;
567592 /*
568593 * Cast the min P-state value retrieved via pstate_funcs.get_min() to
569594 * the effective range of HWP performance levels.
570595 */
571− cpu->pstate.min_pstate = DIV_ROUND_UP(cpu->pstate.min_freq, scaling);
596+ cpu->pstate.min_pstate = intel_pstate_freq_to_hwp(cpu, freq);
572597 }
573598
574599 static inline void update_turbo_state(void)
@@ -2528,13 +2553,12 @@ static void intel_pstate_update_perf_limits(struct cpudata *cpu, · 1953 unmodified lines
25282553 * abstract values to represent performance rather than pure ratios.
25292554 */
25302555 if (hwp_active && cpu->pstate.scaling != perf_ctl_scaling) {
2531− int scaling = cpu->pstate.scaling;
25322556 int freq;
25332557
25342558 freq = max_policy_perf * perf_ctl_scaling;
2535− max_policy_perf = DIV_ROUND_UP(freq, scaling);
2559+ max_policy_perf = intel_pstate_freq_to_hwp(cpu, freq);
25362560 freq = min_policy_perf * perf_ctl_scaling;
2537− min_policy_perf = DIV_ROUND_UP(freq, scaling);
2561+ min_policy_perf = intel_pstate_freq_to_hwp(cpu, freq);
25382562 }
25392563
25402564 pr_debug("cpu:%d min_policy_perf:%d max_policy_perf:%d\n",
@@ -2908,18 +2932,7 @@ static int intel_cpufreq_target(struct cpufreq_policy *policy, · 367 unmodified lines
29082932
29092933 cpufreq_freq_transition_begin(policy, &freqs);
29102934
2911− switch (relation) {
2912− case CPUFREQ_RELATION_L:
2913− target_pstate = DIV_ROUND_UP(freqs.new, cpu->pstate.scaling);
2914− break;
2915− case CPUFREQ_RELATION_H:
2916− target_pstate = freqs.new / cpu->pstate.scaling;
2917− break;
2918− default:
2919− target_pstate = DIV_ROUND_CLOSEST(freqs.new, cpu->pstate.scaling);
2920− break;
2921− }
2922−
2935+ target_pstate = intel_pstate_freq_to_hwp_rel(cpu, freqs.new, relation);
29232936 target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, false);
29242937
29252938 freqs.new = target_pstate * cpu->pstate.scaling;
@@ -2937,7 +2950,7 @@ static unsigned int intel_cpufreq_fast_switch(struct cpufreq_policy *policy, · 11 unmodified lines
29372950
29382951 update_turbo_state();
29392952
2940− target_pstate = DIV_ROUND_UP(target_freq, cpu->pstate.scaling);
2953+ target_pstate = intel_pstate_freq_to_hwp(cpu, target_freq);
29412954
29422955 target_pstate = intel_cpufreq_update_pstate(policy, target_pstate, true);
29432956
drivers/crypto/caam/caamalg_qi2.c+5−2
@@ -4545,6 +4545,7 @@ struct caam_hash_alg { · 4544 unmodified lines
45454545 struct list_head entry;
45464546 struct device *dev;
45474547 int alg_type;
4548+ bool is_hmac;
45484549 struct ahash_alg ahash_alg;
45494550 };
45504551
@@ -4571,7 +4572,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) · 20 unmodified lines
45714572
45724573 ctx->dev = caam_hash->dev;
45734574
4574− if (alg->setkey) {
4575+ if (caam_hash->is_hmac) {
45754576 ctx->adata.key_dma = dma_map_single_attrs(ctx->dev, ctx->key,
45764577 ARRAY_SIZE(ctx->key),
45774578 DMA_TO_DEVICE,
@@ -4611,7 +4612,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) · 33 unmodified lines
46114612 * For keyed hash algorithms shared descriptors
46124613 * will be created later in setkey() callback
46134614 */
4614− return alg->setkey ? 0 : ahash_set_sh_desc(ahash);
4615+ return caam_hash->is_hmac ? 0 : ahash_set_sh_desc(ahash);
46154616 }
46164617
46174618 static void caam_hash_cra_exit(struct crypto_tfm *tfm)
@@ -4646,12 +4647,14 @@ static struct caam_hash_alg *caam_hash_alloc(struct device *dev, · 28 unmodified lines
46464647 template->hmac_name);
46474648 snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
46484649 template->hmac_driver_name);
4650+ t_alg->is_hmac = true;
46494651 } else {
46504652 snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s",
46514653 template->name);
46524654 snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
46534655 template->driver_name);
46544656 t_alg->ahash_alg.setkey = NULL;
4657+ t_alg->is_hmac = false;
46554658 }
46564659 alg->cra_module = THIS_MODULE;
46574660 alg->cra_init = caam_hash_cra_init;
drivers/crypto/caam/caamhash.c+5−2
@@ -1753,6 +1753,7 @@ static struct caam_hash_template driver_hash[] = { · 1752 unmodified lines
17531753 struct caam_hash_alg {
17541754 struct list_head entry;
17551755 int alg_type;
1756+ bool is_hmac;
17561757 struct ahash_engine_alg ahash_alg;
17571758 };
17581759
@@ -1804,7 +1805,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) · 45 unmodified lines
18041805 } else {
18051806 if (priv->era >= 6) {
18061807 ctx->dir = DMA_BIDIRECTIONAL;
1807− ctx->key_dir = alg->setkey ? DMA_TO_DEVICE : DMA_NONE;
1808+ ctx->key_dir = caam_hash->is_hmac ? DMA_TO_DEVICE : DMA_NONE;
18081809 } else {
18091810 ctx->dir = DMA_TO_DEVICE;
18101811 ctx->key_dir = DMA_NONE;
@@ -1862,7 +1863,7 @@ static int caam_hash_cra_init(struct crypto_tfm *tfm) · 51 unmodified lines
18621863 * For keyed hash algorithms shared descriptors
18631864 * will be created later in setkey() callback
18641865 */
1865− return alg->setkey ? 0 : ahash_set_sh_desc(ahash);
1866+ return caam_hash->is_hmac ? 0 : ahash_set_sh_desc(ahash);
18661867 }
18671868
18681869 static void caam_hash_cra_exit(struct crypto_tfm *tfm)
@@ -1915,12 +1916,14 @@ caam_hash_alloc(struct caam_hash_template *template, · 46 unmodified lines
19151916 template->hmac_name);
19161917 snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
19171918 template->hmac_driver_name);
1919+ t_alg->is_hmac = true;
19181920 } else {
19191921 snprintf(alg->cra_name, CRYPTO_MAX_ALG_NAME, "%s",
19201922 template->name);
19211923 snprintf(alg->cra_driver_name, CRYPTO_MAX_ALG_NAME, "%s",
19221924 template->driver_name);
19231925 halg->setkey = NULL;
1926+ t_alg->is_hmac = false;
19241927 }
19251928 alg->cra_module = THIS_MODULE;
19261929 alg->cra_init = caam_hash_cra_init;
drivers/crypto/intel/qat/qat_4xxx/adf_4xxx_hw_data.c+1−0
@@ -463,6 +463,7 @@ void adf_init_hw_data_4xxx(struct adf_hw_device_data *hw_data, u32 dev_id) · 462 unmodified lines
463463 hw_data->fw_name = ADF_402XX_FW;
464464 hw_data->fw_mmp_name = ADF_402XX_MMP;
465465 hw_data->uof_get_name = uof_get_name_402xx;
466+ hw_data->get_ena_thd_mask = get_ena_thd_mask;
466467 break;
467468 case ADF_401XX_PCI_DEVICE_ID:
468469 hw_data->fw_name = ADF_4XXX_FW;
drivers/cxl/core/region.c+2−2
@@ -525,7 +525,7 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size) · 524 unmodified lines
525525 struct cxl_root_decoder *cxlrd = to_cxl_root_decoder(cxlr->dev.parent);
526526 struct cxl_region_params *p = &cxlr->params;
527527 struct resource *res;
528− u32 remainder = 0;
528+ u64 remainder = 0;
529529
530530 lockdep_assert_held_write(&cxl_region_rwsem);
531531
@@ -545,7 +545,7 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size) · 13 unmodified lines
545545 (cxlr->mode == CXL_DECODER_PMEM && uuid_is_null(&p->uuid)))
546546 return -ENXIO;
547547
548− div_u64_rem(size, SZ_256M * p->interleave_ways, &remainder);
548+ div64_u64_rem(size, (u64)SZ_256M * p->interleave_ways, &remainder);
549549 if (remainder)
550550 return -EINVAL;
551551
drivers/cxl/pci.c+15−11
@@ -382,7 +382,7 @@ static int cxl_pci_mbox_send(struct cxl_memdev_state *mds, · 381 unmodified lines
382382 return rc;
383383 }
384384
385−static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds)
385+static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds, bool irq_avail)
386386 {
387387 struct cxl_dev_state *cxlds = &mds->cxlds;
388388 const int cap = readl(cxlds->regs.mbox + CXLDEV_MBOX_CAPS_OFFSET);
@@ -441,7 +441,7 @@ static int cxl_pci_setup_mailbox(struct cxl_memdev_state *mds) · 52 unmodified lines
441441 INIT_DELAYED_WORK(&mds->security.poll_dwork, cxl_mbox_sanitize_work);
442442
443443 /* background command interrupts are optional */
444− if (!(cap & CXLDEV_MBOX_CAP_BG_CMD_IRQ))
444+ if (!(cap & CXLDEV_MBOX_CAP_BG_CMD_IRQ) || !irq_avail)
445445 return 0;
446446
447447 msgnum = FIELD_GET(CXLDEV_MBOX_CAP_IRQ_MSGNUM_MASK, cap);
@@ -588,7 +588,7 @@ static int cxl_mem_alloc_event_buf(struct cxl_memdev_state *mds) · 140 unmodified lines
588588 return devm_add_action_or_reset(mds->cxlds.dev, free_event_buf, buf);
589589 }
590590
591−static int cxl_alloc_irq_vectors(struct pci_dev *pdev)
591+static bool cxl_alloc_irq_vectors(struct pci_dev *pdev)
592592 {
593593 int nvecs;
594594
@@ -605,9 +605,9 @@ static int cxl_alloc_irq_vectors(struct pci_dev *pdev) · 10 unmodified lines
605605 PCI_IRQ_MSIX | PCI_IRQ_MSI);
606606 if (nvecs < 1) {
607607 dev_dbg(&pdev->dev, "Failed to alloc irq vectors: %d\n", nvecs);
608− return -ENXIO;
608+ return false;
609609 }
610− return 0;
610+ return true;
611611 }
612612
613613 static irqreturn_t cxl_event_thread(int irq, void *id)
@@ -743,7 +743,7 @@ static bool cxl_event_int_is_fw(u8 setting) · 129 unmodified lines
743743 }
744744
745745 static int cxl_event_config(struct pci_host_bridge *host_bridge,
746− struct cxl_memdev_state *mds)
746+ struct cxl_memdev_state *mds, bool irq_avail)
747747 {
748748 struct cxl_event_interrupt_policy policy;
749749 int rc;
@@ -755,6 +755,11 @@ static int cxl_event_config(struct pci_host_bridge *host_bridge, · 5 unmodified lines
755755 if (!host_bridge->native_cxl_error)
756756 return 0;
757757
758+ if (!irq_avail) {
759+ dev_info(mds->cxlds.dev, "No interrupt support, disable event processing.\n");
760+ return 0;
761+ }
762+
758763 rc = cxl_mem_alloc_event_buf(mds);
759764 if (rc)
760765 return rc;
@@ -789,6 +794,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 28 unmodified lines
789794 struct cxl_register_map map;
790795 struct cxl_memdev *cxlmd;
791796 int i, rc, pmu_count;
797+ bool irq_avail;
792798
793799 /*
794800 * Double check the anonymous union trickery in struct cxl_regs
@@ -846,11 +852,9 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 51 unmodified lines
846852 else
847853 dev_warn(&pdev->dev, "Media not active (%d)\n", rc);
848854
849− rc = cxl_alloc_irq_vectors(pdev);
850− if (rc)
851− return rc;
855+ irq_avail = cxl_alloc_irq_vectors(pdev);
852856
853− rc = cxl_pci_setup_mailbox(mds);
857+ rc = cxl_pci_setup_mailbox(mds, irq_avail);
854858 if (rc)
855859 return rc;
856860
@@ -909,7 +913,7 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 52 unmodified lines
909913 }
910914 }
911915
912− rc = cxl_event_config(host_bridge, mds);
916+ rc = cxl_event_config(host_bridge, mds, irq_avail);
913917 if (rc)
914918 return rc;
915919
drivers/firewire/core-device.c+13−5
@@ -118,10 +118,9 @@ static int textual_leaf_to_string(const u32 *block, char *buf, size_t size) · 117 unmodified lines
118118 * @buf: where to put the string
119119 * @size: size of @buf, in bytes
120120 *
121− * The string is taken from a minimal ASCII text descriptor leaf after
122− * the immediate entry with @key. The string is zero-terminated.
123− * An overlong string is silently truncated such that it and the
124− * zero byte fit into @size.
121+ * The string is taken from a minimal ASCII text descriptor leaf just after the entry with the
122+ * @key. The string is zero-terminated. An overlong string is silently truncated such that it
123+ * and the zero byte fit into @size.
125124 *
126125 * Returns strlen(buf) or a negative error code.
127126 */
@@ -368,8 +367,17 @@ static ssize_t show_text_leaf(struct device *dev, · 240 unmodified lines
368367 for (i = 0; i < ARRAY_SIZE(directories) && !!directories[i]; ++i) {
369368 int result = fw_csr_string(directories[i], attr->key, buf, bufsize);
370369 // Detected.
371− if (result >= 0)
370+ if (result >= 0) {
372371 ret = result;
372+ } else if (i == 0 && attr->key == CSR_VENDOR) {
373+ // Sony DVMC-DA1 has configuration ROM such that the descriptor leaf entry
374+ // in the root directory follows to the directory entry for vendor ID
375+ // instead of the immediate value for vendor ID.
376+ result = fw_csr_string(directories[i], CSR_DIRECTORY | attr->key, buf,
377+ bufsize);
378+ if (result >= 0)
379+ ret = result;
380+ }
373381 }
374382
375383 if (ret >= 0) {
drivers/firmware/arm_ffa/driver.c+57−28
@@ -107,12 +107,12 @@ struct ffa_drv_info { · 106 unmodified lines
107107 struct work_struct notif_pcpu_work;
108108 struct work_struct irq_work;
109109 struct xarray partition_info;
110− unsigned int partition_count;
111110 DECLARE_HASHTABLE(notifier_hash, ilog2(FFA_MAX_NOTIFICATIONS));
112111 struct mutex notify_lock; /* lock to protect notifier hashtable */
113112 };
114113
115114 static struct ffa_drv_info *drv_info;
115+static void ffa_partitions_cleanup(void);
116116
117117 /*
118118 * The driver must be able to support all the versions from the earliest
@@ -733,6 +733,11 @@ static void __do_sched_recv_cb(u16 part_id, u16 vcpu, bool is_per_vcpu) · 614 unmodified lines
733733 void *cb_data;
734734
735735 partition = xa_load(&drv_info->partition_info, part_id);
736+ if (!partition) {
737+ pr_err("%s: Invalid partition ID 0x%x\n", __func__, part_id);
738+ return;
739+ }
740+
736741 read_lock(&partition->rw_lock);
737742 callback = partition->callback;
738743 cb_data = partition->cb_data;
@@ -915,6 +920,11 @@ static int ffa_sched_recv_cb_update(u16 part_id, ffa_sched_recv_cb callback, · 176 unmodified lines
915920 return -EOPNOTSUPP;
916921
917922 partition = xa_load(&drv_info->partition_info, part_id);
923+ if (!partition) {
924+ pr_err("%s: Invalid partition ID 0x%x\n", __func__, part_id);
925+ return -EINVAL;
926+ }
927+
918928 write_lock(&partition->rw_lock);
919929
920930 cb_valid = !!partition->callback;
@@ -1186,9 +1196,9 @@ void ffa_device_match_uuid(struct ffa_device *ffa_dev, const uuid_t *uuid) · 265 unmodified lines
11861196 kfree(pbuf);
11871197 }
11881198
1189−static void ffa_setup_partitions(void)
1199+static int ffa_setup_partitions(void)
11901200 {
1191− int count, idx;
1201+ int count, idx, ret;
11921202 uuid_t uuid;
11931203 struct ffa_device *ffa_dev;
11941204 struct ffa_dev_part_info *info;
@@ -1197,7 +1207,7 @@ static void ffa_setup_partitions(void) · 2 unmodified lines
11971207 count = ffa_partition_probe(&uuid_null, &pbuf);
11981208 if (count <= 0) {
11991209 pr_info("%s: No partitions found, error %d\n", __func__, count);
1200− return;
1210+ return -EINVAL;
12011211 }
12021212
12031213 xa_init(&drv_info->partition_info);
@@ -1226,40 +1236,53 @@ static void ffa_setup_partitions(void) · 22 unmodified lines
12261236 ffa_device_unregister(ffa_dev);
12271237 continue;
12281238 }
1229− xa_store(&drv_info->partition_info, tpbuf->id, info, GFP_KERNEL);
1239+ rwlock_init(&info->rw_lock);
1240+ ret = xa_insert(&drv_info->partition_info, tpbuf->id,
1241+ info, GFP_KERNEL);
1242+ if (ret) {
1243+ pr_err("%s: failed to save partition ID 0x%x - ret:%d\n",
1244+ __func__, tpbuf->id, ret);
1245+ ffa_device_unregister(ffa_dev);
1246+ kfree(info);
1247+ }
12301248 }
1231− drv_info->partition_count = count;
12321249
12331250 kfree(pbuf);
12341251
12351252 /* Allocate for the host */
12361253 info = kzalloc(sizeof(*info), GFP_KERNEL);
1237− if (!info)
1238− return;
1239− xa_store(&drv_info->partition_info, drv_info->vm_id, info, GFP_KERNEL);
1240− drv_info->partition_count++;
1254+ if (!info) {
1255+ pr_err("%s: failed to alloc Host partition ID 0x%x. Abort.\n",
1256+ __func__, drv_info->vm_id);
1257+ /* Already registered devices are freed on bus_exit */
1258+ ffa_partitions_cleanup();
1259+ return -ENOMEM;
1260+ }
1261+
1262+ rwlock_init(&info->rw_lock);
1263+ ret = xa_insert(&drv_info->partition_info, drv_info->vm_id,
1264+ info, GFP_KERNEL);
1265+ if (ret) {
1266+ pr_err("%s: failed to save Host partition ID 0x%x - ret:%d. Abort.\n",
1267+ __func__, drv_info->vm_id, ret);
1268+ kfree(info);
1269+ /* Already registered devices are freed on bus_exit */
1270+ ffa_partitions_cleanup();
1271+ }
1272+
1273+ return ret;
12411274 }
12421275
12431276 static void ffa_partitions_cleanup(void)
12441277 {
1245− struct ffa_dev_part_info **info;
1246− int idx, count = drv_info->partition_count;
1247−
1248− if (!count)
1249− return;
1250−
1251− info = kcalloc(count, sizeof(*info), GFP_KERNEL);
1252− if (!info)
1253− return;
1254−
1255− xa_extract(&drv_info->partition_info, (void **)info, 0, VM_ID_MASK,
1256− count, XA_PRESENT);
1278+ struct ffa_dev_part_info *info;
1279+ unsigned long idx;
12571280
1258− for (idx = 0; idx < count; idx++)
1259− kfree(info[idx]);
1260− kfree(info);
1281+ xa_for_each(&drv_info->partition_info, idx, info) {
1282+ xa_erase(&drv_info->partition_info, idx);
1283+ kfree(info);
1284+ }
12611285
1262− drv_info->partition_count = 0;
12631286 xa_destroy(&drv_info->partition_info);
12641287 }
12651288
@@ -1508,7 +1531,11 @@ static int __init ffa_init(void) · 242 unmodified lines
15081531
15091532 ffa_notifications_setup();
15101533
1511− ffa_setup_partitions();
1534+ ret = ffa_setup_partitions();
1535+ if (ret) {
1536+ pr_err("failed to setup partitions\n");
1537+ goto cleanup_notifs;
1538+ }
15121539
15131540 ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle,
15141541 drv_info, true);
@@ -1516,6 +1543,9 @@ static int __init ffa_init(void) · 1 unmodified line
15161543 pr_info("Failed to register driver sched callback %d\n", ret);
15171544
15181545 return 0;
1546+
1547+cleanup_notifs:
1548+ ffa_notifications_cleanup();
15191549 free_pages:
15201550 if (drv_info->tx_buffer)
15211551 free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
@@ -1535,7 +1565,6 @@ static void __exit ffa_exit(void) · 13 unmodified lines
15351565 ffa_rxtx_unmap(drv_info->vm_id);
15361566 free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
15371567 free_pages_exact(drv_info->rx_buffer, RXTX_BUFFER_SIZE);
1538− xa_destroy(&drv_info->partition_info);
15391568 kfree(drv_info);
15401569 arm_ffa_bus_exit();
15411570 }
drivers/firmware/arm_scmi/clock.c+2−3
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 #include "notify.h"
1414
1515 /* Updated only after ALL the mandatory features for that version are merged */
16−#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20001
16+#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x20000
1717
1818 enum scmi_clock_protocol_cmd {
1919 CLOCK_ATTRIBUTES = 0x3,
@@ -954,8 +954,7 @@ static int scmi_clock_protocol_init(const struct scmi_protocol_handle *ph) · 934 unmodified lines
954954 scmi_clock_describe_rates_get(ph, clkid, clk);
955955 }
956956
957− if (PROTOCOL_REV_MAJOR(version) >= 0x2 &&
958− PROTOCOL_REV_MINOR(version) >= 0x1) {
957+ if (PROTOCOL_REV_MAJOR(version) >= 0x3) {
959958 cinfo->clock_config_set = scmi_clock_config_set_v2;
960959 cinfo->clock_config_get = scmi_clock_config_get_v2;
961960 } else {
drivers/firmware/arm_scmi/common.h+1−0
@@ -314,6 +314,7 @@ void shmem_fetch_notification(struct scmi_shared_mem __iomem *shmem, · 313 unmodified lines
314314 void shmem_clear_channel(struct scmi_shared_mem __iomem *shmem);
315315 bool shmem_poll_done(struct scmi_shared_mem __iomem *shmem,
316316 struct scmi_xfer *xfer);
317+bool shmem_channel_free(struct scmi_shared_mem __iomem *shmem);
317318
318319 /* declarations for message passing transports */
319320 struct scmi_msg_payld;
drivers/firmware/arm_scmi/mailbox.c+14−0
@@ -45,6 +45,20 @@ static void rx_callback(struct mbox_client *cl, void *m) · 44 unmodified lines
4545 {
4646 struct scmi_mailbox *smbox = client_to_scmi_mailbox(cl);
4747
48+ /*
49+ * An A2P IRQ is NOT valid when received while the platform still has
50+ * the ownership of the channel, because the platform at first releases
51+ * the SMT channel and then sends the completion interrupt.
52+ *
53+ * This addresses a possible race condition in which a spurious IRQ from
54+ * a previous timed-out reply which arrived late could be wrongly
55+ * associated with the next pending transaction.
56+ */
57+ if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) {
58+ dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n");
59+ return;
60+ }
61+
4862 scmi_rx_callback(smbox->cinfo, shmem_read_header(smbox->shmem), NULL);
4963 }
5064
drivers/firmware/arm_scmi/perf.c+18−5
@@ -350,8 +350,8 @@ process_response_opp(struct scmi_opp *opp, unsigned int loop_idx, · 349 unmodified lines
350350 }
351351
352352 static inline void
353−process_response_opp_v4(struct perf_dom_info *dom, struct scmi_opp *opp,
354− unsigned int loop_idx,
353+process_response_opp_v4(struct device *dev, struct perf_dom_info *dom,
354+ struct scmi_opp *opp, unsigned int loop_idx,
355355 const struct scmi_msg_resp_perf_describe_levels_v4 *r)
356356 {
357357 opp->perf = le32_to_cpu(r->opp[loop_idx].perf_val);
@@ -362,10 +362,23 @@ process_response_opp_v4(struct perf_dom_info *dom, struct scmi_opp *opp, · 4 unmodified lines
362362 /* Note that PERF v4 reports always five 32-bit words */
363363 opp->indicative_freq = le32_to_cpu(r->opp[loop_idx].indicative_freq);
364364 if (dom->level_indexing_mode) {
365+ int ret;
366+
365367 opp->level_index = le32_to_cpu(r->opp[loop_idx].level_index);
366368
367− xa_store(&dom->opps_by_idx, opp->level_index, opp, GFP_KERNEL);
368− xa_store(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL);
369+ ret = xa_insert(&dom->opps_by_idx, opp->level_index, opp,
370+ GFP_KERNEL);
371+ if (ret)
372+ dev_warn(dev,
373+ "Failed to add opps_by_idx at %d - ret:%d\n",
374+ opp->level_index, ret);
375+
376+ ret = xa_insert(&dom->opps_by_lvl, opp->perf, opp, GFP_KERNEL);
377+ if (ret)
378+ dev_warn(dev,
379+ "Failed to add opps_by_lvl at %d - ret:%d\n",
380+ opp->perf, ret);
381+
369382 hash_add(dom->opps_by_freq, &opp->hash, opp->indicative_freq);
370383 }
371384 }
@@ -382,7 +395,7 @@ iter_perf_levels_process_response(const struct scmi_protocol_handle *ph, · 10 unmodified lines
382395 if (PROTOCOL_REV_MAJOR(p->version) <= 0x3)
383396 process_response_opp(opp, st->loop_idx, response);
384397 else
385− process_response_opp_v4(p->perf_dom, opp, st->loop_idx,
398+ process_response_opp_v4(ph->dev, p->perf_dom, opp, st->loop_idx,
386399 response);
387400 p->perf_dom->opp_count++;
388401
drivers/firmware/arm_scmi/raw_mode.c+8−4
@@ -1111,7 +1111,6 @@ static int scmi_raw_mode_setup(struct scmi_raw_mode_info *raw, · 1110 unmodified lines
11111111 int i;
11121112
11131113 for (i = 0; i < num_chans; i++) {
1114− void *xret;
11151114 struct scmi_raw_queue *q;
11161115
11171116 q = scmi_raw_queue_init(raw);
@@ -1120,13 +1119,12 @@ static int scmi_raw_mode_setup(struct scmi_raw_mode_info *raw, · 2 unmodified lines
11201119 goto err_xa;
11211120 }
11221121
1123− xret = xa_store(&raw->chans_q, channels[i], q,
1122+ ret = xa_insert(&raw->chans_q, channels[i], q,
11241123 GFP_KERNEL);
1125− if (xa_err(xret)) {
1124+ if (ret) {
11261125 dev_err(dev,
11271126 "Fail to allocate Raw queue 0x%02X\n",
11281127 channels[i]);
1129− ret = xa_err(xret);
11301128 goto err_xa;
11311129 }
11321130 }
@@ -1322,6 +1320,12 @@ void scmi_raw_message_report(void *r, struct scmi_xfer *xfer, · 189 unmodified lines
13221320 dev = raw->handle->dev;
13231321 q = scmi_raw_queue_select(raw, idx,
13241322 SCMI_XFER_IS_CHAN_SET(xfer) ? chan_id : 0);
1323+ if (!q) {
1324+ dev_warn(dev,
1325+ "RAW[%d] - NO queue for chan 0x%X. Dropping report.\n",
1326+ idx, chan_id);
1327+ return;
1328+ }
13251329
13261330 /*
13271331 * Grab the msg_q_lock upfront to avoid a possible race between
drivers/firmware/arm_scmi/shmem.c+7−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #include <linux/processor.h>
1111 #include <linux/types.h>
1212
13−#include <asm-generic/bug.h>
13+#include <linux/bug.h>
1414
1515 #include "common.h"
1616
@@ -122,3 +122,9 @@ bool shmem_poll_done(struct scmi_shared_mem __iomem *shmem, · 105 unmodified lines
122122 (SCMI_SHMEM_CHAN_STAT_CHANNEL_ERROR |
123123 SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE);
124124 }
125+
126+bool shmem_channel_free(struct scmi_shared_mem __iomem *shmem)
127+{
128+ return (ioread32(&shmem->channel_status) &
129+ SCMI_SHMEM_CHAN_STAT_CHANNEL_FREE);
130+}
drivers/firmware/sysfb.c+1−1
@@ -128,4 +128,4 @@ unlock_mutex: · 127 unmodified lines
128128 }
129129
130130 /* must execute after PCI subsystem for EFI quirks */
131−subsys_initcall_sync(sysfb_init);
131+device_initcall(sysfb_init);
drivers/gpio/gpio-eic-sprd.c+28−4
@@ -330,20 +330,27 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) · 329 unmodified lines
330330 switch (flow_type) {
331331 case IRQ_TYPE_LEVEL_HIGH:
332332 sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IEV, 1);
333+ sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IC, 1);
333334 break;
334335 case IRQ_TYPE_LEVEL_LOW:
335336 sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IEV, 0);
337+ sprd_eic_update(chip, offset, SPRD_EIC_DBNC_IC, 1);
336338 break;
337339 case IRQ_TYPE_EDGE_RISING:
338340 case IRQ_TYPE_EDGE_FALLING:
339341 case IRQ_TYPE_EDGE_BOTH:
340342 state = sprd_eic_get(chip, offset);
341− if (state)
343+ if (state) {
342344 sprd_eic_update(chip, offset,
343345 SPRD_EIC_DBNC_IEV, 0);
344− else
346+ sprd_eic_update(chip, offset,
347+ SPRD_EIC_DBNC_IC, 1);
348+ } else {
345349 sprd_eic_update(chip, offset,
346350 SPRD_EIC_DBNC_IEV, 1);
351+ sprd_eic_update(chip, offset,
352+ SPRD_EIC_DBNC_IC, 1);
353+ }
347354 break;
348355 default:
349356 return -ENOTSUPP;
@@ -355,20 +362,27 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) · 5 unmodified lines
355362 switch (flow_type) {
356363 case IRQ_TYPE_LEVEL_HIGH:
357364 sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTPOL, 0);
365+ sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTCLR, 1);
358366 break;
359367 case IRQ_TYPE_LEVEL_LOW:
360368 sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTPOL, 1);
369+ sprd_eic_update(chip, offset, SPRD_EIC_LATCH_INTCLR, 1);
361370 break;
362371 case IRQ_TYPE_EDGE_RISING:
363372 case IRQ_TYPE_EDGE_FALLING:
364373 case IRQ_TYPE_EDGE_BOTH:
365374 state = sprd_eic_get(chip, offset);
366− if (state)
375+ if (state) {
367376 sprd_eic_update(chip, offset,
368377 SPRD_EIC_LATCH_INTPOL, 0);
369− else
378+ sprd_eic_update(chip, offset,
379+ SPRD_EIC_LATCH_INTCLR, 1);
380+ } else {
370381 sprd_eic_update(chip, offset,
371382 SPRD_EIC_LATCH_INTPOL, 1);
383+ sprd_eic_update(chip, offset,
384+ SPRD_EIC_LATCH_INTCLR, 1);
385+ }
372386 break;
373387 default:
374388 return -ENOTSUPP;
@@ -382,29 +396,34 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) · 7 unmodified lines
382396 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0);
383397 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0);
384398 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 1);
399+ sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1);
385400 irq_set_handler_locked(data, handle_edge_irq);
386401 break;
387402 case IRQ_TYPE_EDGE_FALLING:
388403 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0);
389404 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0);
390405 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 0);
406+ sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1);
391407 irq_set_handler_locked(data, handle_edge_irq);
392408 break;
393409 case IRQ_TYPE_EDGE_BOTH:
394410 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0);
395411 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1);
412+ sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1);
396413 irq_set_handler_locked(data, handle_edge_irq);
397414 break;
398415 case IRQ_TYPE_LEVEL_HIGH:
399416 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0);
400417 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 1);
401418 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 1);
419+ sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1);
402420 irq_set_handler_locked(data, handle_level_irq);
403421 break;
404422 case IRQ_TYPE_LEVEL_LOW:
405423 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 0);
406424 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 1);
407425 sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTPOL, 0);
426+ sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTCLR, 1);
408427 irq_set_handler_locked(data, handle_level_irq);
409428 break;
410429 default:
@@ -417,29 +436,34 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) · 6 unmodified lines
417436 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0);
418437 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0);
419438 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 1);
439+ sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1);
420440 irq_set_handler_locked(data, handle_edge_irq);
421441 break;
422442 case IRQ_TYPE_EDGE_FALLING:
423443 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0);
424444 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0);
425445 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 0);
446+ sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1);
426447 irq_set_handler_locked(data, handle_edge_irq);
427448 break;
428449 case IRQ_TYPE_EDGE_BOTH:
429450 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 0);
430451 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 1);
452+ sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1);
431453 irq_set_handler_locked(data, handle_edge_irq);
432454 break;
433455 case IRQ_TYPE_LEVEL_HIGH:
434456 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0);
435457 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 1);
436458 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 1);
459+ sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1);
437460 irq_set_handler_locked(data, handle_level_irq);
438461 break;
439462 case IRQ_TYPE_LEVEL_LOW:
440463 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTBOTH, 0);
441464 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTMODE, 1);
442465 sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTPOL, 0);
466+ sprd_eic_update(chip, offset, SPRD_EIC_SYNC_INTCLR, 1);
443467 irq_set_handler_locked(data, handle_level_irq);
444468 break;
445469 default:
drivers/gpio/gpiolib-acpi.c+14−0
@@ -1651,6 +1651,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = { · 1650 unmodified lines
16511651 .ignore_interrupt = "INT33FC:00@3",
16521652 },
16531653 },
1654+ {
1655+ /*
1656+ * Spurious wakeups from TP_ATTN# pin
1657+ * Found in BIOS 0.35
1658+ * https://gitlab.freedesktop.org/drm/amd/-/issues/3073
1659+ */
1660+ .matches = {
1661+ DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
1662+ DMI_MATCH(DMI_PRODUCT_NAME, "G1619-04"),
1663+ },
1664+ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
1665+ .ignore_wake = "PNP0C50:00@8",
1666+ },
1667+ },
16541668 {} /* Terminating entry */
16551669 };
16561670
drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c+8−0
@@ -121,6 +121,7 @@ int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev) · 120 unmodified lines
121121 struct amdgpu_bo_param bp;
122122 dma_addr_t dma_addr;
123123 struct page *p;
124+ unsigned long x;
124125 int ret;
125126
126127 if (adev->gart.bo != NULL)
@@ -130,6 +131,10 @@ int amdgpu_gart_table_ram_alloc(struct amdgpu_device *adev) · 3 unmodified lines
130131 if (!p)
131132 return -ENOMEM;
132133
134+ /* assign pages to this device */
135+ for (x = 0; x < (1UL << order); x++)
136+ p[x].mapping = adev->mman.bdev.dev_mapping;
137+
133138 /* If the hardware does not support UTCL2 snooping of the CPU caches
134139 * then set_memory_wc() could be used as a workaround to mark the pages
135140 * as write combine memory.
@@ -223,6 +228,7 @@ void amdgpu_gart_table_ram_free(struct amdgpu_device *adev) · 87 unmodified lines
223228 unsigned int order = get_order(adev->gart.table_size);
224229 struct sg_table *sg = adev->gart.bo->tbo.sg;
225230 struct page *p;
231+ unsigned long x;
226232 int ret;
227233
228234 ret = amdgpu_bo_reserve(adev->gart.bo, false);
@@ -234,6 +240,8 @@ void amdgpu_gart_table_ram_free(struct amdgpu_device *adev) · 5 unmodified lines
234240 sg_free_table(sg);
235241 kfree(sg);
236242 p = virt_to_page(adev->gart.ptr);
243+ for (x = 0; x < (1UL << order); x++)
244+ p[x].mapping = NULL;
237245 __free_pages(p, order);
238246
239247 adev->gart.ptr = NULL;
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c+16−1
@@ -221,8 +221,23 @@ static struct attribute *amdgpu_vram_mgr_attributes[] = { · 220 unmodified lines
221221 NULL
222222 };
223223
224+static umode_t amdgpu_vram_attrs_is_visible(struct kobject *kobj,
225+ struct attribute *attr, int i)
226+{
227+ struct device *dev = kobj_to_dev(kobj);
228+ struct drm_device *ddev = dev_get_drvdata(dev);
229+ struct amdgpu_device *adev = drm_to_adev(ddev);
230+
231+ if (attr == &dev_attr_mem_info_vram_vendor.attr &&
232+ !adev->gmc.vram_vendor)
233+ return 0;
234+
235+ return attr->mode;
236+}
237+
224238 const struct attribute_group amdgpu_vram_mgr_attr_group = {
225− .attrs = amdgpu_vram_mgr_attributes
239+ .attrs = amdgpu_vram_mgr_attributes,
240+ .is_visible = amdgpu_vram_attrs_is_visible
226241 };
227242
228243 /**
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+1−1
@@ -6589,7 +6589,7 @@ static int gfx_v10_0_compute_mqd_init(struct amdgpu_device *adev, void *m, · 6588 unmodified lines
65896589 #ifdef __BIG_ENDIAN
65906590 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, ENDIAN_SWAP, 1);
65916591 #endif
6592− tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 0);
6592+ tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
65936593 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,
65946594 prop->allow_tunneling);
65956595 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c+1−1
@@ -3846,7 +3846,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, · 3845 unmodified lines
38463846 (order_base_2(prop->queue_size / 4) - 1));
38473847 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE,
38483848 (order_base_2(AMDGPU_GPU_PAGE_SIZE / 4) - 1));
3849− tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 0);
3849+ tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, UNORD_DISPATCH, 1);
38503850 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, TUNNEL_DISPATCH,
38513851 prop->allow_tunneling);
38523852 tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, PRIV_STATE, 1);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c+2−1
@@ -1950,7 +1950,8 @@ static void gmc_v9_4_3_init_vram_info(struct amdgpu_device *adev) · 1949 unmodified lines
19501950 static const u32 regBIF_BIOS_SCRATCH_4 = 0x50;
19511951 u32 vram_info;
19521952
1953− if (!amdgpu_sriov_vf(adev)) {
1953+ /* Only for dGPU, vendor informaton is reliable */
1954+ if (!amdgpu_sriov_vf(adev) && !(adev->flags & AMD_IS_APU)) {
19541955 vram_info = RREG32(regBIF_BIOS_SCRATCH_4);
19551956 adev->gmc.vram_vendor = vram_info & 0xF;
19561957 }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c+1−0
@@ -170,6 +170,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 169 unmodified lines
170170 m->cp_hqd_pq_control = 5 << CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE__SHIFT;
171171 m->cp_hqd_pq_control |=
172172 ffs(q->queue_size / sizeof(unsigned int)) - 1 - 1;
173+ m->cp_hqd_pq_control |= CP_HQD_PQ_CONTROL__UNORD_DISPATCH_MASK;
173174 pr_debug("cp_hqd_pq_control 0x%x\n", m->cp_hqd_pq_control);
174175
175176 m->cp_hqd_pq_base_lo = lower_32_bits((uint64_t)q->queue_address >> 8);
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c+1−0
@@ -224,6 +224,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 223 unmodified lines
224224 m->cp_hqd_pq_control = 5 << CP_HQD_PQ_CONTROL__RPTR_BLOCK_SIZE__SHIFT;
225225 m->cp_hqd_pq_control |=
226226 ffs(q->queue_size / sizeof(unsigned int)) - 1 - 1;
227+ m->cp_hqd_pq_control |= CP_HQD_PQ_CONTROL__UNORD_DISPATCH_MASK;
227228 pr_debug("cp_hqd_pq_control 0x%x\n", m->cp_hqd_pq_control);
228229
229230 m->cp_hqd_pq_base_lo = lower_32_bits((uint64_t)q->queue_address >> 8);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+10−11
@@ -272,6 +272,7 @@ static int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc, · 271 unmodified lines
272272 {
273273 u32 v_blank_start, v_blank_end, h_position, v_position;
274274 struct amdgpu_crtc *acrtc = NULL;
275+ struct dc *dc = adev->dm.dc;
275276
276277 if ((crtc < 0) || (crtc >= adev->mode_info.num_crtc))
277278 return -EINVAL;
@@ -284,6 +285,9 @@ static int dm_crtc_get_scanoutpos(struct amdgpu_device *adev, int crtc, · 6 unmodified lines
284285 return 0;
285286 }
286287
288+ if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed)
289+ dc_allow_idle_optimizations(dc, false);
290+
287291 /*
288292 * TODO rework base driver to use values directly.
289293 * for now parse it back into reg-format
@@ -1715,7 +1719,10 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) · 1425 unmodified lines
17151719 init_data.nbio_reg_offsets = adev->reg_offset[NBIO_HWIP][0];
17161720 init_data.clk_reg_offsets = adev->reg_offset[CLK_HWIP][0];
17171721
1718− init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL;
1722+ if (amdgpu_dc_debug_mask & DC_DISABLE_IPS)
1723+ init_data.flags.disable_ips = DMUB_IPS_DISABLE_ALL;
1724+
1725+ init_data.flags.disable_ips_in_vpb = 1;
17191726
17201727 /* Enable DWB for tested platforms only */
17211728 if (amdgpu_ip_version(adev, DCE_HWIP, 0) >= IP_VERSION(3, 0, 0))
@@ -8976,16 +8983,8 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state) · 7254 unmodified lines
89768983
89778984 trace_amdgpu_dm_atomic_commit_tail_begin(state);
89788985
8979− if (dm->dc->caps.ips_support) {
8980− for_each_oldnew_connector_in_state(state, connector, old_con_state, new_con_state, i) {
8981− if (new_con_state->crtc &&
8982− new_con_state->crtc->state->active &&
8983− drm_atomic_crtc_needs_modeset(new_con_state->crtc->state)) {
8984− dc_dmub_srv_apply_idle_power_optimizations(dm->dc, false);
8985− break;
8986− }
8987− }
8988− }
8986+ if (dm->dc->caps.ips_support && dm->dc->idle_optimizations_allowed)
8987+ dc_allow_idle_optimizations(dm->dc, false);
89898988
89908989 drm_atomic_helper_update_legacy_modeset_state(dev, state);
89918990 drm_dp_mst_atomic_wait_for_dependencies(state);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c+4−1
@@ -711,7 +711,7 @@ static inline int dm_irq_state(struct amdgpu_device *adev, · 710 unmodified lines
711711 {
712712 bool st;
713713 enum dc_irq_source irq_source;
714−
714+ struct dc *dc = adev->dm.dc;
715715 struct amdgpu_crtc *acrtc = adev->mode_info.crtcs[crtc_id];
716716
717717 if (!acrtc) {
@@ -729,6 +729,9 @@ static inline int dm_irq_state(struct amdgpu_device *adev, · 11 unmodified lines
729729
730730 st = (state == AMDGPU_IRQ_STATE_ENABLE);
731731
732+ if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed)
733+ dc_allow_idle_optimizations(dc, false);
734+
732735 dc_interrupt_set(adev->dm.dc, irq_source, st);
733736 return 0;
734737 }
drivers/gpu/drm/amd/display/dc/dc.h+1−0
@@ -434,6 +434,7 @@ struct dc_config { · 433 unmodified lines
434434 bool EnableMinDispClkODM;
435435 bool enable_auto_dpm_test_logs;
436436 unsigned int disable_ips;
437+ unsigned int disable_ips_in_vpb;
437438 };
438439
439440 enum visual_confirm {
drivers/gpu/drm/amd/display/dc/dc_types.h+5−0
@@ -1034,6 +1034,7 @@ enum replay_FW_Message_type { · 1033 unmodified lines
10341034 Replay_Msg_Not_Support = -1,
10351035 Replay_Set_Timing_Sync_Supported,
10361036 Replay_Set_Residency_Frameupdate_Timer,
1037+ Replay_Set_Pseudo_VTotal,
10371038 };
10381039
10391040 union replay_error_status {
@@ -1089,6 +1090,10 @@ struct replay_settings { · 49 unmodified lines
10891090 uint16_t coasting_vtotal_table[PR_COASTING_TYPE_NUM];
10901091 /* Maximum link off frame count */
10911092 enum replay_link_off_frame_count_level link_off_frame_count_level;
1093+ /* Replay pseudo vtotal for abm + ips on full screen video which can improve ips residency */
1094+ uint16_t abm_with_ips_on_full_screen_video_pseudo_vtotal;
1095+ /* Replay last pseudo vtotal set to DMUB */
1096+ uint16_t last_pseudo_vtotal;
10921097 };
10931098
10941099 /* To split out "global" and "per-panel" config settings.
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c+8−1
@@ -680,7 +680,7 @@ void dcn35_power_down_on_boot(struct dc *dc) · 679 unmodified lines
680680 bool dcn35_apply_idle_power_optimizations(struct dc *dc, bool enable)
681681 {
682682 struct dc_link *edp_links[MAX_NUM_EDP];
683− int edp_num;
683+ int i, edp_num;
684684 if (dc->debug.dmcub_emulation)
685685 return true;
686686
@@ -688,6 +688,13 @@ bool dcn35_apply_idle_power_optimizations(struct dc *dc, bool enable) · 1 unmodified line
688688 dc_get_edp_links(dc, edp_links, &edp_num);
689689 if (edp_num == 0 || edp_num > 1)
690690 return false;
691+
692+ for (i = 0; i < dc->current_state->stream_count; ++i) {
693+ struct dc_stream_state *stream = dc->current_state->streams[i];
694+
695+ if (!stream->dpms_off && !dc_is_embedded_signal(stream->signal))
696+ return false;
697+ }
691698 }
692699
693700 // TODO: review other cases when idle optimization is allowed
drivers/gpu/drm/amd/display/dc/link/protocols/link_dpcd.c+2−2
@@ -205,7 +205,7 @@ enum dc_status core_link_read_dpcd( · 204 unmodified lines
205205 uint32_t extended_size;
206206 /* size of the remaining partitioned address space */
207207 uint32_t size_left_to_read;
208− enum dc_status status;
208+ enum dc_status status = DC_ERROR_UNEXPECTED;
209209 /* size of the next partition to be read from */
210210 uint32_t partition_size;
211211 uint32_t data_index = 0;
@@ -234,7 +234,7 @@ enum dc_status core_link_write_dpcd( · 22 unmodified lines
234234 {
235235 uint32_t partition_size;
236236 uint32_t data_index = 0;
237− enum dc_status status;
237+ enum dc_status status = DC_ERROR_UNEXPECTED;
238238
239239 while (size) {
240240 partition_size = dpcd_get_next_partition_size(address, size);
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h+47−0
@@ -2832,6 +2832,7 @@ struct dmub_rb_cmd_psr_set_power_opt { · 2831 unmodified lines
28322832 #define REPLAY_RESIDENCY_MODE_MASK (0x1 << REPLAY_RESIDENCY_MODE_SHIFT)
28332833 # define REPLAY_RESIDENCY_MODE_PHY (0x0 << REPLAY_RESIDENCY_MODE_SHIFT)
28342834 # define REPLAY_RESIDENCY_MODE_ALPM (0x1 << REPLAY_RESIDENCY_MODE_SHIFT)
2835+# define REPLAY_RESIDENCY_MODE_IPS 0x10
28352836
28362837 #define REPLAY_RESIDENCY_ENABLE_MASK (0x1 << REPLAY_RESIDENCY_ENABLE_SHIFT)
28372838 # define REPLAY_RESIDENCY_DISABLE (0x0 << REPLAY_RESIDENCY_ENABLE_SHIFT)
@@ -2894,6 +2895,10 @@ enum dmub_cmd_replay_type { · 56 unmodified lines
28942895 * Set Residency Frameupdate Timer.
28952896 */
28962897 DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER = 6,
2898+ /**
2899+ * Set pseudo vtotal
2900+ */
2901+ DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL = 7,
28972902 };
28982903
28992904 /**
@@ -3076,6 +3081,26 @@ struct dmub_cmd_replay_set_timing_sync_data { · 176 unmodified lines
30763081 uint8_t pad[2];
30773082 };
30783083
3084+/**
3085+ * Data passed from driver to FW in a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command.
3086+ */
3087+struct dmub_cmd_replay_set_pseudo_vtotal {
3088+ /**
3089+ * Panel Instance.
3090+ * Panel isntance to identify which replay_state to use
3091+ * Currently the support is only for 0 or 1
3092+ */
3093+ uint8_t panel_inst;
3094+ /**
3095+ * Source Vtotal that Replay + IPS + ABM full screen video src vtotal
3096+ */
3097+ uint16_t vtotal;
3098+ /**
3099+ * Explicit padding to 4 byte boundary.
3100+ */
3101+ uint8_t pad;
3102+};
3103+
30793104 /**
30803105 * Definition of a DMUB_CMD__SET_REPLAY_POWER_OPT command.
30813106 */
@@ -3156,6 +3181,20 @@ struct dmub_rb_cmd_replay_set_timing_sync { · 74 unmodified lines
31563181 struct dmub_cmd_replay_set_timing_sync_data replay_set_timing_sync_data;
31573182 };
31583183
3184+/**
3185+ * Definition of a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command.
3186+ */
3187+struct dmub_rb_cmd_replay_set_pseudo_vtotal {
3188+ /**
3189+ * Command header.
3190+ */
3191+ struct dmub_cmd_header header;
3192+ /**
3193+ * Definition of DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command.
3194+ */
3195+ struct dmub_cmd_replay_set_pseudo_vtotal data;
3196+};
3197+
31593198 /**
31603199 * Data passed from driver to FW in DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command.
31613200 */
@@ -3207,6 +3246,10 @@ union dmub_replay_cmd_set { · 45 unmodified lines
32073246 * Definition of DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command data.
32083247 */
32093248 struct dmub_cmd_replay_frameupdate_timer_data timer_data;
3249+ /**
3250+ * Definition of DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command data.
3251+ */
3252+ struct dmub_cmd_replay_set_pseudo_vtotal pseudo_vtotal_data;
32103253 };
32113254
32123255 /**
@@ -4358,6 +4401,10 @@ union dmub_rb_cmd { · 1145 unmodified lines
43584401 * Definition of a DMUB_CMD__REPLAY_SET_RESIDENCY_FRAMEUPDATE_TIMER command.
43594402 */
43604403 struct dmub_rb_cmd_replay_set_frameupdate_timer replay_set_frameupdate_timer;
4404+ /**
4405+ * Definition of a DMUB_CMD__REPLAY_SET_PSEUDO_VTOTAL command.
4406+ */
4407+ struct dmub_rb_cmd_replay_set_pseudo_vtotal replay_set_pseudo_vtotal;
43614408 };
43624409
43634410 /**
drivers/gpu/drm/amd/display/modules/power/power_helpers.c+5−0
@@ -980,6 +980,11 @@ void set_replay_coasting_vtotal(struct dc_link *link, · 979 unmodified lines
980980 link->replay_settings.coasting_vtotal_table[type] = vtotal;
981981 }
982982
983+void set_replay_ips_full_screen_video_src_vtotal(struct dc_link *link, uint16_t vtotal)
984+{
985+ link->replay_settings.abm_with_ips_on_full_screen_video_pseudo_vtotal = vtotal;
986+}
987+
983988 void calculate_replay_link_off_frame_count(struct dc_link *link,
984989 uint16_t vtotal, uint16_t htotal)
985990 {
drivers/gpu/drm/amd/display/modules/power/power_helpers.h+1−0
@@ -57,6 +57,7 @@ void init_replay_config(struct dc_link *link, struct replay_config *pr_config); · 56 unmodified lines
5757 void set_replay_coasting_vtotal(struct dc_link *link,
5858 enum replay_coasting_vtotal_type type,
5959 uint16_t vtotal);
60+void set_replay_ips_full_screen_video_src_vtotal(struct dc_link *link, uint16_t vtotal);
6061 void calculate_replay_link_off_frame_count(struct dc_link *link,
6162 uint16_t vtotal, uint16_t htotal);
6263
drivers/gpu/drm/amd/include/amd_shared.h+1−0
@@ -258,6 +258,7 @@ enum DC_DEBUG_MASK { · 257 unmodified lines
258258 DC_ENABLE_DML2 = 0x100,
259259 DC_DISABLE_PSR_SU = 0x200,
260260 DC_DISABLE_REPLAY = 0x400,
261+ DC_DISABLE_IPS = 0x800,
261262 };
262263
263264 enum amd_dpm_forced_level;
drivers/gpu/drm/amd/include/amdgpu_reg_state.h+1−1
@@ -138,7 +138,7 @@ static inline size_t amdgpu_reginst_size(uint16_t num_inst, size_t inst_size, · 137 unmodified lines
138138 }
139139
140140 #define amdgpu_asic_get_reg_state_supported(adev) \
141− ((adev)->asic_funcs->get_reg_state ? 1 : 0)
141+ (((adev)->asic_funcs && (adev)->asic_funcs->get_reg_state) ? 1 : 0)
142142
143143 #define amdgpu_asic_get_reg_state(adev, state, buf, size) \
144144 ((adev)->asic_funcs->get_reg_state ? \
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c+4−10
@@ -24,6 +24,7 @@ · 23 unmodified lines
2424
2525 #include <linux/firmware.h>
2626 #include <linux/pci.h>
27+#include <linux/power_supply.h>
2728 #include <linux/reboot.h>
2829
2930 #include "amdgpu.h"
@@ -817,16 +818,8 @@ static int smu_late_init(void *handle) · 787 unmodified lines
817818 * handle the switch automatically. Driver involvement
818819 * is unnecessary.
819820 */
820− if (!smu->dc_controlled_by_gpio) {
821− ret = smu_set_power_source(smu,
822− adev->pm.ac_power ? SMU_POWER_SOURCE_AC :
823− SMU_POWER_SOURCE_DC);
824− if (ret) {
825− dev_err(adev->dev, "Failed to switch to %s mode!\n",
826− adev->pm.ac_power ? "AC" : "DC");
827− return ret;
828− }
829− }
821+ adev->pm.ac_power = power_supply_is_system_supplied() > 0;
822+ smu_set_ac_dc(smu);
830823
831824 if ((amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 1)) ||
832825 (amdgpu_ip_version(adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 3)))
@@ -2710,6 +2703,7 @@ int smu_get_power_limit(void *handle, · 1877 unmodified lines
27102703 case SMU_PPT_LIMIT_CURRENT:
27112704 switch (amdgpu_ip_version(adev, MP1_HWIP, 0)) {
27122705 case IP_VERSION(13, 0, 2):
2706+ case IP_VERSION(13, 0, 6):
27132707 case IP_VERSION(11, 0, 7):
27142708 case IP_VERSION(11, 0, 11):
27152709 case IP_VERSION(11, 0, 12):
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c+2−0
@@ -1442,10 +1442,12 @@ static int smu_v11_0_irq_process(struct amdgpu_device *adev, · 1441 unmodified lines
14421442 case 0x3:
14431443 dev_dbg(adev->dev, "Switched to AC mode!\n");
14441444 schedule_work(&smu->interrupt_work);
1445+ adev->pm.ac_power = true;
14451446 break;
14461447 case 0x4:
14471448 dev_dbg(adev->dev, "Switched to DC mode!\n");
14481449 schedule_work(&smu->interrupt_work);
1450+ adev->pm.ac_power = false;
14491451 break;
14501452 case 0x7:
14511453 /*
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c+2−0
@@ -1379,10 +1379,12 @@ static int smu_v13_0_irq_process(struct amdgpu_device *adev, · 1378 unmodified lines
13791379 case 0x3:
13801380 dev_dbg(adev->dev, "Switched to AC mode!\n");
13811381 smu_v13_0_ack_ac_dc_interrupt(smu);
1382+ adev->pm.ac_power = true;
13821383 break;
13831384 case 0x4:
13841385 dev_dbg(adev->dev, "Switched to DC mode!\n");
13851386 smu_v13_0_ack_ac_dc_interrupt(smu);
1387+ adev->pm.ac_power = false;
13861388 break;
13871389 case 0x7:
13881390 /*
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c+52−2
@@ -2357,6 +2357,7 @@ static int smu_v13_0_0_get_power_limit(struct smu_context *smu, · 2356 unmodified lines
23572357 PPTable_t *pptable = table_context->driver_pptable;
23582358 SkuTable_t *skutable = &pptable->SkuTable;
23592359 uint32_t power_limit, od_percent_upper, od_percent_lower;
2360+ uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
23602361
23612362 if (smu_v13_0_get_current_power_limit(smu, &power_limit))
23622363 power_limit = smu->adev->pm.ac_power ?
@@ -2380,7 +2381,7 @@ static int smu_v13_0_0_get_power_limit(struct smu_context *smu, · 17 unmodified lines
23802381 od_percent_upper, od_percent_lower, power_limit);
23812382
23822383 if (max_power_limit) {
2383− *max_power_limit = power_limit * (100 + od_percent_upper);
2384+ *max_power_limit = msg_limit * (100 + od_percent_upper);
23842385 *max_power_limit /= 100;
23852386 }
23862387
@@ -2959,6 +2960,55 @@ static bool smu_v13_0_0_wbrf_support_check(struct smu_context *smu) · 572 unmodified lines
29592960 }
29602961 }
29612962
2963+static int smu_v13_0_0_set_power_limit(struct smu_context *smu,
2964+ enum smu_ppt_limit_type limit_type,
2965+ uint32_t limit)
2966+{
2967+ PPTable_t *pptable = smu->smu_table.driver_pptable;
2968+ SkuTable_t *skutable = &pptable->SkuTable;
2969+ uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
2970+ struct smu_table_context *table_context = &smu->smu_table;
2971+ OverDriveTableExternal_t *od_table =
2972+ (OverDriveTableExternal_t *)table_context->overdrive_table;
2973+ int ret = 0;
2974+
2975+ if (limit_type != SMU_DEFAULT_PPT_LIMIT)
2976+ return -EINVAL;
2977+
2978+ if (limit <= msg_limit) {
2979+ if (smu->current_power_limit > msg_limit) {
2980+ od_table->OverDriveTable.Ppt = 0;
2981+ od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT;
2982+
2983+ ret = smu_v13_0_0_upload_overdrive_table(smu, od_table);
2984+ if (ret) {
2985+ dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
2986+ return ret;
2987+ }
2988+ }
2989+ return smu_v13_0_set_power_limit(smu, limit_type, limit);
2990+ } else if (smu->od_enabled) {
2991+ ret = smu_v13_0_set_power_limit(smu, limit_type, msg_limit);
2992+ if (ret)
2993+ return ret;
2994+
2995+ od_table->OverDriveTable.Ppt = (limit * 100) / msg_limit - 100;
2996+ od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT;
2997+
2998+ ret = smu_v13_0_0_upload_overdrive_table(smu, od_table);
2999+ if (ret) {
3000+ dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
3001+ return ret;
3002+ }
3003+
3004+ smu->current_power_limit = limit;
3005+ } else {
3006+ return -EINVAL;
3007+ }
3008+
3009+ return 0;
3010+}
3011+
29623012 static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
29633013 .get_allowed_feature_mask = smu_v13_0_0_get_allowed_feature_mask,
29643014 .set_default_dpm_table = smu_v13_0_0_set_default_dpm_table,
@@ -3013,7 +3063,7 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = { · 48 unmodified lines
30133063 .set_fan_control_mode = smu_v13_0_set_fan_control_mode,
30143064 .enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost,
30153065 .get_power_limit = smu_v13_0_0_get_power_limit,
3016− .set_power_limit = smu_v13_0_set_power_limit,
3066+ .set_power_limit = smu_v13_0_0_set_power_limit,
30173067 .set_power_source = smu_v13_0_set_power_source,
30183068 .get_power_profile_mode = smu_v13_0_0_get_power_profile_mode,
30193069 .set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c+2−2
@@ -160,8 +160,8 @@ static const struct cmn2asic_msg_mapping smu_v13_0_6_message_map[SMU_MSG_MAX_COU · 159 unmodified lines
160160 MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0),
161161 MSG_MAP(GetMinGfxclkFrequency, PPSMC_MSG_GetMinGfxDpmFreq, 1),
162162 MSG_MAP(GetMaxGfxclkFrequency, PPSMC_MSG_GetMaxGfxDpmFreq, 1),
163− MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxClk, 0),
164− MSG_MAP(SetSoftMaxGfxClk, PPSMC_MSG_SetSoftMaxGfxClk, 0),
163+ MSG_MAP(SetSoftMinGfxclk, PPSMC_MSG_SetSoftMinGfxClk, 1),
164+ MSG_MAP(SetSoftMaxGfxClk, PPSMC_MSG_SetSoftMaxGfxClk, 1),
165165 MSG_MAP(PrepareMp1ForUnload, PPSMC_MSG_PrepareForDriverUnload, 0),
166166 MSG_MAP(GetCTFLimit, PPSMC_MSG_GetCTFLimit, 0),
167167 MSG_MAP(GetThermalLimit, PPSMC_MSG_ReadThrottlerLimit, 0),
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c+52−2
@@ -2321,6 +2321,7 @@ static int smu_v13_0_7_get_power_limit(struct smu_context *smu, · 2320 unmodified lines
23212321 PPTable_t *pptable = table_context->driver_pptable;
23222322 SkuTable_t *skutable = &pptable->SkuTable;
23232323 uint32_t power_limit, od_percent_upper, od_percent_lower;
2324+ uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
23242325
23252326 if (smu_v13_0_get_current_power_limit(smu, &power_limit))
23262327 power_limit = smu->adev->pm.ac_power ?
@@ -2344,7 +2345,7 @@ static int smu_v13_0_7_get_power_limit(struct smu_context *smu, · 17 unmodified lines
23442345 od_percent_upper, od_percent_lower, power_limit);
23452346
23462347 if (max_power_limit) {
2347− *max_power_limit = power_limit * (100 + od_percent_upper);
2348+ *max_power_limit = msg_limit * (100 + od_percent_upper);
23482349 *max_power_limit /= 100;
23492350 }
23502351
@@ -2545,6 +2546,55 @@ static bool smu_v13_0_7_wbrf_support_check(struct smu_context *smu) · 194 unmodified lines
25452546 return smu->smc_fw_version > 0x00524600;
25462547 }
25472548
2549+static int smu_v13_0_7_set_power_limit(struct smu_context *smu,
2550+ enum smu_ppt_limit_type limit_type,
2551+ uint32_t limit)
2552+{
2553+ PPTable_t *pptable = smu->smu_table.driver_pptable;
2554+ SkuTable_t *skutable = &pptable->SkuTable;
2555+ uint32_t msg_limit = skutable->MsgLimits.Power[PPT_THROTTLER_PPT0][POWER_SOURCE_AC];
2556+ struct smu_table_context *table_context = &smu->smu_table;
2557+ OverDriveTableExternal_t *od_table =
2558+ (OverDriveTableExternal_t *)table_context->overdrive_table;
2559+ int ret = 0;
2560+
2561+ if (limit_type != SMU_DEFAULT_PPT_LIMIT)
2562+ return -EINVAL;
2563+
2564+ if (limit <= msg_limit) {
2565+ if (smu->current_power_limit > msg_limit) {
2566+ od_table->OverDriveTable.Ppt = 0;
2567+ od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT;
2568+
2569+ ret = smu_v13_0_7_upload_overdrive_table(smu, od_table);
2570+ if (ret) {
2571+ dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
2572+ return ret;
2573+ }
2574+ }
2575+ return smu_v13_0_set_power_limit(smu, limit_type, limit);
2576+ } else if (smu->od_enabled) {
2577+ ret = smu_v13_0_set_power_limit(smu, limit_type, msg_limit);
2578+ if (ret)
2579+ return ret;
2580+
2581+ od_table->OverDriveTable.Ppt = (limit * 100) / msg_limit - 100;
2582+ od_table->OverDriveTable.FeatureCtrlMask |= 1U << PP_OD_FEATURE_PPT_BIT;
2583+
2584+ ret = smu_v13_0_7_upload_overdrive_table(smu, od_table);
2585+ if (ret) {
2586+ dev_err(smu->adev->dev, "Failed to upload overdrive table!\n");
2587+ return ret;
2588+ }
2589+
2590+ smu->current_power_limit = limit;
2591+ } else {
2592+ return -EINVAL;
2593+ }
2594+
2595+ return 0;
2596+}
2597+
25482598 static const struct pptable_funcs smu_v13_0_7_ppt_funcs = {
25492599 .get_allowed_feature_mask = smu_v13_0_7_get_allowed_feature_mask,
25502600 .set_default_dpm_table = smu_v13_0_7_set_default_dpm_table,
@@ -2596,7 +2646,7 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { · 45 unmodified lines
25962646 .set_fan_control_mode = smu_v13_0_set_fan_control_mode,
25972647 .enable_mgpu_fan_boost = smu_v13_0_7_enable_mgpu_fan_boost,
25982648 .get_power_limit = smu_v13_0_7_get_power_limit,
2599− .set_power_limit = smu_v13_0_set_power_limit,
2649+ .set_power_limit = smu_v13_0_7_set_power_limit,
26002650 .set_power_source = smu_v13_0_set_power_source,
26012651 .get_power_profile_mode = smu_v13_0_7_get_power_profile_mode,
26022652 .set_power_profile_mode = smu_v13_0_7_set_power_profile_mode,
drivers/gpu/drm/bridge/analogix/anx7625.c+6−1
@@ -1762,6 +1762,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, · 1761 unmodified lines
17621762 u8 request = msg->request & ~DP_AUX_I2C_MOT;
17631763 int ret = 0;
17641764
1765+ mutex_lock(&ctx->aux_lock);
17651766 pm_runtime_get_sync(dev);
17661767 msg->reply = 0;
17671768 switch (request) {
@@ -1778,6 +1779,7 @@ static ssize_t anx7625_aux_transfer(struct drm_dp_aux *aux, · 10 unmodified lines
17781779 msg->size, msg->buffer);
17791780 pm_runtime_mark_last_busy(dev);
17801781 pm_runtime_put_autosuspend(dev);
1782+ mutex_unlock(&ctx->aux_lock);
17811783
17821784 return ret;
17831785 }
@@ -2474,7 +2476,9 @@ static void anx7625_bridge_atomic_disable(struct drm_bridge *bridge, · 690 unmodified lines
24742476 ctx->connector = NULL;
24752477 anx7625_dp_stop(ctx);
24762478
2477− pm_runtime_put_sync(dev);
2479+ mutex_lock(&ctx->aux_lock);
2480+ pm_runtime_put_sync_suspend(dev);
2481+ mutex_unlock(&ctx->aux_lock);
24782482 }
24792483
24802484 static enum drm_connector_status
@@ -2668,6 +2672,7 @@ static int anx7625_i2c_probe(struct i2c_client *client) · 187 unmodified lines
26682672
26692673 mutex_init(&platform->lock);
26702674 mutex_init(&platform->hdcp_wq_lock);
2675+ mutex_init(&platform->aux_lock);
26712676
26722677 INIT_DELAYED_WORK(&platform->hdcp_work, hdcp_check_work_func);
26732678 platform->hdcp_workqueue = create_workqueue("hdcp workqueue");
drivers/gpu/drm/bridge/analogix/anx7625.h+2−0
@@ -475,6 +475,8 @@ struct anx7625_data { · 474 unmodified lines
475475 struct workqueue_struct *hdcp_workqueue;
476476 /* Lock for hdcp work queue */
477477 struct mutex hdcp_wq_lock;
478+ /* Lock for aux transfer and disable */
479+ struct mutex aux_lock;
478480 char edid_block;
479481 struct display_timing dt;
480482 u8 display_timing_valid;
drivers/gpu/drm/bridge/parade-ps8640.c+23−0
@@ -107,6 +107,7 @@ struct ps8640 { · 106 unmodified lines
107107 struct device_link *link;
108108 bool pre_enabled;
109109 bool need_post_hpd_delay;
110+ struct mutex aux_lock;
110111 };
111112
112113 static const struct regmap_config ps8640_regmap_config[] = {
@@ -345,11 +346,20 @@ static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux, · 232 unmodified lines
345346 struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev;
346347 int ret;
347348
349+ mutex_lock(&ps_bridge->aux_lock);
348350 pm_runtime_get_sync(dev);
351+ ret = _ps8640_wait_hpd_asserted(ps_bridge, 200 * 1000);
352+ if (ret) {
353+ pm_runtime_put_sync_suspend(dev);
354+ goto exit;
355+ }
349356 ret = ps8640_aux_transfer_msg(aux, msg);
350357 pm_runtime_mark_last_busy(dev);
351358 pm_runtime_put_autosuspend(dev);
352359
360+exit:
361+ mutex_unlock(&ps_bridge->aux_lock);
362+
353363 return ret;
354364 }
355365
@@ -470,7 +480,18 @@ static void ps8640_atomic_post_disable(struct drm_bridge *bridge, · 114 unmodified lines
470480 ps_bridge->pre_enabled = false;
471481
472482 ps8640_bridge_vdo_control(ps_bridge, DISABLE);
483+
484+ /*
485+ * The bridge seems to expect everything to be power cycled at the
486+ * disable process, so grab a lock here to make sure
487+ * ps8640_aux_transfer() is not holding a runtime PM reference and
488+ * preventing the bridge from suspend.
489+ */
490+ mutex_lock(&ps_bridge->aux_lock);
491+
473492 pm_runtime_put_sync_suspend(&ps_bridge->page[PAGE0_DP_CNTL]->dev);
493+
494+ mutex_unlock(&ps_bridge->aux_lock);
474495 }
475496
476497 static int ps8640_bridge_attach(struct drm_bridge *bridge,
@@ -619,6 +640,8 @@ static int ps8640_probe(struct i2c_client *client) · 142 unmodified lines
619640 if (!ps_bridge)
620641 return -ENOMEM;
621642
643+ mutex_init(&ps_bridge->aux_lock);
644+
622645 ps_bridge->supplies[0].supply = "vdd12";
623646 ps_bridge->supplies[1].supply = "vdd33";
624647 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies),
drivers/gpu/drm/bridge/samsung-dsim.c+2−30
@@ -969,10 +969,6 @@ static int samsung_dsim_init_link(struct samsung_dsim *dsi) · 968 unmodified lines
969969 reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG);
970970 reg &= ~DSIM_STOP_STATE_CNT_MASK;
971971 reg |= DSIM_STOP_STATE_CNT(driver_data->reg_values[STOP_STATE_CNT]);
972−
973− if (!samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type))
974− reg |= DSIM_FORCE_STOP_STATE;
975−
976972 samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg);
977973
978974 reg = DSIM_BTA_TIMEOUT(0xff) | DSIM_LPDR_TIMEOUT(0xffff);
@@ -1431,18 +1427,6 @@ static void samsung_dsim_disable_irq(struct samsung_dsim *dsi) · 452 unmodified lines
14311427 disable_irq(dsi->irq);
14321428 }
14331429
1434−static void samsung_dsim_set_stop_state(struct samsung_dsim *dsi, bool enable)
1435−{
1436− u32 reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG);
1437−
1438− if (enable)
1439− reg |= DSIM_FORCE_STOP_STATE;
1440− else
1441− reg &= ~DSIM_FORCE_STOP_STATE;
1442−
1443− samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg);
1444−}
1445−
14461430 static int samsung_dsim_init(struct samsung_dsim *dsi)
14471431 {
14481432 const struct samsung_dsim_driver_data *driver_data = dsi->driver_data;
@@ -1492,9 +1476,6 @@ static void samsung_dsim_atomic_pre_enable(struct drm_bridge *bridge, · 43 unmodified lines
14921476 ret = samsung_dsim_init(dsi);
14931477 if (ret)
14941478 return;
1495−
1496− samsung_dsim_set_display_mode(dsi);
1497− samsung_dsim_set_display_enable(dsi, true);
14981479 }
14991480 }
15001481
@@ -1503,12 +1484,8 @@ static void samsung_dsim_atomic_enable(struct drm_bridge *bridge, · 2 unmodified lines
15031484 {
15041485 struct samsung_dsim *dsi = bridge_to_dsi(bridge);
15051486
1506− if (samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type)) {
1507− samsung_dsim_set_display_mode(dsi);
1508− samsung_dsim_set_display_enable(dsi, true);
1509− } else {
1510− samsung_dsim_set_stop_state(dsi, false);
1511− }
1487+ samsung_dsim_set_display_mode(dsi);
1488+ samsung_dsim_set_display_enable(dsi, true);
15121489
15131490 dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE;
15141491 }
@@ -1521,9 +1498,6 @@ static void samsung_dsim_atomic_disable(struct drm_bridge *bridge, · 6 unmodified lines
15211498 if (!(dsi->state & DSIM_STATE_ENABLED))
15221499 return;
15231500
1524− if (!samsung_dsim_hw_is_exynos(dsi->plat_data->hw_type))
1525− samsung_dsim_set_stop_state(dsi, true);
1526−
15271501 dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE;
15281502 }
15291503
@@ -1828,8 +1802,6 @@ static ssize_t samsung_dsim_host_transfer(struct mipi_dsi_host *host, · 298 unmodified lines
18281802 if (ret)
18291803 return ret;
18301804
1831− samsung_dsim_set_stop_state(dsi, false);
1832−
18331805 ret = mipi_dsi_create_packet(&xfer.packet, msg);
18341806 if (ret < 0)
18351807 return ret;
drivers/gpu/drm/bridge/sii902x.c+29−13
@@ -1080,6 +1080,26 @@ static int sii902x_init(struct sii902x *sii902x) · 1079 unmodified lines
10801080 return ret;
10811081 }
10821082
1083+ ret = sii902x_audio_codec_init(sii902x, dev);
1084+ if (ret)
1085+ return ret;
1086+
1087+ i2c_set_clientdata(sii902x->i2c, sii902x);
1088+
1089+ sii902x->i2cmux = i2c_mux_alloc(sii902x->i2c->adapter, dev,
1090+ 1, 0, I2C_MUX_GATE,
1091+ sii902x_i2c_bypass_select,
1092+ sii902x_i2c_bypass_deselect);
1093+ if (!sii902x->i2cmux) {
1094+ ret = -ENOMEM;
1095+ goto err_unreg_audio;
1096+ }
1097+
1098+ sii902x->i2cmux->priv = sii902x;
1099+ ret = i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
1100+ if (ret)
1101+ goto err_unreg_audio;
1102+
10831103 sii902x->bridge.funcs = &sii902x_bridge_funcs;
10841104 sii902x->bridge.of_node = dev->of_node;
10851105 sii902x->bridge.timings = &default_sii902x_timings;
@@ -1090,19 +1110,13 @@ static int sii902x_init(struct sii902x *sii902x) · 4 unmodified lines
10901110
10911111 drm_bridge_add(&sii902x->bridge);
10921112
1093− sii902x_audio_codec_init(sii902x, dev);
1094−
1095− i2c_set_clientdata(sii902x->i2c, sii902x);
1113+ return 0;
10961114
1097− sii902x->i2cmux = i2c_mux_alloc(sii902x->i2c->adapter, dev,
1098− 1, 0, I2C_MUX_GATE,
1099− sii902x_i2c_bypass_select,
1100− sii902x_i2c_bypass_deselect);
1101− if (!sii902x->i2cmux)
1102− return -ENOMEM;
1115+err_unreg_audio:
1116+ if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev))
1117+ platform_device_unregister(sii902x->audio.pdev);
11031118
1104− sii902x->i2cmux->priv = sii902x;
1105− return i2c_mux_add_adapter(sii902x->i2cmux, 0, 0, 0);
1119+ return ret;
11061120 }
11071121
11081122 static int sii902x_probe(struct i2c_client *client)
@@ -1170,12 +1184,14 @@ static int sii902x_probe(struct i2c_client *client) · 61 unmodified lines
11701184 }
11711185
11721186 static void sii902x_remove(struct i2c_client *client)
1173−
11741187 {
11751188 struct sii902x *sii902x = i2c_get_clientdata(client);
11761189
1177− i2c_mux_del_adapters(sii902x->i2cmux);
11781190 drm_bridge_remove(&sii902x->bridge);
1191+ i2c_mux_del_adapters(sii902x->i2cmux);
1192+
1193+ if (!PTR_ERR_OR_ZERO(sii902x->audio.pdev))
1194+ platform_device_unregister(sii902x->audio.pdev);
11791195 }
11801196
11811197 static const struct of_device_id sii902x_dt_ids[] = {
drivers/gpu/drm/display/drm_dp_mst_topology.c+2−0
@@ -5491,6 +5491,7 @@ EXPORT_SYMBOL(drm_dp_mst_atomic_enable_dsc); · 5490 unmodified lines
54915491 * - 0 if the new state is valid
54925492 * - %-ENOSPC, if the new state is invalid, because of BW limitation
54935493 * @failing_port is set to:
5494+ *
54945495 * - The non-root port where a BW limit check failed
54955496 * with all the ports downstream of @failing_port passing
54965497 * the BW limit check.
@@ -5499,6 +5500,7 @@ EXPORT_SYMBOL(drm_dp_mst_atomic_enable_dsc); · 2 unmodified lines
54995500 * - %NULL if the BW limit check failed at the root port
55005501 * with all the ports downstream of the root port passing
55015502 * the BW limit check.
5503+ *
55025504 * - %-EINVAL, if the new state is invalid, because the root port has
55035505 * too many payloads.
55045506 */
drivers/gpu/drm/exynos/exynos5433_drm_decon.c+2−2
@@ -319,9 +319,9 @@ static void decon_win_set_bldmod(struct decon_context *ctx, unsigned int win, · 318 unmodified lines
319319 static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
320320 struct drm_framebuffer *fb)
321321 {
322− struct exynos_drm_plane plane = ctx->planes[win];
322+ struct exynos_drm_plane *plane = &ctx->planes[win];
323323 struct exynos_drm_plane_state *state =
324− to_exynos_plane_state(plane.base.state);
324+ to_exynos_plane_state(plane->base.state);
325325 unsigned int alpha = state->base.alpha;
326326 unsigned int pixel_alpha;
327327 unsigned long val;
drivers/gpu/drm/exynos/exynos_drm_fimd.c+3−3
@@ -480,7 +480,7 @@ static void fimd_commit(struct exynos_drm_crtc *crtc) · 479 unmodified lines
480480 struct fimd_context *ctx = crtc->ctx;
481481 struct drm_display_mode *mode = &crtc->base.state->adjusted_mode;
482482 const struct fimd_driver_data *driver_data = ctx->driver_data;
483− void *timing_base = ctx->regs + driver_data->timing_base;
483+ void __iomem *timing_base = ctx->regs + driver_data->timing_base;
484484 u32 val;
485485
486486 if (ctx->suspended)
@@ -661,9 +661,9 @@ static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, · 174 unmodified lines
661661 static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win,
662662 struct drm_framebuffer *fb, int width)
663663 {
664− struct exynos_drm_plane plane = ctx->planes[win];
664+ struct exynos_drm_plane *plane = &ctx->planes[win];
665665 struct exynos_drm_plane_state *state =
666− to_exynos_plane_state(plane.base.state);
666+ to_exynos_plane_state(plane->base.state);
667667 uint32_t pixel_format = fb->format->format;
668668 unsigned int alpha = state->base.alpha;
669669 u32 val = WINCONx_ENWIN;
drivers/gpu/drm/exynos/exynos_drm_gsc.c+1−1
@@ -1341,7 +1341,7 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev) · 1340 unmodified lines
13411341 for (i = 0; i < ctx->num_clocks; i++) {
13421342 ret = clk_prepare_enable(ctx->clocks[i]);
13431343 if (ret) {
1344− while (--i > 0)
1344+ while (--i >= 0)
13451345 clk_disable_unprepare(ctx->clocks[i]);
13461346 return ret;
13471347 }
drivers/gpu/drm/i915/Makefile+0−1
@@ -17,7 +17,6 @@ subdir-ccflags-y += $(call cc-option, -Wunused-const-variable) · 16 unmodified lines
1717 subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
1818 subdir-ccflags-y += $(call cc-option, -Wformat-overflow)
1919 subdir-ccflags-y += $(call cc-option, -Wformat-truncation)
20−subdir-ccflags-y += $(call cc-option, -Wstringop-overflow)
2120 subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
2221 # The following turn off the warnings enabled by -Wextra
2322 ifeq ($(findstring 2, $(KBUILD_EXTRA_WARN)),)
drivers/gpu/drm/i915/display/icl_dsi.c+1−2
@@ -1155,6 +1155,7 @@ static void gen11_dsi_powerup_panel(struct intel_encoder *encoder) · 1154 unmodified lines
11551155 }
11561156
11571157 intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_INIT_OTP);
1158+ intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DISPLAY_ON);
11581159
11591160 /* ensure all panel commands dispatched before enabling transcoder */
11601161 wait_for_cmds_dispatched_to_panel(encoder);
@@ -1255,8 +1256,6 @@ static void gen11_dsi_enable(struct intel_atomic_state *state, · 94 unmodified lines
12551256 /* step6d: enable dsi transcoder */
12561257 gen11_dsi_enable_transcoder(encoder);
12571258
1258− intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_DISPLAY_ON);
1259−
12601259 /* step7: enable backlight */
12611260 intel_backlight_enable(crtc_state, conn_state);
12621261 intel_dsi_vbt_exec_sequence(intel_dsi, MIPI_SEQ_BACKLIGHT_ON);
drivers/gpu/drm/i915/display/intel_psr.c+12−2
@@ -1525,8 +1525,18 @@ static void intel_psr_enable_source(struct intel_dp *intel_dp, · 1524 unmodified lines
15251525 * can rely on frontbuffer tracking.
15261526 */
15271527 mask = EDP_PSR_DEBUG_MASK_MEMUP |
1528− EDP_PSR_DEBUG_MASK_HPD |
1529− EDP_PSR_DEBUG_MASK_LPSP;
1528+ EDP_PSR_DEBUG_MASK_HPD;
1529+
1530+ /*
1531+ * For some unknown reason on HSW non-ULT (or at least on
1532+ * Dell Latitude E6540) external displays start to flicker
1533+ * when PSR is enabled on the eDP. SR/PC6 residency is much
1534+ * higher than should be possible with an external display.
1535+ * As a workaround leave LPSP unmasked to prevent PSR entry
1536+ * when external displays are active.
1537+ */
1538+ if (DISPLAY_VER(dev_priv) >= 8 || IS_HASWELL_ULT(dev_priv))
1539+ mask |= EDP_PSR_DEBUG_MASK_LPSP;
15301540
15311541 if (DISPLAY_VER(dev_priv) < 20)
15321542 mask |= EDP_PSR_DEBUG_MASK_MAX_SLEEP;
drivers/gpu/drm/nouveau/nouveau_fence.c+5−23
@@ -62,7 +62,7 @@ nouveau_fence_signal(struct nouveau_fence *fence) · 61 unmodified lines
6262 if (test_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags)) {
6363 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
6464
65− if (atomic_dec_and_test(&fctx->notify_ref))
65+ if (!--fctx->notify_ref)
6666 drop = 1;
6767 }
6868
@@ -103,7 +103,6 @@ nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error) · 34 unmodified lines
103103 void
104104 nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
105105 {
106− cancel_work_sync(&fctx->allow_block_work);
107106 nouveau_fence_context_kill(fctx, 0);
108107 nvif_event_dtor(&fctx->event);
109108 fctx->dead = 1;
@@ -168,18 +167,6 @@ nouveau_fence_wait_uevent_handler(struct nvif_event *event, void *repv, u32 repc · 58 unmodified lines
168167 return ret;
169168 }
170169
171−static void
172−nouveau_fence_work_allow_block(struct work_struct *work)
173−{
174− struct nouveau_fence_chan *fctx = container_of(work, struct nouveau_fence_chan,
175− allow_block_work);
176−
177− if (atomic_read(&fctx->notify_ref) == 0)
178− nvif_event_block(&fctx->event);
179− else
180− nvif_event_allow(&fctx->event);
181−}
182−
183170 void
184171 nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
185172 {
@@ -191,7 +178,6 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha · 5 unmodified lines
191178 } args;
192179 int ret;
193180
194− INIT_WORK(&fctx->allow_block_work, nouveau_fence_work_allow_block);
195181 INIT_LIST_HEAD(&fctx->flip);
196182 INIT_LIST_HEAD(&fctx->pending);
197183 spin_lock_init(&fctx->lock);
@@ -535,19 +521,15 @@ static bool nouveau_fence_enable_signaling(struct dma_fence *f) · 337 unmodified lines
535521 struct nouveau_fence *fence = from_fence(f);
536522 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
537523 bool ret;
538− bool do_work;
539524
540− if (atomic_inc_return(&fctx->notify_ref) == 0)
541− do_work = true;
525+ if (!fctx->notify_ref++)
526+ nvif_event_allow(&fctx->event);
542527
543528 ret = nouveau_fence_no_signaling(f);
544529 if (ret)
545530 set_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags);
546− else if (atomic_dec_and_test(&fctx->notify_ref))
547− do_work = true;
548−
549− if (do_work)
550− schedule_work(&fctx->allow_block_work);
531+ else if (!--fctx->notify_ref)
532+ nvif_event_block(&fctx->event);
551533
552534 return ret;
553535 }
drivers/gpu/drm/nouveau/nouveau_fence.h+1−4
@@ -3,7 +3,6 @@ · 2 unmodified lines
33 #define __NOUVEAU_FENCE_H__
44
55 #include <linux/dma-fence.h>
6−#include <linux/workqueue.h>
76 #include <nvif/event.h>
87
98 struct nouveau_drm;
@@ -46,9 +45,7 @@ struct nouveau_fence_chan { · 36 unmodified lines
4645 char name[32];
4746
4847 struct nvif_event event;
49− struct work_struct allow_block_work;
50− atomic_t notify_ref;
51− int dead, killed;
48+ int notify_ref, dead, killed;
5249 };
5350
5451 struct nouveau_fence_priv {
drivers/gpu/drm/panel/Kconfig+2−0
@@ -539,6 +539,8 @@ config DRM_PANEL_RAYDIUM_RM692E5 · 538 unmodified lines
539539 depends on OF
540540 depends on DRM_MIPI_DSI
541541 depends on BACKLIGHT_CLASS_DEVICE
542+ select DRM_DISPLAY_DP_HELPER
543+ select DRM_DISPLAY_HELPER
542544 help
543545 Say Y here if you want to enable support for Raydium RM692E5-based
544546 display panels, such as the one found in the Fairphone 5 smartphone.
drivers/gpu/drm/panel/panel-samsung-s6d7aa0.c+1−1
@@ -309,7 +309,7 @@ static const struct s6d7aa0_panel_desc s6d7aa0_lsl080al02_desc = { · 308 unmodified lines
309309 .off_func = s6d7aa0_lsl080al02_off,
310310 .drm_mode = &s6d7aa0_lsl080al02_mode,
311311 .mode_flags = MIPI_DSI_MODE_VSYNC_FLUSH | MIPI_DSI_MODE_VIDEO_NO_HFP,
312− .bus_flags = DRM_BUS_FLAG_DE_HIGH,
312+ .bus_flags = 0,
313313
314314 .has_backlight = false,
315315 .use_passwd3 = false,
drivers/gpu/drm/panel/panel-simple.c+2−0
@@ -3948,6 +3948,7 @@ static const struct panel_desc tianma_tm070jdhg30 = { · 3947 unmodified lines
39483948 },
39493949 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
39503950 .connector_type = DRM_MODE_CONNECTOR_LVDS,
3951+ .bus_flags = DRM_BUS_FLAG_DE_HIGH,
39513952 };
39523953
39533954 static const struct panel_desc tianma_tm070jvhg33 = {
@@ -3960,6 +3961,7 @@ static const struct panel_desc tianma_tm070jvhg33 = { · 6 unmodified lines
39603961 },
39613962 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
39623963 .connector_type = DRM_MODE_CONNECTOR_LVDS,
3964+ .bus_flags = DRM_BUS_FLAG_DE_HIGH,
39633965 };
39643966
39653967 static const struct display_timing tianma_tm070rvhg71_timing = {
drivers/gpu/drm/scheduler/sched_main.c+7−8
@@ -1178,21 +1178,20 @@ static void drm_sched_run_job_work(struct work_struct *w) · 1177 unmodified lines
11781178 struct drm_sched_entity *entity;
11791179 struct dma_fence *fence;
11801180 struct drm_sched_fence *s_fence;
1181− struct drm_sched_job *sched_job;
1181+ struct drm_sched_job *sched_job = NULL;
11821182 int r;
11831183
11841184 if (READ_ONCE(sched->pause_submit))
11851185 return;
11861186
1187− entity = drm_sched_select_entity(sched);
1187+ /* Find entity with a ready job */
1188+ while (!sched_job && (entity = drm_sched_select_entity(sched))) {
1189+ sched_job = drm_sched_entity_pop_job(entity);
1190+ if (!sched_job)
1191+ complete_all(&entity->entity_idle);
1192+ }
11881193 if (!entity)
1189− return;
1190−
1191− sched_job = drm_sched_entity_pop_job(entity);
1192− if (!sched_job) {
1193− complete_all(&entity->entity_idle);
11941194 return; /* No more work */
1195− }
11961195
11971196 s_fence = sched_job->s_fence;
11981197
drivers/gpu/drm/tests/drm_mm_test.c+4−1
@@ -188,13 +188,13 @@ out: · 187 unmodified lines
188188
189189 static void drm_test_mm_debug(struct kunit *test)
190190 {
191+ struct drm_printer p = drm_debug_printer(test->name);
191192 struct drm_mm mm;
192193 struct drm_mm_node nodes[2];
193194
194195 /* Create a small drm_mm with a couple of nodes and a few holes, and
195196 * check that the debug iterator doesn't explode over a trivial drm_mm.
196197 */
197−
198198 drm_mm_init(&mm, 0, 4096);
199199
200200 memset(nodes, 0, sizeof(nodes));
@@ -209,6 +209,9 @@ static void drm_test_mm_debug(struct kunit *test) · 8 unmodified lines
209209 KUNIT_ASSERT_FALSE_MSG(test, drm_mm_reserve_node(&mm, &nodes[1]),
210210 "failed to reserve node[0] {start=%lld, size=%lld)\n",
211211 nodes[0].start, nodes[0].size);
212+
213+ drm_mm_print(&mm, &p);
214+ KUNIT_SUCCEED(test);
212215 }
213216
214217 static bool expect_insert(struct kunit *test, struct drm_mm *mm,
drivers/gpu/drm/ttm/ttm_device.c+9−3
@@ -95,11 +95,17 @@ static int ttm_global_init(void) · 94 unmodified lines
9595 ttm_pool_mgr_init(num_pages);
9696 ttm_tt_mgr_init(num_pages, num_dma32);
9797
98− glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32);
98+ glob->dummy_read_page = alloc_page(__GFP_ZERO | GFP_DMA32 |
99+ __GFP_NOWARN);
99100
101+ /* Retry without GFP_DMA32 for platforms DMA32 is not available */
100102 if (unlikely(glob->dummy_read_page == NULL)) {
101− ret = -ENOMEM;
102− goto out;
103+ glob->dummy_read_page = alloc_page(__GFP_ZERO);
104+ if (unlikely(glob->dummy_read_page == NULL)) {
105+ ret = -ENOMEM;
106+ goto out;
107+ }
108+ pr_warn("Using GFP_DMA32 fallback for dummy_read_page\n");
103109 }
104110
105111 INIT_LIST_HEAD(&glob->device_list);
drivers/gpu/drm/v3d/v3d_submit.c+28−7
@@ -147,6 +147,13 @@ v3d_job_allocate(void **container, size_t size) · 146 unmodified lines
147147 return 0;
148148 }
149149
150+static void
151+v3d_job_deallocate(void **container)
152+{
153+ kfree(*container);
154+ *container = NULL;
155+}
156+
150157 static int
151158 v3d_job_init(struct v3d_dev *v3d, struct drm_file *file_priv,
152159 struct v3d_job *job, void (*free)(struct kref *ref),
@@ -273,8 +280,10 @@ v3d_setup_csd_jobs_and_bos(struct drm_file *file_priv, · 120 unmodified lines
273280
274281 ret = v3d_job_init(v3d, file_priv, &(*job)->base,
275282 v3d_job_free, args->in_sync, se, V3D_CSD);
276− if (ret)
283+ if (ret) {
284+ v3d_job_deallocate((void *)job);
277285 return ret;
286+ }
278287
279288 ret = v3d_job_allocate((void *)clean_job, sizeof(**clean_job));
280289 if (ret)
@@ -282,8 +291,10 @@ v3d_setup_csd_jobs_and_bos(struct drm_file *file_priv, · 1 unmodified line
282291
283292 ret = v3d_job_init(v3d, file_priv, *clean_job,
284293 v3d_job_free, 0, NULL, V3D_CACHE_CLEAN);
285− if (ret)
294+ if (ret) {
295+ v3d_job_deallocate((void *)clean_job);
286296 return ret;
297+ }
287298
288299 (*job)->args = *args;
289300
@@ -860,8 +871,10 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, · 570 unmodified lines
860871
861872 ret = v3d_job_init(v3d, file_priv, &render->base,
862873 v3d_render_job_free, args->in_sync_rcl, &se, V3D_RENDER);
863− if (ret)
874+ if (ret) {
875+ v3d_job_deallocate((void *)&render);
864876 goto fail;
877+ }
865878
866879 render->start = args->rcl_start;
867880 render->end = args->rcl_end;
@@ -874,8 +887,10 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, · 6 unmodified lines
874887
875888 ret = v3d_job_init(v3d, file_priv, &bin->base,
876889 v3d_job_free, args->in_sync_bcl, &se, V3D_BIN);
877− if (ret)
890+ if (ret) {
891+ v3d_job_deallocate((void *)&bin);
878892 goto fail;
893+ }
879894
880895 bin->start = args->bcl_start;
881896 bin->end = args->bcl_end;
@@ -892,8 +907,10 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, · 10 unmodified lines
892907
893908 ret = v3d_job_init(v3d, file_priv, clean_job,
894909 v3d_job_free, 0, NULL, V3D_CACHE_CLEAN);
895− if (ret)
910+ if (ret) {
911+ v3d_job_deallocate((void *)&clean_job);
896912 goto fail;
913+ }
897914
898915 last_job = clean_job;
899916 } else {
@@ -1015,8 +1032,10 @@ v3d_submit_tfu_ioctl(struct drm_device *dev, void *data, · 115 unmodified lines
10151032
10161033 ret = v3d_job_init(v3d, file_priv, &job->base,
10171034 v3d_job_free, args->in_sync, &se, V3D_TFU);
1018− if (ret)
1035+ if (ret) {
1036+ v3d_job_deallocate((void *)&job);
10191037 goto fail;
1038+ }
10201039
10211040 job->base.bo = kcalloc(ARRAY_SIZE(args->bo_handles),
10221041 sizeof(*job->base.bo), GFP_KERNEL);
@@ -1233,8 +1252,10 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data, · 210 unmodified lines
12331252
12341253 ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
12351254 v3d_job_free, 0, &se, V3D_CPU);
1236− if (ret)
1255+ if (ret) {
1256+ v3d_job_deallocate((void *)&cpu_job);
12371257 goto fail;
1258+ }
12381259
12391260 clean_job = cpu_job->indirect_csd.clean_job;
12401261 csd_job = cpu_job->indirect_csd.job;
drivers/gpu/drm/xe/compat-i915-headers/gem/i915_gem_object.h+5−6
@@ -35,12 +35,10 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo, · 34 unmodified lines
3535 u32 ofs, u64 *ptr, u32 size)
3636 {
3737 struct ttm_bo_kmap_obj map;
38− void *virtual;
38+ void *src;
3939 bool is_iomem;
4040 int ret;
4141
42− XE_WARN_ON(size != 8);
43−
4442 ret = xe_bo_lock(bo, true);
4543 if (ret)
4644 return ret;
@@ -50,11 +48,12 @@ static inline int i915_gem_object_read_from_page(struct xe_bo *bo, · 3 unmodified lines
5048 goto out_unlock;
5149
5250 ofs &= ~PAGE_MASK;
53− virtual = ttm_kmap_obj_virtual(&map, &is_iomem);
51+ src = ttm_kmap_obj_virtual(&map, &is_iomem);
52+ src += ofs;
5453 if (is_iomem)
55− *ptr = readq((void __iomem *)(virtual + ofs));
54+ memcpy_fromio(ptr, (void __iomem *)src, size);
5655 else
57− *ptr = *(u64 *)(virtual + ofs);
56+ memcpy(ptr, src, size);
5857
5958 ttm_bo_kunmap(&map);
6059 out_unlock:
drivers/gpu/drm/xe/tests/xe_wa_test.c+0−3
@@ -74,9 +74,6 @@ static const struct platform_test_case cases[] = { · 73 unmodified lines
7474 SUBPLATFORM_CASE(DG2, G11, B1),
7575 SUBPLATFORM_CASE(DG2, G12, A0),
7676 SUBPLATFORM_CASE(DG2, G12, A1),
77− PLATFORM_CASE(PVC, B0),
78− PLATFORM_CASE(PVC, B1),
79− PLATFORM_CASE(PVC, C0),
8077 GMDID_CASE(METEORLAKE, 1270, A0, 1300, A0),
8178 GMDID_CASE(METEORLAKE, 1271, A0, 1300, A0),
8279 GMDID_CASE(LUNARLAKE, 2004, A0, 2000, A0),
drivers/gpu/drm/xe/xe_device.c+1−1
@@ -613,7 +613,7 @@ void xe_device_wmb(struct xe_device *xe) · 612 unmodified lines
613613 u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size)
614614 {
615615 return xe_device_has_flat_ccs(xe) ?
616− DIV_ROUND_UP(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0;
616+ DIV_ROUND_UP_ULL(size, NUM_BYTES_PER_CCS_BYTE(xe)) : 0;
617617 }
618618
619619 bool xe_device_mem_access_ongoing(struct xe_device *xe)
drivers/gpu/drm/xe/xe_dma_buf.c+1−1
@@ -175,7 +175,7 @@ static int xe_dma_buf_begin_cpu_access(struct dma_buf *dma_buf, · 174 unmodified lines
175175 return 0;
176176 }
177177
178−const struct dma_buf_ops xe_dmabuf_ops = {
178+static const struct dma_buf_ops xe_dmabuf_ops = {
179179 .attach = xe_dma_buf_attach,
180180 .detach = xe_dma_buf_detach,
181181 .pin = xe_dma_buf_pin,
drivers/gpu/drm/xe/xe_hwmon.c+1−1
@@ -419,7 +419,7 @@ static int xe_hwmon_pcode_read_i1(struct xe_gt *gt, u32 *uval) · 418 unmodified lines
419419
420420 return xe_pcode_read(gt, PCODE_MBOX(PCODE_POWER_SETUP,
421421 POWER_SETUP_SUBCOMMAND_READ_I1, 0),
422− uval, 0);
422+ uval, NULL);
423423 }
424424
425425 static int xe_hwmon_pcode_write_i1(struct xe_gt *gt, u32 uval)
drivers/gpu/drm/xe/xe_migrate.c+7−7
@@ -472,7 +472,7 @@ static void emit_pte(struct xe_migrate *m, · 471 unmodified lines
472472 /* Indirect access needs compression enabled uncached PAT index */
473473 if (GRAPHICS_VERx100(xe) >= 2000)
474474 pat_index = is_comp_pte ? xe->pat.idx[XE_CACHE_NONE_COMPRESSION] :
475− xe->pat.idx[XE_CACHE_NONE];
475+ xe->pat.idx[XE_CACHE_WB];
476476 else
477477 pat_index = xe->pat.idx[XE_CACHE_WB];
478478
@@ -760,14 +760,14 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m, · 281 unmodified lines
760760 if (src_is_vram && xe_migrate_allow_identity(src_L0, &src_it))
761761 xe_res_next(&src_it, src_L0);
762762 else
763− emit_pte(m, bb, src_L0_pt, src_is_vram, true, &src_it, src_L0,
764− src);
763+ emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs,
764+ &src_it, src_L0, src);
765765
766766 if (dst_is_vram && xe_migrate_allow_identity(src_L0, &dst_it))
767767 xe_res_next(&dst_it, src_L0);
768768 else
769− emit_pte(m, bb, dst_L0_pt, dst_is_vram, true, &dst_it, src_L0,
770− dst);
769+ emit_pte(m, bb, dst_L0_pt, dst_is_vram, copy_system_ccs,
770+ &dst_it, src_L0, dst);
771771
772772 if (copy_system_ccs)
773773 emit_pte(m, bb, ccs_pt, false, false, &ccs_it, ccs_size, src);
@@ -1009,8 +1009,8 @@ struct dma_fence *xe_migrate_clear(struct xe_migrate *m, · 235 unmodified lines
10091009 if (clear_vram && xe_migrate_allow_identity(clear_L0, &src_it))
10101010 xe_res_next(&src_it, clear_L0);
10111011 else
1012− emit_pte(m, bb, clear_L0_pt, clear_vram, true, &src_it, clear_L0,
1013− dst);
1012+ emit_pte(m, bb, clear_L0_pt, clear_vram, clear_system_ccs,
1013+ &src_it, clear_L0, dst);
10141014
10151015 bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
10161016 update_idx = bb->len;
drivers/gpu/drm/xe/xe_mmio.c+2−2
@@ -272,8 +272,8 @@ int xe_mmio_probe_vram(struct xe_device *xe) · 271 unmodified lines
272272 drm_info(&xe->drm, "VRAM[%u, %u]: Actual physical size %pa, usable size exclude stolen %pa, CPU accessible size %pa\n", id,
273273 tile->id, &tile->mem.vram.actual_physical_size, &tile->mem.vram.usable_size, &tile->mem.vram.io_size);
274274 drm_info(&xe->drm, "VRAM[%u, %u]: DPA range: [%pa-%llx], io range: [%pa-%llx]\n", id, tile->id,
275− &tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + tile->mem.vram.actual_physical_size,
276− &tile->mem.vram.io_start, tile->mem.vram.io_start + tile->mem.vram.io_size);
275+ &tile->mem.vram.dpa_base, tile->mem.vram.dpa_base + (u64)tile->mem.vram.actual_physical_size,
276+ &tile->mem.vram.io_start, tile->mem.vram.io_start + (u64)tile->mem.vram.io_size);
277277
278278 /* calculate total size using tile size to get the correct HW sizing */
279279 total_size += tile_size;
drivers/gpu/drm/xe/xe_vm.c+14−9
@@ -1855,10 +1855,8 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data, · 1854 unmodified lines
18551855 mutex_lock(&xef->vm.lock);
18561856 err = xa_alloc(&xef->vm.xa, &id, vm, xa_limit_32b, GFP_KERNEL);
18571857 mutex_unlock(&xef->vm.lock);
1858− if (err) {
1859− xe_vm_close_and_put(vm);
1860− return err;
1861− }
1858+ if (err)
1859+ goto err_close_and_put;
18621860
18631861 if (xe->info.has_asid) {
18641862 mutex_lock(&xe->usm.lock);
@@ -1866,11 +1864,9 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data, · 1 unmodified line
18661864 XA_LIMIT(1, XE_MAX_ASID - 1),
18671865 &xe->usm.next_asid, GFP_KERNEL);
18681866 mutex_unlock(&xe->usm.lock);
1869− if (err < 0) {
1870− xe_vm_close_and_put(vm);
1871− return err;
1872− }
1873− err = 0;
1867+ if (err < 0)
1868+ goto err_free_id;
1869+
18741870 vm->usm.asid = asid;
18751871 }
18761872
@@ -1888,6 +1884,15 @@ int xe_vm_create_ioctl(struct drm_device *dev, void *data, · 11 unmodified lines
18881884 #endif
18891885
18901886 return 0;
1887+
1888+err_free_id:
1889+ mutex_lock(&xef->vm.lock);
1890+ xa_erase(&xef->vm.xa, id);
1891+ mutex_unlock(&xef->vm.lock);
1892+err_close_and_put:
1893+ xe_vm_close_and_put(vm);
1894+
1895+ return err;
18911896 }
18921897
18931898 int xe_vm_destroy_ioctl(struct drm_device *dev, void *data,
drivers/hid/bpf/hid_bpf_dispatch.c+74−27
@@ -143,6 +143,9 @@ u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *s · 142 unmodified lines
143143 }
144144 EXPORT_SYMBOL_GPL(call_hid_bpf_rdesc_fixup);
145145
146+/* Disables missing prototype warnings */
147+__bpf_kfunc_start_defs();
148+
146149 /**
147150 * hid_bpf_get_data - Get the kernel memory pointer associated with the context @ctx
148151 *
@@ -152,7 +155,7 @@ EXPORT_SYMBOL_GPL(call_hid_bpf_rdesc_fixup); · 3 unmodified lines
152155 *
153156 * @returns %NULL on error, an %__u8 memory pointer on success
154157 */
155−noinline __u8 *
158+__bpf_kfunc __u8 *
156159 hid_bpf_get_data(struct hid_bpf_ctx *ctx, unsigned int offset, const size_t rdwr_buf_size)
157160 {
158161 struct hid_bpf_ctx_kern *ctx_kern;
@@ -167,6 +170,7 @@ hid_bpf_get_data(struct hid_bpf_ctx *ctx, unsigned int offset, const size_t rdwr · 8 unmodified lines
167170
168171 return ctx_kern->data + offset;
169172 }
173+__bpf_kfunc_end_defs();
170174
171175 /*
172176 * The following set contains all functions we agree BPF programs
@@ -241,6 +245,42 @@ int hid_bpf_reconnect(struct hid_device *hdev) · 68 unmodified lines
241245 return 0;
242246 }
243247
248+static int do_hid_bpf_attach_prog(struct hid_device *hdev, int prog_fd, struct bpf_prog *prog,
249+ __u32 flags)
250+{
251+ int fd, err, prog_type;
252+
253+ prog_type = hid_bpf_get_prog_attach_type(prog);
254+ if (prog_type < 0)
255+ return prog_type;
256+
257+ if (prog_type >= HID_BPF_PROG_TYPE_MAX)
258+ return -EINVAL;
259+
260+ if (prog_type == HID_BPF_PROG_TYPE_DEVICE_EVENT) {
261+ err = hid_bpf_allocate_event_data(hdev);
262+ if (err)
263+ return err;
264+ }
265+
266+ fd = __hid_bpf_attach_prog(hdev, prog_type, prog_fd, prog, flags);
267+ if (fd < 0)
268+ return fd;
269+
270+ if (prog_type == HID_BPF_PROG_TYPE_RDESC_FIXUP) {
271+ err = hid_bpf_reconnect(hdev);
272+ if (err) {
273+ close_fd(fd);
274+ return err;
275+ }
276+ }
277+
278+ return fd;
279+}
280+
281+/* Disables missing prototype warnings */
282+__bpf_kfunc_start_defs();
283+
244284 /**
245285 * hid_bpf_attach_prog - Attach the given @prog_fd to the given HID device
246286 *
@@ -253,22 +293,17 @@ int hid_bpf_reconnect(struct hid_device *hdev) · 6 unmodified lines
253293 * is pinned to the BPF file system).
254294 */
255295 /* called from syscall */
256−noinline int
296+__bpf_kfunc int
257297 hid_bpf_attach_prog(unsigned int hid_id, int prog_fd, __u32 flags)
258298 {
259299 struct hid_device *hdev;
300+ struct bpf_prog *prog;
260301 struct device *dev;
261− int fd, err, prog_type = hid_bpf_get_prog_attach_type(prog_fd);
302+ int err, fd;
262303
263304 if (!hid_bpf_ops)
264305 return -EINVAL;
265306
266− if (prog_type < 0)
267− return prog_type;
268−
269− if (prog_type >= HID_BPF_PROG_TYPE_MAX)
270− return -EINVAL;
271−
272307 if ((flags & ~HID_BPF_FLAG_MASK))
273308 return -EINVAL;
274309
@@ -278,25 +313,29 @@ hid_bpf_attach_prog(unsigned int hid_id, int prog_fd, __u32 flags) · 3 unmodified lines
278313
279314 hdev = to_hid_device(dev);
280315
281− if (prog_type == HID_BPF_PROG_TYPE_DEVICE_EVENT) {
282− err = hid_bpf_allocate_event_data(hdev);
283− if (err)
284− return err;
316+ /*
317+ * take a ref on the prog itself, it will be released
318+ * on errors or when it'll be detached
319+ */
320+ prog = bpf_prog_get(prog_fd);
321+ if (IS_ERR(prog)) {
322+ err = PTR_ERR(prog);
323+ goto out_dev_put;
285324 }
286325
287− fd = __hid_bpf_attach_prog(hdev, prog_type, prog_fd, flags);
288− if (fd < 0)
289− return fd;
290−
291− if (prog_type == HID_BPF_PROG_TYPE_RDESC_FIXUP) {
292− err = hid_bpf_reconnect(hdev);
293− if (err) {
294− close_fd(fd);
295− return err;
296− }
326+ fd = do_hid_bpf_attach_prog(hdev, prog_fd, prog, flags);
327+ if (fd < 0) {
328+ err = fd;
329+ goto out_prog_put;
297330 }
298331
299332 return fd;
333+
334+ out_prog_put:
335+ bpf_prog_put(prog);
336+ out_dev_put:
337+ put_device(dev);
338+ return err;
300339 }
301340
302341 /**
@@ -306,7 +345,7 @@ hid_bpf_attach_prog(unsigned int hid_id, int prog_fd, __u32 flags) · 3 unmodified lines
306345 *
307346 * @returns A pointer to &struct hid_bpf_ctx on success, %NULL on error.
308347 */
309−noinline struct hid_bpf_ctx *
348+__bpf_kfunc struct hid_bpf_ctx *
310349 hid_bpf_allocate_context(unsigned int hid_id)
311350 {
312351 struct hid_device *hdev;
@@ -323,8 +362,10 @@ hid_bpf_allocate_context(unsigned int hid_id) · 10 unmodified lines
323362 hdev = to_hid_device(dev);
324363
325364 ctx_kern = kzalloc(sizeof(*ctx_kern), GFP_KERNEL);
326− if (!ctx_kern)
365+ if (!ctx_kern) {
366+ put_device(dev);
327367 return NULL;
368+ }
328369
329370 ctx_kern->ctx.hid = hdev;
330371
@@ -337,14 +378,19 @@ hid_bpf_allocate_context(unsigned int hid_id) · 6 unmodified lines
337378 * @ctx: the HID-BPF context to release
338379 *
339380 */
340−noinline void
381+__bpf_kfunc void
341382 hid_bpf_release_context(struct hid_bpf_ctx *ctx)
342383 {
343384 struct hid_bpf_ctx_kern *ctx_kern;
385+ struct hid_device *hid;
344386
345387 ctx_kern = container_of(ctx, struct hid_bpf_ctx_kern, ctx);
388+ hid = (struct hid_device *)ctx_kern->ctx.hid; /* ignore const */
346389
347390 kfree(ctx_kern);
391+
392+ /* get_device() is called by bus_find_device() */
393+ put_device(&hid->dev);
348394 }
349395
350396 /**
@@ -358,7 +404,7 @@ hid_bpf_release_context(struct hid_bpf_ctx *ctx) · 7 unmodified lines
358404 *
359405 * @returns %0 on success, a negative error code otherwise.
360406 */
361−noinline int
407+__bpf_kfunc int
362408 hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
363409 enum hid_report_type rtype, enum hid_class_request reqtype)
364410 {
@@ -426,6 +472,7 @@ hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz, · 61 unmodified lines
426472 kfree(dma_data);
427473 return ret;
428474 }
475+__bpf_kfunc_end_defs();
429476
430477 /* our HID-BPF entrypoints */
431478 BTF_SET8_START(hid_bpf_fmodret_ids)
drivers/hid/bpf/hid_bpf_dispatch.h+2−2
@@ -12,9 +12,9 @@ struct hid_bpf_ctx_kern { · 11 unmodified lines
1212
1313 int hid_bpf_preload_skel(void);
1414 void hid_bpf_free_links_and_skel(void);
15−int hid_bpf_get_prog_attach_type(int prog_fd);
15+int hid_bpf_get_prog_attach_type(struct bpf_prog *prog);
1616 int __hid_bpf_attach_prog(struct hid_device *hdev, enum hid_bpf_prog_type prog_type, int prog_fd,
17− __u32 flags);
17+ struct bpf_prog *prog, __u32 flags);
1818 void __hid_bpf_destroy_device(struct hid_device *hdev);
1919 int hid_bpf_prog_run(struct hid_device *hdev, enum hid_bpf_prog_type type,
2020 struct hid_bpf_ctx_kern *ctx_kern);
drivers/hid/bpf/hid_bpf_jmp_table.c+20−20
@@ -196,6 +196,7 @@ static void __hid_bpf_do_release_prog(int map_fd, unsigned int idx) · 195 unmodified lines
196196 static void hid_bpf_release_progs(struct work_struct *work)
197197 {
198198 int i, j, n, map_fd = -1;
199+ bool hdev_destroyed;
199200
200201 if (!jmp_table.map)
201202 return;
@@ -220,6 +221,12 @@ static void hid_bpf_release_progs(struct work_struct *work) · 18 unmodified lines
220221 if (entry->hdev) {
221222 hdev = entry->hdev;
222223 type = entry->type;
224+ /*
225+ * hdev is still valid, even if we are called after hid_destroy_device():
226+ * when hid_bpf_attach() gets called, it takes a ref on the dev through
227+ * bus_find_device()
228+ */
229+ hdev_destroyed = hdev->bpf.destroyed;
223230
224231 hid_bpf_populate_hdev(hdev, type);
225232
@@ -232,12 +239,19 @@ static void hid_bpf_release_progs(struct work_struct *work) · 6 unmodified lines
232239 if (test_bit(next->idx, jmp_table.enabled))
233240 continue;
234241
235− if (next->hdev == hdev && next->type == type)
242+ if (next->hdev == hdev && next->type == type) {
243+ /*
244+ * clear the hdev reference and decrement the device ref
245+ * that was taken during bus_find_device() while calling
246+ * hid_bpf_attach()
247+ */
236248 next->hdev = NULL;
249+ put_device(&hdev->dev);
250+ }
237251 }
238252
239− /* if type was rdesc fixup, reconnect device */
240− if (type == HID_BPF_PROG_TYPE_RDESC_FIXUP)
253+ /* if type was rdesc fixup and the device is not gone, reconnect device */
254+ if (type == HID_BPF_PROG_TYPE_RDESC_FIXUP && !hdev_destroyed)
241255 hid_bpf_reconnect(hdev);
242256 }
243257 }
@@ -333,15 +347,10 @@ static int hid_bpf_insert_prog(int prog_fd, struct bpf_prog *prog) · 89 unmodified lines
333347 return err;
334348 }
335349
336−int hid_bpf_get_prog_attach_type(int prog_fd)
350+int hid_bpf_get_prog_attach_type(struct bpf_prog *prog)
337351 {
338− struct bpf_prog *prog = NULL;
339− int i;
340352 int prog_type = HID_BPF_PROG_TYPE_UNDEF;
341−
342− prog = bpf_prog_get(prog_fd);
343− if (IS_ERR(prog))
344− return PTR_ERR(prog);
353+ int i;
345354
346355 for (i = 0; i < HID_BPF_PROG_TYPE_MAX; i++) {
347356 if (hid_bpf_btf_ids[i] == prog->aux->attach_btf_id) {
@@ -350,8 +359,6 @@ int hid_bpf_get_prog_attach_type(int prog_fd) · 2 unmodified lines
350359 }
351360 }
352361
353− bpf_prog_put(prog);
354−
355362 return prog_type;
356363 }
357364
@@ -388,19 +395,13 @@ static const struct bpf_link_ops hid_bpf_link_lops = { · 30 unmodified lines
388395 /* called from syscall */
389396 noinline int
390397 __hid_bpf_attach_prog(struct hid_device *hdev, enum hid_bpf_prog_type prog_type,
391− int prog_fd, __u32 flags)
398+ int prog_fd, struct bpf_prog *prog, __u32 flags)
392399 {
393400 struct bpf_link_primer link_primer;
394401 struct hid_bpf_link *link;
395− struct bpf_prog *prog = NULL;
396402 struct hid_bpf_prog_entry *prog_entry;
397403 int cnt, err = -EINVAL, prog_table_idx = -1;
398404
399− /* take a ref on the prog itself */
400− prog = bpf_prog_get(prog_fd);
401− if (IS_ERR(prog))
402− return PTR_ERR(prog);
403−
404405 mutex_lock(&hid_bpf_attach_lock);
405406
406407 link = kzalloc(sizeof(*link), GFP_USER);
@@ -467,7 +468,6 @@ __hid_bpf_attach_prog(struct hid_device *hdev, enum hid_bpf_prog_type prog_type, · 60 unmodified lines
467468 err_unlock:
468469 mutex_unlock(&hid_bpf_attach_lock);
469470
470− bpf_prog_put(prog);
471471 kfree(link);
472472
473473 return err;
drivers/hid/hid-ids.h+3−0
@@ -298,6 +298,9 @@ · 297 unmodified lines
298298
299299 #define USB_VENDOR_ID_CIDC 0x1677
300300
301+#define I2C_VENDOR_ID_CIRQUE 0x0488
302+#define I2C_PRODUCT_ID_CIRQUE_1063 0x1063
303+
301304 #define USB_VENDOR_ID_CJTOUCH 0x24b8
302305 #define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020
303306 #define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040 0x0040
drivers/hid/hid-logitech-hidpp.c+2−0
@@ -4610,6 +4610,8 @@ static const struct hid_device_id hidpp_devices[] = { · 4609 unmodified lines
46104610 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC088) },
46114611 { /* Logitech G Pro X Superlight Gaming Mouse over USB */
46124612 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC094) },
4613+ { /* Logitech G Pro X Superlight 2 Gaming Mouse over USB */
4614+ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC09b) },
46134615
46144616 { /* G935 Gaming Headset */
46154617 HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0x0a87),
drivers/hid/hid-nvidia-shield.c+4−0
@@ -800,6 +800,8 @@ static inline int thunderstrike_led_create(struct thunderstrike *ts) · 799 unmodified lines
800800
801801 led->name = devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
802802 "thunderstrike%d:blue:led", ts->id);
803+ if (!led->name)
804+ return -ENOMEM;
803805 led->max_brightness = 1;
804806 led->flags = LED_CORE_SUSPENDRESUME | LED_RETAIN_AT_SHUTDOWN;
805807 led->brightness_get = &thunderstrike_led_get_brightness;
@@ -831,6 +833,8 @@ static inline int thunderstrike_psy_create(struct shield_device *shield_dev) · 25 unmodified lines
831833 shield_dev->battery_dev.desc.name =
832834 devm_kasprintf(&ts->base.hdev->dev, GFP_KERNEL,
833835 "thunderstrike_%d", ts->id);
836+ if (!shield_dev->battery_dev.desc.name)
837+ return -ENOMEM;
834838
835839 shield_dev->battery_dev.psy = power_supply_register(
836840 &hdev->dev, &shield_dev->battery_dev.desc, &psy_cfg);
drivers/hid/hid-steam.c+18−18
@@ -1109,10 +1109,9 @@ static int steam_probe(struct hid_device *hdev, · 1108 unmodified lines
11091109 return hid_hw_start(hdev, HID_CONNECT_DEFAULT);
11101110
11111111 steam = devm_kzalloc(&hdev->dev, sizeof(*steam), GFP_KERNEL);
1112− if (!steam) {
1113− ret = -ENOMEM;
1114− goto steam_alloc_fail;
1115− }
1112+ if (!steam)
1113+ return -ENOMEM;
1114+
11161115 steam->hdev = hdev;
11171116 hid_set_drvdata(hdev, steam);
11181117 spin_lock_init(&steam->lock);
@@ -1129,14 +1128,14 @@ static int steam_probe(struct hid_device *hdev, · 10 unmodified lines
11291128 */
11301129 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_HIDRAW);
11311130 if (ret)
1132− goto hid_hw_start_fail;
1131+ goto err_cancel_work;
11331132
11341133 ret = hid_hw_open(hdev);
11351134 if (ret) {
11361135 hid_err(hdev,
11371136 "%s:hid_hw_open\n",
11381137 __func__);
1139− goto hid_hw_open_fail;
1138+ goto err_hw_stop;
11401139 }
11411140
11421141 if (steam->quirks & STEAM_QUIRK_WIRELESS) {
@@ -1152,36 +1151,37 @@ static int steam_probe(struct hid_device *hdev, · 9 unmodified lines
11521151 hid_err(hdev,
11531152 "%s:steam_register failed with error %d\n",
11541153 __func__, ret);
1155− goto input_register_fail;
1154+ goto err_hw_close;
11561155 }
11571156 }
11581157
11591158 steam->client_hdev = steam_create_client_hid(hdev);
11601159 if (IS_ERR(steam->client_hdev)) {
11611160 ret = PTR_ERR(steam->client_hdev);
1162− goto client_hdev_fail;
1161+ goto err_stream_unregister;
11631162 }
11641163 steam->client_hdev->driver_data = steam;
11651164
11661165 ret = hid_add_device(steam->client_hdev);
11671166 if (ret)
1168− goto client_hdev_add_fail;
1167+ goto err_destroy;
11691168
11701169 return 0;
11711170
1172−client_hdev_add_fail:
1173− hid_hw_stop(hdev);
1174−client_hdev_fail:
1171+err_destroy:
11751172 hid_destroy_device(steam->client_hdev);
1176−input_register_fail:
1177−hid_hw_open_fail:
1178−hid_hw_start_fail:
1173+err_stream_unregister:
1174+ if (steam->connected)
1175+ steam_unregister(steam);
1176+err_hw_close:
1177+ hid_hw_close(hdev);
1178+err_hw_stop:
1179+ hid_hw_stop(hdev);
1180+err_cancel_work:
11791181 cancel_work_sync(&steam->work_connect);
11801182 cancel_delayed_work_sync(&steam->mode_switch);
11811183 cancel_work_sync(&steam->rumble_work);
1182−steam_alloc_fail:
1183− hid_err(hdev, "%s: failed with error %d\n",
1184− __func__, ret);
1184+
11851185 return ret;
11861186 }
11871187
drivers/hid/hidraw.c+5−2
@@ -357,8 +357,11 @@ static int hidraw_release(struct inode * inode, struct file * file) · 356 unmodified lines
357357 down_write(&minors_rwsem);
358358
359359 spin_lock_irqsave(&hidraw_table[minor]->list_lock, flags);
360− for (int i = list->tail; i < list->head; i++)
361− kfree(list->buffer[i].value);
360+ while (list->tail != list->head) {
361+ kfree(list->buffer[list->tail].value);
362+ list->buffer[list->tail].value = NULL;
363+ list->tail = (list->tail + 1) & (HIDRAW_BUFFER_SIZE - 1);
364+ }
362365 list_del(&list->node);
363366 spin_unlock_irqrestore(&hidraw_table[minor]->list_lock, flags);
364367 kfree(list);
drivers/hid/i2c-hid/i2c-hid-core.c+5−1
@@ -49,6 +49,7 @@ · 48 unmodified lines
4949 #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(2)
5050 #define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(3)
5151 #define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET BIT(4)
52+#define I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND BIT(5)
5253
5354 /* Command opcodes */
5455 #define I2C_HID_OPCODE_RESET 0x01
@@ -131,6 +132,8 @@ static const struct i2c_hid_quirks { · 76 unmodified lines
131132 I2C_HID_QUIRK_RESET_ON_RESUME },
132133 { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
133134 I2C_HID_QUIRK_BAD_INPUT_SIZE },
135+ { I2C_VENDOR_ID_CIRQUE, I2C_PRODUCT_ID_CIRQUE_1063,
136+ I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND },
134137 /*
135138 * Sending the wakeup after reset actually break ELAN touchscreen controller
136139 */
@@ -956,7 +959,8 @@ static int i2c_hid_core_suspend(struct i2c_hid *ihid, bool force_poweroff) · 819 unmodified lines
956959 return ret;
957960
958961 /* Save some power */
959− i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP);
962+ if (!(ihid->quirks & I2C_HID_QUIRK_NO_SLEEP_ON_SUSPEND))
963+ i2c_hid_set_power(ihid, I2C_HID_PWR_SLEEP);
960964
961965 disable_irq(client->irq);
962966
drivers/hid/i2c-hid/i2c-hid-of.c+1−0
@@ -87,6 +87,7 @@ static int i2c_hid_of_probe(struct i2c_client *client) · 86 unmodified lines
8787 if (!ihid_of)
8888 return -ENOMEM;
8989
90+ ihid_of->client = client;
9091 ihid_of->ops.power_up = i2c_hid_of_power_up;
9192 ihid_of->ops.power_down = i2c_hid_of_power_down;
9293
drivers/md/raid1.c+1−1
@@ -2262,7 +2262,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio) · 2261 unmodified lines
22622262 int sectors = r1_bio->sectors;
22632263 int read_disk = r1_bio->read_disk;
22642264 struct mddev *mddev = conf->mddev;
2265− struct md_rdev *rdev = rcu_dereference(conf->mirrors[read_disk].rdev);
2265+ struct md_rdev *rdev = conf->mirrors[read_disk].rdev;
22662266
22672267 if (exceed_read_errors(mddev, rdev)) {
22682268 r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED;
drivers/media/common/videobuf2/videobuf2-core.c+1−1
@@ -989,7 +989,7 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, · 988 unmodified lines
989989 bool no_previous_buffers = !q_num_bufs;
990990 int ret = 0;
991991
992− if (q->num_buffers == q->max_num_buffers) {
992+ if (q_num_bufs == q->max_num_buffers) {
993993 dprintk(q, 1, "maximum number of buffers already allocated\n");
994994 return -ENOBUFS;
995995 }
drivers/media/common/videobuf2/videobuf2-v4l2.c+26−29
@@ -671,8 +671,20 @@ int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b) · 670 unmodified lines
671671 }
672672 EXPORT_SYMBOL(vb2_querybuf);
673673
674−static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
674+static void vb2_set_flags_and_caps(struct vb2_queue *q, u32 memory,
675+ u32 *flags, u32 *caps, u32 *max_num_bufs)
675676 {
677+ if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP) {
678+ /*
679+ * This needs to clear V4L2_MEMORY_FLAG_NON_COHERENT only,
680+ * but in order to avoid bugs we zero out all bits.
681+ */
682+ *flags = 0;
683+ } else {
684+ /* Clear all unknown flags. */
685+ *flags &= V4L2_MEMORY_FLAG_NON_COHERENT;
686+ }
687+
676688 *caps = V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS;
677689 if (q->io_modes & VB2_MMAP)
678690 *caps |= V4L2_BUF_CAP_SUPPORTS_MMAP;
@@ -686,21 +698,9 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps) · 7 unmodified lines
686698 *caps |= V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS;
687699 if (q->supports_requests)
688700 *caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS;
689−}
690−
691−static void validate_memory_flags(struct vb2_queue *q,
692− int memory,
693− u32 *flags)
694−{
695− if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP) {
696− /*
697− * This needs to clear V4L2_MEMORY_FLAG_NON_COHERENT only,
698− * but in order to avoid bugs we zero out all bits.
699− */
700− *flags = 0;
701− } else {
702− /* Clear all unknown flags. */
703− *flags &= V4L2_MEMORY_FLAG_NON_COHERENT;
701+ if (max_num_bufs) {
702+ *max_num_bufs = q->max_num_buffers;
703+ *caps |= V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS;
704704 }
705705 }
706706
@@ -709,8 +709,8 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) · 2 unmodified lines
709709 int ret = vb2_verify_memory_type(q, req->memory, req->type);
710710 u32 flags = req->flags;
711711
712− fill_buf_caps(q, &req->capabilities);
713− validate_memory_flags(q, req->memory, &flags);
712+ vb2_set_flags_and_caps(q, req->memory, &flags,
713+ &req->capabilities, NULL);
714714 req->flags = flags;
715715 return ret ? ret : vb2_core_reqbufs(q, req->memory,
716716 req->flags, &req->count);
@@ -751,11 +751,9 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create) · 34 unmodified lines
751751 int ret = vb2_verify_memory_type(q, create->memory, f->type);
752752 unsigned i;
753753
754− fill_buf_caps(q, &create->capabilities);
755− validate_memory_flags(q, create->memory, &create->flags);
756754 create->index = vb2_get_num_buffers(q);
757− create->max_num_buffers = q->max_num_buffers;
758− create->capabilities |= V4L2_BUF_CAP_SUPPORTS_MAX_NUM_BUFFERS;
755+ vb2_set_flags_and_caps(q, create->memory, &create->flags,
756+ &create->capabilities, &create->max_num_buffers);
759757 if (create->count == 0)
760758 return ret != -EBUSY ? ret : 0;
761759
@@ -1006,8 +1004,8 @@ int vb2_ioctl_reqbufs(struct file *file, void *priv, · 244 unmodified lines
10061004 int res = vb2_verify_memory_type(vdev->queue, p->memory, p->type);
10071005 u32 flags = p->flags;
10081006
1009− fill_buf_caps(vdev->queue, &p->capabilities);
1010− validate_memory_flags(vdev->queue, p->memory, &flags);
1007+ vb2_set_flags_and_caps(vdev->queue, p->memory, &flags,
1008+ &p->capabilities, NULL);
10111009 p->flags = flags;
10121010 if (res)
10131011 return res;
@@ -1026,12 +1024,11 @@ int vb2_ioctl_create_bufs(struct file *file, void *priv, · 12 unmodified lines
10261024 struct v4l2_create_buffers *p)
10271025 {
10281026 struct video_device *vdev = video_devdata(file);
1029− int res = vb2_verify_memory_type(vdev->queue, p->memory,
1030− p->format.type);
1027+ int res = vb2_verify_memory_type(vdev->queue, p->memory, p->format.type);
10311028
1032− p->index = vdev->queue->num_buffers;
1033− fill_buf_caps(vdev->queue, &p->capabilities);
1034− validate_memory_flags(vdev->queue, p->memory, &p->flags);
1029+ p->index = vb2_get_num_buffers(vdev->queue);
1030+ vb2_set_flags_and_caps(vdev->queue, p->memory, &p->flags,
1031+ &p->capabilities, &p->max_num_buffers);
10351032 /*
10361033 * If count == 0, then just check if memory and type are valid.
10371034 * Any -EBUSY result from vb2_verify_memory_type can be mapped to 0.
drivers/media/platform/chips-media/wave5/wave5-vpu.c+1−1
@@ -272,7 +272,7 @@ static const struct wave5_match_data ti_wave521c_data = { · 271 unmodified lines
272272 };
273273
274274 static const struct of_device_id wave5_dt_ids[] = {
275− { .compatible = "ti,k3-j721s2-wave521c", .data = &ti_wave521c_data },
275+ { .compatible = "ti,j721s2-wave521c", .data = &ti_wave521c_data },
276276 { /* sentinel */ }
277277 };
278278 MODULE_DEVICE_TABLE(of, wave5_dt_ids);
drivers/net/dsa/mt7530.c+1−2
@@ -2840,8 +2840,7 @@ static void mt753x_phylink_mac_link_up(struct dsa_switch *ds, int port, · 2839 unmodified lines
28402840 /* MT753x MAC works in 1G full duplex mode for all up-clocked
28412841 * variants.
28422842 */
2843− if (interface == PHY_INTERFACE_MODE_INTERNAL ||
2844− interface == PHY_INTERFACE_MODE_TRGMII ||
2843+ if (interface == PHY_INTERFACE_MODE_TRGMII ||
28452844 (phy_interface_mode_is_8023z(interface))) {
28462845 speed = SPEED_1000;
28472846 duplex = DUPLEX_FULL;
drivers/net/dsa/mv88e6xxx/chip.c+1−1
@@ -3659,7 +3659,7 @@ static int mv88e6xxx_mdio_read_c45(struct mii_bus *bus, int phy, int devad, · 3658 unmodified lines
36593659 int err;
36603660
36613661 if (!chip->info->ops->phy_read_c45)
3662− return -EOPNOTSUPP;
3662+ return 0xffff;
36633663
36643664 mv88e6xxx_reg_lock(chip);
36653665 err = chip->info->ops->phy_read_c45(chip, bus, phy, devad, reg, &val);
drivers/net/dsa/qca/qca8k-8xxx.c+1−2
@@ -2051,12 +2051,11 @@ qca8k_sw_probe(struct mdio_device *mdiodev) · 2050 unmodified lines
20512051 priv->info = of_device_get_match_data(priv->dev);
20522052
20532053 priv->reset_gpio = devm_gpiod_get_optional(priv->dev, "reset",
2054− GPIOD_ASIS);
2054+ GPIOD_OUT_HIGH);
20552055 if (IS_ERR(priv->reset_gpio))
20562056 return PTR_ERR(priv->reset_gpio);
20572057
20582058 if (priv->reset_gpio) {
2059− gpiod_set_value_cansleep(priv->reset_gpio, 1);
20602059 /* The active low duration must be greater than 10 ms
20612060 * and checkpatch.pl wants 20 ms.
20622061 */
drivers/net/ethernet/amd/pds_core/adminq.c+48−16
@@ -63,6 +63,15 @@ static int pdsc_process_notifyq(struct pdsc_qcq *qcq) · 62 unmodified lines
6363 return nq_work;
6464 }
6565
66+static bool pdsc_adminq_inc_if_up(struct pdsc *pdsc)
67+{
68+ if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER) ||
69+ pdsc->state & BIT_ULL(PDSC_S_FW_DEAD))
70+ return false;
71+
72+ return refcount_inc_not_zero(&pdsc->adminq_refcnt);
73+}
74+
6675 void pdsc_process_adminq(struct pdsc_qcq *qcq)
6776 {
6877 union pds_core_adminq_comp *comp;
@@ -75,9 +84,9 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) · 6 unmodified lines
7584 int aq_work = 0;
7685 int credits;
7786
78− /* Don't process AdminQ when shutting down */
79− if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) {
80− dev_err(pdsc->dev, "%s: called while PDSC_S_STOPPING_DRIVER\n",
87+ /* Don't process AdminQ when it's not up */
88+ if (!pdsc_adminq_inc_if_up(pdsc)) {
89+ dev_err(pdsc->dev, "%s: called while adminq is unavailable\n",
8190 __func__);
8291 return;
8392 }
@@ -124,6 +133,7 @@ credits: · 40 unmodified lines
124133 pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx],
125134 credits,
126135 PDS_CORE_INTR_CRED_REARM);
136+ refcount_dec(&pdsc->adminq_refcnt);
127137 }
128138
129139 void pdsc_work_thread(struct work_struct *work)
@@ -135,18 +145,20 @@ void pdsc_work_thread(struct work_struct *work) · 5 unmodified lines
135145
136146 irqreturn_t pdsc_adminq_isr(int irq, void *data)
137147 {
138− struct pdsc_qcq *qcq = data;
139− struct pdsc *pdsc = qcq->pdsc;
148+ struct pdsc *pdsc = data;
149+ struct pdsc_qcq *qcq;
140150
141− /* Don't process AdminQ when shutting down */
142− if (pdsc->state & BIT_ULL(PDSC_S_STOPPING_DRIVER)) {
143− dev_err(pdsc->dev, "%s: called while PDSC_S_STOPPING_DRIVER\n",
151+ /* Don't process AdminQ when it's not up */
152+ if (!pdsc_adminq_inc_if_up(pdsc)) {
153+ dev_err(pdsc->dev, "%s: called while adminq is unavailable\n",
144154 __func__);
145155 return IRQ_HANDLED;
146156 }
147157
158+ qcq = &pdsc->adminqcq;
148159 queue_work(pdsc->wq, &qcq->work);
149160 pds_core_intr_mask(&pdsc->intr_ctrl[qcq->intx], PDS_CORE_INTR_MASK_CLEAR);
161+ refcount_dec(&pdsc->adminq_refcnt);
150162
151163 return IRQ_HANDLED;
152164 }
@@ -179,10 +191,16 @@ static int __pdsc_adminq_post(struct pdsc *pdsc, · 26 unmodified lines
179191
180192 /* Check that the FW is running */
181193 if (!pdsc_is_fw_running(pdsc)) {
182− u8 fw_status = ioread8(&pdsc->info_regs->fw_status);
183−
184− dev_info(pdsc->dev, "%s: post failed - fw not running %#02x:\n",
185− __func__, fw_status);
194+ if (pdsc->info_regs) {
195+ u8 fw_status =
196+ ioread8(&pdsc->info_regs->fw_status);
197+
198+ dev_info(pdsc->dev, "%s: post failed - fw not running %#02x:\n",
199+ __func__, fw_status);
200+ } else {
201+ dev_info(pdsc->dev, "%s: post failed - BARs not setup\n",
202+ __func__);
203+ }
186204 ret = -ENXIO;
187205
188206 goto err_out_unlock;
@@ -230,6 +248,12 @@ int pdsc_adminq_post(struct pdsc *pdsc, · 41 unmodified lines
230248 int err = 0;
231249 int index;
232250
251+ if (!pdsc_adminq_inc_if_up(pdsc)) {
252+ dev_dbg(pdsc->dev, "%s: preventing adminq cmd %u\n",
253+ __func__, cmd->opcode);
254+ return -ENXIO;
255+ }
256+
233257 wc.qcq = &pdsc->adminqcq;
234258 index = __pdsc_adminq_post(pdsc, &pdsc->adminqcq, cmd, comp, &wc);
235259 if (index < 0) {
@@ -248,10 +272,16 @@ int pdsc_adminq_post(struct pdsc *pdsc, · 12 unmodified lines
248272 break;
249273
250274 if (!pdsc_is_fw_running(pdsc)) {
251− u8 fw_status = ioread8(&pdsc->info_regs->fw_status);
252−
253− dev_dbg(pdsc->dev, "%s: post wait failed - fw not running %#02x:\n",
254− __func__, fw_status);
275+ if (pdsc->info_regs) {
276+ u8 fw_status =
277+ ioread8(&pdsc->info_regs->fw_status);
278+
279+ dev_dbg(pdsc->dev, "%s: post wait failed - fw not running %#02x:\n",
280+ __func__, fw_status);
281+ } else {
282+ dev_dbg(pdsc->dev, "%s: post wait failed - BARs not setup\n",
283+ __func__);
284+ }
255285 err = -ENXIO;
256286 break;
257287 }
@@ -285,6 +315,8 @@ err_out: · 27 unmodified lines
285315 queue_work(pdsc->wq, &pdsc->health_work);
286316 }
287317
318+ refcount_dec(&pdsc->adminq_refcnt);
319+
288320 return err;
289321 }
290322 EXPORT_SYMBOL_GPL(pdsc_adminq_post);
drivers/net/ethernet/amd/pds_core/core.c+36−10
@@ -125,7 +125,7 @@ static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq) · 124 unmodified lines
125125
126126 snprintf(name, sizeof(name), "%s-%d-%s",
127127 PDS_CORE_DRV_NAME, pdsc->pdev->bus->number, qcq->q.name);
128− index = pdsc_intr_alloc(pdsc, name, pdsc_adminq_isr, qcq);
128+ index = pdsc_intr_alloc(pdsc, name, pdsc_adminq_isr, pdsc);
129129 if (index < 0)
130130 return index;
131131 qcq->intx = index;
@@ -404,10 +404,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init) · 272 unmodified lines
404404 int numdescs;
405405 int err;
406406
407− if (init)
408− err = pdsc_dev_init(pdsc);
409− else
410− err = pdsc_dev_reinit(pdsc);
407+ err = pdsc_dev_init(pdsc);
411408 if (err)
412409 return err;
413410
@@ -450,6 +447,7 @@ int pdsc_setup(struct pdsc *pdsc, bool init) · 36 unmodified lines
450447 pdsc_debugfs_add_viftype(pdsc);
451448 }
452449
450+ refcount_set(&pdsc->adminq_refcnt, 1);
453451 clear_bit(PDSC_S_FW_DEAD, &pdsc->state);
454452 return 0;
455453
@@ -464,6 +462,8 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 8 unmodified lines
464462
465463 if (!pdsc->pdev->is_virtfn)
466464 pdsc_devcmd_reset(pdsc);
465+ if (pdsc->adminqcq.work.func)
466+ cancel_work_sync(&pdsc->adminqcq.work);
467467 pdsc_qcq_free(pdsc, &pdsc->notifyqcq);
468468 pdsc_qcq_free(pdsc, &pdsc->adminqcq);
469469
@@ -476,10 +476,9 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 6 unmodified lines
476476 for (i = 0; i < pdsc->nintrs; i++)
477477 pdsc_intr_free(pdsc, i);
478478
479− if (removing) {
480− kfree(pdsc->intr_info);
481− pdsc->intr_info = NULL;
482− }
479+ kfree(pdsc->intr_info);
480+ pdsc->intr_info = NULL;
481+ pdsc->nintrs = 0;
483482 }
484483
485484 if (pdsc->kern_dbpage) {
@@ -487,6 +486,7 @@ void pdsc_teardown(struct pdsc *pdsc, bool removing) · 1 unmodified line
487486 pdsc->kern_dbpage = NULL;
488487 }
489488
489+ pci_free_irq_vectors(pdsc->pdev);
490490 set_bit(PDSC_S_FW_DEAD, &pdsc->state);
491491 }
492492
@@ -512,6 +512,24 @@ void pdsc_stop(struct pdsc *pdsc) · 19 unmodified lines
512512 PDS_CORE_INTR_MASK_SET);
513513 }
514514
515+static void pdsc_adminq_wait_and_dec_once_unused(struct pdsc *pdsc)
516+{
517+ /* The driver initializes the adminq_refcnt to 1 when the adminq is
518+ * allocated and ready for use. Other users/requesters will increment
519+ * the refcnt while in use. If the refcnt is down to 1 then the adminq
520+ * is not in use and the refcnt can be cleared and adminq freed. Before
521+ * calling this function the driver will set PDSC_S_FW_DEAD, which
522+ * prevent subsequent attempts to use the adminq and increment the
523+ * refcnt to fail. This guarantees that this function will eventually
524+ * exit.
525+ */
526+ while (!refcount_dec_if_one(&pdsc->adminq_refcnt)) {
527+ dev_dbg_ratelimited(pdsc->dev, "%s: adminq in use\n",
528+ __func__);
529+ cpu_relax();
530+ }
531+}
532+
515533 void pdsc_fw_down(struct pdsc *pdsc)
516534 {
517535 union pds_core_notifyq_comp reset_event = {
@@ -527,6 +545,8 @@ void pdsc_fw_down(struct pdsc *pdsc) · 9 unmodified lines
527545 if (pdsc->pdev->is_virtfn)
528546 return;
529547
548+ pdsc_adminq_wait_and_dec_once_unused(pdsc);
549+
530550 /* Notify clients of fw_down */
531551 if (pdsc->fw_reporter)
532552 devlink_health_report(pdsc->fw_reporter, "FW down reported", pdsc);
@@ -577,7 +597,13 @@ err_out: · 44 unmodified lines
577597
578598 static void pdsc_check_pci_health(struct pdsc *pdsc)
579599 {
580− u8 fw_status = ioread8(&pdsc->info_regs->fw_status);
600+ u8 fw_status;
601+
602+ /* some sort of teardown already in progress */
603+ if (!pdsc->info_regs)
604+ return;
605+
606+ fw_status = ioread8(&pdsc->info_regs->fw_status);
581607
582608 /* is PCI broken? */
583609 if (fw_status != PDS_RC_BAD_PCI)
drivers/net/ethernet/amd/pds_core/core.h+1−1
@@ -184,6 +184,7 @@ struct pdsc { · 183 unmodified lines
184184 struct mutex devcmd_lock; /* lock for dev_cmd operations */
185185 struct mutex config_lock; /* lock for configuration operations */
186186 spinlock_t adminq_lock; /* lock for adminq operations */
187+ refcount_t adminq_refcnt;
187188 struct pds_core_dev_info_regs __iomem *info_regs;
188189 struct pds_core_dev_cmd_regs __iomem *cmd_regs;
189190 struct pds_core_intr __iomem *intr_ctrl;
@@ -280,7 +281,6 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, · 90 unmodified lines
280281 union pds_core_dev_comp *comp, int max_seconds);
281282 int pdsc_devcmd_init(struct pdsc *pdsc);
282283 int pdsc_devcmd_reset(struct pdsc *pdsc);
283−int pdsc_dev_reinit(struct pdsc *pdsc);
284284 int pdsc_dev_init(struct pdsc *pdsc);
285285
286286 void pdsc_reset_prepare(struct pci_dev *pdev);
drivers/net/ethernet/amd/pds_core/debugfs.c+4−0
@@ -64,6 +64,10 @@ DEFINE_SHOW_ATTRIBUTE(identity); · 63 unmodified lines
6464
6565 void pdsc_debugfs_add_ident(struct pdsc *pdsc)
6666 {
67+ /* This file will already exist in the reset flow */
68+ if (debugfs_lookup("identity", pdsc->dentry))
69+ return;
70+
6771 debugfs_create_file("identity", 0400, pdsc->dentry,
6872 pdsc, &identity_fops);
6973 }
drivers/net/ethernet/amd/pds_core/dev.c+8−8
@@ -57,6 +57,9 @@ int pdsc_err_to_errno(enum pds_core_status_code code) · 56 unmodified lines
5757
5858 bool pdsc_is_fw_running(struct pdsc *pdsc)
5959 {
60+ if (!pdsc->info_regs)
61+ return false;
62+
6063 pdsc->fw_status = ioread8(&pdsc->info_regs->fw_status);
6164 pdsc->last_fw_time = jiffies;
6265 pdsc->last_hb = ioread32(&pdsc->info_regs->fw_heartbeat);
@@ -182,13 +185,17 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, · 119 unmodified lines
182185 {
183186 int err;
184187
188+ if (!pdsc->cmd_regs)
189+ return -ENXIO;
190+
185191 memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
186192 pdsc_devcmd_dbell(pdsc);
187193 err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
188− memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
189194
190195 if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)
191196 queue_work(pdsc->wq, &pdsc->health_work);
197+ else
198+ memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
192199
193200 return err;
194201 }
@@ -309,13 +316,6 @@ static int pdsc_identify(struct pdsc *pdsc) · 114 unmodified lines
309316 return 0;
310317 }
311318
312−int pdsc_dev_reinit(struct pdsc *pdsc)
313−{
314− pdsc_init_devinfo(pdsc);
315−
316− return pdsc_identify(pdsc);
317−}
318−
319319 int pdsc_dev_init(struct pdsc *pdsc)
320320 {
321321 unsigned int nintrs;
drivers/net/ethernet/amd/pds_core/devlink.c+2−1
@@ -111,7 +111,8 @@ int pdsc_dl_info_get(struct devlink *dl, struct devlink_info_req *req, · 110 unmodified lines
111111
112112 mutex_lock(&pdsc->devcmd_lock);
113113 err = pdsc_devcmd_locked(pdsc, &cmd, &comp, pdsc->devcmd_timeout * 2);
114− memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list));
114+ if (!err)
115+ memcpy_fromio(&fw_list, pdsc->cmd_regs->data, sizeof(fw_list));
115116 mutex_unlock(&pdsc->devcmd_lock);
116117 if (err && err != -EIO)
117118 return err;
drivers/net/ethernet/amd/pds_core/fw.c+3−0
@@ -107,6 +107,9 @@ int pdsc_firmware_update(struct pdsc *pdsc, const struct firmware *fw, · 106 unmodified lines
107107
108108 dev_info(pdsc->dev, "Installing firmware\n");
109109
110+ if (!pdsc->cmd_regs)
111+ return -ENXIO;
112+
110113 dl = priv_to_devlink(pdsc);
111114 devlink_flash_update_status_notify(dl, "Preparing to flash",
112115 NULL, 0, 0);
drivers/net/ethernet/amd/pds_core/main.c+22−4
@@ -37,6 +37,11 @@ static void pdsc_unmap_bars(struct pdsc *pdsc) · 36 unmodified lines
3737 struct pdsc_dev_bar *bars = pdsc->bars;
3838 unsigned int i;
3939
40+ pdsc->info_regs = NULL;
41+ pdsc->cmd_regs = NULL;
42+ pdsc->intr_status = NULL;
43+ pdsc->intr_ctrl = NULL;
44+
4045 for (i = 0; i < PDS_CORE_BARS_MAX; i++) {
4146 if (bars[i].vaddr)
4247 pci_iounmap(pdsc->pdev, bars[i].vaddr);
@@ -293,7 +298,7 @@ err_out_stop: · 250 unmodified lines
293298 err_out_teardown:
294299 pdsc_teardown(pdsc, PDSC_TEARDOWN_REMOVING);
295300 err_out_unmap_bars:
296− del_timer_sync(&pdsc->wdtimer);
301+ timer_shutdown_sync(&pdsc->wdtimer);
297302 if (pdsc->wq)
298303 destroy_workqueue(pdsc->wq);
299304 mutex_destroy(&pdsc->config_lock);
@@ -420,7 +425,7 @@ static void pdsc_remove(struct pci_dev *pdev) · 120 unmodified lines
420425 */
421426 pdsc_sriov_configure(pdev, 0);
422427
423− del_timer_sync(&pdsc->wdtimer);
428+ timer_shutdown_sync(&pdsc->wdtimer);
424429 if (pdsc->wq)
425430 destroy_workqueue(pdsc->wq);
426431
@@ -433,7 +438,6 @@ static void pdsc_remove(struct pci_dev *pdev) · 6 unmodified lines
433438 mutex_destroy(&pdsc->config_lock);
434439 mutex_destroy(&pdsc->devcmd_lock);
435440
436− pci_free_irq_vectors(pdev);
437441 pdsc_unmap_bars(pdsc);
438442 pci_release_regions(pdev);
439443 }
@@ -445,13 +449,26 @@ static void pdsc_remove(struct pci_dev *pdev) · 5 unmodified lines
445449 devlink_free(dl);
446450 }
447451
452+static void pdsc_stop_health_thread(struct pdsc *pdsc)
453+{
454+ timer_shutdown_sync(&pdsc->wdtimer);
455+ if (pdsc->health_work.func)
456+ cancel_work_sync(&pdsc->health_work);
457+}
458+
459+static void pdsc_restart_health_thread(struct pdsc *pdsc)
460+{
461+ timer_setup(&pdsc->wdtimer, pdsc_wdtimer_cb, 0);
462+ mod_timer(&pdsc->wdtimer, jiffies + 1);
463+}
464+
448465 void pdsc_reset_prepare(struct pci_dev *pdev)
449466 {
450467 struct pdsc *pdsc = pci_get_drvdata(pdev);
451468
469+ pdsc_stop_health_thread(pdsc);
452470 pdsc_fw_down(pdsc);
453471
454− pci_free_irq_vectors(pdev);
455472 pdsc_unmap_bars(pdsc);
456473 pci_release_regions(pdev);
457474 pci_disable_device(pdev);
@@ -486,6 +503,7 @@ void pdsc_reset_done(struct pci_dev *pdev) · 28 unmodified lines
486503 }
487504
488505 pdsc_fw_up(pdsc);
506+ pdsc_restart_health_thread(pdsc);
489507 }
490508
491509 static const struct pci_error_handlers pdsc_err_handler = {
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c+1−1
@@ -684,7 +684,7 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) · 683 unmodified lines
684684 timestamp.hwtstamp = ns_to_ktime(ns);
685685 skb_tstamp_tx(ptp->tx_skb, &timestamp);
686686 } else {
687− netdev_WARN_ONCE(bp->dev,
687+ netdev_warn_once(bp->dev,
688688 "TS query for TX timer failed rc = %x\n", rc);
689689 }
690690
drivers/net/ethernet/google/gve/gve_rx.c+4−4
@@ -402,7 +402,7 @@ static enum pkt_hash_types gve_rss_type(__be16 pkt_flags) · 401 unmodified lines
402402
403403 static struct sk_buff *gve_rx_add_frags(struct napi_struct *napi,
404404 struct gve_rx_slot_page_info *page_info,
405− u16 packet_buffer_size, u16 len,
405+ unsigned int truesize, u16 len,
406406 struct gve_rx_ctx *ctx)
407407 {
408408 u32 offset = page_info->page_offset + page_info->pad;
@@ -435,10 +435,10 @@ static struct sk_buff *gve_rx_add_frags(struct napi_struct *napi, · 26 unmodified lines
435435 if (skb != ctx->skb_head) {
436436 ctx->skb_head->len += len;
437437 ctx->skb_head->data_len += len;
438− ctx->skb_head->truesize += packet_buffer_size;
438+ ctx->skb_head->truesize += truesize;
439439 }
440440 skb_add_rx_frag(skb, num_frags, page_info->page,
441− offset, len, packet_buffer_size);
441+ offset, len, truesize);
442442
443443 return ctx->skb_head;
444444 }
@@ -532,7 +532,7 @@ static struct sk_buff *gve_rx_copy_to_pool(struct gve_rx_ring *rx, · 87 unmodified lines
532532
533533 memcpy(alloc_page_info.page_address, src, page_info->pad + len);
534534 skb = gve_rx_add_frags(napi, &alloc_page_info,
535− rx->packet_buffer_size,
535+ PAGE_SIZE,
536536 len, ctx);
537537
538538 u64_stats_update_begin(&rx->statss);
drivers/net/ethernet/intel/e1000e/e1000.h+20−0
@@ -360,23 +360,43 @@ s32 e1000e_get_base_timinca(struct e1000_adapter *adapter, u32 *timinca); · 359 unmodified lines
360360 * As a result, a shift of INCVALUE_SHIFT_n is used to fit a value of
361361 * INCVALUE_n into the TIMINCA register allowing 32+8+(24-INCVALUE_SHIFT_n)
362362 * bits to count nanoseconds leaving the rest for fractional nonseconds.
363+ *
364+ * Any given INCVALUE also has an associated maximum adjustment value. This
365+ * maximum adjustment value is the largest increase (or decrease) which can be
366+ * safely applied without overflowing the INCVALUE. Since INCVALUE has
367+ * a maximum range of 24 bits, its largest value is 0xFFFFFF.
368+ *
369+ * To understand where the maximum value comes from, consider the following
370+ * equation:
371+ *
372+ * new_incval = base_incval + (base_incval * adjustment) / 1billion
373+ *
374+ * To avoid overflow that means:
375+ * max_incval = base_incval + (base_incval * max_adj) / billion
376+ *
377+ * Re-arranging:
378+ * max_adj = floor(((max_incval - base_incval) * 1billion) / 1billion)
363379 */
364380 #define INCVALUE_96MHZ 125
365381 #define INCVALUE_SHIFT_96MHZ 17
366382 #define INCPERIOD_SHIFT_96MHZ 2
367383 #define INCPERIOD_96MHZ (12 >> INCPERIOD_SHIFT_96MHZ)
384+#define MAX_PPB_96MHZ 23999900 /* 23,999,900 ppb */
368385
369386 #define INCVALUE_25MHZ 40
370387 #define INCVALUE_SHIFT_25MHZ 18
371388 #define INCPERIOD_25MHZ 1
389+#define MAX_PPB_25MHZ 599999900 /* 599,999,900 ppb */
372390
373391 #define INCVALUE_24MHZ 125
374392 #define INCVALUE_SHIFT_24MHZ 14
375393 #define INCPERIOD_24MHZ 3
394+#define MAX_PPB_24MHZ 999999999 /* 999,999,999 ppb */
376395
377396 #define INCVALUE_38400KHZ 26
378397 #define INCVALUE_SHIFT_38400KHZ 19
379398 #define INCPERIOD_38400KHZ 1
399+#define MAX_PPB_38400KHZ 230769100 /* 230,769,100 ppb */
380400
381401 /* Another drawback of scaling the incvalue by a large factor is the
382402 * 64-bit SYSTIM register overflows more quickly. This is dealt with
drivers/net/ethernet/intel/e1000e/ptp.c+15−7
@@ -280,8 +280,17 @@ void e1000e_ptp_init(struct e1000_adapter *adapter) · 279 unmodified lines
280280
281281 switch (hw->mac.type) {
282282 case e1000_pch2lan:
283+ adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ;
284+ break;
283285 case e1000_pch_lpt:
286+ if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
287+ adapter->ptp_clock_info.max_adj = MAX_PPB_96MHZ;
288+ else
289+ adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ;
290+ break;
284291 case e1000_pch_spt:
292+ adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ;
293+ break;
285294 case e1000_pch_cnp:
286295 case e1000_pch_tgp:
287296 case e1000_pch_adp:
@@ -289,15 +298,14 @@ void e1000e_ptp_init(struct e1000_adapter *adapter) · 1 unmodified line
289298 case e1000_pch_lnp:
290299 case e1000_pch_ptp:
291300 case e1000_pch_nvp:
292− if ((hw->mac.type < e1000_pch_lpt) ||
293− (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)) {
294− adapter->ptp_clock_info.max_adj = 24000000 - 1;
295− break;
296− }
297− fallthrough;
301+ if (er32(TSYNCRXCTL) & E1000_TSYNCRXCTL_SYSCFI)
302+ adapter->ptp_clock_info.max_adj = MAX_PPB_24MHZ;
303+ else
304+ adapter->ptp_clock_info.max_adj = MAX_PPB_38400KHZ;
305+ break;
298306 case e1000_82574:
299307 case e1000_82583:
300− adapter->ptp_clock_info.max_adj = 600000000 - 1;
308+ adapter->ptp_clock_info.max_adj = MAX_PPB_25MHZ;
301309 break;
302310 default:
303311 break;
drivers/net/ethernet/intel/idpf/virtchnl2.h+1−1
@@ -978,7 +978,7 @@ struct virtchnl2_ptype { · 977 unmodified lines
978978 u8 proto_id_count;
979979 __le16 pad;
980980 __le16 proto_id[];
981−};
981+} __packed __aligned(2);
982982 VIRTCHNL2_CHECK_STRUCT_LEN(6, virtchnl2_ptype);
983983
984984 /**
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c+2−1
@@ -716,7 +716,8 @@ static s32 ixgbe_read_iosf_sb_reg_x550(struct ixgbe_hw *hw, u32 reg_addr, · 715 unmodified lines
716716 if ((command & IXGBE_SB_IOSF_CTRL_RESP_STAT_MASK) != 0) {
717717 error = FIELD_GET(IXGBE_SB_IOSF_CTRL_CMPL_ERR_MASK, command);
718718 hw_dbg(hw, "Failed to read, error %x\n", error);
719− return -EIO;
719+ ret = -EIO;
720+ goto out;
720721 }
721722
722723 if (!ret)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c+0−1
@@ -314,7 +314,6 @@ static int otx2_set_channels(struct net_device *dev, · 313 unmodified lines
314314 pfvf->hw.tx_queues = channel->tx_count;
315315 if (pfvf->xdp_prog)
316316 pfvf->hw.xdp_queues = channel->rx_count;
317− pfvf->hw.non_qos_queues = pfvf->hw.tx_queues + pfvf->hw.xdp_queues;
318317
319318 if (if_up)
320319 err = dev->netdev_ops->ndo_open(dev);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c+1−2
@@ -1744,6 +1744,7 @@ int otx2_open(struct net_device *netdev) · 1743 unmodified lines
17441744 /* RQ and SQs are mapped to different CQs,
17451745 * so find out max CQ IRQs (i.e CINTs) needed.
17461746 */
1747+ pf->hw.non_qos_queues = pf->hw.tx_queues + pf->hw.xdp_queues;
17471748 pf->hw.cint_cnt = max3(pf->hw.rx_queues, pf->hw.tx_queues,
17481749 pf->hw.tc_tx_queues);
17491750
@@ -2643,8 +2644,6 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog) · 893 unmodified lines
26432644 xdp_features_clear_redirect_target(dev);
26442645 }
26452646
2646− pf->hw.non_qos_queues += pf->hw.xdp_queues;
2647−
26482647 if (if_up)
26492648 otx2_open(pf->netdev);
26502649
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c+3−4
@@ -1403,7 +1403,7 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, · 1402 unmodified lines
14031403 struct otx2_cq_queue *cq,
14041404 bool *need_xdp_flush)
14051405 {
1406− unsigned char *hard_start, *data;
1406+ unsigned char *hard_start;
14071407 int qidx = cq->cq_idx;
14081408 struct xdp_buff xdp;
14091409 struct page *page;
@@ -1417,9 +1417,8 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, · 7 unmodified lines
14171417
14181418 xdp_init_buff(&xdp, pfvf->rbsize, &cq->xdp_rxq);
14191419
1420− data = (unsigned char *)phys_to_virt(pa);
1421− hard_start = page_address(page);
1422− xdp_prepare_buff(&xdp, hard_start, data - hard_start,
1420+ hard_start = (unsigned char *)phys_to_virt(pa);
1421+ xdp_prepare_buff(&xdp, hard_start, OTX2_HEAD_ROOM,
14231422 cqe->sg.seg_size, false);
14241423
14251424 act = bpf_prog_run_xdp(prog, &xdp);
drivers/net/ethernet/mediatek/mtk_eth_soc.c+4−1
@@ -4761,7 +4761,10 @@ static int mtk_probe(struct platform_device *pdev) · 4760 unmodified lines
47614761 }
47624762
47634763 if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
4764− err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
4764+ err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(36));
4765+ if (!err)
4766+ err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
4767+
47654768 if (err) {
47664769 dev_err(&pdev->dev, "Wrong DMA config\n");
47674770 return -EINVAL;
drivers/net/ethernet/microchip/lan966x/lan966x_port.c+3−2
@@ -168,9 +168,10 @@ static void lan966x_port_link_up(struct lan966x_port *port) · 167 unmodified lines
168168 lan966x_taprio_speed_set(port, config->speed);
169169
170170 /* Also the GIGA_MODE_ENA(1) needs to be set regardless of the
171− * port speed for QSGMII ports.
171+ * port speed for QSGMII or SGMII ports.
172172 */
173− if (phy_interface_num_ports(config->portmode) == 4)
173+ if (phy_interface_num_ports(config->portmode) == 4 ||
174+ config->portmode == PHY_INTERFACE_MODE_SGMII)
174175 mode = DEV_MAC_MODE_CFG_GIGA_MODE_ENA_SET(1);
175176
176177 lan_wr(config->duplex | mode,
drivers/net/ethernet/netronome/nfp/flower/conntrack.c+43−3
@@ -1424,10 +1424,30 @@ static void nfp_nft_ct_translate_mangle_action(struct flow_action_entry *mangle_ · 1423 unmodified lines
14241424 mangle_action->mangle.mask = (__force u32)cpu_to_be32(mangle_action->mangle.mask);
14251425 return;
14261426
1427+ /* Both struct tcphdr and struct udphdr start with
1428+ * __be16 source;
1429+ * __be16 dest;
1430+ * so we can use the same code for both.
1431+ */
14271432 case FLOW_ACT_MANGLE_HDR_TYPE_TCP:
14281433 case FLOW_ACT_MANGLE_HDR_TYPE_UDP:
1429− mangle_action->mangle.val = (__force u16)cpu_to_be16(mangle_action->mangle.val);
1430− mangle_action->mangle.mask = (__force u16)cpu_to_be16(mangle_action->mangle.mask);
1434+ if (mangle_action->mangle.offset == offsetof(struct tcphdr, source)) {
1435+ mangle_action->mangle.val =
1436+ (__force u32)cpu_to_be32(mangle_action->mangle.val << 16);
1437+ /* The mask of mangle action is inverse mask,
1438+ * so clear the dest tp port with 0xFFFF to
1439+ * instead of rotate-left operation.
1440+ */
1441+ mangle_action->mangle.mask =
1442+ (__force u32)cpu_to_be32(mangle_action->mangle.mask << 16 | 0xFFFF);
1443+ }
1444+ if (mangle_action->mangle.offset == offsetof(struct tcphdr, dest)) {
1445+ mangle_action->mangle.offset = 0;
1446+ mangle_action->mangle.val =
1447+ (__force u32)cpu_to_be32(mangle_action->mangle.val);
1448+ mangle_action->mangle.mask =
1449+ (__force u32)cpu_to_be32(mangle_action->mangle.mask);
1450+ }
14311451 return;
14321452
14331453 default:
@@ -1864,10 +1884,30 @@ int nfp_fl_ct_handle_post_ct(struct nfp_flower_priv *priv, · 430 unmodified lines
18641884 {
18651885 struct flow_rule *rule = flow_cls_offload_flow_rule(flow);
18661886 struct nfp_fl_ct_flow_entry *ct_entry;
1887+ struct flow_action_entry *ct_goto;
18671888 struct nfp_fl_ct_zone_entry *zt;
1889+ struct flow_action_entry *act;
18681890 bool wildcarded = false;
18691891 struct flow_match_ct ct;
1870− struct flow_action_entry *ct_goto;
1892+ int i;
1893+
1894+ flow_action_for_each(i, act, &rule->action) {
1895+ switch (act->id) {
1896+ case FLOW_ACTION_REDIRECT:
1897+ case FLOW_ACTION_REDIRECT_INGRESS:
1898+ case FLOW_ACTION_MIRRED:
1899+ case FLOW_ACTION_MIRRED_INGRESS:
1900+ if (act->dev->rtnl_link_ops &&
1901+ !strcmp(act->dev->rtnl_link_ops->kind, "openvswitch")) {
1902+ NL_SET_ERR_MSG_MOD(extack,
1903+ "unsupported offload: out port is openvswitch internal port");
1904+ return -EOPNOTSUPP;
1905+ }
1906+ break;
1907+ default:
1908+ break;
1909+ }
1910+ }
18711911
18721912 flow_rule_match_ct(rule, &ct);
18731913 if (!ct.mask->ct_zone) {
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c+4−0
@@ -353,6 +353,10 @@ static int imx_dwmac_probe(struct platform_device *pdev) · 352 unmodified lines
353353 if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
354354 plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY;
355355
356+ /* Default TX Q0 to use TSO and rest TXQ for TBS */
357+ for (int i = 1; i < plat_dat->tx_queues_to_use; i++)
358+ plat_dat->tx_queues_cfg[i].tbs_en = 1;
359+
356360 plat_dat->host_dma_width = dwmac->ops->addr_width;
357361 plat_dat->init = imx_dwmac_init;
358362 plat_dat->exit = imx_dwmac_exit;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+3−0
@@ -3939,6 +3939,9 @@ static int __stmmac_open(struct net_device *dev, · 3938 unmodified lines
39393939 priv->rx_copybreak = STMMAC_RX_COPYBREAK;
39403940
39413941 buf_sz = dma_conf->dma_buf_sz;
3942+ for (int i = 0; i < MTL_MAX_TX_QUEUES; i++)
3943+ if (priv->dma_conf.tx_queue[i].tbs & STMMAC_TBS_EN)
3944+ dma_conf->tx_queue[i].tbs = priv->dma_conf.tx_queue[i].tbs;
39423945 memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf));
39433946
39443947 stmmac_reset_queues_param(priv);
drivers/net/hyperv/netvsc.c+4−1
@@ -708,7 +708,10 @@ void netvsc_device_remove(struct hv_device *device) · 707 unmodified lines
708708 /* Disable NAPI and disassociate its context from the device. */
709709 for (i = 0; i < net_device->num_chn; i++) {
710710 /* See also vmbus_reset_channel_cb(). */
711− napi_disable(&net_device->chan_table[i].napi);
711+ /* only disable enabled NAPI channel */
712+ if (i < ndev->real_num_rx_queues)
713+ napi_disable(&net_device->chan_table[i].napi);
714+
712715 netif_napi_del(&net_device->chan_table[i].napi);
713716 }
714717
drivers/net/phy/mediatek-ge-soc.c+81−66
@@ -489,7 +489,7 @@ static int tx_r50_fill_result(struct phy_device *phydev, u16 tx_r50_cal_val, · 488 unmodified lines
489489 u16 reg, val;
490490
491491 if (phydev->drv->phy_id == MTK_GPHY_ID_MT7988)
492− bias = -2;
492+ bias = -1;
493493
494494 val = clamp_val(bias + tx_r50_cal_val, 0, 63);
495495
@@ -705,6 +705,11 @@ restore: · 209 unmodified lines
705705 static void mt798x_phy_common_finetune(struct phy_device *phydev)
706706 {
707707 phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
708+ /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */
709+ __phy_write(phydev, 0x11, 0xc71);
710+ __phy_write(phydev, 0x12, 0xc);
711+ __phy_write(phydev, 0x10, 0x8fae);
712+
708713 /* EnabRandUpdTrig = 1 */
709714 __phy_write(phydev, 0x11, 0x2f00);
710715 __phy_write(phydev, 0x12, 0xe);
@@ -715,15 +720,56 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev) · 4 unmodified lines
715720 __phy_write(phydev, 0x12, 0x0);
716721 __phy_write(phydev, 0x10, 0x83aa);
717722
718− /* TrFreeze = 0 */
723+ /* FfeUpdGainForce = 1(Enable), FfeUpdGainForceVal = 4 */
724+ __phy_write(phydev, 0x11, 0x240);
725+ __phy_write(phydev, 0x12, 0x0);
726+ __phy_write(phydev, 0x10, 0x9680);
727+
728+ /* TrFreeze = 0 (mt7988 default) */
719729 __phy_write(phydev, 0x11, 0x0);
720730 __phy_write(phydev, 0x12, 0x0);
721731 __phy_write(phydev, 0x10, 0x9686);
722732
733+ /* SSTrKp100 = 5 */
734+ /* SSTrKf100 = 6 */
735+ /* SSTrKp1000Mas = 5 */
736+ /* SSTrKf1000Mas = 6 */
723737 /* SSTrKp1000Slv = 5 */
738+ /* SSTrKf1000Slv = 6 */
724739 __phy_write(phydev, 0x11, 0xbaef);
725740 __phy_write(phydev, 0x12, 0x2e);
726741 __phy_write(phydev, 0x10, 0x968c);
742+ phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
743+}
744+
745+static void mt7981_phy_finetune(struct phy_device *phydev)
746+{
747+ u16 val[8] = { 0x01ce, 0x01c1,
748+ 0x020f, 0x0202,
749+ 0x03d0, 0x03c0,
750+ 0x0013, 0x0005 };
751+ int i, k;
752+
753+ /* 100M eye finetune:
754+ * Keep middle level of TX MLT3 shapper as default.
755+ * Only change TX MLT3 overshoot level here.
756+ */
757+ for (k = 0, i = 1; i < 12; i++) {
758+ if (i % 3 == 0)
759+ continue;
760+ phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]);
761+ }
762+
763+ phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
764+ /* ResetSyncOffset = 6 */
765+ __phy_write(phydev, 0x11, 0x600);
766+ __phy_write(phydev, 0x12, 0x0);
767+ __phy_write(phydev, 0x10, 0x8fc0);
768+
769+ /* VgaDecRate = 1 */
770+ __phy_write(phydev, 0x11, 0x4c2a);
771+ __phy_write(phydev, 0x12, 0x3e);
772+ __phy_write(phydev, 0x10, 0x8fa4);
727773
728774 /* MrvlTrFix100Kp = 3, MrvlTrFix100Kf = 2,
729775 * MrvlTrFix1000Kp = 3, MrvlTrFix1000Kf = 2
@@ -738,7 +784,7 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev) · 8 unmodified lines
738784 __phy_write(phydev, 0x10, 0x8ec0);
739785 phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
740786
741− /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9*/
787+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 9 */
742788 phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
743789 MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK,
744790 BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0x9));
@@ -771,48 +817,6 @@ static void mt798x_phy_common_finetune(struct phy_device *phydev) · 26 unmodified lines
771817 phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_LDO_OUTPUT_V, 0x2222);
772818 }
773819
774−static void mt7981_phy_finetune(struct phy_device *phydev)
775−{
776− u16 val[8] = { 0x01ce, 0x01c1,
777− 0x020f, 0x0202,
778− 0x03d0, 0x03c0,
779− 0x0013, 0x0005 };
780− int i, k;
781−
782− /* 100M eye finetune:
783− * Keep middle level of TX MLT3 shapper as default.
784− * Only change TX MLT3 overshoot level here.
785− */
786− for (k = 0, i = 1; i < 12; i++) {
787− if (i % 3 == 0)
788− continue;
789− phy_write_mmd(phydev, MDIO_MMD_VEND1, i, val[k++]);
790− }
791−
792− phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
793− /* SlvDSPreadyTime = 24, MasDSPreadyTime = 24 */
794− __phy_write(phydev, 0x11, 0xc71);
795− __phy_write(phydev, 0x12, 0xc);
796− __phy_write(phydev, 0x10, 0x8fae);
797−
798− /* ResetSyncOffset = 6 */
799− __phy_write(phydev, 0x11, 0x600);
800− __phy_write(phydev, 0x12, 0x0);
801− __phy_write(phydev, 0x10, 0x8fc0);
802−
803− /* VgaDecRate = 1 */
804− __phy_write(phydev, 0x11, 0x4c2a);
805− __phy_write(phydev, 0x12, 0x3e);
806− __phy_write(phydev, 0x10, 0x8fa4);
807−
808− /* FfeUpdGainForce = 4 */
809− __phy_write(phydev, 0x11, 0x240);
810− __phy_write(phydev, 0x12, 0x0);
811− __phy_write(phydev, 0x10, 0x9680);
812−
813− phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
814−}
815−
816820 static void mt7988_phy_finetune(struct phy_device *phydev)
817821 {
818822 u16 val[12] = { 0x0187, 0x01cd, 0x01c8, 0x0182,
@@ -827,17 +831,7 @@ static void mt7988_phy_finetune(struct phy_device *phydev) · 8 unmodified lines
827831 /* TCT finetune */
828832 phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_TX_FILTER, 0x5);
829833
830− /* Disable TX power saving */
831− phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7,
832− MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8);
833−
834834 phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_52B5);
835−
836− /* SlvDSPreadyTime = 24, MasDSPreadyTime = 12 */
837− __phy_write(phydev, 0x11, 0x671);
838− __phy_write(phydev, 0x12, 0xc);
839− __phy_write(phydev, 0x10, 0x8fae);
840−
841835 /* ResetSyncOffset = 5 */
842836 __phy_write(phydev, 0x11, 0x500);
843837 __phy_write(phydev, 0x12, 0x0);
@@ -845,13 +839,27 @@ static void mt7988_phy_finetune(struct phy_device *phydev) · 1 unmodified line
845839
846840 /* VgaDecRate is 1 at default on mt7988 */
847841
848− phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
842+ /* MrvlTrFix100Kp = 6, MrvlTrFix100Kf = 7,
843+ * MrvlTrFix1000Kp = 6, MrvlTrFix1000Kf = 7
844+ */
845+ __phy_write(phydev, 0x11, 0xb90a);
846+ __phy_write(phydev, 0x12, 0x6f);
847+ __phy_write(phydev, 0x10, 0x8f82);
848+
849+ /* RemAckCntLimitCtrl = 1 */
850+ __phy_write(phydev, 0x11, 0xfbba);
851+ __phy_write(phydev, 0x12, 0xc3);
852+ __phy_write(phydev, 0x10, 0x87f8);
849853
850− phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_2A30);
851− /* TxClkOffset = 2 */
852− __phy_modify(phydev, MTK_PHY_ANARG_RG, MTK_PHY_TCLKOFFSET_MASK,
853− FIELD_PREP(MTK_PHY_TCLKOFFSET_MASK, 0x2));
854854 phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0);
855+
856+ /* TR_OPEN_LOOP_EN = 1, lpf_x_average = 10 */
857+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
858+ MTK_PHY_TR_OPEN_LOOP_EN_MASK | MTK_PHY_LPF_X_AVERAGE_MASK,
859+ BIT(0) | FIELD_PREP(MTK_PHY_LPF_X_AVERAGE_MASK, 0xa));
860+
861+ /* rg_tr_lpf_cnt_val = 1023 */
862+ phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_LPF_CNT_VAL, 0x3ff);
855863 }
856864
857865 static void mt798x_phy_eee(struct phy_device *phydev)
@@ -884,11 +892,11 @@ static void mt798x_phy_eee(struct phy_device *phydev) · 26 unmodified lines
884892 MTK_PHY_LPI_SLV_SEND_TX_EN,
885893 FIELD_PREP(MTK_PHY_LPI_SLV_SEND_TX_TIMER_MASK, 0x120));
886894
887− phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239,
888− MTK_PHY_LPI_SEND_LOC_TIMER_MASK |
889− MTK_PHY_LPI_TXPCS_LOC_RCV,
890− FIELD_PREP(MTK_PHY_LPI_SEND_LOC_TIMER_MASK, 0x117));
895+ /* Keep MTK_PHY_LPI_SEND_LOC_TIMER as 375 */
896+ phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG239,
897+ MTK_PHY_LPI_TXPCS_LOC_RCV);
891898
899+ /* This also fixes some IoT issues, such as CH340 */
892900 phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG2C7,
893901 MTK_PHY_MAX_GAIN_MASK | MTK_PHY_MIN_GAIN_MASK,
894902 FIELD_PREP(MTK_PHY_MAX_GAIN_MASK, 0x8) |
@@ -922,7 +930,7 @@ static void mt798x_phy_eee(struct phy_device *phydev) · 27 unmodified lines
922930 __phy_write(phydev, 0x12, 0x0);
923931 __phy_write(phydev, 0x10, 0x9690);
924932
925− /* REG_EEE_st2TrKf1000 = 3 */
933+ /* REG_EEE_st2TrKf1000 = 2 */
926934 __phy_write(phydev, 0x11, 0x114f);
927935 __phy_write(phydev, 0x12, 0x2);
928936 __phy_write(phydev, 0x10, 0x969a);
@@ -947,7 +955,7 @@ static void mt798x_phy_eee(struct phy_device *phydev) · 18 unmodified lines
947955 __phy_write(phydev, 0x12, 0x0);
948956 __phy_write(phydev, 0x10, 0x96b8);
949957
950− /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 1 */
958+ /* REGEEE_wake_slv_tr_wait_dfesigdet_en = 0 */
951959 __phy_write(phydev, 0x11, 0x1463);
952960 __phy_write(phydev, 0x12, 0x0);
953961 __phy_write(phydev, 0x10, 0x96ca);
@@ -1459,6 +1467,13 @@ static int mt7988_phy_probe(struct phy_device *phydev) · 505 unmodified lines
14591467 if (err)
14601468 return err;
14611469
1470+ /* Disable TX power saving at probing to:
1471+ * 1. Meet common mode compliance test criteria
1472+ * 2. Make sure that TX-VCM calibration works fine
1473+ */
1474+ phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RXADC_CTRL_RG7,
1475+ MTK_PHY_DA_AD_BUF_BIAS_LP_MASK, 0x3 << 8);
1476+
14621477 return mt798x_phy_calibration(phydev);
14631478 }
14641479
drivers/net/xen-netback/netback.c+40−44
@@ -104,13 +104,12 @@ bool provides_xdp_headroom = true; · 103 unmodified lines
104104 module_param(provides_xdp_headroom, bool, 0644);
105105
106106 static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
107− u8 status);
107+ s8 status);
108108
109109 static void make_tx_response(struct xenvif_queue *queue,
110− struct xen_netif_tx_request *txp,
110+ const struct xen_netif_tx_request *txp,
111111 unsigned int extra_count,
112− s8 st);
113−static void push_tx_responses(struct xenvif_queue *queue);
112+ s8 status);
114113
115114 static void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx);
116115
@@ -208,13 +207,9 @@ static void xenvif_tx_err(struct xenvif_queue *queue, · 91 unmodified lines
208207 unsigned int extra_count, RING_IDX end)
209208 {
210209 RING_IDX cons = queue->tx.req_cons;
211− unsigned long flags;
212210
213211 do {
214− spin_lock_irqsave(&queue->response_lock, flags);
215212 make_tx_response(queue, txp, extra_count, XEN_NETIF_RSP_ERROR);
216− push_tx_responses(queue);
217− spin_unlock_irqrestore(&queue->response_lock, flags);
218213 if (cons == end)
219214 break;
220215 RING_COPY_REQUEST(&queue->tx, cons++, txp);
@@ -465,12 +460,7 @@ static void xenvif_get_requests(struct xenvif_queue *queue, · 244 unmodified lines
465460 for (shinfo->nr_frags = 0; nr_slots > 0 && shinfo->nr_frags < MAX_SKB_FRAGS;
466461 nr_slots--) {
467462 if (unlikely(!txp->size)) {
468− unsigned long flags;
469−
470− spin_lock_irqsave(&queue->response_lock, flags);
471463 make_tx_response(queue, txp, 0, XEN_NETIF_RSP_OKAY);
472− push_tx_responses(queue);
473− spin_unlock_irqrestore(&queue->response_lock, flags);
474464 ++txp;
475465 continue;
476466 }
@@ -496,14 +486,8 @@ static void xenvif_get_requests(struct xenvif_queue *queue, · 19 unmodified lines
496486
497487 for (shinfo->nr_frags = 0; shinfo->nr_frags < nr_slots; ++txp) {
498488 if (unlikely(!txp->size)) {
499− unsigned long flags;
500−
501− spin_lock_irqsave(&queue->response_lock, flags);
502489 make_tx_response(queue, txp, 0,
503490 XEN_NETIF_RSP_OKAY);
504− push_tx_responses(queue);
505− spin_unlock_irqrestore(&queue->response_lock,
506− flags);
507491 continue;
508492 }
509493
@@ -995,7 +979,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 485 unmodified lines
995979 (ret == 0) ?
996980 XEN_NETIF_RSP_OKAY :
997981 XEN_NETIF_RSP_ERROR);
998− push_tx_responses(queue);
999982 continue;
1000983 }
1001984
@@ -1007,7 +990,6 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue, · 5 unmodified lines
1007990
1008991 make_tx_response(queue, &txreq, extra_count,
1009992 XEN_NETIF_RSP_OKAY);
1010− push_tx_responses(queue);
1011993 continue;
1012994 }
1013995
@@ -1433,8 +1415,35 @@ int xenvif_tx_action(struct xenvif_queue *queue, int budget) · 419 unmodified lines
14331415 return work_done;
14341416 }
14351417
1418+static void _make_tx_response(struct xenvif_queue *queue,
1419+ const struct xen_netif_tx_request *txp,
1420+ unsigned int extra_count,
1421+ s8 status)
1422+{
1423+ RING_IDX i = queue->tx.rsp_prod_pvt;
1424+ struct xen_netif_tx_response *resp;
1425+
1426+ resp = RING_GET_RESPONSE(&queue->tx, i);
1427+ resp->id = txp->id;
1428+ resp->status = status;
1429+
1430+ while (extra_count-- != 0)
1431+ RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL;
1432+
1433+ queue->tx.rsp_prod_pvt = ++i;
1434+}
1435+
1436+static void push_tx_responses(struct xenvif_queue *queue)
1437+{
1438+ int notify;
1439+
1440+ RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
1441+ if (notify)
1442+ notify_remote_via_irq(queue->tx_irq);
1443+}
1444+
14361445 static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx,
1437− u8 status)
1446+ s8 status)
14381447 {
14391448 struct pending_tx_info *pending_tx_info;
14401449 pending_ring_idx_t index;
@@ -1444,8 +1453,8 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, · 3 unmodified lines
14441453
14451454 spin_lock_irqsave(&queue->response_lock, flags);
14461455
1447− make_tx_response(queue, &pending_tx_info->req,
1448− pending_tx_info->extra_count, status);
1456+ _make_tx_response(queue, &pending_tx_info->req,
1457+ pending_tx_info->extra_count, status);
14491458
14501459 /* Release the pending index before pusing the Tx response so
14511460 * its available before a new Tx request is pushed by the
@@ -1459,32 +1468,19 @@ static void xenvif_idx_release(struct xenvif_queue *queue, u16 pending_idx, · 7 unmodified lines
14591468 spin_unlock_irqrestore(&queue->response_lock, flags);
14601469 }
14611470
1462−
14631471 static void make_tx_response(struct xenvif_queue *queue,
1464− struct xen_netif_tx_request *txp,
1472+ const struct xen_netif_tx_request *txp,
14651473 unsigned int extra_count,
1466− s8 st)
1474+ s8 status)
14671475 {
1468− RING_IDX i = queue->tx.rsp_prod_pvt;
1469− struct xen_netif_tx_response *resp;
1470−
1471− resp = RING_GET_RESPONSE(&queue->tx, i);
1472− resp->id = txp->id;
1473− resp->status = st;
1474−
1475− while (extra_count-- != 0)
1476− RING_GET_RESPONSE(&queue->tx, ++i)->status = XEN_NETIF_RSP_NULL;
1476+ unsigned long flags;
14771477
1478− queue->tx.rsp_prod_pvt = ++i;
1479−}
1478+ spin_lock_irqsave(&queue->response_lock, flags);
14801479
1481−static void push_tx_responses(struct xenvif_queue *queue)
1482−{
1483− int notify;
1480+ _make_tx_response(queue, txp, extra_count, status);
1481+ push_tx_responses(queue);
14841482
1485− RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&queue->tx, notify);
1486− if (notify)
1487− notify_remote_via_irq(queue->tx_irq);
1483+ spin_unlock_irqrestore(&queue->response_lock, flags);
14881484 }
14891485
14901486 static void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx)
drivers/platform/mellanox/mlxbf-pmc.c+2−2
@@ -1170,7 +1170,7 @@ static int mlxbf_pmc_program_crspace_counter(int blk_num, uint32_t cnt_num, · 1169 unmodified lines
11701170 int ret;
11711171
11721172 addr = pmc->block[blk_num].mmio_base +
1173− (rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
1173+ ((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
11741174 ret = mlxbf_pmc_readl(addr, &word);
11751175 if (ret)
11761176 return ret;
@@ -1413,7 +1413,7 @@ static int mlxbf_pmc_read_crspace_event(int blk_num, uint32_t cnt_num, · 236 unmodified lines
14131413 int ret;
14141414
14151415 addr = pmc->block[blk_num].mmio_base +
1416− (rounddown(cnt_num, 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
1416+ ((cnt_num / 2) * MLXBF_PMC_CRSPACE_PERFSEL_SZ);
14171417 ret = mlxbf_pmc_readl(addr, &word);
14181418 if (ret)
14191419 return ret;
drivers/platform/mellanox/mlxbf-tmfifo.c+67−0
@@ -47,6 +47,9 @@ · 46 unmodified lines
4747 /* Message with data needs at least two words (for header & data). */
4848 #define MLXBF_TMFIFO_DATA_MIN_WORDS 2
4949
50+/* Tx timeout in milliseconds. */
51+#define TMFIFO_TX_TIMEOUT 2000
52+
5053 /* ACPI UID for BlueField-3. */
5154 #define TMFIFO_BF3_UID 1
5255
@@ -62,12 +65,14 @@ struct mlxbf_tmfifo; · 9 unmodified lines
6265 * @drop_desc: dummy desc for packet dropping
6366 * @cur_len: processed length of the current descriptor
6467 * @rem_len: remaining length of the pending packet
68+ * @rem_padding: remaining bytes to send as paddings
6569 * @pkt_len: total length of the pending packet
6670 * @next_avail: next avail descriptor id
6771 * @num: vring size (number of descriptors)
6872 * @align: vring alignment size
6973 * @index: vring index
7074 * @vdev_id: vring virtio id (VIRTIO_ID_xxx)
75+ * @tx_timeout: expire time of last tx packet
7176 * @fifo: pointer to the tmfifo structure
7277 */
7378 struct mlxbf_tmfifo_vring {
@@ -79,12 +84,14 @@ struct mlxbf_tmfifo_vring { · 5 unmodified lines
7984 struct vring_desc drop_desc;
8085 int cur_len;
8186 int rem_len;
87+ int rem_padding;
8288 u32 pkt_len;
8389 u16 next_avail;
8490 int num;
8591 int align;
8692 int index;
8793 int vdev_id;
94+ unsigned long tx_timeout;
8895 struct mlxbf_tmfifo *fifo;
8996 };
9097
@@ -819,6 +826,50 @@ mlxbf_tmfifo_desc_done: · 728 unmodified lines
819826 return true;
820827 }
821828
829+static void mlxbf_tmfifo_check_tx_timeout(struct mlxbf_tmfifo_vring *vring)
830+{
831+ unsigned long flags;
832+
833+ /* Only handle Tx timeout for network vdev. */
834+ if (vring->vdev_id != VIRTIO_ID_NET)
835+ return;
836+
837+ /* Initialize the timeout or return if not expired. */
838+ if (!vring->tx_timeout) {
839+ /* Initialize the timeout. */
840+ vring->tx_timeout = jiffies +
841+ msecs_to_jiffies(TMFIFO_TX_TIMEOUT);
842+ return;
843+ } else if (time_before(jiffies, vring->tx_timeout)) {
844+ /* Return if not timeout yet. */
845+ return;
846+ }
847+
848+ /*
849+ * Drop the packet after timeout. The outstanding packet is
850+ * released and the remaining bytes will be sent with padding byte 0x00
851+ * as a recovery. On the peer(host) side, the padding bytes 0x00 will be
852+ * either dropped directly, or appended into existing outstanding packet
853+ * thus dropped as corrupted network packet.
854+ */
855+ vring->rem_padding = round_up(vring->rem_len, sizeof(u64));
856+ mlxbf_tmfifo_release_pkt(vring);
857+ vring->cur_len = 0;
858+ vring->rem_len = 0;
859+ vring->fifo->vring[0] = NULL;
860+
861+ /*
862+ * Make sure the load/store are in order before
863+ * returning back to virtio.
864+ */
865+ virtio_mb(false);
866+
867+ /* Notify upper layer. */
868+ spin_lock_irqsave(&vring->fifo->spin_lock[0], flags);
869+ vring_interrupt(0, vring->vq);
870+ spin_unlock_irqrestore(&vring->fifo->spin_lock[0], flags);
871+}
872+
822873 /* Rx & Tx processing of a queue. */
823874 static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx)
824875 {
@@ -841,6 +892,7 @@ static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx) · 16 unmodified lines
841892 return;
842893
843894 do {
895+retry:
844896 /* Get available FIFO space. */
845897 if (avail == 0) {
846898 if (is_rx)
@@ -851,6 +903,17 @@ static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx) · 4 unmodified lines
851903 break;
852904 }
853905
906+ /* Insert paddings for discarded Tx packet. */
907+ if (!is_rx) {
908+ vring->tx_timeout = 0;
909+ while (vring->rem_padding >= sizeof(u64)) {
910+ writeq(0, vring->fifo->tx.data);
911+ vring->rem_padding -= sizeof(u64);
912+ if (--avail == 0)
913+ goto retry;
914+ }
915+ }
916+
854917 /* Console output always comes from the Tx buffer. */
855918 if (!is_rx && devid == VIRTIO_ID_CONSOLE) {
856919 mlxbf_tmfifo_console_tx(fifo, avail);
@@ -860,6 +923,10 @@ static void mlxbf_tmfifo_rxtx(struct mlxbf_tmfifo_vring *vring, bool is_rx) · 3 unmodified lines
860923 /* Handle one descriptor. */
861924 more = mlxbf_tmfifo_rxtx_one_desc(vring, is_rx, &avail);
862925 } while (more);
926+
927+ /* Check Tx timeout. */
928+ if (avail <= 0 && !is_rx)
929+ mlxbf_tmfifo_check_tx_timeout(vring);
863930 }
864931
865932 /* Handle Rx or Tx queues. */
drivers/platform/x86/amd/pmf/Kconfig+1−0
@@ -10,6 +10,7 @@ config AMD_PMF · 9 unmodified lines
1010 depends on AMD_NB
1111 select ACPI_PLATFORM_PROFILE
1212 depends on TEE && AMDTEE
13+ depends on AMD_SFH_HID
1314 help
1415 This driver provides support for the AMD Platform Management Framework.
1516 The goal is to enhance end user experience by making AMD PCs smarter,
drivers/platform/x86/amd/pmf/spc.c+36−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
1010 */
1111
1212 #include <acpi/button.h>
13+#include <linux/amd-pmf-io.h>
1314 #include <linux/power_supply.h>
1415 #include <linux/units.h>
1516 #include "pmf.h"
@@ -44,6 +45,8 @@ void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table * · 28 unmodified lines
4445 dev_dbg(dev->dev, "Max C0 Residency: %u\n", in->ev_info.max_c0residency);
4546 dev_dbg(dev->dev, "GFX Busy: %u\n", in->ev_info.gfx_busy);
4647 dev_dbg(dev->dev, "LID State: %s\n", in->ev_info.lid_state ? "close" : "open");
48+ dev_dbg(dev->dev, "User Presence: %s\n", in->ev_info.user_present ? "Present" : "Away");
49+ dev_dbg(dev->dev, "Ambient Light: %d\n", in->ev_info.ambient_light);
4750 dev_dbg(dev->dev, "==== TA inputs END ====\n");
4851 }
4952 #else
@@ -147,6 +150,38 @@ static int amd_pmf_get_slider_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_ · 97 unmodified lines
147150 return 0;
148151 }
149152
153+static int amd_pmf_get_sensor_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
154+{
155+ struct amd_sfh_info sfh_info;
156+ int ret;
157+
158+ /* Get ALS data */
159+ ret = amd_get_sfh_info(&sfh_info, MT_ALS);
160+ if (!ret)
161+ in->ev_info.ambient_light = sfh_info.ambient_light;
162+ else
163+ return ret;
164+
165+ /* get HPD data */
166+ ret = amd_get_sfh_info(&sfh_info, MT_HPD);
167+ if (ret)
168+ return ret;
169+
170+ switch (sfh_info.user_present) {
171+ case SFH_NOT_DETECTED:
172+ in->ev_info.user_present = 0xff; /* assume no sensors connected */
173+ break;
174+ case SFH_USER_PRESENT:
175+ in->ev_info.user_present = 1;
176+ break;
177+ case SFH_USER_AWAY:
178+ in->ev_info.user_present = 0;
179+ break;
180+ }
181+
182+ return 0;
183+}
184+
150185 void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in)
151186 {
152187 /* TA side lid open is 1 and close is 0, hence the ! here */
@@ -155,4 +190,5 @@ void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_tab · 2 unmodified lines
155190 amd_pmf_get_smu_info(dev, in);
156191 amd_pmf_get_battery_info(dev, in);
157192 amd_pmf_get_slider_info(dev, in);
193+ amd_pmf_get_sensor_info(dev, in);
158194 }
drivers/platform/x86/amd/pmf/tee-if.c+3−1
@@ -298,8 +298,10 @@ static ssize_t amd_pmf_get_pb_data(struct file *filp, const char __user *buf, · 297 unmodified lines
298298 if (!new_policy_buf)
299299 return -ENOMEM;
300300
301− if (copy_from_user(new_policy_buf, buf, length))
301+ if (copy_from_user(new_policy_buf, buf, length)) {
302+ kfree(new_policy_buf);
302303 return -EFAULT;
304+ }
303305
304306 kfree(dev->policy_buf);
305307 dev->policy_buf = new_policy_buf;
drivers/platform/x86/intel/ifs/load.c+2−1
@@ -399,7 +399,8 @@ int ifs_load_firmware(struct device *dev) · 398 unmodified lines
399399 if (fw->size != expected_size) {
400400 dev_err(dev, "File size mismatch (expected %u, actual %zu). Corrupted IFS image.\n",
401401 expected_size, fw->size);
402− return -EINVAL;
402+ ret = -EINVAL;
403+ goto release;
403404 }
404405
405406 ret = image_sanity_check(dev, (struct microcode_header_intel *)fw->data);
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c+41−41
@@ -23,23 +23,23 @@ static int (*uncore_read)(struct uncore_data *data, unsigned int *min, unsigned · 22 unmodified lines
2323 static int (*uncore_write)(struct uncore_data *data, unsigned int input, unsigned int min_max);
2424 static int (*uncore_read_freq)(struct uncore_data *data, unsigned int *freq);
2525
26−static ssize_t show_domain_id(struct device *dev, struct device_attribute *attr, char *buf)
26+static ssize_t show_domain_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
2727 {
28− struct uncore_data *data = container_of(attr, struct uncore_data, domain_id_dev_attr);
28+ struct uncore_data *data = container_of(attr, struct uncore_data, domain_id_kobj_attr);
2929
3030 return sprintf(buf, "%u\n", data->domain_id);
3131 }
3232
33−static ssize_t show_fabric_cluster_id(struct device *dev, struct device_attribute *attr, char *buf)
33+static ssize_t show_fabric_cluster_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
3434 {
35− struct uncore_data *data = container_of(attr, struct uncore_data, fabric_cluster_id_dev_attr);
35+ struct uncore_data *data = container_of(attr, struct uncore_data, fabric_cluster_id_kobj_attr);
3636
3737 return sprintf(buf, "%u\n", data->cluster_id);
3838 }
3939
40−static ssize_t show_package_id(struct device *dev, struct device_attribute *attr, char *buf)
40+static ssize_t show_package_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
4141 {
42− struct uncore_data *data = container_of(attr, struct uncore_data, package_id_dev_attr);
42+ struct uncore_data *data = container_of(attr, struct uncore_data, package_id_kobj_attr);
4343
4444 return sprintf(buf, "%u\n", data->package_id);
4545 }
@@ -97,30 +97,30 @@ static ssize_t show_perf_status_freq_khz(struct uncore_data *data, char *buf) · 51 unmodified lines
9797 }
9898
9999 #define store_uncore_min_max(name, min_max) \
100− static ssize_t store_##name(struct device *dev, \
101− struct device_attribute *attr, \
100+ static ssize_t store_##name(struct kobject *kobj, \
101+ struct kobj_attribute *attr, \
102102 const char *buf, size_t count) \
103103 { \
104− struct uncore_data *data = container_of(attr, struct uncore_data, name##_dev_attr);\
104+ struct uncore_data *data = container_of(attr, struct uncore_data, name##_kobj_attr);\
105105 \
106106 return store_min_max_freq_khz(data, buf, count, \
107107 min_max); \
108108 }
109109
110110 #define show_uncore_min_max(name, min_max) \
111− static ssize_t show_##name(struct device *dev, \
112− struct device_attribute *attr, char *buf)\
111+ static ssize_t show_##name(struct kobject *kobj, \
112+ struct kobj_attribute *attr, char *buf)\
113113 { \
114− struct uncore_data *data = container_of(attr, struct uncore_data, name##_dev_attr);\
114+ struct uncore_data *data = container_of(attr, struct uncore_data, name##_kobj_attr);\
115115 \
116116 return show_min_max_freq_khz(data, buf, min_max); \
117117 }
118118
119119 #define show_uncore_perf_status(name) \
120− static ssize_t show_##name(struct device *dev, \
121− struct device_attribute *attr, char *buf)\
120+ static ssize_t show_##name(struct kobject *kobj, \
121+ struct kobj_attribute *attr, char *buf)\
122122 { \
123− struct uncore_data *data = container_of(attr, struct uncore_data, name##_dev_attr);\
123+ struct uncore_data *data = container_of(attr, struct uncore_data, name##_kobj_attr);\
124124 \
125125 return show_perf_status_freq_khz(data, buf); \
126126 }
@@ -134,11 +134,11 @@ show_uncore_min_max(max_freq_khz, 1); · 7 unmodified lines
134134 show_uncore_perf_status(current_freq_khz);
135135
136136 #define show_uncore_data(member_name) \
137− static ssize_t show_##member_name(struct device *dev, \
138− struct device_attribute *attr, char *buf)\
137+ static ssize_t show_##member_name(struct kobject *kobj, \
138+ struct kobj_attribute *attr, char *buf)\
139139 { \
140140 struct uncore_data *data = container_of(attr, struct uncore_data,\
141− member_name##_dev_attr);\
141+ member_name##_kobj_attr);\
142142 \
143143 return sysfs_emit(buf, "%u\n", \
144144 data->member_name); \
@@ -149,29 +149,29 @@ show_uncore_data(initial_max_freq_khz); · 4 unmodified lines
149149
150150 #define init_attribute_rw(_name) \
151151 do { \
152− sysfs_attr_init(&data->_name##_dev_attr.attr); \
153− data->_name##_dev_attr.show = show_##_name; \
154− data->_name##_dev_attr.store = store_##_name; \
155− data->_name##_dev_attr.attr.name = #_name; \
156− data->_name##_dev_attr.attr.mode = 0644; \
152+ sysfs_attr_init(&data->_name##_kobj_attr.attr); \
153+ data->_name##_kobj_attr.show = show_##_name; \
154+ data->_name##_kobj_attr.store = store_##_name; \
155+ data->_name##_kobj_attr.attr.name = #_name; \
156+ data->_name##_kobj_attr.attr.mode = 0644; \
157157 } while (0)
158158
159159 #define init_attribute_ro(_name) \
160160 do { \
161− sysfs_attr_init(&data->_name##_dev_attr.attr); \
162− data->_name##_dev_attr.show = show_##_name; \
163− data->_name##_dev_attr.store = NULL; \
164− data->_name##_dev_attr.attr.name = #_name; \
165− data->_name##_dev_attr.attr.mode = 0444; \
161+ sysfs_attr_init(&data->_name##_kobj_attr.attr); \
162+ data->_name##_kobj_attr.show = show_##_name; \
163+ data->_name##_kobj_attr.store = NULL; \
164+ data->_name##_kobj_attr.attr.name = #_name; \
165+ data->_name##_kobj_attr.attr.mode = 0444; \
166166 } while (0)
167167
168168 #define init_attribute_root_ro(_name) \
169169 do { \
170− sysfs_attr_init(&data->_name##_dev_attr.attr); \
171− data->_name##_dev_attr.show = show_##_name; \
172− data->_name##_dev_attr.store = NULL; \
173− data->_name##_dev_attr.attr.name = #_name; \
174− data->_name##_dev_attr.attr.mode = 0400; \
170+ sysfs_attr_init(&data->_name##_kobj_attr.attr); \
171+ data->_name##_kobj_attr.show = show_##_name; \
172+ data->_name##_kobj_attr.store = NULL; \
173+ data->_name##_kobj_attr.attr.name = #_name; \
174+ data->_name##_kobj_attr.attr.mode = 0400; \
175175 } while (0)
176176
177177 static int create_attr_group(struct uncore_data *data, char *name)
@@ -186,21 +186,21 @@ static int create_attr_group(struct uncore_data *data, char *name) · 8 unmodified lines
186186
187187 if (data->domain_id != UNCORE_DOMAIN_ID_INVALID) {
188188 init_attribute_root_ro(domain_id);
189− data->uncore_attrs[index++] = &data->domain_id_dev_attr.attr;
189+ data->uncore_attrs[index++] = &data->domain_id_kobj_attr.attr;
190190 init_attribute_root_ro(fabric_cluster_id);
191− data->uncore_attrs[index++] = &data->fabric_cluster_id_dev_attr.attr;
191+ data->uncore_attrs[index++] = &data->fabric_cluster_id_kobj_attr.attr;
192192 init_attribute_root_ro(package_id);
193− data->uncore_attrs[index++] = &data->package_id_dev_attr.attr;
193+ data->uncore_attrs[index++] = &data->package_id_kobj_attr.attr;
194194 }
195195
196− data->uncore_attrs[index++] = &data->max_freq_khz_dev_attr.attr;
197− data->uncore_attrs[index++] = &data->min_freq_khz_dev_attr.attr;
198− data->uncore_attrs[index++] = &data->initial_min_freq_khz_dev_attr.attr;
199− data->uncore_attrs[index++] = &data->initial_max_freq_khz_dev_attr.attr;
196+ data->uncore_attrs[index++] = &data->max_freq_khz_kobj_attr.attr;
197+ data->uncore_attrs[index++] = &data->min_freq_khz_kobj_attr.attr;
198+ data->uncore_attrs[index++] = &data->initial_min_freq_khz_kobj_attr.attr;
199+ data->uncore_attrs[index++] = &data->initial_max_freq_khz_kobj_attr.attr;
200200
201201 ret = uncore_read_freq(data, &freq);
202202 if (!ret)
203− data->uncore_attrs[index++] = &data->current_freq_khz_dev_attr.attr;
203+ data->uncore_attrs[index++] = &data->current_freq_khz_kobj_attr.attr;
204204
205205 data->uncore_attrs[index] = NULL;
206206
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.h+16−16
@@ -26,14 +26,14 @@ · 25 unmodified lines
2626 * @instance_id: Unique instance id to append to directory name
2727 * @name: Sysfs entry name for this instance
2828 * @uncore_attr_group: Attribute group storage
29− * @max_freq_khz_dev_attr: Storage for device attribute max_freq_khz
30− * @mix_freq_khz_dev_attr: Storage for device attribute min_freq_khz
31− * @initial_max_freq_khz_dev_attr: Storage for device attribute initial_max_freq_khz
32− * @initial_min_freq_khz_dev_attr: Storage for device attribute initial_min_freq_khz
33− * @current_freq_khz_dev_attr: Storage for device attribute current_freq_khz
34− * @domain_id_dev_attr: Storage for device attribute domain_id
35− * @fabric_cluster_id_dev_attr: Storage for device attribute fabric_cluster_id
36− * @package_id_dev_attr: Storage for device attribute package_id
29+ * @max_freq_khz_kobj_attr: Storage for kobject attribute max_freq_khz
30+ * @mix_freq_khz_kobj_attr: Storage for kobject attribute min_freq_khz
31+ * @initial_max_freq_khz_kobj_attr: Storage for kobject attribute initial_max_freq_khz
32+ * @initial_min_freq_khz_kobj_attr: Storage for kobject attribute initial_min_freq_khz
33+ * @current_freq_khz_kobj_attr: Storage for kobject attribute current_freq_khz
34+ * @domain_id_kobj_attr: Storage for kobject attribute domain_id
35+ * @fabric_cluster_id_kobj_attr: Storage for kobject attribute fabric_cluster_id
36+ * @package_id_kobj_attr: Storage for kobject attribute package_id
3737 * @uncore_attrs: Attribute storage for group creation
3838 *
3939 * This structure is used to encapsulate all data related to uncore sysfs
@@ -53,14 +53,14 @@ struct uncore_data { · 13 unmodified lines
5353 char name[32];
5454
5555 struct attribute_group uncore_attr_group;
56− struct device_attribute max_freq_khz_dev_attr;
57− struct device_attribute min_freq_khz_dev_attr;
58− struct device_attribute initial_max_freq_khz_dev_attr;
59− struct device_attribute initial_min_freq_khz_dev_attr;
60− struct device_attribute current_freq_khz_dev_attr;
61− struct device_attribute domain_id_dev_attr;
62− struct device_attribute fabric_cluster_id_dev_attr;
63− struct device_attribute package_id_dev_attr;
56+ struct kobj_attribute max_freq_khz_kobj_attr;
57+ struct kobj_attribute min_freq_khz_kobj_attr;
58+ struct kobj_attribute initial_max_freq_khz_kobj_attr;
59+ struct kobj_attribute initial_min_freq_khz_kobj_attr;
60+ struct kobj_attribute current_freq_khz_kobj_attr;
61+ struct kobj_attribute domain_id_kobj_attr;
62+ struct kobj_attribute fabric_cluster_id_kobj_attr;
63+ struct kobj_attribute package_id_kobj_attr;
6464 struct attribute *uncore_attrs[9];
6565 };
6666
drivers/platform/x86/intel/wmi/sbl-fw-update.c+2−2
@@ -32,7 +32,7 @@ static int get_fwu_request(struct device *dev, u32 *out) · 31 unmodified lines
3232 return -ENODEV;
3333
3434 if (obj->type != ACPI_TYPE_INTEGER) {
35− dev_warn(dev, "wmi_query_block returned invalid value\n");
35+ dev_warn(dev, "wmidev_block_query returned invalid value\n");
3636 kfree(obj);
3737 return -EINVAL;
3838 }
@@ -55,7 +55,7 @@ static int set_fwu_request(struct device *dev, u32 in) · 16 unmodified lines
5555
5656 status = wmidev_block_set(to_wmi_device(dev), 0, &input);
5757 if (ACPI_FAILURE(status)) {
58− dev_err(dev, "wmi_set_block failed\n");
58+ dev_err(dev, "wmidev_block_set failed\n");
5959 return -ENODEV;
6060 }
6161
drivers/platform/x86/p2sb.c+140−42
@@ -26,6 +26,21 @@ static const struct x86_cpu_id p2sb_cpu_ids[] = { · 25 unmodified lines
2626 {}
2727 };
2828
29+/*
30+ * Cache BAR0 of P2SB device functions 0 to 7.
31+ * TODO: The constant 8 is the number of functions that PCI specification
32+ * defines. Same definitions exist tree-wide. Unify this definition and
33+ * the other definitions then move to include/uapi/linux/pci.h.
34+ */
35+#define NR_P2SB_RES_CACHE 8
36+
37+struct p2sb_res_cache {
38+ u32 bus_dev_id;
39+ struct resource res;
40+};
41+
42+static struct p2sb_res_cache p2sb_resources[NR_P2SB_RES_CACHE];
43+
2944 static int p2sb_get_devfn(unsigned int *devfn)
3045 {
3146 unsigned int fn = P2SB_DEVFN_DEFAULT;
@@ -39,10 +54,18 @@ static int p2sb_get_devfn(unsigned int *devfn) · 7 unmodified lines
3954 return 0;
4055 }
4156
57+static bool p2sb_valid_resource(struct resource *res)
58+{
59+ if (res->flags)
60+ return true;
61+
62+ return false;
63+}
64+
4265 /* Copy resource from the first BAR of the device in question */
43−static int p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem)
66+static void p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem)
4467 {
45− struct resource *bar0 = &pdev->resource[0];
68+ struct resource *bar0 = pci_resource_n(pdev, 0);
4669
4770 /* Make sure we have no dangling pointers in the output */
4871 memset(mem, 0, sizeof(*mem));
@@ -56,49 +79,66 @@ static int p2sb_read_bar0(struct pci_dev *pdev, struct resource *mem) · 7 unmodified lines
5679 mem->end = bar0->end;
5780 mem->flags = bar0->flags;
5881 mem->desc = bar0->desc;
59−
60− return 0;
6182 }
6283
63−static int p2sb_scan_and_read(struct pci_bus *bus, unsigned int devfn, struct resource *mem)
84+static void p2sb_scan_and_cache_devfn(struct pci_bus *bus, unsigned int devfn)
6485 {
86+ struct p2sb_res_cache *cache = &p2sb_resources[PCI_FUNC(devfn)];
6587 struct pci_dev *pdev;
66− int ret;
6788
6889 pdev = pci_scan_single_device(bus, devfn);
6990 if (!pdev)
70− return -ENODEV;
91+ return;
7192
72− ret = p2sb_read_bar0(pdev, mem);
93+ p2sb_read_bar0(pdev, &cache->res);
94+ cache->bus_dev_id = bus->dev.id;
7395
7496 pci_stop_and_remove_bus_device(pdev);
75− return ret;
7697 }
7798
78−/**
79− * p2sb_bar - Get Primary to Sideband (P2SB) bridge device BAR
80− * @bus: PCI bus to communicate with
81− * @devfn: PCI slot and function to communicate with
82− * @mem: memory resource to be filled in
83− *
84− * The BIOS prevents the P2SB device from being enumerated by the PCI
85− * subsystem, so we need to unhide and hide it back to lookup the BAR.
86− *
87− * if @bus is NULL, the bus 0 in domain 0 will be used.
88− * If @devfn is 0, it will be replaced by devfn of the P2SB device.
89− *
90− * Caller must provide a valid pointer to @mem.
91− *
92− * Locking is handled by pci_rescan_remove_lock mutex.
93− *
94− * Return:
95− * 0 on success or appropriate errno value on error.
96− */
97−int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem)
99+static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn)
100+{
101+ unsigned int slot, fn;
102+
103+ if (PCI_FUNC(devfn) == 0) {
104+ /*
105+ * When function number of the P2SB device is zero, scan it and
106+ * other function numbers, and if devices are available, cache
107+ * their BAR0s.
108+ */
109+ slot = PCI_SLOT(devfn);
110+ for (fn = 0; fn < NR_P2SB_RES_CACHE; fn++)
111+ p2sb_scan_and_cache_devfn(bus, PCI_DEVFN(slot, fn));
112+ } else {
113+ /* Scan the P2SB device and cache its BAR0 */
114+ p2sb_scan_and_cache_devfn(bus, devfn);
115+ }
116+
117+ if (!p2sb_valid_resource(&p2sb_resources[PCI_FUNC(devfn)].res))
118+ return -ENOENT;
119+
120+ return 0;
121+}
122+
123+static struct pci_bus *p2sb_get_bus(struct pci_bus *bus)
124+{
125+ static struct pci_bus *p2sb_bus;
126+
127+ bus = bus ?: p2sb_bus;
128+ if (bus)
129+ return bus;
130+
131+ /* Assume P2SB is on the bus 0 in domain 0 */
132+ p2sb_bus = pci_find_bus(0, 0);
133+ return p2sb_bus;
134+}
135+
136+static int p2sb_cache_resources(void)
98137 {
99− struct pci_dev *pdev_p2sb;
100138 unsigned int devfn_p2sb;
101139 u32 value = P2SBC_HIDE;
140+ struct pci_bus *bus;
141+ u16 class;
102142 int ret;
103143
104144 /* Get devfn for P2SB device itself */
@@ -106,8 +146,17 @@ int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) · 1 unmodified line
106146 if (ret)
107147 return ret;
108148
109− /* if @bus is NULL, use bus 0 in domain 0 */
110− bus = bus ?: pci_find_bus(0, 0);
149+ bus = p2sb_get_bus(NULL);
150+ if (!bus)
151+ return -ENODEV;
152+
153+ /*
154+ * When a device with same devfn exists and its device class is not
155+ * PCI_CLASS_MEMORY_OTHER for P2SB, do not touch it.
156+ */
157+ pci_bus_read_config_word(bus, devfn_p2sb, PCI_CLASS_DEVICE, &class);
158+ if (!PCI_POSSIBLE_ERROR(class) && class != PCI_CLASS_MEMORY_OTHER)
159+ return -ENODEV;
111160
112161 /*
113162 * Prevent concurrent PCI bus scan from seeing the P2SB device and
@@ -115,17 +164,16 @@ int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) · 1 unmodified line
115164 */
116165 pci_lock_rescan_remove();
117166
118− /* Unhide the P2SB device, if needed */
167+ /*
168+ * The BIOS prevents the P2SB device from being enumerated by the PCI
169+ * subsystem, so we need to unhide and hide it back to lookup the BAR.
170+ * Unhide the P2SB device here, if needed.
171+ */
119172 pci_bus_read_config_dword(bus, devfn_p2sb, P2SBC, &value);
120173 if (value & P2SBC_HIDE)
121174 pci_bus_write_config_dword(bus, devfn_p2sb, P2SBC, 0);
122175
123− pdev_p2sb = pci_scan_single_device(bus, devfn_p2sb);
124− if (devfn)
125− ret = p2sb_scan_and_read(bus, devfn, mem);
126− else
127− ret = p2sb_read_bar0(pdev_p2sb, mem);
128− pci_stop_and_remove_bus_device(pdev_p2sb);
176+ ret = p2sb_scan_and_cache(bus, devfn_p2sb);
129177
130178 /* Hide the P2SB device, if it was hidden */
131179 if (value & P2SBC_HIDE)
@@ -133,12 +181,62 @@ int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem) · 1 unmodified line
133181
134182 pci_unlock_rescan_remove();
135183
136− if (ret)
137− return ret;
184+ return ret;
185+}
186+
187+/**
188+ * p2sb_bar - Get Primary to Sideband (P2SB) bridge device BAR
189+ * @bus: PCI bus to communicate with
190+ * @devfn: PCI slot and function to communicate with
191+ * @mem: memory resource to be filled in
192+ *
193+ * If @bus is NULL, the bus 0 in domain 0 will be used.
194+ * If @devfn is 0, it will be replaced by devfn of the P2SB device.
195+ *
196+ * Caller must provide a valid pointer to @mem.
197+ *
198+ * Return:
199+ * 0 on success or appropriate errno value on error.
200+ */
201+int p2sb_bar(struct pci_bus *bus, unsigned int devfn, struct resource *mem)
202+{
203+ struct p2sb_res_cache *cache;
204+ int ret;
205+
206+ bus = p2sb_get_bus(bus);
207+ if (!bus)
208+ return -ENODEV;
209+
210+ if (!devfn) {
211+ ret = p2sb_get_devfn(&devfn);
212+ if (ret)
213+ return ret;
214+ }
138215
139− if (mem->flags == 0)
216+ cache = &p2sb_resources[PCI_FUNC(devfn)];
217+ if (cache->bus_dev_id != bus->dev.id)
140218 return -ENODEV;
141219
220+ if (!p2sb_valid_resource(&cache->res))
221+ return -ENOENT;
222+
223+ memcpy(mem, &cache->res, sizeof(*mem));
142224 return 0;
143225 }
144226 EXPORT_SYMBOL_GPL(p2sb_bar);
227+
228+static int __init p2sb_fs_init(void)
229+{
230+ p2sb_cache_resources();
231+ return 0;
232+}
233+
234+/*
235+ * pci_rescan_remove_lock to avoid access to unhidden P2SB devices can
236+ * not be locked in sysfs pci bus rescan path because of deadlock. To
237+ * avoid the deadlock, access to P2SB devices with the lock at an early
238+ * step in kernel initialization and cache required resources. This
239+ * should happen after subsys_initcall which initializes PCI subsystem
240+ * and before device_initcall which requires P2SB resources.
241+ */
242+fs_initcall(p2sb_fs_init);
drivers/platform/x86/touchscreen_dmi.c+35−0
@@ -944,6 +944,32 @@ static const struct ts_dmi_data teclast_tbook11_data = { · 943 unmodified lines
944944 .properties = teclast_tbook11_props,
945945 };
946946
947+static const struct property_entry teclast_x16_plus_props[] = {
948+ PROPERTY_ENTRY_U32("touchscreen-min-x", 8),
949+ PROPERTY_ENTRY_U32("touchscreen-min-y", 14),
950+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1916),
951+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1264),
952+ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"),
953+ PROPERTY_ENTRY_STRING("firmware-name", "gsl3692-teclast-x16-plus.fw"),
954+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
955+ PROPERTY_ENTRY_BOOL("silead,home-button"),
956+ { }
957+};
958+
959+static const struct ts_dmi_data teclast_x16_plus_data = {
960+ .embedded_fw = {
961+ .name = "silead/gsl3692-teclast-x16-plus.fw",
962+ .prefix = { 0xf0, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 },
963+ .length = 43560,
964+ .sha256 = { 0x9d, 0xb0, 0x3d, 0xf1, 0x00, 0x3c, 0xb5, 0x25,
965+ 0x62, 0x8a, 0xa0, 0x93, 0x4b, 0xe0, 0x4e, 0x75,
966+ 0xd1, 0x27, 0xb1, 0x65, 0x3c, 0xba, 0xa5, 0x0f,
967+ 0xcd, 0xb4, 0xbe, 0x00, 0xbb, 0xf6, 0x43, 0x29 },
968+ },
969+ .acpi_name = "MSSL1680:00",
970+ .properties = teclast_x16_plus_props,
971+};
972+
947973 static const struct property_entry teclast_x3_plus_props[] = {
948974 PROPERTY_ENTRY_U32("touchscreen-size-x", 1980),
949975 PROPERTY_ENTRY_U32("touchscreen-size-y", 1500),
@@ -1612,6 +1638,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { · 662 unmodified lines
16121638 DMI_MATCH(DMI_PRODUCT_SKU, "E5A6_A1"),
16131639 },
16141640 },
1641+ {
1642+ /* Teclast X16 Plus */
1643+ .driver_data = (void *)&teclast_x16_plus_data,
1644+ .matches = {
1645+ DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
1646+ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
1647+ DMI_MATCH(DMI_PRODUCT_SKU, "D3A5_A1"),
1648+ },
1649+ },
16151650 {
16161651 /* Teclast X3 Plus */
16171652 .driver_data = (void *)&teclast_x3_plus_data,
drivers/platform/x86/wmi.c+112−69
@@ -25,6 +25,7 @@ · 24 unmodified lines
2525 #include <linux/list.h>
2626 #include <linux/module.h>
2727 #include <linux/platform_device.h>
28+#include <linux/rwsem.h>
2829 #include <linux/slab.h>
2930 #include <linux/sysfs.h>
3031 #include <linux/types.h>
@@ -56,7 +57,6 @@ static_assert(__alignof__(struct guid_block) == 1); · 25 unmodified lines
5657
5758 enum { /* wmi_block flags */
5859 WMI_READ_TAKES_NO_ARGS,
59− WMI_PROBED,
6060 };
6161
6262 struct wmi_block {
@@ -64,8 +64,10 @@ struct wmi_block { · 1 unmodified line
6464 struct list_head list;
6565 struct guid_block gblock;
6666 struct acpi_device *acpi_device;
67+ struct rw_semaphore notify_lock; /* Protects notify callback add/remove */
6768 wmi_notify_handler handler;
6869 void *handler_data;
70+ bool driver_ready;
6971 unsigned long flags;
7072 };
7173
@@ -219,6 +221,17 @@ static int wmidev_match_guid(struct device *dev, const void *data) · 147 unmodified lines
219221 return 0;
220222 }
221223
224+static int wmidev_match_notify_id(struct device *dev, const void *data)
225+{
226+ struct wmi_block *wblock = dev_to_wblock(dev);
227+ const u32 *notify_id = data;
228+
229+ if (wblock->gblock.flags & ACPI_WMI_EVENT && wblock->gblock.notify_id == *notify_id)
230+ return 1;
231+
232+ return 0;
233+}
234+
222235 static struct bus_type wmi_bus_type;
223236
224237 static struct wmi_device *wmi_find_device_by_guid(const char *guid_string)
@@ -238,6 +251,17 @@ static struct wmi_device *wmi_find_device_by_guid(const char *guid_string) · 13 unmodified lines
238251 return dev_to_wdev(dev);
239252 }
240253
254+static struct wmi_device *wmi_find_event_by_notify_id(const u32 notify_id)
255+{
256+ struct device *dev;
257+
258+ dev = bus_find_device(&wmi_bus_type, NULL, &notify_id, wmidev_match_notify_id);
259+ if (!dev)
260+ return ERR_PTR(-ENODEV);
261+
262+ return to_wmi_device(dev);
263+}
264+
241265 static void wmi_device_put(struct wmi_device *wdev)
242266 {
243267 put_device(&wdev->dev);
@@ -572,32 +596,31 @@ acpi_status wmi_install_notify_handler(const char *guid, · 328 unmodified lines
572596 wmi_notify_handler handler,
573597 void *data)
574598 {
575− struct wmi_block *block;
576− acpi_status status = AE_NOT_EXIST;
577− guid_t guid_input;
578−
579− if (!guid || !handler)
580− return AE_BAD_PARAMETER;
599+ struct wmi_block *wblock;
600+ struct wmi_device *wdev;
601+ acpi_status status;
581602
582− if (guid_parse(guid, &guid_input))
583− return AE_BAD_PARAMETER;
603+ wdev = wmi_find_device_by_guid(guid);
604+ if (IS_ERR(wdev))
605+ return AE_ERROR;
584606
585− list_for_each_entry(block, &wmi_block_list, list) {
586− acpi_status wmi_status;
607+ wblock = container_of(wdev, struct wmi_block, dev);
587608
588− if (guid_equal(&block->gblock.guid, &guid_input)) {
589− if (block->handler)
590− return AE_ALREADY_ACQUIRED;
609+ down_write(&wblock->notify_lock);
610+ if (wblock->handler) {
611+ status = AE_ALREADY_ACQUIRED;
612+ } else {
613+ wblock->handler = handler;
614+ wblock->handler_data = data;
591615
592− block->handler = handler;
593− block->handler_data = data;
616+ if (ACPI_FAILURE(wmi_method_enable(wblock, true)))
617+ dev_warn(&wblock->dev.dev, "Failed to enable device\n");
594618
595− wmi_status = wmi_method_enable(block, true);
596− if ((wmi_status != AE_OK) ||
597− ((wmi_status == AE_OK) && (status == AE_NOT_EXIST)))
598− status = wmi_status;
599− }
619+ status = AE_OK;
600620 }
621+ up_write(&wblock->notify_lock);
622+
623+ wmi_device_put(wdev);
601624
602625 return status;
603626 }
@@ -613,30 +636,31 @@ EXPORT_SYMBOL_GPL(wmi_install_notify_handler); · 9 unmodified lines
613636 */
614637 acpi_status wmi_remove_notify_handler(const char *guid)
615638 {
616− struct wmi_block *block;
617− acpi_status status = AE_NOT_EXIST;
618− guid_t guid_input;
639+ struct wmi_block *wblock;
640+ struct wmi_device *wdev;
641+ acpi_status status;
619642
620− if (!guid)
621− return AE_BAD_PARAMETER;
643+ wdev = wmi_find_device_by_guid(guid);
644+ if (IS_ERR(wdev))
645+ return AE_ERROR;
622646
623− if (guid_parse(guid, &guid_input))
624− return AE_BAD_PARAMETER;
647+ wblock = container_of(wdev, struct wmi_block, dev);
625648
626− list_for_each_entry(block, &wmi_block_list, list) {
627− acpi_status wmi_status;
649+ down_write(&wblock->notify_lock);
650+ if (!wblock->handler) {
651+ status = AE_NULL_ENTRY;
652+ } else {
653+ if (ACPI_FAILURE(wmi_method_enable(wblock, false)))
654+ dev_warn(&wblock->dev.dev, "Failed to disable device\n");
628655
629− if (guid_equal(&block->gblock.guid, &guid_input)) {
630− if (!block->handler)
631− return AE_NULL_ENTRY;
656+ wblock->handler = NULL;
657+ wblock->handler_data = NULL;
632658
633− wmi_status = wmi_method_enable(block, false);
634− block->handler = NULL;
635− block->handler_data = NULL;
636− if (wmi_status != AE_OK || (wmi_status == AE_OK && status == AE_NOT_EXIST))
637− status = wmi_status;
638− }
659+ status = AE_OK;
639660 }
661+ up_write(&wblock->notify_lock);
662+
663+ wmi_device_put(wdev);
640664
641665 return status;
642666 }
@@ -655,15 +679,19 @@ EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); · 12 unmodified lines
655679 acpi_status wmi_get_event_data(u32 event, struct acpi_buffer *out)
656680 {
657681 struct wmi_block *wblock;
682+ struct wmi_device *wdev;
683+ acpi_status status;
658684
659− list_for_each_entry(wblock, &wmi_block_list, list) {
660− struct guid_block *gblock = &wblock->gblock;
685+ wdev = wmi_find_event_by_notify_id(event);
686+ if (IS_ERR(wdev))
687+ return AE_NOT_FOUND;
661688
662− if ((gblock->flags & ACPI_WMI_EVENT) && gblock->notify_id == event)
663− return get_event_data(wblock, out);
664− }
689+ wblock = container_of(wdev, struct wmi_block, dev);
690+ status = get_event_data(wblock, out);
665691
666− return AE_NOT_FOUND;
692+ wmi_device_put(wdev);
693+
694+ return status;
667695 }
668696 EXPORT_SYMBOL_GPL(wmi_get_event_data);
669697
@@ -868,7 +896,7 @@ static int wmi_dev_probe(struct device *dev) · 198 unmodified lines
868896 if (wdriver->probe) {
869897 ret = wdriver->probe(dev_to_wdev(dev),
870898 find_guid_context(wblock, wdriver));
871− if (!ret) {
899+ if (ret) {
872900 if (ACPI_FAILURE(wmi_method_enable(wblock, false)))
873901 dev_warn(dev, "Failed to disable device\n");
874902
@@ -876,7 +904,9 @@ static int wmi_dev_probe(struct device *dev) · 1 unmodified line
876904 }
877905 }
878906
879− set_bit(WMI_PROBED, &wblock->flags);
907+ down_write(&wblock->notify_lock);
908+ wblock->driver_ready = true;
909+ up_write(&wblock->notify_lock);
880910
881911 return 0;
882912 }
@@ -886,7 +916,9 @@ static void wmi_dev_remove(struct device *dev) · 3 unmodified lines
886916 struct wmi_block *wblock = dev_to_wblock(dev);
887917 struct wmi_driver *wdriver = drv_to_wdrv(dev->driver);
888918
889− clear_bit(WMI_PROBED, &wblock->flags);
919+ down_write(&wblock->notify_lock);
920+ wblock->driver_ready = false;
921+ up_write(&wblock->notify_lock);
890922
891923 if (wdriver->remove)
892924 wdriver->remove(dev_to_wdev(dev));
@@ -999,6 +1031,8 @@ static int wmi_create_device(struct device *wmi_bus_dev, · 106 unmodified lines
9991031 wblock->dev.setable = true;
10001032
10011033 out_init:
1034+ init_rwsem(&wblock->notify_lock);
1035+ wblock->driver_ready = false;
10021036 wblock->dev.dev.bus = &wmi_bus_type;
10031037 wblock->dev.dev.parent = wmi_bus_dev;
10041038
@@ -1171,6 +1205,26 @@ acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address, · 166 unmodified lines
11711205 }
11721206 }
11731207
1208+static void wmi_notify_driver(struct wmi_block *wblock)
1209+{
1210+ struct wmi_driver *driver = drv_to_wdrv(wblock->dev.dev.driver);
1211+ struct acpi_buffer data = { ACPI_ALLOCATE_BUFFER, NULL };
1212+ acpi_status status;
1213+
1214+ if (!driver->no_notify_data) {
1215+ status = get_event_data(wblock, &data);
1216+ if (ACPI_FAILURE(status)) {
1217+ dev_warn(&wblock->dev.dev, "Failed to get event data\n");
1218+ return;
1219+ }
1220+ }
1221+
1222+ if (driver->notify)
1223+ driver->notify(&wblock->dev, data.pointer);
1224+
1225+ kfree(data.pointer);
1226+}
1227+
11741228 static int wmi_notify_device(struct device *dev, void *data)
11751229 {
11761230 struct wmi_block *wblock = dev_to_wblock(dev);
@@ -1179,28 +1233,17 @@ static int wmi_notify_device(struct device *dev, void *data) · 2 unmodified lines
11791233 if (!(wblock->gblock.flags & ACPI_WMI_EVENT && wblock->gblock.notify_id == *event))
11801234 return 0;
11811235
1182− /* If a driver is bound, then notify the driver. */
1183− if (test_bit(WMI_PROBED, &wblock->flags) && wblock->dev.dev.driver) {
1184− struct wmi_driver *driver = drv_to_wdrv(wblock->dev.dev.driver);
1185− struct acpi_buffer evdata = { ACPI_ALLOCATE_BUFFER, NULL };
1186− acpi_status status;
1187−
1188− if (!driver->no_notify_data) {
1189− status = get_event_data(wblock, &evdata);
1190− if (ACPI_FAILURE(status)) {
1191− dev_warn(&wblock->dev.dev, "failed to get event data\n");
1192− return -EIO;
1193− }
1194− }
1195−
1196− if (driver->notify)
1197− driver->notify(&wblock->dev, evdata.pointer);
1198−
1199− kfree(evdata.pointer);
1200− } else if (wblock->handler) {
1201− /* Legacy handler */
1202− wblock->handler(*event, wblock->handler_data);
1236+ down_read(&wblock->notify_lock);
1237+ /* The WMI driver notify handler conflicts with the legacy WMI handler.
1238+ * Because of this the WMI driver notify handler takes precedence.
1239+ */
1240+ if (wblock->dev.dev.driver && wblock->driver_ready) {
1241+ wmi_notify_driver(wblock);
1242+ } else {
1243+ if (wblock->handler)
1244+ wblock->handler(*event, wblock->handler_data);
12031245 }
1246+ up_read(&wblock->notify_lock);
12041247
12051248 acpi_bus_generate_netlink_event(wblock->acpi_device->pnp.device_class,
12061249 dev_name(&wblock->dev.dev), *event, 0);
drivers/regulator/max5970-regulator.c+1−1
@@ -392,7 +392,7 @@ static int max597x_regmap_read_clear(struct regmap *map, unsigned int reg, · 391 unmodified lines
392392 return ret;
393393
394394 if (*val)
395− return regmap_write(map, reg, *val);
395+ return regmap_write(map, reg, 0);
396396
397397 return 0;
398398 }
drivers/regulator/pwm-regulator.c+43−0
@@ -157,7 +157,17 @@ static int pwm_regulator_get_voltage(struct regulator_dev *rdev) · 156 unmodified lines
157157
158158 pwm_get_state(drvdata->pwm, &pstate);
159159
160+ if (!pstate.enabled) {
161+ if (pstate.polarity == PWM_POLARITY_INVERSED)
162+ pstate.duty_cycle = pstate.period;
163+ else
164+ pstate.duty_cycle = 0;
165+ }
166+
160167 voltage = pwm_get_relative_duty_cycle(&pstate, duty_unit);
168+ if (voltage < min(max_uV_duty, min_uV_duty) ||
169+ voltage > max(max_uV_duty, min_uV_duty))
170+ return -ENOTRECOVERABLE;
161171
162172 /*
163173 * The dutycycle for min_uV might be greater than the one for max_uV.
@@ -313,6 +323,32 @@ static int pwm_regulator_init_continuous(struct platform_device *pdev, · 149 unmodified lines
313323 return 0;
314324 }
315325
326+static int pwm_regulator_init_boot_on(struct platform_device *pdev,
327+ struct pwm_regulator_data *drvdata,
328+ const struct regulator_init_data *init_data)
329+{
330+ struct pwm_state pstate;
331+
332+ if (!init_data->constraints.boot_on || drvdata->enb_gpio)
333+ return 0;
334+
335+ pwm_get_state(drvdata->pwm, &pstate);
336+ if (pstate.enabled)
337+ return 0;
338+
339+ /*
340+ * Update the duty cycle so the output does not change
341+ * when the regulator core enables the regulator (and
342+ * thus the PWM channel).
343+ */
344+ if (pstate.polarity == PWM_POLARITY_INVERSED)
345+ pstate.duty_cycle = pstate.period;
346+ else
347+ pstate.duty_cycle = 0;
348+
349+ return pwm_apply_might_sleep(drvdata->pwm, &pstate);
350+}
351+
316352 static int pwm_regulator_probe(struct platform_device *pdev)
317353 {
318354 const struct regulator_init_data *init_data;
@@ -372,6 +408,13 @@ static int pwm_regulator_probe(struct platform_device *pdev) · 53 unmodified lines
372408 if (ret)
373409 return ret;
374410
411+ ret = pwm_regulator_init_boot_on(pdev, drvdata, init_data);
412+ if (ret) {
413+ dev_err(&pdev->dev, "Failed to apply boot_on settings: %d\n",
414+ ret);
415+ return ret;
416+ }
417+
375418 regulator = devm_regulator_register(&pdev->dev,
376419 &drvdata->desc, &config);
377420 if (IS_ERR(regulator)) {
drivers/regulator/ti-abb-regulator.c+19−3
@@ -726,9 +726,25 @@ static int ti_abb_probe(struct platform_device *pdev) · 725 unmodified lines
726726 return PTR_ERR(abb->setup_reg);
727727 }
728728
729− abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address");
730− if (IS_ERR(abb->int_base))
731− return PTR_ERR(abb->int_base);
729+ pname = "int-address";
730+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
731+ if (!res) {
732+ dev_err(dev, "Missing '%s' IO resource\n", pname);
733+ return -ENODEV;
734+ }
735+ /*
736+ * The MPU interrupt status register (PRM_IRQSTATUS_MPU) is
737+ * shared between regulator-abb-{ivahd,dspeve,gpu} driver
738+ * instances. Therefore use devm_ioremap() rather than
739+ * devm_platform_ioremap_resource_byname() to avoid busy
740+ * resource region conflicts.
741+ */
742+ abb->int_base = devm_ioremap(dev, res->start,
743+ resource_size(res));
744+ if (!abb->int_base) {
745+ dev_err(dev, "Unable to map '%s'\n", pname);
746+ return -ENOMEM;
747+ }
732748
733749 /* Map Optional resources */
734750 pname = "efuse-address";
drivers/scsi/initio.c+1−2
@@ -371,7 +371,6 @@ static u16 initio_se2_rd(unsigned long base, u8 addr) · 370 unmodified lines
371371 */
372372 static void initio_se2_wr(unsigned long base, u8 addr, u16 val)
373373 {
374− u8 rb;
375374 u8 instr;
376375 int i;
377376
@@ -400,7 +399,7 @@ static void initio_se2_wr(unsigned long base, u8 addr, u16 val) · 22 unmodified lines
400399 udelay(30);
401400 outb(SE2CS, base + TUL_NVRAM); /* -CLK */
402401 udelay(30);
403− if ((rb = inb(base + TUL_NVRAM)) & SE2DI)
402+ if (inb(base + TUL_NVRAM) & SE2DI)
404403 break; /* write complete */
405404 }
406405 outb(0, base + TUL_NVRAM); /* -CS */
drivers/scsi/isci/request.c+1−1
@@ -3387,7 +3387,7 @@ static enum sci_status isci_io_request_build(struct isci_host *ihost, · 3386 unmodified lines
33873387 return SCI_FAILURE;
33883388 }
33893389
3390− return SCI_SUCCESS;
3390+ return status;
33913391 }
33923392
33933393 static struct isci_request *isci_request_from_tag(struct isci_host *ihost, u16 tag)
drivers/scsi/scsi_error.c+4−4
@@ -61,11 +61,11 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd); · 60 unmodified lines
6161 static enum scsi_disposition scsi_try_to_abort_cmd(const struct scsi_host_template *,
6262 struct scsi_cmnd *);
6363
64−void scsi_eh_wakeup(struct Scsi_Host *shost)
64+void scsi_eh_wakeup(struct Scsi_Host *shost, unsigned int busy)
6565 {
6666 lockdep_assert_held(shost->host_lock);
6767
68− if (scsi_host_busy(shost) == shost->host_failed) {
68+ if (busy == shost->host_failed) {
6969 trace_scsi_eh_wakeup(shost);
7070 wake_up_process(shost->ehandler);
7171 SCSI_LOG_ERROR_RECOVERY(5, shost_printk(KERN_INFO, shost,
@@ -88,7 +88,7 @@ void scsi_schedule_eh(struct Scsi_Host *shost) · 16 unmodified lines
8888 if (scsi_host_set_state(shost, SHOST_RECOVERY) == 0 ||
8989 scsi_host_set_state(shost, SHOST_CANCEL_RECOVERY) == 0) {
9090 shost->host_eh_scheduled++;
91− scsi_eh_wakeup(shost);
91+ scsi_eh_wakeup(shost, scsi_host_busy(shost));
9292 }
9393
9494 spin_unlock_irqrestore(shost->host_lock, flags);
@@ -286,7 +286,7 @@ static void scsi_eh_inc_host_failed(struct rcu_head *head) · 191 unmodified lines
286286
287287 spin_lock_irqsave(shost->host_lock, flags);
288288 shost->host_failed++;
289− scsi_eh_wakeup(shost);
289+ scsi_eh_wakeup(shost, scsi_host_busy(shost));
290290 spin_unlock_irqrestore(shost->host_lock, flags);
291291 }
292292
drivers/scsi/scsi_lib.c+1−1
@@ -280,7 +280,7 @@ static void scsi_dec_host_busy(struct Scsi_Host *shost, struct scsi_cmnd *cmd) · 279 unmodified lines
280280 if (unlikely(scsi_host_in_recovery(shost))) {
281281 spin_lock_irqsave(shost->host_lock, flags);
282282 if (shost->host_failed || shost->host_eh_scheduled)
283− scsi_eh_wakeup(shost);
283+ scsi_eh_wakeup(shost, scsi_host_busy(shost));
284284 spin_unlock_irqrestore(shost->host_lock, flags);
285285 }
286286 rcu_read_unlock();
drivers/scsi/scsi_priv.h+1−1
@@ -92,7 +92,7 @@ extern void scmd_eh_abort_handler(struct work_struct *work); · 91 unmodified lines
9292 extern enum blk_eh_timer_return scsi_timeout(struct request *req);
9393 extern int scsi_error_handler(void *host);
9494 extern enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *cmd);
95−extern void scsi_eh_wakeup(struct Scsi_Host *shost);
95+extern void scsi_eh_wakeup(struct Scsi_Host *shost, unsigned int busy);
9696 extern void scsi_eh_scmd_add(struct scsi_cmnd *);
9797 void scsi_eh_ready_devs(struct Scsi_Host *shost,
9898 struct list_head *work_q,
drivers/scsi/storvsc_drv.c+7−5
@@ -330,6 +330,7 @@ enum storvsc_request_type { · 329 unmodified lines
330330 */
331331
332332 static int storvsc_ringbuffer_size = (128 * 1024);
333+static int aligned_ringbuffer_size;
333334 static u32 max_outstanding_req_per_channel;
334335 static int storvsc_change_queue_depth(struct scsi_device *sdev, int queue_depth);
335336
@@ -687,8 +688,8 @@ static void handle_sc_creation(struct vmbus_channel *new_sc) · 351 unmodified lines
687688 new_sc->next_request_id_callback = storvsc_next_request_id;
688689
689690 ret = vmbus_open(new_sc,
690− storvsc_ringbuffer_size,
691− storvsc_ringbuffer_size,
691+ aligned_ringbuffer_size,
692+ aligned_ringbuffer_size,
692693 (void *)&props,
693694 sizeof(struct vmstorage_channel_properties),
694695 storvsc_on_channel_callback, new_sc);
@@ -1973,7 +1974,7 @@ static int storvsc_probe(struct hv_device *device, · 1278 unmodified lines
19731974 dma_set_min_align_mask(&device->device, HV_HYP_PAGE_SIZE - 1);
19741975
19751976 stor_device->port_number = host->host_no;
1976− ret = storvsc_connect_to_vsp(device, storvsc_ringbuffer_size, is_fc);
1977+ ret = storvsc_connect_to_vsp(device, aligned_ringbuffer_size, is_fc);
19771978 if (ret)
19781979 goto err_out1;
19791980
@@ -2164,7 +2165,7 @@ static int storvsc_resume(struct hv_device *hv_dev) · 184 unmodified lines
21642165 {
21652166 int ret;
21662167
2167− ret = storvsc_connect_to_vsp(hv_dev, storvsc_ringbuffer_size,
2168+ ret = storvsc_connect_to_vsp(hv_dev, aligned_ringbuffer_size,
21682169 hv_dev_is_fc(hv_dev));
21692170 return ret;
21702171 }
@@ -2198,8 +2199,9 @@ static int __init storvsc_drv_init(void) · 27 unmodified lines
21982199 * the ring buffer indices) by the max request size (which is
21992200 * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
22002201 */
2202+ aligned_ringbuffer_size = VMBUS_RING_SIZE(storvsc_ringbuffer_size);
22012203 max_outstanding_req_per_channel =
2202− ((storvsc_ringbuffer_size - PAGE_SIZE) /
2204+ ((aligned_ringbuffer_size - PAGE_SIZE) /
22032205 ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
22042206 sizeof(struct vstor_packet) + sizeof(u64),
22052207 sizeof(u64)));
drivers/scsi/virtio_scsi.c+0−2
@@ -188,8 +188,6 @@ static void virtscsi_vq_done(struct virtio_scsi *vscsi, · 187 unmodified lines
188188 while ((buf = virtqueue_get_buf(vq, &len)) != NULL)
189189 fn(vscsi, buf);
190190
191− if (unlikely(virtqueue_is_broken(vq)))
192− break;
193191 } while (!virtqueue_enable_cb(vq));
194192 spin_unlock_irqrestore(&virtscsi_vq->vq_lock, flags);
195193 }
drivers/soc/apple/mailbox.c+3−3
@@ -296,14 +296,14 @@ struct apple_mbox *apple_mbox_get(struct device *dev, int index) · 295 unmodified lines
296296 of_node_put(args.np);
297297
298298 if (!pdev)
299− return ERR_PTR(EPROBE_DEFER);
299+ return ERR_PTR(-EPROBE_DEFER);
300300
301301 mbox = platform_get_drvdata(pdev);
302302 if (!mbox)
303− return ERR_PTR(EPROBE_DEFER);
303+ return ERR_PTR(-EPROBE_DEFER);
304304
305305 if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER))
306− return ERR_PTR(ENODEV);
306+ return ERR_PTR(-ENODEV);
307307
308308 return mbox;
309309 }
drivers/spi/spi-bcm-qspi.c+2−2
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 #include <linux/platform_device.h>
2020 #include <linux/slab.h>
2121 #include <linux/spi/spi.h>
22−#include <linux/spi/spi-mem.h>
22+#include <linux/mtd/spi-nor.h>
2323 #include <linux/sysfs.h>
2424 #include <linux/types.h>
2525 #include "spi-bcm-qspi.h"
@@ -1221,7 +1221,7 @@ static int bcm_qspi_exec_mem_op(struct spi_mem *mem, · 1195 unmodified lines
12211221
12221222 /* non-aligned and very short transfers are handled by MSPI */
12231223 if (!IS_ALIGNED((uintptr_t)addr, 4) || !IS_ALIGNED((uintptr_t)buf, 4) ||
1224− len < 4)
1224+ len < 4 || op->cmd.opcode == SPINOR_OP_RDSFDP)
12251225 mspi_read = true;
12261226
12271227 if (!has_bspi(qspi) || mspi_read)
drivers/spi/spi-cadence.c+9−8
@@ -317,6 +317,15 @@ static void cdns_spi_process_fifo(struct cdns_spi *xspi, int ntx, int nrx) · 316 unmodified lines
317317 xspi->rx_bytes -= nrx;
318318
319319 while (ntx || nrx) {
320+ if (nrx) {
321+ u8 data = cdns_spi_read(xspi, CDNS_SPI_RXD);
322+
323+ if (xspi->rxbuf)
324+ *xspi->rxbuf++ = data;
325+
326+ nrx--;
327+ }
328+
320329 if (ntx) {
321330 if (xspi->txbuf)
322331 cdns_spi_write(xspi, CDNS_SPI_TXD, *xspi->txbuf++);
@@ -326,14 +335,6 @@ static void cdns_spi_process_fifo(struct cdns_spi *xspi, int ntx, int nrx) · 3 unmodified lines
326335 ntx--;
327336 }
328337
329− if (nrx) {
330− u8 data = cdns_spi_read(xspi, CDNS_SPI_RXD);
331−
332− if (xspi->rxbuf)
333− *xspi->rxbuf++ = data;
334−
335− nrx--;
336− }
337338 }
338339 }
339340
drivers/spi/spi-cs42l43.c+4−1
@@ -244,7 +244,10 @@ static int cs42l43_spi_probe(struct platform_device *pdev) · 243 unmodified lines
244244 priv->ctlr->use_gpio_descriptors = true;
245245 priv->ctlr->auto_runtime_pm = true;
246246
247− devm_pm_runtime_enable(priv->dev);
247+ ret = devm_pm_runtime_enable(priv->dev);
248+ if (ret)
249+ return ret;
250+
248251 pm_runtime_idle(priv->dev);
249252
250253 regmap_write(priv->regmap, CS42L43_TRAN_CONFIG6, CS42L43_FIFO_SIZE - 1);
drivers/spi/spi-hisi-sfc-v3xx.c+5−0
@@ -377,6 +377,11 @@ static const struct spi_controller_mem_ops hisi_sfc_v3xx_mem_ops = { · 376 unmodified lines
377377 static irqreturn_t hisi_sfc_v3xx_isr(int irq, void *data)
378378 {
379379 struct hisi_sfc_v3xx_host *host = data;
380+ u32 reg;
381+
382+ reg = readl(host->regbase + HISI_SFC_V3XX_INT_STAT);
383+ if (!reg)
384+ return IRQ_NONE;
380385
381386 hisi_sfc_v3xx_disable_int(host);
382387
drivers/spi/spi-imx.c+2−2
@@ -1344,7 +1344,7 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx, · 1343 unmodified lines
13441344 controller->dma_tx = dma_request_chan(dev, "tx");
13451345 if (IS_ERR(controller->dma_tx)) {
13461346 ret = PTR_ERR(controller->dma_tx);
1347− dev_dbg(dev, "can't get the TX DMA channel, error %d!\n", ret);
1347+ dev_err_probe(dev, ret, "can't get the TX DMA channel!\n");
13481348 controller->dma_tx = NULL;
13491349 goto err;
13501350 }
@@ -1353,7 +1353,7 @@ static int spi_imx_sdma_init(struct device *dev, struct spi_imx_data *spi_imx, · 2 unmodified lines
13531353 controller->dma_rx = dma_request_chan(dev, "rx");
13541354 if (IS_ERR(controller->dma_rx)) {
13551355 ret = PTR_ERR(controller->dma_rx);
1356− dev_dbg(dev, "can't get the RX DMA channel, error %d\n", ret);
1356+ dev_err_probe(dev, ret, "can't get the RX DMA channel!\n");
13571357 controller->dma_rx = NULL;
13581358 goto err;
13591359 }
drivers/spi/spi-intel-pci.c+1−1
@@ -76,6 +76,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = { · 75 unmodified lines
7676 { PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info },
7777 { PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info },
7878 { PCI_VDEVICE(INTEL, 0x7e23), (unsigned long)&cnl_info },
79+ { PCI_VDEVICE(INTEL, 0x7f24), (unsigned long)&cnl_info },
7980 { PCI_VDEVICE(INTEL, 0x9d24), (unsigned long)&cnl_info },
8081 { PCI_VDEVICE(INTEL, 0x9da4), (unsigned long)&cnl_info },
8182 { PCI_VDEVICE(INTEL, 0xa0a4), (unsigned long)&cnl_info },
@@ -84,7 +85,6 @@ static const struct pci_device_id intel_spi_pci_ids[] = { · 2 unmodified lines
8485 { PCI_VDEVICE(INTEL, 0xa2a4), (unsigned long)&cnl_info },
8586 { PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info },
8687 { PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info },
87− { PCI_VDEVICE(INTEL, 0xae23), (unsigned long)&cnl_info },
8888 { },
8989 };
9090 MODULE_DEVICE_TABLE(pci, intel_spi_pci_ids);
drivers/spi/spi-sh-msiof.c+8−8
@@ -136,14 +136,14 @@ struct sh_msiof_spi_priv { · 135 unmodified lines
136136
137137 /* SIFCTR */
138138 #define SIFCTR_TFWM_MASK GENMASK(31, 29) /* Transmit FIFO Watermark */
139−#define SIFCTR_TFWM_64 (0 << 29) /* Transfer Request when 64 empty stages */
140−#define SIFCTR_TFWM_32 (1 << 29) /* Transfer Request when 32 empty stages */
141−#define SIFCTR_TFWM_24 (2 << 29) /* Transfer Request when 24 empty stages */
142−#define SIFCTR_TFWM_16 (3 << 29) /* Transfer Request when 16 empty stages */
143−#define SIFCTR_TFWM_12 (4 << 29) /* Transfer Request when 12 empty stages */
144−#define SIFCTR_TFWM_8 (5 << 29) /* Transfer Request when 8 empty stages */
145−#define SIFCTR_TFWM_4 (6 << 29) /* Transfer Request when 4 empty stages */
146−#define SIFCTR_TFWM_1 (7 << 29) /* Transfer Request when 1 empty stage */
139+#define SIFCTR_TFWM_64 (0UL << 29) /* Transfer Request when 64 empty stages */
140+#define SIFCTR_TFWM_32 (1UL << 29) /* Transfer Request when 32 empty stages */
141+#define SIFCTR_TFWM_24 (2UL << 29) /* Transfer Request when 24 empty stages */
142+#define SIFCTR_TFWM_16 (3UL << 29) /* Transfer Request when 16 empty stages */
143+#define SIFCTR_TFWM_12 (4UL << 29) /* Transfer Request when 12 empty stages */
144+#define SIFCTR_TFWM_8 (5UL << 29) /* Transfer Request when 8 empty stages */
145+#define SIFCTR_TFWM_4 (6UL << 29) /* Transfer Request when 4 empty stages */
146+#define SIFCTR_TFWM_1 (7UL << 29) /* Transfer Request when 1 empty stage */
147147 #define SIFCTR_TFUA_MASK GENMASK(26, 20) /* Transmit FIFO Usable Area */
148148 #define SIFCTR_TFUA_SHIFT 20
149149 #define SIFCTR_TFUA(i) ((i) << SIFCTR_TFUA_SHIFT)
drivers/spi/spi.c+4−0
@@ -1717,6 +1717,10 @@ static int __spi_pump_transfer_message(struct spi_controller *ctlr, · 1716 unmodified lines
17171717 pm_runtime_put_noidle(ctlr->dev.parent);
17181718 dev_err(&ctlr->dev, "Failed to power device: %d\n",
17191719 ret);
1720+
1721+ msg->status = ret;
1722+ spi_finalize_current_message(ctlr);
1723+
17201724 return ret;
17211725 }
17221726 }
drivers/thermal/intel/intel_powerclamp.c+0−32
@@ -49,7 +49,6 @@ · 48 unmodified lines
4949 */
5050 #define DEFAULT_DURATION_JIFFIES (6)
5151
52−static unsigned int target_mwait;
5352 static struct dentry *debug_dir;
5453 static bool poll_pkg_cstate_enable;
5554
@@ -312,34 +311,6 @@ MODULE_PARM_DESC(window_size, "sliding window in number of clamping cycles\n" · 256 unmodified lines
312311 "\twindow size results in slower response time but more smooth\n"
313312 "\tclamping results. default to 2.");
314313
315−static void find_target_mwait(void)
316−{
317− unsigned int eax, ebx, ecx, edx;
318− unsigned int highest_cstate = 0;
319− unsigned int highest_subcstate = 0;
320− int i;
321−
322− if (boot_cpu_data.cpuid_level < CPUID_MWAIT_LEAF)
323− return;
324−
325− cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
326−
327− if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
328− !(ecx & CPUID5_ECX_INTERRUPT_BREAK))
329− return;
330−
331− edx >>= MWAIT_SUBSTATE_SIZE;
332− for (i = 0; i < 7 && edx; i++, edx >>= MWAIT_SUBSTATE_SIZE) {
333− if (edx & MWAIT_SUBSTATE_MASK) {
334− highest_cstate = i;
335− highest_subcstate = edx & MWAIT_SUBSTATE_MASK;
336− }
337− }
338− target_mwait = (highest_cstate << MWAIT_SUBSTATE_SIZE) |
339− (highest_subcstate - 1);
340−
341−}
342−
343314 struct pkg_cstate_info {
344315 bool skip;
345316 int msr_index;
@@ -759,9 +730,6 @@ static int __init powerclamp_probe(void) · 413 unmodified lines
759730 return -ENODEV;
760731 }
761732
762− /* find the deepest mwait value */
763− find_target_mwait();
764−
765733 return 0;
766734 }
767735
fs/bcachefs/alloc_background.c+1−1
@@ -1715,7 +1715,7 @@ static int bch2_discard_one_bucket(struct btree_trans *trans, · 1714 unmodified lines
17151715 * This works without any other locks because this is the only
17161716 * thread that removes items from the need_discard tree
17171717 */
1718− bch2_trans_unlock(trans);
1718+ bch2_trans_unlock_long(trans);
17191719 blkdev_issue_discard(ca->disk_sb.bdev,
17201720 k.k->p.offset * ca->mi.bucket_size,
17211721 ca->mi.bucket_size,
fs/bcachefs/btree_locking.c+2−2
@@ -92,7 +92,7 @@ static noinline void print_cycle(struct printbuf *out, struct lock_graph *g) · 91 unmodified lines
9292 continue;
9393
9494 bch2_btree_trans_to_text(out, i->trans);
95− bch2_prt_task_backtrace(out, task, i == g->g ? 5 : 1);
95+ bch2_prt_task_backtrace(out, task, i == g->g ? 5 : 1, GFP_NOWAIT);
9696 }
9797 }
9898
@@ -227,7 +227,7 @@ static noinline int break_cycle(struct lock_graph *g, struct printbuf *cycle) · 128 unmodified lines
227227 prt_printf(&buf, "backtrace:");
228228 prt_newline(&buf);
229229 printbuf_indent_add(&buf, 2);
230− bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2);
230+ bch2_prt_task_backtrace(&buf, trans->locking_wait.task, 2, GFP_NOWAIT);
231231 printbuf_indent_sub(&buf, 2);
232232 prt_newline(&buf);
233233 }
fs/bcachefs/debug.c+1−1
@@ -627,7 +627,7 @@ restart: · 626 unmodified lines
627627 prt_printf(&i->buf, "backtrace:");
628628 prt_newline(&i->buf);
629629 printbuf_indent_add(&i->buf, 2);
630− bch2_prt_task_backtrace(&i->buf, task, 0);
630+ bch2_prt_task_backtrace(&i->buf, task, 0, GFP_KERNEL);
631631 printbuf_indent_sub(&i->buf, 2);
632632 prt_newline(&i->buf);
633633
fs/bcachefs/fs-io.c+1−1
@@ -79,7 +79,7 @@ void bch2_inode_flush_nocow_writes_async(struct bch_fs *c, · 78 unmodified lines
7979 continue;
8080
8181 bio = container_of(bio_alloc_bioset(ca->disk_sb.bdev, 0,
82− REQ_OP_FLUSH,
82+ REQ_OP_WRITE|REQ_PREFLUSH,
8383 GFP_KERNEL,
8484 &c->nocow_flush_bioset),
8585 struct nocow_flush, bio);
fs/bcachefs/fsck.c+12−11
@@ -119,22 +119,19 @@ static int lookup_inode(struct btree_trans *trans, u64 inode_nr, · 118 unmodified lines
119119 if (!ret)
120120 *snapshot = iter.pos.snapshot;
121121 err:
122− bch_err_msg(trans->c, ret, "fetching inode %llu:%u", inode_nr, *snapshot);
123122 bch2_trans_iter_exit(trans, &iter);
124123 return ret;
125124 }
126125
127−static int __lookup_dirent(struct btree_trans *trans,
126+static int lookup_dirent_in_snapshot(struct btree_trans *trans,
128127 struct bch_hash_info hash_info,
129128 subvol_inum dir, struct qstr *name,
130− u64 *target, unsigned *type)
129+ u64 *target, unsigned *type, u32 snapshot)
131130 {
132131 struct btree_iter iter;
133132 struct bkey_s_c_dirent d;
134− int ret;
135−
136− ret = bch2_hash_lookup(trans, &iter, bch2_dirent_hash_desc,
137− &hash_info, dir, name, 0);
133+ int ret = bch2_hash_lookup_in_snapshot(trans, &iter, bch2_dirent_hash_desc,
134+ &hash_info, dir, name, 0, snapshot);
138135 if (ret)
139136 return ret;
140137
@@ -225,15 +222,16 @@ static int lookup_lostfound(struct btree_trans *trans, u32 snapshot, · 84 unmodified lines
225222
226223 struct bch_inode_unpacked root_inode;
227224 struct bch_hash_info root_hash_info;
228− ret = lookup_inode(trans, root_inum.inum, &root_inode, &snapshot);
225+ u32 root_inode_snapshot = snapshot;
226+ ret = lookup_inode(trans, root_inum.inum, &root_inode, &root_inode_snapshot);
229227 bch_err_msg(c, ret, "looking up root inode");
230228 if (ret)
231229 return ret;
232230
233231 root_hash_info = bch2_hash_info_init(c, &root_inode);
234232
235− ret = __lookup_dirent(trans, root_hash_info, root_inum,
236− &lostfound_str, &inum, &d_type);
233+ ret = lookup_dirent_in_snapshot(trans, root_hash_info, root_inum,
234+ &lostfound_str, &inum, &d_type, snapshot);
237235 if (bch2_err_matches(ret, ENOENT))
238236 goto create_lostfound;
239237
@@ -250,7 +248,10 @@ static int lookup_lostfound(struct btree_trans *trans, u32 snapshot, · 10 unmodified lines
250248 * The bch2_check_dirents pass has already run, dangling dirents
251249 * shouldn't exist here:
252250 */
253− return lookup_inode(trans, inum, lostfound, &snapshot);
251+ ret = lookup_inode(trans, inum, lostfound, &snapshot);
252+ bch_err_msg(c, ret, "looking up lost+found %llu:%u in (root inode %llu, snapshot root %u)",
253+ inum, snapshot, root_inum.inum, bch2_snapshot_root(c, snapshot));
254+ return ret;
254255
255256 create_lostfound:
256257 /*
fs/bcachefs/journal.c+1−1
@@ -233,7 +233,7 @@ static void __journal_entry_close(struct journal *j, unsigned closed_val, bool t · 232 unmodified lines
233233 prt_str(&pbuf, "entry size: ");
234234 prt_human_readable_u64(&pbuf, vstruct_bytes(buf->data));
235235 prt_newline(&pbuf);
236− bch2_prt_task_backtrace(&pbuf, current, 1);
236+ bch2_prt_task_backtrace(&pbuf, current, 1, GFP_NOWAIT);
237237 trace_journal_entry_close(c, pbuf.buf);
238238 printbuf_exit(&pbuf);
239239 }
fs/bcachefs/journal_io.c+2−1
@@ -1988,7 +1988,8 @@ CLOSURE_CALLBACK(bch2_journal_write) · 1987 unmodified lines
19881988 percpu_ref_get(&ca->io_ref);
19891989
19901990 bio = ca->journal.bio;
1991− bio_reset(bio, ca->disk_sb.bdev, REQ_OP_FLUSH);
1991+ bio_reset(bio, ca->disk_sb.bdev,
1992+ REQ_OP_WRITE|REQ_PREFLUSH);
19921993 bio->bi_end_io = journal_write_endio;
19931994 bio->bi_private = ca;
19941995 closure_bio_submit(bio, cl);
fs/bcachefs/str_hash.h+15−7
@@ -160,21 +160,16 @@ static inline bool is_visible_key(struct bch_hash_desc desc, subvol_inum inum, s · 159 unmodified lines
160160 }
161161
162162 static __always_inline int
163−bch2_hash_lookup(struct btree_trans *trans,
163+bch2_hash_lookup_in_snapshot(struct btree_trans *trans,
164164 struct btree_iter *iter,
165165 const struct bch_hash_desc desc,
166166 const struct bch_hash_info *info,
167167 subvol_inum inum, const void *key,
168− unsigned flags)
168+ unsigned flags, u32 snapshot)
169169 {
170170 struct bkey_s_c k;
171− u32 snapshot;
172171 int ret;
173172
174− ret = bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot);
175− if (ret)
176− return ret;
177−
178173 for_each_btree_key_upto_norestart(trans, *iter, desc.btree_id,
179174 SPOS(inum.inum, desc.hash_key(info, key), snapshot),
180175 POS(inum.inum, U64_MAX),
@@ -194,6 +189,19 @@ bch2_hash_lookup(struct btree_trans *trans, · 13 unmodified lines
194189 return ret ?: -BCH_ERR_ENOENT_str_hash_lookup;
195190 }
196191
192+static __always_inline int
193+bch2_hash_lookup(struct btree_trans *trans,
194+ struct btree_iter *iter,
195+ const struct bch_hash_desc desc,
196+ const struct bch_hash_info *info,
197+ subvol_inum inum, const void *key,
198+ unsigned flags)
199+{
200+ u32 snapshot;
201+ return bch2_subvolume_get_snapshot(trans, inum.subvol, &snapshot) ?:
202+ bch2_hash_lookup_in_snapshot(trans, iter, desc, info, inum, key, flags, snapshot);
203+}
204+
197205 static __always_inline int
198206 bch2_hash_hole(struct btree_trans *trans,
199207 struct btree_iter *iter,
fs/bcachefs/util.c+5−5
@@ -272,14 +272,14 @@ void bch2_print_string_as_lines(const char *prefix, const char *lines) · 271 unmodified lines
272272 console_unlock();
273273 }
274274
275−int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *task, unsigned skipnr)
275+int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *task, unsigned skipnr,
276+ gfp_t gfp)
276277 {
277278 #ifdef CONFIG_STACKTRACE
278279 unsigned nr_entries = 0;
279− int ret = 0;
280280
281281 stack->nr = 0;
282− ret = darray_make_room(stack, 32);
282+ int ret = darray_make_room_gfp(stack, 32, gfp);
283283 if (ret)
284284 return ret;
285285
@@ -308,10 +308,10 @@ void bch2_prt_backtrace(struct printbuf *out, bch_stacktrace *stack) · 22 unmodified lines
308308 }
309309 }
310310
311−int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task, unsigned skipnr)
311+int bch2_prt_task_backtrace(struct printbuf *out, struct task_struct *task, unsigned skipnr, gfp_t gfp)
312312 {
313313 bch_stacktrace stack = { 0 };
314− int ret = bch2_save_backtrace(&stack, task, skipnr + 1);
314+ int ret = bch2_save_backtrace(&stack, task, skipnr + 1, gfp);
315315
316316 bch2_prt_backtrace(out, &stack);
317317 darray_exit(&stack);
fs/bcachefs/util.h+2−2
@@ -348,9 +348,9 @@ void bch2_prt_u64_base2(struct printbuf *, u64); · 347 unmodified lines
348348 void bch2_print_string_as_lines(const char *prefix, const char *lines);
349349
350350 typedef DARRAY(unsigned long) bch_stacktrace;
351−int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned);
351+int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned, gfp_t);
352352 void bch2_prt_backtrace(struct printbuf *, bch_stacktrace *);
353−int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned);
353+int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned, gfp_t);
354354
355355 static inline void prt_bdevname(struct printbuf *out, struct block_device *bdev)
356356 {
fs/erofs/compress.h+2−3
@@ -11,13 +11,12 @@ · 10 unmodified lines
1111 struct z_erofs_decompress_req {
1212 struct super_block *sb;
1313 struct page **in, **out;
14−
1514 unsigned short pageofs_in, pageofs_out;
1615 unsigned int inputsize, outputsize;
1716
18− /* indicate the algorithm will be used for decompression */
19− unsigned int alg;
17+ unsigned int alg; /* the algorithm for decompression */
2018 bool inplace_io, partial_decoding, fillgaps;
19+ gfp_t gfp; /* allocation flags for extra temporary buffers */
2120 };
2221
2322 struct z_erofs_decompressor {
fs/erofs/decompressor.c+3−2
@@ -111,8 +111,9 @@ static int z_erofs_lz4_prepare_dstpages(struct z_erofs_lz4_decompress_ctx *ctx, · 110 unmodified lines
111111 victim = availables[--top];
112112 get_page(victim);
113113 } else {
114− victim = erofs_allocpage(pagepool,
115− GFP_KERNEL | __GFP_NOFAIL);
114+ victim = erofs_allocpage(pagepool, rq->gfp);
115+ if (!victim)
116+ return -ENOMEM;
116117 set_page_private(victim, Z_EROFS_SHORTLIVED_PAGE);
117118 }
118119 rq->out[i] = victim;
fs/erofs/decompressor_deflate.c+13−6
@@ -95,7 +95,7 @@ int z_erofs_load_deflate_config(struct super_block *sb, · 94 unmodified lines
9595 }
9696
9797 int z_erofs_deflate_decompress(struct z_erofs_decompress_req *rq,
98− struct page **pagepool)
98+ struct page **pgpl)
9999 {
100100 const unsigned int nrpages_out =
101101 PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT;
@@ -158,8 +158,12 @@ again: · 56 unmodified lines
158158 strm->z.avail_out = min_t(u32, outsz, PAGE_SIZE - pofs);
159159 outsz -= strm->z.avail_out;
160160 if (!rq->out[no]) {
161− rq->out[no] = erofs_allocpage(pagepool,
162− GFP_KERNEL | __GFP_NOFAIL);
161+ rq->out[no] = erofs_allocpage(pgpl, rq->gfp);
162+ if (!rq->out[no]) {
163+ kout = NULL;
164+ err = -ENOMEM;
165+ break;
166+ }
163167 set_page_private(rq->out[no],
164168 Z_EROFS_SHORTLIVED_PAGE);
165169 }
@@ -211,8 +215,11 @@ again: · 45 unmodified lines
211215
212216 DBG_BUGON(erofs_page_is_managed(EROFS_SB(sb),
213217 rq->in[j]));
214− tmppage = erofs_allocpage(pagepool,
215− GFP_KERNEL | __GFP_NOFAIL);
218+ tmppage = erofs_allocpage(pgpl, rq->gfp);
219+ if (!tmppage) {
220+ err = -ENOMEM;
221+ goto failed;
222+ }
216223 set_page_private(tmppage, Z_EROFS_SHORTLIVED_PAGE);
217224 copy_highpage(tmppage, rq->in[j]);
218225 rq->in[j] = tmppage;
@@ -230,7 +237,7 @@ again: · 11 unmodified lines
230237 break;
231238 }
232239 }
233−
240+failed:
234241 if (zlib_inflateEnd(&strm->z) != Z_OK && !err)
235242 err = -EIO;
236243 if (kout)
fs/erofs/decompressor_lzma.c+12−5
@@ -148,7 +148,7 @@ again: · 147 unmodified lines
148148 }
149149
150150 int z_erofs_lzma_decompress(struct z_erofs_decompress_req *rq,
151− struct page **pagepool)
151+ struct page **pgpl)
152152 {
153153 const unsigned int nrpages_out =
154154 PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT;
@@ -215,8 +215,11 @@ again: · 60 unmodified lines
215215 PAGE_SIZE - pageofs);
216216 outlen -= strm->buf.out_size;
217217 if (!rq->out[no] && rq->fillgaps) { /* deduped */
218− rq->out[no] = erofs_allocpage(pagepool,
219− GFP_KERNEL | __GFP_NOFAIL);
218+ rq->out[no] = erofs_allocpage(pgpl, rq->gfp);
219+ if (!rq->out[no]) {
220+ err = -ENOMEM;
221+ break;
222+ }
220223 set_page_private(rq->out[no],
221224 Z_EROFS_SHORTLIVED_PAGE);
222225 }
@@ -258,8 +261,11 @@ again: · 35 unmodified lines
258261
259262 DBG_BUGON(erofs_page_is_managed(EROFS_SB(rq->sb),
260263 rq->in[j]));
261− tmppage = erofs_allocpage(pagepool,
262− GFP_KERNEL | __GFP_NOFAIL);
264+ tmppage = erofs_allocpage(pgpl, rq->gfp);
265+ if (!tmppage) {
266+ err = -ENOMEM;
267+ goto failed;
268+ }
263269 set_page_private(tmppage, Z_EROFS_SHORTLIVED_PAGE);
264270 copy_highpage(tmppage, rq->in[j]);
265271 rq->in[j] = tmppage;
@@ -277,6 +283,7 @@ again: · 11 unmodified lines
277283 break;
278284 }
279285 }
286+failed:
280287 if (no < nrpages_out && strm->buf.out)
281288 kunmap(rq->out[no]);
282289 if (ni < nrpages_in)
fs/erofs/fscache.c+1−1
@@ -459,7 +459,7 @@ static struct erofs_fscache *erofs_fscache_acquire_cookie(struct super_block *sb · 458 unmodified lines
459459
460460 inode->i_size = OFFSET_MAX;
461461 inode->i_mapping->a_ops = &erofs_fscache_meta_aops;
462− mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
462+ mapping_set_gfp_mask(inode->i_mapping, GFP_KERNEL);
463463 inode->i_blkbits = EROFS_SB(sb)->blkszbits;
464464 inode->i_private = ctx;
465465
fs/erofs/inode.c+1−1
@@ -60,7 +60,7 @@ static void *erofs_read_inode(struct erofs_buf *buf, · 59 unmodified lines
6060 } else {
6161 const unsigned int gotten = sb->s_blocksize - *ofs;
6262
63− copied = kmalloc(vi->inode_isize, GFP_NOFS);
63+ copied = kmalloc(vi->inode_isize, GFP_KERNEL);
6464 if (!copied) {
6565 err = -ENOMEM;
6666 goto err_out;
fs/erofs/utils.c+1−1
@@ -81,7 +81,7 @@ struct erofs_workgroup *erofs_insert_workgroup(struct super_block *sb, · 80 unmodified lines
8181 repeat:
8282 xa_lock(&sbi->managed_pslots);
8383 pre = __xa_cmpxchg(&sbi->managed_pslots, grp->index,
84− NULL, grp, GFP_NOFS);
84+ NULL, grp, GFP_KERNEL);
8585 if (pre) {
8686 if (xa_is_err(pre)) {
8787 pre = ERR_PTR(xa_err(pre));
fs/erofs/zdata.c+54−44
@@ -82,6 +82,9 @@ struct z_erofs_pcluster { · 81 unmodified lines
8282 /* L: indicate several pageofs_outs or not */
8383 bool multibases;
8484
85+ /* L: whether extra buffer allocations are best-effort */
86+ bool besteffort;
87+
8588 /* A: compressed bvecs (can be cached or inplaced pages) */
8689 struct z_erofs_bvec compressed_bvecs[];
8790 };
@@ -230,7 +233,7 @@ static int z_erofs_bvec_enqueue(struct z_erofs_bvec_iter *iter, · 142 unmodified lines
230233 struct page *nextpage = *candidate_bvpage;
231234
232235 if (!nextpage) {
233− nextpage = erofs_allocpage(pagepool, GFP_NOFS);
236+ nextpage = erofs_allocpage(pagepool, GFP_KERNEL);
234237 if (!nextpage)
235238 return -ENOMEM;
236239 set_page_private(nextpage, Z_EROFS_SHORTLIVED_PAGE);
@@ -302,7 +305,7 @@ static struct z_erofs_pcluster *z_erofs_alloc_pcluster(unsigned int size) · 65 unmodified lines
302305 if (nrpages > pcs->maxpages)
303306 continue;
304307
305− pcl = kmem_cache_zalloc(pcs->slab, GFP_NOFS);
308+ pcl = kmem_cache_zalloc(pcs->slab, GFP_KERNEL);
306309 if (!pcl)
307310 return ERR_PTR(-ENOMEM);
308311 pcl->pclustersize = size;
@@ -563,21 +566,19 @@ static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe) · 254 unmodified lines
563566 __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN;
564567 unsigned int i;
565568
566− if (i_blocksize(fe->inode) != PAGE_SIZE)
567− return;
568− if (fe->mode < Z_EROFS_PCLUSTER_FOLLOWED)
569+ if (i_blocksize(fe->inode) != PAGE_SIZE ||
570+ fe->mode < Z_EROFS_PCLUSTER_FOLLOWED)
569571 return;
570572
571573 for (i = 0; i < pclusterpages; ++i) {
572574 struct page *page, *newpage;
573575 void *t; /* mark pages just found for debugging */
574576
575− /* the compressed page was loaded before */
577+ /* Inaccurate check w/o locking to avoid unneeded lookups */
576578 if (READ_ONCE(pcl->compressed_bvecs[i].page))
577579 continue;
578580
579581 page = find_get_page(mc, pcl->obj.index + i);
580−
581582 if (page) {
582583 t = (void *)((unsigned long)page | 1);
583584 newpage = NULL;
@@ -597,9 +598,13 @@ static void z_erofs_bind_cache(struct z_erofs_decompress_frontend *fe) · 13 unmodified lines
597598 set_page_private(newpage, Z_EROFS_PREALLOCATED_PAGE);
598599 t = (void *)((unsigned long)newpage | 1);
599600 }
600−
601− if (!cmpxchg_relaxed(&pcl->compressed_bvecs[i].page, NULL, t))
601+ spin_lock(&pcl->obj.lockref.lock);
602+ if (!pcl->compressed_bvecs[i].page) {
603+ pcl->compressed_bvecs[i].page = t;
604+ spin_unlock(&pcl->obj.lockref.lock);
602605 continue;
606+ }
607+ spin_unlock(&pcl->obj.lockref.lock);
603608
604609 if (page)
605610 put_page(page);
@@ -694,7 +699,7 @@ static void z_erofs_cache_invalidate_folio(struct folio *folio, · 88 unmodified lines
694699 DBG_BUGON(stop > folio_size(folio) || stop < length);
695700
696701 if (offset == 0 && stop == folio_size(folio))
697− while (!z_erofs_cache_release_folio(folio, GFP_NOFS))
702+ while (!z_erofs_cache_release_folio(folio, 0))
698703 cond_resched();
699704 }
700705
@@ -713,36 +718,30 @@ int erofs_init_managed_cache(struct super_block *sb) · 12 unmodified lines
713718 set_nlink(inode, 1);
714719 inode->i_size = OFFSET_MAX;
715720 inode->i_mapping->a_ops = &z_erofs_cache_aops;
716− mapping_set_gfp_mask(inode->i_mapping, GFP_NOFS);
721+ mapping_set_gfp_mask(inode->i_mapping, GFP_KERNEL);
717722 EROFS_SB(sb)->managed_cache = inode;
718723 return 0;
719724 }
720725
721−static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe,
722− struct z_erofs_bvec *bvec)
723−{
724− struct z_erofs_pcluster *const pcl = fe->pcl;
725−
726− while (fe->icur > 0) {
727− if (!cmpxchg(&pcl->compressed_bvecs[--fe->icur].page,
728− NULL, bvec->page)) {
729− pcl->compressed_bvecs[fe->icur] = *bvec;
730− return true;
731− }
732− }
733− return false;
734−}
735−
736726 /* callers must be with pcluster lock held */
737727 static int z_erofs_attach_page(struct z_erofs_decompress_frontend *fe,
738728 struct z_erofs_bvec *bvec, bool exclusive)
739729 {
730+ struct z_erofs_pcluster *pcl = fe->pcl;
740731 int ret;
741732
742733 if (exclusive) {
743734 /* give priority for inplaceio to use file pages first */
744− if (z_erofs_try_inplace_io(fe, bvec))
735+ spin_lock(&pcl->obj.lockref.lock);
736+ while (fe->icur > 0) {
737+ if (pcl->compressed_bvecs[--fe->icur].page)
738+ continue;
739+ pcl->compressed_bvecs[fe->icur] = *bvec;
740+ spin_unlock(&pcl->obj.lockref.lock);
745741 return 0;
742+ }
743+ spin_unlock(&pcl->obj.lockref.lock);
744+
746745 /* otherwise, check if it can be used as a bvpage */
747746 if (fe->mode >= Z_EROFS_PCLUSTER_FOLLOWED &&
748747 !fe->candidate_bvpage)
@@ -964,7 +963,7 @@ static int z_erofs_read_fragment(struct super_block *sb, struct page *page, · 215 unmodified lines
964963 }
965964
966965 static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
967− struct page *page)
966+ struct page *page, bool ra)
968967 {
969968 struct inode *const inode = fe->inode;
970969 struct erofs_map_blocks *const map = &fe->map;
@@ -1014,6 +1013,7 @@ repeat: · 43 unmodified lines
10141013 err = z_erofs_pcluster_begin(fe);
10151014 if (err)
10161015 goto out;
1016+ fe->pcl->besteffort |= !ra;
10171017 }
10181018
10191019 /*
@@ -1280,6 +1280,9 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be, · 260 unmodified lines
12801280 .inplace_io = overlapped,
12811281 .partial_decoding = pcl->partial,
12821282 .fillgaps = pcl->multibases,
1283+ .gfp = pcl->besteffort ?
1284+ GFP_KERNEL | __GFP_NOFAIL :
1285+ GFP_NOWAIT | __GFP_NORETRY
12831286 }, be->pagepool);
12841287
12851288 /* must handle all compressed pages before actual file pages */
@@ -1322,6 +1325,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be, · 36 unmodified lines
13221325 pcl->length = 0;
13231326 pcl->partial = true;
13241327 pcl->multibases = false;
1328+ pcl->besteffort = false;
13251329 pcl->bvset.nextpage = NULL;
13261330 pcl->vcnt = 0;
13271331
@@ -1423,23 +1427,26 @@ static void z_erofs_fill_bio_vec(struct bio_vec *bvec, · 95 unmodified lines
14231427 {
14241428 gfp_t gfp = mapping_gfp_mask(mc);
14251429 bool tocache = false;
1426− struct z_erofs_bvec *zbv = pcl->compressed_bvecs + nr;
1430+ struct z_erofs_bvec zbv;
14271431 struct address_space *mapping;
1428− struct page *page, *oldpage;
1432+ struct page *page;
14291433 int justfound, bs = i_blocksize(f->inode);
14301434
14311435 /* Except for inplace pages, the entire page can be used for I/Os */
14321436 bvec->bv_offset = 0;
14331437 bvec->bv_len = PAGE_SIZE;
14341438 repeat:
1435− oldpage = READ_ONCE(zbv->page);
1436− if (!oldpage)
1439+ spin_lock(&pcl->obj.lockref.lock);
1440+ zbv = pcl->compressed_bvecs[nr];
1441+ page = zbv.page;
1442+ justfound = (unsigned long)page & 1UL;
1443+ page = (struct page *)((unsigned long)page & ~1UL);
1444+ pcl->compressed_bvecs[nr].page = page;
1445+ spin_unlock(&pcl->obj.lockref.lock);
1446+ if (!page)
14371447 goto out_allocpage;
14381448
1439− justfound = (unsigned long)oldpage & 1UL;
1440− page = (struct page *)((unsigned long)oldpage & ~1UL);
14411449 bvec->bv_page = page;
1442−
14431450 DBG_BUGON(z_erofs_is_shortlived_page(page));
14441451 /*
14451452 * Handle preallocated cached pages. We tried to allocate such pages
@@ -1448,7 +1455,6 @@ repeat: · 2 unmodified lines
14481455 */
14491456 if (page->private == Z_EROFS_PREALLOCATED_PAGE) {
14501457 set_page_private(page, 0);
1451− WRITE_ONCE(zbv->page, page);
14521458 tocache = true;
14531459 goto out_tocache;
14541460 }
@@ -1459,9 +1465,9 @@ repeat: · 4 unmodified lines
14591465 * therefore it is impossible for `mapping` to be NULL.
14601466 */
14611467 if (mapping && mapping != mc) {
1462− if (zbv->offset < 0)
1463− bvec->bv_offset = round_up(-zbv->offset, bs);
1464− bvec->bv_len = round_up(zbv->end, bs) - bvec->bv_offset;
1468+ if (zbv.offset < 0)
1469+ bvec->bv_offset = round_up(-zbv.offset, bs);
1470+ bvec->bv_len = round_up(zbv.end, bs) - bvec->bv_offset;
14651471 return;
14661472 }
14671473
@@ -1471,7 +1477,6 @@ repeat: · 3 unmodified lines
14711477
14721478 /* the cached page is still in managed cache */
14731479 if (page->mapping == mc) {
1474− WRITE_ONCE(zbv->page, page);
14751480 /*
14761481 * The cached page is still available but without a valid
14771482 * `->private` pcluster hint. Let's reconnect them.
@@ -1503,11 +1508,15 @@ repeat: · 25 unmodified lines
15031508 put_page(page);
15041509 out_allocpage:
15051510 page = erofs_allocpage(&f->pagepool, gfp | __GFP_NOFAIL);
1506− if (oldpage != cmpxchg(&zbv->page, oldpage, page)) {
1511+ spin_lock(&pcl->obj.lockref.lock);
1512+ if (pcl->compressed_bvecs[nr].page) {
15071513 erofs_pagepool_add(&f->pagepool, page);
1514+ spin_unlock(&pcl->obj.lockref.lock);
15081515 cond_resched();
15091516 goto repeat;
15101517 }
1518+ pcl->compressed_bvecs[nr].page = page;
1519+ spin_unlock(&pcl->obj.lockref.lock);
15111520 bvec->bv_page = page;
15121521 out_tocache:
15131522 if (!tocache || bs != PAGE_SIZE ||
@@ -1685,6 +1694,7 @@ submit_bio_retry: · 171 unmodified lines
16851694
16861695 if (cur + bvec.bv_len > end)
16871696 bvec.bv_len = end - cur;
1697+ DBG_BUGON(bvec.bv_len < sb->s_blocksize);
16881698 if (!bio_add_page(bio, bvec.bv_page, bvec.bv_len,
16891699 bvec.bv_offset))
16901700 goto submit_bio_retry;
@@ -1785,7 +1795,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f, · 94 unmodified lines
17851795 if (PageUptodate(page))
17861796 unlock_page(page);
17871797 else
1788− (void)z_erofs_do_read_page(f, page);
1798+ (void)z_erofs_do_read_page(f, page, !!rac);
17891799 put_page(page);
17901800 }
17911801
@@ -1806,7 +1816,7 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio) · 14 unmodified lines
18061816 f.headoffset = (erofs_off_t)folio->index << PAGE_SHIFT;
18071817
18081818 z_erofs_pcluster_readmore(&f, NULL, true);
1809− err = z_erofs_do_read_page(&f, &folio->page);
1819+ err = z_erofs_do_read_page(&f, &folio->page, false);
18101820 z_erofs_pcluster_readmore(&f, NULL, false);
18111821 z_erofs_pcluster_end(&f);
18121822
@@ -1847,7 +1857,7 @@ static void z_erofs_readahead(struct readahead_control *rac) · 34 unmodified lines
18471857 folio = head;
18481858 head = folio_get_private(folio);
18491859
1850− err = z_erofs_do_read_page(&f, &folio->page);
1860+ err = z_erofs_do_read_page(&f, &folio->page, true);
18511861 if (err && err != -EINTR)
18521862 erofs_err(inode->i_sb, "readahead error at folio %lu @ nid %llu",
18531863 folio->index, EROFS_I(inode)->nid);
fs/exfat/inode.c+3−4
@@ -501,7 +501,7 @@ static ssize_t exfat_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · 500 unmodified lines
501501 struct inode *inode = mapping->host;
502502 struct exfat_inode_info *ei = EXFAT_I(inode);
503503 loff_t pos = iocb->ki_pos;
504− loff_t size = iocb->ki_pos + iov_iter_count(iter);
504+ loff_t size = pos + iov_iter_count(iter);
505505 int rw = iov_iter_rw(iter);
506506 ssize_t ret;
507507
@@ -525,11 +525,10 @@ static ssize_t exfat_direct_IO(struct kiocb *iocb, struct iov_iter *iter) · 17 unmodified lines
525525 */
526526 ret = blockdev_direct_IO(iocb, inode, iter, exfat_get_block);
527527 if (ret < 0) {
528− if (rw == WRITE)
528+ if (rw == WRITE && ret != -EIOCBQUEUED)
529529 exfat_write_failed(mapping, size);
530530
531− if (ret != -EIOCBQUEUED)
532− return ret;
531+ return ret;
533532 } else
534533 size = pos + ret;
535534
fs/hugetlbfs/inode.c+1−1
@@ -340,7 +340,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to) · 339 unmodified lines
340340 } else {
341341 folio_unlock(folio);
342342
343− if (!folio_test_has_hwpoisoned(folio))
343+ if (!folio_test_hwpoison(folio))
344344 want = nr;
345345 else {
346346 /*
fs/jfs/jfs_dmap.c+1−7
@@ -2763,9 +2763,7 @@ static int dbBackSplit(dmtree_t *tp, int leafno, bool is_ctl) · 2762 unmodified lines
27632763 * leafno - the number of the leaf to be updated.
27642764 * newval - the new value for the leaf.
27652765 *
2766− * RETURN VALUES:
2767− * 0 - success
2768− * -EIO - i/o error
2766+ * RETURN VALUES: none
27692767 */
27702768 static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl)
27712769 {
@@ -2792,10 +2790,6 @@ static int dbJoin(dmtree_t *tp, int leafno, int newval, bool is_ctl) · 20 unmodified lines
27922790 * get the buddy size (number of words covered) of
27932791 * the new value.
27942792 */
2795−
2796− if ((newval - tp->dmt_budmin) > BUDMIN)
2797− return -EIO;
2798−
27992793 budsz = BUDSIZE(newval, tp->dmt_budmin);
28002794
28012795 /* try to join.
fs/smb/client/cached_dir.c+20−4
@@ -145,21 +145,27 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, · 144 unmodified lines
145145 struct cached_fid *cfid;
146146 struct cached_fids *cfids;
147147 const char *npath;
148+ int retries = 0, cur_sleep = 1;
148149
149150 if (tcon == NULL || tcon->cfids == NULL || tcon->nohandlecache ||
150151 is_smb1_server(tcon->ses->server) || (dir_cache_timeout == 0))
151152 return -EOPNOTSUPP;
152153
153154 ses = tcon->ses;
154− server = cifs_pick_channel(ses);
155155 cfids = tcon->cfids;
156156
157− if (!server->ops->new_lease_key)
158− return -EIO;
159−
160157 if (cifs_sb->root == NULL)
161158 return -ENOENT;
162159
160+replay_again:
161+ /* reinitialize for possible replay */
162+ flags = 0;
163+ oplock = SMB2_OPLOCK_LEVEL_II;
164+ server = cifs_pick_channel(ses);
165+
166+ if (!server->ops->new_lease_key)
167+ return -EIO;
168+
163169 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
164170 if (!utf16_path)
165171 return -ENOMEM;
@@ -268,6 +274,11 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, · 102 unmodified lines
268274 */
269275 cfid->has_lease = true;
270276
277+ if (retries) {
278+ smb2_set_replay(server, &rqst[0]);
279+ smb2_set_replay(server, &rqst[1]);
280+ }
281+
271282 rc = compound_send_recv(xid, ses, server,
272283 flags, 2, rqst,
273284 resp_buftype, rsp_iov);
@@ -367,6 +378,11 @@ out: · 93 unmodified lines
367378 atomic_inc(&tcon->num_remote_opens);
368379 }
369380 kfree(utf16_path);
381+
382+ if (is_replayable_error(rc) &&
383+ smb2_should_replay(tcon, &retries, &cur_sleep))
384+ goto replay_again;
385+
370386 return rc;
371387 }
372388
fs/smb/client/cifsencrypt.c+1−1
@@ -572,7 +572,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash, · 571 unmodified lines
572572 len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp);
573573 UniStrupr(user);
574574 } else {
575− memset(user, '\0', 2);
575+ *(u16 *)user = 0;
576576 }
577577
578578 rc = crypto_shash_update(ses->server->secmech.hmacmd5,
fs/smb/client/cifsfs.c+14−3
@@ -396,7 +396,7 @@ cifs_alloc_inode(struct super_block *sb) · 395 unmodified lines
396396 spin_lock_init(&cifs_inode->writers_lock);
397397 cifs_inode->writers = 0;
398398 cifs_inode->netfs.inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
399− cifs_inode->server_eof = 0;
399+ cifs_inode->netfs.remote_i_size = 0;
400400 cifs_inode->uniqueid = 0;
401401 cifs_inode->createtime = 0;
402402 cifs_inode->epoch = 0;
@@ -1380,6 +1380,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, · 977 unmodified lines
13801380 struct inode *src_inode = file_inode(src_file);
13811381 struct inode *target_inode = file_inode(dst_file);
13821382 struct cifsInodeInfo *src_cifsi = CIFS_I(src_inode);
1383+ struct cifsInodeInfo *target_cifsi = CIFS_I(target_inode);
13831384 struct cifsFileInfo *smb_file_src;
13841385 struct cifsFileInfo *smb_file_target;
13851386 struct cifs_tcon *src_tcon;
@@ -1428,7 +1429,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, · 42 unmodified lines
14281429 * Advance the EOF marker after the flush above to the end of the range
14291430 * if it's short of that.
14301431 */
1431− if (src_cifsi->server_eof < off + len) {
1432+ if (src_cifsi->netfs.remote_i_size < off + len) {
14321433 rc = cifs_precopy_set_eof(src_inode, src_cifsi, src_tcon, xid, off + len);
14331434 if (rc < 0)
14341435 goto unlock;
@@ -1452,12 +1453,22 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, · 17 unmodified lines
14521453 /* Discard all the folios that overlap the destination region. */
14531454 truncate_inode_pages_range(&target_inode->i_data, fstart, fend);
14541455
1456+ fscache_invalidate(cifs_inode_cookie(target_inode), NULL,
1457+ i_size_read(target_inode), 0);
1458+
14551459 rc = file_modified(dst_file);
14561460 if (!rc) {
14571461 rc = target_tcon->ses->server->ops->copychunk_range(xid,
14581462 smb_file_src, smb_file_target, off, len, destoff);
1459− if (rc > 0 && destoff + rc > i_size_read(target_inode))
1463+ if (rc > 0 && destoff + rc > i_size_read(target_inode)) {
14601464 truncate_setsize(target_inode, destoff + rc);
1465+ netfs_resize_file(&target_cifsi->netfs,
1466+ i_size_read(target_inode), true);
1467+ fscache_resize_cookie(cifs_inode_cookie(target_inode),
1468+ i_size_read(target_inode));
1469+ }
1470+ if (rc > 0 && destoff + rc > target_cifsi->netfs.zero_point)
1471+ target_cifsi->netfs.zero_point = destoff + rc;
14611472 }
14621473
14631474 file_accessed(src_file);
fs/smb/client/cifsglob.h+13−1
@@ -49,6 +49,11 @@ · 48 unmodified lines
4949 */
5050 #define CIFS_DEF_ACTIMEO (1 * HZ)
5151
52+/*
53+ * max sleep time before retry to server
54+ */
55+#define CIFS_MAX_SLEEP 2000
56+
5257 /*
5358 * max attribute cache timeout (jiffies) - 2^30
5459 */
@@ -1501,6 +1506,7 @@ struct cifs_writedata { · 1446 unmodified lines
15011506 struct smbd_mr *mr;
15021507 #endif
15031508 struct cifs_credits credits;
1509+ bool replay;
15041510 };
15051511
15061512 /*
@@ -1561,7 +1567,6 @@ struct cifsInodeInfo { · 54 unmodified lines
15611567 spinlock_t writers_lock;
15621568 unsigned int writers; /* Number of writers on this inode */
15631569 unsigned long time; /* jiffies of last update of inode */
1564− u64 server_eof; /* current file size on server -- protected by i_lock */
15651570 u64 uniqueid; /* server inode number */
15661571 u64 createtime; /* creation time on server */
15671572 __u8 lease_key[SMB2_LEASE_KEY_SIZE]; /* lease key for this inode */
@@ -1831,6 +1836,13 @@ static inline bool is_retryable_error(int error) · 263 unmodified lines
18311836 return false;
18321837 }
18331838
1839+static inline bool is_replayable_error(int error)
1840+{
1841+ if (error == -EAGAIN || error == -ECONNABORTED)
1842+ return true;
1843+ return false;
1844+}
1845+
18341846
18351847 /* cifs_get_writable_file() flags */
18361848 #define FIND_WR_ANY 0
fs/smb/client/file.c+5−4
@@ -2120,8 +2120,8 @@ cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset, · 2119 unmodified lines
21202120 {
21212121 loff_t end_of_write = offset + bytes_written;
21222122
2123− if (end_of_write > cifsi->server_eof)
2124− cifsi->server_eof = end_of_write;
2123+ if (end_of_write > cifsi->netfs.remote_i_size)
2124+ netfs_resize_file(&cifsi->netfs, end_of_write, true);
21252125 }
21262126
21272127 static ssize_t
@@ -3247,8 +3247,8 @@ cifs_uncached_writev_complete(struct work_struct *work) · 1119 unmodified lines
32473247
32483248 spin_lock(&inode->i_lock);
32493249 cifs_update_eof(cifsi, wdata->offset, wdata->bytes);
3250− if (cifsi->server_eof > inode->i_size)
3251− i_size_write(inode, cifsi->server_eof);
3250+ if (cifsi->netfs.remote_i_size > inode->i_size)
3251+ i_size_write(inode, cifsi->netfs.remote_i_size);
32523252 spin_unlock(&inode->i_lock);
32533253
32543254 complete(&wdata->done);
@@ -3300,6 +3300,7 @@ cifs_resend_wdata(struct cifs_writedata *wdata, struct list_head *wdata_list, · 45 unmodified lines
33003300 if (wdata->cfile->invalidHandle)
33013301 rc = -EAGAIN;
33023302 else {
3303+ wdata->replay = true;
33033304 #ifdef CONFIG_CIFS_SMB_DIRECT
33043305 if (wdata->mr) {
33053306 wdata->mr->need_invalidate = true;
fs/smb/client/inode.c+5−3
@@ -104,7 +104,7 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) · 103 unmodified lines
104104 fattr->cf_mtime = timestamp_truncate(fattr->cf_mtime, inode);
105105 mtime = inode_get_mtime(inode);
106106 if (timespec64_equal(&mtime, &fattr->cf_mtime) &&
107− cifs_i->server_eof == fattr->cf_eof) {
107+ cifs_i->netfs.remote_i_size == fattr->cf_eof) {
108108 cifs_dbg(FYI, "%s: inode %llu is unchanged\n",
109109 __func__, cifs_i->uniqueid);
110110 return;
@@ -194,7 +194,7 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr) · 83 unmodified lines
194194 else
195195 clear_bit(CIFS_INO_DELETE_PENDING, &cifs_i->flags);
196196
197− cifs_i->server_eof = fattr->cf_eof;
197+ cifs_i->netfs.remote_i_size = fattr->cf_eof;
198198 /*
199199 * Can't safely change the file size here if the client is writing to
200200 * it due to potential races.
@@ -2858,7 +2858,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, · 2657 unmodified lines
28582858
28592859 set_size_out:
28602860 if (rc == 0) {
2861− cifsInode->server_eof = attrs->ia_size;
2861+ netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true);
28622862 cifs_setsize(inode, attrs->ia_size);
28632863 /*
28642864 * i_blocks is not related to (i_size / i_blksize), but instead
@@ -3011,6 +3011,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) · 146 unmodified lines
30113011 if ((attrs->ia_valid & ATTR_SIZE) &&
30123012 attrs->ia_size != i_size_read(inode)) {
30133013 truncate_setsize(inode, attrs->ia_size);
3014+ netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true);
30143015 fscache_resize_cookie(cifs_inode_cookie(inode), attrs->ia_size);
30153016 }
30163017
@@ -3210,6 +3211,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs) · 193 unmodified lines
32103211 if ((attrs->ia_valid & ATTR_SIZE) &&
32113212 attrs->ia_size != i_size_read(inode)) {
32123213 truncate_setsize(inode, attrs->ia_size);
3214+ netfs_resize_file(&cifsInode->netfs, attrs->ia_size, true);
32133215 fscache_resize_cookie(cifs_inode_cookie(inode), attrs->ia_size);
32143216 }
32153217
fs/smb/client/readdir.c+1−1
@@ -141,7 +141,7 @@ retry: · 140 unmodified lines
141141 if (likely(reparse_inode_match(inode, fattr))) {
142142 fattr->cf_mode = inode->i_mode;
143143 fattr->cf_rdev = inode->i_rdev;
144− fattr->cf_eof = CIFS_I(inode)->server_eof;
144+ fattr->cf_eof = CIFS_I(inode)->netfs.remote_i_size;
145145 fattr->cf_symlink_target = NULL;
146146 } else {
147147 CIFS_I(inode)->time = 0;
fs/smb/client/smb2inode.c+27−6
@@ -120,6 +120,14 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, · 119 unmodified lines
120120 unsigned int size[2];
121121 void *data[2];
122122 int len;
123+ int retries = 0, cur_sleep = 1;
124+
125+replay_again:
126+ /* reinitialize for possible replay */
127+ flags = 0;
128+ oplock = SMB2_OPLOCK_LEVEL_NONE;
129+ num_rqst = 0;
130+ server = cifs_pick_channel(ses);
123131
124132 vars = kzalloc(sizeof(*vars), GFP_ATOMIC);
125133 if (vars == NULL)
@@ -127,8 +135,6 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, · 1 unmodified line
127135 rqst = &vars->rqst[0];
128136 rsp_iov = &vars->rsp_iov[0];
129137
130− server = cifs_pick_channel(ses);
131−
132138 if (smb3_encryption_required(tcon))
133139 flags |= CIFS_TRANSFORM_REQ;
134140
@@ -463,15 +469,24 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon, · 328 unmodified lines
463469 num_rqst++;
464470
465471 if (cfile) {
472+ if (retries)
473+ for (i = 1; i < num_rqst - 2; i++)
474+ smb2_set_replay(server, &rqst[i]);
475+
466476 rc = compound_send_recv(xid, ses, server,
467477 flags, num_rqst - 2,
468478 &rqst[1], &resp_buftype[1],
469479 &rsp_iov[1]);
470− } else
480+ } else {
481+ if (retries)
482+ for (i = 0; i < num_rqst; i++)
483+ smb2_set_replay(server, &rqst[i]);
484+
471485 rc = compound_send_recv(xid, ses, server,
472486 flags, num_rqst,
473487 rqst, resp_buftype,
474488 rsp_iov);
489+ }
475490
476491 finished:
477492 num_rqst = 0;
@@ -620,9 +635,6 @@ finished: · 142 unmodified lines
620635 }
621636 SMB2_close_free(&rqst[num_rqst]);
622637
623− if (cfile)
624− cifsFileInfo_put(cfile);
625−
626638 num_cmds += 2;
627639 if (out_iov && out_buftype) {
628640 memcpy(out_iov, rsp_iov, num_cmds * sizeof(*out_iov));
@@ -632,7 +644,16 @@ finished: · 3 unmodified lines
632644 for (i = 0; i < num_cmds; i++)
633645 free_rsp_buf(resp_buftype[i], rsp_iov[i].iov_base);
634646 }
647+ num_cmds -= 2; /* correct num_cmds as there could be a retry */
635648 kfree(vars);
649+
650+ if (is_replayable_error(rc) &&
651+ smb2_should_replay(tcon, &retries, &cur_sleep))
652+ goto replay_again;
653+
654+ if (cfile)
655+ cifsFileInfo_put(cfile);
656+
636657 return rc;
637658 }
638659
fs/smb/client/smb2ops.c+127−14
@@ -1108,7 +1108,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 1107 unmodified lines
11081108 {
11091109 struct smb2_compound_vars *vars;
11101110 struct cifs_ses *ses = tcon->ses;
1111− struct TCP_Server_Info *server = cifs_pick_channel(ses);
1111+ struct TCP_Server_Info *server;
11121112 struct smb_rqst *rqst;
11131113 struct kvec *rsp_iov;
11141114 __le16 *utf16_path = NULL;
@@ -1124,6 +1124,13 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 9 unmodified lines
11241124 struct smb2_file_full_ea_info *ea = NULL;
11251125 struct smb2_query_info_rsp *rsp;
11261126 int rc, used_len = 0;
1127+ int retries = 0, cur_sleep = 1;
1128+
1129+replay_again:
1130+ /* reinitialize for possible replay */
1131+ flags = CIFS_CP_CREATE_CLOSE_OP;
1132+ oplock = SMB2_OPLOCK_LEVEL_NONE;
1133+ server = cifs_pick_channel(ses);
11271134
11281135 if (smb3_encryption_required(tcon))
11291136 flags |= CIFS_TRANSFORM_REQ;
@@ -1244,6 +1251,12 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 114 unmodified lines
12441251 goto sea_exit;
12451252 smb2_set_related(&rqst[2]);
12461253
1254+ if (retries) {
1255+ smb2_set_replay(server, &rqst[0]);
1256+ smb2_set_replay(server, &rqst[1]);
1257+ smb2_set_replay(server, &rqst[2]);
1258+ }
1259+
12471260 rc = compound_send_recv(xid, ses, server,
12481261 flags, 3, rqst,
12491262 resp_buftype, rsp_iov);
@@ -1260,6 +1273,11 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 10 unmodified lines
12601273 kfree(vars);
12611274 out_free_path:
12621275 kfree(utf16_path);
1276+
1277+ if (is_replayable_error(rc) &&
1278+ smb2_should_replay(tcon, &retries, &cur_sleep))
1279+ goto replay_again;
1280+
12631281 return rc;
12641282 }
12651283 #endif
@@ -1484,7 +1502,7 @@ smb2_ioctl_query_info(const unsigned int xid, · 218 unmodified lines
14841502 struct smb_rqst *rqst;
14851503 struct kvec *rsp_iov;
14861504 struct cifs_ses *ses = tcon->ses;
1487− struct TCP_Server_Info *server = cifs_pick_channel(ses);
1505+ struct TCP_Server_Info *server;
14881506 char __user *arg = (char __user *)p;
14891507 struct smb_query_info qi;
14901508 struct smb_query_info __user *pqi;
@@ -1501,6 +1519,13 @@ smb2_ioctl_query_info(const unsigned int xid, · 10 unmodified lines
15011519 void *data[2];
15021520 int create_options = is_dir ? CREATE_NOT_FILE : CREATE_NOT_DIR;
15031521 void (*free_req1_func)(struct smb_rqst *r);
1522+ int retries = 0, cur_sleep = 1;
1523+
1524+replay_again:
1525+ /* reinitialize for possible replay */
1526+ flags = CIFS_CP_CREATE_CLOSE_OP;
1527+ oplock = SMB2_OPLOCK_LEVEL_NONE;
1528+ server = cifs_pick_channel(ses);
15041529
15051530 vars = kzalloc(sizeof(*vars), GFP_ATOMIC);
15061531 if (vars == NULL)
@@ -1641,6 +1666,12 @@ smb2_ioctl_query_info(const unsigned int xid, · 134 unmodified lines
16411666 goto free_req_1;
16421667 smb2_set_related(&rqst[2]);
16431668
1669+ if (retries) {
1670+ smb2_set_replay(server, &rqst[0]);
1671+ smb2_set_replay(server, &rqst[1]);
1672+ smb2_set_replay(server, &rqst[2]);
1673+ }
1674+
16441675 rc = compound_send_recv(xid, ses, server,
16451676 flags, 3, rqst,
16461677 resp_buftype, rsp_iov);
@@ -1701,6 +1732,11 @@ free_output_buffer: · 54 unmodified lines
17011732 kfree(buffer);
17021733 free_vars:
17031734 kfree(vars);
1735+
1736+ if (is_replayable_error(rc) &&
1737+ smb2_should_replay(tcon, &retries, &cur_sleep))
1738+ goto replay_again;
1739+
17041740 return rc;
17051741 }
17061742
@@ -2227,8 +2263,14 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 520 unmodified lines
22272263 struct cifs_open_parms oparms;
22282264 struct smb2_query_directory_rsp *qd_rsp = NULL;
22292265 struct smb2_create_rsp *op_rsp = NULL;
2230− struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
2231− int retry_count = 0;
2266+ struct TCP_Server_Info *server;
2267+ int retries = 0, cur_sleep = 1;
2268+
2269+replay_again:
2270+ /* reinitialize for possible replay */
2271+ flags = 0;
2272+ oplock = SMB2_OPLOCK_LEVEL_NONE;
2273+ server = cifs_pick_channel(tcon->ses);
22322274
22332275 utf16_path = cifs_convert_path_to_utf16(path, cifs_sb);
22342276 if (!utf16_path)
@@ -2278,14 +2320,15 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, · 43 unmodified lines
22782320
22792321 smb2_set_related(&rqst[1]);
22802322
2281−again:
2323+ if (retries) {
2324+ smb2_set_replay(server, &rqst[0]);
2325+ smb2_set_replay(server, &rqst[1]);
2326+ }
2327+
22822328 rc = compound_send_recv(xid, tcon->ses, server,
22832329 flags, 2, rqst,
22842330 resp_buftype, rsp_iov);
22852331
2286− if (rc == -EAGAIN && retry_count++ < 10)
2287− goto again;
2288−
22892332 /* If the open failed there is nothing to do */
22902333 op_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base;
22912334 if (op_rsp == NULL || op_rsp->hdr.Status != STATUS_SUCCESS) {
@@ -2333,6 +2376,11 @@ again: · 41 unmodified lines
23332376 SMB2_query_directory_free(&rqst[1]);
23342377 free_rsp_buf(resp_buftype[0], rsp_iov[0].iov_base);
23352378 free_rsp_buf(resp_buftype[1], rsp_iov[1].iov_base);
2379+
2380+ if (is_replayable_error(rc) &&
2381+ smb2_should_replay(tcon, &retries, &cur_sleep))
2382+ goto replay_again;
2383+
23362384 return rc;
23372385 }
23382386
@@ -2457,6 +2505,22 @@ smb2_oplock_response(struct cifs_tcon *tcon, __u64 persistent_fid, · 118 unmodified lines
24572505 CIFS_CACHE_READ(cinode) ? 1 : 0);
24582506 }
24592507
2508+void
2509+smb2_set_replay(struct TCP_Server_Info *server, struct smb_rqst *rqst)
2510+{
2511+ struct smb2_hdr *shdr;
2512+
2513+ if (server->dialect < SMB30_PROT_ID)
2514+ return;
2515+
2516+ shdr = (struct smb2_hdr *)(rqst->rq_iov[0].iov_base);
2517+ if (shdr == NULL) {
2518+ cifs_dbg(FYI, "shdr NULL in smb2_set_related\n");
2519+ return;
2520+ }
2521+ shdr->Flags |= SMB2_FLAGS_REPLAY_OPERATION;
2522+}
2523+
24602524 void
24612525 smb2_set_related(struct smb_rqst *rqst)
24622526 {
@@ -2529,6 +2593,27 @@ smb2_set_next_command(struct cifs_tcon *tcon, struct smb_rqst *rqst) · 66 unmodified lines
25292593 shdr->NextCommand = cpu_to_le32(len);
25302594 }
25312595
2596+/*
2597+ * helper function for exponential backoff and check if replayable
2598+ */
2599+bool smb2_should_replay(struct cifs_tcon *tcon,
2600+ int *pretries,
2601+ int *pcur_sleep)
2602+{
2603+ if (!pretries || !pcur_sleep)
2604+ return false;
2605+
2606+ if (tcon->retry || (*pretries)++ < tcon->ses->server->retrans) {
2607+ msleep(*pcur_sleep);
2608+ (*pcur_sleep) = ((*pcur_sleep) << 1);
2609+ if ((*pcur_sleep) > CIFS_MAX_SLEEP)
2610+ (*pcur_sleep) = CIFS_MAX_SLEEP;
2611+ return true;
2612+ }
2613+
2614+ return false;
2615+}
2616+
25322617 /*
25332618 * Passes the query info response back to the caller on success.
25342619 * Caller need to free this with free_rsp_buf().
@@ -2542,7 +2627,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, · 7 unmodified lines
25422627 {
25432628 struct smb2_compound_vars *vars;
25442629 struct cifs_ses *ses = tcon->ses;
2545− struct TCP_Server_Info *server = cifs_pick_channel(ses);
2630+ struct TCP_Server_Info *server;
25462631 int flags = CIFS_CP_CREATE_CLOSE_OP;
25472632 struct smb_rqst *rqst;
25482633 int resp_buftype[3];
@@ -2553,6 +2638,13 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, · 4 unmodified lines
25532638 int rc;
25542639 __le16 *utf16_path;
25552640 struct cached_fid *cfid = NULL;
2641+ int retries = 0, cur_sleep = 1;
2642+
2643+replay_again:
2644+ /* reinitialize for possible replay */
2645+ flags = CIFS_CP_CREATE_CLOSE_OP;
2646+ oplock = SMB2_OPLOCK_LEVEL_NONE;
2647+ server = cifs_pick_channel(ses);
25562648
25572649 if (!path)
25582650 path = "";
@@ -2633,6 +2725,14 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, · 74 unmodified lines
26332725 goto qic_exit;
26342726 smb2_set_related(&rqst[2]);
26352727
2728+ if (retries) {
2729+ if (!cfid) {
2730+ smb2_set_replay(server, &rqst[0]);
2731+ smb2_set_replay(server, &rqst[2]);
2732+ }
2733+ smb2_set_replay(server, &rqst[1]);
2734+ }
2735+
26362736 if (cfid) {
26372737 rc = compound_send_recv(xid, ses, server,
26382738 flags, 1, &rqst[1],
@@ -2665,6 +2765,11 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon, · 26 unmodified lines
26652765 kfree(vars);
26662766 out_free_path:
26672767 kfree(utf16_path);
2768+
2769+ if (is_replayable_error(rc) &&
2770+ smb2_should_replay(tcon, &retries, &cur_sleep))
2771+ goto replay_again;
2772+
26682773 return rc;
26692774 }
26702775
@@ -3213,6 +3318,9 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, · 542 unmodified lines
32133318 cfile->fid.volatile_fid, cfile->pid, new_size);
32143319 if (rc >= 0) {
32153320 truncate_setsize(inode, new_size);
3321+ netfs_resize_file(&cifsi->netfs, new_size, true);
3322+ if (offset < cifsi->netfs.zero_point)
3323+ cifsi->netfs.zero_point = offset;
32163324 fscache_resize_cookie(cifs_inode_cookie(inode), new_size);
32173325 }
32183326 }
@@ -3436,7 +3544,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, · 217 unmodified lines
34363544 rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
34373545 cfile->fid.volatile_fid, cfile->pid, new_eof);
34383546 if (rc == 0) {
3439− cifsi->server_eof = new_eof;
3547+ netfs_resize_file(&cifsi->netfs, new_eof, true);
34403548 cifs_setsize(inode, new_eof);
34413549 cifs_truncate_page(inode->i_mapping, inode->i_size);
34423550 truncate_setsize(inode, new_eof);
@@ -3528,8 +3636,9 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon, · 85 unmodified lines
35283636 int rc;
35293637 unsigned int xid;
35303638 struct inode *inode = file_inode(file);
3531− struct cifsFileInfo *cfile = file->private_data;
35323639 struct cifsInodeInfo *cifsi = CIFS_I(inode);
3640+ struct cifsFileInfo *cfile = file->private_data;
3641+ struct netfs_inode *ictx = &cifsi->netfs;
35333642 loff_t old_eof, new_eof;
35343643
35353644 xid = get_xid();
@@ -3549,6 +3658,7 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon, · 13 unmodified lines
35493658 goto out_2;
35503659
35513660 truncate_pagecache_range(inode, off, old_eof);
3661+ ictx->zero_point = old_eof;
35523662
35533663 rc = smb2_copychunk_range(xid, cfile, cfile, off + len,
35543664 old_eof - off - len, off);
@@ -3563,9 +3673,10 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon, · 8 unmodified lines
35633673
35643674 rc = 0;
35653675
3566− cifsi->server_eof = i_size_read(inode) - len;
3567− truncate_setsize(inode, cifsi->server_eof);
3568− fscache_resize_cookie(cifs_inode_cookie(inode), cifsi->server_eof);
3676+ truncate_setsize(inode, new_eof);
3677+ netfs_resize_file(&cifsi->netfs, new_eof, true);
3678+ ictx->zero_point = new_eof;
3679+ fscache_resize_cookie(cifs_inode_cookie(inode), new_eof);
35693680 out_2:
35703681 filemap_invalidate_unlock(inode->i_mapping);
35713682 out:
@@ -3581,6 +3692,7 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon, · 9 unmodified lines
35813692 unsigned int xid;
35823693 struct cifsFileInfo *cfile = file->private_data;
35833694 struct inode *inode = file_inode(file);
3695+ struct cifsInodeInfo *cifsi = CIFS_I(inode);
35843696 __u64 count, old_eof, new_eof;
35853697
35863698 xid = get_xid();
@@ -3608,6 +3720,7 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon, · 21 unmodified lines
36083720 goto out_2;
36093721
36103722 truncate_setsize(inode, new_eof);
3723+ netfs_resize_file(&cifsi->netfs, i_size_read(inode), true);
36113724 fscache_resize_cookie(cifs_inode_cookie(inode), i_size_read(inode));
36123725
36133726 rc = smb2_copychunk_range(xid, cfile, cfile, off, count, off + len);
fs/smb/client/smb2pdu.c+237−28
@@ -195,7 +195,6 @@ cifs_chan_skip_or_disable(struct cifs_ses *ses, · 194 unmodified lines
195195 pserver = server->primary_server;
196196 cifs_signal_cifsd_for_reconnect(pserver, false);
197197 skip_terminate:
198− mutex_unlock(&ses->session_mutex);
199198 return -EHOSTDOWN;
200199 }
201200
@@ -2765,7 +2764,14 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, · 2563 unmodified lines
27652764 int flags = 0;
27662765 unsigned int total_len;
27672766 __le16 *utf16_path = NULL;
2768− struct TCP_Server_Info *server = cifs_pick_channel(ses);
2767+ struct TCP_Server_Info *server;
2768+ int retries = 0, cur_sleep = 1;
2769+
2770+replay_again:
2771+ /* reinitialize for possible replay */
2772+ flags = 0;
2773+ n_iov = 2;
2774+ server = cifs_pick_channel(ses);
27692775
27702776 cifs_dbg(FYI, "mkdir\n");
27712777
@@ -2869,6 +2875,10 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode, · 97 unmodified lines
28692875 /* no need to inc num_remote_opens because we close it just below */
28702876 trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, full_path, CREATE_NOT_FILE,
28712877 FILE_WRITE_ATTRIBUTES);
2878+
2879+ if (retries)
2880+ smb2_set_replay(server, &rqst);
2881+
28722882 /* resource #4: response buffer */
28732883 rc = cifs_send_recv(xid, ses, server,
28742884 &rqst, &resp_buftype, flags, &rsp_iov);
@@ -2906,6 +2916,11 @@ err_free_req: · 31 unmodified lines
29062916 cifs_small_buf_release(req);
29072917 err_free_path:
29082918 kfree(utf16_path);
2919+
2920+ if (is_replayable_error(rc) &&
2921+ smb2_should_replay(tcon, &retries, &cur_sleep))
2922+ goto replay_again;
2923+
29092924 return rc;
29102925 }
29112926
@@ -3101,12 +3116,18 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, · 189 unmodified lines
31013116 struct smb2_create_rsp *rsp = NULL;
31023117 struct cifs_tcon *tcon = oparms->tcon;
31033118 struct cifs_ses *ses = tcon->ses;
3104− struct TCP_Server_Info *server = cifs_pick_channel(ses);
3119+ struct TCP_Server_Info *server;
31053120 struct kvec iov[SMB2_CREATE_IOV_SIZE];
31063121 struct kvec rsp_iov = {NULL, 0};
31073122 int resp_buftype = CIFS_NO_BUFFER;
31083123 int rc = 0;
31093124 int flags = 0;
3125+ int retries = 0, cur_sleep = 1;
3126+
3127+replay_again:
3128+ /* reinitialize for possible replay */
3129+ flags = 0;
3130+ server = cifs_pick_channel(ses);
31103131
31113132 cifs_dbg(FYI, "create/open\n");
31123133 if (!ses || !server)
@@ -3128,6 +3149,9 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, · 15 unmodified lines
31283149 trace_smb3_open_enter(xid, tcon->tid, tcon->ses->Suid, oparms->path,
31293150 oparms->create_options, oparms->desired_access);
31303151
3152+ if (retries)
3153+ smb2_set_replay(server, &rqst);
3154+
31313155 rc = cifs_send_recv(xid, ses, server,
31323156 &rqst, &resp_buftype, flags,
31333157 &rsp_iov);
@@ -3181,6 +3205,11 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path, · 47 unmodified lines
31813205 creat_exit:
31823206 SMB2_open_free(&rqst);
31833207 free_rsp_buf(resp_buftype, rsp);
3208+
3209+ if (is_replayable_error(rc) &&
3210+ smb2_should_replay(tcon, &retries, &cur_sleep))
3211+ goto replay_again;
3212+
31843213 return rc;
31853214 }
31863215
@@ -3305,15 +3334,7 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 118 unmodified lines
33053334 int resp_buftype = CIFS_NO_BUFFER;
33063335 int rc = 0;
33073336 int flags = 0;
3308−
3309− cifs_dbg(FYI, "SMB2 IOCTL\n");
3310−
3311− if (out_data != NULL)
3312− *out_data = NULL;
3313−
3314− /* zero out returned data len, in case of error */
3315− if (plen)
3316− *plen = 0;
3337+ int retries = 0, cur_sleep = 1;
33173338
33183339 if (!tcon)
33193340 return -EIO;
@@ -3322,10 +3343,23 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 2 unmodified lines
33223343 if (!ses)
33233344 return -EIO;
33243345
3346+replay_again:
3347+ /* reinitialize for possible replay */
3348+ flags = 0;
33253349 server = cifs_pick_channel(ses);
3350+
33263351 if (!server)
33273352 return -EIO;
33283353
3354+ cifs_dbg(FYI, "SMB2 IOCTL\n");
3355+
3356+ if (out_data != NULL)
3357+ *out_data = NULL;
3358+
3359+ /* zero out returned data len, in case of error */
3360+ if (plen)
3361+ *plen = 0;
3362+
33293363 if (smb3_encryption_required(tcon))
33303364 flags |= CIFS_TRANSFORM_REQ;
33313365
@@ -3340,6 +3374,9 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 8 unmodified lines
33403374 if (rc)
33413375 goto ioctl_exit;
33423376
3377+ if (retries)
3378+ smb2_set_replay(server, &rqst);
3379+
33433380 rc = cifs_send_recv(xid, ses, server,
33443381 &rqst, &resp_buftype, flags,
33453382 &rsp_iov);
@@ -3409,6 +3446,11 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 63 unmodified lines
34093446 ioctl_exit:
34103447 SMB2_ioctl_free(&rqst);
34113448 free_rsp_buf(resp_buftype, rsp);
3449+
3450+ if (is_replayable_error(rc) &&
3451+ smb2_should_replay(tcon, &retries, &cur_sleep))
3452+ goto replay_again;
3453+
34123454 return rc;
34133455 }
34143456
@@ -3480,13 +3522,20 @@ __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon, · 65 unmodified lines
34803522 struct smb_rqst rqst;
34813523 struct smb2_close_rsp *rsp = NULL;
34823524 struct cifs_ses *ses = tcon->ses;
3483− struct TCP_Server_Info *server = cifs_pick_channel(ses);
3525+ struct TCP_Server_Info *server;
34843526 struct kvec iov[1];
34853527 struct kvec rsp_iov;
34863528 int resp_buftype = CIFS_NO_BUFFER;
34873529 int rc = 0;
34883530 int flags = 0;
34893531 bool query_attrs = false;
3532+ int retries = 0, cur_sleep = 1;
3533+
3534+replay_again:
3535+ /* reinitialize for possible replay */
3536+ flags = 0;
3537+ query_attrs = false;
3538+ server = cifs_pick_channel(ses);
34903539
34913540 cifs_dbg(FYI, "Close\n");
34923541
@@ -3512,6 +3561,9 @@ __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon, · 19 unmodified lines
35123561 if (rc)
35133562 goto close_exit;
35143563
3564+ if (retries)
3565+ smb2_set_replay(server, &rqst);
3566+
35153567 rc = cifs_send_recv(xid, ses, server,
35163568 &rqst, &resp_buftype, flags, &rsp_iov);
35173569 rsp = (struct smb2_close_rsp *)rsp_iov.iov_base;
@@ -3545,6 +3597,11 @@ close_exit: · 27 unmodified lines
35453597 cifs_dbg(VFS, "handle cancelled close fid 0x%llx returned error %d\n",
35463598 persistent_fid, tmp_rc);
35473599 }
3600+
3601+ if (is_replayable_error(rc) &&
3602+ smb2_should_replay(tcon, &retries, &cur_sleep))
3603+ goto replay_again;
3604+
35483605 return rc;
35493606 }
35503607
@@ -3675,12 +3732,19 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, · 124 unmodified lines
36753732 struct TCP_Server_Info *server;
36763733 int flags = 0;
36773734 bool allocated = false;
3735+ int retries = 0, cur_sleep = 1;
36783736
36793737 cifs_dbg(FYI, "Query Info\n");
36803738
36813739 if (!ses)
36823740 return -EIO;
3741+
3742+replay_again:
3743+ /* reinitialize for possible replay */
3744+ flags = 0;
3745+ allocated = false;
36833746 server = cifs_pick_channel(ses);
3747+
36843748 if (!server)
36853749 return -EIO;
36863750
@@ -3702,6 +3766,9 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, · 15 unmodified lines
37023766 trace_smb3_query_info_enter(xid, persistent_fid, tcon->tid,
37033767 ses->Suid, info_class, (__u32)info_type);
37043768
3769+ if (retries)
3770+ smb2_set_replay(server, &rqst);
3771+
37053772 rc = cifs_send_recv(xid, ses, server,
37063773 &rqst, &resp_buftype, flags, &rsp_iov);
37073774 rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base;
@@ -3744,6 +3811,11 @@ query_info(const unsigned int xid, struct cifs_tcon *tcon, · 36 unmodified lines
37443811 qinf_exit:
37453812 SMB2_query_info_free(&rqst);
37463813 free_rsp_buf(resp_buftype, rsp);
3814+
3815+ if (is_replayable_error(rc) &&
3816+ smb2_should_replay(tcon, &retries, &cur_sleep))
3817+ goto replay_again;
3818+
37473819 return rc;
37483820 }
37493821
@@ -3844,7 +3916,7 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon, · 94 unmodified lines
38443916 u32 *plen /* returned data len */)
38453917 {
38463918 struct cifs_ses *ses = tcon->ses;
3847− struct TCP_Server_Info *server = cifs_pick_channel(ses);
3919+ struct TCP_Server_Info *server;
38483920 struct smb_rqst rqst;
38493921 struct smb2_change_notify_rsp *smb_rsp;
38503922 struct kvec iov[1];
@@ -3852,6 +3924,12 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon, · 1 unmodified line
38523924 int resp_buftype = CIFS_NO_BUFFER;
38533925 int flags = 0;
38543926 int rc = 0;
3927+ int retries = 0, cur_sleep = 1;
3928+
3929+replay_again:
3930+ /* reinitialize for possible replay */
3931+ flags = 0;
3932+ server = cifs_pick_channel(ses);
38553933
38563934 cifs_dbg(FYI, "change notify\n");
38573935 if (!ses || !server)
@@ -3876,6 +3954,10 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon, · 18 unmodified lines
38763954
38773955 trace_smb3_notify_enter(xid, persistent_fid, tcon->tid, ses->Suid,
38783956 (u8)watch_tree, completion_filter);
3957+
3958+ if (retries)
3959+ smb2_set_replay(server, &rqst);
3960+
38793961 rc = cifs_send_recv(xid, ses, server,
38803962 &rqst, &resp_buftype, flags, &rsp_iov);
38813963
@@ -3910,6 +3992,11 @@ SMB2_change_notify(const unsigned int xid, struct cifs_tcon *tcon, · 28 unmodified lines
39103992 if (rqst.rq_iov)
39113993 cifs_small_buf_release(rqst.rq_iov[0].iov_base); /* request */
39123994 free_rsp_buf(resp_buftype, rsp_iov.iov_base);
3995+
3996+ if (is_replayable_error(rc) &&
3997+ smb2_should_replay(tcon, &retries, &cur_sleep))
3998+ goto replay_again;
3999+
39134000 return rc;
39144001 }
39154002
@@ -4152,10 +4239,16 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 236 unmodified lines
41524239 struct smb_rqst rqst;
41534240 struct kvec iov[1];
41544241 struct kvec rsp_iov = {NULL, 0};
4155− struct TCP_Server_Info *server = cifs_pick_channel(ses);
4242+ struct TCP_Server_Info *server;
41564243 int resp_buftype = CIFS_NO_BUFFER;
41574244 int flags = 0;
41584245 int rc = 0;
4246+ int retries = 0, cur_sleep = 1;
4247+
4248+replay_again:
4249+ /* reinitialize for possible replay */
4250+ flags = 0;
4251+ server = cifs_pick_channel(ses);
41594252
41604253 cifs_dbg(FYI, "flush\n");
41614254 if (!ses || !(ses->server))
@@ -4175,6 +4268,10 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 13 unmodified lines
41754268 goto flush_exit;
41764269
41774270 trace_smb3_flush_enter(xid, persistent_fid, tcon->tid, ses->Suid);
4271+
4272+ if (retries)
4273+ smb2_set_replay(server, &rqst);
4274+
41784275 rc = cifs_send_recv(xid, ses, server,
41794276 &rqst, &resp_buftype, flags, &rsp_iov);
41804277
@@ -4189,6 +4286,11 @@ SMB2_flush(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, · 8 unmodified lines
41894286 flush_exit:
41904287 SMB2_flush_free(&rqst);
41914288 free_rsp_buf(resp_buftype, rsp_iov.iov_base);
4289+
4290+ if (is_replayable_error(rc) &&
4291+ smb2_should_replay(tcon, &retries, &cur_sleep))
4292+ goto replay_again;
4293+
41924294 return rc;
41934295 }
41944296
@@ -4668,7 +4770,7 @@ smb2_async_writev(struct cifs_writedata *wdata, · 473 unmodified lines
46684770 struct cifs_io_parms *io_parms = NULL;
46694771 int credit_request;
46704772
4671− if (!wdata->server)
4773+ if (!wdata->server || wdata->replay)
46724774 server = wdata->server = cifs_pick_channel(tcon->ses);
46734775
46744776 /*
@@ -4753,6 +4855,8 @@ smb2_async_writev(struct cifs_writedata *wdata, · 78 unmodified lines
47534855 rqst.rq_nvec = 1;
47544856 rqst.rq_iter = wdata->iter;
47554857 rqst.rq_iter_size = iov_iter_count(&rqst.rq_iter);
4858+ if (wdata->replay)
4859+ smb2_set_replay(server, &rqst);
47564860 #ifdef CONFIG_CIFS_SMB_DIRECT
47574861 if (wdata->mr)
47584862 iov[0].iov_len += sizeof(struct smbd_buffer_descriptor_v1);
@@ -4826,18 +4930,21 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 67 unmodified lines
48264930 int flags = 0;
48274931 unsigned int total_len;
48284932 struct TCP_Server_Info *server;
4933+ int retries = 0, cur_sleep = 1;
48294934
4935+replay_again:
4936+ /* reinitialize for possible replay */
4937+ flags = 0;
48304938 *nbytes = 0;
4831−
4832− if (n_vec < 1)
4833− return rc;
4834−
48354939 if (!io_parms->server)
48364940 io_parms->server = cifs_pick_channel(io_parms->tcon->ses);
48374941 server = io_parms->server;
48384942 if (server == NULL)
48394943 return -ECONNABORTED;
48404944
4945+ if (n_vec < 1)
4946+ return rc;
4947+
48414948 rc = smb2_plain_req_init(SMB2_WRITE, io_parms->tcon, server,
48424949 (void **) &req, &total_len);
48434950 if (rc)
@@ -4871,6 +4978,9 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 27 unmodified lines
48714978 rqst.rq_iov = iov;
48724979 rqst.rq_nvec = n_vec + 1;
48734980
4981+ if (retries)
4982+ smb2_set_replay(server, &rqst);
4983+
48744984 rc = cifs_send_recv(xid, io_parms->tcon->ses, server,
48754985 &rqst,
48764986 &resp_buftype, flags, &rsp_iov);
@@ -4895,6 +5005,11 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 18 unmodified lines
48955005
48965006 cifs_small_buf_release(req);
48975007 free_rsp_buf(resp_buftype, rsp);
5008+
5009+ if (is_replayable_error(rc) &&
5010+ smb2_should_replay(io_parms->tcon, &retries, &cur_sleep))
5011+ goto replay_again;
5012+
48985013 return rc;
48995014 }
49005015
@@ -5206,8 +5321,14 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, · 305 unmodified lines
52065321 struct kvec rsp_iov;
52075322 int rc = 0;
52085323 struct cifs_ses *ses = tcon->ses;
5209− struct TCP_Server_Info *server = cifs_pick_channel(ses);
5324+ struct TCP_Server_Info *server;
52105325 int flags = 0;
5326+ int retries = 0, cur_sleep = 1;
5327+
5328+replay_again:
5329+ /* reinitialize for possible replay */
5330+ flags = 0;
5331+ server = cifs_pick_channel(ses);
52115332
52125333 if (!ses || !(ses->server))
52135334 return -EIO;
@@ -5227,6 +5348,9 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, · 13 unmodified lines
52275348 if (rc)
52285349 goto qdir_exit;
52295350
5351+ if (retries)
5352+ smb2_set_replay(server, &rqst);
5353+
52305354 rc = cifs_send_recv(xid, ses, server,
52315355 &rqst, &resp_buftype, flags, &rsp_iov);
52325356 rsp = (struct smb2_query_directory_rsp *)rsp_iov.iov_base;
@@ -5261,6 +5385,11 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon, · 28 unmodified lines
52615385 qdir_exit:
52625386 SMB2_query_directory_free(&rqst);
52635387 free_rsp_buf(resp_buftype, rsp);
5388+
5389+ if (is_replayable_error(rc) &&
5390+ smb2_should_replay(tcon, &retries, &cur_sleep))
5391+ goto replay_again;
5392+
52645393 return rc;
52655394 }
52665395
@@ -5327,8 +5456,14 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon, · 60 unmodified lines
53275456 int rc = 0;
53285457 int resp_buftype;
53295458 struct cifs_ses *ses = tcon->ses;
5330− struct TCP_Server_Info *server = cifs_pick_channel(ses);
5459+ struct TCP_Server_Info *server;
53315460 int flags = 0;
5461+ int retries = 0, cur_sleep = 1;
5462+
5463+replay_again:
5464+ /* reinitialize for possible replay */
5465+ flags = 0;
5466+ server = cifs_pick_channel(ses);
53325467
53335468 if (!ses || !server)
53345469 return -EIO;
@@ -5356,6 +5491,8 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon, · 21 unmodified lines
53565491 return rc;
53575492 }
53585493
5494+ if (retries)
5495+ smb2_set_replay(server, &rqst);
53595496
53605497 rc = cifs_send_recv(xid, ses, server,
53615498 &rqst, &resp_buftype, flags,
@@ -5371,6 +5508,11 @@ send_set_info(const unsigned int xid, struct cifs_tcon *tcon, · 9 unmodified lines
53715508
53725509 free_rsp_buf(resp_buftype, rsp);
53735510 kfree(iov);
5511+
5512+ if (is_replayable_error(rc) &&
5513+ smb2_should_replay(tcon, &retries, &cur_sleep))
5514+ goto replay_again;
5515+
53745516 return rc;
53755517 }
53765518
@@ -5423,12 +5565,18 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon, · 46 unmodified lines
54235565 int rc;
54245566 struct smb2_oplock_break *req = NULL;
54255567 struct cifs_ses *ses = tcon->ses;
5426− struct TCP_Server_Info *server = cifs_pick_channel(ses);
5568+ struct TCP_Server_Info *server;
54275569 int flags = CIFS_OBREAK_OP;
54285570 unsigned int total_len;
54295571 struct kvec iov[1];
54305572 struct kvec rsp_iov;
54315573 int resp_buf_type;
5574+ int retries = 0, cur_sleep = 1;
5575+
5576+replay_again:
5577+ /* reinitialize for possible replay */
5578+ flags = CIFS_OBREAK_OP;
5579+ server = cifs_pick_channel(ses);
54325580
54335581 cifs_dbg(FYI, "SMB2_oplock_break\n");
54345582 rc = smb2_plain_req_init(SMB2_OPLOCK_BREAK, tcon, server,
@@ -5453,15 +5601,21 @@ SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon, · 18 unmodified lines
54535601 rqst.rq_iov = iov;
54545602 rqst.rq_nvec = 1;
54555603
5604+ if (retries)
5605+ smb2_set_replay(server, &rqst);
5606+
54565607 rc = cifs_send_recv(xid, ses, server,
54575608 &rqst, &resp_buf_type, flags, &rsp_iov);
54585609 cifs_small_buf_release(req);
5459−
54605610 if (rc) {
54615611 cifs_stats_fail_inc(tcon, SMB2_OPLOCK_BREAK_HE);
54625612 cifs_dbg(FYI, "Send error in Oplock Break = %d\n", rc);
54635613 }
54645614
5615+ if (is_replayable_error(rc) &&
5616+ smb2_should_replay(tcon, &retries, &cur_sleep))
5617+ goto replay_again;
5618+
54655619 return rc;
54665620 }
54675621
@@ -5547,9 +5701,15 @@ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon, · 79 unmodified lines
55475701 int rc = 0;
55485702 int resp_buftype;
55495703 struct cifs_ses *ses = tcon->ses;
5550− struct TCP_Server_Info *server = cifs_pick_channel(ses);
5704+ struct TCP_Server_Info *server;
55515705 FILE_SYSTEM_POSIX_INFO *info = NULL;
55525706 int flags = 0;
5707+ int retries = 0, cur_sleep = 1;
5708+
5709+replay_again:
5710+ /* reinitialize for possible replay */
5711+ flags = 0;
5712+ server = cifs_pick_channel(ses);
55535713
55545714 rc = build_qfs_info_req(&iov, tcon, server,
55555715 FS_POSIX_INFORMATION,
@@ -5565,6 +5725,9 @@ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon, · 9 unmodified lines
55655725 rqst.rq_iov = &iov;
55665726 rqst.rq_nvec = 1;
55675727
5728+ if (retries)
5729+ smb2_set_replay(server, &rqst);
5730+
55685731 rc = cifs_send_recv(xid, ses, server,
55695732 &rqst, &resp_buftype, flags, &rsp_iov);
55705733 free_qfs_info_req(&iov);
@@ -5584,6 +5747,11 @@ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon, · 13 unmodified lines
55845747
55855748 posix_qfsinf_exit:
55865749 free_rsp_buf(resp_buftype, rsp_iov.iov_base);
5750+
5751+ if (is_replayable_error(rc) &&
5752+ smb2_should_replay(tcon, &retries, &cur_sleep))
5753+ goto replay_again;
5754+
55875755 return rc;
55885756 }
55895757
@@ -5598,9 +5766,15 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon, · 8 unmodified lines
55985766 int rc = 0;
55995767 int resp_buftype;
56005768 struct cifs_ses *ses = tcon->ses;
5601− struct TCP_Server_Info *server = cifs_pick_channel(ses);
5769+ struct TCP_Server_Info *server;
56025770 struct smb2_fs_full_size_info *info = NULL;
56035771 int flags = 0;
5772+ int retries = 0, cur_sleep = 1;
5773+
5774+replay_again:
5775+ /* reinitialize for possible replay */
5776+ flags = 0;
5777+ server = cifs_pick_channel(ses);
56045778
56055779 rc = build_qfs_info_req(&iov, tcon, server,
56065780 FS_FULL_SIZE_INFORMATION,
@@ -5616,6 +5790,9 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon, · 9 unmodified lines
56165790 rqst.rq_iov = &iov;
56175791 rqst.rq_nvec = 1;
56185792
5793+ if (retries)
5794+ smb2_set_replay(server, &rqst);
5795+
56195796 rc = cifs_send_recv(xid, ses, server,
56205797 &rqst, &resp_buftype, flags, &rsp_iov);
56215798 free_qfs_info_req(&iov);
@@ -5635,6 +5812,11 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon, · 13 unmodified lines
56355812
56365813 qfsinf_exit:
56375814 free_rsp_buf(resp_buftype, rsp_iov.iov_base);
5815+
5816+ if (is_replayable_error(rc) &&
5817+ smb2_should_replay(tcon, &retries, &cur_sleep))
5818+ goto replay_again;
5819+
56385820 return rc;
56395821 }
56405822
@@ -5649,9 +5831,15 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, · 8 unmodified lines
56495831 int rc = 0;
56505832 int resp_buftype, max_len, min_len;
56515833 struct cifs_ses *ses = tcon->ses;
5652− struct TCP_Server_Info *server = cifs_pick_channel(ses);
5834+ struct TCP_Server_Info *server;
56535835 unsigned int rsp_len, offset;
56545836 int flags = 0;
5837+ int retries = 0, cur_sleep = 1;
5838+
5839+replay_again:
5840+ /* reinitialize for possible replay */
5841+ flags = 0;
5842+ server = cifs_pick_channel(ses);
56555843
56565844 if (level == FS_DEVICE_INFORMATION) {
56575845 max_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
@@ -5683,6 +5871,9 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, · 25 unmodified lines
56835871 rqst.rq_iov = &iov;
56845872 rqst.rq_nvec = 1;
56855873
5874+ if (retries)
5875+ smb2_set_replay(server, &rqst);
5876+
56865877 rc = cifs_send_recv(xid, ses, server,
56875878 &rqst, &resp_buftype, flags, &rsp_iov);
56885879 free_qfs_info_req(&iov);
@@ -5720,6 +5911,11 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, · 31 unmodified lines
57205911
57215912 qfsattr_exit:
57225913 free_rsp_buf(resp_buftype, rsp_iov.iov_base);
5914+
5915+ if (is_replayable_error(rc) &&
5916+ smb2_should_replay(tcon, &retries, &cur_sleep))
5917+ goto replay_again;
5918+
57235919 return rc;
57245920 }
57255921
@@ -5737,7 +5933,13 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon, · 11 unmodified lines
57375933 unsigned int count;
57385934 int flags = CIFS_NO_RSP_BUF;
57395935 unsigned int total_len;
5740− struct TCP_Server_Info *server = cifs_pick_channel(tcon->ses);
5936+ struct TCP_Server_Info *server;
5937+ int retries = 0, cur_sleep = 1;
5938+
5939+replay_again:
5940+ /* reinitialize for possible replay */
5941+ flags = CIFS_NO_RSP_BUF;
5942+ server = cifs_pick_channel(tcon->ses);
57415943
57425944 cifs_dbg(FYI, "smb2_lockv num lock %d\n", num_lock);
57435945
@@ -5768,6 +5970,9 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon, · 24 unmodified lines
57685970 rqst.rq_iov = iov;
57695971 rqst.rq_nvec = 2;
57705972
5973+ if (retries)
5974+ smb2_set_replay(server, &rqst);
5975+
57715976 rc = cifs_send_recv(xid, tcon->ses, server,
57725977 &rqst, &resp_buf_type, flags,
57735978 &rsp_iov);
@@ -5779,6 +5984,10 @@ smb2_lockv(const unsigned int xid, struct cifs_tcon *tcon, · 5 unmodified lines
57795984 tcon->ses->Suid, rc);
57805985 }
57815986
5987+ if (is_replayable_error(rc) &&
5988+ smb2_should_replay(tcon, &retries, &cur_sleep))
5989+ goto replay_again;
5990+
57825991 return rc;
57835992 }
57845993
fs/smb/client/smb2proto.h+5−0
@@ -122,6 +122,11 @@ extern unsigned long smb_rqst_len(struct TCP_Server_Info *server, · 121 unmodified lines
122122 extern void smb2_set_next_command(struct cifs_tcon *tcon,
123123 struct smb_rqst *rqst);
124124 extern void smb2_set_related(struct smb_rqst *rqst);
125+extern void smb2_set_replay(struct TCP_Server_Info *server,
126+ struct smb_rqst *rqst);
127+extern bool smb2_should_replay(struct cifs_tcon *tcon,
128+ int *pretries,
129+ int *pcur_sleep);
125130
126131 /*
127132 * SMB2 Worker functions - most of protocol specific implementation details
fs/smb/client/smbencrypt.c+0−7
@@ -26,13 +26,6 @@ · 25 unmodified lines
2626 #include "cifsproto.h"
2727 #include "../common/md4.h"
2828
29−#ifndef false
30−#define false 0
31−#endif
32−#ifndef true
33−#define true 1
34−#endif
35−
3629 /* following came from the other byteorder.h to avoid include conflicts */
3730 #define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
3831 #define SSVALX(buf,pos,val) (CVAL(buf,pos)=(val)&0xFF,CVAL(buf,pos+1)=(val)>>8)
fs/smb/client/transport.c+12−2
@@ -400,10 +400,17 @@ unmask: · 399 unmodified lines
400400 server->conn_id, server->hostname);
401401 }
402402 smbd_done:
403− if (rc < 0 && rc != -EINTR)
403+ /*
404+ * there's hardly any use for the layers above to know the
405+ * actual error code here. All they should do at this point is
406+ * to retry the connection and hope it goes away.
407+ */
408+ if (rc < 0 && rc != -EINTR && rc != -EAGAIN) {
404409 cifs_server_dbg(VFS, "Error %d sending data on socket to server\n",
405410 rc);
406− else if (rc > 0)
411+ rc = -ECONNABORTED;
412+ cifs_signal_cifsd_for_reconnect(server, false);
413+ } else if (rc > 0)
407414 rc = 0;
408415 out:
409416 cifs_in_send_dec(server);
@@ -1026,6 +1033,9 @@ struct TCP_Server_Info *cifs_pick_channel(struct cifs_ses *ses) · 616 unmodified lines
10261033 if (!server || server->terminate)
10271034 continue;
10281035
1036+ if (CIFS_CHAN_NEEDS_RECONNECT(ses, i))
1037+ continue;
1038+
10291039 /*
10301040 * strictly speaking, we should pick up req_lock to read
10311041 * server->in_flight. But it shouldn't matter much here if we
fs/smb/server/ksmbd_netlink.h+2−1
@@ -304,7 +304,8 @@ enum ksmbd_event { · 303 unmodified lines
304304 KSMBD_EVENT_SPNEGO_AUTHEN_REQUEST,
305305 KSMBD_EVENT_SPNEGO_AUTHEN_RESPONSE = 15,
306306
307− KSMBD_EVENT_MAX
307+ __KSMBD_EVENT_MAX,
308+ KSMBD_EVENT_MAX = __KSMBD_EVENT_MAX - 1
308309 };
309310
310311 /*
fs/smb/server/transport_ipc.c+2−2
@@ -74,7 +74,7 @@ static int handle_unsupported_event(struct sk_buff *skb, struct genl_info *info) · 73 unmodified lines
7474 static int handle_generic_event(struct sk_buff *skb, struct genl_info *info);
7575 static int ksmbd_ipc_heartbeat_request(void);
7676
77−static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX] = {
77+static const struct nla_policy ksmbd_nl_policy[KSMBD_EVENT_MAX + 1] = {
7878 [KSMBD_EVENT_UNSPEC] = {
7979 .len = 0,
8080 },
@@ -403,7 +403,7 @@ static int handle_generic_event(struct sk_buff *skb, struct genl_info *info) · 322 unmodified lines
403403 return -EPERM;
404404 #endif
405405
406− if (type >= KSMBD_EVENT_MAX) {
406+ if (type > KSMBD_EVENT_MAX) {
407407 WARN_ON(1);
408408 return -EINVAL;
409409 }
fs/smb/server/transport_tcp.c+2−0
@@ -365,6 +365,7 @@ static int ksmbd_tcp_readv(struct tcp_transport *t, struct kvec *iov_orig, · 364 unmodified lines
365365 * @t: TCP transport instance
366366 * @buf: buffer to store read data from socket
367367 * @to_read: number of bytes to read from socket
368+ * @max_retries: number of retries if reading from socket fails
368369 *
369370 * Return: on success return number of bytes read from socket,
370371 * otherwise return error number
@@ -416,6 +417,7 @@ static void tcp_destroy_socket(struct socket *ksmbd_socket) · 45 unmodified lines
416417
417418 /**
418419 * create_socket - create socket for ksmbd/0
420+ * @iface: interface to bind the created socket to
419421 *
420422 * Return: 0 on success, error number otherwise
421423 */
fs/tracefs/event_inode.c+0−38
@@ -281,44 +281,6 @@ static void update_inode_attr(struct dentry *dentry, struct inode *inode, · 280 unmodified lines
281281 inode->i_gid = attr->gid;
282282 }
283283
284−static void update_gid(struct eventfs_inode *ei, kgid_t gid, int level)
285−{
286− struct eventfs_inode *ei_child;
287−
288− /* at most we have events/system/event */
289− if (WARN_ON_ONCE(level > 3))
290− return;
291−
292− ei->attr.gid = gid;
293−
294− if (ei->entry_attrs) {
295− for (int i = 0; i < ei->nr_entries; i++) {
296− ei->entry_attrs[i].gid = gid;
297− }
298− }
299−
300− /*
301− * Only eventfs_inode with dentries are updated, make sure
302− * all eventfs_inodes are updated. If one of the children
303− * do not have a dentry, this function must traverse it.
304− */
305− list_for_each_entry_srcu(ei_child, &ei->children, list,
306− srcu_read_lock_held(&eventfs_srcu)) {
307− if (!ei_child->dentry)
308− update_gid(ei_child, gid, level + 1);
309− }
310−}
311−
312−void eventfs_update_gid(struct dentry *dentry, kgid_t gid)
313−{
314− struct eventfs_inode *ei = dentry->d_fsdata;
315− int idx;
316−
317− idx = srcu_read_lock(&eventfs_srcu);
318− update_gid(ei, gid, 0);
319− srcu_read_unlock(&eventfs_srcu, idx);
320−}
321−
322284 /**
323285 * create_file - create a file in the tracefs filesystem
324286 * @name: the name of the file to create.
fs/tracefs/internal.h+0−1
@@ -82,7 +82,6 @@ struct inode *tracefs_get_inode(struct super_block *sb); · 81 unmodified lines
8282 struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
8383 struct dentry *eventfs_failed_creating(struct dentry *dentry);
8484 struct dentry *eventfs_end_creating(struct dentry *dentry);
85−void eventfs_update_gid(struct dentry *dentry, kgid_t gid);
8685 void eventfs_set_ei_status_free(struct tracefs_inode *ti, struct dentry *dentry);
8786
8887 #endif /* _TRACEFS_INTERNAL_H */
fs/xfs/xfs_super.c+17−10
@@ -1496,6 +1496,18 @@ xfs_fs_fill_super( · 1495 unmodified lines
14961496
14971497 mp->m_super = sb;
14981498
1499+ /*
1500+ * Copy VFS mount flags from the context now that all parameter parsing
1501+ * is guaranteed to have been completed by either the old mount API or
1502+ * the newer fsopen/fsconfig API.
1503+ */
1504+ if (fc->sb_flags & SB_RDONLY)
1505+ set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
1506+ if (fc->sb_flags & SB_DIRSYNC)
1507+ mp->m_features |= XFS_FEAT_DIRSYNC;
1508+ if (fc->sb_flags & SB_SYNCHRONOUS)
1509+ mp->m_features |= XFS_FEAT_WSYNC;
1510+
14991511 error = xfs_fs_validate_params(mp);
15001512 if (error)
15011513 return error;
@@ -1965,6 +1977,11 @@ static const struct fs_context_operations xfs_context_ops = { · 463 unmodified lines
19651977 .free = xfs_fs_free,
19661978 };
19671979
1980+/*
1981+ * WARNING: do not initialise any parameters in this function that depend on
1982+ * mount option parsing having already been performed as this can be called from
1983+ * fsopen() before any parameters have been set.
1984+ */
19681985 static int xfs_init_fs_context(
19691986 struct fs_context *fc)
19701987 {
@@ -1996,16 +2013,6 @@ static int xfs_init_fs_context( · 25 unmodified lines
19962013 mp->m_logbsize = -1;
19972014 mp->m_allocsize_log = 16; /* 64k */
19982015
1999− /*
2000− * Copy binary VFS mount flags we are interested in.
2001− */
2002− if (fc->sb_flags & SB_RDONLY)
2003− set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
2004− if (fc->sb_flags & SB_DIRSYNC)
2005− mp->m_features |= XFS_FEAT_DIRSYNC;
2006− if (fc->sb_flags & SB_SYNCHRONOUS)
2007− mp->m_features |= XFS_FEAT_WSYNC;
2008−
20092016 fc->s_fs_info = mp;
20102017 fc->ops = &xfs_context_ops;
20112018
include/linux/hid_bpf.h+0−11
@@ -77,17 +77,6 @@ enum hid_bpf_attach_flags { · 76 unmodified lines
7777 int hid_bpf_device_event(struct hid_bpf_ctx *ctx);
7878 int hid_bpf_rdesc_fixup(struct hid_bpf_ctx *ctx);
7979
80−/* Following functions are kfunc that we export to BPF programs */
81−/* available everywhere in HID-BPF */
82−__u8 *hid_bpf_get_data(struct hid_bpf_ctx *ctx, unsigned int offset, const size_t __sz);
83−
84−/* only available in syscall */
85−int hid_bpf_attach_prog(unsigned int hid_id, int prog_fd, __u32 flags);
86−int hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz,
87− enum hid_report_type rtype, enum hid_class_request reqtype);
88−struct hid_bpf_ctx *hid_bpf_allocate_context(unsigned int hid_id);
89−void hid_bpf_release_context(struct hid_bpf_ctx *ctx);
90−
9180 /*
9281 * Below is HID internal
9382 */
include/linux/libata.h+1−1
@@ -471,7 +471,7 @@ enum ata_completion_errors { · 470 unmodified lines
471471
472472 /*
473473 * Link power management policy: If you alter this, you also need to
474− * alter libata-scsi.c (for the ascii descriptions)
474+ * alter libata-sata.c (for the ascii descriptions)
475475 */
476476 enum ata_lpm_policy {
477477 ATA_LPM_UNKNOWN,
include/linux/lsm_hook_defs.h+2−2
@@ -315,9 +315,9 @@ LSM_HOOK(int, 0, socket_getsockopt, struct socket *sock, int level, int optname) · 314 unmodified lines
315315 LSM_HOOK(int, 0, socket_setsockopt, struct socket *sock, int level, int optname)
316316 LSM_HOOK(int, 0, socket_shutdown, struct socket *sock, int how)
317317 LSM_HOOK(int, 0, socket_sock_rcv_skb, struct sock *sk, struct sk_buff *skb)
318−LSM_HOOK(int, 0, socket_getpeersec_stream, struct socket *sock,
318+LSM_HOOK(int, -ENOPROTOOPT, socket_getpeersec_stream, struct socket *sock,
319319 sockptr_t optval, sockptr_t optlen, unsigned int len)
320−LSM_HOOK(int, 0, socket_getpeersec_dgram, struct socket *sock,
320+LSM_HOOK(int, -ENOPROTOOPT, socket_getpeersec_dgram, struct socket *sock,
321321 struct sk_buff *skb, u32 *secid)
322322 LSM_HOOK(int, 0, sk_alloc_security, struct sock *sk, int family, gfp_t priority)
323323 LSM_HOOK(void, LSM_RET_VOID, sk_free_security, struct sock *sk)
include/linux/mman.h+1−0
@@ -156,6 +156,7 @@ calc_vm_flag_bits(unsigned long flags) · 155 unmodified lines
156156 return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) |
157157 _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ) |
158158 _calc_vm_trans(flags, MAP_SYNC, VM_SYNC ) |
159+ _calc_vm_trans(flags, MAP_STACK, VM_NOHUGEPAGE) |
159160 arch_calc_vm_flag_bits(flags);
160161 }
161162
include/linux/mmzone.h+3−3
@@ -2013,9 +2013,9 @@ static inline int pfn_valid(unsigned long pfn) · 2012 unmodified lines
20132013 if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
20142014 return 0;
20152015 ms = __pfn_to_section(pfn);
2016− rcu_read_lock();
2016+ rcu_read_lock_sched();
20172017 if (!valid_section(ms)) {
2018− rcu_read_unlock();
2018+ rcu_read_unlock_sched();
20192019 return 0;
20202020 }
20212021 /*
@@ -2023,7 +2023,7 @@ static inline int pfn_valid(unsigned long pfn) · 1 unmodified line
20232023 * the entire section-sized span.
20242024 */
20252025 ret = early_section(ms) || pfn_section_valid(ms, pfn);
2026− rcu_read_unlock();
2026+ rcu_read_unlock_sched();
20272027
20282028 return ret;
20292029 }
include/linux/netfilter/ipset/ip_set.h+4−0
@@ -186,6 +186,8 @@ struct ip_set_type_variant { · 185 unmodified lines
186186 /* Return true if "b" set is the same as "a"
187187 * according to the create set parameters */
188188 bool (*same_set)(const struct ip_set *a, const struct ip_set *b);
189+ /* Cancel ongoing garbage collectors before destroying the set*/
190+ void (*cancel_gc)(struct ip_set *set);
189191 /* Region-locking is used */
190192 bool region_lock;
191193 };
@@ -242,6 +244,8 @@ extern void ip_set_type_unregister(struct ip_set_type *set_type); · 50 unmodified lines
242244
243245 /* A generic IP set */
244246 struct ip_set {
247+ /* For call_cru in destroy */
248+ struct rcu_head rcu;
245249 /* The name of the set */
246250 char name[IPSET_MAXNAMELEN];
247251 /* Lock protecting the set data */
include/linux/spi/spi.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #include <uapi/linux/spi/spi.h>
2222
2323 /* Max no. of CS supported per spi device */
24−#define SPI_CS_CNT_MAX 4
24+#define SPI_CS_CNT_MAX 16
2525
2626 struct dma_chan;
2727 struct software_node;
include/linux/syscalls.h+1−0
@@ -128,6 +128,7 @@ struct mnt_id_req; · 127 unmodified lines
128128 #define __TYPE_IS_LL(t) (__TYPE_AS(t, 0LL) || __TYPE_AS(t, 0ULL))
129129 #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a
130130 #define __SC_CAST(t, a) (__force t) a
131+#define __SC_TYPE(t, a) t
131132 #define __SC_ARGS(t, a) a
132133 #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long))
133134
include/net/af_unix.h+14−6
@@ -54,12 +54,6 @@ struct scm_stat { · 53 unmodified lines
5454
5555 #define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
5656
57−#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
58−#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
59−#define unix_state_lock_nested(s) \
60− spin_lock_nested(&unix_sk(s)->lock, \
61− SINGLE_DEPTH_NESTING)
62−
6357 /* The AF_UNIX socket */
6458 struct unix_sock {
6559 /* WARNING: sk has to be the first member */
@@ -85,6 +79,20 @@ struct unix_sock { · 19 unmodified lines
8579 #define unix_sk(ptr) container_of_const(ptr, struct unix_sock, sk)
8680 #define unix_peer(sk) (unix_sk(sk)->peer)
8781
82+#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
83+#define unix_state_unlock(s) spin_unlock(&unix_sk(s)->lock)
84+enum unix_socket_lock_class {
85+ U_LOCK_NORMAL,
86+ U_LOCK_SECOND, /* for double locking, see unix_state_double_lock(). */
87+ U_LOCK_DIAG, /* used while dumping icons, see sk_diag_dump_icons(). */
88+};
89+
90+static inline void unix_state_lock_nested(struct sock *sk,
91+ enum unix_socket_lock_class subclass)
92+{
93+ spin_lock_nested(&unix_sk(sk)->lock, subclass);
94+}
95+
8896 #define peer_wait peer_wq.wait
8997
9098 long unix_inq_len(struct sock *sk);
include/net/ip.h+1−1
@@ -767,7 +767,7 @@ int ip_options_rcv_srr(struct sk_buff *skb, struct net_device *dev); · 766 unmodified lines
767767 * Functions provided by ip_sockglue.c
768768 */
769769
770−void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
770+void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb, bool drop_dst);
771771 void ip_cmsg_recv_offset(struct msghdr *msg, struct sock *sk,
772772 struct sk_buff *skb, int tlen, int offset);
773773 int ip_cmsg_send(struct sock *sk, struct msghdr *msg,
include/net/netfilter/nf_tables.h+2−0
@@ -1357,6 +1357,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table, · 1356 unmodified lines
13571357 * @type: stateful object numeric type
13581358 * @owner: module owner
13591359 * @maxattr: maximum netlink attribute
1360+ * @family: address family for AF-specific object types
13601361 * @policy: netlink attribute policy
13611362 */
13621363 struct nft_object_type {
@@ -1366,6 +1367,7 @@ struct nft_object_type { · 3 unmodified lines
13661367 struct list_head list;
13671368 u32 type;
13681369 unsigned int maxattr;
1370+ u8 family;
13691371 struct module *owner;
13701372 const struct nla_policy *policy;
13711373 };
include/uapi/drm/ivpu_accel.h+20−5
@@ -53,7 +53,7 @@ extern "C" { · 52 unmodified lines
5353 #define DRM_IVPU_PARAM_CORE_CLOCK_RATE 3
5454 #define DRM_IVPU_PARAM_NUM_CONTEXTS 4
5555 #define DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS 5
56−#define DRM_IVPU_PARAM_CONTEXT_PRIORITY 6
56+#define DRM_IVPU_PARAM_CONTEXT_PRIORITY 6 /* Deprecated */
5757 #define DRM_IVPU_PARAM_CONTEXT_ID 7
5858 #define DRM_IVPU_PARAM_FW_API_VERSION 8
5959 #define DRM_IVPU_PARAM_ENGINE_HEARTBEAT 9
@@ -64,11 +64,18 @@ extern "C" { · 4 unmodified lines
6464
6565 #define DRM_IVPU_PLATFORM_TYPE_SILICON 0
6666
67+/* Deprecated, use DRM_IVPU_JOB_PRIORITY */
6768 #define DRM_IVPU_CONTEXT_PRIORITY_IDLE 0
6869 #define DRM_IVPU_CONTEXT_PRIORITY_NORMAL 1
6970 #define DRM_IVPU_CONTEXT_PRIORITY_FOCUS 2
7071 #define DRM_IVPU_CONTEXT_PRIORITY_REALTIME 3
7172
73+#define DRM_IVPU_JOB_PRIORITY_DEFAULT 0
74+#define DRM_IVPU_JOB_PRIORITY_IDLE 1
75+#define DRM_IVPU_JOB_PRIORITY_NORMAL 2
76+#define DRM_IVPU_JOB_PRIORITY_FOCUS 3
77+#define DRM_IVPU_JOB_PRIORITY_REALTIME 4
78+
7279 /**
7380 * DRM_IVPU_CAP_METRIC_STREAMER
7481 *
@@ -112,10 +119,6 @@ struct drm_ivpu_param { · 37 unmodified lines
112119 * %DRM_IVPU_PARAM_CONTEXT_BASE_ADDRESS:
113120 * Lowest VPU virtual address available in the current context (read-only)
114121 *
115− * %DRM_IVPU_PARAM_CONTEXT_PRIORITY:
116− * Value of current context scheduling priority (read-write).
117− * See DRM_IVPU_CONTEXT_PRIORITY_* for possible values.
118− *
119122 * %DRM_IVPU_PARAM_CONTEXT_ID:
120123 * Current context ID, always greater than 0 (read-only)
121124 *
@@ -286,6 +289,18 @@ struct drm_ivpu_submit { · 164 unmodified lines
286289 * to be executed. The offset has to be 8-byte aligned.
287290 */
288291 __u32 commands_offset;
292+
293+ /**
294+ * @priority:
295+ *
296+ * Priority to be set for related job command queue, can be one of the following:
297+ * %DRM_IVPU_JOB_PRIORITY_DEFAULT
298+ * %DRM_IVPU_JOB_PRIORITY_IDLE
299+ * %DRM_IVPU_JOB_PRIORITY_NORMAL
300+ * %DRM_IVPU_JOB_PRIORITY_FOCUS
301+ * %DRM_IVPU_JOB_PRIORITY_REALTIME
302+ */
303+ __u32 priority;
289304 };
290305
291306 /* drm_ivpu_bo_wait job status codes */
io_uring/opdef.c+0−1
@@ -471,7 +471,6 @@ const struct io_issue_def io_issue_defs[] = { · 470 unmodified lines
471471 },
472472 [IORING_OP_FIXED_FD_INSTALL] = {
473473 .needs_file = 1,
474− .audit_skip = 1,
475474 .prep = io_install_fixed_fd_prep,
476475 .issue = io_install_fixed_fd,
477476 },
io_uring/openclose.c+4−0
@@ -277,6 +277,10 @@ int io_install_fixed_fd_prep(struct io_kiocb *req, const struct io_uring_sqe *sq · 276 unmodified lines
277277 if (flags & ~IORING_FIXED_FD_NO_CLOEXEC)
278278 return -EINVAL;
279279
280+ /* ensure the task's creds are used when installing/receiving fds */
281+ if (req->flags & REQ_F_CREDS)
282+ return -EPERM;
283+
280284 /* default to O_CLOEXEC, disable if IORING_FIXED_FD_NO_CLOEXEC is set */
281285 ifi = io_kiocb_to_cmd(req, struct io_fixed_install);
282286 ifi->o_flags = O_CLOEXEC;
kernel/events/uprobes.c+1−1
@@ -537,7 +537,7 @@ retry: · 536 unmodified lines
537537 }
538538 }
539539
540− ret = __replace_page(vma, vaddr, old_page, new_page);
540+ ret = __replace_page(vma, vaddr & PAGE_MASK, old_page, new_page);
541541 if (new_page)
542542 put_page(new_page);
543543 put_old:
kernel/futex/core.c+12−3
@@ -627,12 +627,21 @@ retry: · 626 unmodified lines
627627 }
628628
629629 /*
630− * PI futexes can not be requeued and must remove themselves from the
631− * hash bucket. The hash bucket lock (i.e. lock_ptr) is held.
630+ * PI futexes can not be requeued and must remove themselves from the hash
631+ * bucket. The hash bucket lock (i.e. lock_ptr) is held.
632632 */
633633 void futex_unqueue_pi(struct futex_q *q)
634634 {
635− __futex_unqueue(q);
635+ /*
636+ * If the lock was not acquired (due to timeout or signal) then the
637+ * rt_waiter is removed before futex_q is. If this is observed by
638+ * an unlocker after dropping the rtmutex wait lock and before
639+ * acquiring the hash bucket lock, then the unlocker dequeues the
640+ * futex_q from the hash bucket list to guarantee consistent state
641+ * vs. userspace. Therefore the dequeue here must be conditional.
642+ */
643+ if (!plist_node_empty(&q->list))
644+ __futex_unqueue(q);
636645
637646 BUG_ON(!q->pi_state);
638647 put_pi_state(q->pi_state);
kernel/futex/pi.c+8−3
@@ -1135,6 +1135,7 @@ retry: · 1134 unmodified lines
11351135
11361136 hb = futex_hash(&key);
11371137 spin_lock(&hb->lock);
1138+retry_hb:
11381139
11391140 /*
11401141 * Check waiters first. We do not trust user space values at
@@ -1177,12 +1178,17 @@ retry: · 36 unmodified lines
11771178 /*
11781179 * Futex vs rt_mutex waiter state -- if there are no rt_mutex
11791180 * waiters even though futex thinks there are, then the waiter
1180− * is leaving and the uncontended path is safe to take.
1181+ * is leaving. The entry needs to be removed from the list so a
1182+ * new futex_lock_pi() is not using this stale PI-state while
1183+ * the futex is available in user space again.
1184+ * There can be more than one task on its way out so it needs
1185+ * to retry.
11811186 */
11821187 rt_waiter = rt_mutex_top_waiter(&pi_state->pi_mutex);
11831188 if (!rt_waiter) {
1189+ __futex_unqueue(top_waiter);
11841190 raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
1185− goto do_uncontended;
1191+ goto retry_hb;
11861192 }
11871193
11881194 get_pi_state(pi_state);
@@ -1217,7 +1223,6 @@ retry: · 28 unmodified lines
12171223 return ret;
12181224 }
12191225
1220−do_uncontended:
12211226 /*
12221227 * We have no kernel internal state, i.e. no waiters in the
12231228 * kernel. Waiters which are about to queue themselves are stuck
kernel/irq/irqdesc.c+1−1
@@ -600,7 +600,7 @@ int __init early_irq_init(void) · 599 unmodified lines
600600 mutex_init(&desc[i].request_mutex);
601601 init_waitqueue_head(&desc[i].wait_for_threads);
602602 desc_set_defaults(i, &desc[i], node, NULL, NULL);
603− irq_resend_init(desc);
603+ irq_resend_init(&desc[i]);
604604 }
605605 return arch_early_irq_init();
606606 }
kernel/time/clocksource.c+24−1
@@ -99,6 +99,7 @@ static u64 suspend_start; · 98 unmodified lines
9999 * Interval: 0.5sec.
100100 */
101101 #define WATCHDOG_INTERVAL (HZ >> 1)
102+#define WATCHDOG_INTERVAL_MAX_NS ((2 * WATCHDOG_INTERVAL) * (NSEC_PER_SEC / HZ))
102103
103104 /*
104105 * Threshold: 0.0312s, when doubled: 0.0625s.
@@ -134,6 +135,7 @@ static DECLARE_WORK(watchdog_work, clocksource_watchdog_work); · 29 unmodified lines
134135 static DEFINE_SPINLOCK(watchdog_lock);
135136 static int watchdog_running;
136137 static atomic_t watchdog_reset_pending;
138+static int64_t watchdog_max_interval;
137139
138140 static inline void clocksource_watchdog_lock(unsigned long *flags)
139141 {
@@ -399,8 +401,8 @@ static inline void clocksource_reset_watchdog(void) · 259 unmodified lines
399401 static void clocksource_watchdog(struct timer_list *unused)
400402 {
401403 u64 csnow, wdnow, cslast, wdlast, delta;
404+ int64_t wd_nsec, cs_nsec, interval;
402405 int next_cpu, reset_pending;
403− int64_t wd_nsec, cs_nsec;
404406 struct clocksource *cs;
405407 enum wd_read_status read_ret;
406408 unsigned long extra_wait = 0;
@@ -470,6 +472,27 @@ static void clocksource_watchdog(struct timer_list *unused) · 63 unmodified lines
470472 if (atomic_read(&watchdog_reset_pending))
471473 continue;
472474
475+ /*
476+ * The processing of timer softirqs can get delayed (usually
477+ * on account of ksoftirqd not getting to run in a timely
478+ * manner), which causes the watchdog interval to stretch.
479+ * Skew detection may fail for longer watchdog intervals
480+ * on account of fixed margins being used.
481+ * Some clocksources, e.g. acpi_pm, cannot tolerate
482+ * watchdog intervals longer than a few seconds.
483+ */
484+ interval = max(cs_nsec, wd_nsec);
485+ if (unlikely(interval > WATCHDOG_INTERVAL_MAX_NS)) {
486+ if (system_state > SYSTEM_SCHEDULING &&
487+ interval > 2 * watchdog_max_interval) {
488+ watchdog_max_interval = interval;
489+ pr_warn("Long readout interval, skipping watchdog check: cs_nsec: %lld wd_nsec: %lld\n",
490+ cs_nsec, wd_nsec);
491+ }
492+ watchdog_timer.expires = jiffies;
493+ continue;
494+ }
495+
473496 /* Check the deviation from the watchdog clocksource. */
474497 md = cs->uncertainty_margin + watchdog->uncertainty_margin;
475498 if (abs(cs_nsec - wd_nsec) > md) {
kernel/time/tick-sched.c+5−0
@@ -1577,6 +1577,7 @@ void tick_cancel_sched_timer(int cpu) · 1576 unmodified lines
15771577 {
15781578 struct tick_sched *ts = &per_cpu(tick_cpu_sched, cpu);
15791579 ktime_t idle_sleeptime, iowait_sleeptime;
1580+ unsigned long idle_calls, idle_sleeps;
15801581
15811582 # ifdef CONFIG_HIGH_RES_TIMERS
15821583 if (ts->sched_timer.base)
@@ -1585,9 +1586,13 @@ void tick_cancel_sched_timer(int cpu) · 2 unmodified lines
15851586
15861587 idle_sleeptime = ts->idle_sleeptime;
15871588 iowait_sleeptime = ts->iowait_sleeptime;
1589+ idle_calls = ts->idle_calls;
1590+ idle_sleeps = ts->idle_sleeps;
15881591 memset(ts, 0, sizeof(*ts));
15891592 ts->idle_sleeptime = idle_sleeptime;
15901593 ts->iowait_sleeptime = iowait_sleeptime;
1594+ ts->idle_calls = idle_calls;
1595+ ts->idle_sleeps = idle_sleeps;
15911596 }
15921597 #endif
15931598
kernel/trace/trace_events_trigger.c+4−2
@@ -1470,8 +1470,10 @@ register_snapshot_trigger(char *glob, · 1469 unmodified lines
14701470 struct event_trigger_data *data,
14711471 struct trace_event_file *file)
14721472 {
1473− if (tracing_alloc_snapshot_instance(file->tr) != 0)
1474− return 0;
1473+ int ret = tracing_alloc_snapshot_instance(file->tr);
1474+
1475+ if (ret < 0)
1476+ return ret;
14751477
14761478 return register_trigger(glob, data, file);
14771479 }
lib/kunit/device.c+2−2
@@ -45,8 +45,8 @@ int kunit_bus_init(void) · 44 unmodified lines
4545 int error;
4646
4747 kunit_bus_device = root_device_register("kunit");
48− if (!kunit_bus_device)
49− return -ENOMEM;
48+ if (IS_ERR(kunit_bus_device))
49+ return PTR_ERR(kunit_bus_device);
5050
5151 error = bus_register(&kunit_bus_type);
5252 if (error)
lib/kunit/executor.c+4−0
@@ -146,6 +146,10 @@ void kunit_free_suite_set(struct kunit_suite_set suite_set) · 145 unmodified lines
146146 kfree(suite_set.start);
147147 }
148148
149+/*
150+ * Filter and reallocate test suites. Must return the filtered test suites set
151+ * allocated at a valid virtual address or NULL in case of error.
152+ */
149153 struct kunit_suite_set
150154 kunit_filter_suites(const struct kunit_suite_set *suite_set,
151155 const char *filter_glob,
lib/kunit/kunit-test.c+1−1
@@ -720,7 +720,7 @@ static void kunit_device_cleanup_test(struct kunit *test) · 719 unmodified lines
720720 long action_was_run = 0;
721721
722722 test_device = kunit_device_register(test, "my_device");
723− KUNIT_ASSERT_NOT_NULL(test, test_device);
723+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, test_device);
724724
725725 /* Add an action to verify cleanup. */
726726 devm_add_action(test_device, test_dev_action, &action_was_run);
lib/kunit/test.c+11−3
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/panic.h>
1818 #include <linux/sched/debug.h>
1919 #include <linux/sched.h>
20+#include <linux/mm.h>
2021
2122 #include "debugfs.h"
2223 #include "device-impl.h"
@@ -801,12 +802,19 @@ static void kunit_module_exit(struct module *mod) · 778 unmodified lines
801802 };
802803 const char *action = kunit_action();
803804
805+ /*
806+ * Check if the start address is a valid virtual address to detect
807+ * if the module load sequence has failed and the suite set has not
808+ * been initialized and filtered.
809+ */
810+ if (!suite_set.start || !virt_addr_valid(suite_set.start))
811+ return;
812+
804813 if (!action)
805814 __kunit_test_suites_exit(mod->kunit_suites,
806815 mod->num_kunit_suites);
807816
808− if (suite_set.start)
809− kunit_free_suite_set(suite_set);
817+ kunit_free_suite_set(suite_set);
810818 }
811819
812820 static int kunit_module_notify(struct notifier_block *nb, unsigned long val,
@@ -816,12 +824,12 @@ static int kunit_module_notify(struct notifier_block *nb, unsigned long val, · 3 unmodified lines
816824
817825 switch (val) {
818826 case MODULE_STATE_LIVE:
827+ kunit_module_init(mod);
819828 break;
820829 case MODULE_STATE_GOING:
821830 kunit_module_exit(mod);
822831 break;
823832 case MODULE_STATE_COMING:
824− kunit_module_init(mod);
825833 break;
826834 case MODULE_STATE_UNFORMED:
827835 break;
lib/stackdepot.c+263−110
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 #define pr_fmt(fmt) "stackdepot: " fmt
1616
17+#include <linux/debugfs.h>
1718 #include <linux/gfp.h>
1819 #include <linux/jhash.h>
1920 #include <linux/kernel.h>
@@ -21,8 +22,9 @@ · 1 unmodified line
2122 #include <linux/list.h>
2223 #include <linux/mm.h>
2324 #include <linux/mutex.h>
24−#include <linux/percpu.h>
2525 #include <linux/printk.h>
26+#include <linux/rculist.h>
27+#include <linux/rcupdate.h>
2628 #include <linux/refcount.h>
2729 #include <linux/slab.h>
2830 #include <linux/spinlock.h>
@@ -67,12 +69,28 @@ union handle_parts { · 38 unmodified lines
6769 };
6870
6971 struct stack_record {
70− struct list_head list; /* Links in hash table or freelist */
72+ struct list_head hash_list; /* Links in the hash table */
7173 u32 hash; /* Hash in hash table */
7274 u32 size; /* Number of stored frames */
73− union handle_parts handle;
75+ union handle_parts handle; /* Constant after initialization */
7476 refcount_t count;
75− unsigned long entries[CONFIG_STACKDEPOT_MAX_FRAMES]; /* Frames */
77+ union {
78+ unsigned long entries[CONFIG_STACKDEPOT_MAX_FRAMES]; /* Frames */
79+ struct {
80+ /*
81+ * An important invariant of the implementation is to
82+ * only place a stack record onto the freelist iff its
83+ * refcount is zero. Because stack records with a zero
84+ * refcount are never considered as valid, it is safe to
85+ * union @entries and freelist management state below.
86+ * Conversely, as soon as an entry is off the freelist
87+ * and its refcount becomes non-zero, the below must not
88+ * be accessed until being placed back on the freelist.
89+ */
90+ struct list_head free_list; /* Links in the freelist */
91+ unsigned long rcu_state; /* RCU cookie */
92+ };
93+ };
7694 };
7795
7896 #define DEPOT_STACK_RECORD_SIZE \
@@ -112,8 +130,25 @@ static LIST_HEAD(free_stacks); · 33 unmodified lines
112130 * yet allocated or if the limit on the number of pools is reached.
113131 */
114132 static bool new_pool_required = true;
115−/* Lock that protects the variables above. */
116−static DEFINE_RWLOCK(pool_rwlock);
133+/* The lock must be held when performing pool or freelist modifications. */
134+static DEFINE_RAW_SPINLOCK(pool_lock);
135+
136+/* Statistics counters for debugfs. */
137+enum depot_counter_id {
138+ DEPOT_COUNTER_ALLOCS,
139+ DEPOT_COUNTER_FREES,
140+ DEPOT_COUNTER_INUSE,
141+ DEPOT_COUNTER_FREELIST_SIZE,
142+ DEPOT_COUNTER_COUNT,
143+};
144+static long counters[DEPOT_COUNTER_COUNT];
145+static const char *const counter_names[] = {
146+ [DEPOT_COUNTER_ALLOCS] = "allocations",
147+ [DEPOT_COUNTER_FREES] = "frees",
148+ [DEPOT_COUNTER_INUSE] = "in_use",
149+ [DEPOT_COUNTER_FREELIST_SIZE] = "freelist_size",
150+};
151+static_assert(ARRAY_SIZE(counter_names) == DEPOT_COUNTER_COUNT);
117152
118153 static int __init disable_stack_depot(char *str)
119154 {
@@ -258,14 +293,15 @@ out_unlock: · 138 unmodified lines
258293 }
259294 EXPORT_SYMBOL_GPL(stack_depot_init);
260295
261−/* Initializes a stack depol pool. */
296+/*
297+ * Initializes new stack depot @pool, release all its entries to the freelist,
298+ * and update the list of pools.
299+ */
262300 static void depot_init_pool(void *pool)
263301 {
264302 int offset;
265303
266− lockdep_assert_held_write(&pool_rwlock);
267−
268− WARN_ON(!list_empty(&free_stacks));
304+ lockdep_assert_held(&pool_lock);
269305
270306 /* Initialize handles and link stack records into the freelist. */
271307 for (offset = 0; offset <= DEPOT_POOL_SIZE - DEPOT_STACK_RECORD_SIZE;
@@ -276,18 +312,36 @@ static void depot_init_pool(void *pool) · 4 unmodified lines
276312 stack->handle.offset = offset >> DEPOT_STACK_ALIGN;
277313 stack->handle.extra = 0;
278314
279− list_add(&stack->list, &free_stacks);
315+ /*
316+ * Stack traces of size 0 are never saved, and we can simply use
317+ * the size field as an indicator if this is a new unused stack
318+ * record in the freelist.
319+ */
320+ stack->size = 0;
321+
322+ INIT_LIST_HEAD(&stack->hash_list);
323+ /*
324+ * Add to the freelist front to prioritize never-used entries:
325+ * required in case there are entries in the freelist, but their
326+ * RCU cookie still belongs to the current RCU grace period
327+ * (there can still be concurrent readers).
328+ */
329+ list_add(&stack->free_list, &free_stacks);
330+ counters[DEPOT_COUNTER_FREELIST_SIZE]++;
280331 }
281332
282333 /* Save reference to the pool to be used by depot_fetch_stack(). */
283334 stack_pools[pools_num] = pool;
284− pools_num++;
335+
336+ /* Pairs with concurrent READ_ONCE() in depot_fetch_stack(). */
337+ WRITE_ONCE(pools_num, pools_num + 1);
338+ ASSERT_EXCLUSIVE_WRITER(pools_num);
285339 }
286340
287341 /* Keeps the preallocated memory to be used for a new stack depot pool. */
288342 static void depot_keep_new_pool(void **prealloc)
289343 {
290− lockdep_assert_held_write(&pool_rwlock);
344+ lockdep_assert_held(&pool_lock);
291345
292346 /*
293347 * If a new pool is already saved or the maximum number of
@@ -310,17 +364,16 @@ static void depot_keep_new_pool(void **prealloc) · 16 unmodified lines
310364 * number of pools is reached. In either case, take note that
311365 * keeping another pool is not required.
312366 */
313− new_pool_required = false;
367+ WRITE_ONCE(new_pool_required, false);
314368 }
315369
316−/* Updates references to the current and the next stack depot pools. */
317−static bool depot_update_pools(void **prealloc)
370+/*
371+ * Try to initialize a new stack depot pool from either a previous or the
372+ * current pre-allocation, and release all its entries to the freelist.
373+ */
374+static bool depot_try_init_pool(void **prealloc)
318375 {
319− lockdep_assert_held_write(&pool_rwlock);
320−
321− /* Check if we still have objects in the freelist. */
322− if (!list_empty(&free_stacks))
323− goto out_keep_prealloc;
376+ lockdep_assert_held(&pool_lock);
324377
325378 /* Check if we have a new pool saved and use it. */
326379 if (new_pool) {
@@ -329,10 +382,9 @@ static bool depot_update_pools(void **prealloc) · 2 unmodified lines
329382
330383 /* Take note that we might need a new new_pool. */
331384 if (pools_num < DEPOT_MAX_POOLS)
332− new_pool_required = true;
385+ WRITE_ONCE(new_pool_required, true);
333386
334− /* Try keeping the preallocated memory for new_pool. */
335− goto out_keep_prealloc;
387+ return true;
336388 }
337389
338390 /* Bail out if we reached the pool limit. */
@@ -349,12 +401,32 @@ static bool depot_update_pools(void **prealloc) · 10 unmodified lines
349401 }
350402
351403 return false;
404+}
405+
406+/* Try to find next free usable entry. */
407+static struct stack_record *depot_pop_free(void)
408+{
409+ struct stack_record *stack;
410+
411+ lockdep_assert_held(&pool_lock);
412+
413+ if (list_empty(&free_stacks))
414+ return NULL;
415+
416+ /*
417+ * We maintain the invariant that the elements in front are least
418+ * recently used, and are therefore more likely to be associated with an
419+ * RCU grace period in the past. Consequently it is sufficient to only
420+ * check the first entry.
421+ */
422+ stack = list_first_entry(&free_stacks, struct stack_record, free_list);
423+ if (stack->size && !poll_state_synchronize_rcu(stack->rcu_state))
424+ return NULL;
425+
426+ list_del(&stack->free_list);
427+ counters[DEPOT_COUNTER_FREELIST_SIZE]--;
352428
353−out_keep_prealloc:
354− /* Keep the preallocated memory for a new pool if required. */
355− if (*prealloc)
356− depot_keep_new_pool(prealloc);
357− return true;
429+ return stack;
358430 }
359431
360432 /* Allocates a new stack in a stack depot pool. */
@@ -363,19 +435,22 @@ depot_alloc_stack(unsigned long *entries, int size, u32 hash, void **prealloc) · 2 unmodified lines
363435 {
364436 struct stack_record *stack;
365437
366− lockdep_assert_held_write(&pool_rwlock);
438+ lockdep_assert_held(&pool_lock);
367439
368− /* Update current and new pools if required and possible. */
369− if (!depot_update_pools(prealloc))
440+ /* This should already be checked by public API entry points. */
441+ if (WARN_ON_ONCE(!size))
370442 return NULL;
371443
372444 /* Check if we have a stack record to save the stack trace. */
373− if (list_empty(&free_stacks))
374− return NULL;
375−
376− /* Get and unlink the first entry from the freelist. */
377− stack = list_first_entry(&free_stacks, struct stack_record, list);
378− list_del(&stack->list);
445+ stack = depot_pop_free();
446+ if (!stack) {
447+ /* No usable entries on the freelist - try to refill the freelist. */
448+ if (!depot_try_init_pool(prealloc))
449+ return NULL;
450+ stack = depot_pop_free();
451+ if (WARN_ON(!stack))
452+ return NULL;
453+ }
379454
380455 /* Limit number of saved frames to CONFIG_STACKDEPOT_MAX_FRAMES. */
381456 if (size > CONFIG_STACKDEPOT_MAX_FRAMES)
@@ -394,38 +469,80 @@ depot_alloc_stack(unsigned long *entries, int size, u32 hash, void **prealloc) · 12 unmodified lines
394469 */
395470 kmsan_unpoison_memory(stack, DEPOT_STACK_RECORD_SIZE);
396471
472+ counters[DEPOT_COUNTER_ALLOCS]++;
473+ counters[DEPOT_COUNTER_INUSE]++;
397474 return stack;
398475 }
399476
400477 static struct stack_record *depot_fetch_stack(depot_stack_handle_t handle)
401478 {
479+ const int pools_num_cached = READ_ONCE(pools_num);
402480 union handle_parts parts = { .handle = handle };
403481 void *pool;
404482 size_t offset = parts.offset << DEPOT_STACK_ALIGN;
405483 struct stack_record *stack;
406484
407− lockdep_assert_held(&pool_rwlock);
485+ lockdep_assert_not_held(&pool_lock);
408486
409− if (parts.pool_index > pools_num) {
487+ if (parts.pool_index > pools_num_cached) {
410488 WARN(1, "pool index %d out of bounds (%d) for stack id %08x\n",
411− parts.pool_index, pools_num, handle);
489+ parts.pool_index, pools_num_cached, handle);
412490 return NULL;
413491 }
414492
415493 pool = stack_pools[parts.pool_index];
416− if (!pool)
494+ if (WARN_ON(!pool))
417495 return NULL;
418496
419497 stack = pool + offset;
498+ if (WARN_ON(!refcount_read(&stack->count)))
499+ return NULL;
500+
420501 return stack;
421502 }
422503
423504 /* Links stack into the freelist. */
424505 static void depot_free_stack(struct stack_record *stack)
425506 {
426− lockdep_assert_held_write(&pool_rwlock);
507+ unsigned long flags;
508+
509+ lockdep_assert_not_held(&pool_lock);
427510
428− list_add(&stack->list, &free_stacks);
511+ raw_spin_lock_irqsave(&pool_lock, flags);
512+ printk_deferred_enter();
513+
514+ /*
515+ * Remove the entry from the hash list. Concurrent list traversal may
516+ * still observe the entry, but since the refcount is zero, this entry
517+ * will no longer be considered as valid.
518+ */
519+ list_del_rcu(&stack->hash_list);
520+
521+ /*
522+ * Due to being used from constrained contexts such as the allocators,
523+ * NMI, or even RCU itself, stack depot cannot rely on primitives that
524+ * would sleep (such as synchronize_rcu()) or recursively call into
525+ * stack depot again (such as call_rcu()).
526+ *
527+ * Instead, get an RCU cookie, so that we can ensure this entry isn't
528+ * moved onto another list until the next grace period, and concurrent
529+ * RCU list traversal remains safe.
530+ */
531+ stack->rcu_state = get_state_synchronize_rcu();
532+
533+ /*
534+ * Add the entry to the freelist tail, so that older entries are
535+ * considered first - their RCU cookie is more likely to no longer be
536+ * associated with the current grace period.
537+ */
538+ list_add_tail(&stack->free_list, &free_stacks);
539+
540+ counters[DEPOT_COUNTER_FREELIST_SIZE]++;
541+ counters[DEPOT_COUNTER_FREES]++;
542+ counters[DEPOT_COUNTER_INUSE]--;
543+
544+ printk_deferred_exit();
545+ raw_spin_unlock_irqrestore(&pool_lock, flags);
429546 }
430547
431548 /* Calculates the hash for a stack. */
@@ -453,22 +570,52 @@ int stackdepot_memcmp(const unsigned long *u1, const unsigned long *u2, · 21 unmodified lines
453570
454571 /* Finds a stack in a bucket of the hash table. */
455572 static inline struct stack_record *find_stack(struct list_head *bucket,
456− unsigned long *entries, int size,
457− u32 hash)
573+ unsigned long *entries, int size,
574+ u32 hash, depot_flags_t flags)
458575 {
459− struct list_head *pos;
460− struct stack_record *found;
576+ struct stack_record *stack, *ret = NULL;
577+
578+ /*
579+ * Stack depot may be used from instrumentation that instruments RCU or
580+ * tracing itself; use variant that does not call into RCU and cannot be
581+ * traced.
582+ *
583+ * Note: Such use cases must take care when using refcounting to evict
584+ * unused entries, because the stack record free-then-reuse code paths
585+ * do call into RCU.
586+ */
587+ rcu_read_lock_sched_notrace();
461588
462− lockdep_assert_held(&pool_rwlock);
589+ list_for_each_entry_rcu(stack, bucket, hash_list) {
590+ if (stack->hash != hash || stack->size != size)
591+ continue;
592+
593+ /*
594+ * This may race with depot_free_stack() accessing the freelist
595+ * management state unioned with @entries. The refcount is zero
596+ * in that case and the below refcount_inc_not_zero() will fail.
597+ */
598+ if (data_race(stackdepot_memcmp(entries, stack->entries, size)))
599+ continue;
600+
601+ /*
602+ * Try to increment refcount. If this succeeds, the stack record
603+ * is valid and has not yet been freed.
604+ *
605+ * If STACK_DEPOT_FLAG_GET is not used, it is undefined behavior
606+ * to then call stack_depot_put() later, and we can assume that
607+ * a stack record is never placed back on the freelist.
608+ */
609+ if ((flags & STACK_DEPOT_FLAG_GET) && !refcount_inc_not_zero(&stack->count))
610+ continue;
463611
464− list_for_each(pos, bucket) {
465− found = list_entry(pos, struct stack_record, list);
466− if (found->hash == hash &&
467− found->size == size &&
468− !stackdepot_memcmp(entries, found->entries, size))
469− return found;
612+ ret = stack;
613+ break;
470614 }
471− return NULL;
615+
616+ rcu_read_unlock_sched_notrace();
617+
618+ return ret;
472619 }
473620
474621 depot_stack_handle_t stack_depot_save_flags(unsigned long *entries,
@@ -482,7 +629,6 @@ depot_stack_handle_t stack_depot_save_flags(unsigned long *entries, · 7 unmodified lines
482629 struct page *page = NULL;
483630 void *prealloc = NULL;
484631 bool can_alloc = depot_flags & STACK_DEPOT_FLAG_CAN_ALLOC;
485− bool need_alloc = false;
486632 unsigned long flags;
487633 u32 hash;
488634
@@ -505,31 +651,16 @@ depot_stack_handle_t stack_depot_save_flags(unsigned long *entries, · 16 unmodified lines
505651 hash = hash_stack(entries, nr_entries);
506652 bucket = &stack_table[hash & stack_hash_mask];
507653
508− read_lock_irqsave(&pool_rwlock, flags);
509− printk_deferred_enter();
510−
511− /* Fast path: look the stack trace up without full locking. */
512− found = find_stack(bucket, entries, nr_entries, hash);
513− if (found) {
514− if (depot_flags & STACK_DEPOT_FLAG_GET)
515− refcount_inc(&found->count);
516− printk_deferred_exit();
517− read_unlock_irqrestore(&pool_rwlock, flags);
654+ /* Fast path: look the stack trace up without locking. */
655+ found = find_stack(bucket, entries, nr_entries, hash, depot_flags);
656+ if (found)
518657 goto exit;
519− }
520−
521− /* Take note if another stack pool needs to be allocated. */
522− if (new_pool_required)
523− need_alloc = true;
524−
525− printk_deferred_exit();
526− read_unlock_irqrestore(&pool_rwlock, flags);
527658
528659 /*
529660 * Allocate memory for a new pool if required now:
530661 * we won't be able to do that under the lock.
531662 */
532− if (unlikely(can_alloc && need_alloc)) {
663+ if (unlikely(can_alloc && READ_ONCE(new_pool_required))) {
533664 /*
534665 * Zero out zone modifiers, as we don't have specific zone
535666 * requirements. Keep the flags related to allocation in atomic
@@ -543,31 +674,36 @@ depot_stack_handle_t stack_depot_save_flags(unsigned long *entries, · 7 unmodified lines
543674 prealloc = page_address(page);
544675 }
545676
546− write_lock_irqsave(&pool_rwlock, flags);
677+ raw_spin_lock_irqsave(&pool_lock, flags);
547678 printk_deferred_enter();
548679
549− found = find_stack(bucket, entries, nr_entries, hash);
680+ /* Try to find again, to avoid concurrently inserting duplicates. */
681+ found = find_stack(bucket, entries, nr_entries, hash, depot_flags);
550682 if (!found) {
551683 struct stack_record *new =
552684 depot_alloc_stack(entries, nr_entries, hash, &prealloc);
553685
554686 if (new) {
555− list_add(&new->list, bucket);
687+ /*
688+ * This releases the stack record into the bucket and
689+ * makes it visible to readers in find_stack().
690+ */
691+ list_add_rcu(&new->hash_list, bucket);
556692 found = new;
557693 }
558− } else {
559− if (depot_flags & STACK_DEPOT_FLAG_GET)
560− refcount_inc(&found->count);
694+ }
695+
696+ if (prealloc) {
561697 /*
562− * Stack depot already contains this stack trace, but let's
563− * keep the preallocated memory for future.
698+ * Either stack depot already contains this stack trace, or
699+ * depot_alloc_stack() did not consume the preallocated memory.
700+ * Try to keep the preallocated memory for future.
564701 */
565− if (prealloc)
566− depot_keep_new_pool(&prealloc);
702+ depot_keep_new_pool(&prealloc);
567703 }
568704
569705 printk_deferred_exit();
570− write_unlock_irqrestore(&pool_rwlock, flags);
706+ raw_spin_unlock_irqrestore(&pool_lock, flags);
571707 exit:
572708 if (prealloc) {
573709 /* Stack depot didn't use this memory, free it. */
@@ -592,7 +728,6 @@ unsigned int stack_depot_fetch(depot_stack_handle_t handle, · 18 unmodified lines
592728 unsigned long **entries)
593729 {
594730 struct stack_record *stack;
595− unsigned long flags;
596731
597732 *entries = NULL;
598733 /*
@@ -604,13 +739,13 @@ unsigned int stack_depot_fetch(depot_stack_handle_t handle, · 5 unmodified lines
604739 if (!handle || stack_depot_disabled)
605740 return 0;
606741
607− read_lock_irqsave(&pool_rwlock, flags);
608− printk_deferred_enter();
609−
610742 stack = depot_fetch_stack(handle);
611−
612− printk_deferred_exit();
613− read_unlock_irqrestore(&pool_rwlock, flags);
743+ /*
744+ * Should never be NULL, otherwise this is a use-after-put (or just a
745+ * corrupt handle).
746+ */
747+ if (WARN(!stack, "corrupt handle or use after stack_depot_put()"))
748+ return 0;
614749
615750 *entries = stack->entries;
616751 return stack->size;
@@ -620,29 +755,20 @@ EXPORT_SYMBOL_GPL(stack_depot_fetch); · 3 unmodified lines
620755 void stack_depot_put(depot_stack_handle_t handle)
621756 {
622757 struct stack_record *stack;
623− unsigned long flags;
624758
625759 if (!handle || stack_depot_disabled)
626760 return;
627761
628− write_lock_irqsave(&pool_rwlock, flags);
629− printk_deferred_enter();
630−
631762 stack = depot_fetch_stack(handle);
632− if (WARN_ON(!stack))
633− goto out;
634−
635− if (refcount_dec_and_test(&stack->count)) {
636− /* Unlink stack from the hash table. */
637− list_del(&stack->list);
763+ /*
764+ * Should always be able to find the stack record, otherwise this is an
765+ * unbalanced put attempt (or corrupt handle).
766+ */
767+ if (WARN(!stack, "corrupt handle or unbalanced stack_depot_put()"))
768+ return;
638769
639− /* Free stack. */
770+ if (refcount_dec_and_test(&stack->count))
640771 depot_free_stack(stack);
641− }
642−
643−out:
644− printk_deferred_exit();
645− write_unlock_irqrestore(&pool_rwlock, flags);
646772 }
647773 EXPORT_SYMBOL_GPL(stack_depot_put);
648774
@@ -690,3 +816,30 @@ unsigned int stack_depot_get_extra_bits(depot_stack_handle_t handle) · 41 unmodified lines
690816 return parts.extra;
691817 }
692818 EXPORT_SYMBOL(stack_depot_get_extra_bits);
819+
820+static int stats_show(struct seq_file *seq, void *v)
821+{
822+ /*
823+ * data race ok: These are just statistics counters, and approximate
824+ * statistics are ok for debugging.
825+ */
826+ seq_printf(seq, "pools: %d\n", data_race(pools_num));
827+ for (int i = 0; i < DEPOT_COUNTER_COUNT; i++)
828+ seq_printf(seq, "%s: %ld\n", counter_names[i], data_race(counters[i]));
829+
830+ return 0;
831+}
832+DEFINE_SHOW_ATTRIBUTE(stats);
833+
834+static int depot_debugfs_init(void)
835+{
836+ struct dentry *dir;
837+
838+ if (stack_depot_disabled)
839+ return 0;
840+
841+ dir = debugfs_create_dir("stackdepot", NULL);
842+ debugfs_create_file("stats", 0444, dir, NULL, &stats_fops);
843+ return 0;
844+}
845+late_initcall(depot_debugfs_init);
mm/huge_memory.c+14−4
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include <linux/page_owner.h>
3838 #include <linux/sched/sysctl.h>
3939 #include <linux/memory-tiers.h>
40+#include <linux/compat.h>
4041
4142 #include <asm/tlb.h>
4243 #include <asm/pgalloc.h>
@@ -809,7 +810,10 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, · 766 unmodified lines
809810 {
810811 loff_t off_end = off + len;
811812 loff_t off_align = round_up(off, size);
812− unsigned long len_pad, ret;
813+ unsigned long len_pad, ret, off_sub;
814+
815+ if (IS_ENABLED(CONFIG_32BIT) || in_compat_syscall())
816+ return 0;
813817
814818 if (off_end <= off_align || (off_end - off_align) < size)
815819 return 0;
@@ -835,7 +839,13 @@ static unsigned long __thp_get_unmapped_area(struct file *filp, · 19 unmodified lines
835839 if (ret == addr)
836840 return addr;
837841
838− ret += (off - ret) & (size - 1);
842+ off_sub = (off - ret) & (size - 1);
843+
844+ if (current->mm->get_unmapped_area == arch_get_unmapped_area_topdown &&
845+ !off_sub)
846+ return ret + size;
847+
848+ ret += off_sub;
839849 return ret;
840850 }
841851
@@ -2437,7 +2447,7 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, · 1595 unmodified lines
24372447 page = pmd_page(old_pmd);
24382448 folio = page_folio(page);
24392449 if (!folio_test_dirty(folio) && pmd_dirty(old_pmd))
2440− folio_set_dirty(folio);
2450+ folio_mark_dirty(folio);
24412451 if (!folio_test_referenced(folio) && pmd_young(old_pmd))
24422452 folio_set_referenced(folio);
24432453 folio_remove_rmap_pmd(folio, page, vma);
@@ -3563,7 +3573,7 @@ int set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw, · 1119 unmodified lines
35633573 }
35643574
35653575 if (pmd_dirty(pmdval))
3566− folio_set_dirty(folio);
3576+ folio_mark_dirty(folio);
35673577 if (pmd_write(pmdval))
35683578 entry = make_writable_migration_entry(page_to_pfn(page));
35693579 else if (anon_exclusive)
mm/memblock.c+3−0
@@ -2176,6 +2176,9 @@ static void __init memmap_init_reserved_pages(void) · 2175 unmodified lines
21762176 start = region->base;
21772177 end = start + region->size;
21782178
2179+ if (nid == NUMA_NO_NODE || nid >= MAX_NUMNODES)
2180+ nid = early_pfn_to_nid(PFN_DOWN(start));
2181+
21792182 reserve_bootmem_region(start, end, nid);
21802183 }
21812184 }
mm/memcontrol.c+25−4
@@ -2623,8 +2623,9 @@ static unsigned long calculate_high_delay(struct mem_cgroup *memcg, · 2622 unmodified lines
26232623 }
26242624
26252625 /*
2626− * Scheduled by try_charge() to be executed from the userland return path
2627− * and reclaims memory over the high limit.
2626+ * Reclaims memory over the high limit. Called directly from
2627+ * try_charge() (context permitting), as well as from the userland
2628+ * return path where reclaim is always able to block.
26282629 */
26292630 void mem_cgroup_handle_over_high(gfp_t gfp_mask)
26302631 {
@@ -2643,6 +2644,17 @@ void mem_cgroup_handle_over_high(gfp_t gfp_mask) · 12 unmodified lines
26432644 current->memcg_nr_pages_over_high = 0;
26442645
26452646 retry_reclaim:
2647+ /*
2648+ * Bail if the task is already exiting. Unlike memory.max,
2649+ * memory.high enforcement isn't as strict, and there is no
2650+ * OOM killer involved, which means the excess could already
2651+ * be much bigger (and still growing) than it could for
2652+ * memory.max; the dying task could get stuck in fruitless
2653+ * reclaim for a long time, which isn't desirable.
2654+ */
2655+ if (task_is_dying())
2656+ goto out;
2657+
26462658 /*
26472659 * The allocating task should reclaim at least the batch size, but for
26482660 * subsequent retries we only want to do what's necessary to prevent oom
@@ -2693,6 +2705,9 @@ retry_reclaim: · 44 unmodified lines
26932705 }
26942706
26952707 /*
2708+ * Reclaim didn't manage to push usage below the limit, slow
2709+ * this allocating task down.
2710+ *
26962711 * If we exit early, we're guaranteed to die (since
26972712 * schedule_timeout_killable sets TASK_KILLABLE). This means we don't
26982713 * need to account for any ill-begotten jiffies to pay them off later.
@@ -2887,11 +2902,17 @@ done_restock: · 188 unmodified lines
28872902 }
28882903 } while ((memcg = parent_mem_cgroup(memcg)));
28892904
2905+ /*
2906+ * Reclaim is set up above to be called from the userland
2907+ * return path. But also attempt synchronous reclaim to avoid
2908+ * excessive overrun while the task is still inside the
2909+ * kernel. If this is successful, the return path will see it
2910+ * when it rechecks the overage and simply bail out.
2911+ */
28902912 if (current->memcg_nr_pages_over_high > MEMCG_CHARGE_BATCH &&
28912913 !(current->flags & PF_MEMALLOC) &&
2892− gfpflags_allow_blocking(gfp_mask)) {
2914+ gfpflags_allow_blocking(gfp_mask))
28932915 mem_cgroup_handle_over_high(gfp_mask);
2894− }
28952916 return 0;
28962917 }
28972918
mm/memory-failure.c+1−1
@@ -982,7 +982,7 @@ static bool has_extra_refcount(struct page_state *ps, struct page *p, · 981 unmodified lines
982982 int count = page_count(p) - 1;
983983
984984 if (extra_pins)
985− count -= 1;
985+ count -= folio_nr_pages(page_folio(p));
986986
987987 if (count > 0) {
988988 pr_err("%#lx: %s still referenced by %d users\n",
mm/memory.c+1−1
@@ -1464,7 +1464,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb, · 1463 unmodified lines
14641464 delay_rmap = 0;
14651465 if (!folio_test_anon(folio)) {
14661466 if (pte_dirty(ptent)) {
1467− folio_set_dirty(folio);
1467+ folio_mark_dirty(folio);
14681468 if (tlb_delay_rmap(tlb)) {
14691469 delay_rmap = 1;
14701470 force_flush = 1;
mm/mmap.c+4−2
@@ -1825,15 +1825,17 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, · 1824 unmodified lines
18251825 /*
18261826 * mmap_region() will call shmem_zero_setup() to create a file,
18271827 * so use shmem's get_unmapped_area in case it can be huge.
1828− * do_mmap() will clear pgoff, so match alignment.
18291828 */
1830− pgoff = 0;
18311829 get_area = shmem_get_unmapped_area;
18321830 } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
18331831 /* Ensures that larger anonymous mappings are THP aligned. */
18341832 get_area = thp_get_unmapped_area;
18351833 }
18361834
1835+ /* Always treat pgoff as zero for anonymous memory. */
1836+ if (!file)
1837+ pgoff = 0;
1838+
18371839 addr = get_area(file, addr, len, pgoff, flags);
18381840 if (IS_ERR_VALUE(addr))
18391841 return addr;
mm/page-writeback.c+1−1
@@ -1638,7 +1638,7 @@ static inline void wb_dirty_limits(struct dirty_throttle_control *dtc) · 1637 unmodified lines
16381638 */
16391639 dtc->wb_thresh = __wb_calc_thresh(dtc);
16401640 dtc->wb_bg_thresh = dtc->thresh ?
1641− div_u64((u64)dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) : 0;
1641+ div64_u64(dtc->wb_thresh * dtc->bg_thresh, dtc->thresh) : 0;
16421642
16431643 /*
16441644 * In order to avoid the stacked BDI deadlock we need
mm/readahead.c+2−2
@@ -469,7 +469,7 @@ static inline int ra_alloc_folio(struct readahead_control *ractl, pgoff_t index, · 468 unmodified lines
469469
470470 if (!folio)
471471 return -ENOMEM;
472− mark = round_up(mark, 1UL << order);
472+ mark = round_down(mark, 1UL << order);
473473 if (index == mark)
474474 folio_set_readahead(folio);
475475 err = filemap_add_folio(ractl->mapping, folio, index, gfp);
@@ -575,7 +575,7 @@ static void ondemand_readahead(struct readahead_control *ractl, · 99 unmodified lines
575575 * It's the expected callback index, assume sequential access.
576576 * Ramp up sizes, and push forward the readahead window.
577577 */
578− expected = round_up(ra->start + ra->size - ra->async_size,
578+ expected = round_down(ra->start + ra->size - ra->async_size,
579579 1UL << order);
580580 if (index == expected || index == (ra->start + ra->size)) {
581581 ra->start += ra->size;
mm/userfaultfd.c+13−2
@@ -357,6 +357,7 @@ static __always_inline ssize_t mfill_atomic_hugetlb( · 356 unmodified lines
357357 unsigned long dst_start,
358358 unsigned long src_start,
359359 unsigned long len,
360+ atomic_t *mmap_changing,
360361 uffd_flags_t flags)
361362 {
362363 struct mm_struct *dst_mm = dst_vma->vm_mm;
@@ -472,6 +473,15 @@ retry: · 109 unmodified lines
472473 goto out;
473474 }
474475 mmap_read_lock(dst_mm);
476+ /*
477+ * If memory mappings are changing because of non-cooperative
478+ * operation (e.g. mremap) running in parallel, bail out and
479+ * request the user to retry later
480+ */
481+ if (mmap_changing && atomic_read(mmap_changing)) {
482+ err = -EAGAIN;
483+ break;
484+ }
475485
476486 dst_vma = NULL;
477487 goto retry;
@@ -506,6 +516,7 @@ extern ssize_t mfill_atomic_hugetlb(struct vm_area_struct *dst_vma, · 28 unmodified lines
506516 unsigned long dst_start,
507517 unsigned long src_start,
508518 unsigned long len,
519+ atomic_t *mmap_changing,
509520 uffd_flags_t flags);
510521 #endif /* CONFIG_HUGETLB_PAGE */
511522
@@ -622,8 +633,8 @@ retry: · 110 unmodified lines
622633 * If this is a HUGETLB vma, pass off to appropriate routine
623634 */
624635 if (is_vm_hugetlb_page(dst_vma))
625− return mfill_atomic_hugetlb(dst_vma, dst_start,
626− src_start, len, flags);
636+ return mfill_atomic_hugetlb(dst_vma, dst_start, src_start,
637+ len, mmap_changing, flags);
627638
628639 if (!vma_is_anonymous(dst_vma) && !vma_is_shmem(dst_vma))
629640 goto out_unlock;
net/batman-adv/multicast.c+3−0
@@ -2175,6 +2175,7 @@ void batadv_mcast_free(struct batadv_priv *bat_priv) · 2174 unmodified lines
21752175 cancel_delayed_work_sync(&bat_priv->mcast.work);
21762176
21772177 batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
2178+ batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST_TRACKER, 1);
21782179 batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
21792180
21802181 /* safely calling outside of worker, as worker was canceled above */
@@ -2198,6 +2199,8 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig) · 17 unmodified lines
21982199 BATADV_MCAST_WANT_NO_RTR4);
21992200 batadv_mcast_want_rtr6_update(bat_priv, orig,
22002201 BATADV_MCAST_WANT_NO_RTR6);
2202+ batadv_mcast_have_mc_ptype_update(bat_priv, orig,
2203+ BATADV_MCAST_HAVE_MC_PTYPE_CAPA);
22012204
22022205 spin_unlock_bh(&orig->mcast_handler_lock);
22032206 }
net/bridge/br_multicast.c+15−5
@@ -1762,6 +1762,10 @@ static void br_ip6_multicast_querier_expired(struct timer_list *t) · 1761 unmodified lines
17621762 }
17631763 #endif
17641764
1765+static void br_multicast_query_delay_expired(struct timer_list *t)
1766+{
1767+}
1768+
17651769 static void br_multicast_select_own_querier(struct net_bridge_mcast *brmctx,
17661770 struct br_ip *ip,
17671771 struct sk_buff *skb)
@@ -3198,7 +3202,7 @@ br_multicast_update_query_timer(struct net_bridge_mcast *brmctx, · 1430 unmodified lines
31983202 unsigned long max_delay)
31993203 {
32003204 if (!timer_pending(&query->timer))
3201− query->delay_time = jiffies + max_delay;
3205+ mod_timer(&query->delay_timer, jiffies + max_delay);
32023206
32033207 mod_timer(&query->timer, jiffies + brmctx->multicast_querier_interval);
32043208 }
@@ -4041,13 +4045,11 @@ void br_multicast_ctx_init(struct net_bridge *br, · 836 unmodified lines
40414045 brmctx->multicast_querier_interval = 255 * HZ;
40424046 brmctx->multicast_membership_interval = 260 * HZ;
40434047
4044− brmctx->ip4_other_query.delay_time = 0;
40454048 brmctx->ip4_querier.port_ifidx = 0;
40464049 seqcount_spinlock_init(&brmctx->ip4_querier.seq, &br->multicast_lock);
40474050 brmctx->multicast_igmp_version = 2;
40484051 #if IS_ENABLED(CONFIG_IPV6)
40494052 brmctx->multicast_mld_version = 1;
4050− brmctx->ip6_other_query.delay_time = 0;
40514053 brmctx->ip6_querier.port_ifidx = 0;
40524054 seqcount_spinlock_init(&brmctx->ip6_querier.seq, &br->multicast_lock);
40534055 #endif
@@ -4056,6 +4058,8 @@ void br_multicast_ctx_init(struct net_bridge *br, · 2 unmodified lines
40564058 br_ip4_multicast_local_router_expired, 0);
40574059 timer_setup(&brmctx->ip4_other_query.timer,
40584060 br_ip4_multicast_querier_expired, 0);
4061+ timer_setup(&brmctx->ip4_other_query.delay_timer,
4062+ br_multicast_query_delay_expired, 0);
40594063 timer_setup(&brmctx->ip4_own_query.timer,
40604064 br_ip4_multicast_query_expired, 0);
40614065 #if IS_ENABLED(CONFIG_IPV6)
@@ -4063,6 +4067,8 @@ void br_multicast_ctx_init(struct net_bridge *br, · 1 unmodified line
40634067 br_ip6_multicast_local_router_expired, 0);
40644068 timer_setup(&brmctx->ip6_other_query.timer,
40654069 br_ip6_multicast_querier_expired, 0);
4070+ timer_setup(&brmctx->ip6_other_query.delay_timer,
4071+ br_multicast_query_delay_expired, 0);
40664072 timer_setup(&brmctx->ip6_own_query.timer,
40674073 br_ip6_multicast_query_expired, 0);
40684074 #endif
@@ -4197,10 +4203,12 @@ static void __br_multicast_stop(struct net_bridge_mcast *brmctx) · 128 unmodified lines
41974203 {
41984204 del_timer_sync(&brmctx->ip4_mc_router_timer);
41994205 del_timer_sync(&brmctx->ip4_other_query.timer);
4206+ del_timer_sync(&brmctx->ip4_other_query.delay_timer);
42004207 del_timer_sync(&brmctx->ip4_own_query.timer);
42014208 #if IS_ENABLED(CONFIG_IPV6)
42024209 del_timer_sync(&brmctx->ip6_mc_router_timer);
42034210 del_timer_sync(&brmctx->ip6_other_query.timer);
4211+ del_timer_sync(&brmctx->ip6_other_query.delay_timer);
42044212 del_timer_sync(&brmctx->ip6_own_query.timer);
42054213 #endif
42064214 }
@@ -4643,13 +4651,15 @@ int br_multicast_set_querier(struct net_bridge_mcast *brmctx, unsigned long val) · 436 unmodified lines
46434651 max_delay = brmctx->multicast_query_response_interval;
46444652
46454653 if (!timer_pending(&brmctx->ip4_other_query.timer))
4646− brmctx->ip4_other_query.delay_time = jiffies + max_delay;
4654+ mod_timer(&brmctx->ip4_other_query.delay_timer,
4655+ jiffies + max_delay);
46474656
46484657 br_multicast_start_querier(brmctx, &brmctx->ip4_own_query);
46494658
46504659 #if IS_ENABLED(CONFIG_IPV6)
46514660 if (!timer_pending(&brmctx->ip6_other_query.timer))
4652− brmctx->ip6_other_query.delay_time = jiffies + max_delay;
4661+ mod_timer(&brmctx->ip6_other_query.delay_timer,
4662+ jiffies + max_delay);
46534663
46544664 br_multicast_start_querier(brmctx, &brmctx->ip6_own_query);
46554665 #endif
net/bridge/br_private.h+2−2
@@ -78,7 +78,7 @@ struct bridge_mcast_own_query { · 77 unmodified lines
7878 /* other querier */
7979 struct bridge_mcast_other_query {
8080 struct timer_list timer;
81− unsigned long delay_time;
81+ struct timer_list delay_timer;
8282 };
8383
8484 /* selected querier */
@@ -1159,7 +1159,7 @@ __br_multicast_querier_exists(struct net_bridge_mcast *brmctx, · 1074 unmodified lines
11591159 own_querier_enabled = false;
11601160 }
11611161
1162− return time_is_before_jiffies(querier->delay_time) &&
1162+ return !timer_pending(&querier->delay_timer) &&
11631163 (own_querier_enabled || timer_pending(&querier->timer));
11641164 }
11651165
net/devlink/port.c+1−1
@@ -674,7 +674,7 @@ static int devlink_port_function_validate(struct devlink_port *devlink_port, · 673 unmodified lines
674674 return -EOPNOTSUPP;
675675 }
676676 if (tb[DEVLINK_PORT_FN_ATTR_STATE] && !ops->port_fn_state_set) {
677− NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FUNCTION_ATTR_HW_ADDR],
677+ NL_SET_ERR_MSG_ATTR(extack, tb[DEVLINK_PORT_FN_ATTR_STATE],
678678 "Function does not support state setting");
679679 return -EOPNOTSUPP;
680680 }
net/hsr/hsr_device.c+2−2
@@ -308,7 +308,7 @@ static void send_hsr_supervision_frame(struct hsr_port *master, · 307 unmodified lines
308308
309309 skb = hsr_init_skb(master);
310310 if (!skb) {
311− WARN_ONCE(1, "HSR: Could not send supervision frame\n");
311+ netdev_warn_once(master->dev, "HSR: Could not send supervision frame\n");
312312 return;
313313 }
314314
@@ -355,7 +355,7 @@ static void send_prp_supervision_frame(struct hsr_port *master, · 40 unmodified lines
355355
356356 skb = hsr_init_skb(master);
357357 if (!skb) {
358− WARN_ONCE(1, "PRP: Could not send supervision frame\n");
358+ netdev_warn_once(master->dev, "PRP: Could not send supervision frame\n");
359359 return;
360360 }
361361
net/ipv4/ip_output.c+6−6
@@ -1287,6 +1287,12 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, · 1286 unmodified lines
12871287 if (unlikely(!rt))
12881288 return -EFAULT;
12891289
1290+ cork->fragsize = ip_sk_use_pmtu(sk) ?
1291+ dst_mtu(&rt->dst) : READ_ONCE(rt->dst.dev->mtu);
1292+
1293+ if (!inetdev_valid_mtu(cork->fragsize))
1294+ return -ENETUNREACH;
1295+
12901296 /*
12911297 * setup for corking.
12921298 */
@@ -1303,12 +1309,6 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, · 10 unmodified lines
13031309 cork->addr = ipc->addr;
13041310 }
13051311
1306− cork->fragsize = ip_sk_use_pmtu(sk) ?
1307− dst_mtu(&rt->dst) : READ_ONCE(rt->dst.dev->mtu);
1308−
1309− if (!inetdev_valid_mtu(cork->fragsize))
1310− return -ENETUNREACH;
1311−
13121312 cork->gso_size = ipc->gso_size;
13131313
13141314 cork->dst = &rt->dst;
net/ipv4/ip_sockglue.c+4−2
@@ -1363,12 +1363,13 @@ e_inval: · 1362 unmodified lines
13631363 * ipv4_pktinfo_prepare - transfer some info from rtable to skb
13641364 * @sk: socket
13651365 * @skb: buffer
1366+ * @drop_dst: if true, drops skb dst
13661367 *
13671368 * To support IP_CMSG_PKTINFO option, we store rt_iif and specific
13681369 * destination in skb->cb[] before dst drop.
13691370 * This way, receiver doesn't make cache line misses to read rtable.
13701371 */
1371−void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb)
1372+void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb, bool drop_dst)
13721373 {
13731374 struct in_pktinfo *pktinfo = PKTINFO_SKB_CB(skb);
13741375 bool prepare = inet_test_bit(PKTINFO, sk) ||
@@ -1397,7 +1398,8 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) · 22 unmodified lines
13971398 pktinfo->ipi_ifindex = 0;
13981399 pktinfo->ipi_spec_dst.s_addr = 0;
13991400 }
1400− skb_dst_drop(skb);
1401+ if (drop_dst)
1402+ skb_dst_drop(skb);
14011403 }
14021404
14031405 int ip_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
net/ipv4/ipmr.c+1−1
@@ -1073,7 +1073,7 @@ static int ipmr_cache_report(const struct mr_table *mrt, · 1072 unmodified lines
10731073 msg = (struct igmpmsg *)skb_network_header(skb);
10741074 msg->im_vif = vifi;
10751075 msg->im_vif_hi = vifi >> 8;
1076− ipv4_pktinfo_prepare(mroute_sk, pkt);
1076+ ipv4_pktinfo_prepare(mroute_sk, pkt, false);
10771077 memcpy(skb->cb, pkt->cb, sizeof(skb->cb));
10781078 /* Add our header */
10791079 igmp = skb_put(skb, sizeof(struct igmphdr));
net/ipv4/raw.c+1−1
@@ -292,7 +292,7 @@ static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) · 291 unmodified lines
292292
293293 /* Charge it to the socket. */
294294
295− ipv4_pktinfo_prepare(sk, skb);
295+ ipv4_pktinfo_prepare(sk, skb, true);
296296 if (sock_queue_rcv_skb_reason(sk, skb, &reason) < 0) {
297297 kfree_skb_reason(skb, reason);
298298 return NET_RX_DROP;
net/ipv4/tcp.c+11−1
@@ -1786,7 +1786,17 @@ static skb_frag_t *skb_advance_to_frag(struct sk_buff *skb, u32 offset_skb, · 1785 unmodified lines
17861786
17871787 static bool can_map_frag(const skb_frag_t *frag)
17881788 {
1789− return skb_frag_size(frag) == PAGE_SIZE && !skb_frag_off(frag);
1789+ struct page *page;
1790+
1791+ if (skb_frag_size(frag) != PAGE_SIZE || skb_frag_off(frag))
1792+ return false;
1793+
1794+ page = skb_frag_page(frag);
1795+
1796+ if (PageCompound(page) || page->mapping)
1797+ return false;
1798+
1799+ return true;
17901800 }
17911801
17921802 static int find_next_mappable_frag(const skb_frag_t *frag,
net/ipv4/udp.c+1−1
@@ -2169,7 +2169,7 @@ static int udp_queue_rcv_one_skb(struct sock *sk, struct sk_buff *skb) · 2168 unmodified lines
21692169
21702170 udp_csum_pull_header(skb);
21712171
2172− ipv4_pktinfo_prepare(sk, skb);
2172+ ipv4_pktinfo_prepare(sk, skb, true);
21732173 return __udp_queue_rcv_skb(sk, skb);
21742174
21752175 csum_error:
net/ipv6/addrconf_core.c+14−7
@@ -220,19 +220,26 @@ const struct ipv6_stub *ipv6_stub __read_mostly = &(struct ipv6_stub) { · 219 unmodified lines
220220 EXPORT_SYMBOL_GPL(ipv6_stub);
221221
222222 /* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
223−const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
223+const struct in6_addr in6addr_loopback __aligned(BITS_PER_LONG/8)
224+ = IN6ADDR_LOOPBACK_INIT;
224225 EXPORT_SYMBOL(in6addr_loopback);
225−const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
226+const struct in6_addr in6addr_any __aligned(BITS_PER_LONG/8)
227+ = IN6ADDR_ANY_INIT;
226228 EXPORT_SYMBOL(in6addr_any);
227−const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
229+const struct in6_addr in6addr_linklocal_allnodes __aligned(BITS_PER_LONG/8)
230+ = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
228231 EXPORT_SYMBOL(in6addr_linklocal_allnodes);
229−const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
232+const struct in6_addr in6addr_linklocal_allrouters __aligned(BITS_PER_LONG/8)
233+ = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
230234 EXPORT_SYMBOL(in6addr_linklocal_allrouters);
231−const struct in6_addr in6addr_interfacelocal_allnodes = IN6ADDR_INTERFACELOCAL_ALLNODES_INIT;
235+const struct in6_addr in6addr_interfacelocal_allnodes __aligned(BITS_PER_LONG/8)
236+ = IN6ADDR_INTERFACELOCAL_ALLNODES_INIT;
232237 EXPORT_SYMBOL(in6addr_interfacelocal_allnodes);
233−const struct in6_addr in6addr_interfacelocal_allrouters = IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT;
238+const struct in6_addr in6addr_interfacelocal_allrouters __aligned(BITS_PER_LONG/8)
239+ = IN6ADDR_INTERFACELOCAL_ALLROUTERS_INIT;
234240 EXPORT_SYMBOL(in6addr_interfacelocal_allrouters);
235−const struct in6_addr in6addr_sitelocal_allrouters = IN6ADDR_SITELOCAL_ALLROUTERS_INIT;
241+const struct in6_addr in6addr_sitelocal_allrouters __aligned(BITS_PER_LONG/8)
242+ = IN6ADDR_SITELOCAL_ALLROUTERS_INIT;
236243 EXPORT_SYMBOL(in6addr_sitelocal_allrouters);
237244
238245 static void snmp6_free_dev(struct inet6_dev *idev)
net/ipv6/ip6_tunnel.c+18−3
@@ -796,8 +796,8 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 795 unmodified lines
796796 struct sk_buff *skb),
797797 bool log_ecn_err)
798798 {
799− const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
800− int err;
799+ const struct ipv6hdr *ipv6h;
800+ int nh, err;
801801
802802 if ((!(tpi->flags & TUNNEL_CSUM) &&
803803 (tunnel->parms.i_flags & TUNNEL_CSUM)) ||
@@ -829,7 +829,6 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 25 unmodified lines
829829 goto drop;
830830 }
831831
832− ipv6h = ipv6_hdr(skb);
833832 skb->protocol = eth_type_trans(skb, tunnel->dev);
834833 skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
835834 } else {
@@ -837,7 +836,23 @@ static int __ip6_tnl_rcv(struct ip6_tnl *tunnel, struct sk_buff *skb, · 1 unmodified line
837836 skb_reset_mac_header(skb);
838837 }
839838
839+ /* Save offset of outer header relative to skb->head,
840+ * because we are going to reset the network header to the inner header
841+ * and might change skb->head.
842+ */
843+ nh = skb_network_header(skb) - skb->head;
844+
840845 skb_reset_network_header(skb);
846+
847+ if (!pskb_inet_may_pull(skb)) {
848+ DEV_STATS_INC(tunnel->dev, rx_length_errors);
849+ DEV_STATS_INC(tunnel->dev, rx_errors);
850+ goto drop;
851+ }
852+
853+ /* Get the outer header. */
854+ ipv6h = (struct ipv6hdr *)(skb->head + nh);
855+
841856 memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
842857
843858 __skb_tunnel_rx(skb, tunnel->dev, tunnel->net);
net/llc/af_llc.c+2−0
@@ -226,6 +226,8 @@ static int llc_ui_release(struct socket *sock) · 225 unmodified lines
226226 }
227227 netdev_put(llc->dev, &llc->dev_tracker);
228228 sock_put(sk);
229+ sock_orphan(sk);
230+ sock->sk = NULL;
229231 llc_sk_free(sk);
230232 out:
231233 return 0;
net/mptcp/protocol.c+0−3
@@ -2314,9 +2314,6 @@ bool __mptcp_retransmit_pending_data(struct sock *sk) · 2313 unmodified lines
23142314 if (__mptcp_check_fallback(msk))
23152315 return false;
23162316
2317− if (tcp_rtx_and_write_queues_empty(sk))
2318− return false;
2319−
23202317 /* the closing socket has some data untransmitted and/or unacked:
23212318 * some data in the mptcp rtx queue has not really xmitted yet.
23222319 * keep it simple and re-inject the whole mptcp level rtx queue
net/netfilter/ipset/ip_set_bitmap_gen.h+11−3
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 #define mtype_del IPSET_TOKEN(MTYPE, _del)
3131 #define mtype_list IPSET_TOKEN(MTYPE, _list)
3232 #define mtype_gc IPSET_TOKEN(MTYPE, _gc)
33+#define mtype_cancel_gc IPSET_TOKEN(MTYPE, _cancel_gc)
3334 #define mtype MTYPE
3435
3536 #define get_ext(set, map, id) ((map)->extensions + ((set)->dsize * (id)))
@@ -59,9 +60,6 @@ mtype_destroy(struct ip_set *set) · 23 unmodified lines
5960 {
6061 struct mtype *map = set->data;
6162
62− if (SET_WITH_TIMEOUT(set))
63− del_timer_sync(&map->gc);
64−
6563 if (set->dsize && set->extensions & IPSET_EXT_DESTROY)
6664 mtype_ext_cleanup(set);
6765 ip_set_free(map->members);
@@ -290,6 +288,15 @@ mtype_gc(struct timer_list *t) · 222 unmodified lines
290288 add_timer(&map->gc);
291289 }
292290
291+static void
292+mtype_cancel_gc(struct ip_set *set)
293+{
294+ struct mtype *map = set->data;
295+
296+ if (SET_WITH_TIMEOUT(set))
297+ del_timer_sync(&map->gc);
298+}
299+
293300 static const struct ip_set_type_variant mtype = {
294301 .kadt = mtype_kadt,
295302 .uadt = mtype_uadt,
@@ -303,6 +310,7 @@ static const struct ip_set_type_variant mtype = { · 7 unmodified lines
303310 .head = mtype_head,
304311 .list = mtype_list,
305312 .same_set = mtype_same_set,
313+ .cancel_gc = mtype_cancel_gc,
306314 };
307315
308316 #endif /* __IP_SET_BITMAP_IP_GEN_H */
net/netfilter/ipset/ip_set_core.c+28−9
@@ -1182,6 +1182,14 @@ ip_set_destroy_set(struct ip_set *set) · 1181 unmodified lines
11821182 kfree(set);
11831183 }
11841184
1185+static void
1186+ip_set_destroy_set_rcu(struct rcu_head *head)
1187+{
1188+ struct ip_set *set = container_of(head, struct ip_set, rcu);
1189+
1190+ ip_set_destroy_set(set);
1191+}
1192+
11851193 static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info,
11861194 const struct nlattr * const attr[])
11871195 {
@@ -1193,8 +1201,6 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 5 unmodified lines
11931201 if (unlikely(protocol_min_failed(attr)))
11941202 return -IPSET_ERR_PROTOCOL;
11951203
1196− /* Must wait for flush to be really finished in list:set */
1197− rcu_barrier();
11981204
11991205 /* Commands are serialized and references are
12001206 * protected by the ip_set_ref_lock.
@@ -1206,8 +1212,10 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 5 unmodified lines
12061212 * counter, so if it's already zero, we can proceed
12071213 * without holding the lock.
12081214 */
1209− read_lock_bh(&ip_set_ref_lock);
12101215 if (!attr[IPSET_ATTR_SETNAME]) {
1216+ /* Must wait for flush to be really finished in list:set */
1217+ rcu_barrier();
1218+ read_lock_bh(&ip_set_ref_lock);
12111219 for (i = 0; i < inst->ip_set_max; i++) {
12121220 s = ip_set(inst, i);
12131221 if (s && (s->ref || s->ref_netlink)) {
@@ -1221,6 +1229,8 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 7 unmodified lines
12211229 s = ip_set(inst, i);
12221230 if (s) {
12231231 ip_set(inst, i) = NULL;
1232+ /* Must cancel garbage collectors */
1233+ s->variant->cancel_gc(s);
12241234 ip_set_destroy_set(s);
12251235 }
12261236 }
@@ -1228,6 +1238,9 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 1 unmodified line
12281238 inst->is_destroyed = false;
12291239 } else {
12301240 u32 flags = flag_exist(info->nlh);
1241+ u16 features = 0;
1242+
1243+ read_lock_bh(&ip_set_ref_lock);
12311244 s = find_set_and_id(inst, nla_data(attr[IPSET_ATTR_SETNAME]),
12321245 &i);
12331246 if (!s) {
@@ -1238,10 +1251,16 @@ static int ip_set_destroy(struct sk_buff *skb, const struct nfnl_info *info, · 4 unmodified lines
12381251 ret = -IPSET_ERR_BUSY;
12391252 goto out;
12401253 }
1254+ features = s->type->features;
12411255 ip_set(inst, i) = NULL;
12421256 read_unlock_bh(&ip_set_ref_lock);
1243−
1244− ip_set_destroy_set(s);
1257+ if (features & IPSET_TYPE_NAME) {
1258+ /* Must wait for flush to be really finished */
1259+ rcu_barrier();
1260+ }
1261+ /* Must cancel garbage collectors */
1262+ s->variant->cancel_gc(s);
1263+ call_rcu(&s->rcu, ip_set_destroy_set_rcu);
12451264 }
12461265 return 0;
12471266 out:
@@ -1394,9 +1413,6 @@ static int ip_set_swap(struct sk_buff *skb, const struct nfnl_info *info, · 146 unmodified lines
13941413 ip_set(inst, to_id) = from;
13951414 write_unlock_bh(&ip_set_ref_lock);
13961415
1397− /* Make sure all readers of the old set pointers are completed. */
1398− synchronize_rcu();
1399−
14001416 return 0;
14011417 }
14021418
@@ -2409,8 +2425,11 @@ ip_set_fini(void) · 1006 unmodified lines
24092425 {
24102426 nf_unregister_sockopt(&so_set);
24112427 nfnetlink_subsys_unregister(&ip_set_netlink_subsys);
2412−
24132428 unregister_pernet_subsys(&ip_set_net_ops);
2429+
2430+ /* Wait for call_rcu() in destroy */
2431+ rcu_barrier();
2432+
24142433 pr_debug("these are the famous last words\n");
24152434 }
24162435
net/netfilter/ipset/ip_set_hash_gen.h+12−3
@@ -222,6 +222,7 @@ static const union nf_inet_addr zeromask = {}; · 221 unmodified lines
222222 #undef mtype_gc_do
223223 #undef mtype_gc
224224 #undef mtype_gc_init
225+#undef mtype_cancel_gc
225226 #undef mtype_variant
226227 #undef mtype_data_match
227228
@@ -266,6 +267,7 @@ static const union nf_inet_addr zeromask = {}; · 38 unmodified lines
266267 #define mtype_gc_do IPSET_TOKEN(MTYPE, _gc_do)
267268 #define mtype_gc IPSET_TOKEN(MTYPE, _gc)
268269 #define mtype_gc_init IPSET_TOKEN(MTYPE, _gc_init)
270+#define mtype_cancel_gc IPSET_TOKEN(MTYPE, _cancel_gc)
269271 #define mtype_variant IPSET_TOKEN(MTYPE, _variant)
270272 #define mtype_data_match IPSET_TOKEN(MTYPE, _data_match)
271273
@@ -450,9 +452,6 @@ mtype_destroy(struct ip_set *set) · 178 unmodified lines
450452 struct htype *h = set->data;
451453 struct list_head *l, *lt;
452454
453− if (SET_WITH_TIMEOUT(set))
454− cancel_delayed_work_sync(&h->gc.dwork);
455−
456455 mtype_ahash_destroy(set, ipset_dereference_nfnl(h->table), true);
457456 list_for_each_safe(l, lt, &h->ad) {
458457 list_del(l);
@@ -599,6 +598,15 @@ mtype_gc_init(struct htable_gc *gc) · 140 unmodified lines
599598 queue_delayed_work(system_power_efficient_wq, &gc->dwork, HZ);
600599 }
601600
601+static void
602+mtype_cancel_gc(struct ip_set *set)
603+{
604+ struct htype *h = set->data;
605+
606+ if (SET_WITH_TIMEOUT(set))
607+ cancel_delayed_work_sync(&h->gc.dwork);
608+}
609+
602610 static int
603611 mtype_add(struct ip_set *set, void *value, const struct ip_set_ext *ext,
604612 struct ip_set_ext *mext, u32 flags);
@@ -1441,6 +1449,7 @@ static const struct ip_set_type_variant mtype_variant = { · 836 unmodified lines
14411449 .uref = mtype_uref,
14421450 .resize = mtype_resize,
14431451 .same_set = mtype_same_set,
1452+ .cancel_gc = mtype_cancel_gc,
14441453 .region_lock = true,
14451454 };
14461455
net/netfilter/ipset/ip_set_list_set.c+10−3
@@ -426,9 +426,6 @@ list_set_destroy(struct ip_set *set) · 425 unmodified lines
426426 struct list_set *map = set->data;
427427 struct set_elem *e, *n;
428428
429− if (SET_WITH_TIMEOUT(set))
430− timer_shutdown_sync(&map->gc);
431−
432429 list_for_each_entry_safe(e, n, &map->members, list) {
433430 list_del(&e->list);
434431 ip_set_put_byindex(map->net, e->id);
@@ -545,6 +542,15 @@ list_set_same_set(const struct ip_set *a, const struct ip_set *b) · 110 unmodified lines
545542 a->extensions == b->extensions;
546543 }
547544
545+static void
546+list_set_cancel_gc(struct ip_set *set)
547+{
548+ struct list_set *map = set->data;
549+
550+ if (SET_WITH_TIMEOUT(set))
551+ timer_shutdown_sync(&map->gc);
552+}
553+
548554 static const struct ip_set_type_variant set_variant = {
549555 .kadt = list_set_kadt,
550556 .uadt = list_set_uadt,
@@ -558,6 +564,7 @@ static const struct ip_set_type_variant set_variant = { · 7 unmodified lines
558564 .head = list_set_head,
559565 .list = list_set_list,
560566 .same_set = list_set_same_set,
567+ .cancel_gc = list_set_cancel_gc,
561568 };
562569
563570 static void
net/netfilter/nf_conntrack_proto_sctp.c+1−1
@@ -283,7 +283,7 @@ sctp_new(struct nf_conn *ct, const struct sk_buff *skb, · 282 unmodified lines
283283 pr_debug("Setting vtag %x for secondary conntrack\n",
284284 sh->vtag);
285285 ct->proto.sctp.vtag[IP_CT_DIR_ORIGINAL] = sh->vtag;
286− } else {
286+ } else if (sch->type == SCTP_CID_SHUTDOWN_ACK) {
287287 /* If it is a shutdown ack OOTB packet, we expect a return
288288 shutdown complete, otherwise an ABORT Sec 8.4 (5) and (8) */
289289 pr_debug("Setting vtag %x for new conn OOTB\n",
net/netfilter/nf_conntrack_proto_tcp.c+6−4
@@ -457,7 +457,8 @@ static void tcp_init_sender(struct ip_ct_tcp_state *sender, · 456 unmodified lines
457457 const struct sk_buff *skb,
458458 unsigned int dataoff,
459459 const struct tcphdr *tcph,
460− u32 end, u32 win)
460+ u32 end, u32 win,
461+ enum ip_conntrack_dir dir)
461462 {
462463 /* SYN-ACK in reply to a SYN
463464 * or SYN from reply direction in simultaneous open.
@@ -471,7 +472,8 @@ static void tcp_init_sender(struct ip_ct_tcp_state *sender, · 7 unmodified lines
471472 * Both sides must send the Window Scale option
472473 * to enable window scaling in either direction.
473474 */
474− if (!(sender->flags & IP_CT_TCP_FLAG_WINDOW_SCALE &&
475+ if (dir == IP_CT_DIR_REPLY &&
476+ !(sender->flags & IP_CT_TCP_FLAG_WINDOW_SCALE &&
475477 receiver->flags & IP_CT_TCP_FLAG_WINDOW_SCALE)) {
476478 sender->td_scale = 0;
477479 receiver->td_scale = 0;
@@ -542,7 +544,7 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir, · 64 unmodified lines
542544 if (tcph->syn) {
543545 tcp_init_sender(sender, receiver,
544546 skb, dataoff, tcph,
545− end, win);
547+ end, win, dir);
546548 if (!tcph->ack)
547549 /* Simultaneous open */
548550 return NFCT_TCP_ACCEPT;
@@ -585,7 +587,7 @@ tcp_in_window(struct nf_conn *ct, enum ip_conntrack_dir dir, · 36 unmodified lines
585587 */
586588 tcp_init_sender(sender, receiver,
587589 skb, dataoff, tcph,
588− end, win);
590+ end, win, dir);
589591
590592 if (dir == IP_CT_DIR_REPLY && !tcph->ack)
591593 return NFCT_TCP_ACCEPT;
net/netfilter/nf_log.c+4−3
@@ -193,11 +193,12 @@ void nf_logger_put(int pf, enum nf_log_type type) · 192 unmodified lines
193193 return;
194194 }
195195
196− BUG_ON(loggers[pf][type] == NULL);
197−
198196 rcu_read_lock();
199197 logger = rcu_dereference(loggers[pf][type]);
200− module_put(logger->me);
198+ if (!logger)
199+ WARN_ON_ONCE(1);
200+ else
201+ module_put(logger->me);
201202 rcu_read_unlock();
202203 }
203204 EXPORT_SYMBOL_GPL(nf_logger_put);
net/netfilter/nf_tables_api.c+9−5
@@ -7558,11 +7558,15 @@ nla_put_failure: · 7557 unmodified lines
75587558 return -1;
75597559 }
75607560
7561−static const struct nft_object_type *__nft_obj_type_get(u32 objtype)
7561+static const struct nft_object_type *__nft_obj_type_get(u32 objtype, u8 family)
75627562 {
75637563 const struct nft_object_type *type;
75647564
75657565 list_for_each_entry(type, &nf_tables_objects, list) {
7566+ if (type->family != NFPROTO_UNSPEC &&
7567+ type->family != family)
7568+ continue;
7569+
75667570 if (objtype == type->type)
75677571 return type;
75687572 }
@@ -7570,11 +7574,11 @@ static const struct nft_object_type *__nft_obj_type_get(u32 objtype) · 1 unmodified line
75707574 }
75717575
75727576 static const struct nft_object_type *
7573−nft_obj_type_get(struct net *net, u32 objtype)
7577+nft_obj_type_get(struct net *net, u32 objtype, u8 family)
75747578 {
75757579 const struct nft_object_type *type;
75767580
7577− type = __nft_obj_type_get(objtype);
7581+ type = __nft_obj_type_get(objtype, family);
75787582 if (type != NULL && try_module_get(type->owner))
75797583 return type;
75807584
@@ -7667,7 +7671,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info, · 86 unmodified lines
76677671 if (info->nlh->nlmsg_flags & NLM_F_REPLACE)
76687672 return -EOPNOTSUPP;
76697673
7670− type = __nft_obj_type_get(objtype);
7674+ type = __nft_obj_type_get(objtype, family);
76717675 if (WARN_ON_ONCE(!type))
76727676 return -ENOENT;
76737677
@@ -7681,7 +7685,7 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info, · 7 unmodified lines
76817685 if (!nft_use_inc(&table->use))
76827686 return -EMFILE;
76837687
7684− type = nft_obj_type_get(net, objtype);
7688+ type = nft_obj_type_get(net, objtype, family);
76857689 if (IS_ERR(type)) {
76867690 err = PTR_ERR(type);
76877691 goto err_type;
net/netfilter/nft_ct.c+24−0
@@ -1250,7 +1250,31 @@ static int nft_ct_expect_obj_init(const struct nft_ctx *ctx, · 1249 unmodified lines
12501250 if (tb[NFTA_CT_EXPECT_L3PROTO])
12511251 priv->l3num = ntohs(nla_get_be16(tb[NFTA_CT_EXPECT_L3PROTO]));
12521252
1253+ switch (priv->l3num) {
1254+ case NFPROTO_IPV4:
1255+ case NFPROTO_IPV6:
1256+ if (priv->l3num != ctx->family)
1257+ return -EINVAL;
1258+
1259+ fallthrough;
1260+ case NFPROTO_INET:
1261+ break;
1262+ default:
1263+ return -EOPNOTSUPP;
1264+ }
1265+
12531266 priv->l4proto = nla_get_u8(tb[NFTA_CT_EXPECT_L4PROTO]);
1267+ switch (priv->l4proto) {
1268+ case IPPROTO_TCP:
1269+ case IPPROTO_UDP:
1270+ case IPPROTO_UDPLITE:
1271+ case IPPROTO_DCCP:
1272+ case IPPROTO_SCTP:
1273+ break;
1274+ default:
1275+ return -EOPNOTSUPP;
1276+ }
1277+
12541278 priv->dport = nla_get_be16(tb[NFTA_CT_EXPECT_DPORT]);
12551279 priv->timeout = nla_get_u32(tb[NFTA_CT_EXPECT_TIMEOUT]);
12561280 priv->size = nla_get_u8(tb[NFTA_CT_EXPECT_SIZE]);
net/netfilter/nft_tunnel.c+1−0
@@ -713,6 +713,7 @@ static const struct nft_object_ops nft_tunnel_obj_ops = { · 712 unmodified lines
713713
714714 static struct nft_object_type nft_tunnel_obj_type __read_mostly = {
715715 .type = NFT_OBJECT_TUNNEL,
716+ .family = NFPROTO_NETDEV,
716717 .ops = &nft_tunnel_obj_ops,
717718 .maxattr = NFTA_TUNNEL_KEY_MAX,
718719 .policy = nft_tunnel_key_policy,
net/nfc/nci/core.c+4−0
@@ -1208,6 +1208,10 @@ void nci_free_device(struct nci_dev *ndev) · 1207 unmodified lines
12081208 {
12091209 nfc_free_device(ndev->nfc_dev);
12101210 nci_hci_deallocate(ndev);
1211+
1212+ /* drop partial rx data packet if present */
1213+ if (ndev->rx_data_reassembly)
1214+ kfree_skb(ndev->rx_data_reassembly);
12111215 kfree(ndev);
12121216 }
12131217 EXPORT_SYMBOL(nci_free_device);
net/smc/smc_core.c+9−3
@@ -1877,9 +1877,15 @@ static bool smcd_lgr_match(struct smc_link_group *lgr, · 1876 unmodified lines
18771877 struct smcd_dev *smcismdev,
18781878 struct smcd_gid *peer_gid)
18791879 {
1880− return lgr->peer_gid.gid == peer_gid->gid && lgr->smcd == smcismdev &&
1881− smc_ism_is_virtual(smcismdev) ?
1882− (lgr->peer_gid.gid_ext == peer_gid->gid_ext) : 1;
1880+ if (lgr->peer_gid.gid != peer_gid->gid ||
1881+ lgr->smcd != smcismdev)
1882+ return false;
1883+
1884+ if (smc_ism_is_virtual(smcismdev) &&
1885+ lgr->peer_gid.gid_ext != peer_gid->gid_ext)
1886+ return false;
1887+
1888+ return true;
18831889 }
18841890
18851891 /* create a new SMC connection (and a new link group if necessary) */
net/sunrpc/svc.c+2−2
@@ -1598,10 +1598,10 @@ void svc_process_bc(struct rpc_rqst *req, struct svc_rqst *rqstp) · 1597 unmodified lines
15981598 /* Finally, send the reply synchronously */
15991599 if (rqstp->bc_to_initval > 0) {
16001600 timeout.to_initval = rqstp->bc_to_initval;
1601− timeout.to_retries = rqstp->bc_to_initval;
1601+ timeout.to_retries = rqstp->bc_to_retries;
16021602 } else {
16031603 timeout.to_initval = req->rq_xprt->timeout->to_initval;
1604− timeout.to_initval = req->rq_xprt->timeout->to_retries;
1604+ timeout.to_retries = req->rq_xprt->timeout->to_retries;
16051605 }
16061606 memcpy(&req->rq_snd_buf, &rqstp->rq_res, sizeof(req->rq_snd_buf));
16071607 task = rpc_run_bc_task(req, &timeout);
net/unix/af_unix.c+6−8
@@ -1342,13 +1342,11 @@ static void unix_state_double_lock(struct sock *sk1, struct sock *sk2) · 1341 unmodified lines
13421342 unix_state_lock(sk1);
13431343 return;
13441344 }
1345− if (sk1 < sk2) {
1346− unix_state_lock(sk1);
1347− unix_state_lock_nested(sk2);
1348− } else {
1349− unix_state_lock(sk2);
1350− unix_state_lock_nested(sk1);
1351− }
1345+ if (sk1 > sk2)
1346+ swap(sk1, sk2);
1347+
1348+ unix_state_lock(sk1);
1349+ unix_state_lock_nested(sk2, U_LOCK_SECOND);
13521350 }
13531351
13541352 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)
@@ -1589,7 +1587,7 @@ restart: · 234 unmodified lines
15891587 goto out_unlock;
15901588 }
15911589
1592− unix_state_lock_nested(sk);
1590+ unix_state_lock_nested(sk, U_LOCK_SECOND);
15931591
15941592 if (sk->sk_state != st) {
15951593 unix_state_unlock(sk);
net/unix/diag.c+1−1
@@ -84,7 +84,7 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb) · 83 unmodified lines
8484 * queue lock. With the other's queue locked it's
8585 * OK to lock the state.
8686 */
87− unix_state_lock_nested(req);
87+ unix_state_lock_nested(req, U_LOCK_DIAG);
8888 peer = unix_sk(req)->peer;
8989 buf[i++] = (peer ? sock_i_ino(peer) : 0);
9090 unix_state_unlock(req);
scripts/Makefile.defconf+4−4
@@ -9,8 +9,8 @@ · 8 unmodified lines
99 # Input config fragments without '.config' suffix
1010 define merge_into_defconfig
1111 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
12− -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
13− $(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
12+ -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
13+ $(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
1414 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
1515 endef
1616
@@ -23,7 +23,7 @@ endef · 6 unmodified lines
2323 # Input config fragments without '.config' suffix
2424 define merge_into_defconfig_override
2525 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
26− -Q -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
27− $(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
26+ -Q -m -O $(objtree) $(srctree)/arch/$(SRCARCH)/configs/$(1) \
27+ $(foreach config,$(2),$(srctree)/arch/$(SRCARCH)/configs/$(config).config)
2828 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
2929 endef
scripts/kconfig/symbol.c+3−1
@@ -345,6 +345,8 @@ void sym_calc_value(struct symbol *sym) · 344 unmodified lines
345345
346346 oldval = sym->curr;
347347
348+ newval.tri = no;
349+
348350 switch (sym->type) {
349351 case S_INT:
350352 newval.val = "0";
@@ -357,7 +359,7 @@ void sym_calc_value(struct symbol *sym) · 6 unmodified lines
357359 break;
358360 case S_BOOLEAN:
359361 case S_TRISTATE:
360− newval = symbol_no.curr;
362+ newval.val = "n";
361363 break;
362364 default:
363365 sym->curr.val = sym->name;
scripts/mod/modpost.c+3−12
@@ -70,9 +70,7 @@ void modpost_log(enum loglevel loglevel, const char *fmt, ...) · 69 unmodified lines
7070 break;
7171 case LOG_ERROR:
7272 fprintf(stderr, "ERROR: ");
73− break;
74− case LOG_FATAL:
75− fprintf(stderr, "FATAL: ");
73+ error_occurred = true;
7674 break;
7775 default: /* invalid loglevel, ignore */
7876 break;
@@ -83,16 +81,8 @@ void modpost_log(enum loglevel loglevel, const char *fmt, ...) · 4 unmodified lines
8381 va_start(arglist, fmt);
8482 vfprintf(stderr, fmt, arglist);
8583 va_end(arglist);
86−
87− if (loglevel == LOG_FATAL)
88− exit(1);
89− if (loglevel == LOG_ERROR)
90− error_occurred = true;
9184 }
9285
93−void __attribute__((alias("modpost_log")))
94−modpost_log_noret(enum loglevel loglevel, const char *fmt, ...);
95−
9686 static inline bool strends(const char *str, const char *postfix)
9787 {
9888 if (strlen(str) < strlen(postfix))
@@ -806,7 +796,8 @@ static void check_section(const char *modname, struct elf_info *elf, · 707 unmodified lines
806796
807797 #define DATA_SECTIONS ".data", ".data.rel"
808798 #define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \
809− ".kprobes.text", ".cpuidle.text", ".noinstr.text"
799+ ".kprobes.text", ".cpuidle.text", ".noinstr.text", \
800+ ".ltext", ".ltext.*"
810801 #define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \
811802 ".fixup", ".entry.text", ".exception.text", \
812803 ".coldtext", ".softirqentry.text"
scripts/mod/modpost.h+1−5
@@ -194,15 +194,11 @@ void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym); · 193 unmodified lines
194194 enum loglevel {
195195 LOG_WARN,
196196 LOG_ERROR,
197− LOG_FATAL
198197 };
199198
200199 void __attribute__((format(printf, 2, 3)))
201200 modpost_log(enum loglevel loglevel, const char *fmt, ...);
202201
203−void __attribute__((format(printf, 2, 3), noreturn))
204−modpost_log_noret(enum loglevel loglevel, const char *fmt, ...);
205−
206202 /*
207203 * warn - show the given message, then let modpost continue running, still
208204 * allowing modpost to exit successfully. This should be used when
@@ -218,4 +214,4 @@ modpost_log_noret(enum loglevel loglevel, const char *fmt, ...); · 9 unmodified lines
218214 */
219215 #define warn(fmt, args...) modpost_log(LOG_WARN, fmt, ##args)
220216 #define error(fmt, args...) modpost_log(LOG_ERROR, fmt, ##args)
221−#define fatal(fmt, args...) modpost_log_noret(LOG_FATAL, fmt, ##args)
217+#define fatal(fmt, args...) do { error(fmt, ##args); exit(1); } while (1)
scripts/package/kernel.spec+11−11
@@ -55,12 +55,12 @@ patch -p1 < %{SOURCE2} · 54 unmodified lines
5555 %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
5656
5757 %install
58−mkdir -p %{buildroot}/boot
59−cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE}
58+mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
59+cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
6060 %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
6161 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
62−cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
63−cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
62+cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
63+cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
6464 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
6565 %if %{with_devel}
6666 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
@@ -70,13 +70,14 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA · 3 unmodified lines
7070 rm -rf %{buildroot}
7171
7272 %post
73−if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
74−cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
75−cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
76−rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
77−/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
78−rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
73+if [ -x /usr/bin/kernel-install ]; then
74+ /usr/bin/kernel-install add %{KERNELRELEASE} /lib/modules/%{KERNELRELEASE}/vmlinuz
7975 fi
76+for file in vmlinuz System.map config; do
77+ if ! cmp --silent "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"; then
78+ cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
79+ fi
80+done
8081
8182 %preun
8283 if [ -x /sbin/new-kernel-pkg ]; then
@@ -94,7 +95,6 @@ fi · 11 unmodified lines
9495 %defattr (-, root, root)
9596 /lib/modules/%{KERNELRELEASE}
9697 %exclude /lib/modules/%{KERNELRELEASE}/build
97−/boot/*
9898
9999 %files headers
100100 %defattr (-, root, root)
security/security.c+40−5
@@ -4255,7 +4255,19 @@ EXPORT_SYMBOL(security_inode_setsecctx); · 4254 unmodified lines
42554255 */
42564256 int security_inode_getsecctx(struct inode *inode, void **ctx, u32 *ctxlen)
42574257 {
4258− return call_int_hook(inode_getsecctx, -EOPNOTSUPP, inode, ctx, ctxlen);
4258+ struct security_hook_list *hp;
4259+ int rc;
4260+
4261+ /*
4262+ * Only one module will provide a security context.
4263+ */
4264+ hlist_for_each_entry(hp, &security_hook_heads.inode_getsecctx, list) {
4265+ rc = hp->hook.inode_getsecctx(inode, ctx, ctxlen);
4266+ if (rc != LSM_RET_DEFAULT(inode_getsecctx))
4267+ return rc;
4268+ }
4269+
4270+ return LSM_RET_DEFAULT(inode_getsecctx);
42594271 }
42604272 EXPORT_SYMBOL(security_inode_getsecctx);
42614273
@@ -4612,8 +4624,20 @@ EXPORT_SYMBOL(security_sock_rcv_skb); · 350 unmodified lines
46124624 int security_socket_getpeersec_stream(struct socket *sock, sockptr_t optval,
46134625 sockptr_t optlen, unsigned int len)
46144626 {
4615− return call_int_hook(socket_getpeersec_stream, -ENOPROTOOPT, sock,
4616− optval, optlen, len);
4627+ struct security_hook_list *hp;
4628+ int rc;
4629+
4630+ /*
4631+ * Only one module will provide a security context.
4632+ */
4633+ hlist_for_each_entry(hp, &security_hook_heads.socket_getpeersec_stream,
4634+ list) {
4635+ rc = hp->hook.socket_getpeersec_stream(sock, optval, optlen,
4636+ len);
4637+ if (rc != LSM_RET_DEFAULT(socket_getpeersec_stream))
4638+ return rc;
4639+ }
4640+ return LSM_RET_DEFAULT(socket_getpeersec_stream);
46174641 }
46184642
46194643 /**
@@ -4633,8 +4657,19 @@ int security_socket_getpeersec_stream(struct socket *sock, sockptr_t optval, · 13 unmodified lines
46334657 int security_socket_getpeersec_dgram(struct socket *sock,
46344658 struct sk_buff *skb, u32 *secid)
46354659 {
4636− return call_int_hook(socket_getpeersec_dgram, -ENOPROTOOPT, sock,
4637− skb, secid);
4660+ struct security_hook_list *hp;
4661+ int rc;
4662+
4663+ /*
4664+ * Only one module will provide a security context.
4665+ */
4666+ hlist_for_each_entry(hp, &security_hook_heads.socket_getpeersec_dgram,
4667+ list) {
4668+ rc = hp->hook.socket_getpeersec_dgram(sock, skb, secid);
4669+ if (rc != LSM_RET_DEFAULT(socket_getpeersec_dgram))
4670+ return rc;
4671+ }
4672+ return LSM_RET_DEFAULT(socket_getpeersec_dgram);
46384673 }
46394674 EXPORT_SYMBOL(security_socket_getpeersec_dgram);
46404675
tools/power/cpupower/bench/Makefile+1−1
@@ -15,7 +15,7 @@ LIBS = -L../ -L$(OUTPUT) -lm -lcpupower · 14 unmodified lines
1515 OBJS = $(OUTPUT)main.o $(OUTPUT)parse.o $(OUTPUT)system.o $(OUTPUT)benchmark.o
1616 endif
1717
18−CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\"
18+override CFLAGS += -D_GNU_SOURCE -I../lib -DDEFAULT_CONFIG_FILE=\"$(confdir)/cpufreq-bench.conf\"
1919
2020 $(OUTPUT)%.o : %.c
2121 $(ECHO) " CC " $@
tools/testing/cxl/Kbuild+2−0
@@ -65,4 +65,6 @@ cxl_core-y += config_check.o · 64 unmodified lines
6565 cxl_core-y += cxl_core_test.o
6666 cxl_core-y += cxl_core_exports.o
6767
68+KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
69+
6870 obj-m += test/
tools/testing/cxl/test/Kbuild+2−0
@@ -8,3 +8,5 @@ obj-m += cxl_mock_mem.o · 7 unmodified lines
88 cxl_test-y := cxl.o
99 cxl_mock-y := mock.o
1010 cxl_mock_mem-y := mem.o
11+
12+KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
tools/testing/nvdimm/Kbuild+2−0
@@ -82,4 +82,6 @@ libnvdimm-$(CONFIG_NVDIMM_KEYS) += $(NVDIMM_SRC)/security.o · 81 unmodified lines
8282 libnvdimm-y += libnvdimm_test.o
8383 libnvdimm-y += config_check.o
8484
85+KBUILD_CFLAGS := $(filter-out -Wmissing-prototypes -Wmissing-declarations, $(KBUILD_CFLAGS))
86+
8587 obj-m += test/
tools/testing/selftests/drivers/net/bonding/lag_lib.sh+11−0
@@ -48,6 +48,17 @@ test_LAG_cleanup() · 47 unmodified lines
4848 ip link add mv0 link "$name" up address "$ucaddr" type macvlan
4949 # Used to test dev->mc handling
5050 ip address add "$addr6" dev "$name"
51+
52+ # Check that addresses were added as expected
53+ (grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy1 ||
54+ grep_bridge_fdb "$ucaddr" bridge fdb show dev dummy2) >/dev/null
55+ check_err $? "macvlan unicast address not found on a slave"
56+
57+ # mcaddr is added asynchronously by addrconf_dad_work(), use busywait
58+ (busywait 10000 grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy1 ||
59+ grep_bridge_fdb "$mcaddr" bridge fdb show dev dummy2) >/dev/null
60+ check_err $? "IPv6 solicited-node multicast mac address not found on a slave"
61+
5162 ip link set dev "$name" down
5263 ip link del "$name"
5364
tools/testing/selftests/drivers/net/team/config+3−1
@@ -1,3 +1,5 @@
1+CONFIG_DUMMY=y
2+CONFIG_IPV6=y
3+CONFIG_MACVLAN=y
14 CONFIG_NET_TEAM=y
25 CONFIG_NET_TEAM_MODE_LOADBALANCE=y
3−CONFIG_MACVLAN=y
tools/testing/selftests/hid/tests/test_wacom_generic.py+4−4
@@ -880,8 +880,8 @@ class TestDTH2452Tablet(test_multitouch.BaseTest.TestMultitouch, TouchTabletTest · 879 unmodified lines
880880 does not overlap with other contacts. The value of `t` may be
881881 incremented over time to move the point along a linear path.
882882 """
883− x = 50 + 10 * contact_id + t
884− y = 100 + 100 * contact_id + t
883+ x = 50 + 10 * contact_id + t * 11
884+ y = 100 + 100 * contact_id + t * 11
885885 return test_multitouch.Touch(contact_id, x, y)
886886
887887 def make_contacts(self, n, t=0):
@@ -902,8 +902,8 @@ class TestDTH2452Tablet(test_multitouch.BaseTest.TestMultitouch, TouchTabletTest · 14 unmodified lines
902902 tracking_id = contact_ids.tracking_id
903903 slot_num = contact_ids.slot_num
904904
905− x = 50 + 10 * contact_id + t
906− y = 100 + 100 * contact_id + t
905+ x = 50 + 10 * contact_id + t * 11
906+ y = 100 + 100 * contact_id + t * 11
907907
908908 # If the data isn't supposed to be stored in any slots, there is
909909 # nothing we can check for in the evdev stream.
tools/testing/selftests/livepatch/functions.sh+17−20
@@ -42,17 +42,6 @@ function die() { · 41 unmodified lines
4242 exit 1
4343 }
4444
45−# save existing dmesg so we can detect new content
46−function save_dmesg() {
47− SAVED_DMESG=$(mktemp --tmpdir -t klp-dmesg-XXXXXX)
48− dmesg > "$SAVED_DMESG"
49−}
50−
51−# cleanup temporary dmesg file from save_dmesg()
52−function cleanup_dmesg_file() {
53− rm -f "$SAVED_DMESG"
54−}
55−
5645 function push_config() {
5746 DYNAMIC_DEBUG=$(grep '^kernel/livepatch' /sys/kernel/debug/dynamic_debug/control | \
5847 awk -F'[: ]' '{print "file " $1 " line " $2 " " $4}')
@@ -99,7 +88,6 @@ function set_ftrace_enabled() { · 40 unmodified lines
9988
10089 function cleanup() {
10190 pop_config
102− cleanup_dmesg_file
10391 }
10492
10593 # setup_config - save the current config and set a script exit trap that
@@ -280,7 +268,15 @@ function set_pre_patch_ret { · 174 unmodified lines
280268 function start_test {
281269 local test="$1"
282270
283− save_dmesg
271+ # Dump something unique into the dmesg log, then stash the entry
272+ # in LAST_DMESG. The check_result() function will use it to
273+ # find new kernel messages since the test started.
274+ local last_dmesg_msg="livepatch kselftest timestamp: $(date --rfc-3339=ns)"
275+ log "$last_dmesg_msg"
276+ loop_until 'dmesg | grep -q "$last_dmesg_msg"' ||
277+ die "buffer busy? can't find canary dmesg message: $last_dmesg_msg"
278+ LAST_DMESG=$(dmesg | grep "$last_dmesg_msg")
279+
284280 echo -n "TEST: $test ... "
285281 log "===== TEST: $test ====="
286282 }
@@ -291,23 +287,24 @@ function check_result { · 4 unmodified lines
291287 local expect="$*"
292288 local result
293289
294− # Note: when comparing dmesg output, the kernel log timestamps
295− # help differentiate repeated testing runs. Remove them with a
296− # post-comparison sed filter.
297−
298− result=$(dmesg | comm --nocheck-order -13 "$SAVED_DMESG" - | \
290+ # Test results include any new dmesg entry since LAST_DMESG, then:
291+ # - include lines matching keywords
292+ # - exclude lines matching keywords
293+ # - filter out dmesg timestamp prefixes
294+ result=$(dmesg | awk -v last_dmesg="$LAST_DMESG" 'p; $0 == last_dmesg { p=1 }' | \
299295 grep -e 'livepatch:' -e 'test_klp' | \
300296 grep -v '\(tainting\|taints\) kernel' | \
301297 sed 's/^\[[ 0-9.]*\] //')
302298
303299 if [[ "$expect" == "$result" ]] ; then
304300 echo "ok"
301+ elif [[ "$result" == "" ]] ; then
302+ echo -e "not ok\n\nbuffer overrun? can't find canary dmesg entry: $LAST_DMESG\n"
303+ die "livepatch kselftest(s) failed"
305304 else
306305 echo -e "not ok\n\n$(diff -upr --label expected --label result <(echo "$expect") <(echo "$result"))\n"
307306 die "livepatch kselftest(s) failed"
308307 fi
309−
310− cleanup_dmesg_file
311308 }
312309
313310 # check_sysfs_rights(modname, rel_path, expected_rights) - check sysfs
tools/testing/selftests/mm/charge_reserved_hugetlb.sh+1−1
@@ -1,4 +1,4 @@
1−#!/bin/sh
1+#!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
44 # Kselftest framework requirement - SKIP code is 4.
tools/testing/selftests/mm/ksm_tests.c+1−1
@@ -566,7 +566,7 @@ static int ksm_merge_hugepages_time(int merge_type, int mapping, int prot, · 565 unmodified lines
566566 if (map_ptr_orig == MAP_FAILED)
567567 err(2, "initial mmap");
568568
569− if (madvise(map_ptr, len + HPAGE_SIZE, MADV_HUGEPAGE))
569+ if (madvise(map_ptr, len, MADV_HUGEPAGE))
570570 err(2, "MADV_HUGEPAGE");
571571
572572 pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
tools/testing/selftests/mm/map_hugetlb.c+7−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <unistd.h>
1616 #include <sys/mman.h>
1717 #include <fcntl.h>
18+#include "vm_util.h"
1819
1920 #define LENGTH (256UL*1024*1024)
2021 #define PROTECTION (PROT_READ | PROT_WRITE)
@@ -58,10 +59,16 @@ int main(int argc, char **argv) · 37 unmodified lines
5859 {
5960 void *addr;
6061 int ret;
62+ size_t hugepage_size;
6163 size_t length = LENGTH;
6264 int flags = FLAGS;
6365 int shift = 0;
6466
67+ hugepage_size = default_huge_page_size();
68+ /* munmap with fail if the length is not page aligned */
69+ if (hugepage_size > length)
70+ length = hugepage_size;
71+
6572 if (argc > 1)
6673 length = atol(argv[1]) << 20;
6774 if (argc > 2) {
tools/testing/selftests/mm/mremap_test.c+14−13
@@ -360,7 +360,8 @@ static long long remap_region(struct config c, unsigned int threshold_mb, · 359 unmodified lines
360360 char pattern_seed)
361361 {
362362 void *addr, *src_addr, *dest_addr, *dest_preamble_addr;
363− unsigned long long i;
363+ int d;
364+ unsigned long long t;
364365 struct timespec t_start = {0, 0}, t_end = {0, 0};
365366 long long start_ns, end_ns, align_mask, ret, offset;
366367 unsigned long long threshold;
@@ -378,8 +379,8 @@ static long long remap_region(struct config c, unsigned int threshold_mb, · 11 unmodified lines
378379
379380 /* Set byte pattern for source block. */
380381 srand(pattern_seed);
381− for (i = 0; i < threshold; i++)
382− memset((char *) src_addr + i, (char) rand(), 1);
382+ for (t = 0; t < threshold; t++)
383+ memset((char *) src_addr + t, (char) rand(), 1);
383384
384385 /* Mask to zero out lower bits of address for alignment */
385386 align_mask = ~(c.dest_alignment - 1);
@@ -420,8 +421,8 @@ static long long remap_region(struct config c, unsigned int threshold_mb, · 34 unmodified lines
420421
421422 /* Set byte pattern for the dest preamble block. */
422423 srand(pattern_seed);
423− for (i = 0; i < c.dest_preamble_size; i++)
424− memset((char *) dest_preamble_addr + i, (char) rand(), 1);
424+ for (d = 0; d < c.dest_preamble_size; d++)
425+ memset((char *) dest_preamble_addr + d, (char) rand(), 1);
425426 }
426427
427428 clock_gettime(CLOCK_MONOTONIC, &t_start);
@@ -437,14 +438,14 @@ static long long remap_region(struct config c, unsigned int threshold_mb, · 9 unmodified lines
437438
438439 /* Verify byte pattern after remapping */
439440 srand(pattern_seed);
440− for (i = 0; i < threshold; i++) {
441+ for (t = 0; t < threshold; t++) {
441442 char c = (char) rand();
442443
443− if (((char *) dest_addr)[i] != c) {
444+ if (((char *) dest_addr)[t] != c) {
444445 ksft_print_msg("Data after remap doesn't match at offset %llu\n",
445− i);
446+ t);
446447 ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff,
447− ((char *) dest_addr)[i] & 0xff);
448+ ((char *) dest_addr)[t] & 0xff);
448449 ret = -1;
449450 goto clean_up_dest;
450451 }
@@ -453,14 +454,14 @@ static long long remap_region(struct config c, unsigned int threshold_mb, · 2 unmodified lines
453454 /* Verify the dest preamble byte pattern after remapping */
454455 if (c.dest_preamble_size) {
455456 srand(pattern_seed);
456− for (i = 0; i < c.dest_preamble_size; i++) {
457+ for (d = 0; d < c.dest_preamble_size; d++) {
457458 char c = (char) rand();
458459
459− if (((char *) dest_preamble_addr)[i] != c) {
460+ if (((char *) dest_preamble_addr)[d] != c) {
460461 ksft_print_msg("Preamble data after remap doesn't match at offset %d\n",
461− i);
462+ d);
462463 ksft_print_msg("Expected: %#x\t Got: %#x\n", c & 0xff,
463− ((char *) dest_preamble_addr)[i] & 0xff);
464+ ((char *) dest_preamble_addr)[d] & 0xff);
464465 ret = -1;
465466 goto clean_up_dest;
466467 }
tools/testing/selftests/mm/va_high_addr_switch.sh+6−0
@@ -29,9 +29,15 @@ check_supported_x86_64() · 28 unmodified lines
2929 # See man 1 gzip under '-f'.
3030 local pg_table_levels=$(gzip -dcfq "${config}" | grep PGTABLE_LEVELS | cut -d'=' -f 2)
3131
32+ local cpu_supports_pl5=$(awk '/^flags/ {if (/la57/) {print 0;}
33+ else {print 1}; exit}' /proc/cpuinfo 2>/dev/null)
34+
3235 if [[ "${pg_table_levels}" -lt 5 ]]; then
3336 echo "$0: PGTABLE_LEVELS=${pg_table_levels}, must be >= 5 to run this test"
3437 exit $ksft_skip
38+ elif [[ "${cpu_supports_pl5}" -ne 0 ]]; then
39+ echo "$0: CPU does not have the necessary la57 flag to support page table level 5"
40+ exit $ksft_skip
3541 fi
3642 }
3743
tools/testing/selftests/mm/write_hugetlb_memory.sh+1−1
@@ -1,4 +1,4 @@
1−#!/bin/sh
1+#!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
44 set -e
tools/testing/selftests/net/Makefile+5−4
@@ -53,8 +53,7 @@ TEST_PROGS += bind_bhash.sh · 52 unmodified lines
5353 TEST_PROGS += ip_local_port_range.sh
5454 TEST_PROGS += rps_default_mask.sh
5555 TEST_PROGS += big_tcp.sh
56−TEST_PROGS_EXTENDED := in_netns.sh setup_loopback.sh setup_veth.sh
57−TEST_PROGS_EXTENDED += toeplitz_client.sh toeplitz.sh lib.sh
56+TEST_PROGS_EXTENDED := toeplitz_client.sh toeplitz.sh
5857 TEST_GEN_FILES = socket nettest
5958 TEST_GEN_FILES += psock_fanout psock_tpacket msg_zerocopy reuseport_addr_any
6059 TEST_GEN_FILES += tcp_mmap tcp_inq psock_snd txring_overwrite
@@ -84,6 +83,7 @@ TEST_PROGS += sctp_vrf.sh · 23 unmodified lines
8483 TEST_GEN_FILES += sctp_hello
8584 TEST_GEN_FILES += csum
8685 TEST_GEN_FILES += nat6to4.o
86+TEST_GEN_FILES += xdp_dummy.o
8787 TEST_GEN_FILES += ip_local_port_range
8888 TEST_GEN_FILES += bind_wildcard
8989 TEST_PROGS += test_vxlan_mdb.sh
@@ -95,6 +95,7 @@ TEST_PROGS += fq_band_pktlimit.sh · 5 unmodified lines
9595 TEST_PROGS += vlan_hw_filter.sh
9696
9797 TEST_FILES := settings
98+TEST_FILES += in_netns.sh lib.sh net_helper.sh setup_loopback.sh setup_veth.sh
9899
99100 include ../lib.mk
100101
@@ -104,7 +105,7 @@ $(OUTPUT)/tcp_inq: LDLIBS += -lpthread · 3 unmodified lines
104105 $(OUTPUT)/bind_bhash: LDLIBS += -lpthread
105106 $(OUTPUT)/io_uring_zerocopy_tx: CFLAGS += -I../../../include/
106107
107−# Rules to generate bpf obj nat6to4.o
108+# Rules to generate bpf objs
108109 CLANG ?= clang
109110 SCRATCH_DIR := $(OUTPUT)/tools
110111 BUILD_DIR := $(SCRATCH_DIR)/build
@@ -139,7 +140,7 @@ endif · 28 unmodified lines
139140
140141 CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
141142
142−$(OUTPUT)/nat6to4.o: nat6to4.c $(BPFOBJ) | $(MAKE_DIRS)
143+$(OUTPUT)/nat6to4.o $(OUTPUT)/xdp_dummy.o: $(OUTPUT)/%.o : %.c $(BPFOBJ) | $(MAKE_DIRS)
143144 $(CLANG) -O2 --target=bpf -c $< $(CCINCLUDE) $(CLANG_SYS_INCLUDES) -o $@
144145
145146 $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
tools/testing/selftests/net/config+16−0
@@ -19,8 +19,11 @@ CONFIG_BRIDGE_VLAN_FILTERING=y · 18 unmodified lines
1919 CONFIG_BRIDGE=y
2020 CONFIG_CRYPTO_CHACHA20POLY1305=m
2121 CONFIG_VLAN_8021Q=y
22+CONFIG_GENEVE=m
2223 CONFIG_IFB=y
2324 CONFIG_INET_DIAG=y
25+CONFIG_INET_ESP=y
26+CONFIG_INET_ESP_OFFLOAD=y
2427 CONFIG_IP_GRE=m
2528 CONFIG_NETFILTER=y
2629 CONFIG_NETFILTER_ADVANCED=y
@@ -29,7 +32,10 @@ CONFIG_NF_NAT=m · 2 unmodified lines
2932 CONFIG_IP6_NF_IPTABLES=m
3033 CONFIG_IP_NF_IPTABLES=m
3134 CONFIG_IP6_NF_NAT=m
35+CONFIG_IP6_NF_RAW=m
3236 CONFIG_IP_NF_NAT=m
37+CONFIG_IP_NF_RAW=m
38+CONFIG_IP_NF_TARGET_TTL=m
3339 CONFIG_IPV6_GRE=m
3440 CONFIG_IPV6_SEG6_LWTUNNEL=y
3541 CONFIG_L2TP_ETH=m
@@ -45,8 +51,14 @@ CONFIG_NF_TABLES=m · 9 unmodified lines
4551 CONFIG_NF_TABLES_IPV6=y
4652 CONFIG_NF_TABLES_IPV4=y
4753 CONFIG_NFT_NAT=m
54+CONFIG_NETFILTER_XT_MATCH_LENGTH=m
55+CONFIG_NET_ACT_CSUM=m
56+CONFIG_NET_ACT_CT=m
4857 CONFIG_NET_ACT_GACT=m
58+CONFIG_NET_ACT_PEDIT=m
4959 CONFIG_NET_CLS_BASIC=m
60+CONFIG_NET_CLS_BPF=m
61+CONFIG_NET_CLS_MATCHALL=m
5062 CONFIG_NET_CLS_U32=m
5163 CONFIG_NET_IPGRE_DEMUX=m
5264 CONFIG_NET_IPGRE=m
@@ -55,6 +67,9 @@ CONFIG_NET_SCH_HTB=m · 2 unmodified lines
5567 CONFIG_NET_SCH_FQ=m
5668 CONFIG_NET_SCH_ETF=m
5769 CONFIG_NET_SCH_NETEM=y
70+CONFIG_NET_SCH_PRIO=m
71+CONFIG_NFT_COMPAT=m
72+CONFIG_NF_FLOW_TABLE=m
5873 CONFIG_PSAMPLE=m
5974 CONFIG_TCP_MD5SIG=y
6075 CONFIG_TEST_BLACKHOLE_DEV=m
@@ -80,3 +95,4 @@ CONFIG_IP_SCTP=m · 19 unmodified lines
8095 CONFIG_NETFILTER_XT_MATCH_POLICY=m
8196 CONFIG_CRYPTO_ARIA=y
8297 CONFIG_XFRM_INTERFACE=m
98+CONFIG_XFRM_USER=m
tools/testing/selftests/net/forwarding/Makefile+1−1
@@ -112,7 +112,7 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ · 111 unmodified lines
112112 vxlan_symmetric_ipv6.sh \
113113 vxlan_symmetric.sh
114114
115−TEST_PROGS_EXTENDED := devlink_lib.sh \
115+TEST_FILES := devlink_lib.sh \
116116 ethtool_lib.sh \
117117 fib_offload_lib.sh \
118118 forwarding.config.sample \
tools/testing/selftests/net/lib.sh+4−1
@@ -4,6 +4,9 @@ · 3 unmodified lines
44 ##############################################################################
55 # Defines
66
7+WAIT_TIMEOUT=${WAIT_TIMEOUT:=20}
8+BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms
9+
710 # Kselftest framework requirement - SKIP code is 4.
811 ksft_skip=4
912 # namespace list created by setup_ns
@@ -48,7 +51,7 @@ cleanup_ns() · 38 unmodified lines
4851
4952 for ns in "$@"; do
5053 ip netns delete "${ns}" &> /dev/null
51− if ! busywait 2 ip netns list \| grep -vq "^$ns$" &> /dev/null; then
54+ if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
5255 echo "Warn: Failed to remove namespace $ns"
5356 ret=1
5457 fi
tools/testing/selftests/net/mptcp/config+3−0
@@ -22,8 +22,11 @@ CONFIG_NFT_TPROXY=m · 21 unmodified lines
2222 CONFIG_NFT_SOCKET=m
2323 CONFIG_IP_ADVANCED_ROUTER=y
2424 CONFIG_IP_MULTIPLE_TABLES=y
25+CONFIG_IP_NF_FILTER=m
26+CONFIG_IP_NF_MANGLE=m
2527 CONFIG_IP_NF_TARGET_REJECT=m
2628 CONFIG_IPV6_MULTIPLE_TABLES=y
29+CONFIG_IP6_NF_FILTER=m
2730 CONFIG_NET_ACT_CSUM=m
2831 CONFIG_NET_ACT_PEDIT=m
2932 CONFIG_NET_CLS_ACT=y
tools/testing/selftests/net/mptcp/mptcp_join.sh+11−16
@@ -643,13 +643,6 @@ kill_events_pids() · 642 unmodified lines
643643 mptcp_lib_kill_wait $evts_ns2_pid
644644 }
645645
646−kill_tests_wait()
647−{
648− #shellcheck disable=SC2046
649− kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
650− wait
651−}
652−
653646 pm_nl_set_limits()
654647 {
655648 local ns=$1
@@ -3453,7 +3446,7 @@ userspace_tests() · 2797 unmodified lines
34533446 chk_mptcp_info subflows 0 subflows 0
34543447 chk_subflows_total 1 1
34553448 kill_events_pids
3456− wait $tests_pid
3449+ mptcp_lib_kill_wait $tests_pid
34573450 fi
34583451
34593452 # userspace pm create destroy subflow
@@ -3475,7 +3468,7 @@ userspace_tests() · 15 unmodified lines
34753468 chk_mptcp_info subflows 0 subflows 0
34763469 chk_subflows_total 1 1
34773470 kill_events_pids
3478− wait $tests_pid
3471+ mptcp_lib_kill_wait $tests_pid
34793472 fi
34803473
34813474 # userspace pm create id 0 subflow
@@ -3494,7 +3487,7 @@ userspace_tests() · 12 unmodified lines
34943487 chk_mptcp_info subflows 1 subflows 1
34953488 chk_subflows_total 2 2
34963489 kill_events_pids
3497− wait $tests_pid
3490+ mptcp_lib_kill_wait $tests_pid
34983491 fi
34993492
35003493 # userspace pm remove initial subflow
@@ -3518,7 +3511,7 @@ userspace_tests() · 17 unmodified lines
35183511 chk_mptcp_info subflows 1 subflows 1
35193512 chk_subflows_total 1 1
35203513 kill_events_pids
3521− wait $tests_pid
3514+ mptcp_lib_kill_wait $tests_pid
35223515 fi
35233516
35243517 # userspace pm send RM_ADDR for ID 0
@@ -3544,7 +3537,7 @@ userspace_tests() · 19 unmodified lines
35443537 chk_mptcp_info subflows 1 subflows 1
35453538 chk_subflows_total 1 1
35463539 kill_events_pids
3547− wait $tests_pid
3540+ mptcp_lib_kill_wait $tests_pid
35483541 fi
35493542 }
35503543
@@ -3558,7 +3551,8 @@ endpoint_tests() · 7 unmodified lines
35583551 pm_nl_set_limits $ns2 2 2
35593552 pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
35603553 speed=slow \
3561− run_tests $ns1 $ns2 10.0.1.1 2>/dev/null &
3554+ run_tests $ns1 $ns2 10.0.1.1 &
3555+ local tests_pid=$!
35623556
35633557 wait_mpj $ns1
35643558 pm_nl_check_endpoint "creation" \
@@ -3573,7 +3567,7 @@ endpoint_tests() · 8 unmodified lines
35733567 pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
35743568 pm_nl_check_endpoint "modif is allowed" \
35753569 $ns2 10.0.2.2 id 1 flags signal
3576− kill_tests_wait
3570+ mptcp_lib_kill_wait $tests_pid
35773571 fi
35783572
35793573 if reset "delete and re-add" &&
@@ -3582,7 +3576,8 @@ endpoint_tests() · 2 unmodified lines
35823576 pm_nl_set_limits $ns2 1 1
35833577 pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
35843578 test_linkfail=4 speed=20 \
3585− run_tests $ns1 $ns2 10.0.1.1 2>/dev/null &
3579+ run_tests $ns1 $ns2 10.0.1.1 &
3580+ local tests_pid=$!
35863581
35873582 wait_mpj $ns2
35883583 chk_subflow_nr "before delete" 2
@@ -3597,7 +3592,7 @@ endpoint_tests() · 8 unmodified lines
35973592 wait_mpj $ns2
35983593 chk_subflow_nr "after re-add" 2
35993594 chk_mptcp_info subflows 1 subflows 1
3600− kill_tests_wait
3595+ mptcp_lib_kill_wait $tests_pid
36013596 fi
36023597 }
36033598
tools/testing/selftests/net/mptcp/mptcp_lib.sh+1−1
@@ -6,7 +6,7 @@ readonly KSFT_FAIL=1 · 5 unmodified lines
66 readonly KSFT_SKIP=4
77
88 # shellcheck disable=SC2155 # declare and assign separately
9−readonly KSFT_TEST=$(basename "${0}" | sed 's/\.sh$//g')
9+readonly KSFT_TEST="${MPTCP_LIB_KSFT_TEST:-$(basename "${0}" .sh)}"
1010
1111 MPTCP_LIB_SUBTESTS=()
1212
tools/testing/selftests/net/mptcp/settings+1−1
@@ -1 +1 @@
1−timeout=1200
1+timeout=1800
tools/testing/selftests/net/mptcp/simult_flows.sh+4−4
@@ -284,12 +284,12 @@ done · 283 unmodified lines
284284
285285 setup
286286 run_test 10 10 0 0 "balanced bwidth"
287−run_test 10 10 1 50 "balanced bwidth with unbalanced delay"
287+run_test 10 10 1 25 "balanced bwidth with unbalanced delay"
288288
289289 # we still need some additional infrastructure to pass the following test-cases
290−run_test 30 10 0 0 "unbalanced bwidth"
291−run_test 30 10 1 50 "unbalanced bwidth with unbalanced delay"
292−run_test 30 10 50 1 "unbalanced bwidth with opposed, unbalanced delay"
290+run_test 10 3 0 0 "unbalanced bwidth"
291+run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay"
292+run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay"
293293
294294 mptcp_lib_result_print_all_tap
295295 exit $ret
tools/testing/selftests/net/net_helper.sh+0−0

File mode changed from 100755 to 100644.

tools/testing/selftests/net/pmtu.sh+9−9
@@ -707,23 +707,23 @@ setup_xfrm6() { · 706 unmodified lines
707707 }
708708
709709 setup_xfrm4udp() {
710− setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0"
711− setup_nettest_xfrm 4 4500
710+ setup_xfrm 4 ${veth4_a_addr} ${veth4_b_addr} "encap espinudp 4500 4500 0.0.0.0" && \
711+ setup_nettest_xfrm 4 4500
712712 }
713713
714714 setup_xfrm6udp() {
715− setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0"
716− setup_nettest_xfrm 6 4500
715+ setup_xfrm 6 ${veth6_a_addr} ${veth6_b_addr} "encap espinudp 4500 4500 0.0.0.0" && \
716+ setup_nettest_xfrm 6 4500
717717 }
718718
719719 setup_xfrm4udprouted() {
720− setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0"
721− setup_nettest_xfrm 4 4500
720+ setup_xfrm 4 ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "encap espinudp 4500 4500 0.0.0.0" && \
721+ setup_nettest_xfrm 4 4500
722722 }
723723
724724 setup_xfrm6udprouted() {
725− setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0"
726− setup_nettest_xfrm 6 4500
725+ setup_xfrm 6 ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 "encap espinudp 4500 4500 0.0.0.0" && \
726+ setup_nettest_xfrm 6 4500
727727 }
728728
729729 setup_routing_old() {
@@ -1339,7 +1339,7 @@ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception() { · 609 unmodified lines
13391339
13401340 sleep 1
13411341
1342− dd if=/dev/zero of=/dev/stdout status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
1342+ dd if=/dev/zero status=none bs=1M count=1 | ${target} socat -T 3 -u STDIN $TCPDST,connect-timeout=3
13431343
13441344 size=$(du -sb $tmpoutfile)
13451345 size=${size%%/tmp/*}
tools/testing/selftests/net/setup_loopback.sh+0−0

File mode changed from 100755 to 100644.

tools/testing/selftests/net/setup_veth.sh+1−1
@@ -11,7 +11,7 @@ setup_veth_ns() { · 10 unmodified lines
1111 local -r ns_mac="$4"
1212
1313 [[ -e /var/run/netns/"${ns_name}" ]] || ip netns add "${ns_name}"
14− echo 100000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
14+ echo 1000000 > "/sys/class/net/${ns_dev}/gro_flush_timeout"
1515 ip link set dev "${ns_dev}" netns "${ns_name}" mtu 65535
1616 ip -netns "${ns_name}" link set dev "${ns_dev}" up
1717
tools/testing/selftests/net/tcp_ao/config+10−0
@@ -0,0 +1,10 @@
1+CONFIG_CRYPTO_HMAC=y
2+CONFIG_CRYPTO_RMD160=y
3+CONFIG_CRYPTO_SHA1=y
4+CONFIG_IPV6_MULTIPLE_TABLES=y
5+CONFIG_IPV6=y
6+CONFIG_NET_L3_MASTER_DEV=y
7+CONFIG_NET_VRF=y
8+CONFIG_TCP_AO=y
9+CONFIG_TCP_MD5SIG=y
10+CONFIG_VETH=m
tools/testing/selftests/net/tcp_ao/key-management.c+26−20
@@ -417,9 +417,9 @@ struct test_key { · 416 unmodified lines
417417 matches_vrf : 1,
418418 is_current : 1,
419419 is_rnext : 1,
420− used_on_handshake : 1,
421− used_after_accept : 1,
422− used_on_client : 1;
420+ used_on_server_tx : 1,
421+ used_on_client_tx : 1,
422+ skip_counters_checks : 1;
423423 };
424424
425425 struct key_collection {
@@ -609,16 +609,14 @@ static int key_collection_socket(bool server, unsigned int port) · 183 unmodified lines
609609 addr = &this_ip_dest;
610610 sndid = key->client_keyid;
611611 rcvid = key->server_keyid;
612− set_current = key->is_current;
613− set_rnext = key->is_rnext;
612+ key->used_on_client_tx = set_current = key->is_current;
613+ key->used_on_server_tx = set_rnext = key->is_rnext;
614614 }
615615
616616 if (test_add_key_cr(sk, key->password, key->len,
617617 *addr, vrf, sndid, rcvid, key->maclen,
618618 key->alg, set_current, set_rnext))
619619 test_key_error("setsockopt(TCP_AO_ADD_KEY)", key);
620− if (set_current || set_rnext)
621− key->used_on_handshake = 1;
622620 #ifdef DEBUG
623621 test_print("%s [%u/%u] key: { %s, %u:%u, %u, %u:%u:%u:%u (%u)}",
624622 server ? "server" : "client", i, collection.nr_keys,
@@ -640,22 +638,22 @@ static void verify_counters(const char *tst_name, bool is_listen_sk, bool server · 15 unmodified lines
640638 for (i = 0; i < collection.nr_keys; i++) {
641639 struct test_key *key = &collection.keys[i];
642640 uint8_t sndid, rcvid;
643− bool was_used;
641+ bool rx_cnt_expected;
644642
643+ if (key->skip_counters_checks)
644+ continue;
645645 if (server) {
646646 sndid = key->server_keyid;
647647 rcvid = key->client_keyid;
648− if (is_listen_sk)
649− was_used = key->used_on_handshake;
650− else
651− was_used = key->used_after_accept;
648+ rx_cnt_expected = key->used_on_client_tx;
652649 } else {
653650 sndid = key->client_keyid;
654651 rcvid = key->server_keyid;
655− was_used = key->used_on_client;
652+ rx_cnt_expected = key->used_on_server_tx;
656653 }
657654
658− test_tcp_ao_key_counters_cmp(tst_name, a, b, was_used,
655+ test_tcp_ao_key_counters_cmp(tst_name, a, b,
656+ rx_cnt_expected ? TEST_CNT_KEY_GOOD : 0,
659657 sndid, rcvid);
660658 }
661659 test_tcp_ao_counters_free(a);
@@ -843,7 +841,7 @@ static void end_server(const char *tst_name, int sk, · 181 unmodified lines
843841 synchronize_threads(); /* 4: verified => closed */
844842 close(sk);
845843
846− verify_counters(tst_name, true, false, begin, &end);
844+ verify_counters(tst_name, false, true, begin, &end);
847845 synchronize_threads(); /* 5: counters */
848846 }
849847
@@ -916,9 +914,8 @@ static int run_client(const char *tst_name, unsigned int port, · 66 unmodified lines
916914 current_index = nr_keys - 1;
917915 if (rnext_index < 0)
918916 rnext_index = nr_keys - 1;
919− collection.keys[current_index].used_on_handshake = 1;
920− collection.keys[rnext_index].used_after_accept = 1;
921− collection.keys[rnext_index].used_on_client = 1;
917+ collection.keys[current_index].used_on_client_tx = 1;
918+ collection.keys[rnext_index].used_on_server_tx = 1;
922919
923920 synchronize_threads(); /* 3: accepted => send data */
924921 if (test_client_verify(sk, msg_sz, msg_nr, TEST_TIMEOUT_SEC)) {
@@ -1059,7 +1056,16 @@ static void check_current_back(const char *tst_name, unsigned int port, · 134 unmodified lines
10591056 test_error("Can't change the current key");
10601057 if (test_client_verify(sk, msg_len, nr_packets, TEST_TIMEOUT_SEC))
10611058 test_fail("verify failed");
1062− collection.keys[rotate_to_index].used_after_accept = 1;
1059+ /* There is a race here: between setting the current_key with
1060+ * setsockopt(TCP_AO_INFO) and starting to send some data - there
1061+ * might have been a segment received with the desired
1062+ * RNext_key set. In turn that would mean that the first outgoing
1063+ * segment will have the desired current_key (flipped back).
1064+ * Which is what the user/test wants. As it's racy, skip checking
1065+ * the counters, yet check what are the resulting current/rnext
1066+ * keys on both sides.
1067+ */
1068+ collection.keys[rotate_to_index].skip_counters_checks = 1;
10631069
10641070 end_client(tst_name, sk, nr_keys, current_index, rnext_index, &tmp);
10651071 }
@@ -1089,7 +1095,7 @@ static void roll_over_keys(const char *tst_name, unsigned int port, · 23 unmodified lines
10891095 }
10901096 verify_current_rnext(tst_name, sk, -1,
10911097 collection.keys[i].server_keyid);
1092− collection.keys[i].used_on_client = 1;
1098+ collection.keys[i].used_on_server_tx = 1;
10931099 synchronize_threads(); /* verify current/rnext */
10941100 }
10951101 end_client(tst_name, sk, nr_keys, current_index, rnext_index, &tmp);
tools/testing/selftests/net/tcp_ao/lib/sock.c+8−4
@@ -62,7 +62,9 @@ int test_wait_fd(int sk, time_t sec, bool write) · 61 unmodified lines
6262 return -ETIMEDOUT;
6363 }
6464
65− if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &ret, &slen) || ret)
65+ if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &ret, &slen))
66+ return -errno;
67+ if (ret)
6668 return -ret;
6769 return 0;
6870 }
@@ -584,9 +586,11 @@ int test_client_verify(int sk, const size_t msg_len, const size_t nr, · 515 unmodified lines
584586 {
585587 size_t buf_sz = msg_len * nr;
586588 char *buf = alloca(buf_sz);
589+ ssize_t ret;
587590
588591 randomize_buffer(buf, buf_sz);
589− if (test_client_loop(sk, buf, buf_sz, msg_len, timeout_sec) != buf_sz)
590− return -1;
591− return 0;
592+ ret = test_client_loop(sk, buf, buf_sz, msg_len, timeout_sec);
593+ if (ret < 0)
594+ return (int)ret;
595+ return ret != buf_sz ? -1 : 0;
592596 }
tools/testing/selftests/net/tcp_ao/rst.c+90−48
@@ -1,10 +1,33 @@
11 // SPDX-License-Identifier: GPL-2.0
2−/* Author: Dmitry Safonov <dima@arista.com> */
2+/*
3+ * The test checks that both active and passive reset have correct TCP-AO
4+ * signature. An "active" reset (abort) here is procured from closing
5+ * listen() socket with non-accepted connections in the queue:
6+ * inet_csk_listen_stop() => inet_child_forget() =>
7+ * => tcp_disconnect() => tcp_send_active_reset()
8+ *
9+ * The passive reset is quite hard to get on established TCP connections.
10+ * It could be procured from non-established states, but the synchronization
11+ * part from userspace in order to reliably get RST seems uneasy.
12+ * So, instead it's procured by corrupting SEQ number on TIMED-WAIT state.
13+ *
14+ * It's important to test both passive and active RST as they go through
15+ * different code-paths:
16+ * - tcp_send_active_reset() makes no-data skb, sends it with tcp_transmit_skb()
17+ * - tcp_v*_send_reset() create their reply skbs and send them with
18+ * ip_send_unicast_reply()
19+ *
20+ * In both cases TCP-AO signatures have to be correct, which is verified by
21+ * (1) checking that the TCP-AO connection was reset and (2) TCP-AO counters.
22+ *
23+ * Author: Dmitry Safonov <dima@arista.com>
24+ */
325 #include <inttypes.h>
426 #include "../../../../include/linux/kernel.h"
527 #include "aolib.h"
628
729 const size_t quota = 1000;
30+const size_t packet_sz = 100;
831 /*
932 * Backlog == 0 means 1 connection in queue, see:
1033 * commit 64a146513f8f ("[NET]: Revert incorrect accept queue...")
@@ -59,26 +82,6 @@ static void close_forced(int sk) · 48 unmodified lines
5982 close(sk);
6083 }
6184
62−static int test_wait_for_exception(int sk, time_t sec)
63−{
64− struct timeval tv = { .tv_sec = sec };
65− struct timeval *ptv = NULL;
66− fd_set efds;
67− int ret;
68−
69− FD_ZERO(&efds);
70− FD_SET(sk, &efds);
71−
72− if (sec)
73− ptv = &tv;
74−
75− errno = 0;
76− ret = select(sk + 1, NULL, NULL, &efds, ptv);
77− if (ret < 0)
78− return -errno;
79− return ret ? sk : 0;
80−}
81−
8285 static void test_server_active_rst(unsigned int port)
8386 {
8487 struct tcp_ao_counters cnt1, cnt2;
@@ -155,17 +158,16 @@ static void test_server_passive_rst(unsigned int port) · 70 unmodified lines
155158 test_fail("server returned %zd", bytes);
156159 }
157160
158− synchronize_threads(); /* 3: chekpoint/restore the connection */
161+ synchronize_threads(); /* 3: checkpoint the client */
162+ synchronize_threads(); /* 4: close the server, creating twsk */
159163 if (test_get_tcp_ao_counters(sk, &ao2))
160164 test_error("test_get_tcp_ao_counters()");
161−
162− synchronize_threads(); /* 4: terminate server + send more on client */
163− bytes = test_server_run(sk, quota, TEST_RETRANSMIT_SEC);
164165 close(sk);
166+
167+ synchronize_threads(); /* 5: restore the socket, send more data */
165168 test_tcp_ao_counters_cmp("passive RST server", &ao1, &ao2, TEST_CNT_GOOD);
166169
167− synchronize_threads(); /* 5: verified => closed */
168− close(sk);
170+ synchronize_threads(); /* 6: server exits */
169171 }
170172
171173 static void *server_fn(void *arg)
@@ -284,7 +286,7 @@ static void test_client_active_rst(unsigned int port) · 112 unmodified lines
284286 test_error("test_wait_fds(): %d", err);
285287
286288 synchronize_threads(); /* 3: close listen socket */
287− if (test_client_verify(sk[0], 100, quota / 100, TEST_TIMEOUT_SEC))
289+ if (test_client_verify(sk[0], packet_sz, quota / packet_sz, TEST_TIMEOUT_SEC))
288290 test_fail("Failed to send data on connected socket");
289291 else
290292 test_ok("Verified established tcp connection");
@@ -323,7 +325,6 @@ static void test_client_passive_rst(unsigned int port) · 32 unmodified lines
323325 struct tcp_sock_state img;
324326 sockaddr_af saddr;
325327 int sk, err;
326− socklen_t slen = sizeof(err);
327328
328329 sk = socket(test_family, SOCK_STREAM, IPPROTO_TCP);
329330 if (sk < 0)
@@ -337,18 +338,51 @@ static void test_client_passive_rst(unsigned int port) · 7 unmodified lines
337338 test_error("failed to connect()");
338339
339340 synchronize_threads(); /* 2: accepted => send data */
340− if (test_client_verify(sk, 100, quota / 100, TEST_TIMEOUT_SEC))
341+ if (test_client_verify(sk, packet_sz, quota / packet_sz, TEST_TIMEOUT_SEC))
341342 test_fail("Failed to send data on connected socket");
342343 else
343344 test_ok("Verified established tcp connection");
344345
345− synchronize_threads(); /* 3: chekpoint/restore the connection */
346+ synchronize_threads(); /* 3: checkpoint the client */
346347 test_enable_repair(sk);
347348 test_sock_checkpoint(sk, &img, &saddr);
348349 test_ao_checkpoint(sk, &ao_img);
349− test_kill_sk(sk);
350+ test_disable_repair(sk);
350351
351− img.out.seq += quota;
352+ synchronize_threads(); /* 4: close the server, creating twsk */
353+
354+ /*
355+ * The "corruption" in SEQ has to be small enough to fit into TCP
356+ * window, see tcp_timewait_state_process() for out-of-window
357+ * segments.
358+ */
359+ img.out.seq += 5; /* 5 is more noticeable in tcpdump than 1 */
360+
361+ /*
362+ * FIXME: This is kind-of ugly and dirty, but it works.
363+ *
364+ * At this moment, the server has close'ed(sk).
365+ * The passive RST that is being targeted here is new data after
366+ * half-duplex close, see tcp_timewait_state_process() => TCP_TW_RST
367+ *
368+ * What is needed here is:
369+ * (1) wait for FIN from the server
370+ * (2) make sure that the ACK from the client went out
371+ * (3) make sure that the ACK was received and processed by the server
372+ *
373+ * Otherwise, the data that will be sent from "repaired" socket
374+ * post SEQ corruption may get to the server before it's in
375+ * TCP_FIN_WAIT2.
376+ *
377+ * (1) is easy with select()/poll()
378+ * (2) is possible by polling tcpi_state from TCP_INFO
379+ * (3) is quite complex: as server's socket was already closed,
380+ * probably the way to do it would be tcp-diag.
381+ */
382+ sleep(TEST_RETRANSMIT_SEC);
383+
384+ synchronize_threads(); /* 5: restore the socket, send more data */
385+ test_kill_sk(sk);
352386
353387 sk = socket(test_family, SOCK_STREAM, IPPROTO_TCP);
354388 if (sk < 0)
@@ -366,25 +400,33 @@ static void test_client_passive_rst(unsigned int port) · 11 unmodified lines
366400 test_disable_repair(sk);
367401 test_sock_state_free(&img);
368402
369− synchronize_threads(); /* 4: terminate server + send more on client */
370− if (test_client_verify(sk, 100, quota / 100, 2 * TEST_TIMEOUT_SEC))
371− test_ok("client connection broken post-seq-adjust");
372− else
373− test_fail("client connection still works post-seq-adjust");
374−
375− test_wait_for_exception(sk, TEST_TIMEOUT_SEC);
376−
377− if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &slen))
378− test_error("getsockopt()");
379− if (err != ECONNRESET && err != EPIPE)
380− test_fail("client connection was not reset: %d", err);
403+ /*
404+ * This is how "passive reset" is acquired in this test from TCP_TW_RST:
405+ *
406+ * IP 10.0.254.1.7011 > 10.0.1.1.59772: Flags [P.], seq 901:1001, ack 1001, win 249,
407+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x10217d6c36a22379086ef3b1], length 100
408+ * IP 10.0.254.1.7011 > 10.0.1.1.59772: Flags [F.], seq 1001, ack 1001, win 249,
409+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x104ffc99b98c10a5298cc268], length 0
410+ * IP 10.0.1.1.59772 > 10.0.254.1.7011: Flags [.], ack 1002, win 251,
411+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0xe496dd4f7f5a8a66873c6f93,nop,nop,sack 1 {1001:1002}], length 0
412+ * IP 10.0.1.1.59772 > 10.0.254.1.7011: Flags [P.], seq 1006:1106, ack 1001, win 251,
413+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x1b5f3330fb23fbcd0c77d0ca], length 100
414+ * IP 10.0.254.1.7011 > 10.0.1.1.59772: Flags [R], seq 3215596252, win 0,
415+ * options [tcp-ao keyid 100 rnextkeyid 100 mac 0x0bcfbbf497bce844312304b2], length 0
416+ */
417+ err = test_client_verify(sk, packet_sz, quota / packet_sz, 2 * TEST_TIMEOUT_SEC);
418+ /* Make sure that the connection was reset, not timeouted */
419+ if (err && err == -ECONNRESET)
420+ test_ok("client sock was passively reset post-seq-adjust");
421+ else if (err)
422+ test_fail("client sock was not reset post-seq-adjust: %d", err);
381423 else
382− test_ok("client connection was reset");
424+ test_fail("client sock is yet connected post-seq-adjust");
383425
384426 if (test_get_tcp_ao_counters(sk, &ao2))
385427 test_error("test_get_tcp_ao_counters()");
386428
387− synchronize_threads(); /* 5: verified => closed */
429+ synchronize_threads(); /* 6: server exits */
388430 close(sk);
389431 test_tcp_ao_counters_cmp("client passive RST", &ao1, &ao2, TEST_CNT_GOOD);
390432 }
@@ -410,6 +452,6 @@ static void *client_fn(void *arg) · 19 unmodified lines
410452
411453 int main(int argc, char *argv[])
412454 {
413− test_init(15, server_fn, client_fn);
455+ test_init(14, server_fn, client_fn);
414456 return 0;
415457 }
tools/testing/selftests/net/tcp_ao/settings+1−0
@@ -0,0 +1 @@
1+timeout=120
tools/testing/selftests/net/udpgro.sh+2−2
@@ -7,7 +7,7 @@ source net_helper.sh · 6 unmodified lines
77
88 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99
10−BPF_FILE="../bpf/xdp_dummy.bpf.o"
10+BPF_FILE="xdp_dummy.o"
1111
1212 # set global exit status, but never reset nonzero one.
1313 check_err()
@@ -197,7 +197,7 @@ run_all() { · 183 unmodified lines
197197 }
198198
199199 if [ ! -f ${BPF_FILE} ]; then
200− echo "Missing ${BPF_FILE}. Build bpf selftest first"
200+ echo "Missing ${BPF_FILE}. Run 'make' first"
201201 exit -1
202202 fi
203203
tools/testing/selftests/net/udpgro_bench.sh+2−2
@@ -7,7 +7,7 @@ source net_helper.sh · 6 unmodified lines
77
88 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99
10−BPF_FILE="../bpf/xdp_dummy.bpf.o"
10+BPF_FILE="xdp_dummy.o"
1111
1212 cleanup() {
1313 local -r jobs="$(jobs -p)"
@@ -84,7 +84,7 @@ run_all() { · 70 unmodified lines
8484 }
8585
8686 if [ ! -f ${BPF_FILE} ]; then
87− echo "Missing ${BPF_FILE}. Build bpf selftest first"
87+ echo "Missing ${BPF_FILE}. Run 'make' first"
8888 exit -1
8989 fi
9090
tools/testing/selftests/net/udpgro_frglist.sh+3−3
@@ -7,7 +7,7 @@ source net_helper.sh · 6 unmodified lines
77
88 readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)"
99
10−BPF_FILE="../bpf/xdp_dummy.bpf.o"
10+BPF_FILE="xdp_dummy.o"
1111
1212 cleanup() {
1313 local -r jobs="$(jobs -p)"
@@ -85,12 +85,12 @@ run_all() { · 71 unmodified lines
8585 }
8686
8787 if [ ! -f ${BPF_FILE} ]; then
88− echo "Missing ${BPF_FILE}. Build bpf selftest first"
88+ echo "Missing ${BPF_FILE}. Run 'make' first"
8989 exit -1
9090 fi
9191
9292 if [ ! -f nat6to4.o ]; then
93− echo "Missing nat6to4 helper. Build bpf nat6to4.o selftest first"
93+ echo "Missing nat6to4 helper. Run 'make' first"
9494 exit -1
9595 fi
9696
tools/testing/selftests/net/udpgro_fwd.sh+5−3
@@ -1,7 +1,9 @@
11 #!/bin/bash
22 # SPDX-License-Identifier: GPL-2.0
33
4−BPF_FILE="../bpf/xdp_dummy.bpf.o"
4+source net_helper.sh
5+
6+BPF_FILE="xdp_dummy.o"
57 readonly BASE="ns-$(mktemp -u XXXXXX)"
68 readonly SRC=2
79 readonly DST=1
@@ -119,7 +121,7 @@ run_test() { · 111 unmodified lines
119121 ip netns exec $NS_DST $ipt -A INPUT -p udp --dport 8000
120122 ip netns exec $NS_DST ./udpgso_bench_rx -C 1000 -R 10 -n 10 -l 1300 $rx_args &
121123 local spid=$!
122− sleep 0.1
124+ wait_local_port_listen "$NS_DST" 8000 udp
123125 ip netns exec $NS_SRC ./udpgso_bench_tx $family -M 1 -s 13000 -S 1300 -D $dst
124126 local retc=$?
125127 wait $spid
@@ -168,7 +170,7 @@ run_bench() { · 42 unmodified lines
168170 ip netns exec $NS_DST bash -c "echo 2 > /sys/class/net/veth$DST/queues/rx-0/rps_cpus"
169171 ip netns exec $NS_DST taskset 0x2 ./udpgso_bench_rx -C 1000 -R 10 &
170172 local spid=$!
171− sleep 0.1
173+ wait_local_port_listen "$NS_DST" 8000 udp
172174 ip netns exec $NS_SRC taskset 0x1 ./udpgso_bench_tx $family -l 3 -S 1300 -D $dst
173175 local retc=$?
174176 wait $spid
tools/testing/selftests/net/veth.sh+2−2
@@ -1,7 +1,7 @@
11 #!/bin/sh
22 # SPDX-License-Identifier: GPL-2.0
33
4−BPF_FILE="../bpf/xdp_dummy.bpf.o"
4+BPF_FILE="xdp_dummy.o"
55 readonly STATS="$(mktemp -p /tmp ns-XXXXXX)"
66 readonly BASE=`basename $STATS`
77 readonly SRC=2
@@ -218,7 +218,7 @@ while getopts "hs:" option; do · 210 unmodified lines
218218 done
219219
220220 if [ ! -f ${BPF_FILE} ]; then
221− echo "Missing ${BPF_FILE}. Build bpf selftest first"
221+ echo "Missing ${BPF_FILE}. Run 'make' first"
222222 exit 1
223223 fi
224224
tools/testing/selftests/net/xdp_dummy.c+13−0
@@ -0,0 +1,13 @@
1+// SPDX-License-Identifier: GPL-2.0
2+
3+#define KBUILD_MODNAME "xdp_dummy"
4+#include <linux/bpf.h>
5+#include <bpf/bpf_helpers.h>
6+
7+SEC("xdp")
8+int xdp_dummy_prog(struct xdp_md *ctx)
9+{
10+ return XDP_PASS;
11+}
12+
13+char _license[] SEC("license") = "GPL";
tools/testing/selftests/rseq/basic_percpu_ops_test.c+12−2
@@ -24,6 +24,11 @@ bool rseq_validate_cpu_id(void) · 23 unmodified lines
2424 {
2525 return rseq_mm_cid_available();
2626 }
27+static
28+bool rseq_use_cpu_index(void)
29+{
30+ return false; /* Use mm_cid */
31+}
2732 #else
2833 # define RSEQ_PERCPU RSEQ_PERCPU_CPU_ID
2934 static
@@ -36,6 +41,11 @@ bool rseq_validate_cpu_id(void) · 6 unmodified lines
3641 {
3742 return rseq_current_cpu_raw() >= 0;
3843 }
44+static
45+bool rseq_use_cpu_index(void)
46+{
47+ return true; /* Use cpu_id as index. */
48+}
3949 #endif
4050
4151 struct percpu_lock_entry {
@@ -274,7 +284,7 @@ void test_percpu_list(void) · 232 unmodified lines
274284 /* Generate list entries for every usable cpu. */
275285 sched_getaffinity(0, sizeof(allowed_cpus), &allowed_cpus);
276286 for (i = 0; i < CPU_SETSIZE; i++) {
277− if (!CPU_ISSET(i, &allowed_cpus))
287+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
278288 continue;
279289 for (j = 1; j <= 100; j++) {
280290 struct percpu_list_node *node;
@@ -299,7 +309,7 @@ void test_percpu_list(void) · 18 unmodified lines
299309 for (i = 0; i < CPU_SETSIZE; i++) {
300310 struct percpu_list_node *node;
301311
302− if (!CPU_ISSET(i, &allowed_cpus))
312+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
303313 continue;
304314
305315 while ((node = __percpu_list_pop(&list, i))) {
tools/testing/selftests/rseq/param_test.c+16−6
@@ -288,6 +288,11 @@ bool rseq_validate_cpu_id(void) · 287 unmodified lines
288288 {
289289 return rseq_mm_cid_available();
290290 }
291+static
292+bool rseq_use_cpu_index(void)
293+{
294+ return false; /* Use mm_cid */
295+}
291296 # ifdef TEST_MEMBARRIER
292297 /*
293298 * Membarrier does not currently support targeting a mm_cid, so
@@ -312,6 +317,11 @@ bool rseq_validate_cpu_id(void) · 18 unmodified lines
312317 {
313318 return rseq_current_cpu_raw() >= 0;
314319 }
320+static
321+bool rseq_use_cpu_index(void)
322+{
323+ return true; /* Use cpu_id as index. */
324+}
315325 # ifdef TEST_MEMBARRIER
316326 static
317327 int rseq_membarrier_expedited(int cpu)
@@ -715,7 +725,7 @@ void test_percpu_list(void) · 397 unmodified lines
715725 /* Generate list entries for every usable cpu. */
716726 sched_getaffinity(0, sizeof(allowed_cpus), &allowed_cpus);
717727 for (i = 0; i < CPU_SETSIZE; i++) {
718− if (!CPU_ISSET(i, &allowed_cpus))
728+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
719729 continue;
720730 for (j = 1; j <= 100; j++) {
721731 struct percpu_list_node *node;
@@ -752,7 +762,7 @@ void test_percpu_list(void) · 30 unmodified lines
752762 for (i = 0; i < CPU_SETSIZE; i++) {
753763 struct percpu_list_node *node;
754764
755− if (!CPU_ISSET(i, &allowed_cpus))
765+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
756766 continue;
757767
758768 while ((node = __percpu_list_pop(&list, i))) {
@@ -902,7 +912,7 @@ void test_percpu_buffer(void) · 143 unmodified lines
902912 /* Generate list entries for every usable cpu. */
903913 sched_getaffinity(0, sizeof(allowed_cpus), &allowed_cpus);
904914 for (i = 0; i < CPU_SETSIZE; i++) {
905− if (!CPU_ISSET(i, &allowed_cpus))
915+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
906916 continue;
907917 /* Worse-case is every item in same CPU. */
908918 buffer.c[i].array =
@@ -952,7 +962,7 @@ void test_percpu_buffer(void) · 43 unmodified lines
952962 for (i = 0; i < CPU_SETSIZE; i++) {
953963 struct percpu_buffer_node *node;
954964
955− if (!CPU_ISSET(i, &allowed_cpus))
965+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
956966 continue;
957967
958968 while ((node = __percpu_buffer_pop(&buffer, i))) {
@@ -1113,7 +1123,7 @@ void test_percpu_memcpy_buffer(void) · 154 unmodified lines
11131123 /* Generate list entries for every usable cpu. */
11141124 sched_getaffinity(0, sizeof(allowed_cpus), &allowed_cpus);
11151125 for (i = 0; i < CPU_SETSIZE; i++) {
1116− if (!CPU_ISSET(i, &allowed_cpus))
1126+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
11171127 continue;
11181128 /* Worse-case is every item in same CPU. */
11191129 buffer.c[i].array =
@@ -1160,7 +1170,7 @@ void test_percpu_memcpy_buffer(void) · 40 unmodified lines
11601170 for (i = 0; i < CPU_SETSIZE; i++) {
11611171 struct percpu_memcpy_buffer_node item;
11621172
1163− if (!CPU_ISSET(i, &allowed_cpus))
1173+ if (rseq_use_cpu_index() && !CPU_ISSET(i, &allowed_cpus))
11641174 continue;
11651175
11661176 while (__percpu_memcpy_buffer_pop(&buffer, &item, i)) {
tools/testing/selftests/seccomp/seccomp_benchmark.c+64−40
@@ -38,10 +38,10 @@ unsigned long long timing(clockid_t clk_id, unsigned long long samples) · 37 unmodified lines
3838 i *= 1000000000ULL;
3939 i += finish.tv_nsec - start.tv_nsec;
4040
41− printf("%lu.%09lu - %lu.%09lu = %llu (%.1fs)\n",
42− finish.tv_sec, finish.tv_nsec,
43− start.tv_sec, start.tv_nsec,
44− i, (double)i / 1000000000.0);
41+ ksft_print_msg("%lu.%09lu - %lu.%09lu = %llu (%.1fs)\n",
42+ finish.tv_sec, finish.tv_nsec,
43+ start.tv_sec, start.tv_nsec,
44+ i, (double)i / 1000000000.0);
4545
4646 return i;
4747 }
@@ -53,7 +53,7 @@ unsigned long long calibrate(void) · 5 unmodified lines
5353 pid_t pid, ret;
5454 int seconds = 15;
5555
56− printf("Calibrating sample size for %d seconds worth of syscalls ...\n", seconds);
56+ ksft_print_msg("Calibrating sample size for %d seconds worth of syscalls ...\n", seconds);
5757
5858 samples = 0;
5959 pid = getpid();
@@ -98,24 +98,36 @@ bool le(int i_one, int i_two) · 38 unmodified lines
9898 }
9999
100100 long compare(const char *name_one, const char *name_eval, const char *name_two,
101− unsigned long long one, bool (*eval)(int, int), unsigned long long two)
101+ unsigned long long one, bool (*eval)(int, int), unsigned long long two,
102+ bool skip)
102103 {
103104 bool good;
104105
105− printf("\t%s %s %s (%lld %s %lld): ", name_one, name_eval, name_two,
106− (long long)one, name_eval, (long long)two);
106+ if (skip) {
107+ ksft_test_result_skip("%s %s %s\n", name_one, name_eval,
108+ name_two);
109+ return 0;
110+ }
111+
112+ ksft_print_msg("\t%s %s %s (%lld %s %lld): ", name_one, name_eval, name_two,
113+ (long long)one, name_eval, (long long)two);
107114 if (one > INT_MAX) {
108− printf("Miscalculation! Measurement went negative: %lld\n", (long long)one);
109− return 1;
115+ ksft_print_msg("Miscalculation! Measurement went negative: %lld\n", (long long)one);
116+ good = false;
117+ goto out;
110118 }
111119 if (two > INT_MAX) {
112− printf("Miscalculation! Measurement went negative: %lld\n", (long long)two);
113− return 1;
120+ ksft_print_msg("Miscalculation! Measurement went negative: %lld\n", (long long)two);
121+ good = false;
122+ goto out;
114123 }
115124
116125 good = eval(one, two);
117126 printf("%s\n", good ? "✔️" : "❌");
118127
128+out:
129+ ksft_test_result(good, "%s %s %s\n", name_one, name_eval, name_two);
130+
119131 return good ? 0 : 1;
120132 }
121133
@@ -142,15 +154,22 @@ int main(int argc, char *argv[]) · 20 unmodified lines
142154 unsigned long long samples, calc;
143155 unsigned long long native, filter1, filter2, bitmap1, bitmap2;
144156 unsigned long long entry, per_filter1, per_filter2;
157+ bool skip = false;
145158
146159 setbuf(stdout, NULL);
147160
148− printf("Running on:\n");
161+ ksft_print_header();
162+ ksft_set_plan(7);
163+
164+ ksft_print_msg("Running on:\n");
165+ ksft_print_msg("");
149166 system("uname -a");
150167
151− printf("Current BPF sysctl settings:\n");
168+ ksft_print_msg("Current BPF sysctl settings:\n");
152169 /* Avoid using "sysctl" which may not be installed. */
170+ ksft_print_msg("");
153171 system("grep -H . /proc/sys/net/core/bpf_jit_enable");
172+ ksft_print_msg("");
154173 system("grep -H . /proc/sys/net/core/bpf_jit_harden");
155174
156175 if (argc > 1)
@@ -158,11 +177,11 @@ int main(int argc, char *argv[]) · 1 unmodified line
158177 else
159178 samples = calibrate();
160179
161− printf("Benchmarking %llu syscalls...\n", samples);
180+ ksft_print_msg("Benchmarking %llu syscalls...\n", samples);
162181
163182 /* Native call */
164183 native = timing(CLOCK_PROCESS_CPUTIME_ID, samples) / samples;
165− printf("getpid native: %llu ns\n", native);
184+ ksft_print_msg("getpid native: %llu ns\n", native);
166185
167186 ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
168187 assert(ret == 0);
@@ -172,35 +191,37 @@ int main(int argc, char *argv[]) · 3 unmodified lines
172191 assert(ret == 0);
173192
174193 bitmap1 = timing(CLOCK_PROCESS_CPUTIME_ID, samples) / samples;
175− printf("getpid RET_ALLOW 1 filter (bitmap): %llu ns\n", bitmap1);
194+ ksft_print_msg("getpid RET_ALLOW 1 filter (bitmap): %llu ns\n", bitmap1);
176195
177196 /* Second filter resulting in a bitmap */
178197 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &bitmap_prog);
179198 assert(ret == 0);
180199
181200 bitmap2 = timing(CLOCK_PROCESS_CPUTIME_ID, samples) / samples;
182− printf("getpid RET_ALLOW 2 filters (bitmap): %llu ns\n", bitmap2);
201+ ksft_print_msg("getpid RET_ALLOW 2 filters (bitmap): %llu ns\n", bitmap2);
183202
184203 /* Third filter, can no longer be converted to bitmap */
185204 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog);
186205 assert(ret == 0);
187206
188207 filter1 = timing(CLOCK_PROCESS_CPUTIME_ID, samples) / samples;
189− printf("getpid RET_ALLOW 3 filters (full): %llu ns\n", filter1);
208+ ksft_print_msg("getpid RET_ALLOW 3 filters (full): %llu ns\n", filter1);
190209
191210 /* Fourth filter, can not be converted to bitmap because of filter 3 */
192211 ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &bitmap_prog);
193212 assert(ret == 0);
194213
195214 filter2 = timing(CLOCK_PROCESS_CPUTIME_ID, samples) / samples;
196− printf("getpid RET_ALLOW 4 filters (full): %llu ns\n", filter2);
215+ ksft_print_msg("getpid RET_ALLOW 4 filters (full): %llu ns\n", filter2);
197216
198217 /* Estimations */
199218 #define ESTIMATE(fmt, var, what) do { \
200219 var = (what); \
201− printf("Estimated " fmt ": %llu ns\n", var); \
202− if (var > INT_MAX) \
203− goto more_samples; \
220+ ksft_print_msg("Estimated " fmt ": %llu ns\n", var); \
221+ if (var > INT_MAX) { \
222+ skip = true; \
223+ ret |= 1; \
224+ } \
204225 } while (0)
205226
206227 ESTIMATE("total seccomp overhead for 1 bitmapped filter", calc,
@@ -218,31 +239,34 @@ int main(int argc, char *argv[]) · 11 unmodified lines
218239 ESTIMATE("seccomp per-filter overhead (filters / 4)", per_filter2,
219240 (filter2 - native - entry) / 4);
220241
221− printf("Expectations:\n");
222− ret |= compare("native", "≤", "1 bitmap", native, le, bitmap1);
223− bits = compare("native", "≤", "1 filter", native, le, filter1);
242+ ksft_print_msg("Expectations:\n");
243+ ret |= compare("native", "≤", "1 bitmap", native, le, bitmap1,
244+ skip);
245+ bits = compare("native", "≤", "1 filter", native, le, filter1,
246+ skip);
224247 if (bits)
225− goto more_samples;
248+ skip = true;
226249
227250 ret |= compare("per-filter (last 2 diff)", "≈", "per-filter (filters / 4)",
228− per_filter1, approx, per_filter2);
251+ per_filter1, approx, per_filter2, skip);
229252
230253 bits = compare("1 bitmapped", "≈", "2 bitmapped",
231− bitmap1 - native, approx, bitmap2 - native);
254+ bitmap1 - native, approx, bitmap2 - native, skip);
232255 if (bits) {
233− printf("Skipping constant action bitmap expectations: they appear unsupported.\n");
234− goto out;
256+ ksft_print_msg("Skipping constant action bitmap expectations: they appear unsupported.\n");
257+ skip = true;
235258 }
236259
237− ret |= compare("entry", "≈", "1 bitmapped", entry, approx, bitmap1 - native);
238− ret |= compare("entry", "≈", "2 bitmapped", entry, approx, bitmap2 - native);
260+ ret |= compare("entry", "≈", "1 bitmapped", entry, approx,
261+ bitmap1 - native, skip);
262+ ret |= compare("entry", "≈", "2 bitmapped", entry, approx,
263+ bitmap2 - native, skip);
239264 ret |= compare("native + entry + (per filter * 4)", "≈", "4 filters total",
240− entry + (per_filter1 * 4) + native, approx, filter2);
241− if (ret == 0)
242− goto out;
265+ entry + (per_filter1 * 4) + native, approx, filter2,
266+ skip);
243267
244−more_samples:
245− printf("Saw unexpected benchmark result. Try running again with more samples?\n");
246−out:
247− return 0;
268+ if (ret)
269+ ksft_print_msg("Saw unexpected benchmark result. Try running again with more samples?\n");
270+
271+ ksft_finished();
248272 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t