History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf bpf-6.14-rc4

Cross-merge bpf fixes after downstream PR (bpf-6.14-rc4). Minor conflict: kernel/bpf/btf.c Adjacent changes: kernel/bpf/arena.c kernel/bpf/btf.c kernel/bpf/syscall.c kernel/bpf/verifier.c mm/memory.c

Alexei Starovoitov committed 1 year ago

Commit bd4319b2 parents 7042882 319fc77727 files · +8714 −4714Browse files

Unified · Split

727 files
  1. .mailmap +5 −0
  2. CREDITS +2 −4
  3. Documentation/arch/arm64/gcs.rst +1 −1
  4. Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +3 −0
  5. Documentation/devicetree/bindings/clock/qcom,sa8775p-camcc.yaml +5 −1
  6. Documentation/devicetree/bindings/clock/qcom,sa8775p-videocc.yaml +1 −0
  7. Documentation/devicetree/bindings/display/panel/powertip,hx8238a.yaml +29 −0
  8. Documentation/devicetree/bindings/display/panel/powertip,st7272.yaml +29 −0
  9. Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml +1 −1
  10. Documentation/devicetree/bindings/interrupt-controller/microchip,lan966x-oic.yaml +2 −3
  11. Documentation/devicetree/bindings/net/wireless/qcom,ath10k.yaml +0 −1
  12. Documentation/devicetree/bindings/net/wireless/qcom,ath11k-pci.yaml +0 −1
  13. Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml +0 −1
  14. Documentation/devicetree/bindings/net/wireless/qcom,ath12k-wsi.yaml +0 −1
  15. Documentation/devicetree/bindings/net/wireless/qcom,ath12k.yaml +0 −1
  16. Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml +1 −0
  17. Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml +1 −1
  18. Documentation/driver-api/infrastructure.rst +6 −0
  19. Documentation/filesystems/bcachefs/SubmittingPatches.rst +98 −0
  20. Documentation/filesystems/bcachefs/index.rst +1 −0
  21. Documentation/netlink/specs/ethtool.yaml +2 −1
  22. Documentation/networking/iso15765-2.rst +2 −2
  23. Documentation/networking/strparser.rst +8 −1
  24. Documentation/process/embargoed-hardware-issues.rst +1 −1
  25. Documentation/translations/sp_SP/process/embargoed-hardware-issues.rst +1 −1
  26. Documentation/virt/kvm/api.rst +1 −1
  27. MAINTAINERS +73 −23
  28. Makefile +5 −10
  29. arch/alpha/include/asm/elf.h +1 −5
  30. arch/alpha/include/asm/hwrpb.h +1 −1
  31. arch/alpha/include/asm/pgtable.h +1 −1
  32. arch/alpha/include/asm/processor.h +2 −6
  33. arch/alpha/include/uapi/asm/ptrace.h +2 −0
  34. arch/alpha/kernel/asm-offsets.c +4 −0
  35. arch/alpha/kernel/entry.S +10 −14
  36. arch/alpha/kernel/osf_sys.c +2 −9
  37. arch/alpha/kernel/pci_iommu.c +2 −1
  38. arch/alpha/kernel/traps.c +1 −1
  39. arch/alpha/mm/fault.c +2 −2
  40. arch/arm64/Kconfig +0 −1
  41. arch/arm64/Makefile +4 −0
  42. arch/arm64/include/asm/kvm_emulate.h +0 −42
  43. arch/arm64/include/asm/kvm_host.h +6 −18
  44. arch/arm64/kernel/cacheinfo.c +7 −5
  45. arch/arm64/kernel/cpufeature.c +3 −2
  46. arch/arm64/kernel/fpsimd.c +0 −25
  47. arch/arm64/kernel/topology.c +10 −12
  48. arch/arm64/kernel/vdso/vdso.lds.S +1 −0
  49. arch/arm64/kernel/vmlinux.lds.S +1 −0
  50. arch/arm64/kvm/arch_timer.c +18 −47
  51. arch/arm64/kvm/arm.c +20 −8
  52. arch/arm64/kvm/fpsimd.c +9 −98
  53. arch/arm64/kvm/hyp/entry.S +5 −0
  54. arch/arm64/kvm/hyp/include/hyp/switch.h +111 −37
  55. arch/arm64/kvm/hyp/nvhe/hyp-main.c +31 −8
  56. arch/arm64/kvm/hyp/nvhe/mem_protect.c +41 −35
  57. arch/arm64/kvm/hyp/nvhe/switch.c +45 −44
  58. arch/arm64/kvm/hyp/vhe/switch.c +19 −14
  59. arch/arm64/kvm/nested.c +5 −4
  60. arch/arm64/kvm/sys_regs.c +13 −3
  61. arch/arm64/kvm/vgic/vgic-init.c +37 −37
  62. arch/arm64/mm/trans_pgd.c +7 −0
  63. arch/loongarch/include/asm/cpu-info.h +0 −21
  64. arch/loongarch/include/asm/smp.h +2 −0
  65. arch/loongarch/kernel/genex.S +15 −13
  66. arch/loongarch/kernel/idle.c +1 −2
  67. arch/loongarch/kernel/proc.c +3 −26
  68. arch/loongarch/kernel/reset.c +3 −3
  69. arch/loongarch/kvm/main.c +2 −2
  70. arch/loongarch/kvm/switch.S +1 −1
  71. arch/loongarch/kvm/vcpu.c +0 −3
  72. arch/loongarch/lib/csum.c +1 −1
  73. arch/loongarch/mm/pageattr.c +2 −1
  74. arch/mips/include/asm/ptrace.h +2 −2
  75. arch/mips/include/asm/syscall.h +8 −24
  76. arch/mips/kernel/asm-offsets.c +6 −0
  77. arch/mips/kernel/scall32-o32.S +4 −4
  78. arch/powerpc/include/asm/book3s/64/hash-4k.h +10 −2
  79. arch/powerpc/lib/code-patching.c +3 −1
  80. arch/powerpc/sysdev/fsl_msi.c +1 −1
  81. arch/s390/configs/debug_defconfig +0 −1
  82. arch/s390/configs/defconfig +0 −1
  83. arch/s390/configs/zfcpdump_defconfig +0 −1
  84. arch/s390/include/asm/bitops.h +5 −1
  85. arch/s390/include/asm/gmap.h +6 −14
  86. arch/s390/include/asm/kvm_host.h +5 −1
  87. arch/s390/include/asm/pgtable.h +18 −3
  88. arch/s390/include/asm/uv.h +3 −3
  89. arch/s390/kernel/uv.c +29 −263
  90. arch/s390/kvm/Makefile +1 −1
  91. arch/s390/kvm/gaccess.c +43 −1
  92. arch/s390/kvm/gmap-vsie.c +142 −0
  93. arch/s390/kvm/gmap.c +212 −0
  94. arch/s390/kvm/gmap.h +39 −0
  95. arch/s390/kvm/intercept.c +4 −3
  96. arch/s390/kvm/interrupt.c +11 −8
  97. arch/s390/kvm/kvm-s390.c +197 −40
  98. arch/s390/kvm/kvm-s390.h +19 −0
  99. arch/s390/kvm/pv.c +21 −0
  100. arch/s390/kvm/vsie.c +68 −38
  101. arch/s390/mm/gmap.c +150 −531
  102. arch/s390/mm/pgalloc.c +0 −2
  103. arch/s390/pci/pci_bus.c +20 −0
  104. arch/s390/pci/pci_iov.c +42 −14
  105. arch/s390/pci/pci_iov.h +7 −0
  106. arch/um/drivers/virt-pci.c +102 −96
  107. arch/um/drivers/virtio_uml.c +4 −4
  108. arch/um/kernel/irq.c +47 −32
  109. arch/um/kernel/process.c +9 −1
  110. arch/um/os-Linux/skas/process.c +13 −3
  111. arch/x86/Kconfig +2 −1
  112. arch/x86/boot/compressed/Makefile +1 −0
  113. arch/x86/events/intel/core.c +14 −19
  114. arch/x86/events/intel/ds.c +9 −1
  115. arch/x86/events/rapl.c +4 −8
  116. arch/x86/include/asm/kvm-x86-ops.h +1 −0
  117. arch/x86/include/asm/kvm_host.h +1 −0
  118. arch/x86/include/asm/msr-index.h +2 −1
  119. arch/x86/include/asm/perf_event.h +25 −3
  120. arch/x86/include/asm/sev.h +2 −0
  121. arch/x86/kernel/cpu/bugs.c +14 −7
  122. arch/x86/kvm/cpuid.c +1 −1
  123. arch/x86/kvm/hyperv.c +5 −1
  124. arch/x86/kvm/mmu/mmu.c +27 −8
  125. arch/x86/kvm/svm/nested.c +5 −5
  126. arch/x86/kvm/svm/sev.c +10 −0
  127. arch/x86/kvm/svm/svm.c +6 −7
  128. arch/x86/kvm/vmx/main.c +1 −0
  129. arch/x86/kvm/vmx/vmx.c +6 −4
  130. arch/x86/kvm/vmx/x86_ops.h +1 −0
  131. arch/x86/kvm/x86.c +4 −6
  132. arch/x86/um/os-Linux/registers.c +18 −3
  133. arch/x86/um/signal.c +10 −3
  134. arch/x86/virt/svm/sev.c +7 −16
  135. arch/x86/xen/mmu_pv.c +62 −9
  136. arch/x86/xen/xen-head.S +3 −8
  137. block/partitions/mac.c +15 −3
  138. drivers/accel/amdxdna/amdxdna_pci_drv.c +5 −0
  139. drivers/accel/ivpu/ivpu_drv.c +6 −2
  140. drivers/accel/ivpu/ivpu_pm.c +47 −37
  141. drivers/acpi/arm64/gtdt.c +8 −4
  142. drivers/acpi/prmt.c +1 −3
  143. drivers/acpi/property.c +5 −5
  144. drivers/acpi/resource.c +6 −0
  145. drivers/base/Makefile +1 −1
  146. drivers/base/base.h +1 −0
  147. drivers/base/faux.c +232 −0
  148. drivers/base/init.c +1 −0
  149. drivers/base/power/main.c +9 −12
  150. drivers/base/regmap/regmap-irq.c +2 −0
  151. drivers/block/sunvdc.c +2 −2
  152. drivers/bluetooth/btintel_pcie.c +4 −1
  153. drivers/bus/moxtet.c +1 −1
  154. drivers/cpufreq/Kconfig.arm +2 −1
  155. drivers/cpufreq/amd-pstate.c +10 −10
  156. drivers/cpufreq/cpufreq.c +2 −1
  157. drivers/crypto/ccp/sp-dev.c +14 −0
  158. drivers/dma/tegra210-adma.c +14 −3
  159. drivers/firmware/Kconfig +1 −1
  160. drivers/firmware/efi/efi.c +4 −2
  161. drivers/firmware/efi/libstub/randomalloc.c +3 −0
  162. drivers/firmware/efi/libstub/relocate.c +3 −0
  163. drivers/firmware/iscsi_ibft.c +4 −1
  164. drivers/gpio/Kconfig +1 −0
  165. drivers/gpio/gpio-bcm-kona.c +58 −13
  166. drivers/gpio/gpio-pca953x.c +0 −19
  167. drivers/gpio/gpio-sim.c +8 −5
  168. drivers/gpio/gpio-stmpe.c +12 −3
  169. drivers/gpio/gpiolib-acpi.c +14 −0
  170. drivers/gpio/gpiolib.c +3 −3
  171. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 −1
  172. drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 −2
  173. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 −2
  174. drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +2 −0
  175. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +34 −2
  176. drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +3 −2
  177. drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h +2 −1
  178. drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm +4 −0
  179. drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +1 −1
  180. drivers/gpu/drm/amd/display/dc/core/dc.c +1 −1
  181. drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c +1 −2
  182. drivers/gpu/drm/amd/display/dc/dml/Makefile +9 −5
  183. drivers/gpu/drm/amd/display/dc/dml2/Makefile +13 −9
  184. drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c +2 −2
  185. drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c +3 −3
  186. drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c +2 −1
  187. drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c +2 −1
  188. drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c +2 −1
  189. drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c +2 −1
  190. drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c +2 −0
  191. drivers/gpu/drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c +2 −0
  192. drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +2 −1
  193. drivers/gpu/drm/amd/pm/amdgpu_dpm.c +1 −1
  194. drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 −1
  195. drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +4 −0
  196. drivers/gpu/drm/ast/ast_dp.c +1 −1
  197. drivers/gpu/drm/display/drm_dp_cec.c +3 −11
  198. drivers/gpu/drm/display/drm_dp_helper.c +1 −1
  199. drivers/gpu/drm/hisilicon/hibmc/Kconfig +2 −0
  200. drivers/gpu/drm/i915/display/intel_backlight.c +3 −2
  201. drivers/gpu/drm/i915/display/intel_dp.c +5 −7
  202. drivers/gpu/drm/i915/display/intel_dp_mst.c +4 −0
  203. drivers/gpu/drm/i915/display/intel_hdcp.c +14 −1
  204. drivers/gpu/drm/i915/display/skl_universal_plane.c +0 −4
  205. drivers/gpu/drm/i915/gem/i915_gem_shmem.c +1 −5
  206. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +30 −6
  207. drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +2 −2
  208. drivers/gpu/drm/panthor/panthor_drv.c +1 −0
  209. drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +103 −97
  210. drivers/gpu/drm/xe/regs/xe_oa_regs.h +6 −0
  211. drivers/gpu/drm/xe/xe_devcoredump.c +14 −26
  212. drivers/gpu/drm/xe/xe_devcoredump.h +1 −1
  213. drivers/gpu/drm/xe/xe_drm_client.c +1 −1
  214. drivers/gpu/drm/xe/xe_gt.c +3 −1
  215. drivers/gpu/drm/xe/xe_gt_sriov_pf.c +13 −1
  216. drivers/gpu/drm/xe/xe_gt_sriov_pf.h +6 −0
  217. drivers/gpu/drm/xe/xe_guc_ct.c +2 −1
  218. drivers/gpu/drm/xe/xe_guc_log.c +3 −1
  219. drivers/gpu/drm/xe/xe_oa.c +13 −8
  220. drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c +30 −24
  221. drivers/gpu/host1x/dev.c +2 −0
  222. drivers/gpu/host1x/intr.c +0 −2
  223. drivers/hid/Kconfig +10 −5
  224. drivers/hid/amd-sfh-hid/Kconfig +0 −1
  225. drivers/hid/hid-apple.c +8 −0
  226. drivers/hid/hid-corsair-void.c +2 −1
  227. drivers/hid/hid-ids.h +3 −0
  228. drivers/hid/hid-lenovo.c +1 −6
  229. drivers/hid/hid-multitouch.c +4 −1
  230. drivers/hid/hid-quirks.c +1 −0
  231. drivers/hid/hid-steam.c +35 −11
  232. drivers/hid/hid-thrustmaster.c +1 −1
  233. drivers/hid/hid-topre.c +7 −0
  234. drivers/hid/hid-winwing.c +2 −0
  235. drivers/hid/i2c-hid/Kconfig +1 −1
  236. drivers/hid/intel-ish-hid/Kconfig +0 −1
  237. drivers/hid/intel-ish-hid/ipc/hw-ish.h +2 −0
  238. drivers/hid/intel-ish-hid/ipc/ipc.c +9 −6
  239. drivers/hid/intel-ish-hid/ipc/pci-ish.c +7 −0
  240. drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h +2 −0
  241. drivers/hid/intel-thc-hid/Kconfig +0 −1
  242. drivers/hid/surface-hid/Kconfig +0 −2
  243. drivers/hid/usbhid/Kconfig +1 −2
  244. drivers/i2c/i2c-core-base.c +75 −38
  245. drivers/iommu/amd/amd_iommu_types.h +1 −0
  246. drivers/iommu/amd/init.c +34 −4
  247. drivers/iommu/exynos-iommu.c +3 −3
  248. drivers/iommu/intel/prq.c +3 −1
  249. drivers/iommu/io-pgfault.c +1 −0
  250. drivers/iommu/iommu.c +1 −1
  251. drivers/irqchip/Kconfig +1 −0
  252. drivers/irqchip/irq-apple-aic.c +2 −1
  253. drivers/irqchip/irq-mvebu-icu.c +2 −1
  254. drivers/irqchip/irq-partition-percpu.c +1 −1
  255. drivers/irqchip/irq-riscv-imsic-early.c +1 −1
  256. drivers/irqchip/irq-thead-c900-aclint-sswi.c +1 −1
  257. drivers/md/md-linear.c +1 −3
  258. drivers/mfd/syscon.c +26 −3
  259. drivers/mmc/host/mtk-sd.c +20 −11
  260. drivers/mmc/host/sdhci_am654.c +0 −30
  261. drivers/net/can/c_can/c_can_platform.c +3 −2
  262. drivers/net/can/ctucanfd/ctucanfd_base.c +6 −4
  263. drivers/net/can/rockchip/rockchip_canfd-core.c +1 −1
  264. drivers/net/can/usb/etas_es58x/es58x_devlink.c +5 −1
  265. drivers/net/ethernet/aquantia/atlantic/aq_nic.c +3 −1
  266. drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +12 −4
  267. drivers/net/ethernet/broadcom/tg3.c +58 −0
  268. drivers/net/ethernet/google/gve/gve.h +10 −0
  269. drivers/net/ethernet/google/gve/gve_main.c +5 −1
  270. drivers/net/ethernet/ibm/ibmvnic.c +3 −1
  271. drivers/net/ethernet/intel/iavf/iavf_main.c +1 −1
  272. drivers/net/ethernet/intel/ice/devlink/devlink.c +3 −0
  273. drivers/net/ethernet/intel/ice/ice_txrx.c +103 −47
  274. drivers/net/ethernet/intel/ice/ice_txrx.h +0 −1
  275. drivers/net/ethernet/intel/ice/ice_txrx_lib.h +0 −43
  276. drivers/net/ethernet/intel/idpf/idpf_lib.c +5 −0
  277. drivers/net/ethernet/intel/idpf/idpf_txrx.c +1 −4
  278. drivers/net/ethernet/intel/igc/igc_main.c +13 −9
  279. drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 −1
  280. drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c +3 −1
  281. drivers/net/ethernet/netronome/nfp/bpf/cmsg.c +2 −0
  282. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +22 −18
  283. drivers/net/ethernet/ti/am65-cpsw-nuss.c +31 −19
  284. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 −0
  285. drivers/net/geneve.c +2 −14
  286. drivers/net/gtp.c +0 −5
  287. drivers/net/phy/phylink.c +9 −6
  288. drivers/net/pse-pd/pd692x0.c +1 −1
  289. drivers/net/pse-pd/pse_core.c +2 −2
  290. drivers/net/team/team_core.c +3 −1
  291. drivers/net/tun.c +5 −9
  292. drivers/net/vmxnet3/vmxnet3_xdp.c +12 −2
  293. drivers/net/vxlan/vxlan_core.c +5 −2
  294. drivers/net/wireless/ath/ath12k/wmi.c +45 −16
  295. drivers/net/wireless/ath/ath12k/wmi.h +0 −1
  296. drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +2 −2
  297. drivers/net/wwan/mhi_wwan_mbim.c +1 −1
  298. drivers/nvme/host/core.c +7 −1
  299. drivers/nvme/host/fc.c +25 −10
  300. drivers/nvme/host/pci.c +3 −9
  301. drivers/nvme/host/sysfs.c +1 −1
  302. drivers/nvme/target/admin-cmd.c +1 −0
  303. drivers/nvme/target/fabrics-cmd.c +1 −1
  304. drivers/nvme/target/io-cmd-bdev.c +1 −1
  305. drivers/nvme/target/nvmet.h +1 −1
  306. drivers/of/address.c +4 −1
  307. drivers/of/of_private.h +4 −0
  308. drivers/of/of_test.c +118 −1
  309. drivers/pci/pcie/aspm.c +0 −3
  310. drivers/pci/probe.c +3 −2
  311. drivers/pci/quirks.c +2 −1
  312. drivers/pci/tph.c +1 −1
  313. drivers/pinctrl/pinconf-generic.c +4 −4
  314. drivers/pinctrl/pinctrl-cy8c95x0.c +25 −17
  315. drivers/platform/x86/ideapad-laptop.c +1 −1
  316. drivers/platform/x86/intel/ifs/ifs.h +4 −5
  317. drivers/platform/x86/intel/int3472/discrete.c +65 −20
  318. drivers/platform/x86/intel/pmc/core.c +2 −2
  319. drivers/platform/x86/thinkpad_acpi.c +45 −16
  320. drivers/powercap/powercap_sys.c +1 −2
  321. drivers/ptp/ptp_vmclock.c +21 −26
  322. drivers/regulator/core.c +27 −34
  323. drivers/s390/cio/chp.c +2 −1
  324. drivers/s390/net/ism_drv.c +12 −2
  325. drivers/s390/net/qeth_core_main.c +5 −3
  326. drivers/scsi/qla1280.c +1 −1
  327. drivers/scsi/scsi_lib.c +7 −2
  328. drivers/scsi/scsi_lib_test.c +7 −0
  329. drivers/scsi/scsi_scan.c +1 −1
  330. drivers/scsi/storvsc_drv.c +1 −0
  331. drivers/soc/qcom/smp2p.c +1 −1
  332. drivers/spi/atmel-quadspi.c +2 −2
  333. drivers/spi/spi-pxa2xx.c +1 −1
  334. drivers/spi/spi-sn-f-ospi.c +3 −0
  335. drivers/target/target_core_stat.c +2 −2
  336. drivers/thermal/cpufreq_cooling.c +0 −2
  337. drivers/tty/pty.c +1 −1
  338. drivers/tty/serial/8250/8250.h +2 −0
  339. drivers/tty/serial/8250/8250_dma.c +16 −0
  340. drivers/tty/serial/8250/8250_of.c +0 −1
  341. drivers/tty/serial/8250/8250_platform.c +0 −9
  342. drivers/tty/serial/8250/8250_pnp.c +0 −10
  343. drivers/tty/serial/8250/8250_port.c +9 −0
  344. drivers/tty/serial/sc16is7xx.c +1 −1
  345. drivers/tty/serial/serial_port.c +7 −5
  346. drivers/ufs/core/ufshcd.c +35 −33
  347. drivers/ufs/host/ufshcd-pci.c +0 −2
  348. drivers/ufs/host/ufshcd-pltfrm.c +9 −19
  349. drivers/usb/class/cdc-acm.c +21 −7
  350. drivers/usb/core/hub.c +12 −2
  351. drivers/usb/core/quirks.c +6 −0
  352. drivers/usb/dwc2/gadget.c +1 −0
  353. drivers/usb/dwc3/core.h +1 −0
  354. drivers/usb/dwc3/gadget.c +34 −0
  355. drivers/usb/gadget/function/f_midi.c +14 −5
  356. drivers/usb/gadget/function/uvc_video.c +1 −1
  357. drivers/usb/gadget/udc/core.c +1 −1
  358. drivers/usb/gadget/udc/renesas_usb3.c +1 −1
  359. drivers/usb/host/pci-quirks.c +9 −0
  360. drivers/usb/host/xhci-pci.c +4 −3
  361. drivers/usb/phy/phy-generic.c +1 −1
  362. drivers/usb/roles/class.c +3 −2
  363. drivers/usb/serial/option.c +29 −20
  364. drivers/usb/typec/tcpm/tcpm.c +1 −2
  365. drivers/xen/swiotlb-xen.c +13 −9
  366. fs/bcachefs/Kconfig +7 −0
  367. fs/bcachefs/alloc_background.c +25 −22
  368. fs/bcachefs/alloc_foreground.c +7 −3
  369. fs/bcachefs/alloc_types.h +1 −0
  370. fs/bcachefs/btree_iter.c +32 −1
  371. fs/bcachefs/btree_iter.h +13 −1
  372. fs/bcachefs/btree_key_cache.c +0 −1
  373. fs/bcachefs/btree_trans_commit.c +4 −0
  374. fs/bcachefs/btree_types.h +3 −0
  375. fs/bcachefs/btree_update_interior.c +2 −0
  376. fs/bcachefs/btree_update_interior.h +2 −2
  377. fs/bcachefs/buckets_waiting_for_journal.c +5 −7
  378. fs/bcachefs/buckets_waiting_for_journal.h +2 −2
  379. fs/bcachefs/disk_accounting.h +2 −0
  380. fs/bcachefs/fsck.c +31 −47
  381. fs/bcachefs/inode.h +3 −1
  382. fs/bcachefs/io_write.c +11 −1
  383. fs/bcachefs/journal.c +16 −2
  384. fs/bcachefs/journal.h +1 −0
  385. fs/bcachefs/journal_reclaim.c +18 −19
  386. fs/bcachefs/journal_types.h +5 −1
  387. fs/bcachefs/opts.h +0 −14
  388. fs/bcachefs/rebalance.c +3 −5
  389. fs/bcachefs/rebalance.h +20 −0
  390. fs/bcachefs/reflink.c +8 −8
  391. fs/bcachefs/sb-downgrade.c +1 −1
  392. fs/bcachefs/sb-errors_format.h +2 −2
  393. fs/bcachefs/subvolume.c +6 −1
  394. fs/bcachefs/super.c +11 −0
  395. fs/bcachefs/super.h +1 −0
  396. fs/bcachefs/trace.h +13 −1
  397. fs/btrfs/ctree.c +2 −0
  398. fs/btrfs/extent_io.c +20 −9
  399. fs/btrfs/file.c +1 −3
  400. fs/btrfs/ordered-data.c +12 −0
  401. fs/btrfs/qgroup.c +5 −6
  402. fs/btrfs/transaction.c +3 −1
  403. fs/dcache.c +3 −3
  404. fs/erofs/zdata.c +1 −1
  405. fs/file_table.c +16 −0
  406. fs/gfs2/glock.c +1 −1
  407. fs/gfs2/main.c +0 −1
  408. fs/gfs2/quota.c +2 −2
  409. fs/namespace.c +30 −24
  410. fs/netfs/buffered_read.c +13 −6
  411. fs/netfs/internal.h +4 −0
  412. fs/netfs/read_collect.c +4 −2
  413. fs/netfs/read_retry.c +33 −10
  414. fs/netfs/stats.c +9 −0
  415. fs/netfs/write_issue.c +1 −0
  416. fs/netfs/write_retry.c +2 −0
  417. fs/nfsd/filecache.c +10 −1
  418. fs/nfsd/nfs2acl.c +2 −0
  419. fs/nfsd/nfs3acl.c +2 −0
  420. fs/nfsd/nfs4callback.c +6 −3
  421. fs/nfsd/nfs4state.c +2 −1
  422. fs/nfsd/nfsfh.c +3 −2
  423. fs/notify/fsnotify.c +12 −6
  424. fs/open.c +6 −5
  425. fs/pidfs.c +11 −1
  426. fs/pipe.c +6 −0
  427. fs/proc/vmcore.c +4 −1
  428. fs/smb/client/cifsglob.h +10 −10
  429. fs/smb/client/dfs.c +16 −14
  430. fs/smb/client/dfs.h +7 −0
  431. fs/smb/client/dfs_cache.c +5 −22
  432. fs/smb/client/file.c +4 −3
  433. fs/smb/client/inode.c +15 −2
  434. fs/smb/client/reparse.c +2 −3
  435. fs/smb/client/reparse.h +22 −6
  436. fs/smb/client/smb1ops.c +1 −1
  437. fs/smb/client/smb2inode.c +4 −0
  438. fs/smb/client/smb2ops.c +11 −10
  439. fs/smb/client/smb2pdu.c +2 −2
  440. fs/smb/client/smb2proto.h +1 −1
  441. fs/smb/common/smb2pdu.h +20 −10
  442. fs/smb/common/smbfsctl.h +3 −0
  443. fs/stat.c +3 −1
  444. fs/vboxsf/super.c +2 −1
  445. fs/xfs/libxfs/xfs_bmap.c +7 −6
  446. fs/xfs/scrub/common.h +0 −5
  447. fs/xfs/scrub/inode_repair.c +10 −2
  448. fs/xfs/scrub/repair.h +10 −1
  449. fs/xfs/scrub/scrub.c +12 −0
  450. fs/xfs/xfs_aops.c +37 −4
  451. fs/xfs/xfs_buf.c +17 −19
  452. fs/xfs/xfs_buf.h +0 −1
  453. fs/xfs/xfs_exchrange.c +27 −44
  454. fs/xfs/xfs_inode.c +5 −2
  455. fs/xfs/xfs_iomap.c +2 −4
  456. fs/xfs/xfs_qm_bhv.c +39 −16
  457. fs/xfs/xfs_super.c +6 −2
  458. include/asm-generic/vmlinux.lds.h +1 −0
  459. include/drm/display/drm_dp.h +1 −0
  460. include/drm/drm_print.h +1 −0
  461. include/dt-bindings/clock/qcom,qcs8300-camcc.h +16 −0
  462. include/dt-bindings/clock/qcom,qcs8300-gpucc.h +17 −0
  463. include/linux/blk-mq.h +14 −4
  464. include/linux/cgroup-defs.h +3 −3
  465. include/linux/compiler.h +19 −13
  466. include/linux/device/faux.h +69 −0
  467. include/linux/efi.h +16 −15
  468. include/linux/fs.h +19 −1
  469. include/linux/fsnotify.h +2 −2
  470. include/linux/hrtimer_defs.h +1 −0
  471. include/linux/i2c.h +8 −2
  472. include/linux/jiffies.h +1 −1
  473. include/linux/kvm_host.h +0 −1
  474. include/linux/lockref.h +4 −3
  475. include/linux/module.h +4 −1
  476. include/linux/netdevice.h +9 −2
  477. include/linux/netfs.h +1 −1
  478. include/linux/pci_ids.h +1 −0
  479. include/linux/psp-sev.h +9 −0
  480. include/linux/sched/task.h +1 −0
  481. include/linux/skmsg.h +2 −0
  482. include/linux/string.h +8 −4
  483. include/net/bluetooth/l2cap.h +2 −1
  484. include/net/gro.h +3 −0
  485. include/net/ip.h +10 −3
  486. include/net/l3mdev.h +2 −0
  487. include/net/net_namespace.h +12 −1
  488. include/net/route.h +7 −2
  489. include/net/sch_generic.h +1 −1
  490. include/net/strparser.h +2 −0
  491. include/net/tcp.h +22 −0
  492. include/trace/events/netfs.h +3 −1
  493. include/trace/events/rxrpc.h +1 −0
  494. include/uapi/drm/amdgpu_drm.h +8 −1
  495. include/uapi/linux/ethtool.h +2 −0
  496. include/uapi/linux/taskstats.h +1 −1
  497. include/uapi/linux/thermal.h +1 −1
  498. include/uapi/linux/virtio_snd.h +1 −1
  499. include/ufs/ufs.h +2 −2
  500. include/ufs/ufshcd.h +0 −1
  501. io_uring/futex.c +1 −1
  502. io_uring/kbuf.c +12 −4
  503. io_uring/uring_cmd.c +9 −19
  504. io_uring/waitid.c +9 −9
  505. kernel/acct.c +84 −50
  506. kernel/bpf/arena.c +1 −1
  507. kernel/bpf/bpf_cgrp_storage.c +1 −1
  508. kernel/bpf/btf.c +2 −0
  509. kernel/bpf/ringbuf.c +0 −4
  510. kernel/bpf/syscall.c +22 −21
  511. kernel/bpf/verifier.c +23 −8
  512. kernel/cgroup/cgroup.c +12 −8
  513. kernel/cgroup/rstat.c +0 −1
  514. kernel/futex/core.c +3 −2
  515. kernel/futex/futex.h +8 −3
  516. kernel/futex/pi.c +1 −1
  517. kernel/futex/waitwake.c +2 −2
  518. kernel/irq/Kconfig +0 −4
  519. kernel/kthread.c +2 −2
  520. kernel/sched/autogroup.c +2 −2
  521. kernel/sched/core.c +7 −5
  522. kernel/sched/debug.c +2 −0
  523. kernel/sched/ext.c +76 −37
  524. kernel/sched/ext.h +2 −2
  525. kernel/sched/fair.c +19 −0
  526. kernel/sched/sched.h +1 −1
  527. kernel/seccomp.c +12 −0
  528. kernel/time/clocksource.c +6 −3
  529. kernel/time/hrtimer.c +94 −31
  530. kernel/time/timer_migration.c +9 −1
  531. kernel/trace/ring_buffer.c +26 −2
  532. kernel/trace/trace.c +5 −7
  533. kernel/trace/trace_functions_graph.c +1 −1
  534. kernel/workqueue.c +6 −6
  535. lib/iov_iter.c +2 −1
  536. lib/stackinit_kunit.c +4 −2
  537. lib/test_xarray.c +8 −7
  538. mm/hugetlb.c +1 −1
  539. mm/kasan/report.c +33 −1
  540. mm/madvise.c +10 −1
  541. mm/memcontrol.c +1 −0
  542. mm/memory.c +14 −3
  543. mm/migrate_device.c +4 −9
  544. mm/zswap.c +16 −19
  545. net/ax25/af_ax25.c +11 −0
  546. net/batman-adv/bat_v.c +0 −2
  547. net/batman-adv/bat_v_elp.c +86 −36
  548. net/batman-adv/bat_v_elp.h +0 −2
  549. net/batman-adv/translation-table.c +5 −7
  550. net/batman-adv/types.h +0 −3
  551. net/bluetooth/hidp/Kconfig +1 −2
  552. net/bluetooth/l2cap_core.c +79 −90
  553. net/bluetooth/l2cap_sock.c +7 −8
  554. net/bpf/test_run.c +1 −4
  555. net/can/j1939/socket.c +2 −2
  556. net/can/j1939/transport.c +3 −2
  557. net/core/bpf_sk_storage.c +1 −12
  558. net/core/dev.c +111 −11
  559. net/core/drop_monitor.c +14 −15
  560. net/core/fib_rules.c +13 −11
  561. net/core/flow_dissector.c +40 −30
  562. net/core/gro.c +0 −3
  563. net/core/neighbour.c +6 −2
  564. net/core/net_namespace.c +4 −4
  565. net/core/rtnetlink.c +1 −0
  566. net/core/skbuff.c +10 −100
  567. net/core/skmsg.c +7 −0
  568. net/core/sock_map.c +7 −1
  569. net/ethtool/common.c +5 −0
  570. net/ethtool/common.h +2 −0
  571. net/ethtool/ioctl.c +1 −1
  572. net/ethtool/rss.c +2 −1
  573. net/ethtool/strset.c +5 −0
  574. net/ethtool/tsconfig.c +23 −10
  575. net/ipv4/arp.c +4 −2
  576. net/ipv4/devinet.c +2 −1
  577. net/ipv4/icmp.c +17 −14
  578. net/ipv4/route.c +21 −9
  579. net/ipv4/tcp.c +24 −5
  580. net/ipv4/tcp_bpf.c +36 −0
  581. net/ipv4/tcp_fastopen.c +2 −2
  582. net/ipv4/tcp_input.c +13 −7
  583. net/ipv4/tcp_ipv4.c +1 −1
  584. net/ipv4/udp.c +2 −2
  585. net/ipv6/icmp.c +23 −19
  586. net/ipv6/ioam6_iptunnel.c +9 −5
  587. net/ipv6/ip6_input.c +9 −5
  588. net/ipv6/mcast.c +25 −20
  589. net/ipv6/ndisc.c +13 −11
  590. net/ipv6/route.c +6 −1
  591. net/ipv6/rpl_iptunnel.c +10 −5
  592. net/ipv6/seg6_iptunnel.c +10 −5
  593. net/ipv6/udp.c +2 −2
  594. net/netfilter/nf_flow_table_ip.c +2 −6
  595. net/openvswitch/datapath.c +9 −3
  596. net/rose/af_rose.c +16 −8
  597. net/rxrpc/ar-internal.h +4 −5
  598. net/rxrpc/call_object.c +2 −4
  599. net/rxrpc/conn_event.c +11 −10
  600. net/rxrpc/conn_object.c +1 −0
  601. net/rxrpc/input.c +10 −2
  602. net/rxrpc/output.c +35 −15
  603. net/rxrpc/peer_event.c +7 −0
  604. net/rxrpc/rxkad.c +5 −8
  605. net/rxrpc/sendmsg.c +2 −4
  606. net/rxrpc/txbuf.c +10 −27
  607. net/sched/cls_api.c +1 −1
  608. net/sched/sch_fifo.c +3 −0
  609. net/sched/sch_netem.c +1 −1
  610. net/sctp/stream.c +1 −1
  611. net/socket.c +5 −0
  612. net/strparser/strparser.c +9 −2
  613. net/vmw_vsock/af_vsock.c +10 −1
  614. net/vmw_vsock/virtio_transport.c +7 −3
  615. net/vmw_vsock/vsock_bpf.c +1 −1
  616. rust/Makefile +3 −2
  617. rust/bindings/bindings_helper.h +1 −0
  618. rust/kernel/faux.rs +67 −0
  619. rust/kernel/init.rs +1 −1
  620. rust/kernel/lib.rs +1 −0
  621. rust/kernel/rbtree.rs +1 −1
  622. samples/hid/Makefile +7 −6
  623. samples/rust/Kconfig +10 −0
  624. samples/rust/Makefile +1 −0
  625. samples/rust/rust_driver_faux.rs +29 −0
  626. scripts/Makefile.extrawarn +9 −6
  627. scripts/Makefile.lib +1 −1
  628. scripts/generate_rust_target.rs +18 −0
  629. scripts/mod/modpost.c +37 −2
  630. scripts/mod/modpost.h +6 −0
  631. scripts/module.lds.S +1 −0
  632. scripts/package/install-extmod-build +2 −2
  633. security/tomoyo/common.c +112 −33
  634. security/tomoyo/domain.c +1 −1
  635. security/tomoyo/securityfs_if.c +3 −3
  636. security/tomoyo/tomoyo.c +1 −4
  637. sound/core/hrtimer.c +1 −2
  638. sound/core/seq/seq_clientmgr.c +9 −3
  639. sound/drivers/dummy.c +1 −2
  640. sound/drivers/pcsp/pcsp.c +1 −2
  641. sound/hda/intel-dsp-config.c +5 −0
  642. sound/pci/hda/hda_codec.c +3 −1
  643. sound/pci/hda/hda_intel.c +2 −0
  644. sound/pci/hda/patch_conexant.c +1 −0
  645. sound/pci/hda/patch_cs8409-tables.c +6 −6
  646. sound/pci/hda/patch_cs8409.c +16 −10
  647. sound/pci/hda/patch_cs8409.h +4 −3
  648. sound/pci/hda/patch_realtek.c +2 −0
  649. sound/pci/hda/tas2781_hda_spi.c +14 −13
  650. sound/pci/hda/tas2781_spi_fwlib.c +5 −5
  651. sound/sh/sh_dac_audio.c +1 −2
  652. sound/soc/codecs/arizona.c +7 −7
  653. sound/soc/codecs/cs35l41.c +23 −7
  654. sound/soc/codecs/madera.c +5 −5
  655. sound/soc/codecs/tas2781-i2c.c +1 −3
  656. sound/soc/codecs/wm5110.c +4 −4
  657. sound/soc/fsl/fsl_micfil.c +2 −0
  658. sound/soc/fsl/imx-audmix.c +0 −31
  659. sound/soc/generic/simple-card-utils.c +1 −0
  660. sound/soc/intel/boards/sof_sdw.c +35 −6
  661. sound/soc/intel/common/soc-acpi-intel-mtl-match.c +1 −1
  662. sound/soc/intel/common/soc-acpi-intel-ptl-match.c +6 −6
  663. sound/soc/intel/common/soc-acpi-intel-tgl-match.c +8 −8
  664. sound/soc/renesas/rcar/core.c +0 −14
  665. sound/soc/renesas/rcar/rsnd.h +0 −1
  666. sound/soc/renesas/rcar/src.c +93 −23
  667. sound/soc/renesas/rcar/ssi.c +2 −1
  668. sound/soc/rockchip/rockchip_i2s_tdm.c +2 −2
  669. sound/soc/sof/amd/acp-ipc.c +17 −8
  670. sound/soc/sof/amd/acp.c +1 −0
  671. sound/soc/sof/amd/acp.h +1 −0
  672. sound/soc/sof/amd/pci-vangogh.c +0 −2
  673. sound/soc/sof/amd/vangogh.c +18 −4
  674. sound/soc/sof/intel/hda-codec.c +1 −0
  675. sound/soc/sof/intel/pci-ptl.c +1 −0
  676. sound/soc/sof/ipc4-topology.c +10 −2
  677. sound/soc/sof/pcm.c +2 −0
  678. sound/soc/sof/stream-ipc.c +5 −1
  679. tools/accounting/getdelays.c +16 −16
  680. tools/mm/page-types.c +2 −2
  681. tools/objtool/check.c +11 −1
  682. tools/sched_ext/include/scx/common.bpf.h +22 −3
  683. tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c +44 −18
  684. tools/testing/selftests/bpf/prog_tests/flow_dissector_classification.c +6 −1
  685. tools/testing/selftests/bpf/prog_tests/sockmap_basic.c +55 −74
  686. tools/testing/selftests/bpf/prog_tests/sockmap_strp.c +454 −0
  687. tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c +2 −2
  688. tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c +4 −4
  689. tools/testing/selftests/bpf/progs/test_sockmap_strp.c +53 −0
  690. tools/testing/selftests/bpf/progs/verifier_array_access.c +15 −0
  691. tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh +1 −1
  692. tools/testing/selftests/drivers/net/hw/rss_ctx.py +8 −1
  693. tools/testing/selftests/filesystems/statmount/statmount_test.c +21 −1
  694. tools/testing/selftests/kvm/s390/cmma_test.c +2 −2
  695. tools/testing/selftests/kvm/s390/ucontrol_test.c +12 −20
  696. tools/testing/selftests/kvm/x86/hyperv_cpuid.c +32 −15
  697. tools/testing/selftests/livepatch/functions.sh +2 −1
  698. tools/testing/selftests/mm/run_vmtests.sh +1 −1
  699. tools/testing/selftests/net/forwarding/tc_flower_port_range.sh +46 −0
  700. tools/testing/selftests/net/mptcp/mptcp_connect.c +1 −1
  701. tools/testing/selftests/net/udpgso.c +26 −0
  702. tools/testing/selftests/sched_ext/create_dsq.c +5 −5
  703. tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c +5 −2
  704. tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c +5 −2
  705. tools/testing/selftests/sched_ext/dsp_local_on.bpf.c +1 −1
  706. tools/testing/selftests/sched_ext/dsp_local_on.c +1 −0
  707. tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c +5 −5
  708. tools/testing/selftests/sched_ext/enq_select_cpu_fails.c +5 −5
  709. tools/testing/selftests/sched_ext/exit.c +1 −0
  710. tools/testing/selftests/sched_ext/hotplug.c +4 −2
  711. tools/testing/selftests/sched_ext/init_enable_count.c +9 −18
  712. tools/testing/selftests/sched_ext/maximal.c +5 −2
  713. tools/testing/selftests/sched_ext/maybe_null.c +1 −1
  714. tools/testing/selftests/sched_ext/minimal.c +5 −5
  715. tools/testing/selftests/sched_ext/prog_run.c +5 −5
  716. tools/testing/selftests/sched_ext/reload_loop.c +4 −5
  717. tools/testing/selftests/sched_ext/select_cpu_dfl.c +5 −2
  718. tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.c +5 −2
  719. tools/testing/selftests/sched_ext/select_cpu_dispatch.c +5 −2
  720. tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.c +5 −2
  721. tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c +5 −2
  722. tools/testing/selftests/sched_ext/select_cpu_vtime.c +5 −2
  723. tools/testing/selftests/seccomp/seccomp_bpf.c +199 −0
  724. tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json +33 −1
  725. tools/testing/selftests/tc-testing/tc-tests/qdiscs/fifo.json +23 −0
  726. tools/testing/vsock/vsock_test.c +41 −0
  727. virt/kvm/kvm_main.c +9 −16
.mailmap+5−0
@@ -226,6 +226,7 @@ Fangrui Song <i@maskray.me> <maskray@google.com> · 225 unmodified lines
226226 Felipe W Damasio <felipewd@terra.com.br>
227227 Felix Kuhling <fxkuehl@gmx.de>
228228 Felix Moeller <felix@derklecks.de>
229+Feng Tang <feng.79.tang@gmail.com> <feng.tang@intel.com>
229230 Fenglin Wu <quic_fenglinw@quicinc.com> <fenglinw@codeaurora.org>
230231 Filipe Lautert <filipe@icewall.org>
231232 Finn Thain <fthain@linux-m68k.org> <fthain@telegraphics.com.au>
@@ -317,6 +318,8 @@ Jayachandran C <c.jayachandran@gmail.com> <jnair@caviumnetworks.com> · 85 unmodified lines
317318 Jean Tourrilhes <jt@hpl.hp.com>
318319 Jeevan Shriram <quic_jshriram@quicinc.com> <jshriram@codeaurora.org>
319320 Jeff Garzik <jgarzik@pretzel.yyz.us>
321+Jeff Johnson <jeff.johnson@oss.qualcomm.com> <jjohnson@codeaurora.org>
322+Jeff Johnson <jeff.johnson@oss.qualcomm.com> <quic_jjohnson@quicinc.com>
320323 Jeff Layton <jlayton@kernel.org> <jlayton@poochiereds.net>
321324 Jeff Layton <jlayton@kernel.org> <jlayton@primarydata.com>
322325 Jeff Layton <jlayton@kernel.org> <jlayton@redhat.com>
@@ -376,6 +379,7 @@ Juha Yrjola <juha.yrjola@solidboot.com> · 53 unmodified lines
376379 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com>
377380 Iskren Chernev <me@iskren.info> <iskren.chernev@gmail.com>
378381 Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org>
382+Kalle Valo <kvalo@kernel.org> <quic_kvalo@quicinc.com>
379383 Kalyan Thota <quic_kalyant@quicinc.com> <kalyan_t@codeaurora.org>
380384 Karthikeyan Periyasamy <quic_periyasa@quicinc.com> <periyasa@codeaurora.org>
381385 Kathiravan T <quic_kathirav@quicinc.com> <kathirav@codeaurora.org>
@@ -530,6 +534,7 @@ Nicholas Piggin <npiggin@gmail.com> <npiggin@kernel.dk> · 148 unmodified lines
530534 Nicholas Piggin <npiggin@gmail.com> <npiggin@suse.de>
531535 Nicholas Piggin <npiggin@gmail.com> <nickpiggin@yahoo.com.au>
532536 Nicholas Piggin <npiggin@gmail.com> <piggin@cyberone.com.au>
537+Nick Desaulniers <nick.desaulniers+lkml@gmail.com> <ndesaulniers@google.com>
533538 Nicolas Ferre <nicolas.ferre@microchip.com> <nicolas.ferre@atmel.com>
534539 Nicolas Pitre <nico@fluxnic.net> <nicolas.pitre@linaro.org>
535540 Nicolas Pitre <nico@fluxnic.net> <nico@linaro.org>
CREDITS+2−4
@@ -2515,11 +2515,9 @@ D: SLS distribution · 2514 unmodified lines
25152515 D: Initial implementation of VC's, pty's and select()
25162516
25172517 N: Pavel Machek
2518−E: pavel@ucw.cz
2518+E: pavel@kernel.org
25192519 P: 4096R/92DFCE96 4FA7 9EEF FCD4 C44F C585 B8C7 C060 2241 92DF CE96
2520−D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd,
2521−D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB,
2522−D: work on suspend-to-ram/disk, killing duplicates from ioctl32,
2520+D: NBD, Sun4/330 port, USB, work on suspend-to-ram/disk,
25232521 D: Altera SoCFPGA and Nokia N900 support.
25242522 S: Czech Republic
25252523
Documentation/arch/arm64/gcs.rst+1−1
@@ -37,7 +37,7 @@ intended to be exhaustive. · 36 unmodified lines
3737 shadow stacks rather than GCS.
3838
3939 * Support for GCS is reported to userspace via HWCAP_GCS in the aux vector
40− AT_HWCAP2 entry.
40+ AT_HWCAP entry.
4141
4242 * GCS is enabled per thread. While there is support for disabling GCS
4343 at runtime this should be done with great care.
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml+3−0
@@ -8,6 +8,7 @@ title: Qualcomm Graphics Clock & Reset Controller · 7 unmodified lines
88
99 maintainers:
1010 - Taniya Das <quic_tdas@quicinc.com>
11+ - Imran Shaik <quic_imrashai@quicinc.com>
1112
1213 description: |
1314 Qualcomm graphics clock control module provides the clocks, resets and power
@@ -23,10 +24,12 @@ description: | · 9 unmodified lines
2324 include/dt-bindings/clock/qcom,gpucc-sm8150.h
2425 include/dt-bindings/clock/qcom,gpucc-sm8250.h
2526 include/dt-bindings/clock/qcom,gpucc-sm8350.h
27+ include/dt-bindings/clock/qcom,qcs8300-gpucc.h
2628
2729 properties:
2830 compatible:
2931 enum:
32+ - qcom,qcs8300-gpucc
3033 - qcom,sdm845-gpucc
3134 - qcom,sa8775p-gpucc
3235 - qcom,sc7180-gpucc
Documentation/devicetree/bindings/clock/qcom,sa8775p-camcc.yaml+5−1
@@ -8,16 +8,20 @@ title: Qualcomm Camera Clock & Reset Controller on SA8775P · 7 unmodified lines
88
99 maintainers:
1010 - Taniya Das <quic_tdas@quicinc.com>
11+ - Imran Shaik <quic_imrashai@quicinc.com>
1112
1213 description: |
1314 Qualcomm camera clock control module provides the clocks, resets and power
1415 domains on SA8775p.
1516
16− See also: include/dt-bindings/clock/qcom,sa8775p-camcc.h
17+ See also:
18+ include/dt-bindings/clock/qcom,qcs8300-camcc.h
19+ include/dt-bindings/clock/qcom,sa8775p-camcc.h
1720
1821 properties:
1922 compatible:
2023 enum:
24+ - qcom,qcs8300-camcc
2125 - qcom,sa8775p-camcc
2226
2327 clocks:
Documentation/devicetree/bindings/clock/qcom,sa8775p-videocc.yaml+1−0
@@ -18,6 +18,7 @@ description: | · 17 unmodified lines
1818 properties:
1919 compatible:
2020 enum:
21+ - qcom,qcs8300-videocc
2122 - qcom,sa8775p-videocc
2223
2324 clocks:
Documentation/devicetree/bindings/display/panel/powertip,hx8238a.yaml+29−0
@@ -0,0 +1,29 @@
1+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/panel/powertip,hx8238a.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Powertip Electronic Technology Co. 320 x 240 LCD panel
8+
9+maintainers:
10+ - Lukasz Majewski <lukma@denx.de>
11+
12+allOf:
13+ - $ref: panel-dpi.yaml#
14+
15+properties:
16+ compatible:
17+ items:
18+ - const: powertip,hx8238a
19+ - {} # panel-dpi, but not listed here to avoid false select
20+
21+ height-mm: true
22+ panel-timing: true
23+ port: true
24+ power-supply: true
25+ width-mm: true
26+
27+additionalProperties: false
28+
29+...
Documentation/devicetree/bindings/display/panel/powertip,st7272.yaml+29−0
@@ -0,0 +1,29 @@
1+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+%YAML 1.2
3+---
4+$id: http://devicetree.org/schemas/display/panel/powertip,st7272.yaml#
5+$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+title: Powertip Electronic Technology Co. 320 x 240 LCD panel
8+
9+maintainers:
10+ - Lukasz Majewski <lukma@denx.de>
11+
12+allOf:
13+ - $ref: panel-dpi.yaml#
14+
15+properties:
16+ compatible:
17+ items:
18+ - const: powertip,st7272
19+ - {} # panel-dpi, but not listed here to avoid false select
20+
21+ height-mm: true
22+ panel-timing: true
23+ port: true
24+ power-supply: true
25+ width-mm: true
26+
27+additionalProperties: false
28+
29+...
Documentation/devicetree/bindings/display/ti/ti,am65x-dss.yaml+1−1
@@ -23,7 +23,7 @@ properties: · 22 unmodified lines
2323 compatible:
2424 enum:
2525 - ti,am625-dss
26− - ti,am62a7,dss
26+ - ti,am62a7-dss
2727 - ti,am65x-dss
2828
2929 reg:
Documentation/devicetree/bindings/interrupt-controller/microchip,lan966x-oic.yaml+2−3
@@ -14,9 +14,8 @@ allOf: · 13 unmodified lines
1414
1515 description: |
1616 The Microchip LAN966x outband interrupt controller (OIC) maps the internal
17− interrupt sources of the LAN966x device to an external interrupt.
18− When the LAN966x device is used as a PCI device, the external interrupt is
19− routed to the PCI interrupt.
17+ interrupt sources of the LAN966x device to a PCI interrupt when the LAN966x
18+ device is used as a PCI device.
2019
2120 properties:
2221 compatible:
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.yaml+0−1
@@ -7,7 +7,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 6 unmodified lines
77 title: Qualcomm Technologies ath10k wireless devices
88
99 maintainers:
10− - Kalle Valo <kvalo@kernel.org>
1110 - Jeff Johnson <jjohnson@kernel.org>
1211
1312 description:
Documentation/devicetree/bindings/net/wireless/qcom,ath11k-pci.yaml+0−1
@@ -8,7 +8,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 7 unmodified lines
88 title: Qualcomm Technologies ath11k wireless devices (PCIe)
99
1010 maintainers:
11− - Kalle Valo <kvalo@kernel.org>
1211 - Jeff Johnson <jjohnson@kernel.org>
1312
1413 description: |
Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml+0−1
@@ -8,7 +8,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml# · 7 unmodified lines
88 title: Qualcomm Technologies ath11k wireless devices
99
1010 maintainers:
11− - Kalle Valo <kvalo@kernel.org>
1211 - Jeff Johnson <jjohnson@kernel.org>
1312
1413 description: |
Documentation/devicetree/bindings/net/wireless/qcom,ath12k-wsi.yaml+0−1
@@ -9,7 +9,6 @@ title: Qualcomm Technologies ath12k wireless devices (PCIe) with WSI interface · 8 unmodified lines
99
1010 maintainers:
1111 - Jeff Johnson <jjohnson@kernel.org>
12− - Kalle Valo <kvalo@kernel.org>
1312
1413 description: |
1514 Qualcomm Technologies IEEE 802.11be PCIe devices with WSI interface.
Documentation/devicetree/bindings/net/wireless/qcom,ath12k.yaml+0−1
@@ -9,7 +9,6 @@ title: Qualcomm Technologies ath12k wireless devices (PCIe) · 8 unmodified lines
99
1010 maintainers:
1111 - Jeff Johnson <quic_jjohnson@quicinc.com>
12− - Kalle Valo <kvalo@kernel.org>
1312
1413 description:
1514 Qualcomm Technologies IEEE 802.11be PCIe devices.
Documentation/devicetree/bindings/nvmem/qcom,qfprom.yaml+1−0
@@ -36,6 +36,7 @@ properties: · 35 unmodified lines
3636 - qcom,qcs404-qfprom
3737 - qcom,qcs615-qfprom
3838 - qcom,qcs8300-qfprom
39+ - qcom,sar2130p-qfprom
3940 - qcom,sc7180-qfprom
4041 - qcom,sc7280-qfprom
4142 - qcom,sc8280xp-qfprom
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml+1−1
@@ -22,7 +22,7 @@ description: · 21 unmodified lines
2222 Each sub-node is identified using the node's name, with valid values listed
2323 for each of the pmics below.
2424
25− For mp5496, s1, s2
25+ For mp5496, s1, s2, l2, l5
2626
2727 For pm2250, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
2828 l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22
Documentation/driver-api/infrastructure.rst+6−0
@@ -41,6 +41,12 @@ Device Drivers Base · 40 unmodified lines
4141 .. kernel-doc:: drivers/base/class.c
4242 :export:
4343
44+.. kernel-doc:: include/linux/device/faux.h
45+ :internal:
46+
47+.. kernel-doc:: drivers/base/faux.c
48+ :export:
49+
4450 .. kernel-doc:: drivers/base/node.c
4551 :internal:
4652
Documentation/filesystems/bcachefs/SubmittingPatches.rst+98−0
@@ -0,0 +1,98 @@
1+Submitting patches to bcachefs:
2+===============================
3+
4+Patches must be tested before being submitted, either with the xfstests suite
5+[0], or the full bcachefs test suite in ktest [1], depending on what's being
6+touched. Note that ktest wraps xfstests and will be an easier method to running
7+it for most users; it includes single-command wrappers for all the mainstream
8+in-kernel local filesystems.
9+
10+Patches will undergo more testing after being merged (including
11+lockdep/kasan/preempt/etc. variants), these are not generally required to be
12+run by the submitter - but do put some thought into what you're changing and
13+which tests might be relevant, e.g. are you dealing with tricky memory layout
14+work? kasan, are you doing locking work? then lockdep; and ktest includes
15+single-command variants for the debug build types you'll most likely need.
16+
17+The exception to this rule is incomplete WIP/RFC patches: if you're working on
18+something nontrivial, it's encouraged to send out a WIP patch to let people
19+know what you're doing and make sure you're on the right track. Just make sure
20+it includes a brief note as to what's done and what's incomplete, to avoid
21+confusion.
22+
23+Rigorous checkpatch.pl adherence is not required (many of its warnings are
24+considered out of date), but try not to deviate too much without reason.
25+
26+Focus on writing code that reads well and is organized well; code should be
27+aesthetically pleasing.
28+
29+CI:
30+===
31+
32+Instead of running your tests locally, when running the full test suite it's
33+prefereable to let a server farm do it in parallel, and then have the results
34+in a nice test dashboard (which can tell you which failures are new, and
35+presents results in a git log view, avoiding the need for most bisecting).
36+
37+That exists [2], and community members may request an account. If you work for
38+a big tech company, you'll need to help out with server costs to get access -
39+but the CI is not restricted to running bcachefs tests: it runs any ktest test
40+(which generally makes it easy to wrap other tests that can run in qemu).
41+
42+Other things to think about:
43+============================
44+
45+- How will we debug this code? Is there sufficient introspection to diagnose
46+ when something starts acting wonky on a user machine?
47+
48+ We don't necessarily need every single field of every data structure visible
49+ with introspection, but having the important fields of all the core data
50+ types wired up makes debugging drastically easier - a bit of thoughtful
51+ foresight greatly reduces the need to have people build custom kernels with
52+ debug patches.
53+
54+ More broadly, think about all the debug tooling that might be needed.
55+
56+- Does it make the codebase more or less of a mess? Can we also try to do some
57+ organizing, too?
58+
59+- Do new tests need to be written? New assertions? How do we know and verify
60+ that the code is correct, and what happens if something goes wrong?
61+
62+ We don't yet have automated code coverage analysis or easy fault injection -
63+ but for now, pretend we did and ask what they might tell us.
64+
65+ Assertions are hugely important, given that we don't yet have a systems
66+ language that can do ergonomic embedded correctness proofs. Hitting an assert
67+ in testing is much better than wandering off into undefined behaviour la-la
68+ land - use them. Use them judiciously, and not as a replacement for proper
69+ error handling, but use them.
70+
71+- Does it need to be performance tested? Should we add new peformance counters?
72+
73+ bcachefs has a set of persistent runtime counters which can be viewed with
74+ the 'bcachefs fs top' command; this should give users a basic idea of what
75+ their filesystem is currently doing. If you're doing a new feature or looking
76+ at old code, think if anything should be added.
77+
78+- If it's a new on disk format feature - have upgrades and downgrades been
79+ tested? (Automated tests exists but aren't in the CI, due to the hassle of
80+ disk image management; coordinate to have them run.)
81+
82+Mailing list, IRC:
83+==================
84+
85+Patches should hit the list [3], but much discussion and code review happens on
86+IRC as well [4]; many people appreciate the more conversational approach and
87+quicker feedback.
88+
89+Additionally, we have a lively user community doing excellent QA work, which
90+exists primarily on IRC. Please make use of that resource; user feedback is
91+important for any nontrivial feature, and documenting it in commit messages
92+would be a good idea.
93+
94+[0]: git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
95+[1]: https://evilpiepirate.org/git/ktest.git/
96+[2]: https://evilpiepirate.org/~testdashboard/ci/
97+[3]: linux-bcachefs@vger.kernel.org
98+[4]: irc.oftc.net#bcache, #bcachefs-dev
Documentation/filesystems/bcachefs/index.rst+1−0
@@ -9,4 +9,5 @@ bcachefs Documentation · 8 unmodified lines
99 :numbered:
1010
1111 CodingStyle
12+ SubmittingPatches
1213 errorcodes
Documentation/netlink/specs/ethtool.yaml+2−1
@@ -1524,7 +1524,8 @@ attribute-sets: · 1523 unmodified lines
15241524 nested-attributes: bitset
15251525 -
15261526 name: hwtstamp-flags
1527− type: u32
1527+ type: nest
1528+ nested-attributes: bitset
15281529
15291530 operations:
15301531 enum-model: directional
Documentation/networking/iso15765-2.rst+2−2
@@ -369,8 +369,8 @@ to their default. · 368 unmodified lines
369369
370370 addr.can_family = AF_CAN;
371371 addr.can_ifindex = if_nametoindex("can0");
372− addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG;
373− addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG;
372+ addr.can_addr.tp.tx_id = 0x18DA42F1 | CAN_EFF_FLAG;
373+ addr.can_addr.tp.rx_id = 0x18DAF142 | CAN_EFF_FLAG;
374374
375375 ret = bind(s, (struct sockaddr *)&addr, sizeof(addr));
376376 if (ret < 0)
Documentation/networking/strparser.rst+8−1
@@ -112,7 +112,7 @@ Functions · 111 unmodified lines
112112 Callbacks
113113 =========
114114
115−There are six callbacks:
115+There are seven callbacks:
116116
117117 ::
118118
@@ -182,6 +182,13 @@ There are six callbacks: · 63 unmodified lines
182182 the length of the message. skb->len - offset may be greater
183183 then full_len since strparser does not trim the skb.
184184
185+ ::
186+
187+ int (*read_sock)(struct strparser *strp, read_descriptor_t *desc,
188+ sk_read_actor_t recv_actor);
189+
190+ The read_sock callback is used by strparser instead of
191+ sock->ops->read_sock, if provided.
185192 ::
186193
187194 int (*read_sock_done)(struct strparser *strp, int err);
Documentation/process/embargoed-hardware-issues.rst+1−1
@@ -308,7 +308,7 @@ an involved disclosed party. The current ambassadors list: · 307 unmodified lines
308308
309309 Google Kees Cook <keescook@chromium.org>
310310
311− LLVM Nick Desaulniers <ndesaulniers@google.com>
311+ LLVM Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
312312 ============= ========================================================
313313
314314 If you want your organization to be added to the ambassadors list, please
Documentation/translations/sp_SP/process/embargoed-hardware-issues.rst+1−1
@@ -287,7 +287,7 @@ revelada involucrada. La lista de embajadores actuales: · 286 unmodified lines
287287
288288 Google Kees Cook <keescook@chromium.org>
289289
290− LLVM Nick Desaulniers <ndesaulniers@google.com>
290+ LLVM Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
291291 ============= ========================================================
292292
293293 Si quiere que su organización se añada a la lista de embajadores, por
Documentation/virt/kvm/api.rst+1−1
@@ -1419,7 +1419,7 @@ fetch) is injected in the guest. · 1418 unmodified lines
14191419 S390:
14201420 ^^^^^
14211421
1422−Returns -EINVAL if the VM has the KVM_VM_S390_UCONTROL flag set.
1422+Returns -EINVAL or -EEXIST if the VM has the KVM_VM_S390_UCONTROL flag set.
14231423 Returns -EINVAL if called on a protected VM.
14241424
14251425 4.36 KVM_SET_TSS_ADDR
MAINTAINERS+73−23
@@ -2209,7 +2209,6 @@ F: sound/soc/codecs/cs42l84.* · 2208 unmodified lines
22092209 F: sound/soc/codecs/ssm3515.c
22102210
22112211 ARM/APPLE MACHINE SUPPORT
2212−M: Hector Martin <marcan@marcan.st>
22132212 M: Sven Peter <sven@svenpeter.dev>
22142213 R: Alyssa Rosenzweig <alyssa@rosenzweig.io>
22152214 L: asahi@lists.linux.dev
@@ -3655,7 +3654,6 @@ F: Documentation/devicetree/bindings/phy/phy-ath79-usb.txt · 1439 unmodified lines
36553654 F: drivers/phy/qualcomm/phy-ath79-usb.c
36563655
36573656 ATHEROS ATH GENERIC UTILITIES
3658−M: Kalle Valo <kvalo@kernel.org>
36593657 M: Jeff Johnson <jjohnson@kernel.org>
36603658 L: linux-wireless@vger.kernel.org
36613659 S: Supported
@@ -3860,13 +3858,6 @@ W: https://ez.analog.com/linux-software-drivers · 198 unmodified lines
38603858 F: Documentation/devicetree/bindings/pwm/adi,axi-pwmgen.yaml
38613859 F: drivers/pwm/pwm-axi-pwmgen.c
38623860
3863−AXXIA I2C CONTROLLER
3864−M: Krzysztof Adamski <krzysztof.adamski@nokia.com>
3865−L: linux-i2c@vger.kernel.org
3866−S: Maintained
3867−F: Documentation/devicetree/bindings/i2c/i2c-axxia.txt
3868−F: drivers/i2c/busses/i2c-axxia.c
3869−
38703861 AZ6007 DVB DRIVER
38713862 M: Mauro Carvalho Chehab <mchehab@kernel.org>
38723863 L: linux-media@vger.kernel.org
@@ -3955,6 +3946,7 @@ M: Kent Overstreet <kent.overstreet@linux.dev> · 82 unmodified lines
39553946 L: linux-bcachefs@vger.kernel.org
39563947 S: Supported
39573948 C: irc://irc.oftc.net/bcache
3949+P: Documentation/filesystems/bcachefs/SubmittingPatches.rst
39583950 T: git https://evilpiepirate.org/git/bcachefs.git
39593951 F: fs/bcachefs/
39603952 F: Documentation/filesystems/bcachefs/
@@ -5663,7 +5655,7 @@ F: .clang-format · 1702 unmodified lines
56635655
56645656 CLANG/LLVM BUILD SUPPORT
56655657 M: Nathan Chancellor <nathan@kernel.org>
5666−R: Nick Desaulniers <ndesaulniers@google.com>
5658+R: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>
56675659 R: Bill Wendling <morbo@google.com>
56685660 R: Justin Stitt <justinstitt@google.com>
56695661 L: llvm@lists.linux.dev
@@ -7116,8 +7108,10 @@ F: rust/kernel/device.rs · 1446 unmodified lines
71167108 F: rust/kernel/device_id.rs
71177109 F: rust/kernel/devres.rs
71187110 F: rust/kernel/driver.rs
7111+F: rust/kernel/faux.rs
71197112 F: rust/kernel/platform.rs
71207113 F: samples/rust/rust_driver_platform.rs
7114+F: samples/rust/rust_driver_faux.rs
71217115
71227116 DRIVERS FOR OMAP ADAPTIVE VOLTAGE SCALING (AVS)
71237117 M: Nishanth Menon <nm@ti.com>
@@ -9418,7 +9412,7 @@ F: fs/freevxfs/ · 2294 unmodified lines
94189412
94199413 FREEZER
94209414 M: "Rafael J. Wysocki" <rafael@kernel.org>
9421−M: Pavel Machek <pavel@ucw.cz>
9415+M: Pavel Machek <pavel@kernel.org>
94229416 L: linux-pm@vger.kernel.org
94239417 S: Supported
94249418 F: Documentation/power/freezing-of-tasks.rst
@@ -9835,8 +9829,7 @@ F: drivers/input/touchscreen/goodix* · 410 unmodified lines
98359829
98369830 GOOGLE ETHERNET DRIVERS
98379831 M: Jeroen de Borst <jeroendb@google.com>
9838−M: Praveen Kaligineedi <pkaligineedi@google.com>
9839−R: Shailend Chand <shailend@google.com>
9832+M: Harshitha Ramamurthy <hramamurthy@google.com>
98409833 L: netdev@vger.kernel.org
98419834 S: Maintained
98429835 F: Documentation/networking/device_drivers/ethernet/google/gve.rst
@@ -9878,7 +9871,7 @@ S: Maintained · 35 unmodified lines
98789871 F: drivers/staging/gpib/
98799872
98809873 GPIO ACPI SUPPORT
9881−M: Mika Westerberg <mika.westerberg@linux.intel.com>
9874+M: Mika Westerberg <westeri@kernel.org>
98829875 M: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
98839876 L: linux-gpio@vger.kernel.org
98849877 L: linux-acpi@vger.kernel.org
@@ -10253,7 +10246,7 @@ F: drivers/video/fbdev/hgafb.c · 368 unmodified lines
1025310246
1025410247 HIBERNATION (aka Software Suspend, aka swsusp)
1025510248 M: "Rafael J. Wysocki" <rafael@kernel.org>
10256−M: Pavel Machek <pavel@ucw.cz>
10249+M: Pavel Machek <pavel@kernel.org>
1025710250 L: linux-pm@vger.kernel.org
1025810251 S: Supported
1025910252 B: https://bugzilla.kernel.org
@@ -10822,7 +10815,7 @@ S: Odd Fixes · 562 unmodified lines
1082210815 F: drivers/tty/hvc/
1082310816
1082410817 I2C ACPI SUPPORT
10825−M: Mika Westerberg <mika.westerberg@linux.intel.com>
10818+M: Mika Westerberg <westeri@kernel.org>
1082610819 L: linux-i2c@vger.kernel.org
1082710820 L: linux-acpi@vger.kernel.org
1082810821 S: Maintained
@@ -13124,8 +13117,8 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/har · 2295 unmodified lines
1312413117 F: scripts/leaking_addresses.pl
1312513118
1312613119 LED SUBSYSTEM
13127−M: Pavel Machek <pavel@ucw.cz>
1312813120 M: Lee Jones <lee@kernel.org>
13121+M: Pavel Machek <pavel@kernel.org>
1312913122 L: linux-leds@vger.kernel.org
1313013123 S: Maintained
1313113124 T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git
@@ -16438,7 +16431,7 @@ X: drivers/net/can/ · 3306 unmodified lines
1643816431 X: drivers/net/wireless/
1643916432
1644016433 NETWORKING DRIVERS (WIRELESS)
16441−M: Kalle Valo <kvalo@kernel.org>
16434+M: Johannes Berg <johannes@sipsolutions.net>
1644216435 L: linux-wireless@vger.kernel.org
1644316436 S: Maintained
1644416437 W: https://wireless.wiki.kernel.org/
@@ -16462,6 +16455,28 @@ F: include/net/dsa.h · 17 unmodified lines
1646216455 F: net/dsa/
1646316456 F: tools/testing/selftests/drivers/net/dsa/
1646416457
16458+NETWORKING [ETHTOOL]
16459+M: Andrew Lunn <andrew@lunn.ch>
16460+M: Jakub Kicinski <kuba@kernel.org>
16461+F: Documentation/netlink/specs/ethtool.yaml
16462+F: Documentation/networking/ethtool-netlink.rst
16463+F: include/linux/ethtool*
16464+F: include/uapi/linux/ethtool*
16465+F: net/ethtool/
16466+F: tools/testing/selftests/drivers/net/*/ethtool*
16467+
16468+NETWORKING [ETHTOOL CABLE TEST]
16469+M: Andrew Lunn <andrew@lunn.ch>
16470+F: net/ethtool/cabletest.c
16471+F: tools/testing/selftests/drivers/net/*/ethtool*
16472+K: cable_test
16473+
16474+NETWORKING [ETHTOOL MAC MERGE]
16475+M: Vladimir Oltean <vladimir.oltean@nxp.com>
16476+F: net/ethtool/mm.c
16477+F: tools/testing/selftests/drivers/net/hw/ethtool_mm.sh
16478+K: ethtool_mm
16479+
1646516480 NETWORKING [GENERAL]
1646616481 M: "David S. Miller" <davem@davemloft.net>
1646716482 M: Eric Dumazet <edumazet@google.com>
@@ -16493,6 +16508,7 @@ F: include/linux/netdev* · 25 unmodified lines
1649316508 F: include/linux/netlink.h
1649416509 F: include/linux/netpoll.h
1649516510 F: include/linux/rtnetlink.h
16511+F: include/linux/sctp.h
1649616512 F: include/linux/seq_file_net.h
1649716513 F: include/linux/skbuff*
1649816514 F: include/net/
@@ -16509,6 +16525,7 @@ F: include/uapi/linux/netdev* · 10 unmodified lines
1650916525 F: include/uapi/linux/netlink.h
1651016526 F: include/uapi/linux/netlink_diag.h
1651116527 F: include/uapi/linux/rtnetlink.h
16528+F: include/uapi/linux/sctp.h
1651216529 F: lib/net_utils.c
1651316530 F: lib/random32.c
1651416531 F: net/
@@ -16621,6 +16638,7 @@ F: tools/testing/selftests/net/mptcp/ · 106 unmodified lines
1662116638 NETWORKING [TCP]
1662216639 M: Eric Dumazet <edumazet@google.com>
1662316640 M: Neal Cardwell <ncardwell@google.com>
16641+R: Kuniyuki Iwashima <kuniyu@amazon.com>
1662416642 L: netdev@vger.kernel.org
1662516643 S: Maintained
1662616644 F: Documentation/networking/net_cachelines/tcp_sock.rst
@@ -16648,6 +16666,31 @@ F: include/net/tls.h · 21 unmodified lines
1664816666 F: include/uapi/linux/tls.h
1664916667 F: net/tls/*
1665016668
16669+NETWORKING [SOCKETS]
16670+M: Eric Dumazet <edumazet@google.com>
16671+M: Kuniyuki Iwashima <kuniyu@amazon.com>
16672+M: Paolo Abeni <pabeni@redhat.com>
16673+M: Willem de Bruijn <willemb@google.com>
16674+S: Maintained
16675+F: include/linux/sock_diag.h
16676+F: include/linux/socket.h
16677+F: include/linux/sockptr.h
16678+F: include/net/sock.h
16679+F: include/net/sock_reuseport.h
16680+F: include/uapi/linux/socket.h
16681+F: net/core/*sock*
16682+F: net/core/scm.c
16683+F: net/socket.c
16684+
16685+NETWORKING [UNIX SOCKETS]
16686+M: Kuniyuki Iwashima <kuniyu@amazon.com>
16687+S: Maintained
16688+F: include/net/af_unix.h
16689+F: include/net/netns/unix.h
16690+F: include/uapi/linux/unix_diag.h
16691+F: net/unix/
16692+F: tools/testing/selftests/net/af_unix/
16693+
1665116694 NETXEN (1/10) GbE SUPPORT
1665216695 M: Manish Chopra <manishc@marvell.com>
1665316696 M: Rahul Verma <rahulv@marvell.com>
@@ -16781,7 +16824,7 @@ F: include/linux/tick.h · 127 unmodified lines
1678116824 F: kernel/time/tick*.*
1678216825
1678316826 NOKIA N900 CAMERA SUPPORT (ET8EK8 SENSOR, AD5820 FOCUS)
16784−M: Pavel Machek <pavel@ucw.cz>
16827+M: Pavel Machek <pavel@kernel.org>
1678516828 M: Sakari Ailus <sakari.ailus@iki.fi>
1678616829 L: linux-media@vger.kernel.org
1678716830 S: Maintained
@@ -17713,6 +17756,7 @@ L: netdev@vger.kernel.org · 925 unmodified lines
1771317756 L: dev@openvswitch.org
1771417757 S: Maintained
1771517758 W: http://openvswitch.org
17759+F: Documentation/networking/openvswitch.rst
1771617760 F: include/uapi/linux/openvswitch.h
1771717761 F: net/openvswitch/
1771817762 F: tools/testing/selftests/net/openvswitch/
@@ -19312,7 +19356,6 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/ · 1593 unmodified lines
1931219356 F: drivers/media/tuners/qt1010*
1931319357
1931419358 QUALCOMM ATH12K WIRELESS DRIVER
19315−M: Kalle Valo <kvalo@kernel.org>
1931619359 M: Jeff Johnson <jjohnson@kernel.org>
1931719360 L: ath12k@lists.infradead.org
1931819361 S: Supported
@@ -19322,7 +19365,6 @@ F: drivers/net/wireless/ath/ath12k/ · 3 unmodified lines
1932219365 N: ath12k
1932319366
1932419367 QUALCOMM ATHEROS ATH10K WIRELESS DRIVER
19325−M: Kalle Valo <kvalo@kernel.org>
1932619368 M: Jeff Johnson <jjohnson@kernel.org>
1932719369 L: ath10k@lists.infradead.org
1932819370 S: Supported
@@ -19332,7 +19374,6 @@ F: drivers/net/wireless/ath/ath10k/ · 3 unmodified lines
1933219374 N: ath10k
1933319375
1933419376 QUALCOMM ATHEROS ATH11K WIRELESS DRIVER
19335−M: Kalle Valo <kvalo@kernel.org>
1933619377 M: Jeff Johnson <jjohnson@kernel.org>
1933719378 L: ath11k@lists.infradead.org
1933819379 S: Supported
@@ -19467,6 +19508,15 @@ L: dmaengine@vger.kernel.org · 128 unmodified lines
1946719508 S: Supported
1946819509 F: drivers/dma/qcom/hidma*
1946919510
19511+QUALCOMM I2C QCOM GENI DRIVER
19512+M: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
19513+M: Viken Dadhaniya <quic_vdadhani@quicinc.com>
19514+L: linux-i2c@vger.kernel.org
19515+L: linux-arm-msm@vger.kernel.org
19516+S: Maintained
19517+F: Documentation/devicetree/bindings/i2c/qcom,i2c-geni-qcom.yaml
19518+F: drivers/i2c/busses/i2c-qcom-geni.c
19519+
1947019520 QUALCOMM I2C CCI DRIVER
1947119521 M: Loic Poulain <loic.poulain@linaro.org>
1947219522 M: Robert Foss <rfoss@kernel.org>
@@ -22806,7 +22856,7 @@ F: drivers/sh/ · 3333 unmodified lines
2280622856 SUSPEND TO RAM
2280722857 M: "Rafael J. Wysocki" <rafael@kernel.org>
2280822858 M: Len Brown <len.brown@intel.com>
22809−M: Pavel Machek <pavel@ucw.cz>
22859+M: Pavel Machek <pavel@kernel.org>
2281022860 L: linux-pm@vger.kernel.org
2281122861 S: Supported
2281222862 B: https://bugzilla.kernel.org
Makefile+5−10
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 14
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
5+EXTRAVERSION = -rc3
66 NAME = Baby Opossum Posse
77
88 # *DOCUMENTATION*
@@ -1120,8 +1120,8 @@ LDFLAGS_vmlinux += --orphan-handling=$(CONFIG_LD_ORPHAN_WARN_LEVEL) · 1111 unmodified lines
11201120 endif
11211121
11221122 # Align the bit size of userspace programs with the kernel
1123−KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
1124−KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
1123+KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
1124+KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
11251125
11261126 # make the checker run with the right architecture
11271127 CHECKFLAGS += --arch=$(ARCH)
@@ -1421,18 +1421,13 @@ ifneq ($(wildcard $(resolve_btfids_O)),) · 293 unmodified lines
14211421 $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
14221422 endif
14231423
1424−# Clear a bunch of variables before executing the submake
1425−ifeq ($(quiet),silent_)
1426−tools_silent=s
1427−endif
1428−
14291424 tools/: FORCE
14301425 $(Q)mkdir -p $(objtree)/tools
1431− $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
1426+ $(Q)$(MAKE) LDFLAGS= O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/
14321427
14331428 tools/%: FORCE
14341429 $(Q)mkdir -p $(objtree)/tools
1435− $(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
1430+ $(Q)$(MAKE) LDFLAGS= O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
14361431
14371432 # ---------------------------------------------------------------------------
14381433 # Kernel selftest
arch/alpha/include/asm/elf.h+1−5
@@ -74,7 +74,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; · 73 unmodified lines
7474 /*
7575 * This is used to ensure we don't load something for the wrong architecture.
7676 */
77−#define elf_check_arch(x) ((x)->e_machine == EM_ALPHA)
77+#define elf_check_arch(x) (((x)->e_machine == EM_ALPHA) && !((x)->e_flags & EF_ALPHA_32BIT))
7878
7979 /*
8080 * These are used to set parameters in the core dumps.
@@ -137,10 +137,6 @@ extern int dump_elf_task(elf_greg_t *dest, struct task_struct *task); · 56 unmodified lines
137137 : amask (AMASK_CIX) ? "ev6" : "ev67"); \
138138 })
139139
140−#define SET_PERSONALITY(EX) \
141− set_personality(((EX).e_flags & EF_ALPHA_32BIT) \
142− ? PER_LINUX_32BIT : PER_LINUX)
143−
144140 extern int alpha_l1i_cacheshape;
145141 extern int alpha_l1d_cacheshape;
146142 extern int alpha_l2_cacheshape;
arch/alpha/include/asm/hwrpb.h+1−1
@@ -135,7 +135,7 @@ struct crb_struct { · 134 unmodified lines
135135 /* virtual->physical map */
136136 unsigned long map_entries;
137137 unsigned long map_pages;
138− struct vf_map_struct map[1];
138+ struct vf_map_struct map[];
139139 };
140140
141141 struct memclust_struct {
arch/alpha/include/asm/pgtable.h+1−1
@@ -360,7 +360,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) · 359 unmodified lines
360360
361361 extern void paging_init(void);
362362
363−/* We have our own get_unmapped_area to cope with ADDR_LIMIT_32BIT. */
363+/* We have our own get_unmapped_area */
364364 #define HAVE_ARCH_UNMAPPED_AREA
365365
366366 #endif /* _ALPHA_PGTABLE_H */
arch/alpha/include/asm/processor.h+2−6
@@ -8,23 +8,19 @@ · 7 unmodified lines
88 #ifndef __ASM_ALPHA_PROCESSOR_H
99 #define __ASM_ALPHA_PROCESSOR_H
1010
11−#include <linux/personality.h> /* for ADDR_LIMIT_32BIT */
12−
1311 /*
1412 * We have a 42-bit user address space: 4TB user VM...
1513 */
1614 #define TASK_SIZE (0x40000000000UL)
1715
18−#define STACK_TOP \
19− (current->personality & ADDR_LIMIT_32BIT ? 0x80000000 : 0x00120000000UL)
16+#define STACK_TOP (0x00120000000UL)
2017
2118 #define STACK_TOP_MAX 0x00120000000UL
2219
2320 /* This decides where the kernel will search for a free chunk of vm
2421 * space during mmap's.
2522 */
26−#define TASK_UNMAPPED_BASE \
27− ((current->personality & ADDR_LIMIT_32BIT) ? 0x40000000 : TASK_SIZE / 2)
23+#define TASK_UNMAPPED_BASE (TASK_SIZE / 2)
2824
2925 /* This is dead. Everything has been moved to thread_info. */
3026 struct thread_struct { };
arch/alpha/include/uapi/asm/ptrace.h+2−0
@@ -42,6 +42,8 @@ struct pt_regs { · 41 unmodified lines
4242 unsigned long trap_a0;
4343 unsigned long trap_a1;
4444 unsigned long trap_a2;
45+/* This makes the stack 16-byte aligned as GCC expects */
46+ unsigned long __pad0;
4547 /* These are saved by PAL-code: */
4648 unsigned long ps;
4749 unsigned long pc;
arch/alpha/kernel/asm-offsets.c+4−0
@@ -19,9 +19,13 @@ static void __used foo(void) · 18 unmodified lines
1919 DEFINE(TI_STATUS, offsetof(struct thread_info, status));
2020 BLANK();
2121
22+ DEFINE(SP_OFF, offsetof(struct pt_regs, ps));
2223 DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs));
2324 BLANK();
2425
26+ DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
27+ BLANK();
28+
2529 DEFINE(HAE_CACHE, offsetof(struct alpha_machine_vector, hae_cache));
2630 DEFINE(HAE_REG, offsetof(struct alpha_machine_vector, hae_register));
2731 }
arch/alpha/kernel/entry.S+10−14
@@ -15,10 +15,6 @@ · 14 unmodified lines
1515 .set noat
1616 .cfi_sections .debug_frame
1717
18−/* Stack offsets. */
19−#define SP_OFF 184
20−#define SWITCH_STACK_SIZE 64
21−
2218 .macro CFI_START_OSF_FRAME func
2319 .align 4
2420 .globl \func
@@ -198,8 +194,8 @@ CFI_END_OSF_FRAME entArith · 173 unmodified lines
198194 CFI_START_OSF_FRAME entMM
199195 SAVE_ALL
200196 /* save $9 - $15 so the inline exception code can manipulate them. */
201− subq $sp, 56, $sp
202− .cfi_adjust_cfa_offset 56
197+ subq $sp, 64, $sp
198+ .cfi_adjust_cfa_offset 64
203199 stq $9, 0($sp)
204200 stq $10, 8($sp)
205201 stq $11, 16($sp)
@@ -214,7 +210,7 @@ CFI_START_OSF_FRAME entMM · 8 unmodified lines
214210 .cfi_rel_offset $13, 32
215211 .cfi_rel_offset $14, 40
216212 .cfi_rel_offset $15, 48
217− addq $sp, 56, $19
213+ addq $sp, 64, $19
218214 /* handle the fault */
219215 lda $8, 0x3fff
220216 bic $sp, $8, $8
@@ -227,7 +223,7 @@ CFI_START_OSF_FRAME entMM · 6 unmodified lines
227223 ldq $13, 32($sp)
228224 ldq $14, 40($sp)
229225 ldq $15, 48($sp)
230− addq $sp, 56, $sp
226+ addq $sp, 64, $sp
231227 .cfi_restore $9
232228 .cfi_restore $10
233229 .cfi_restore $11
@@ -235,7 +231,7 @@ CFI_START_OSF_FRAME entMM · 1 unmodified line
235231 .cfi_restore $13
236232 .cfi_restore $14
237233 .cfi_restore $15
238− .cfi_adjust_cfa_offset -56
234+ .cfi_adjust_cfa_offset -64
239235 /* finish up the syscall as normal. */
240236 br ret_from_sys_call
241237 CFI_END_OSF_FRAME entMM
@@ -382,8 +378,8 @@ entUnaUser: · 140 unmodified lines
382378 .cfi_restore $0
383379 .cfi_adjust_cfa_offset -256
384380 SAVE_ALL /* setup normal kernel stack */
385− lda $sp, -56($sp)
386− .cfi_adjust_cfa_offset 56
381+ lda $sp, -64($sp)
382+ .cfi_adjust_cfa_offset 64
387383 stq $9, 0($sp)
388384 stq $10, 8($sp)
389385 stq $11, 16($sp)
@@ -399,7 +395,7 @@ entUnaUser: · 9 unmodified lines
399395 .cfi_rel_offset $14, 40
400396 .cfi_rel_offset $15, 48
401397 lda $8, 0x3fff
402− addq $sp, 56, $19
398+ addq $sp, 64, $19
403399 bic $sp, $8, $8
404400 jsr $26, do_entUnaUser
405401 ldq $9, 0($sp)
@@ -409,7 +405,7 @@ entUnaUser: · 3 unmodified lines
409405 ldq $13, 32($sp)
410406 ldq $14, 40($sp)
411407 ldq $15, 48($sp)
412− lda $sp, 56($sp)
408+ lda $sp, 64($sp)
413409 .cfi_restore $9
414410 .cfi_restore $10
415411 .cfi_restore $11
@@ -417,7 +413,7 @@ entUnaUser: · 1 unmodified line
417413 .cfi_restore $13
418414 .cfi_restore $14
419415 .cfi_restore $15
420− .cfi_adjust_cfa_offset -56
416+ .cfi_adjust_cfa_offset -64
421417 br ret_from_sys_call
422418 CFI_END_OSF_FRAME entUna
423419
arch/alpha/kernel/osf_sys.c+2−9
@@ -1210,8 +1210,7 @@ SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p) · 1209 unmodified lines
12101210 return ret;
12111211 }
12121212
1213−/* Get an address range which is currently unmapped. Similar to the
1214− generic version except that we know how to honor ADDR_LIMIT_32BIT. */
1213+/* Get an address range which is currently unmapped. */
12151214
12161215 static unsigned long
12171216 arch_get_unmapped_area_1(unsigned long addr, unsigned long len,
@@ -1230,13 +1229,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, · 12 unmodified lines
12301229 unsigned long len, unsigned long pgoff,
12311230 unsigned long flags, vm_flags_t vm_flags)
12321231 {
1233− unsigned long limit;
1234−
1235− /* "32 bit" actually means 31 bit, since pointers sign extend. */
1236− if (current->personality & ADDR_LIMIT_32BIT)
1237− limit = 0x80000000;
1238− else
1239− limit = TASK_SIZE;
1232+ unsigned long limit = TASK_SIZE;
12401233
12411234 if (len > limit)
12421235 return -ENOMEM;
arch/alpha/kernel/pci_iommu.c+2−1
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/log2.h>
1414 #include <linux/dma-map-ops.h>
1515 #include <linux/iommu-helper.h>
16+#include <linux/string_choices.h>
1617
1718 #include <asm/io.h>
1819 #include <asm/hwrpb.h>
@@ -212,7 +213,7 @@ static int pci_dac_dma_supported(struct pci_dev *dev, u64 mask) · 193 unmodified lines
212213
213214 /* If both conditions above are met, we are fine. */
214215 DBGA("pci_dac_dma_supported %s from %ps\n",
215− ok ? "yes" : "no", __builtin_return_address(0));
216+ str_yes_no(ok), __builtin_return_address(0));
216217
217218 return ok;
218219 }
arch/alpha/kernel/traps.c+1−1
@@ -649,7 +649,7 @@ s_reg_to_mem (unsigned long s_reg) · 648 unmodified lines
649649 static int unauser_reg_offsets[32] = {
650650 R(r0), R(r1), R(r2), R(r3), R(r4), R(r5), R(r6), R(r7), R(r8),
651651 /* r9 ... r15 are stored in front of regs. */
652− -56, -48, -40, -32, -24, -16, -8,
652+ -64, -56, -48, -40, -32, -24, -16, /* padding at -8 */
653653 R(r16), R(r17), R(r18),
654654 R(r19), R(r20), R(r21), R(r22), R(r23), R(r24), R(r25), R(r26),
655655 R(r27), R(r28), R(gp),
arch/alpha/mm/fault.c+2−2
@@ -78,8 +78,8 @@ __load_new_mm_context(struct mm_struct *next_mm) · 77 unmodified lines
7878
7979 /* Macro for exception fixup code to access integer registers. */
8080 #define dpf_reg(r) \
81− (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \
82− (r) <= 18 ? (r)+10 : (r)-10])
81+ (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-17 : \
82+ (r) <= 18 ? (r)+11 : (r)-10])
8383
8484 asmlinkage void
8585 do_page_fault(unsigned long address, unsigned long mmcsr,
arch/arm64/Kconfig+0−1
@@ -225,7 +225,6 @@ config ARM64 · 224 unmodified lines
225225 select HAVE_FUNCTION_ERROR_INJECTION
226226 select HAVE_FUNCTION_GRAPH_FREGS
227227 select HAVE_FUNCTION_GRAPH_TRACER
228− select HAVE_FUNCTION_GRAPH_RETVAL
229228 select HAVE_GCC_PLUGINS
230229 select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && \
231230 HW_PERF_EVENTS && HAVE_PERF_EVENTS_NMI
arch/arm64/Makefile+4−0
@@ -48,7 +48,11 @@ KBUILD_CFLAGS += $(CC_FLAGS_NO_FPU) \ · 47 unmodified lines
4848 KBUILD_CFLAGS += $(call cc-disable-warning, psabi)
4949 KBUILD_AFLAGS += $(compat_vdso)
5050
51+ifeq ($(call test-ge, $(CONFIG_RUSTC_VERSION), 108500),y)
52+KBUILD_RUSTFLAGS += --target=aarch64-unknown-none-softfloat
53+else
5154 KBUILD_RUSTFLAGS += --target=aarch64-unknown-none -Ctarget-feature="-neon"
55+endif
5256
5357 KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
5458 KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
arch/arm64/include/asm/kvm_emulate.h+0−42
@@ -605,48 +605,6 @@ static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu) · 604 unmodified lines
605605 __cpacr_to_cptr_set(clr, set));\
606606 } while (0)
607607
608−static __always_inline void kvm_write_cptr_el2(u64 val)
609−{
610− if (has_vhe() || has_hvhe())
611− write_sysreg(val, cpacr_el1);
612− else
613− write_sysreg(val, cptr_el2);
614−}
615−
616−/* Resets the value of cptr_el2 when returning to the host. */
617−static __always_inline void __kvm_reset_cptr_el2(struct kvm *kvm)
618−{
619− u64 val;
620−
621− if (has_vhe()) {
622− val = (CPACR_EL1_FPEN | CPACR_EL1_ZEN_EL1EN);
623− if (cpus_have_final_cap(ARM64_SME))
624− val |= CPACR_EL1_SMEN_EL1EN;
625− } else if (has_hvhe()) {
626− val = CPACR_EL1_FPEN;
627−
628− if (!kvm_has_sve(kvm) || !guest_owns_fp_regs())
629− val |= CPACR_EL1_ZEN;
630− if (cpus_have_final_cap(ARM64_SME))
631− val |= CPACR_EL1_SMEN;
632− } else {
633− val = CPTR_NVHE_EL2_RES1;
634−
635− if (kvm_has_sve(kvm) && guest_owns_fp_regs())
636− val |= CPTR_EL2_TZ;
637− if (!cpus_have_final_cap(ARM64_SME))
638− val |= CPTR_EL2_TSM;
639− }
640−
641− kvm_write_cptr_el2(val);
642−}
643−
644−#ifdef __KVM_NVHE_HYPERVISOR__
645−#define kvm_reset_cptr_el2(v) __kvm_reset_cptr_el2(kern_hyp_va((v)->kvm))
646−#else
647−#define kvm_reset_cptr_el2(v) __kvm_reset_cptr_el2((v)->kvm)
648−#endif
649−
650608 /*
651609 * Returns a 'sanitised' view of CPTR_EL2, translating from nVHE to the VHE
652610 * format if E2H isn't set.
arch/arm64/include/asm/kvm_host.h+6−18
@@ -100,7 +100,7 @@ static inline void push_hyp_memcache(struct kvm_hyp_memcache *mc, · 99 unmodified lines
100100 static inline void *pop_hyp_memcache(struct kvm_hyp_memcache *mc,
101101 void *(*to_va)(phys_addr_t phys))
102102 {
103− phys_addr_t *p = to_va(mc->head);
103+ phys_addr_t *p = to_va(mc->head & PAGE_MASK);
104104
105105 if (!mc->nr_pages)
106106 return NULL;
@@ -615,8 +615,6 @@ struct cpu_sve_state { · 508 unmodified lines
615615 struct kvm_host_data {
616616 #define KVM_HOST_DATA_FLAG_HAS_SPE 0
617617 #define KVM_HOST_DATA_FLAG_HAS_TRBE 1
618−#define KVM_HOST_DATA_FLAG_HOST_SVE_ENABLED 2
619−#define KVM_HOST_DATA_FLAG_HOST_SME_ENABLED 3
620618 #define KVM_HOST_DATA_FLAG_TRBE_ENABLED 4
621619 #define KVM_HOST_DATA_FLAG_EL1_TRACING_CONFIGURED 5
622620 unsigned long flags;
@@ -624,23 +622,13 @@ struct kvm_host_data { · 1 unmodified line
624622 struct kvm_cpu_context host_ctxt;
625623
626624 /*
627− * All pointers in this union are hyp VA.
625+ * Hyp VA.
628626 * sve_state is only used in pKVM and if system_supports_sve().
629627 */
630− union {
631− struct user_fpsimd_state *fpsimd_state;
632− struct cpu_sve_state *sve_state;
633− };
634−
635− union {
636− /* HYP VA pointer to the host storage for FPMR */
637− u64 *fpmr_ptr;
638− /*
639− * Used by pKVM only, as it needs to provide storage
640− * for the host
641− */
642− u64 fpmr;
643− };
628+ struct cpu_sve_state *sve_state;
629+
630+ /* Used by pKVM only. */
631+ u64 fpmr;
644632
645633 /* Ownership of the FP regs */
646634 enum {
arch/arm64/kernel/cacheinfo.c+7−5
@@ -101,16 +101,18 @@ int populate_cache_leaves(unsigned int cpu) · 100 unmodified lines
101101 unsigned int level, idx;
102102 enum cache_type type;
103103 struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu);
104− struct cacheinfo *this_leaf = this_cpu_ci->info_list;
104+ struct cacheinfo *infos = this_cpu_ci->info_list;
105105
106106 for (idx = 0, level = 1; level <= this_cpu_ci->num_levels &&
107− idx < this_cpu_ci->num_leaves; idx++, level++) {
107+ idx < this_cpu_ci->num_leaves; level++) {
108108 type = get_cache_type(level);
109109 if (type == CACHE_TYPE_SEPARATE) {
110− ci_leaf_init(this_leaf++, CACHE_TYPE_DATA, level);
111− ci_leaf_init(this_leaf++, CACHE_TYPE_INST, level);
110+ if (idx + 1 >= this_cpu_ci->num_leaves)
111+ break;
112+ ci_leaf_init(&infos[idx++], CACHE_TYPE_DATA, level);
113+ ci_leaf_init(&infos[idx++], CACHE_TYPE_INST, level);
112114 } else {
113− ci_leaf_init(this_leaf++, type, level);
115+ ci_leaf_init(&infos[idx++], type, level);
114116 }
115117 }
116118 return 0;
arch/arm64/kernel/cpufeature.c+3−2
@@ -3091,6 +3091,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = { · 3090 unmodified lines
30913091 HWCAP_CAP(ID_AA64ISAR0_EL1, TS, FLAGM, CAP_HWCAP, KERNEL_HWCAP_FLAGM),
30923092 HWCAP_CAP(ID_AA64ISAR0_EL1, TS, FLAGM2, CAP_HWCAP, KERNEL_HWCAP_FLAGM2),
30933093 HWCAP_CAP(ID_AA64ISAR0_EL1, RNDR, IMP, CAP_HWCAP, KERNEL_HWCAP_RNG),
3094+ HWCAP_CAP(ID_AA64ISAR3_EL1, FPRCVT, IMP, CAP_HWCAP, KERNEL_HWCAP_FPRCVT),
30943095 HWCAP_CAP(ID_AA64PFR0_EL1, FP, IMP, CAP_HWCAP, KERNEL_HWCAP_FP),
30953096 HWCAP_CAP(ID_AA64PFR0_EL1, FP, FP16, CAP_HWCAP, KERNEL_HWCAP_FPHP),
30963097 HWCAP_CAP(ID_AA64PFR0_EL1, AdvSIMD, IMP, CAP_HWCAP, KERNEL_HWCAP_ASIMD),
@@ -3180,8 +3181,6 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = { · 83 unmodified lines
31803181 HWCAP_CAP(ID_AA64SMFR0_EL1, SF8FMA, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SF8FMA),
31813182 HWCAP_CAP(ID_AA64SMFR0_EL1, SF8DP4, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SF8DP4),
31823183 HWCAP_CAP(ID_AA64SMFR0_EL1, SF8DP2, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SF8DP2),
3183− HWCAP_CAP(ID_AA64SMFR0_EL1, SF8MM8, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SF8MM8),
3184− HWCAP_CAP(ID_AA64SMFR0_EL1, SF8MM4, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SF8MM4),
31853184 HWCAP_CAP(ID_AA64SMFR0_EL1, SBitPerm, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SBITPERM),
31863185 HWCAP_CAP(ID_AA64SMFR0_EL1, AES, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_AES),
31873186 HWCAP_CAP(ID_AA64SMFR0_EL1, SFEXPA, IMP, CAP_HWCAP, KERNEL_HWCAP_SME_SFEXPA),
@@ -3192,6 +3191,8 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = { · 4 unmodified lines
31923191 HWCAP_CAP(ID_AA64FPFR0_EL1, F8FMA, IMP, CAP_HWCAP, KERNEL_HWCAP_F8FMA),
31933192 HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP4, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP4),
31943193 HWCAP_CAP(ID_AA64FPFR0_EL1, F8DP2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8DP2),
3194+ HWCAP_CAP(ID_AA64FPFR0_EL1, F8MM8, IMP, CAP_HWCAP, KERNEL_HWCAP_F8MM8),
3195+ HWCAP_CAP(ID_AA64FPFR0_EL1, F8MM4, IMP, CAP_HWCAP, KERNEL_HWCAP_F8MM4),
31953196 HWCAP_CAP(ID_AA64FPFR0_EL1, F8E4M3, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E4M3),
31963197 HWCAP_CAP(ID_AA64FPFR0_EL1, F8E5M2, IMP, CAP_HWCAP, KERNEL_HWCAP_F8E5M2),
31973198 #ifdef CONFIG_ARM64_POE
arch/arm64/kernel/fpsimd.c+0−25
@@ -1694,31 +1694,6 @@ void fpsimd_signal_preserve_current_state(void) · 1693 unmodified lines
16941694 sve_to_fpsimd(current);
16951695 }
16961696
1697−/*
1698− * Called by KVM when entering the guest.
1699− */
1700−void fpsimd_kvm_prepare(void)
1701−{
1702− if (!system_supports_sve())
1703− return;
1704−
1705− /*
1706− * KVM does not save host SVE state since we can only enter
1707− * the guest from a syscall so the ABI means that only the
1708− * non-saved SVE state needs to be saved. If we have left
1709− * SVE enabled for performance reasons then update the task
1710− * state to be FPSIMD only.
1711− */
1712− get_cpu_fpsimd_context();
1713−
1714− if (test_and_clear_thread_flag(TIF_SVE)) {
1715− sve_to_fpsimd(current);
1716− current->thread.fp_type = FP_STATE_FPSIMD;
1717− }
1718−
1719− put_cpu_fpsimd_context();
1720−}
1721−
17221697 /*
17231698 * Associate current's FPSIMD context with this cpu
17241699 * The caller must have ownership of the cpu FPSIMD context before calling
arch/arm64/kernel/topology.c+10−12
@@ -194,12 +194,19 @@ static void amu_fie_setup(const struct cpumask *cpus) · 193 unmodified lines
194194 int cpu;
195195
196196 /* We are already set since the last insmod of cpufreq driver */
197− if (unlikely(cpumask_subset(cpus, amu_fie_cpus)))
197+ if (cpumask_available(amu_fie_cpus) &&
198+ unlikely(cpumask_subset(cpus, amu_fie_cpus)))
198199 return;
199200
200− for_each_cpu(cpu, cpus) {
201+ for_each_cpu(cpu, cpus)
201202 if (!freq_counters_valid(cpu))
202203 return;
204+
205+ if (!cpumask_available(amu_fie_cpus) &&
206+ !zalloc_cpumask_var(&amu_fie_cpus, GFP_KERNEL)) {
207+ WARN_ONCE(1, "Failed to allocate FIE cpumask for CPUs[%*pbl]\n",
208+ cpumask_pr_args(cpus));
209+ return;
203210 }
204211
205212 cpumask_or(amu_fie_cpus, amu_fie_cpus, cpus);
@@ -237,17 +244,8 @@ static struct notifier_block init_amu_fie_notifier = { · 31 unmodified lines
237244
238245 static int __init init_amu_fie(void)
239246 {
240− int ret;
241−
242− if (!zalloc_cpumask_var(&amu_fie_cpus, GFP_KERNEL))
243− return -ENOMEM;
244−
245− ret = cpufreq_register_notifier(&init_amu_fie_notifier,
247+ return cpufreq_register_notifier(&init_amu_fie_notifier,
246248 CPUFREQ_POLICY_NOTIFIER);
247− if (ret)
248− free_cpumask_var(amu_fie_cpus);
249−
250− return ret;
251249 }
252250 core_initcall(init_amu_fie);
253251
arch/arm64/kernel/vdso/vdso.lds.S+1−0
@@ -41,6 +41,7 @@ SECTIONS · 40 unmodified lines
4141 */
4242 /DISCARD/ : {
4343 *(.note.GNU-stack .note.gnu.property)
44+ *(.ARM.attributes)
4445 }
4546 .note : { *(.note.*) } :text :note
4647
arch/arm64/kernel/vmlinux.lds.S+1−0
@@ -162,6 +162,7 @@ SECTIONS · 161 unmodified lines
162162 /DISCARD/ : {
163163 *(.interp .dynamic)
164164 *(.dynsym .dynstr .hash .gnu.hash)
165+ *(.ARM.attributes)
165166 }
166167
167168 . = KIMAGE_VADDR;
arch/arm64/kvm/arch_timer.c+18−47
@@ -447,21 +447,19 @@ static void kvm_timer_update_status(struct arch_timer_context *ctx, bool level) · 446 unmodified lines
447447 static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level,
448448 struct arch_timer_context *timer_ctx)
449449 {
450− int ret;
451−
452450 kvm_timer_update_status(timer_ctx, new_level);
453451
454452 timer_ctx->irq.level = new_level;
455453 trace_kvm_timer_update_irq(vcpu->vcpu_id, timer_irq(timer_ctx),
456454 timer_ctx->irq.level);
457455
458− if (!userspace_irqchip(vcpu->kvm)) {
459− ret = kvm_vgic_inject_irq(vcpu->kvm, vcpu,
460− timer_irq(timer_ctx),
461− timer_ctx->irq.level,
462− timer_ctx);
463− WARN_ON(ret);
464− }
456+ if (userspace_irqchip(vcpu->kvm))
457+ return;
458+
459+ kvm_vgic_inject_irq(vcpu->kvm, vcpu,
460+ timer_irq(timer_ctx),
461+ timer_ctx->irq.level,
462+ timer_ctx);
465463 }
466464
467465 /* Only called for a fully emulated timer */
@@ -471,10 +469,8 @@ static void timer_emulate(struct arch_timer_context *ctx) · 3 unmodified lines
471469
472470 trace_kvm_timer_emulate(ctx, should_fire);
473471
474− if (should_fire != ctx->irq.level) {
472+ if (should_fire != ctx->irq.level)
475473 kvm_timer_update_irq(ctx->vcpu, should_fire, ctx);
476− return;
477− }
478474
479475 kvm_timer_update_status(ctx, should_fire);
480476
@@ -761,21 +757,6 @@ static void kvm_timer_vcpu_load_nested_switch(struct kvm_vcpu *vcpu, · 280 unmodified lines
761757 timer_irq(map->direct_ptimer),
762758 &arch_timer_irq_ops);
763759 WARN_ON_ONCE(ret);
764−
765− /*
766− * The virtual offset behaviour is "interesting", as it
767− * always applies when HCR_EL2.E2H==0, but only when
768− * accessed from EL1 when HCR_EL2.E2H==1. So make sure we
769− * track E2H when putting the HV timer in "direct" mode.
770− */
771− if (map->direct_vtimer == vcpu_hvtimer(vcpu)) {
772− struct arch_timer_offset *offs = &map->direct_vtimer->offset;
773−
774− if (vcpu_el2_e2h_is_set(vcpu))
775− offs->vcpu_offset = NULL;
776− else
777− offs->vcpu_offset = &__vcpu_sys_reg(vcpu, CNTVOFF_EL2);
778− }
779760 }
780761 }
781762
@@ -976,31 +957,21 @@ void kvm_timer_sync_nested(struct kvm_vcpu *vcpu) · 194 unmodified lines
976957 * which allows trapping of the timer registers even with NV2.
977958 * Still, this is still worse than FEAT_NV on its own. Meh.
978959 */
979− if (!vcpu_el2_e2h_is_set(vcpu)) {
980− if (cpus_have_final_cap(ARM64_HAS_ECV))
981− return;
982−
983− /*
984− * A non-VHE guest hypervisor doesn't have any direct access
985− * to its timers: the EL2 registers trap (and the HW is
986− * fully emulated), while the EL0 registers access memory
987− * despite the access being notionally direct. Boo.
988− *
989− * We update the hardware timer registers with the
990− * latest value written by the guest to the VNCR page
991− * and let the hardware take care of the rest.
992− */
993− write_sysreg_el0(__vcpu_sys_reg(vcpu, CNTV_CTL_EL0), SYS_CNTV_CTL);
994− write_sysreg_el0(__vcpu_sys_reg(vcpu, CNTV_CVAL_EL0), SYS_CNTV_CVAL);
995− write_sysreg_el0(__vcpu_sys_reg(vcpu, CNTP_CTL_EL0), SYS_CNTP_CTL);
996− write_sysreg_el0(__vcpu_sys_reg(vcpu, CNTP_CVAL_EL0), SYS_CNTP_CVAL);
997− } else {
960+ if (!cpus_have_final_cap(ARM64_HAS_ECV)) {
998961 /*
999962 * For a VHE guest hypervisor, the EL2 state is directly
1000− * stored in the host EL1 timers, while the emulated EL0
963+ * stored in the host EL1 timers, while the emulated EL1
1001964 * state is stored in the VNCR page. The latter could have
1002965 * been updated behind our back, and we must reset the
1003966 * emulation of the timers.
967+ *
968+ * A non-VHE guest hypervisor doesn't have any direct access
969+ * to its timers: the EL2 registers trap despite being
970+ * notionally direct (we use the EL1 HW, as for VHE), while
971+ * the EL1 registers access memory.
972+ *
973+ * In both cases, process the emulated timers on each guest
974+ * exit. Boo.
1004975 */
1005976 struct timer_map map;
1006977 get_timer_map(vcpu, &map);
arch/arm64/kvm/arm.c+20−8
@@ -2290,6 +2290,19 @@ static int __init init_subsystems(void) · 2289 unmodified lines
22902290 break;
22912291 case -ENODEV:
22922292 case -ENXIO:
2293+ /*
2294+ * No VGIC? No pKVM for you.
2295+ *
2296+ * Protected mode assumes that VGICv3 is present, so no point
2297+ * in trying to hobble along if vgic initialization fails.
2298+ */
2299+ if (is_protected_kvm_enabled())
2300+ goto out;
2301+
2302+ /*
2303+ * Otherwise, userspace could choose to implement a GIC for its
2304+ * guest on non-cooperative hardware.
2305+ */
22932306 vgic_present = false;
22942307 err = 0;
22952308 break;
@@ -2400,6 +2413,13 @@ static void kvm_hyp_init_symbols(void) · 104 unmodified lines
24002413 kvm_nvhe_sym(id_aa64smfr0_el1_sys_val) = read_sanitised_ftr_reg(SYS_ID_AA64SMFR0_EL1);
24012414 kvm_nvhe_sym(__icache_flags) = __icache_flags;
24022415 kvm_nvhe_sym(kvm_arm_vmid_bits) = kvm_arm_vmid_bits;
2416+
2417+ /*
2418+ * Flush entire BSS since part of its data containing init symbols is read
2419+ * while the MMU is off.
2420+ */
2421+ kvm_flush_dcache_to_poc(kvm_ksym_ref(__hyp_bss_start),
2422+ kvm_ksym_ref(__hyp_bss_end) - kvm_ksym_ref(__hyp_bss_start));
24032423 }
24042424
24052425 static int __init kvm_hyp_init_protection(u32 hyp_va_bits)
@@ -2461,14 +2481,6 @@ static void finalize_init_hyp_mode(void) · 55 unmodified lines
24612481 per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->sve_state =
24622482 kern_hyp_va(sve_state);
24632483 }
2464− } else {
2465− for_each_possible_cpu(cpu) {
2466− struct user_fpsimd_state *fpsimd_state;
2467−
2468− fpsimd_state = &per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->host_ctxt.fp_regs;
2469− per_cpu_ptr_nvhe_sym(kvm_host_data, cpu)->fpsimd_state =
2470− kern_hyp_va(fpsimd_state);
2471− }
24722484 }
24732485 }
24742486
arch/arm64/kvm/fpsimd.c+9−98
@@ -54,50 +54,18 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) · 53 unmodified lines
5454 if (!system_supports_fpsimd())
5555 return;
5656
57− fpsimd_kvm_prepare();
58−
5957 /*
60− * We will check TIF_FOREIGN_FPSTATE just before entering the
61− * guest in kvm_arch_vcpu_ctxflush_fp() and override this to
62− * FP_STATE_FREE if the flag set.
58+ * Ensure that any host FPSIMD/SVE/SME state is saved and unbound such
59+ * that the host kernel is responsible for restoring this state upon
60+ * return to userspace, and the hyp code doesn't need to save anything.
61+ *
62+ * When the host may use SME, fpsimd_save_and_flush_cpu_state() ensures
63+ * that PSTATE.{SM,ZA} == {0,0}.
6364 */
64− *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED;
65− *host_data_ptr(fpsimd_state) = kern_hyp_va(&current->thread.uw.fpsimd_state);
66− *host_data_ptr(fpmr_ptr) = kern_hyp_va(&current->thread.uw.fpmr);
67−
68− host_data_clear_flag(HOST_SVE_ENABLED);
69− if (read_sysreg(cpacr_el1) & CPACR_EL1_ZEN_EL0EN)
70− host_data_set_flag(HOST_SVE_ENABLED);
71−
72− if (system_supports_sme()) {
73− host_data_clear_flag(HOST_SME_ENABLED);
74− if (read_sysreg(cpacr_el1) & CPACR_EL1_SMEN_EL0EN)
75− host_data_set_flag(HOST_SME_ENABLED);
76−
77− /*
78− * If PSTATE.SM is enabled then save any pending FP
79− * state and disable PSTATE.SM. If we leave PSTATE.SM
80− * enabled and the guest does not enable SME via
81− * CPACR_EL1.SMEN then operations that should be valid
82− * may generate SME traps from EL1 to EL1 which we
83− * can't intercept and which would confuse the guest.
84− *
85− * Do the same for PSTATE.ZA in the case where there
86− * is state in the registers which has not already
87− * been saved, this is very unlikely to happen.
88− */
89− if (read_sysreg_s(SYS_SVCR) & (SVCR_SM_MASK | SVCR_ZA_MASK)) {
90− *host_data_ptr(fp_owner) = FP_STATE_FREE;
91− fpsimd_save_and_flush_cpu_state();
92− }
93− }
65+ fpsimd_save_and_flush_cpu_state();
66+ *host_data_ptr(fp_owner) = FP_STATE_FREE;
9467
95− /*
96− * If normal guests gain SME support, maintain this behavior for pKVM
97− * guests, which don't support SME.
98− */
99− WARN_ON(is_protected_kvm_enabled() && system_supports_sme() &&
100− read_sysreg_s(SYS_SVCR));
68+ WARN_ON_ONCE(system_supports_sme() && read_sysreg_s(SYS_SVCR));
10169 }
10270
10371 /*
@@ -162,52 +130,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) · 58 unmodified lines
162130
163131 local_irq_save(flags);
164132
165− /*
166− * If we have VHE then the Hyp code will reset CPACR_EL1 to
167− * the default value and we need to reenable SME.
168− */
169− if (has_vhe() && system_supports_sme()) {
170− /* Also restore EL0 state seen on entry */
171− if (host_data_test_flag(HOST_SME_ENABLED))
172− sysreg_clear_set(CPACR_EL1, 0, CPACR_EL1_SMEN);
173− else
174− sysreg_clear_set(CPACR_EL1,
175− CPACR_EL1_SMEN_EL0EN,
176− CPACR_EL1_SMEN_EL1EN);
177− isb();
178− }
179−
180133 if (guest_owns_fp_regs()) {
181− if (vcpu_has_sve(vcpu)) {
182− u64 zcr = read_sysreg_el1(SYS_ZCR);
183−
184− /*
185− * If the vCPU is in the hyp context then ZCR_EL1 is
186− * loaded with its vEL2 counterpart.
187− */
188− __vcpu_sys_reg(vcpu, vcpu_sve_zcr_elx(vcpu)) = zcr;
189−
190− /*
191− * Restore the VL that was saved when bound to the CPU,
192− * which is the maximum VL for the guest. Because the
193− * layout of the data when saving the sve state depends
194− * on the VL, we need to use a consistent (i.e., the
195− * maximum) VL.
196− * Note that this means that at guest exit ZCR_EL1 is
197− * not necessarily the same as on guest entry.
198− *
199− * ZCR_EL2 holds the guest hypervisor's VL when running
200− * a nested guest, which could be smaller than the
201− * max for the vCPU. Similar to above, we first need to
202− * switch to a VL consistent with the layout of the
203− * vCPU's SVE state. KVM support for NV implies VHE, so
204− * using the ZCR_EL1 alias is safe.
205− */
206− if (!has_vhe() || (vcpu_has_nv(vcpu) && !is_hyp_ctxt(vcpu)))
207− sve_cond_update_zcr_vq(vcpu_sve_max_vq(vcpu) - 1,
208− SYS_ZCR_EL1);
209− }
210−
211134 /*
212135 * Flush (save and invalidate) the fpsimd/sve state so that if
213136 * the host tries to use fpsimd/sve, it's not using stale data
@@ -219,18 +142,6 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) · 5 unmodified lines
219142 * when needed.
220143 */
221144 fpsimd_save_and_flush_cpu_state();
222− } else if (has_vhe() && system_supports_sve()) {
223− /*
224− * The FPSIMD/SVE state in the CPU has not been touched, and we
225− * have SVE (and VHE): CPACR_EL1 (alias CPTR_EL2) has been
226− * reset by kvm_reset_cptr_el2() in the Hyp code, disabling SVE
227− * for EL0. To avoid spurious traps, restore the trap state
228− * seen by kvm_arch_vcpu_load_fp():
229− */
230− if (host_data_test_flag(HOST_SVE_ENABLED))
231− sysreg_clear_set(CPACR_EL1, 0, CPACR_EL1_ZEN_EL0EN);
232− else
233− sysreg_clear_set(CPACR_EL1, CPACR_EL1_ZEN_EL0EN, 0);
234145 }
235146
236147 local_irq_restore(flags);
arch/arm64/kvm/hyp/entry.S+5−0
@@ -44,6 +44,11 @@ alternative_if ARM64_HAS_RAS_EXTN · 43 unmodified lines
4444 alternative_else_nop_endif
4545 mrs x1, isr_el1
4646 cbz x1, 1f
47+
48+ // Ensure that __guest_enter() always provides a context
49+ // synchronization event so that callers don't need ISBs for anything
50+ // that would usually be synchonized by the ERET.
51+ isb
4752 mov x0, #ARM_EXCEPTION_IRQ
4853 ret
4954
arch/arm64/kvm/hyp/include/hyp/switch.h+111−37
@@ -326,7 +326,7 @@ static inline bool __populate_fault_info(struct kvm_vcpu *vcpu) · 325 unmodified lines
326326 return __get_fault_info(vcpu->arch.fault.esr_el2, &vcpu->arch.fault);
327327 }
328328
329−static bool kvm_hyp_handle_mops(struct kvm_vcpu *vcpu, u64 *exit_code)
329+static inline bool kvm_hyp_handle_mops(struct kvm_vcpu *vcpu, u64 *exit_code)
330330 {
331331 *vcpu_pc(vcpu) = read_sysreg_el2(SYS_ELR);
332332 arm64_mops_reset_regs(vcpu_gp_regs(vcpu), vcpu->arch.fault.esr_el2);
@@ -375,7 +375,87 @@ static inline void __hyp_sve_save_host(void) · 42 unmodified lines
375375 true);
376376 }
377377
378−static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu);
378+static inline void fpsimd_lazy_switch_to_guest(struct kvm_vcpu *vcpu)
379+{
380+ u64 zcr_el1, zcr_el2;
381+
382+ if (!guest_owns_fp_regs())
383+ return;
384+
385+ if (vcpu_has_sve(vcpu)) {
386+ /* A guest hypervisor may restrict the effective max VL. */
387+ if (vcpu_has_nv(vcpu) && !is_hyp_ctxt(vcpu))
388+ zcr_el2 = __vcpu_sys_reg(vcpu, ZCR_EL2);
389+ else
390+ zcr_el2 = vcpu_sve_max_vq(vcpu) - 1;
391+
392+ write_sysreg_el2(zcr_el2, SYS_ZCR);
393+
394+ zcr_el1 = __vcpu_sys_reg(vcpu, vcpu_sve_zcr_elx(vcpu));
395+ write_sysreg_el1(zcr_el1, SYS_ZCR);
396+ }
397+}
398+
399+static inline void fpsimd_lazy_switch_to_host(struct kvm_vcpu *vcpu)
400+{
401+ u64 zcr_el1, zcr_el2;
402+
403+ if (!guest_owns_fp_regs())
404+ return;
405+
406+ /*
407+ * When the guest owns the FP regs, we know that guest+hyp traps for
408+ * any FPSIMD/SVE/SME features exposed to the guest have been disabled
409+ * by either fpsimd_lazy_switch_to_guest() or kvm_hyp_handle_fpsimd()
410+ * prior to __guest_entry(). As __guest_entry() guarantees a context
411+ * synchronization event, we don't need an ISB here to avoid taking
412+ * traps for anything that was exposed to the guest.
413+ */
414+ if (vcpu_has_sve(vcpu)) {
415+ zcr_el1 = read_sysreg_el1(SYS_ZCR);
416+ __vcpu_sys_reg(vcpu, vcpu_sve_zcr_elx(vcpu)) = zcr_el1;
417+
418+ /*
419+ * The guest's state is always saved using the guest's max VL.
420+ * Ensure that the host has the guest's max VL active such that
421+ * the host can save the guest's state lazily, but don't
422+ * artificially restrict the host to the guest's max VL.
423+ */
424+ if (has_vhe()) {
425+ zcr_el2 = vcpu_sve_max_vq(vcpu) - 1;
426+ write_sysreg_el2(zcr_el2, SYS_ZCR);
427+ } else {
428+ zcr_el2 = sve_vq_from_vl(kvm_host_sve_max_vl) - 1;
429+ write_sysreg_el2(zcr_el2, SYS_ZCR);
430+
431+ zcr_el1 = vcpu_sve_max_vq(vcpu) - 1;
432+ write_sysreg_el1(zcr_el1, SYS_ZCR);
433+ }
434+ }
435+}
436+
437+static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)
438+{
439+ /*
440+ * Non-protected kvm relies on the host restoring its sve state.
441+ * Protected kvm restores the host's sve state as not to reveal that
442+ * fpsimd was used by a guest nor leak upper sve bits.
443+ */
444+ if (system_supports_sve()) {
445+ __hyp_sve_save_host();
446+
447+ /* Re-enable SVE traps if not supported for the guest vcpu. */
448+ if (!vcpu_has_sve(vcpu))
449+ cpacr_clear_set(CPACR_EL1_ZEN, 0);
450+
451+ } else {
452+ __fpsimd_save_state(host_data_ptr(host_ctxt.fp_regs));
453+ }
454+
455+ if (kvm_has_fpmr(kern_hyp_va(vcpu->kvm)))
456+ *host_data_ptr(fpmr) = read_sysreg_s(SYS_FPMR);
457+}
458+
379459
380460 /*
381461 * We trap the first access to the FP/SIMD to save the host context and
@@ -383,7 +463,7 @@ static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu); · 1 unmodified line
383463 * If FP/SIMD is not implemented, handle the trap and inject an undefined
384464 * instruction exception to the guest. Similarly for trapped SVE accesses.
385465 */
386−static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)
466+static inline bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)
387467 {
388468 bool sve_guest;
389469 u8 esr_ec;
@@ -425,7 +505,7 @@ static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code) · 35 unmodified lines
425505 isb();
426506
427507 /* Write out the host state if it's in the registers */
428− if (host_owns_fp_regs())
508+ if (is_protected_kvm_enabled() && host_owns_fp_regs())
429509 kvm_hyp_save_fpsimd_host(vcpu);
430510
431511 /* Restore the guest state */
@@ -501,9 +581,22 @@ static inline bool handle_tx2_tvm(struct kvm_vcpu *vcpu) · 69 unmodified lines
501581 return true;
502582 }
503583
584+/* Open-coded version of timer_get_offset() to allow for kern_hyp_va() */
585+static inline u64 hyp_timer_get_offset(struct arch_timer_context *ctxt)
586+{
587+ u64 offset = 0;
588+
589+ if (ctxt->offset.vm_offset)
590+ offset += *kern_hyp_va(ctxt->offset.vm_offset);
591+ if (ctxt->offset.vcpu_offset)
592+ offset += *kern_hyp_va(ctxt->offset.vcpu_offset);
593+
594+ return offset;
595+}
596+
504597 static inline u64 compute_counter_value(struct arch_timer_context *ctxt)
505598 {
506− return arch_timer_read_cntpct_el0() - timer_get_offset(ctxt);
599+ return arch_timer_read_cntpct_el0() - hyp_timer_get_offset(ctxt);
507600 }
508601
509602 static bool kvm_handle_cntxct(struct kvm_vcpu *vcpu)
@@ -587,7 +680,7 @@ static bool handle_ampere1_tcr(struct kvm_vcpu *vcpu) · 77 unmodified lines
587680 return true;
588681 }
589682
590−static bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code)
683+static inline bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code)
591684 {
592685 if (cpus_have_final_cap(ARM64_WORKAROUND_CAVIUM_TX2_219_TVM) &&
593686 handle_tx2_tvm(vcpu))
@@ -607,7 +700,7 @@ static bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code) · 13 unmodified lines
607700 return false;
608701 }
609702
610−static bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code)
703+static inline bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code)
611704 {
612705 if (static_branch_unlikely(&vgic_v3_cpuif_trap) &&
613706 __vgic_v3_perform_cpuif_access(vcpu) == 1)
@@ -616,19 +709,18 @@ static bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code) · 2 unmodified lines
616709 return false;
617710 }
618711
619−static bool kvm_hyp_handle_memory_fault(struct kvm_vcpu *vcpu, u64 *exit_code)
712+static inline bool kvm_hyp_handle_memory_fault(struct kvm_vcpu *vcpu,
713+ u64 *exit_code)
620714 {
621715 if (!__populate_fault_info(vcpu))
622716 return true;
623717
624718 return false;
625719 }
626−static bool kvm_hyp_handle_iabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
627− __alias(kvm_hyp_handle_memory_fault);
628−static bool kvm_hyp_handle_watchpt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
629− __alias(kvm_hyp_handle_memory_fault);
720+#define kvm_hyp_handle_iabt_low kvm_hyp_handle_memory_fault
721+#define kvm_hyp_handle_watchpt_low kvm_hyp_handle_memory_fault
630722
631−static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
723+static inline bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code)
632724 {
633725 if (kvm_hyp_handle_memory_fault(vcpu, exit_code))
634726 return true;
@@ -658,23 +750,16 @@ static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) · 23 unmodified lines
658750
659751 typedef bool (*exit_handler_fn)(struct kvm_vcpu *, u64 *);
660752
661−static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu);
662−
663−static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code);
664−
665753 /*
666754 * Allow the hypervisor to handle the exit with an exit handler if it has one.
667755 *
668756 * Returns true if the hypervisor handled the exit, and control should go back
669757 * to the guest, or false if it hasn't.
670758 */
671−static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
759+static inline bool kvm_hyp_handle_exit(struct kvm_vcpu *vcpu, u64 *exit_code,
760+ const exit_handler_fn *handlers)
672761 {
673− const exit_handler_fn *handlers = kvm_get_exit_handler_array(vcpu);
674− exit_handler_fn fn;
675−
676− fn = handlers[kvm_vcpu_trap_get_class(vcpu)];
677−
762+ exit_handler_fn fn = handlers[kvm_vcpu_trap_get_class(vcpu)];
678763 if (fn)
679764 return fn(vcpu, exit_code);
680765
@@ -704,20 +789,9 @@ static inline void synchronize_vcpu_pstate(struct kvm_vcpu *vcpu, u64 *exit_code · 23 unmodified lines
704789 * the guest, false when we should restore the host state and return to the
705790 * main run loop.
706791 */
707−static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
792+static inline bool __fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code,
793+ const exit_handler_fn *handlers)
708794 {
709− /*
710− * Save PSTATE early so that we can evaluate the vcpu mode
711− * early on.
712− */
713− synchronize_vcpu_pstate(vcpu, exit_code);
714−
715− /*
716− * Check whether we want to repaint the state one way or
717− * another.
718− */
719− early_exit_filter(vcpu, exit_code);
720−
721795 if (ARM_EXCEPTION_CODE(*exit_code) != ARM_EXCEPTION_IRQ)
722796 vcpu->arch.fault.esr_el2 = read_sysreg_el2(SYS_ESR);
723797
@@ -747,7 +821,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code) · 23 unmodified lines
747821 goto exit;
748822
749823 /* Check if there's an exit handler and allow it to handle the exit. */
750− if (kvm_hyp_handle_exit(vcpu, exit_code))
824+ if (kvm_hyp_handle_exit(vcpu, exit_code, handlers))
751825 goto guest;
752826 exit:
753827 /* Return to the host kernel and handle the exit */
arch/arm64/kvm/hyp/nvhe/hyp-main.c+31−8
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 */
66
77 #include <hyp/adjust_pc.h>
8+#include <hyp/switch.h>
89
910 #include <asm/pgtable-types.h>
1011 #include <asm/kvm_asm.h>
@@ -83,7 +84,7 @@ static void fpsimd_sve_sync(struct kvm_vcpu *vcpu) · 72 unmodified lines
8384 if (system_supports_sve())
8485 __hyp_sve_restore_host();
8586 else
86− __fpsimd_restore_state(*host_data_ptr(fpsimd_state));
87+ __fpsimd_restore_state(host_data_ptr(host_ctxt.fp_regs));
8788
8889 if (has_fpmr)
8990 write_sysreg_s(*host_data_ptr(fpmr), SYS_FPMR);
@@ -91,11 +92,34 @@ static void fpsimd_sve_sync(struct kvm_vcpu *vcpu) · 1 unmodified line
9192 *host_data_ptr(fp_owner) = FP_STATE_HOST_OWNED;
9293 }
9394
95+static void flush_debug_state(struct pkvm_hyp_vcpu *hyp_vcpu)
96+{
97+ struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu;
98+
99+ hyp_vcpu->vcpu.arch.debug_owner = host_vcpu->arch.debug_owner;
100+
101+ if (kvm_guest_owns_debug_regs(&hyp_vcpu->vcpu))
102+ hyp_vcpu->vcpu.arch.vcpu_debug_state = host_vcpu->arch.vcpu_debug_state;
103+ else if (kvm_host_owns_debug_regs(&hyp_vcpu->vcpu))
104+ hyp_vcpu->vcpu.arch.external_debug_state = host_vcpu->arch.external_debug_state;
105+}
106+
107+static void sync_debug_state(struct pkvm_hyp_vcpu *hyp_vcpu)
108+{
109+ struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu;
110+
111+ if (kvm_guest_owns_debug_regs(&hyp_vcpu->vcpu))
112+ host_vcpu->arch.vcpu_debug_state = hyp_vcpu->vcpu.arch.vcpu_debug_state;
113+ else if (kvm_host_owns_debug_regs(&hyp_vcpu->vcpu))
114+ host_vcpu->arch.external_debug_state = hyp_vcpu->vcpu.arch.external_debug_state;
115+}
116+
94117 static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu)
95118 {
96119 struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu;
97120
98121 fpsimd_sve_flush();
122+ flush_debug_state(hyp_vcpu);
99123
100124 hyp_vcpu->vcpu.arch.ctxt = host_vcpu->arch.ctxt;
101125
@@ -123,6 +147,7 @@ static void sync_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) · 21 unmodified lines
123147 unsigned int i;
124148
125149 fpsimd_sve_sync(&hyp_vcpu->vcpu);
150+ sync_debug_state(hyp_vcpu);
126151
127152 host_vcpu->arch.ctxt = hyp_vcpu->vcpu.arch.ctxt;
128153
@@ -200,8 +225,12 @@ static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt) · 71 unmodified lines
200225
201226 sync_hyp_vcpu(hyp_vcpu);
202227 } else {
228+ struct kvm_vcpu *vcpu = kern_hyp_va(host_vcpu);
229+
203230 /* The host is fully trusted, run its vCPU directly. */
204− ret = __kvm_vcpu_run(kern_hyp_va(host_vcpu));
231+ fpsimd_lazy_switch_to_guest(vcpu);
232+ ret = __kvm_vcpu_run(vcpu);
233+ fpsimd_lazy_switch_to_host(vcpu);
205234 }
206235 out:
207236 cpu_reg(host_ctxt, 1) = ret;
@@ -651,12 +680,6 @@ void handle_trap(struct kvm_cpu_context *host_ctxt) · 443 unmodified lines
651680 case ESR_ELx_EC_SMC64:
652681 handle_host_smc(host_ctxt);
653682 break;
654− case ESR_ELx_EC_SVE:
655− cpacr_clear_set(0, CPACR_EL1_ZEN);
656− isb();
657− sve_cond_update_zcr_vq(sve_vq_from_vl(kvm_host_sve_max_vl) - 1,
658− SYS_ZCR_EL2);
659− break;
660683 case ESR_ELx_EC_IABT_LOW:
661684 case ESR_ELx_EC_DABT_LOW:
662685 handle_host_mem_abort(host_ctxt);
arch/arm64/kvm/hyp/nvhe/mem_protect.c+41−35
@@ -943,10 +943,10 @@ static int __check_host_shared_guest(struct pkvm_hyp_vm *vm, u64 *__phys, u64 ip · 942 unmodified lines
943943 ret = kvm_pgtable_get_leaf(&vm->pgt, ipa, &pte, &level);
944944 if (ret)
945945 return ret;
946− if (level != KVM_PGTABLE_LAST_LEVEL)
947− return -E2BIG;
948946 if (!kvm_pte_valid(pte))
949947 return -ENOENT;
948+ if (level != KVM_PGTABLE_LAST_LEVEL)
949+ return -E2BIG;
950950
951951 state = guest_get_page_state(pte, ipa);
952952 if (state != PKVM_PAGE_SHARED_BORROWED)
@@ -998,63 +998,73 @@ unlock: · 45 unmodified lines
998998 return ret;
999999 }
10001000
1001−int __pkvm_host_relax_perms_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu, enum kvm_pgtable_prot prot)
1001+static void assert_host_shared_guest(struct pkvm_hyp_vm *vm, u64 ipa)
10021002 {
1003− struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);
1004− u64 ipa = hyp_pfn_to_phys(gfn);
10051003 u64 phys;
10061004 int ret;
10071005
1008− if (prot & ~KVM_PGTABLE_PROT_RWX)
1009− return -EINVAL;
1006+ if (!IS_ENABLED(CONFIG_NVHE_EL2_DEBUG))
1007+ return;
10101008
10111009 host_lock_component();
10121010 guest_lock_component(vm);
10131011
10141012 ret = __check_host_shared_guest(vm, &phys, ipa);
1015− if (!ret)
1016− ret = kvm_pgtable_stage2_relax_perms(&vm->pgt, ipa, prot, 0);
10171013
10181014 guest_unlock_component(vm);
10191015 host_unlock_component();
10201016
1021− return ret;
1017+ WARN_ON(ret && ret != -ENOENT);
10221018 }
10231019
1024−int __pkvm_host_wrprotect_guest(u64 gfn, struct pkvm_hyp_vm *vm)
1020+int __pkvm_host_relax_perms_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu, enum kvm_pgtable_prot prot)
10251021 {
1022+ struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);
10261023 u64 ipa = hyp_pfn_to_phys(gfn);
1027− u64 phys;
10281024 int ret;
10291025
1030− host_lock_component();
1031− guest_lock_component(vm);
1026+ if (pkvm_hyp_vm_is_protected(vm))
1027+ return -EPERM;
10321028
1033− ret = __check_host_shared_guest(vm, &phys, ipa);
1034− if (!ret)
1035− ret = kvm_pgtable_stage2_wrprotect(&vm->pgt, ipa, PAGE_SIZE);
1029+ if (prot & ~KVM_PGTABLE_PROT_RWX)
1030+ return -EINVAL;
10361031
1032+ assert_host_shared_guest(vm, ipa);
1033+ guest_lock_component(vm);
1034+ ret = kvm_pgtable_stage2_relax_perms(&vm->pgt, ipa, prot, 0);
10371035 guest_unlock_component(vm);
1038− host_unlock_component();
10391036
10401037 return ret;
10411038 }
10421039
1043−int __pkvm_host_test_clear_young_guest(u64 gfn, bool mkold, struct pkvm_hyp_vm *vm)
1040+int __pkvm_host_wrprotect_guest(u64 gfn, struct pkvm_hyp_vm *vm)
10441041 {
10451042 u64 ipa = hyp_pfn_to_phys(gfn);
1046− u64 phys;
10471043 int ret;
10481044
1049− host_lock_component();
1045+ if (pkvm_hyp_vm_is_protected(vm))
1046+ return -EPERM;
1047+
1048+ assert_host_shared_guest(vm, ipa);
10501049 guest_lock_component(vm);
1050+ ret = kvm_pgtable_stage2_wrprotect(&vm->pgt, ipa, PAGE_SIZE);
1051+ guest_unlock_component(vm);
10511052
1052− ret = __check_host_shared_guest(vm, &phys, ipa);
1053− if (!ret)
1054− ret = kvm_pgtable_stage2_test_clear_young(&vm->pgt, ipa, PAGE_SIZE, mkold);
1053+ return ret;
1054+}
1055+
1056+int __pkvm_host_test_clear_young_guest(u64 gfn, bool mkold, struct pkvm_hyp_vm *vm)
1057+{
1058+ u64 ipa = hyp_pfn_to_phys(gfn);
1059+ int ret;
1060+
1061+ if (pkvm_hyp_vm_is_protected(vm))
1062+ return -EPERM;
10551063
1064+ assert_host_shared_guest(vm, ipa);
1065+ guest_lock_component(vm);
1066+ ret = kvm_pgtable_stage2_test_clear_young(&vm->pgt, ipa, PAGE_SIZE, mkold);
10561067 guest_unlock_component(vm);
1057− host_unlock_component();
10581068
10591069 return ret;
10601070 }
@@ -1063,18 +1073,14 @@ int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu) · 2 unmodified lines
10631073 {
10641074 struct pkvm_hyp_vm *vm = pkvm_hyp_vcpu_to_hyp_vm(vcpu);
10651075 u64 ipa = hyp_pfn_to_phys(gfn);
1066− u64 phys;
1067− int ret;
1068−
1069− host_lock_component();
1070− guest_lock_component(vm);
10711076
1072− ret = __check_host_shared_guest(vm, &phys, ipa);
1073− if (!ret)
1074− kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);
1077+ if (pkvm_hyp_vm_is_protected(vm))
1078+ return -EPERM;
10751079
1080+ assert_host_shared_guest(vm, ipa);
1081+ guest_lock_component(vm);
1082+ kvm_pgtable_stage2_mkyoung(&vm->pgt, ipa, 0);
10761083 guest_unlock_component(vm);
1077− host_unlock_component();
10781084
1079− return ret;
1085+ return 0;
10801086 }
arch/arm64/kvm/hyp/nvhe/switch.c+45−44
@@ -39,6 +39,9 @@ static void __activate_cptr_traps(struct kvm_vcpu *vcpu) · 38 unmodified lines
3939 {
4040 u64 val = CPTR_EL2_TAM; /* Same bit irrespective of E2H */
4141
42+ if (!guest_owns_fp_regs())
43+ __activate_traps_fpsimd32(vcpu);
44+
4245 if (has_hvhe()) {
4346 val |= CPACR_EL1_TTA;
4447
@@ -47,6 +50,8 @@ static void __activate_cptr_traps(struct kvm_vcpu *vcpu) · 2 unmodified lines
4750 if (vcpu_has_sve(vcpu))
4851 val |= CPACR_EL1_ZEN;
4952 }
53+
54+ write_sysreg(val, cpacr_el1);
5055 } else {
5156 val |= CPTR_EL2_TTA | CPTR_NVHE_EL2_RES1;
5257
@@ -61,12 +66,32 @@ static void __activate_cptr_traps(struct kvm_vcpu *vcpu) · 8 unmodified lines
6166
6267 if (!guest_owns_fp_regs())
6368 val |= CPTR_EL2_TFP;
69+
70+ write_sysreg(val, cptr_el2);
6471 }
72+}
6573
66− if (!guest_owns_fp_regs())
67− __activate_traps_fpsimd32(vcpu);
74+static void __deactivate_cptr_traps(struct kvm_vcpu *vcpu)
75+{
76+ if (has_hvhe()) {
77+ u64 val = CPACR_EL1_FPEN;
78+
79+ if (cpus_have_final_cap(ARM64_SVE))
80+ val |= CPACR_EL1_ZEN;
81+ if (cpus_have_final_cap(ARM64_SME))
82+ val |= CPACR_EL1_SMEN;
6883
69− kvm_write_cptr_el2(val);
84+ write_sysreg(val, cpacr_el1);
85+ } else {
86+ u64 val = CPTR_NVHE_EL2_RES1;
87+
88+ if (!cpus_have_final_cap(ARM64_SVE))
89+ val |= CPTR_EL2_TZ;
90+ if (!cpus_have_final_cap(ARM64_SME))
91+ val |= CPTR_EL2_TSM;
92+
93+ write_sysreg(val, cptr_el2);
94+ }
7095 }
7196
7297 static void __activate_traps(struct kvm_vcpu *vcpu)
@@ -119,7 +144,7 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) · 46 unmodified lines
119144
120145 write_sysreg(this_cpu_ptr(&kvm_init_params)->hcr_el2, hcr_el2);
121146
122− kvm_reset_cptr_el2(vcpu);
147+ __deactivate_cptr_traps(vcpu);
123148 write_sysreg(__kvm_hyp_host_vector, vbar_el2);
124149 }
125150
@@ -192,34 +217,6 @@ static bool kvm_handle_pvm_sys64(struct kvm_vcpu *vcpu, u64 *exit_code) · 66 unmodified lines
192217 kvm_handle_pvm_sysreg(vcpu, exit_code));
193218 }
194219
195−static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)
196−{
197− /*
198− * Non-protected kvm relies on the host restoring its sve state.
199− * Protected kvm restores the host's sve state as not to reveal that
200− * fpsimd was used by a guest nor leak upper sve bits.
201− */
202− if (unlikely(is_protected_kvm_enabled() && system_supports_sve())) {
203− __hyp_sve_save_host();
204−
205− /* Re-enable SVE traps if not supported for the guest vcpu. */
206− if (!vcpu_has_sve(vcpu))
207− cpacr_clear_set(CPACR_EL1_ZEN, 0);
208−
209− } else {
210− __fpsimd_save_state(*host_data_ptr(fpsimd_state));
211− }
212−
213− if (kvm_has_fpmr(kern_hyp_va(vcpu->kvm))) {
214− u64 val = read_sysreg_s(SYS_FPMR);
215−
216− if (unlikely(is_protected_kvm_enabled()))
217− *host_data_ptr(fpmr) = val;
218− else
219− **host_data_ptr(fpmr_ptr) = val;
220− }
221−}
222−
223220 static const exit_handler_fn hyp_exit_handlers[] = {
224221 [0 ... ESR_ELx_EC_MAX] = NULL,
225222 [ESR_ELx_EC_CP15_32] = kvm_hyp_handle_cp15_32,
@@ -251,19 +248,21 @@ static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu) · 25 unmodified lines
251248 return hyp_exit_handlers;
252249 }
253250
254−/*
255− * Some guests (e.g., protected VMs) are not be allowed to run in AArch32.
256− * The ARMv8 architecture does not give the hypervisor a mechanism to prevent a
257− * guest from dropping to AArch32 EL0 if implemented by the CPU. If the
258− * hypervisor spots a guest in such a state ensure it is handled, and don't
259− * trust the host to spot or fix it. The check below is based on the one in
260− * kvm_arch_vcpu_ioctl_run().
261− *
262− * Returns false if the guest ran in AArch32 when it shouldn't have, and
263− * thus should exit to the host, or true if a the guest run loop can continue.
264− */
265−static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code)
251+static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
266252 {
253+ const exit_handler_fn *handlers = kvm_get_exit_handler_array(vcpu);
254+
255+ synchronize_vcpu_pstate(vcpu, exit_code);
256+
257+ /*
258+ * Some guests (e.g., protected VMs) are not be allowed to run in
259+ * AArch32. The ARMv8 architecture does not give the hypervisor a
260+ * mechanism to prevent a guest from dropping to AArch32 EL0 if
261+ * implemented by the CPU. If the hypervisor spots a guest in such a
262+ * state ensure it is handled, and don't trust the host to spot or fix
263+ * it. The check below is based on the one in
264+ * kvm_arch_vcpu_ioctl_run().
265+ */
267266 if (unlikely(vcpu_is_protected(vcpu) && vcpu_mode_is_32bit(vcpu))) {
268267 /*
269268 * As we have caught the guest red-handed, decide that it isn't
@@ -276,6 +275,8 @@ static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code) · 6 unmodified lines
276275 *exit_code &= BIT(ARM_EXIT_WITH_SERROR_BIT);
277276 *exit_code |= ARM_EXCEPTION_IL;
278277 }
278+
279+ return __fixup_guest_exit(vcpu, exit_code, handlers);
279280 }
280281
281282 /* Switch to the guest for legacy non-VHE systems */
arch/arm64/kvm/hyp/vhe/switch.c+19−14
@@ -136,6 +136,16 @@ write: · 135 unmodified lines
136136 write_sysreg(val, cpacr_el1);
137137 }
138138
139+static void __deactivate_cptr_traps(struct kvm_vcpu *vcpu)
140+{
141+ u64 val = CPACR_EL1_FPEN | CPACR_EL1_ZEN_EL1EN;
142+
143+ if (cpus_have_final_cap(ARM64_SME))
144+ val |= CPACR_EL1_SMEN_EL1EN;
145+
146+ write_sysreg(val, cpacr_el1);
147+}
148+
139149 static void __activate_traps(struct kvm_vcpu *vcpu)
140150 {
141151 u64 val;
@@ -207,7 +217,7 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) · 65 unmodified lines
207217 */
208218 asm(ALTERNATIVE("nop", "isb", ARM64_WORKAROUND_SPECULATIVE_AT));
209219
210− kvm_reset_cptr_el2(vcpu);
220+ __deactivate_cptr_traps(vcpu);
211221
212222 if (!arm64_kernel_unmapped_at_el0())
213223 host_vectors = __this_cpu_read(this_cpu_vector);
@@ -413,14 +423,6 @@ static bool kvm_hyp_handle_eret(struct kvm_vcpu *vcpu, u64 *exit_code) · 199 unmodified lines
413423 return true;
414424 }
415425
416−static void kvm_hyp_save_fpsimd_host(struct kvm_vcpu *vcpu)
417−{
418− __fpsimd_save_state(*host_data_ptr(fpsimd_state));
419−
420− if (kvm_has_fpmr(vcpu->kvm))
421− **host_data_ptr(fpmr_ptr) = read_sysreg_s(SYS_FPMR);
422−}
423−
424426 static bool kvm_hyp_handle_tlbi_el2(struct kvm_vcpu *vcpu, u64 *exit_code)
425427 {
426428 int ret = -EINVAL;
@@ -538,13 +540,10 @@ static const exit_handler_fn hyp_exit_handlers[] = { · 111 unmodified lines
538540 [ESR_ELx_EC_MOPS] = kvm_hyp_handle_mops,
539541 };
540542
541−static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu)
543+static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
542544 {
543− return hyp_exit_handlers;
544−}
545+ synchronize_vcpu_pstate(vcpu, exit_code);
545546
546−static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code)
547−{
548547 /*
549548 * If we were in HYP context on entry, adjust the PSTATE view
550549 * so that the usual helpers work correctly.
@@ -564,6 +563,8 @@ static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code) · 13 unmodified lines
564563 *vcpu_cpsr(vcpu) &= ~(PSR_MODE_MASK | PSR_MODE32_BIT);
565564 *vcpu_cpsr(vcpu) |= mode;
566565 }
566+
567+ return __fixup_guest_exit(vcpu, exit_code, hyp_exit_handlers);
567568 }
568569
569570 /* Switch to the guest for VHE systems running in EL2 */
@@ -578,6 +579,8 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) · 8 unmodified lines
578579
579580 sysreg_save_host_state_vhe(host_ctxt);
580581
582+ fpsimd_lazy_switch_to_guest(vcpu);
583+
581584 /*
582585 * Note that ARM erratum 1165522 requires us to configure both stage 1
583586 * and stage 2 translation for the guest context before we clear
@@ -602,6 +605,8 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) · 18 unmodified lines
602605
603606 __deactivate_traps(vcpu);
604607
608+ fpsimd_lazy_switch_to_host(vcpu);
609+
605610 sysreg_restore_host_state_vhe(host_ctxt);
606611
607612 if (guest_owns_fp_regs())
arch/arm64/kvm/nested.c+5−4
@@ -67,26 +67,27 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu) · 66 unmodified lines
6767 if (!tmp)
6868 return -ENOMEM;
6969
70+ swap(kvm->arch.nested_mmus, tmp);
71+
7072 /*
7173 * If we went through a realocation, adjust the MMU back-pointers in
7274 * the previously initialised kvm_pgtable structures.
7375 */
7476 if (kvm->arch.nested_mmus != tmp)
7577 for (int i = 0; i < kvm->arch.nested_mmus_size; i++)
76− tmp[i].pgt->mmu = &tmp[i];
78+ kvm->arch.nested_mmus[i].pgt->mmu = &kvm->arch.nested_mmus[i];
7779
7880 for (int i = kvm->arch.nested_mmus_size; !ret && i < num_mmus; i++)
79− ret = init_nested_s2_mmu(kvm, &tmp[i]);
81+ ret = init_nested_s2_mmu(kvm, &kvm->arch.nested_mmus[i]);
8082
8183 if (ret) {
8284 for (int i = kvm->arch.nested_mmus_size; i < num_mmus; i++)
83− kvm_free_stage2_pgd(&tmp[i]);
85+ kvm_free_stage2_pgd(&kvm->arch.nested_mmus[i]);
8486
8587 return ret;
8688 }
8789
8890 kvm->arch.nested_mmus_size = num_mmus;
89− kvm->arch.nested_mmus = tmp;
9091
9192 return 0;
9293 }
arch/arm64/kvm/sys_regs.c+13−3
@@ -1452,6 +1452,16 @@ static bool access_arch_timer(struct kvm_vcpu *vcpu, · 1451 unmodified lines
14521452 return true;
14531453 }
14541454
1455+static bool access_hv_timer(struct kvm_vcpu *vcpu,
1456+ struct sys_reg_params *p,
1457+ const struct sys_reg_desc *r)
1458+{
1459+ if (!vcpu_el2_e2h_is_set(vcpu))
1460+ return undef_access(vcpu, p, r);
1461+
1462+ return access_arch_timer(vcpu, p, r);
1463+}
1464+
14551465 static s64 kvm_arm64_ftr_safe_value(u32 id, const struct arm64_ftr_bits *ftrp,
14561466 s64 new, s64 cur)
14571467 {
@@ -3103,9 +3113,9 @@ static const struct sys_reg_desc sys_reg_descs[] = { · 1645 unmodified lines
31033113 EL2_REG(CNTHP_CTL_EL2, access_arch_timer, reset_val, 0),
31043114 EL2_REG(CNTHP_CVAL_EL2, access_arch_timer, reset_val, 0),
31053115
3106− { SYS_DESC(SYS_CNTHV_TVAL_EL2), access_arch_timer },
3107− EL2_REG(CNTHV_CTL_EL2, access_arch_timer, reset_val, 0),
3108− EL2_REG(CNTHV_CVAL_EL2, access_arch_timer, reset_val, 0),
3116+ { SYS_DESC(SYS_CNTHV_TVAL_EL2), access_hv_timer },
3117+ EL2_REG(CNTHV_CTL_EL2, access_hv_timer, reset_val, 0),
3118+ EL2_REG(CNTHV_CVAL_EL2, access_hv_timer, reset_val, 0),
31093119
31103120 { SYS_DESC(SYS_CNTKCTL_EL12), access_cntkctl_el12 },
31113121
arch/arm64/kvm/vgic/vgic-init.c+37−37
@@ -34,9 +34,9 @@ · 33 unmodified lines
3434 *
3535 * CPU Interface:
3636 *
37− * - kvm_vgic_vcpu_init(): initialization of static data that
38− * doesn't depend on any sizing information or emulation type. No
39− * allocation is allowed there.
37+ * - kvm_vgic_vcpu_init(): initialization of static data that doesn't depend
38+ * on any sizing information. Private interrupts are allocated if not
39+ * already allocated at vgic-creation time.
4040 */
4141
4242 /* EARLY INIT */
@@ -58,6 +58,8 @@ void kvm_vgic_early_init(struct kvm *kvm) · 15 unmodified lines
5858
5959 /* CREATION */
6060
61+static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu, u32 type);
62+
6163 /**
6264 * kvm_vgic_create: triggered by the instantiation of the VGIC device by
6365 * user space, either through the legacy KVM_CREATE_IRQCHIP ioctl (v2 only)
@@ -112,6 +114,22 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) · 48 unmodified lines
112114 goto out_unlock;
113115 }
114116
117+ kvm_for_each_vcpu(i, vcpu, kvm) {
118+ ret = vgic_allocate_private_irqs_locked(vcpu, type);
119+ if (ret)
120+ break;
121+ }
122+
123+ if (ret) {
124+ kvm_for_each_vcpu(i, vcpu, kvm) {
125+ struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
126+ kfree(vgic_cpu->private_irqs);
127+ vgic_cpu->private_irqs = NULL;
128+ }
129+
130+ goto out_unlock;
131+ }
132+
115133 kvm->arch.vgic.in_kernel = true;
116134 kvm->arch.vgic.vgic_model = type;
117135
@@ -180,7 +198,7 @@ static int kvm_vgic_dist_init(struct kvm *kvm, unsigned int nr_spis) · 62 unmodified lines
180198 return 0;
181199 }
182200
183−static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu)
201+static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu, u32 type)
184202 {
185203 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
186204 int i;
@@ -218,17 +236,28 @@ static int vgic_allocate_private_irqs_locked(struct kvm_vcpu *vcpu) · 31 unmodified lines
218236 /* PPIs */
219237 irq->config = VGIC_CONFIG_LEVEL;
220238 }
239+
240+ switch (type) {
241+ case KVM_DEV_TYPE_ARM_VGIC_V3:
242+ irq->group = 1;
243+ irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);
244+ break;
245+ case KVM_DEV_TYPE_ARM_VGIC_V2:
246+ irq->group = 0;
247+ irq->targets = BIT(vcpu->vcpu_id);
248+ break;
249+ }
221250 }
222251
223252 return 0;
224253 }
225254
226−static int vgic_allocate_private_irqs(struct kvm_vcpu *vcpu)
255+static int vgic_allocate_private_irqs(struct kvm_vcpu *vcpu, u32 type)
227256 {
228257 int ret;
229258
230259 mutex_lock(&vcpu->kvm->arch.config_lock);
231− ret = vgic_allocate_private_irqs_locked(vcpu);
260+ ret = vgic_allocate_private_irqs_locked(vcpu, type);
232261 mutex_unlock(&vcpu->kvm->arch.config_lock);
233262
234263 return ret;
@@ -258,7 +287,7 @@ int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu) · 23 unmodified lines
258287 if (!irqchip_in_kernel(vcpu->kvm))
259288 return 0;
260289
261− ret = vgic_allocate_private_irqs(vcpu);
290+ ret = vgic_allocate_private_irqs(vcpu, dist->vgic_model);
262291 if (ret)
263292 return ret;
264293
@@ -295,7 +324,7 @@ int vgic_init(struct kvm *kvm) · 30 unmodified lines
295324 {
296325 struct vgic_dist *dist = &kvm->arch.vgic;
297326 struct kvm_vcpu *vcpu;
298− int ret = 0, i;
327+ int ret = 0;
299328 unsigned long idx;
300329
301330 lockdep_assert_held(&kvm->arch.config_lock);
@@ -315,35 +344,6 @@ int vgic_init(struct kvm *kvm) · 13 unmodified lines
315344 if (ret)
316345 goto out;
317346
318− /* Initialize groups on CPUs created before the VGIC type was known */
319− kvm_for_each_vcpu(idx, vcpu, kvm) {
320− ret = vgic_allocate_private_irqs_locked(vcpu);
321− if (ret)
322− goto out;
323−
324− for (i = 0; i < VGIC_NR_PRIVATE_IRQS; i++) {
325− struct vgic_irq *irq = vgic_get_vcpu_irq(vcpu, i);
326−
327− switch (dist->vgic_model) {
328− case KVM_DEV_TYPE_ARM_VGIC_V3:
329− irq->group = 1;
330− irq->mpidr = kvm_vcpu_get_mpidr_aff(vcpu);
331− break;
332− case KVM_DEV_TYPE_ARM_VGIC_V2:
333− irq->group = 0;
334− irq->targets = 1U << idx;
335− break;
336− default:
337− ret = -EINVAL;
338− }
339−
340− vgic_put_irq(kvm, irq);
341−
342− if (ret)
343− goto out;
344− }
345− }
346−
347347 /*
348348 * If we have GICv4.1 enabled, unconditionally request enable the
349349 * v4 support so that we get HW-accelerated vSGIs. Otherwise, only
arch/arm64/mm/trans_pgd.c+7−0
@@ -162,6 +162,13 @@ static int copy_p4d(struct trans_pgd_info *info, pgd_t *dst_pgdp, · 161 unmodified lines
162162 unsigned long next;
163163 unsigned long addr = start;
164164
165+ if (pgd_none(READ_ONCE(*dst_pgdp))) {
166+ dst_p4dp = trans_alloc(info);
167+ if (!dst_p4dp)
168+ return -ENOMEM;
169+ pgd_populate(NULL, dst_pgdp, dst_p4dp);
170+ }
171+
165172 dst_p4dp = p4d_offset(dst_pgdp, start);
166173 src_p4dp = p4d_offset(src_pgdp, start);
167174 do {
arch/loongarch/include/asm/cpu-info.h+0−21
@@ -76,27 +76,6 @@ extern const char *__cpu_full_name[]; · 75 unmodified lines
7676 #define cpu_family_string() __cpu_family[raw_smp_processor_id()]
7777 #define cpu_full_name_string() __cpu_full_name[raw_smp_processor_id()]
7878
79−struct seq_file;
80−struct notifier_block;
81−
82−extern int register_proc_cpuinfo_notifier(struct notifier_block *nb);
83−extern int proc_cpuinfo_notifier_call_chain(unsigned long val, void *v);
84−
85−#define proc_cpuinfo_notifier(fn, pri) \
86−({ \
87− static struct notifier_block fn##_nb = { \
88− .notifier_call = fn, \
89− .priority = pri \
90− }; \
91− \
92− register_proc_cpuinfo_notifier(&fn##_nb); \
93−})
94−
95−struct proc_cpuinfo_notifier_args {
96− struct seq_file *m;
97− unsigned long n;
98−};
99−
10079 static inline bool cpus_are_siblings(int cpua, int cpub)
10180 {
10281 struct cpuinfo_loongarch *infoa = &cpu_data[cpua];
arch/loongarch/include/asm/smp.h+2−0
@@ -77,6 +77,8 @@ extern int __cpu_logical_map[NR_CPUS]; · 76 unmodified lines
7777 #define SMP_IRQ_WORK BIT(ACTION_IRQ_WORK)
7878 #define SMP_CLEAR_VECTOR BIT(ACTION_CLEAR_VECTOR)
7979
80+struct seq_file;
81+
8082 struct secondary_data {
8183 unsigned long stack;
8284 unsigned long thread_info;
arch/loongarch/kernel/genex.S+15−13
@@ -18,16 +18,19 @@ · 17 unmodified lines
1818
1919 .align 5
2020 SYM_FUNC_START(__arch_cpu_idle)
21− /* start of rollback region */
22− LONG_L t0, tp, TI_FLAGS
23− nop
24− andi t0, t0, _TIF_NEED_RESCHED
25− bnez t0, 1f
26− nop
27− nop
28− nop
21+ /* start of idle interrupt region */
22+ ori t0, zero, CSR_CRMD_IE
23+ /* idle instruction needs irq enabled */
24+ csrxchg t0, t0, LOONGARCH_CSR_CRMD
25+ /*
26+ * If an interrupt lands here; between enabling interrupts above and
27+ * going idle on the next instruction, we must *NOT* go idle since the
28+ * interrupt could have set TIF_NEED_RESCHED or caused an timer to need
29+ * reprogramming. Fall through -- see handle_vint() below -- and have
30+ * the idle loop take care of things.
31+ */
2932 idle 0
30− /* end of rollback region */
33+ /* end of idle interrupt region */
3134 1: jr ra
3235 SYM_FUNC_END(__arch_cpu_idle)
3336
@@ -35,11 +38,10 @@ SYM_CODE_START(handle_vint) · 1 unmodified line
3538 UNWIND_HINT_UNDEFINED
3639 BACKUP_T0T1
3740 SAVE_ALL
38− la_abs t1, __arch_cpu_idle
41+ la_abs t1, 1b
3942 LONG_L t0, sp, PT_ERA
40− /* 32 byte rollback region */
41− ori t0, t0, 0x1f
42− xori t0, t0, 0x1f
43+ /* 3 instructions idle interrupt region */
44+ ori t0, t0, 0b1100
4345 bne t0, t1, 1f
4446 LONG_S t0, sp, PT_ERA
4547 1: move a0, sp
arch/loongarch/kernel/idle.c+1−2
@@ -11,7 +11,6 @@ · 10 unmodified lines
1111
1212 void __cpuidle arch_cpu_idle(void)
1313 {
14− raw_local_irq_enable();
15− __arch_cpu_idle(); /* idle instruction needs irq enabled */
14+ __arch_cpu_idle();
1615 raw_local_irq_disable();
1716 }
arch/loongarch/kernel/proc.c+3−26
@@ -13,28 +13,12 @@ · 12 unmodified lines
1313 #include <asm/processor.h>
1414 #include <asm/time.h>
1515
16−/*
17− * No lock; only written during early bootup by CPU 0.
18− */
19−static RAW_NOTIFIER_HEAD(proc_cpuinfo_chain);
20−
21−int __ref register_proc_cpuinfo_notifier(struct notifier_block *nb)
22−{
23− return raw_notifier_chain_register(&proc_cpuinfo_chain, nb);
24−}
25−
26−int proc_cpuinfo_notifier_call_chain(unsigned long val, void *v)
27−{
28− return raw_notifier_call_chain(&proc_cpuinfo_chain, val, v);
29−}
30−
3116 static int show_cpuinfo(struct seq_file *m, void *v)
3217 {
3318 unsigned long n = (unsigned long) v - 1;
3419 unsigned int isa = cpu_data[n].isa_level;
3520 unsigned int version = cpu_data[n].processor_id & 0xff;
3621 unsigned int fp_version = cpu_data[n].fpu_vers;
37− struct proc_cpuinfo_notifier_args proc_cpuinfo_notifier_args;
3822
3923 #ifdef CONFIG_SMP
4024 if (!cpu_online(n))
@@ -91,20 +75,13 @@ static int show_cpuinfo(struct seq_file *m, void *v) · 50 unmodified lines
9175 if (cpu_has_lbt_mips) seq_printf(m, " lbt_mips");
9276 seq_printf(m, "\n");
9377
94− seq_printf(m, "Hardware Watchpoint\t: %s",
95− cpu_has_watch ? "yes, " : "no\n");
78+ seq_printf(m, "Hardware Watchpoint\t: %s", str_yes_no(cpu_has_watch));
9679 if (cpu_has_watch) {
97− seq_printf(m, "iwatch count: %d, dwatch count: %d\n",
80+ seq_printf(m, ", iwatch count: %d, dwatch count: %d",
9881 cpu_data[n].watch_ireg_count, cpu_data[n].watch_dreg_count);
9982 }
10083
101− proc_cpuinfo_notifier_args.m = m;
102− proc_cpuinfo_notifier_args.n = n;
103−
104− raw_notifier_call_chain(&proc_cpuinfo_chain, 0,
105− &proc_cpuinfo_notifier_args);
106−
107− seq_printf(m, "\n");
84+ seq_printf(m, "\n\n");
10885
10986 return 0;
11087 }
arch/loongarch/kernel/reset.c+3−3
@@ -33,7 +33,7 @@ void machine_halt(void) · 32 unmodified lines
3333 console_flush_on_panic(CONSOLE_FLUSH_PENDING);
3434
3535 while (true) {
36− __arch_cpu_idle();
36+ __asm__ __volatile__("idle 0" : : : "memory");
3737 }
3838 }
3939
@@ -53,7 +53,7 @@ void machine_power_off(void) · 13 unmodified lines
5353 #endif
5454
5555 while (true) {
56− __arch_cpu_idle();
56+ __asm__ __volatile__("idle 0" : : : "memory");
5757 }
5858 }
5959
@@ -74,6 +74,6 @@ void machine_restart(char *command) · 14 unmodified lines
7474 acpi_reboot();
7575
7676 while (true) {
77− __arch_cpu_idle();
77+ __asm__ __volatile__("idle 0" : : : "memory");
7878 }
7979 }
arch/loongarch/kvm/main.c+2−2
@@ -303,9 +303,9 @@ int kvm_arch_enable_virtualization_cpu(void) · 302 unmodified lines
303303 * TOE=0: Trap on Exception.
304304 * TIT=0: Trap on Timer.
305305 */
306− if (env & CSR_GCFG_GCIP_ALL)
306+ if (env & CSR_GCFG_GCIP_SECURE)
307307 gcfg |= CSR_GCFG_GCI_SECURE;
308− if (env & CSR_GCFG_MATC_ROOT)
308+ if (env & CSR_GCFG_MATP_ROOT)
309309 gcfg |= CSR_GCFG_MATC_ROOT;
310310
311311 write_csr_gcfg(gcfg);
arch/loongarch/kvm/switch.S+1−1
@@ -85,7 +85,7 @@ · 84 unmodified lines
8585 * Guest CRMD comes from separate GCSR_CRMD register
8686 */
8787 ori t0, zero, CSR_PRMD_PIE
88− csrxchg t0, t0, LOONGARCH_CSR_PRMD
88+ csrwr t0, LOONGARCH_CSR_PRMD
8989
9090 /* Set PVM bit to setup ertn to guest context */
9191 ori t0, zero, CSR_GSTAT_PVM
arch/loongarch/kvm/vcpu.c+0−3
@@ -1548,9 +1548,6 @@ static int _kvm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) · 1547 unmodified lines
15481548
15491549 /* Restore timer state regardless */
15501550 kvm_restore_timer(vcpu);
1551−
1552− /* Control guest page CCA attribute */
1553− change_csr_gcfg(CSR_GCFG_MATC_MASK, CSR_GCFG_MATC_ROOT);
15541551 kvm_make_request(KVM_REQ_STEAL_UPDATE, vcpu);
15551552
15561553 /* Restore hardware PMU CSRs */
arch/loongarch/lib/csum.c+1−1
@@ -25,7 +25,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len) · 24 unmodified lines
2525 const u64 *ptr;
2626 u64 data, sum64 = 0;
2727
28− if (unlikely(len == 0))
28+ if (unlikely(len <= 0))
2929 return 0;
3030
3131 offset = (unsigned long)buff & 7;
arch/loongarch/mm/pageattr.c+2−1
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 * Copyright (C) 2024 Loongson Technology Corporation Limited
44 */
55
6+#include <linux/memblock.h>
67 #include <linux/pagewalk.h>
78 #include <linux/pgtable.h>
89 #include <asm/set_memory.h>
@@ -167,7 +168,7 @@ bool kernel_page_present(struct page *page) · 158 unmodified lines
167168 unsigned long addr = (unsigned long)page_address(page);
168169
169170 if (addr < vm_map_base)
170− return true;
171+ return memblock_is_memory(__pa(addr));
171172
172173 pgd = pgd_offset_k(addr);
173174 if (pgd_none(pgdp_get(pgd)))
arch/mips/include/asm/ptrace.h+2−2
@@ -27,8 +27,8 @@ · 26 unmodified lines
2727 */
2828 struct pt_regs {
2929 #ifdef CONFIG_32BIT
30− /* Pad bytes for argument save space on the stack. */
31− unsigned long pad0[8];
30+ /* Saved syscall stack arguments; entries 0-3 unused. */
31+ unsigned long args[8];
3232 #endif
3333
3434 /* Saved main processor registers. */
arch/mips/include/asm/syscall.h+8−24
@@ -57,37 +57,21 @@ static inline void mips_syscall_update_nr(struct task_struct *task, · 56 unmodified lines
5757 static inline void mips_get_syscall_arg(unsigned long *arg,
5858 struct task_struct *task, struct pt_regs *regs, unsigned int n)
5959 {
60− unsigned long usp __maybe_unused = regs->regs[29];
61−
60+#ifdef CONFIG_32BIT
6261 switch (n) {
6362 case 0: case 1: case 2: case 3:
6463 *arg = regs->regs[4 + n];
65−
66− return;
67−
68−#ifdef CONFIG_32BIT
69− case 4: case 5: case 6: case 7:
70− get_user(*arg, (int *)usp + n);
7164 return;
72−#endif
73−
74−#ifdef CONFIG_64BIT
7565 case 4: case 5: case 6: case 7:
76−#ifdef CONFIG_MIPS32_O32
77− if (test_tsk_thread_flag(task, TIF_32BIT_REGS))
78− get_user(*arg, (int *)usp + n);
79− else
80−#endif
81− *arg = regs->regs[4 + n];
82−
66+ *arg = regs->args[n];
8367 return;
84−#endif
85−
86− default:
87− BUG();
8868 }
89−
90− unreachable();
69+#else
70+ *arg = regs->regs[4 + n];
71+ if ((IS_ENABLED(CONFIG_MIPS32_O32) &&
72+ test_tsk_thread_flag(task, TIF_32BIT_REGS)))
73+ *arg = (unsigned int)*arg;
74+#endif
9175 }
9276
9377 static inline long syscall_get_error(struct task_struct *task,
arch/mips/kernel/asm-offsets.c+6−0
@@ -27,6 +27,12 @@ void output_ptreg_defines(void); · 26 unmodified lines
2727 void output_ptreg_defines(void)
2828 {
2929 COMMENT("MIPS pt_regs offsets.");
30+#ifdef CONFIG_32BIT
31+ OFFSET(PT_ARG4, pt_regs, args[4]);
32+ OFFSET(PT_ARG5, pt_regs, args[5]);
33+ OFFSET(PT_ARG6, pt_regs, args[6]);
34+ OFFSET(PT_ARG7, pt_regs, args[7]);
35+#endif
3036 OFFSET(PT_R0, pt_regs, regs[0]);
3137 OFFSET(PT_R1, pt_regs, regs[1]);
3238 OFFSET(PT_R2, pt_regs, regs[2]);
arch/mips/kernel/scall32-o32.S+4−4
@@ -64,10 +64,10 @@ load_a6: user_lw(t7, 24(t0)) # argument #7 from usp · 63 unmodified lines
6464 load_a7: user_lw(t8, 28(t0)) # argument #8 from usp
6565 loads_done:
6666
67− sw t5, 16(sp) # argument #5 to ksp
68− sw t6, 20(sp) # argument #6 to ksp
69− sw t7, 24(sp) # argument #7 to ksp
70− sw t8, 28(sp) # argument #8 to ksp
67+ sw t5, PT_ARG4(sp) # argument #5 to ksp
68+ sw t6, PT_ARG5(sp) # argument #6 to ksp
69+ sw t7, PT_ARG6(sp) # argument #7 to ksp
70+ sw t8, PT_ARG7(sp) # argument #8 to ksp
7171 .set pop
7272
7373 .section __ex_table,"a"
arch/powerpc/include/asm/book3s/64/hash-4k.h+10−2
@@ -77,9 +77,17 @@ · 76 unmodified lines
7777 /*
7878 * With 4K page size the real_pte machinery is all nops.
7979 */
80−#define __real_pte(e, p, o) ((real_pte_t){(e)})
80+static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep, int offset)
81+{
82+ return (real_pte_t){pte};
83+}
84+
8185 #define __rpte_to_pte(r) ((r).pte)
82−#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
86+
87+static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index)
88+{
89+ return pte_val(__rpte_to_pte(rpte)) >> H_PAGE_F_GIX_SHIFT;
90+}
8391
8492 #define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
8593 do { \
arch/powerpc/lib/code-patching.c+3−1
@@ -108,7 +108,7 @@ static int text_area_cpu_up(unsigned int cpu) · 107 unmodified lines
108108 unsigned long addr;
109109 int err;
110110
111− area = get_vm_area(PAGE_SIZE, VM_ALLOC);
111+ area = get_vm_area(PAGE_SIZE, 0);
112112 if (!area) {
113113 WARN_ONCE(1, "Failed to create text area for cpu %d\n",
114114 cpu);
@@ -493,7 +493,9 @@ static int __do_patch_instructions_mm(u32 *addr, u32 *code, size_t len, bool rep · 378 unmodified lines
493493
494494 orig_mm = start_using_temp_mm(patching_mm);
495495
496+ kasan_disable_current();
496497 err = __patch_instructions(patch_addr, code, len, repeat_instr);
498+ kasan_enable_current();
497499
498500 /* context synchronisation performed by __patch_instructions */
499501 stop_using_temp_mm(patching_mm, orig_mm);
arch/powerpc/sysdev/fsl_msi.c+1−1
@@ -75,7 +75,7 @@ static void fsl_msi_print_chip(struct irq_data *irqd, struct seq_file *p) · 74 unmodified lines
7575 srs = (hwirq >> msi_data->srs_shift) & MSI_SRS_MASK;
7676 cascade_virq = msi_data->cascade_array[srs]->virq;
7777
78− seq_printf(p, " fsl-msi-%d", cascade_virq);
78+ seq_printf(p, "fsl-msi-%d", cascade_virq);
7979 }
8080
8181
arch/s390/configs/debug_defconfig+0−1
@@ -740,7 +740,6 @@ CONFIG_IMA=y · 739 unmodified lines
740740 CONFIG_IMA_DEFAULT_HASH_SHA256=y
741741 CONFIG_IMA_WRITE_POLICY=y
742742 CONFIG_IMA_APPRAISE=y
743−CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
744743 CONFIG_BUG_ON_DATA_CORRUPTION=y
745744 CONFIG_CRYPTO_USER=m
746745 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
arch/s390/configs/defconfig+0−1
@@ -725,7 +725,6 @@ CONFIG_IMA=y · 724 unmodified lines
725725 CONFIG_IMA_DEFAULT_HASH_SHA256=y
726726 CONFIG_IMA_WRITE_POLICY=y
727727 CONFIG_IMA_APPRAISE=y
728−CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
729728 CONFIG_BUG_ON_DATA_CORRUPTION=y
730729 CONFIG_CRYPTO_FIPS=y
731730 CONFIG_CRYPTO_USER=m
arch/s390/configs/zfcpdump_defconfig+0−1
@@ -62,7 +62,6 @@ CONFIG_ZFCP=y · 61 unmodified lines
6262 # CONFIG_INOTIFY_USER is not set
6363 # CONFIG_MISC_FILESYSTEMS is not set
6464 # CONFIG_NETWORK_FILESYSTEMS is not set
65−CONFIG_LSM="yama,loadpin,safesetid,integrity"
6665 # CONFIG_ZLIB_DFLTCC is not set
6766 CONFIG_XZ_DEC_MICROLZMA=y
6867 CONFIG_PRINTK_TIME=y
arch/s390/include/asm/bitops.h+5−1
@@ -53,7 +53,11 @@ static __always_inline bool arch_test_bit(unsigned long nr, const volatile unsig · 52 unmodified lines
5353 unsigned long mask;
5454 int cc;
5555
56− if (__builtin_constant_p(nr)) {
56+ /*
57+ * With CONFIG_PROFILE_ALL_BRANCHES enabled gcc fails to
58+ * handle __builtin_constant_p() in some cases.
59+ */
60+ if (!IS_ENABLED(CONFIG_PROFILE_ALL_BRANCHES) && __builtin_constant_p(nr)) {
5761 addr = (const volatile unsigned char *)ptr;
5862 addr += (nr ^ (BITS_PER_LONG - BITS_PER_BYTE)) / BITS_PER_BYTE;
5963 mask = 1UL << (nr & (BITS_PER_BYTE - 1));
arch/s390/include/asm/gmap.h+6−14
@@ -23,7 +23,6 @@ · 22 unmodified lines
2323 /**
2424 * struct gmap_struct - guest address space
2525 * @list: list head for the mm->context gmap list
26− * @crst_list: list of all crst tables used in the guest address space
2726 * @mm: pointer to the parent mm_struct
2827 * @guest_to_host: radix tree with guest to host address translation
2928 * @host_to_guest: radix tree with pointer to segment table entries
@@ -35,7 +34,6 @@ · 5 unmodified lines
3534 * @guest_handle: protected virtual machine handle for the ultravisor
3635 * @host_to_rmap: radix tree with gmap_rmap lists
3736 * @children: list of shadow gmap structures
38− * @pt_list: list of all page tables used in the shadow guest address space
3937 * @shadow_lock: spinlock to protect the shadow gmap list
4038 * @parent: pointer to the parent gmap for shadow guest address spaces
4139 * @orig_asce: ASCE for which the shadow page table has been created
@@ -45,7 +43,6 @@ · 3 unmodified lines
4543 */
4644 struct gmap {
4745 struct list_head list;
48− struct list_head crst_list;
4946 struct mm_struct *mm;
5047 struct radix_tree_root guest_to_host;
5148 struct radix_tree_root host_to_guest;
@@ -61,7 +58,6 @@ struct gmap { · 9 unmodified lines
6158 /* Additional data for shadow guest address spaces */
6259 struct radix_tree_root host_to_rmap;
6360 struct list_head children;
64− struct list_head pt_list;
6561 spinlock_t shadow_lock;
6662 struct gmap *parent;
6763 unsigned long orig_asce;
@@ -106,23 +102,21 @@ struct gmap *gmap_create(struct mm_struct *mm, unsigned long limit); · 38 unmodified lines
106102 void gmap_remove(struct gmap *gmap);
107103 struct gmap *gmap_get(struct gmap *gmap);
108104 void gmap_put(struct gmap *gmap);
105+void gmap_free(struct gmap *gmap);
106+struct gmap *gmap_alloc(unsigned long limit);
109107
110108 int gmap_map_segment(struct gmap *gmap, unsigned long from,
111109 unsigned long to, unsigned long len);
112110 int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len);
113111 unsigned long __gmap_translate(struct gmap *, unsigned long gaddr);
114−unsigned long gmap_translate(struct gmap *, unsigned long gaddr);
115112 int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr);
116−int gmap_fault(struct gmap *, unsigned long gaddr, unsigned int fault_flags);
117113 void gmap_discard(struct gmap *, unsigned long from, unsigned long to);
118114 void __gmap_zap(struct gmap *, unsigned long gaddr);
119115 void gmap_unlink(struct mm_struct *, unsigned long *table, unsigned long vmaddr);
120116
121117 int gmap_read_table(struct gmap *gmap, unsigned long gaddr, unsigned long *val);
122118
123−struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce,
124− int edat_level);
125−int gmap_shadow_valid(struct gmap *sg, unsigned long asce, int edat_level);
119+void gmap_unshadow(struct gmap *sg);
126120 int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t,
127121 int fake);
128122 int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t,
@@ -131,24 +125,22 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, · 2 unmodified lines
131125 int fake);
132126 int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt,
133127 int fake);
134−int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr,
135− unsigned long *pgt, int *dat_protection, int *fake);
136128 int gmap_shadow_page(struct gmap *sg, unsigned long saddr, pte_t pte);
137129
138130 void gmap_register_pte_notifier(struct gmap_notifier *);
139131 void gmap_unregister_pte_notifier(struct gmap_notifier *);
140132
141−int gmap_mprotect_notify(struct gmap *, unsigned long start,
142− unsigned long len, int prot);
133+int gmap_protect_one(struct gmap *gmap, unsigned long gaddr, int prot, unsigned long bits);
143134
144135 void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long dirty_bitmap[4],
145136 unsigned long gaddr, unsigned long vmaddr);
146137 int s390_disable_cow_sharing(void);
147−void s390_unlist_old_asce(struct gmap *gmap);
148138 int s390_replace_asce(struct gmap *gmap);
149139 void s390_uv_destroy_pfns(unsigned long count, unsigned long *pfns);
150140 int __s390_uv_destroy_range(struct mm_struct *mm, unsigned long start,
151141 unsigned long end, bool interruptible);
142+int kvm_s390_wiggle_split_folio(struct mm_struct *mm, struct folio *folio, bool split);
143+unsigned long *gmap_table_walk(struct gmap *gmap, unsigned long gaddr, int level);
152144
153145 /**
154146 * s390_uv_destroy_range - Destroy a range of pages in the given mm.
arch/s390/include/asm/kvm_host.h+5−1
@@ -30,6 +30,8 @@ · 29 unmodified lines
3030 #define KVM_S390_ESCA_CPU_SLOTS 248
3131 #define KVM_MAX_VCPUS 255
3232
33+#define KVM_INTERNAL_MEM_SLOTS 1
34+
3335 /*
3436 * These seem to be used for allocating ->chip in the routing table, which we
3537 * don't use. 1 is as small as we can get to reduce the needed memory. If we
@@ -931,12 +933,14 @@ struct sie_page2 { · 895 unmodified lines
931933 u8 reserved928[0x1000 - 0x928]; /* 0x0928 */
932934 };
933935
936+struct vsie_page;
937+
934938 struct kvm_s390_vsie {
935939 struct mutex mutex;
936940 struct radix_tree_root addr_to_page;
937941 int page_count;
938942 int next;
939− struct page *pages[KVM_MAX_VCPUS];
943+ struct vsie_page *pages[KVM_MAX_VCPUS];
940944 };
941945
942946 struct kvm_s390_gisa_iam {
arch/s390/include/asm/pgtable.h+18−3
@@ -420,9 +420,10 @@ void setup_protection_map(void); · 419 unmodified lines
420420 #define PGSTE_HC_BIT 0x0020000000000000UL
421421 #define PGSTE_GR_BIT 0x0004000000000000UL
422422 #define PGSTE_GC_BIT 0x0002000000000000UL
423−#define PGSTE_UC_BIT 0x0000800000000000UL /* user dirty (migration) */
424−#define PGSTE_IN_BIT 0x0000400000000000UL /* IPTE notify bit */
425−#define PGSTE_VSIE_BIT 0x0000200000000000UL /* ref'd in a shadow table */
423+#define PGSTE_ST2_MASK 0x0000ffff00000000UL
424+#define PGSTE_UC_BIT 0x0000000000008000UL /* user dirty (migration) */
425+#define PGSTE_IN_BIT 0x0000000000004000UL /* IPTE notify bit */
426+#define PGSTE_VSIE_BIT 0x0000000000002000UL /* ref'd in a shadow table */
426427
427428 /* Guest Page State used for virtualization */
428429 #define _PGSTE_GPS_ZERO 0x0000000080000000UL
@@ -2007,4 +2008,18 @@ extern void s390_reset_cmma(struct mm_struct *mm); · 1578 unmodified lines
20072008 #define pmd_pgtable(pmd) \
20082009 ((pgtable_t)__va(pmd_val(pmd) & -sizeof(pte_t)*PTRS_PER_PTE))
20092010
2011+static inline unsigned long gmap_pgste_get_pgt_addr(unsigned long *pgt)
2012+{
2013+ unsigned long *pgstes, res;
2014+
2015+ pgstes = pgt + _PAGE_ENTRIES;
2016+
2017+ res = (pgstes[0] & PGSTE_ST2_MASK) << 16;
2018+ res |= pgstes[1] & PGSTE_ST2_MASK;
2019+ res |= (pgstes[2] & PGSTE_ST2_MASK) >> 16;
2020+ res |= (pgstes[3] & PGSTE_ST2_MASK) >> 32;
2021+
2022+ return res;
2023+}
2024+
20102025 #endif /* _S390_PAGE_H */
arch/s390/include/asm/uv.h+3−3
@@ -628,12 +628,12 @@ static inline int is_prot_virt_host(void) · 627 unmodified lines
628628 }
629629
630630 int uv_pin_shared(unsigned long paddr);
631−int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb);
632−int gmap_destroy_page(struct gmap *gmap, unsigned long gaddr);
633631 int uv_destroy_folio(struct folio *folio);
634632 int uv_destroy_pte(pte_t pte);
635633 int uv_convert_from_secure_pte(pte_t pte);
636−int gmap_convert_to_secure(struct gmap *gmap, unsigned long gaddr);
634+int make_folio_secure(struct folio *folio, struct uv_cb_header *uvcb);
635+int uv_convert_from_secure(unsigned long paddr);
636+int uv_convert_from_secure_folio(struct folio *folio);
637637
638638 void setup_uv(void);
639639
arch/s390/kernel/uv.c+29−263
@@ -19,19 +19,6 @@ · 18 unmodified lines
1919 #include <asm/sections.h>
2020 #include <asm/uv.h>
2121
22−#if !IS_ENABLED(CONFIG_KVM)
23−unsigned long __gmap_translate(struct gmap *gmap, unsigned long gaddr)
24−{
25− return 0;
26−}
27−
28−int gmap_fault(struct gmap *gmap, unsigned long gaddr,
29− unsigned int fault_flags)
30−{
31− return 0;
32−}
33−#endif
34−
3522 /* the bootdata_preserved fields come from ones in arch/s390/boot/uv.c */
3623 int __bootdata_preserved(prot_virt_guest);
3724 EXPORT_SYMBOL(prot_virt_guest);
@@ -159,6 +146,7 @@ int uv_destroy_folio(struct folio *folio) · 121 unmodified lines
159146 folio_put(folio);
160147 return rc;
161148 }
149+EXPORT_SYMBOL(uv_destroy_folio);
162150
163151 /*
164152 * The present PTE still indirectly holds a folio reference through the mapping.
@@ -175,7 +163,7 @@ int uv_destroy_pte(pte_t pte) · 10 unmodified lines
175163 *
176164 * @paddr: Absolute host address of page to be exported
177165 */
178−static int uv_convert_from_secure(unsigned long paddr)
166+int uv_convert_from_secure(unsigned long paddr)
179167 {
180168 struct uv_cb_cfs uvcb = {
181169 .header.cmd = UVC_CMD_CONV_FROM_SEC_STOR,
@@ -187,11 +175,12 @@ static int uv_convert_from_secure(unsigned long paddr) · 5 unmodified lines
187175 return -EINVAL;
188176 return 0;
189177 }
178+EXPORT_SYMBOL_GPL(uv_convert_from_secure);
190179
191180 /*
192181 * The caller must already hold a reference to the folio.
193182 */
194−static int uv_convert_from_secure_folio(struct folio *folio)
183+int uv_convert_from_secure_folio(struct folio *folio)
195184 {
196185 int rc;
197186
@@ -206,6 +195,7 @@ static int uv_convert_from_secure_folio(struct folio *folio) · 8 unmodified lines
206195 folio_put(folio);
207196 return rc;
208197 }
198+EXPORT_SYMBOL_GPL(uv_convert_from_secure_folio);
209199
210200 /*
211201 * The present PTE still indirectly holds a folio reference through the mapping.
@@ -237,13 +227,33 @@ static int expected_folio_refs(struct folio *folio) · 25 unmodified lines
237227 return res;
238228 }
239229
240−static int make_folio_secure(struct folio *folio, struct uv_cb_header *uvcb)
230+/**
231+ * make_folio_secure() - make a folio secure
232+ * @folio: the folio to make secure
233+ * @uvcb: the uvcb that describes the UVC to be used
234+ *
235+ * The folio @folio will be made secure if possible, @uvcb will be passed
236+ * as-is to the UVC.
237+ *
238+ * Return: 0 on success;
239+ * -EBUSY if the folio is in writeback or has too many references;
240+ * -E2BIG if the folio is large;
241+ * -EAGAIN if the UVC needs to be attempted again;
242+ * -ENXIO if the address is not mapped;
243+ * -EINVAL if the UVC failed for other reasons.
244+ *
245+ * Context: The caller must hold exactly one extra reference on the folio
246+ * (it's the same logic as split_folio())
247+ */
248+int make_folio_secure(struct folio *folio, struct uv_cb_header *uvcb)
241249 {
242250 int expected, cc = 0;
243251
252+ if (folio_test_large(folio))
253+ return -E2BIG;
244254 if (folio_test_writeback(folio))
245− return -EAGAIN;
246− expected = expected_folio_refs(folio);
255+ return -EBUSY;
256+ expected = expected_folio_refs(folio) + 1;
247257 if (!folio_ref_freeze(folio, expected))
248258 return -EBUSY;
249259 set_bit(PG_arch_1, &folio->flags);
@@ -267,251 +277,7 @@ static int make_folio_secure(struct folio *folio, struct uv_cb_header *uvcb) · 17 unmodified lines
267277 return -EAGAIN;
268278 return uvcb->rc == 0x10a ? -ENXIO : -EINVAL;
269279 }
270−
271−/**
272− * should_export_before_import - Determine whether an export is needed
273− * before an import-like operation
274− * @uvcb: the Ultravisor control block of the UVC to be performed
275− * @mm: the mm of the process
276− *
277− * Returns whether an export is needed before every import-like operation.
278− * This is needed for shared pages, which don't trigger a secure storage
279− * exception when accessed from a different guest.
280− *
281− * Although considered as one, the Unpin Page UVC is not an actual import,
282− * so it is not affected.
283− *
284− * No export is needed also when there is only one protected VM, because the
285− * page cannot belong to the wrong VM in that case (there is no "other VM"
286− * it can belong to).
287− *
288− * Return: true if an export is needed before every import, otherwise false.
289− */
290−static bool should_export_before_import(struct uv_cb_header *uvcb, struct mm_struct *mm)
291−{
292− /*
293− * The misc feature indicates, among other things, that importing a
294− * shared page from a different protected VM will automatically also
295− * transfer its ownership.
296− */
297− if (uv_has_feature(BIT_UV_FEAT_MISC))
298− return false;
299− if (uvcb->cmd == UVC_CMD_UNPIN_PAGE_SHARED)
300− return false;
301− return atomic_read(&mm->context.protected_count) > 1;
302−}
303−
304−/*
305− * Drain LRU caches: the local one on first invocation and the ones of all
306− * CPUs on successive invocations. Returns "true" on the first invocation.
307− */
308−static bool drain_lru(bool *drain_lru_called)
309−{
310− /*
311− * If we have tried a local drain and the folio refcount
312− * still does not match our expected safe value, try with a
313− * system wide drain. This is needed if the pagevecs holding
314− * the page are on a different CPU.
315− */
316− if (*drain_lru_called) {
317− lru_add_drain_all();
318− /* We give up here, don't retry immediately. */
319− return false;
320− }
321− /*
322− * We are here if the folio refcount does not match the
323− * expected safe value. The main culprits are usually
324− * pagevecs. With lru_add_drain() we drain the pagevecs
325− * on the local CPU so that hopefully the refcount will
326− * reach the expected safe value.
327− */
328− lru_add_drain();
329− *drain_lru_called = true;
330− /* The caller should try again immediately */
331− return true;
332−}
333−
334−/*
335− * Requests the Ultravisor to make a page accessible to a guest.
336− * If it's brought in the first time, it will be cleared. If
337− * it has been exported before, it will be decrypted and integrity
338− * checked.
339− */
340−int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)
341−{
342− struct vm_area_struct *vma;
343− bool drain_lru_called = false;
344− spinlock_t *ptelock;
345− unsigned long uaddr;
346− struct folio *folio;
347− pte_t *ptep;
348− int rc;
349−
350−again:
351− rc = -EFAULT;
352− mmap_read_lock(gmap->mm);
353−
354− uaddr = __gmap_translate(gmap, gaddr);
355− if (IS_ERR_VALUE(uaddr))
356− goto out;
357− vma = vma_lookup(gmap->mm, uaddr);
358− if (!vma)
359− goto out;
360− /*
361− * Secure pages cannot be huge and userspace should not combine both.
362− * In case userspace does it anyway this will result in an -EFAULT for
363− * the unpack. The guest is thus never reaching secure mode. If
364− * userspace is playing dirty tricky with mapping huge pages later
365− * on this will result in a segmentation fault.
366− */
367− if (is_vm_hugetlb_page(vma))
368− goto out;
369−
370− rc = -ENXIO;
371− ptep = get_locked_pte(gmap->mm, uaddr, &ptelock);
372− if (!ptep)
373− goto out;
374− if (pte_present(*ptep) && !(pte_val(*ptep) & _PAGE_INVALID) && pte_write(*ptep)) {
375− folio = page_folio(pte_page(*ptep));
376− rc = -EAGAIN;
377− if (folio_test_large(folio)) {
378− rc = -E2BIG;
379− } else if (folio_trylock(folio)) {
380− if (should_export_before_import(uvcb, gmap->mm))
381− uv_convert_from_secure(PFN_PHYS(folio_pfn(folio)));
382− rc = make_folio_secure(folio, uvcb);
383− folio_unlock(folio);
384− }
385−
386− /*
387− * Once we drop the PTL, the folio may get unmapped and
388− * freed immediately. We need a temporary reference.
389− */
390− if (rc == -EAGAIN || rc == -E2BIG)
391− folio_get(folio);
392− }
393− pte_unmap_unlock(ptep, ptelock);
394−out:
395− mmap_read_unlock(gmap->mm);
396−
397− switch (rc) {
398− case -E2BIG:
399− folio_lock(folio);
400− rc = split_folio(folio);
401− folio_unlock(folio);
402− folio_put(folio);
403−
404− switch (rc) {
405− case 0:
406− /* Splitting succeeded, try again immediately. */
407− goto again;
408− case -EAGAIN:
409− /* Additional folio references. */
410− if (drain_lru(&drain_lru_called))
411− goto again;
412− return -EAGAIN;
413− case -EBUSY:
414− /* Unexpected race. */
415− return -EAGAIN;
416− }
417− WARN_ON_ONCE(1);
418− return -ENXIO;
419− case -EAGAIN:
420− /*
421− * If we are here because the UVC returned busy or partial
422− * completion, this is just a useless check, but it is safe.
423− */
424− folio_wait_writeback(folio);
425− folio_put(folio);
426− return -EAGAIN;
427− case -EBUSY:
428− /* Additional folio references. */
429− if (drain_lru(&drain_lru_called))
430− goto again;
431− return -EAGAIN;
432− case -ENXIO:
433− if (gmap_fault(gmap, gaddr, FAULT_FLAG_WRITE))
434− return -EFAULT;
435− return -EAGAIN;
436− }
437− return rc;
438−}
439−EXPORT_SYMBOL_GPL(gmap_make_secure);
440−
441−int gmap_convert_to_secure(struct gmap *gmap, unsigned long gaddr)
442−{
443− struct uv_cb_cts uvcb = {
444− .header.cmd = UVC_CMD_CONV_TO_SEC_STOR,
445− .header.len = sizeof(uvcb),
446− .guest_handle = gmap->guest_handle,
447− .gaddr = gaddr,
448− };
449−
450− return gmap_make_secure(gmap, gaddr, &uvcb);
451−}
452−EXPORT_SYMBOL_GPL(gmap_convert_to_secure);
453−
454−/**
455− * gmap_destroy_page - Destroy a guest page.
456− * @gmap: the gmap of the guest
457− * @gaddr: the guest address to destroy
458− *
459− * An attempt will be made to destroy the given guest page. If the attempt
460− * fails, an attempt is made to export the page. If both attempts fail, an
461− * appropriate error is returned.
462− */
463−int gmap_destroy_page(struct gmap *gmap, unsigned long gaddr)
464−{
465− struct vm_area_struct *vma;
466− struct folio_walk fw;
467− unsigned long uaddr;
468− struct folio *folio;
469− int rc;
470−
471− rc = -EFAULT;
472− mmap_read_lock(gmap->mm);
473−
474− uaddr = __gmap_translate(gmap, gaddr);
475− if (IS_ERR_VALUE(uaddr))
476− goto out;
477− vma = vma_lookup(gmap->mm, uaddr);
478− if (!vma)
479− goto out;
480− /*
481− * Huge pages should not be able to become secure
482− */
483− if (is_vm_hugetlb_page(vma))
484− goto out;
485−
486− rc = 0;
487− folio = folio_walk_start(&fw, vma, uaddr, 0);
488− if (!folio)
489− goto out;
490− /*
491− * See gmap_make_secure(): large folios cannot be secure. Small
492− * folio implies FW_LEVEL_PTE.
493− */
494− if (folio_test_large(folio) || !pte_write(fw.pte))
495− goto out_walk_end;
496− rc = uv_destroy_folio(folio);
497− /*
498− * Fault handlers can race; it is possible that two CPUs will fault
499− * on the same secure page. One CPU can destroy the page, reboot,
500− * re-enter secure mode and import it, while the second CPU was
501− * stuck at the beginning of the handler. At some point the second
502− * CPU will be able to progress, and it will not be able to destroy
503− * the page. In that case we do not want to terminate the process,
504− * we instead try to export the page.
505− */
506− if (rc)
507− rc = uv_convert_from_secure_folio(folio);
508−out_walk_end:
509− folio_walk_end(&fw, vma);
510−out:
511− mmap_read_unlock(gmap->mm);
512− return rc;
513−}
514−EXPORT_SYMBOL_GPL(gmap_destroy_page);
280+EXPORT_SYMBOL_GPL(make_folio_secure);
515281
516282 /*
517283 * To be called with the folio locked or with an extra reference! This will
arch/s390/kvm/Makefile+1−1
@@ -8,7 +8,7 @@ include $(srctree)/virt/kvm/Makefile.kvm · 7 unmodified lines
88 ccflags-y := -Ivirt/kvm -Iarch/s390/kvm
99
1010 kvm-y += kvm-s390.o intercept.o interrupt.o priv.o sigp.o
11−kvm-y += diag.o gaccess.o guestdbg.o vsie.o pv.o
11+kvm-y += diag.o gaccess.o guestdbg.o vsie.o pv.o gmap.o gmap-vsie.o
1212
1313 kvm-$(CONFIG_VFIO_PCI_ZDEV_KVM) += pci.o
1414 obj-$(CONFIG_KVM) += kvm.o
arch/s390/kvm/gaccess.c+43−1
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <asm/gmap.h>
1717 #include <asm/dat-bits.h>
1818 #include "kvm-s390.h"
19+#include "gmap.h"
1920 #include "gaccess.h"
2021
2122 /*
@@ -1392,6 +1393,44 @@ shadow_pgt: · 1370 unmodified lines
13921393 return 0;
13931394 }
13941395
1396+/**
1397+ * shadow_pgt_lookup() - find a shadow page table
1398+ * @sg: pointer to the shadow guest address space structure
1399+ * @saddr: the address in the shadow aguest address space
1400+ * @pgt: parent gmap address of the page table to get shadowed
1401+ * @dat_protection: if the pgtable is marked as protected by dat
1402+ * @fake: pgt references contiguous guest memory block, not a pgtable
1403+ *
1404+ * Returns 0 if the shadow page table was found and -EAGAIN if the page
1405+ * table was not found.
1406+ *
1407+ * Called with sg->mm->mmap_lock in read.
1408+ */
1409+static int shadow_pgt_lookup(struct gmap *sg, unsigned long saddr, unsigned long *pgt,
1410+ int *dat_protection, int *fake)
1411+{
1412+ unsigned long pt_index;
1413+ unsigned long *table;
1414+ struct page *page;
1415+ int rc;
1416+
1417+ spin_lock(&sg->guest_table_lock);
1418+ table = gmap_table_walk(sg, saddr, 1); /* get segment pointer */
1419+ if (table && !(*table & _SEGMENT_ENTRY_INVALID)) {
1420+ /* Shadow page tables are full pages (pte+pgste) */
1421+ page = pfn_to_page(*table >> PAGE_SHIFT);
1422+ pt_index = gmap_pgste_get_pgt_addr(page_to_virt(page));
1423+ *pgt = pt_index & ~GMAP_SHADOW_FAKE_TABLE;
1424+ *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT);
1425+ *fake = !!(pt_index & GMAP_SHADOW_FAKE_TABLE);
1426+ rc = 0;
1427+ } else {
1428+ rc = -EAGAIN;
1429+ }
1430+ spin_unlock(&sg->guest_table_lock);
1431+ return rc;
1432+}
1433+
13951434 /**
13961435 * kvm_s390_shadow_fault - handle fault on a shadow page table
13971436 * @vcpu: virtual cpu
@@ -1415,6 +1454,9 @@ int kvm_s390_shadow_fault(struct kvm_vcpu *vcpu, struct gmap *sg, · 17 unmodified lines
14151454 int dat_protection, fake;
14161455 int rc;
14171456
1457+ if (KVM_BUG_ON(!gmap_is_shadow(sg), vcpu->kvm))
1458+ return -EFAULT;
1459+
14181460 mmap_read_lock(sg->mm);
14191461 /*
14201462 * We don't want any guest-2 tables to change - so the parent
@@ -1423,7 +1465,7 @@ int kvm_s390_shadow_fault(struct kvm_vcpu *vcpu, struct gmap *sg, · 2 unmodified lines
14231465 */
14241466 ipte_lock(vcpu->kvm);
14251467
1426− rc = gmap_shadow_pgt_lookup(sg, saddr, &pgt, &dat_protection, &fake);
1468+ rc = shadow_pgt_lookup(sg, saddr, &pgt, &dat_protection, &fake);
14271469 if (rc)
14281470 rc = kvm_s390_shadow_tables(sg, saddr, &pgt, &dat_protection,
14291471 &fake);
arch/s390/kvm/gmap-vsie.c+142−0
@@ -0,0 +1,142 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Guest memory management for KVM/s390 nested VMs.
4+ *
5+ * Copyright IBM Corp. 2008, 2020, 2024
6+ *
7+ * Author(s): Claudio Imbrenda <imbrenda@linux.ibm.com>
8+ * Martin Schwidefsky <schwidefsky@de.ibm.com>
9+ * David Hildenbrand <david@redhat.com>
10+ * Janosch Frank <frankja@linux.vnet.ibm.com>
11+ */
12+
13+#include <linux/compiler.h>
14+#include <linux/kvm.h>
15+#include <linux/kvm_host.h>
16+#include <linux/pgtable.h>
17+#include <linux/pagemap.h>
18+#include <linux/mman.h>
19+
20+#include <asm/lowcore.h>
21+#include <asm/gmap.h>
22+#include <asm/uv.h>
23+
24+#include "kvm-s390.h"
25+#include "gmap.h"
26+
27+/**
28+ * gmap_find_shadow - find a specific asce in the list of shadow tables
29+ * @parent: pointer to the parent gmap
30+ * @asce: ASCE for which the shadow table is created
31+ * @edat_level: edat level to be used for the shadow translation
32+ *
33+ * Returns the pointer to a gmap if a shadow table with the given asce is
34+ * already available, ERR_PTR(-EAGAIN) if another one is just being created,
35+ * otherwise NULL
36+ *
37+ * Context: Called with parent->shadow_lock held
38+ */
39+static struct gmap *gmap_find_shadow(struct gmap *parent, unsigned long asce, int edat_level)
40+{
41+ struct gmap *sg;
42+
43+ lockdep_assert_held(&parent->shadow_lock);
44+ list_for_each_entry(sg, &parent->children, list) {
45+ if (!gmap_shadow_valid(sg, asce, edat_level))
46+ continue;
47+ if (!sg->initialized)
48+ return ERR_PTR(-EAGAIN);
49+ refcount_inc(&sg->ref_count);
50+ return sg;
51+ }
52+ return NULL;
53+}
54+
55+/**
56+ * gmap_shadow - create/find a shadow guest address space
57+ * @parent: pointer to the parent gmap
58+ * @asce: ASCE for which the shadow table is created
59+ * @edat_level: edat level to be used for the shadow translation
60+ *
61+ * The pages of the top level page table referred by the asce parameter
62+ * will be set to read-only and marked in the PGSTEs of the kvm process.
63+ * The shadow table will be removed automatically on any change to the
64+ * PTE mapping for the source table.
65+ *
66+ * Returns a guest address space structure, ERR_PTR(-ENOMEM) if out of memory,
67+ * ERR_PTR(-EAGAIN) if the caller has to retry and ERR_PTR(-EFAULT) if the
68+ * parent gmap table could not be protected.
69+ */
70+struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce, int edat_level)
71+{
72+ struct gmap *sg, *new;
73+ unsigned long limit;
74+ int rc;
75+
76+ if (KVM_BUG_ON(parent->mm->context.allow_gmap_hpage_1m, (struct kvm *)parent->private) ||
77+ KVM_BUG_ON(gmap_is_shadow(parent), (struct kvm *)parent->private))
78+ return ERR_PTR(-EFAULT);
79+ spin_lock(&parent->shadow_lock);
80+ sg = gmap_find_shadow(parent, asce, edat_level);
81+ spin_unlock(&parent->shadow_lock);
82+ if (sg)
83+ return sg;
84+ /* Create a new shadow gmap */
85+ limit = -1UL >> (33 - (((asce & _ASCE_TYPE_MASK) >> 2) * 11));
86+ if (asce & _ASCE_REAL_SPACE)
87+ limit = -1UL;
88+ new = gmap_alloc(limit);
89+ if (!new)
90+ return ERR_PTR(-ENOMEM);
91+ new->mm = parent->mm;
92+ new->parent = gmap_get(parent);
93+ new->private = parent->private;
94+ new->orig_asce = asce;
95+ new->edat_level = edat_level;
96+ new->initialized = false;
97+ spin_lock(&parent->shadow_lock);
98+ /* Recheck if another CPU created the same shadow */
99+ sg = gmap_find_shadow(parent, asce, edat_level);
100+ if (sg) {
101+ spin_unlock(&parent->shadow_lock);
102+ gmap_free(new);
103+ return sg;
104+ }
105+ if (asce & _ASCE_REAL_SPACE) {
106+ /* only allow one real-space gmap shadow */
107+ list_for_each_entry(sg, &parent->children, list) {
108+ if (sg->orig_asce & _ASCE_REAL_SPACE) {
109+ spin_lock(&sg->guest_table_lock);
110+ gmap_unshadow(sg);
111+ spin_unlock(&sg->guest_table_lock);
112+ list_del(&sg->list);
113+ gmap_put(sg);
114+ break;
115+ }
116+ }
117+ }
118+ refcount_set(&new->ref_count, 2);
119+ list_add(&new->list, &parent->children);
120+ if (asce & _ASCE_REAL_SPACE) {
121+ /* nothing to protect, return right away */
122+ new->initialized = true;
123+ spin_unlock(&parent->shadow_lock);
124+ return new;
125+ }
126+ spin_unlock(&parent->shadow_lock);
127+ /* protect after insertion, so it will get properly invalidated */
128+ mmap_read_lock(parent->mm);
129+ rc = __kvm_s390_mprotect_many(parent, asce & _ASCE_ORIGIN,
130+ ((asce & _ASCE_TABLE_LENGTH) + 1),
131+ PROT_READ, GMAP_NOTIFY_SHADOW);
132+ mmap_read_unlock(parent->mm);
133+ spin_lock(&parent->shadow_lock);
134+ new->initialized = true;
135+ if (rc) {
136+ list_del(&new->list);
137+ gmap_free(new);
138+ new = ERR_PTR(rc);
139+ }
140+ spin_unlock(&parent->shadow_lock);
141+ return new;
142+}
arch/s390/kvm/gmap.c+212−0
@@ -0,0 +1,212 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Guest memory management for KVM/s390
4+ *
5+ * Copyright IBM Corp. 2008, 2020, 2024
6+ *
7+ * Author(s): Claudio Imbrenda <imbrenda@linux.ibm.com>
8+ * Martin Schwidefsky <schwidefsky@de.ibm.com>
9+ * David Hildenbrand <david@redhat.com>
10+ * Janosch Frank <frankja@linux.vnet.ibm.com>
11+ */
12+
13+#include <linux/compiler.h>
14+#include <linux/kvm.h>
15+#include <linux/kvm_host.h>
16+#include <linux/pgtable.h>
17+#include <linux/pagemap.h>
18+
19+#include <asm/lowcore.h>
20+#include <asm/gmap.h>
21+#include <asm/uv.h>
22+
23+#include "gmap.h"
24+
25+/**
26+ * should_export_before_import - Determine whether an export is needed
27+ * before an import-like operation
28+ * @uvcb: the Ultravisor control block of the UVC to be performed
29+ * @mm: the mm of the process
30+ *
31+ * Returns whether an export is needed before every import-like operation.
32+ * This is needed for shared pages, which don't trigger a secure storage
33+ * exception when accessed from a different guest.
34+ *
35+ * Although considered as one, the Unpin Page UVC is not an actual import,
36+ * so it is not affected.
37+ *
38+ * No export is needed also when there is only one protected VM, because the
39+ * page cannot belong to the wrong VM in that case (there is no "other VM"
40+ * it can belong to).
41+ *
42+ * Return: true if an export is needed before every import, otherwise false.
43+ */
44+static bool should_export_before_import(struct uv_cb_header *uvcb, struct mm_struct *mm)
45+{
46+ /*
47+ * The misc feature indicates, among other things, that importing a
48+ * shared page from a different protected VM will automatically also
49+ * transfer its ownership.
50+ */
51+ if (uv_has_feature(BIT_UV_FEAT_MISC))
52+ return false;
53+ if (uvcb->cmd == UVC_CMD_UNPIN_PAGE_SHARED)
54+ return false;
55+ return atomic_read(&mm->context.protected_count) > 1;
56+}
57+
58+static int __gmap_make_secure(struct gmap *gmap, struct page *page, void *uvcb)
59+{
60+ struct folio *folio = page_folio(page);
61+ int rc;
62+
63+ /*
64+ * Secure pages cannot be huge and userspace should not combine both.
65+ * In case userspace does it anyway this will result in an -EFAULT for
66+ * the unpack. The guest is thus never reaching secure mode.
67+ * If userspace plays dirty tricks and decides to map huge pages at a
68+ * later point in time, it will receive a segmentation fault or
69+ * KVM_RUN will return -EFAULT.
70+ */
71+ if (folio_test_hugetlb(folio))
72+ return -EFAULT;
73+ if (folio_test_large(folio)) {
74+ mmap_read_unlock(gmap->mm);
75+ rc = kvm_s390_wiggle_split_folio(gmap->mm, folio, true);
76+ mmap_read_lock(gmap->mm);
77+ if (rc)
78+ return rc;
79+ folio = page_folio(page);
80+ }
81+
82+ if (!folio_trylock(folio))
83+ return -EAGAIN;
84+ if (should_export_before_import(uvcb, gmap->mm))
85+ uv_convert_from_secure(folio_to_phys(folio));
86+ rc = make_folio_secure(folio, uvcb);
87+ folio_unlock(folio);
88+
89+ /*
90+ * In theory a race is possible and the folio might have become
91+ * large again before the folio_trylock() above. In that case, no
92+ * action is performed and -EAGAIN is returned; the callers will
93+ * have to try again later.
94+ * In most cases this implies running the VM again, getting the same
95+ * exception again, and make another attempt in this function.
96+ * This is expected to happen extremely rarely.
97+ */
98+ if (rc == -E2BIG)
99+ return -EAGAIN;
100+ /* The folio has too many references, try to shake some off */
101+ if (rc == -EBUSY) {
102+ mmap_read_unlock(gmap->mm);
103+ kvm_s390_wiggle_split_folio(gmap->mm, folio, false);
104+ mmap_read_lock(gmap->mm);
105+ return -EAGAIN;
106+ }
107+
108+ return rc;
109+}
110+
111+/**
112+ * gmap_make_secure() - make one guest page secure
113+ * @gmap: the guest gmap
114+ * @gaddr: the guest address that needs to be made secure
115+ * @uvcb: the UVCB specifying which operation needs to be performed
116+ *
117+ * Context: needs to be called with kvm->srcu held.
118+ * Return: 0 on success, < 0 in case of error (see __gmap_make_secure()).
119+ */
120+int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb)
121+{
122+ struct kvm *kvm = gmap->private;
123+ struct page *page;
124+ int rc = 0;
125+
126+ lockdep_assert_held(&kvm->srcu);
127+
128+ page = gfn_to_page(kvm, gpa_to_gfn(gaddr));
129+ mmap_read_lock(gmap->mm);
130+ if (page)
131+ rc = __gmap_make_secure(gmap, page, uvcb);
132+ kvm_release_page_clean(page);
133+ mmap_read_unlock(gmap->mm);
134+
135+ return rc;
136+}
137+
138+int gmap_convert_to_secure(struct gmap *gmap, unsigned long gaddr)
139+{
140+ struct uv_cb_cts uvcb = {
141+ .header.cmd = UVC_CMD_CONV_TO_SEC_STOR,
142+ .header.len = sizeof(uvcb),
143+ .guest_handle = gmap->guest_handle,
144+ .gaddr = gaddr,
145+ };
146+
147+ return gmap_make_secure(gmap, gaddr, &uvcb);
148+}
149+
150+/**
151+ * __gmap_destroy_page() - Destroy a guest page.
152+ * @gmap: the gmap of the guest
153+ * @page: the page to destroy
154+ *
155+ * An attempt will be made to destroy the given guest page. If the attempt
156+ * fails, an attempt is made to export the page. If both attempts fail, an
157+ * appropriate error is returned.
158+ *
159+ * Context: must be called holding the mm lock for gmap->mm
160+ */
161+static int __gmap_destroy_page(struct gmap *gmap, struct page *page)
162+{
163+ struct folio *folio = page_folio(page);
164+ int rc;
165+
166+ /*
167+ * See gmap_make_secure(): large folios cannot be secure. Small
168+ * folio implies FW_LEVEL_PTE.
169+ */
170+ if (folio_test_large(folio))
171+ return -EFAULT;
172+
173+ rc = uv_destroy_folio(folio);
174+ /*
175+ * Fault handlers can race; it is possible that two CPUs will fault
176+ * on the same secure page. One CPU can destroy the page, reboot,
177+ * re-enter secure mode and import it, while the second CPU was
178+ * stuck at the beginning of the handler. At some point the second
179+ * CPU will be able to progress, and it will not be able to destroy
180+ * the page. In that case we do not want to terminate the process,
181+ * we instead try to export the page.
182+ */
183+ if (rc)
184+ rc = uv_convert_from_secure_folio(folio);
185+
186+ return rc;
187+}
188+
189+/**
190+ * gmap_destroy_page() - Destroy a guest page.
191+ * @gmap: the gmap of the guest
192+ * @gaddr: the guest address to destroy
193+ *
194+ * An attempt will be made to destroy the given guest page. If the attempt
195+ * fails, an attempt is made to export the page. If both attempts fail, an
196+ * appropriate error is returned.
197+ *
198+ * Context: may sleep.
199+ */
200+int gmap_destroy_page(struct gmap *gmap, unsigned long gaddr)
201+{
202+ struct page *page;
203+ int rc = 0;
204+
205+ mmap_read_lock(gmap->mm);
206+ page = gfn_to_page(gmap->private, gpa_to_gfn(gaddr));
207+ if (page)
208+ rc = __gmap_destroy_page(gmap, page);
209+ kvm_release_page_clean(page);
210+ mmap_read_unlock(gmap->mm);
211+ return rc;
212+}
arch/s390/kvm/gmap.h+39−0
@@ -0,0 +1,39 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * KVM guest address space mapping code
4+ *
5+ * Copyright IBM Corp. 2007, 2016, 2025
6+ * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7+ * Claudio Imbrenda <imbrenda@linux.ibm.com>
8+ */
9+
10+#ifndef ARCH_KVM_S390_GMAP_H
11+#define ARCH_KVM_S390_GMAP_H
12+
13+#define GMAP_SHADOW_FAKE_TABLE 1ULL
14+
15+int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb);
16+int gmap_convert_to_secure(struct gmap *gmap, unsigned long gaddr);
17+int gmap_destroy_page(struct gmap *gmap, unsigned long gaddr);
18+struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce, int edat_level);
19+
20+/**
21+ * gmap_shadow_valid - check if a shadow guest address space matches the
22+ * given properties and is still valid
23+ * @sg: pointer to the shadow guest address space structure
24+ * @asce: ASCE for which the shadow table is requested
25+ * @edat_level: edat level to be used for the shadow translation
26+ *
27+ * Returns 1 if the gmap shadow is still valid and matches the given
28+ * properties, the caller can continue using it. Returns 0 otherwise, the
29+ * caller has to request a new shadow gmap in this case.
30+ *
31+ */
32+static inline int gmap_shadow_valid(struct gmap *sg, unsigned long asce, int edat_level)
33+{
34+ if (sg->removed)
35+ return 0;
36+ return sg->orig_asce == asce && sg->edat_level == edat_level;
37+}
38+
39+#endif
arch/s390/kvm/intercept.c+4−3
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include "gaccess.h"
2222 #include "trace.h"
2323 #include "trace-s390.h"
24+#include "gmap.h"
2425
2526 u8 kvm_s390_get_ilen(struct kvm_vcpu *vcpu)
2627 {
@@ -367,7 +368,7 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu) · 340 unmodified lines
367368 reg2, &srcaddr, GACC_FETCH, 0);
368369 if (rc)
369370 return kvm_s390_inject_prog_cond(vcpu, rc);
370− rc = gmap_fault(vcpu->arch.gmap, srcaddr, 0);
371+ rc = kvm_s390_handle_dat_fault(vcpu, srcaddr, 0);
371372 if (rc != 0)
372373 return rc;
373374
@@ -376,7 +377,7 @@ static int handle_mvpg_pei(struct kvm_vcpu *vcpu) · 2 unmodified lines
376377 reg1, &dstaddr, GACC_STORE, 0);
377378 if (rc)
378379 return kvm_s390_inject_prog_cond(vcpu, rc);
379− rc = gmap_fault(vcpu->arch.gmap, dstaddr, FAULT_FLAG_WRITE);
380+ rc = kvm_s390_handle_dat_fault(vcpu, dstaddr, FOLL_WRITE);
380381 if (rc != 0)
381382 return rc;
382383
@@ -549,7 +550,7 @@ static int handle_pv_uvc(struct kvm_vcpu *vcpu) · 166 unmodified lines
549550 * If the unpin did not succeed, the guest will exit again for the UVC
550551 * and we will retry the unpin.
551552 */
552− if (rc == -EINVAL)
553+ if (rc == -EINVAL || rc == -ENXIO)
553554 return 0;
554555 /*
555556 * If we got -EAGAIN here, we simply return it. It will eventually
arch/s390/kvm/interrupt.c+11−8
@@ -2893,7 +2893,8 @@ int kvm_set_routing_entry(struct kvm *kvm, · 2892 unmodified lines
28932893 struct kvm_kernel_irq_routing_entry *e,
28942894 const struct kvm_irq_routing_entry *ue)
28952895 {
2896− u64 uaddr;
2896+ u64 uaddr_s, uaddr_i;
2897+ int idx;
28972898
28982899 switch (ue->type) {
28992900 /* we store the userspace addresses instead of the guest addresses */
@@ -2901,14 +2902,16 @@ int kvm_set_routing_entry(struct kvm *kvm, · 1 unmodified line
29012902 if (kvm_is_ucontrol(kvm))
29022903 return -EINVAL;
29032904 e->set = set_adapter_int;
2904− uaddr = gmap_translate(kvm->arch.gmap, ue->u.adapter.summary_addr);
2905− if (uaddr == -EFAULT)
2906− return -EFAULT;
2907− e->adapter.summary_addr = uaddr;
2908− uaddr = gmap_translate(kvm->arch.gmap, ue->u.adapter.ind_addr);
2909− if (uaddr == -EFAULT)
2905+
2906+ idx = srcu_read_lock(&kvm->srcu);
2907+ uaddr_s = gpa_to_hva(kvm, ue->u.adapter.summary_addr);
2908+ uaddr_i = gpa_to_hva(kvm, ue->u.adapter.ind_addr);
2909+ srcu_read_unlock(&kvm->srcu, idx);
2910+
2911+ if (kvm_is_error_hva(uaddr_s) || kvm_is_error_hva(uaddr_i))
29102912 return -EFAULT;
2911− e->adapter.ind_addr = uaddr;
2913+ e->adapter.summary_addr = uaddr_s;
2914+ e->adapter.ind_addr = uaddr_i;
29122915 e->adapter.summary_offset = ue->u.adapter.summary_offset;
29132916 e->adapter.ind_offset = ue->u.adapter.ind_offset;
29142917 e->adapter.adapter_id = ue->u.adapter.adapter_id;
arch/s390/kvm/kvm-s390.c+197−40
@@ -50,6 +50,7 @@ · 49 unmodified lines
5050 #include "kvm-s390.h"
5151 #include "gaccess.h"
5252 #include "pci.h"
53+#include "gmap.h"
5354
5455 #define CREATE_TRACE_POINTS
5556 #include "trace.h"
@@ -3428,8 +3429,20 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 3372 unmodified lines
34283429 VM_EVENT(kvm, 3, "vm created with type %lu", type);
34293430
34303431 if (type & KVM_VM_S390_UCONTROL) {
3432+ struct kvm_userspace_memory_region2 fake_memslot = {
3433+ .slot = KVM_S390_UCONTROL_MEMSLOT,
3434+ .guest_phys_addr = 0,
3435+ .userspace_addr = 0,
3436+ .memory_size = ALIGN_DOWN(TASK_SIZE, _SEGMENT_SIZE),
3437+ .flags = 0,
3438+ };
3439+
34313440 kvm->arch.gmap = NULL;
34323441 kvm->arch.mem_limit = KVM_S390_NO_MEM_LIMIT;
3442+ /* one flat fake memslot covering the whole address-space */
3443+ mutex_lock(&kvm->slots_lock);
3444+ KVM_BUG_ON(kvm_set_internal_memslot(kvm, &fake_memslot), kvm);
3445+ mutex_unlock(&kvm->slots_lock);
34333446 } else {
34343447 if (sclp.hamax == U64_MAX)
34353448 kvm->arch.mem_limit = TASK_SIZE_MAX;
@@ -4498,6 +4511,75 @@ static bool ibs_enabled(struct kvm_vcpu *vcpu) · 1062 unmodified lines
44984511 return kvm_s390_test_cpuflags(vcpu, CPUSTAT_IBS);
44994512 }
45004513
4514+static int __kvm_s390_fixup_fault_sync(struct gmap *gmap, gpa_t gaddr, unsigned int flags)
4515+{
4516+ struct kvm *kvm = gmap->private;
4517+ gfn_t gfn = gpa_to_gfn(gaddr);
4518+ bool unlocked;
4519+ hva_t vmaddr;
4520+ gpa_t tmp;
4521+ int rc;
4522+
4523+ if (kvm_is_ucontrol(kvm)) {
4524+ tmp = __gmap_translate(gmap, gaddr);
4525+ gfn = gpa_to_gfn(tmp);
4526+ }
4527+
4528+ vmaddr = gfn_to_hva(kvm, gfn);
4529+ rc = fixup_user_fault(gmap->mm, vmaddr, FAULT_FLAG_WRITE, &unlocked);
4530+ if (!rc)
4531+ rc = __gmap_link(gmap, gaddr, vmaddr);
4532+ return rc;
4533+}
4534+
4535+/**
4536+ * __kvm_s390_mprotect_many() - Apply specified protection to guest pages
4537+ * @gmap: the gmap of the guest
4538+ * @gpa: the starting guest address
4539+ * @npages: how many pages to protect
4540+ * @prot: indicates access rights: PROT_NONE, PROT_READ or PROT_WRITE
4541+ * @bits: pgste notification bits to set
4542+ *
4543+ * Returns: 0 in case of success, < 0 in case of error - see gmap_protect_one()
4544+ *
4545+ * Context: kvm->srcu and gmap->mm need to be held in read mode
4546+ */
4547+int __kvm_s390_mprotect_many(struct gmap *gmap, gpa_t gpa, u8 npages, unsigned int prot,
4548+ unsigned long bits)
4549+{
4550+ unsigned int fault_flag = (prot & PROT_WRITE) ? FAULT_FLAG_WRITE : 0;
4551+ gpa_t end = gpa + npages * PAGE_SIZE;
4552+ int rc;
4553+
4554+ for (; gpa < end; gpa = ALIGN(gpa + 1, rc)) {
4555+ rc = gmap_protect_one(gmap, gpa, prot, bits);
4556+ if (rc == -EAGAIN) {
4557+ __kvm_s390_fixup_fault_sync(gmap, gpa, fault_flag);
4558+ rc = gmap_protect_one(gmap, gpa, prot, bits);
4559+ }
4560+ if (rc < 0)
4561+ return rc;
4562+ }
4563+
4564+ return 0;
4565+}
4566+
4567+static int kvm_s390_mprotect_notify_prefix(struct kvm_vcpu *vcpu)
4568+{
4569+ gpa_t gaddr = kvm_s390_get_prefix(vcpu);
4570+ int idx, rc;
4571+
4572+ idx = srcu_read_lock(&vcpu->kvm->srcu);
4573+ mmap_read_lock(vcpu->arch.gmap->mm);
4574+
4575+ rc = __kvm_s390_mprotect_many(vcpu->arch.gmap, gaddr, 2, PROT_WRITE, GMAP_NOTIFY_MPROT);
4576+
4577+ mmap_read_unlock(vcpu->arch.gmap->mm);
4578+ srcu_read_unlock(&vcpu->kvm->srcu, idx);
4579+
4580+ return rc;
4581+}
4582+
45014583 static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
45024584 {
45034585 retry:
@@ -4513,9 +4595,8 @@ retry: · 9 unmodified lines
45134595 */
45144596 if (kvm_check_request(KVM_REQ_REFRESH_GUEST_PREFIX, vcpu)) {
45154597 int rc;
4516− rc = gmap_mprotect_notify(vcpu->arch.gmap,
4517− kvm_s390_get_prefix(vcpu),
4518− PAGE_SIZE * 2, PROT_WRITE);
4598+
4599+ rc = kvm_s390_mprotect_notify_prefix(vcpu);
45194600 if (rc) {
45204601 kvm_make_request(KVM_REQ_REFRESH_GUEST_PREFIX, vcpu);
45214602 return rc;
@@ -4766,11 +4847,111 @@ static int vcpu_post_run_addressing_exception(struct kvm_vcpu *vcpu) · 244 unmodified lines
47664847 return kvm_s390_inject_prog_irq(vcpu, &pgm_info);
47674848 }
47684849
4850+static void kvm_s390_assert_primary_as(struct kvm_vcpu *vcpu)
4851+{
4852+ KVM_BUG(current->thread.gmap_teid.as != PSW_BITS_AS_PRIMARY, vcpu->kvm,
4853+ "Unexpected program interrupt 0x%x, TEID 0x%016lx",
4854+ current->thread.gmap_int_code, current->thread.gmap_teid.val);
4855+}
4856+
4857+/*
4858+ * __kvm_s390_handle_dat_fault() - handle a dat fault for the gmap of a vcpu
4859+ * @vcpu: the vCPU whose gmap is to be fixed up
4860+ * @gfn: the guest frame number used for memslots (including fake memslots)
4861+ * @gaddr: the gmap address, does not have to match @gfn for ucontrol gmaps
4862+ * @flags: FOLL_* flags
4863+ *
4864+ * Return: 0 on success, < 0 in case of error.
4865+ * Context: The mm lock must not be held before calling. May sleep.
4866+ */
4867+int __kvm_s390_handle_dat_fault(struct kvm_vcpu *vcpu, gfn_t gfn, gpa_t gaddr, unsigned int flags)
4868+{
4869+ struct kvm_memory_slot *slot;
4870+ unsigned int fault_flags;
4871+ bool writable, unlocked;
4872+ unsigned long vmaddr;
4873+ struct page *page;
4874+ kvm_pfn_t pfn;
4875+ int rc;
4876+
4877+ slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn);
4878+ if (!slot || slot->flags & KVM_MEMSLOT_INVALID)
4879+ return vcpu_post_run_addressing_exception(vcpu);
4880+
4881+ fault_flags = flags & FOLL_WRITE ? FAULT_FLAG_WRITE : 0;
4882+ if (vcpu->arch.gmap->pfault_enabled)
4883+ flags |= FOLL_NOWAIT;
4884+ vmaddr = __gfn_to_hva_memslot(slot, gfn);
4885+
4886+try_again:
4887+ pfn = __kvm_faultin_pfn(slot, gfn, flags, &writable, &page);
4888+
4889+ /* Access outside memory, inject addressing exception */
4890+ if (is_noslot_pfn(pfn))
4891+ return vcpu_post_run_addressing_exception(vcpu);
4892+ /* Signal pending: try again */
4893+ if (pfn == KVM_PFN_ERR_SIGPENDING)
4894+ return -EAGAIN;
4895+
4896+ /* Needs I/O, try to setup async pfault (only possible with FOLL_NOWAIT) */
4897+ if (pfn == KVM_PFN_ERR_NEEDS_IO) {
4898+ trace_kvm_s390_major_guest_pfault(vcpu);
4899+ if (kvm_arch_setup_async_pf(vcpu))
4900+ return 0;
4901+ vcpu->stat.pfault_sync++;
4902+ /* Could not setup async pfault, try again synchronously */
4903+ flags &= ~FOLL_NOWAIT;
4904+ goto try_again;
4905+ }
4906+ /* Any other error */
4907+ if (is_error_pfn(pfn))
4908+ return -EFAULT;
4909+
4910+ /* Success */
4911+ mmap_read_lock(vcpu->arch.gmap->mm);
4912+ /* Mark the userspace PTEs as young and/or dirty, to avoid page fault loops */
4913+ rc = fixup_user_fault(vcpu->arch.gmap->mm, vmaddr, fault_flags, &unlocked);
4914+ if (!rc)
4915+ rc = __gmap_link(vcpu->arch.gmap, gaddr, vmaddr);
4916+ scoped_guard(spinlock, &vcpu->kvm->mmu_lock) {
4917+ kvm_release_faultin_page(vcpu->kvm, page, false, writable);
4918+ }
4919+ mmap_read_unlock(vcpu->arch.gmap->mm);
4920+ return rc;
4921+}
4922+
4923+static int vcpu_dat_fault_handler(struct kvm_vcpu *vcpu, unsigned long gaddr, unsigned int flags)
4924+{
4925+ unsigned long gaddr_tmp;
4926+ gfn_t gfn;
4927+
4928+ gfn = gpa_to_gfn(gaddr);
4929+ if (kvm_is_ucontrol(vcpu->kvm)) {
4930+ /*
4931+ * This translates the per-vCPU guest address into a
4932+ * fake guest address, which can then be used with the
4933+ * fake memslots that are identity mapping userspace.
4934+ * This allows ucontrol VMs to use the normal fault
4935+ * resolution path, like normal VMs.
4936+ */
4937+ mmap_read_lock(vcpu->arch.gmap->mm);
4938+ gaddr_tmp = __gmap_translate(vcpu->arch.gmap, gaddr);
4939+ mmap_read_unlock(vcpu->arch.gmap->mm);
4940+ if (gaddr_tmp == -EFAULT) {
4941+ vcpu->run->exit_reason = KVM_EXIT_S390_UCONTROL;
4942+ vcpu->run->s390_ucontrol.trans_exc_code = gaddr;
4943+ vcpu->run->s390_ucontrol.pgm_code = PGM_SEGMENT_TRANSLATION;
4944+ return -EREMOTE;
4945+ }
4946+ gfn = gpa_to_gfn(gaddr_tmp);
4947+ }
4948+ return __kvm_s390_handle_dat_fault(vcpu, gfn, gaddr, flags);
4949+}
4950+
47694951 static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu)
47704952 {
47714953 unsigned int flags = 0;
47724954 unsigned long gaddr;
4773− int rc = 0;
47744955
47754956 gaddr = current->thread.gmap_teid.addr * PAGE_SIZE;
47764957 if (kvm_s390_cur_gmap_fault_is_write())
@@ -4781,9 +4962,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) · 4 unmodified lines
47814962 vcpu->stat.exit_null++;
47824963 break;
47834964 case PGM_NON_SECURE_STORAGE_ACCESS:
4784− KVM_BUG(current->thread.gmap_teid.as != PSW_BITS_AS_PRIMARY, vcpu->kvm,
4785− "Unexpected program interrupt 0x%x, TEID 0x%016lx",
4786− current->thread.gmap_int_code, current->thread.gmap_teid.val);
4965+ kvm_s390_assert_primary_as(vcpu);
47874966 /*
47884967 * This is normal operation; a page belonging to a protected
47894968 * guest has not been imported yet. Try to import the page into
@@ -4794,9 +4973,7 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) · 4 unmodified lines
47944973 break;
47954974 case PGM_SECURE_STORAGE_ACCESS:
47964975 case PGM_SECURE_STORAGE_VIOLATION:
4797− KVM_BUG(current->thread.gmap_teid.as != PSW_BITS_AS_PRIMARY, vcpu->kvm,
4798− "Unexpected program interrupt 0x%x, TEID 0x%016lx",
4799− current->thread.gmap_int_code, current->thread.gmap_teid.val);
4976+ kvm_s390_assert_primary_as(vcpu);
48004977 /*
48014978 * This can happen after a reboot with asynchronous teardown;
48024979 * the new guest (normal or protected) will run on top of the
@@ -4825,40 +5002,15 @@ static int vcpu_post_run_handle_fault(struct kvm_vcpu *vcpu) · 22 unmodified lines
48255002 case PGM_REGION_FIRST_TRANS:
48265003 case PGM_REGION_SECOND_TRANS:
48275004 case PGM_REGION_THIRD_TRANS:
4828− KVM_BUG(current->thread.gmap_teid.as != PSW_BITS_AS_PRIMARY, vcpu->kvm,
4829− "Unexpected program interrupt 0x%x, TEID 0x%016lx",
4830− current->thread.gmap_int_code, current->thread.gmap_teid.val);
4831− if (vcpu->arch.gmap->pfault_enabled) {
4832− rc = gmap_fault(vcpu->arch.gmap, gaddr, flags | FAULT_FLAG_RETRY_NOWAIT);
4833− if (rc == -EFAULT)
4834− return vcpu_post_run_addressing_exception(vcpu);
4835− if (rc == -EAGAIN) {
4836− trace_kvm_s390_major_guest_pfault(vcpu);
4837− if (kvm_arch_setup_async_pf(vcpu))
4838− return 0;
4839− vcpu->stat.pfault_sync++;
4840− } else {
4841− return rc;
4842− }
4843− }
4844− rc = gmap_fault(vcpu->arch.gmap, gaddr, flags);
4845− if (rc == -EFAULT) {
4846− if (kvm_is_ucontrol(vcpu->kvm)) {
4847− vcpu->run->exit_reason = KVM_EXIT_S390_UCONTROL;
4848− vcpu->run->s390_ucontrol.trans_exc_code = gaddr;
4849− vcpu->run->s390_ucontrol.pgm_code = 0x10;
4850− return -EREMOTE;
4851− }
4852− return vcpu_post_run_addressing_exception(vcpu);
4853− }
4854− break;
5005+ kvm_s390_assert_primary_as(vcpu);
5006+ return vcpu_dat_fault_handler(vcpu, gaddr, flags);
48555007 default:
48565008 KVM_BUG(1, vcpu->kvm, "Unexpected program interrupt 0x%x, TEID 0x%016lx",
48575009 current->thread.gmap_int_code, current->thread.gmap_teid.val);
48585010 send_sig(SIGSEGV, current, 0);
48595011 break;
48605012 }
4861− return rc;
5013+ return 0;
48625014 }
48635015
48645016 static int vcpu_post_run(struct kvm_vcpu *vcpu, int exit_reason)
@@ -5737,7 +5889,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, · 872 unmodified lines
57375889 }
57385890 #endif
57395891 case KVM_S390_VCPU_FAULT: {
5740− r = gmap_fault(vcpu->arch.gmap, arg, 0);
5892+ idx = srcu_read_lock(&vcpu->kvm->srcu);
5893+ r = vcpu_dat_fault_handler(vcpu, arg, 0);
5894+ srcu_read_unlock(&vcpu->kvm->srcu, idx);
57415895 break;
57425896 }
57435897 case KVM_ENABLE_CAP:
@@ -5853,7 +6007,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, · 109 unmodified lines
58536007 {
58546008 gpa_t size;
58556009
5856− if (kvm_is_ucontrol(kvm))
6010+ if (kvm_is_ucontrol(kvm) && new->id < KVM_USER_MEM_SLOTS)
58576011 return -EINVAL;
58586012
58596013 /* When we are protected, we should not change the memory slots */
@@ -5905,6 +6059,9 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, · 45 unmodified lines
59056059 {
59066060 int rc = 0;
59076061
6062+ if (kvm_is_ucontrol(kvm))
6063+ return;
6064+
59086065 switch (change) {
59096066 case KVM_MR_DELETE:
59106067 rc = gmap_unmap_segment(kvm->arch.gmap, old->base_gfn * PAGE_SIZE,
arch/s390/kvm/kvm-s390.h+19−0
@@ -20,6 +20,8 @@ · 19 unmodified lines
2020 #include <asm/processor.h>
2121 #include <asm/sclp.h>
2222
23+#define KVM_S390_UCONTROL_MEMSLOT (KVM_USER_MEM_SLOTS + 0)
24+
2325 static inline void kvm_s390_fpu_store(struct kvm_run *run)
2426 {
2527 fpu_stfpc(&run->s.regs.fpc);
@@ -279,6 +281,15 @@ static inline u32 kvm_s390_get_gisa_desc(struct kvm *kvm) · 253 unmodified lines
279281 return gd;
280282 }
281283
284+static inline hva_t gpa_to_hva(struct kvm *kvm, gpa_t gpa)
285+{
286+ hva_t hva = gfn_to_hva(kvm, gpa_to_gfn(gpa));
287+
288+ if (!kvm_is_error_hva(hva))
289+ hva |= offset_in_page(gpa);
290+ return hva;
291+}
292+
282293 /* implemented in pv.c */
283294 int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
284295 int kvm_s390_pv_create_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
@@ -408,6 +419,14 @@ void kvm_s390_vcpu_unsetup_cmma(struct kvm_vcpu *vcpu); · 123 unmodified lines
408419 void kvm_s390_set_cpu_timer(struct kvm_vcpu *vcpu, __u64 cputm);
409420 __u64 kvm_s390_get_cpu_timer(struct kvm_vcpu *vcpu);
410421 int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rc, u16 *rrc);
422+int __kvm_s390_handle_dat_fault(struct kvm_vcpu *vcpu, gfn_t gfn, gpa_t gaddr, unsigned int flags);
423+int __kvm_s390_mprotect_many(struct gmap *gmap, gpa_t gpa, u8 npages, unsigned int prot,
424+ unsigned long bits);
425+
426+static inline int kvm_s390_handle_dat_fault(struct kvm_vcpu *vcpu, gpa_t gaddr, unsigned int flags)
427+{
428+ return __kvm_s390_handle_dat_fault(vcpu, gpa_to_gfn(gaddr), gaddr, flags);
429+}
411430
412431 /* implemented in diag.c */
413432 int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
arch/s390/kvm/pv.c+21−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/sched/mm.h>
1818 #include <linux/mmu_notifier.h>
1919 #include "kvm-s390.h"
20+#include "gmap.h"
2021
2122 bool kvm_s390_pv_is_protected(struct kvm *kvm)
2223 {
@@ -638,10 +639,28 @@ static int unpack_one(struct kvm *kvm, unsigned long addr, u64 tweak, · 615 unmodified lines
638639 .tweak[1] = offset,
639640 };
640641 int ret = gmap_make_secure(kvm->arch.gmap, addr, &uvcb);
642+ unsigned long vmaddr;
643+ bool unlocked;
641644
642645 *rc = uvcb.header.rc;
643646 *rrc = uvcb.header.rrc;
644647
648+ if (ret == -ENXIO) {
649+ mmap_read_lock(kvm->mm);
650+ vmaddr = gfn_to_hva(kvm, gpa_to_gfn(addr));
651+ if (kvm_is_error_hva(vmaddr)) {
652+ ret = -EFAULT;
653+ } else {
654+ ret = fixup_user_fault(kvm->mm, vmaddr, FAULT_FLAG_WRITE, &unlocked);
655+ if (!ret)
656+ ret = __gmap_link(kvm->arch.gmap, addr, vmaddr);
657+ }
658+ mmap_read_unlock(kvm->mm);
659+ if (!ret)
660+ return -EAGAIN;
661+ return ret;
662+ }
663+
645664 if (ret && ret != -EAGAIN)
646665 KVM_UV_EVENT(kvm, 3, "PROTVIRT VM UNPACK: failed addr %llx with rc %x rrc %x",
647666 uvcb.gaddr, *rc, *rrc);
@@ -660,6 +679,8 @@ int kvm_s390_pv_unpack(struct kvm *kvm, unsigned long addr, unsigned long size, · 12 unmodified lines
660679 KVM_UV_EVENT(kvm, 3, "PROTVIRT VM UNPACK: start addr %lx size %lx",
661680 addr, size);
662681
682+ guard(srcu)(&kvm->srcu);
683+
663684 while (offset < size) {
664685 ret = unpack_one(kvm, addr, tweak, offset, rc, rrc);
665686 if (ret == -EAGAIN) {
arch/s390/kvm/vsie.c+68−38
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/bitmap.h>
1414 #include <linux/sched/signal.h>
1515 #include <linux/io.h>
16+#include <linux/mman.h>
1617
1718 #include <asm/gmap.h>
1819 #include <asm/mmu_context.h>
@@ -22,6 +23,11 @@ · 3 unmodified lines
2223 #include <asm/facility.h>
2324 #include "kvm-s390.h"
2425 #include "gaccess.h"
26+#include "gmap.h"
27+
28+enum vsie_page_flags {
29+ VSIE_PAGE_IN_USE = 0,
30+};
2531
2632 struct vsie_page {
2733 struct kvm_s390_sie_block scb_s; /* 0x0000 */
@@ -46,7 +52,18 @@ struct vsie_page { · 18 unmodified lines
4652 gpa_t gvrd_gpa; /* 0x0240 */
4753 gpa_t riccbd_gpa; /* 0x0248 */
4854 gpa_t sdnx_gpa; /* 0x0250 */
49− __u8 reserved[0x0700 - 0x0258]; /* 0x0258 */
55+ /*
56+ * guest address of the original SCB. Remains set for free vsie
57+ * pages, so we can properly look them up in our addr_to_page
58+ * radix tree.
59+ */
60+ gpa_t scb_gpa; /* 0x0258 */
61+ /*
62+ * Flags: must be set/cleared atomically after the vsie page can be
63+ * looked up by other CPUs.
64+ */
65+ unsigned long flags; /* 0x0260 */
66+ __u8 reserved[0x0700 - 0x0268]; /* 0x0268 */
5067 struct kvm_s390_crypto_cb crycb; /* 0x0700 */
5168 __u8 fac[S390_ARCH_FAC_LIST_SIZE_BYTE]; /* 0x0800 */
5269 };
@@ -584,7 +601,6 @@ void kvm_s390_vsie_gmap_notifier(struct gmap *gmap, unsigned long start, · 531 unmodified lines
584601 struct kvm *kvm = gmap->private;
585602 struct vsie_page *cur;
586603 unsigned long prefix;
587− struct page *page;
588604 int i;
589605
590606 if (!gmap_is_shadow(gmap))
@@ -594,10 +610,9 @@ void kvm_s390_vsie_gmap_notifier(struct gmap *gmap, unsigned long start, · 3 unmodified lines
594610 * therefore we can safely reference them all the time.
595611 */
596612 for (i = 0; i < kvm->arch.vsie.page_count; i++) {
597− page = READ_ONCE(kvm->arch.vsie.pages[i]);
598− if (!page)
613+ cur = READ_ONCE(kvm->arch.vsie.pages[i]);
614+ if (!cur)
599615 continue;
600− cur = page_to_virt(page);
601616 if (READ_ONCE(cur->gmap) != gmap)
602617 continue;
603618 prefix = cur->scb_s.prefix << GUEST_PREFIX_SHIFT;
@@ -1345,6 +1360,20 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · 741 unmodified lines
13451360 return rc;
13461361 }
13471362
1363+/* Try getting a given vsie page, returning "true" on success. */
1364+static inline bool try_get_vsie_page(struct vsie_page *vsie_page)
1365+{
1366+ if (test_bit(VSIE_PAGE_IN_USE, &vsie_page->flags))
1367+ return false;
1368+ return !test_and_set_bit(VSIE_PAGE_IN_USE, &vsie_page->flags);
1369+}
1370+
1371+/* Put a vsie page acquired through get_vsie_page / try_get_vsie_page. */
1372+static void put_vsie_page(struct vsie_page *vsie_page)
1373+{
1374+ clear_bit(VSIE_PAGE_IN_USE, &vsie_page->flags);
1375+}
1376+
13481377 /*
13491378 * Get or create a vsie page for a scb address.
13501379 *
@@ -1355,16 +1384,21 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) · 4 unmodified lines
13551384 static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr)
13561385 {
13571386 struct vsie_page *vsie_page;
1358− struct page *page;
13591387 int nr_vcpus;
13601388
13611389 rcu_read_lock();
1362− page = radix_tree_lookup(&kvm->arch.vsie.addr_to_page, addr >> 9);
1390+ vsie_page = radix_tree_lookup(&kvm->arch.vsie.addr_to_page, addr >> 9);
13631391 rcu_read_unlock();
1364− if (page) {
1365− if (page_ref_inc_return(page) == 2)
1366− return page_to_virt(page);
1367− page_ref_dec(page);
1392+ if (vsie_page) {
1393+ if (try_get_vsie_page(vsie_page)) {
1394+ if (vsie_page->scb_gpa == addr)
1395+ return vsie_page;
1396+ /*
1397+ * We raced with someone reusing + putting this vsie
1398+ * page before we grabbed it.
1399+ */
1400+ put_vsie_page(vsie_page);
1401+ }
13681402 }
13691403
13701404 /*
@@ -1375,36 +1409,40 @@ static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr) · 4 unmodified lines
13751409
13761410 mutex_lock(&kvm->arch.vsie.mutex);
13771411 if (kvm->arch.vsie.page_count < nr_vcpus) {
1378− page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO | GFP_DMA);
1379− if (!page) {
1412+ vsie_page = (void *)__get_free_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO | GFP_DMA);
1413+ if (!vsie_page) {
13801414 mutex_unlock(&kvm->arch.vsie.mutex);
13811415 return ERR_PTR(-ENOMEM);
13821416 }
1383− page_ref_inc(page);
1384− kvm->arch.vsie.pages[kvm->arch.vsie.page_count] = page;
1417+ __set_bit(VSIE_PAGE_IN_USE, &vsie_page->flags);
1418+ kvm->arch.vsie.pages[kvm->arch.vsie.page_count] = vsie_page;
13851419 kvm->arch.vsie.page_count++;
13861420 } else {
13871421 /* reuse an existing entry that belongs to nobody */
13881422 while (true) {
1389− page = kvm->arch.vsie.pages[kvm->arch.vsie.next];
1390− if (page_ref_inc_return(page) == 2)
1423+ vsie_page = kvm->arch.vsie.pages[kvm->arch.vsie.next];
1424+ if (try_get_vsie_page(vsie_page))
13911425 break;
1392− page_ref_dec(page);
13931426 kvm->arch.vsie.next++;
13941427 kvm->arch.vsie.next %= nr_vcpus;
13951428 }
1396− radix_tree_delete(&kvm->arch.vsie.addr_to_page, page->index >> 9);
1429+ if (vsie_page->scb_gpa != ULONG_MAX)
1430+ radix_tree_delete(&kvm->arch.vsie.addr_to_page,
1431+ vsie_page->scb_gpa >> 9);
13971432 }
1398− page->index = addr;
1399− /* double use of the same address */
1400− if (radix_tree_insert(&kvm->arch.vsie.addr_to_page, addr >> 9, page)) {
1401− page_ref_dec(page);
1433+ /* Mark it as invalid until it resides in the tree. */
1434+ vsie_page->scb_gpa = ULONG_MAX;
1435+
1436+ /* Double use of the same address or allocation failure. */
1437+ if (radix_tree_insert(&kvm->arch.vsie.addr_to_page, addr >> 9,
1438+ vsie_page)) {
1439+ put_vsie_page(vsie_page);
14021440 mutex_unlock(&kvm->arch.vsie.mutex);
14031441 return NULL;
14041442 }
1443+ vsie_page->scb_gpa = addr;
14051444 mutex_unlock(&kvm->arch.vsie.mutex);
14061445
1407− vsie_page = page_to_virt(page);
14081446 memset(&vsie_page->scb_s, 0, sizeof(struct kvm_s390_sie_block));
14091447 release_gmap_shadow(vsie_page);
14101448 vsie_page->fault_addr = 0;
@@ -1412,14 +1450,6 @@ static struct vsie_page *get_vsie_page(struct kvm *kvm, unsigned long addr) · 1 unmodified line
14121450 return vsie_page;
14131451 }
14141452
1415−/* put a vsie page acquired via get_vsie_page */
1416−static void put_vsie_page(struct kvm *kvm, struct vsie_page *vsie_page)
1417−{
1418− struct page *page = pfn_to_page(__pa(vsie_page) >> PAGE_SHIFT);
1419−
1420− page_ref_dec(page);
1421−}
1422−
14231453 int kvm_s390_handle_vsie(struct kvm_vcpu *vcpu)
14241454 {
14251455 struct vsie_page *vsie_page;
@@ -1470,7 +1500,7 @@ out_unshadow: · 44 unmodified lines
14701500 out_unpin_scb:
14711501 unpin_scb(vcpu, vsie_page, scb_addr);
14721502 out_put:
1473− put_vsie_page(vcpu->kvm, vsie_page);
1503+ put_vsie_page(vsie_page);
14741504
14751505 return rc < 0 ? rc : 0;
14761506 }
@@ -1486,18 +1516,18 @@ void kvm_s390_vsie_init(struct kvm *kvm) · 9 unmodified lines
14861516 void kvm_s390_vsie_destroy(struct kvm *kvm)
14871517 {
14881518 struct vsie_page *vsie_page;
1489− struct page *page;
14901519 int i;
14911520
14921521 mutex_lock(&kvm->arch.vsie.mutex);
14931522 for (i = 0; i < kvm->arch.vsie.page_count; i++) {
1494− page = kvm->arch.vsie.pages[i];
1523+ vsie_page = kvm->arch.vsie.pages[i];
14951524 kvm->arch.vsie.pages[i] = NULL;
1496− vsie_page = page_to_virt(page);
14971525 release_gmap_shadow(vsie_page);
14981526 /* free the radix tree entry */
1499− radix_tree_delete(&kvm->arch.vsie.addr_to_page, page->index >> 9);
1500− __free_page(page);
1527+ if (vsie_page->scb_gpa != ULONG_MAX)
1528+ radix_tree_delete(&kvm->arch.vsie.addr_to_page,
1529+ vsie_page->scb_gpa >> 9);
1530+ free_page((unsigned long)vsie_page);
15011531 }
15021532 kvm->arch.vsie.page_count = 0;
15031533 mutex_unlock(&kvm->arch.vsie.mutex);
arch/s390/mm/gmap.c+150−531
@@ -24,6 +24,16 @@ · 23 unmodified lines
2424 #include <asm/page.h>
2525 #include <asm/tlb.h>
2626
27+/*
28+ * The address is saved in a radix tree directly; NULL would be ambiguous,
29+ * since 0 is a valid address, and NULL is returned when nothing was found.
30+ * The lower bits are ignored by all users of the macro, so it can be used
31+ * to distinguish a valid address 0 from a NULL.
32+ */
33+#define VALID_GADDR_FLAG 1
34+#define IS_GADDR_VALID(gaddr) ((gaddr) & VALID_GADDR_FLAG)
35+#define MAKE_VALID_GADDR(gaddr) (((gaddr) & HPAGE_MASK) | VALID_GADDR_FLAG)
36+
2737 #define GMAP_SHADOW_FAKE_TABLE 1ULL
2838
2939 static struct page *gmap_alloc_crst(void)
@@ -43,7 +53,7 @@ static struct page *gmap_alloc_crst(void) · 13 unmodified lines
4353 *
4454 * Returns a guest address space structure.
4555 */
46−static struct gmap *gmap_alloc(unsigned long limit)
56+struct gmap *gmap_alloc(unsigned long limit)
4757 {
4858 struct gmap *gmap;
4959 struct page *page;
@@ -70,9 +80,7 @@ static struct gmap *gmap_alloc(unsigned long limit) · 20 unmodified lines
7080 gmap = kzalloc(sizeof(struct gmap), GFP_KERNEL_ACCOUNT);
7181 if (!gmap)
7282 goto out;
73− INIT_LIST_HEAD(&gmap->crst_list);
7483 INIT_LIST_HEAD(&gmap->children);
75− INIT_LIST_HEAD(&gmap->pt_list);
7684 INIT_RADIX_TREE(&gmap->guest_to_host, GFP_KERNEL_ACCOUNT);
7785 INIT_RADIX_TREE(&gmap->host_to_guest, GFP_ATOMIC | __GFP_ACCOUNT);
7886 INIT_RADIX_TREE(&gmap->host_to_rmap, GFP_ATOMIC | __GFP_ACCOUNT);
@@ -82,8 +90,6 @@ static struct gmap *gmap_alloc(unsigned long limit) · 3 unmodified lines
8290 page = gmap_alloc_crst();
8391 if (!page)
8492 goto out_free;
85− page->index = 0;
86− list_add(&page->lru, &gmap->crst_list);
8793 table = page_to_virt(page);
8894 crst_table_init(table, etype);
8995 gmap->table = table;
@@ -97,6 +103,7 @@ out_free: · 7 unmodified lines
97103 out:
98104 return NULL;
99105 }
106+EXPORT_SYMBOL_GPL(gmap_alloc);
100107
101108 /**
102109 * gmap_create - create a guest address space
@@ -185,32 +192,46 @@ static void gmap_rmap_radix_tree_free(struct radix_tree_root *root) · 82 unmodified lines
185192 } while (nr > 0);
186193 }
187194
195+static void gmap_free_crst(unsigned long *table, bool free_ptes)
196+{
197+ bool is_segment = (table[0] & _SEGMENT_ENTRY_TYPE_MASK) == 0;
198+ int i;
199+
200+ if (is_segment) {
201+ if (!free_ptes)
202+ goto out;
203+ for (i = 0; i < _CRST_ENTRIES; i++)
204+ if (!(table[i] & _SEGMENT_ENTRY_INVALID))
205+ page_table_free_pgste(page_ptdesc(phys_to_page(table[i])));
206+ } else {
207+ for (i = 0; i < _CRST_ENTRIES; i++)
208+ if (!(table[i] & _REGION_ENTRY_INVALID))
209+ gmap_free_crst(__va(table[i] & PAGE_MASK), free_ptes);
210+ }
211+
212+out:
213+ free_pages((unsigned long)table, CRST_ALLOC_ORDER);
214+}
215+
188216 /**
189217 * gmap_free - free a guest address space
190218 * @gmap: pointer to the guest address space structure
191219 *
192220 * No locks required. There are no references to this gmap anymore.
193221 */
194−static void gmap_free(struct gmap *gmap)
222+void gmap_free(struct gmap *gmap)
195223 {
196− struct page *page, *next;
197−
198224 /* Flush tlb of all gmaps (if not already done for shadows) */
199225 if (!(gmap_is_shadow(gmap) && gmap->removed))
200226 gmap_flush_tlb(gmap);
201227 /* Free all segment & region tables. */
202− list_for_each_entry_safe(page, next, &gmap->crst_list, lru)
203− __free_pages(page, CRST_ALLOC_ORDER);
228+ gmap_free_crst(gmap->table, gmap_is_shadow(gmap));
229+
204230 gmap_radix_tree_free(&gmap->guest_to_host);
205231 gmap_radix_tree_free(&gmap->host_to_guest);
206232
207233 /* Free additional data for a shadow gmap */
208234 if (gmap_is_shadow(gmap)) {
209− struct ptdesc *ptdesc, *n;
210−
211− /* Free all page tables. */
212− list_for_each_entry_safe(ptdesc, n, &gmap->pt_list, pt_list)
213− page_table_free_pgste(ptdesc);
214235 gmap_rmap_radix_tree_free(&gmap->host_to_rmap);
215236 /* Release reference to the parent */
216237 gmap_put(gmap->parent);
@@ -218,6 +239,7 @@ static void gmap_free(struct gmap *gmap) · 1 unmodified line
218239
219240 kfree(gmap);
220241 }
242+EXPORT_SYMBOL_GPL(gmap_free);
221243
222244 /**
223245 * gmap_get - increase reference counter for guest address space
@@ -298,10 +320,8 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, · 74 unmodified lines
298320 crst_table_init(new, init);
299321 spin_lock(&gmap->guest_table_lock);
300322 if (*table & _REGION_ENTRY_INVALID) {
301− list_add(&page->lru, &gmap->crst_list);
302323 *table = __pa(new) | _REGION_ENTRY_LENGTH |
303324 (*table & _REGION_ENTRY_TYPE_MASK);
304− page->index = gaddr;
305325 page = NULL;
306326 }
307327 spin_unlock(&gmap->guest_table_lock);
@@ -310,21 +330,23 @@ static int gmap_alloc_table(struct gmap *gmap, unsigned long *table, · 2 unmodified lines
310330 return 0;
311331 }
312332
313−/**
314− * __gmap_segment_gaddr - find virtual address from segment pointer
315− * @entry: pointer to a segment table entry in the guest address space
316− *
317− * Returns the virtual address in the guest address space for the segment
318− */
319−static unsigned long __gmap_segment_gaddr(unsigned long *entry)
333+static unsigned long host_to_guest_lookup(struct gmap *gmap, unsigned long vmaddr)
320334 {
321− struct page *page;
322− unsigned long offset;
335+ return (unsigned long)radix_tree_lookup(&gmap->host_to_guest, vmaddr >> PMD_SHIFT);
336+}
323337
324− offset = (unsigned long) entry / sizeof(unsigned long);
325− offset = (offset & (PTRS_PER_PMD - 1)) * PMD_SIZE;
326− page = pmd_pgtable_page((pmd_t *) entry);
327− return page->index + offset;
338+static unsigned long host_to_guest_delete(struct gmap *gmap, unsigned long vmaddr)
339+{
340+ return (unsigned long)radix_tree_delete(&gmap->host_to_guest, vmaddr >> PMD_SHIFT);
341+}
342+
343+static pmd_t *host_to_guest_pmd_delete(struct gmap *gmap, unsigned long vmaddr,
344+ unsigned long *gaddr)
345+{
346+ *gaddr = host_to_guest_delete(gmap, vmaddr);
347+ if (IS_GADDR_VALID(*gaddr))
348+ return (pmd_t *)gmap_table_walk(gmap, *gaddr, 1);
349+ return NULL;
328350 }
329351
330352 /**
@@ -336,16 +358,19 @@ static unsigned long __gmap_segment_gaddr(unsigned long *entry) · 5 unmodified lines
336358 */
337359 static int __gmap_unlink_by_vmaddr(struct gmap *gmap, unsigned long vmaddr)
338360 {
339− unsigned long *entry;
361+ unsigned long gaddr;
340362 int flush = 0;
363+ pmd_t *pmdp;
341364
342365 BUG_ON(gmap_is_shadow(gmap));
343366 spin_lock(&gmap->guest_table_lock);
344− entry = radix_tree_delete(&gmap->host_to_guest, vmaddr >> PMD_SHIFT);
345− if (entry) {
346− flush = (*entry != _SEGMENT_ENTRY_EMPTY);
347− *entry = _SEGMENT_ENTRY_EMPTY;
367+
368+ pmdp = host_to_guest_pmd_delete(gmap, vmaddr, &gaddr);
369+ if (pmdp) {
370+ flush = (pmd_val(*pmdp) != _SEGMENT_ENTRY_EMPTY);
371+ *pmdp = __pmd(_SEGMENT_ENTRY_EMPTY);
348372 }
373+
349374 spin_unlock(&gmap->guest_table_lock);
350375 return flush;
351376 }
@@ -463,26 +488,6 @@ unsigned long __gmap_translate(struct gmap *gmap, unsigned long gaddr) · 111 unmodified lines
463488 }
464489 EXPORT_SYMBOL_GPL(__gmap_translate);
465490
466−/**
467− * gmap_translate - translate a guest address to a user space address
468− * @gmap: pointer to guest mapping meta data structure
469− * @gaddr: guest address
470− *
471− * Returns user space address which corresponds to the guest address or
472− * -EFAULT if no such mapping exists.
473− * This function does not establish potentially missing page table entries.
474− */
475−unsigned long gmap_translate(struct gmap *gmap, unsigned long gaddr)
476−{
477− unsigned long rc;
478−
479− mmap_read_lock(gmap->mm);
480− rc = __gmap_translate(gmap, gaddr);
481− mmap_read_unlock(gmap->mm);
482− return rc;
483−}
484−EXPORT_SYMBOL_GPL(gmap_translate);
485−
486491 /**
487492 * gmap_unlink - disconnect a page table from the gmap shadow tables
488493 * @mm: pointer to the parent mm_struct
@@ -582,7 +587,8 @@ int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr) · 93 unmodified lines
582587 spin_lock(&gmap->guest_table_lock);
583588 if (*table == _SEGMENT_ENTRY_EMPTY) {
584589 rc = radix_tree_insert(&gmap->host_to_guest,
585− vmaddr >> PMD_SHIFT, table);
590+ vmaddr >> PMD_SHIFT,
591+ (void *)MAKE_VALID_GADDR(gaddr));
586592 if (!rc) {
587593 if (pmd_leaf(*pmd)) {
588594 *table = (pmd_val(*pmd) &
@@ -605,130 +611,7 @@ int __gmap_link(struct gmap *gmap, unsigned long gaddr, unsigned long vmaddr) · 16 unmodified lines
605611 radix_tree_preload_end();
606612 return rc;
607613 }
608−
609−/**
610− * fixup_user_fault_nowait - manually resolve a user page fault without waiting
611− * @mm: mm_struct of target mm
612− * @address: user address
613− * @fault_flags:flags to pass down to handle_mm_fault()
614− * @unlocked: did we unlock the mmap_lock while retrying
615− *
616− * This function behaves similarly to fixup_user_fault(), but it guarantees
617− * that the fault will be resolved without waiting. The function might drop
618− * and re-acquire the mm lock, in which case @unlocked will be set to true.
619− *
620− * The guarantee is that the fault is handled without waiting, but the
621− * function itself might sleep, due to the lock.
622− *
623− * Context: Needs to be called with mm->mmap_lock held in read mode, and will
624− * return with the lock held in read mode; @unlocked will indicate whether
625− * the lock has been dropped and re-acquired. This is the same behaviour as
626− * fixup_user_fault().
627− *
628− * Return: 0 on success, -EAGAIN if the fault cannot be resolved without
629− * waiting, -EFAULT if the fault cannot be resolved, -ENOMEM if out of
630− * memory.
631− */
632−static int fixup_user_fault_nowait(struct mm_struct *mm, unsigned long address,
633− unsigned int fault_flags, bool *unlocked)
634−{
635− struct vm_area_struct *vma;
636− unsigned int test_flags;
637− vm_fault_t fault;
638− int rc;
639−
640− fault_flags |= FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_RETRY_NOWAIT;
641− test_flags = fault_flags & FAULT_FLAG_WRITE ? VM_WRITE : VM_READ;
642−
643− vma = find_vma(mm, address);
644− if (unlikely(!vma || address < vma->vm_start))
645− return -EFAULT;
646− if (unlikely(!(vma->vm_flags & test_flags)))
647− return -EFAULT;
648−
649− fault = handle_mm_fault(vma, address, fault_flags, NULL);
650− /* the mm lock has been dropped, take it again */
651− if (fault & VM_FAULT_COMPLETED) {
652− *unlocked = true;
653− mmap_read_lock(mm);
654− return 0;
655− }
656− /* the mm lock has not been dropped */
657− if (fault & VM_FAULT_ERROR) {
658− rc = vm_fault_to_errno(fault, 0);
659− BUG_ON(!rc);
660− return rc;
661− }
662− /* the mm lock has not been dropped because of FAULT_FLAG_RETRY_NOWAIT */
663− if (fault & VM_FAULT_RETRY)
664− return -EAGAIN;
665− /* nothing needed to be done and the mm lock has not been dropped */
666− return 0;
667−}
668−
669−/**
670− * __gmap_fault - resolve a fault on a guest address
671− * @gmap: pointer to guest mapping meta data structure
672− * @gaddr: guest address
673− * @fault_flags: flags to pass down to handle_mm_fault()
674− *
675− * Context: Needs to be called with mm->mmap_lock held in read mode. Might
676− * drop and re-acquire the lock. Will always return with the lock held.
677− */
678−static int __gmap_fault(struct gmap *gmap, unsigned long gaddr, unsigned int fault_flags)
679−{
680− unsigned long vmaddr;
681− bool unlocked;
682− int rc = 0;
683−
684−retry:
685− unlocked = false;
686−
687− vmaddr = __gmap_translate(gmap, gaddr);
688− if (IS_ERR_VALUE(vmaddr))
689− return vmaddr;
690−
691− if (fault_flags & FAULT_FLAG_RETRY_NOWAIT)
692− rc = fixup_user_fault_nowait(gmap->mm, vmaddr, fault_flags, &unlocked);
693− else
694− rc = fixup_user_fault(gmap->mm, vmaddr, fault_flags, &unlocked);
695− if (rc)
696− return rc;
697− /*
698− * In the case that fixup_user_fault unlocked the mmap_lock during
699− * fault-in, redo __gmap_translate() to avoid racing with a
700− * map/unmap_segment.
701− * In particular, __gmap_translate(), fixup_user_fault{,_nowait}(),
702− * and __gmap_link() must all be called atomically in one go; if the
703− * lock had been dropped in between, a retry is needed.
704− */
705− if (unlocked)
706− goto retry;
707−
708− return __gmap_link(gmap, gaddr, vmaddr);
709−}
710−
711−/**
712− * gmap_fault - resolve a fault on a guest address
713− * @gmap: pointer to guest mapping meta data structure
714− * @gaddr: guest address
715− * @fault_flags: flags to pass down to handle_mm_fault()
716− *
717− * Returns 0 on success, -ENOMEM for out of memory conditions, -EFAULT if the
718− * vm address is already mapped to a different guest segment, and -EAGAIN if
719− * FAULT_FLAG_RETRY_NOWAIT was specified and the fault could not be processed
720− * immediately.
721− */
722−int gmap_fault(struct gmap *gmap, unsigned long gaddr, unsigned int fault_flags)
723−{
724− int rc;
725−
726− mmap_read_lock(gmap->mm);
727− rc = __gmap_fault(gmap, gaddr, fault_flags);
728− mmap_read_unlock(gmap->mm);
729− return rc;
730−}
731−EXPORT_SYMBOL_GPL(gmap_fault);
614+EXPORT_SYMBOL(__gmap_link);
732615
733616 /*
734617 * this function is assumed to be called with mmap_lock held
@@ -853,8 +736,7 @@ static void gmap_call_notifier(struct gmap *gmap, unsigned long start, · 118 unmodified lines
853736 *
854737 * Note: Can also be called for shadow gmaps.
855738 */
856−static inline unsigned long *gmap_table_walk(struct gmap *gmap,
857− unsigned long gaddr, int level)
739+unsigned long *gmap_table_walk(struct gmap *gmap, unsigned long gaddr, int level)
858740 {
859741 const int asce_type = gmap->asce & _ASCE_TYPE_MASK;
860742 unsigned long *table = gmap->table;
@@ -905,6 +787,7 @@ static inline unsigned long *gmap_table_walk(struct gmap *gmap, · 44 unmodified lines
905787 }
906788 return table;
907789 }
790+EXPORT_SYMBOL(gmap_table_walk);
908791
909792 /**
910793 * gmap_pte_op_walk - walk the gmap page table, get the page table lock
@@ -1101,86 +984,40 @@ static int gmap_protect_pte(struct gmap *gmap, unsigned long gaddr, · 190 unmodified lines
1101984 * @prot: indicates access rights: PROT_NONE, PROT_READ or PROT_WRITE
1102985 * @bits: pgste notification bits to set
1103986 *
1104− * Returns 0 if successfully protected, -ENOMEM if out of memory and
1105− * -EFAULT if gaddr is invalid (or mapping for shadows is missing).
987+ * Returns:
988+ * PAGE_SIZE if a small page was successfully protected;
989+ * HPAGE_SIZE if a large page was successfully protected;
990+ * -ENOMEM if out of memory;
991+ * -EFAULT if gaddr is invalid (or mapping for shadows is missing);
992+ * -EAGAIN if the guest mapping is missing and should be fixed by the caller.
1106993 *
1107− * Called with sg->mm->mmap_lock in read.
994+ * Context: Called with sg->mm->mmap_lock in read.
1108995 */
1109−static int gmap_protect_range(struct gmap *gmap, unsigned long gaddr,
1110− unsigned long len, int prot, unsigned long bits)
996+int gmap_protect_one(struct gmap *gmap, unsigned long gaddr, int prot, unsigned long bits)
1111997 {
1112− unsigned long vmaddr, dist;
1113998 pmd_t *pmdp;
1114− int rc;
999+ int rc = 0;
11151000
11161001 BUG_ON(gmap_is_shadow(gmap));
1117− while (len) {
1118− rc = -EAGAIN;
1119− pmdp = gmap_pmd_op_walk(gmap, gaddr);
1120− if (pmdp) {
1121− if (!pmd_leaf(*pmdp)) {
1122− rc = gmap_protect_pte(gmap, gaddr, pmdp, prot,
1123− bits);
1124− if (!rc) {
1125− len -= PAGE_SIZE;
1126− gaddr += PAGE_SIZE;
1127− }
1128− } else {
1129− rc = gmap_protect_pmd(gmap, gaddr, pmdp, prot,
1130− bits);
1131− if (!rc) {
1132− dist = HPAGE_SIZE - (gaddr & ~HPAGE_MASK);
1133− len = len < dist ? 0 : len - dist;
1134− gaddr = (gaddr & HPAGE_MASK) + HPAGE_SIZE;
1135− }
1136− }
1137− gmap_pmd_op_end(gmap, pmdp);
1138− }
1139− if (rc) {
1140− if (rc == -EINVAL)
1141− return rc;
11421002
1143− /* -EAGAIN, fixup of userspace mm and gmap */
1144− vmaddr = __gmap_translate(gmap, gaddr);
1145− if (IS_ERR_VALUE(vmaddr))
1146− return vmaddr;
1147− rc = gmap_pte_op_fixup(gmap, gaddr, vmaddr, prot);
1148− if (rc)
1149− return rc;
1150− }
1151− }
1152− return 0;
1153−}
1003+ pmdp = gmap_pmd_op_walk(gmap, gaddr);
1004+ if (!pmdp)
1005+ return -EAGAIN;
11541006
1155−/**
1156− * gmap_mprotect_notify - change access rights for a range of ptes and
1157− * call the notifier if any pte changes again
1158− * @gmap: pointer to guest mapping meta data structure
1159− * @gaddr: virtual address in the guest address space
1160− * @len: size of area
1161− * @prot: indicates access rights: PROT_NONE, PROT_READ or PROT_WRITE
1162− *
1163− * Returns 0 if for each page in the given range a gmap mapping exists,
1164− * the new access rights could be set and the notifier could be armed.
1165− * If the gmap mapping is missing for one or more pages -EFAULT is
1166− * returned. If no memory could be allocated -ENOMEM is returned.
1167− * This function establishes missing page table entries.
1168− */
1169−int gmap_mprotect_notify(struct gmap *gmap, unsigned long gaddr,
1170− unsigned long len, int prot)
1171−{
1172− int rc;
1007+ if (!pmd_leaf(*pmdp)) {
1008+ rc = gmap_protect_pte(gmap, gaddr, pmdp, prot, bits);
1009+ if (!rc)
1010+ rc = PAGE_SIZE;
1011+ } else {
1012+ rc = gmap_protect_pmd(gmap, gaddr, pmdp, prot, bits);
1013+ if (!rc)
1014+ rc = HPAGE_SIZE;
1015+ }
1016+ gmap_pmd_op_end(gmap, pmdp);
11731017
1174− if ((gaddr & ~PAGE_MASK) || (len & ~PAGE_MASK) || gmap_is_shadow(gmap))
1175− return -EINVAL;
1176− if (!MACHINE_HAS_ESOP && prot == PROT_READ)
1177− return -EINVAL;
1178− mmap_read_lock(gmap->mm);
1179− rc = gmap_protect_range(gmap, gaddr, len, prot, GMAP_NOTIFY_MPROT);
1180− mmap_read_unlock(gmap->mm);
11811018 return rc;
11821019 }
1183−EXPORT_SYMBOL_GPL(gmap_mprotect_notify);
1020+EXPORT_SYMBOL_GPL(gmap_protect_one);
11841021
11851022 /**
11861023 * gmap_read_table - get an unsigned long value from a guest page table using
@@ -1414,7 +1251,6 @@ static void gmap_unshadow_pgt(struct gmap *sg, unsigned long raddr) · 227 unmodified lines
14141251 __gmap_unshadow_pgt(sg, raddr, __va(pgt));
14151252 /* Free page table */
14161253 ptdesc = page_ptdesc(phys_to_page(pgt));
1417− list_del(&ptdesc->pt_list);
14181254 page_table_free_pgste(ptdesc);
14191255 }
14201256
@@ -1442,7 +1278,6 @@ static void __gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr, · 21 unmodified lines
14421278 __gmap_unshadow_pgt(sg, raddr, __va(pgt));
14431279 /* Free page table */
14441280 ptdesc = page_ptdesc(phys_to_page(pgt));
1445− list_del(&ptdesc->pt_list);
14461281 page_table_free_pgste(ptdesc);
14471282 }
14481283 }
@@ -1472,7 +1307,6 @@ static void gmap_unshadow_sgt(struct gmap *sg, unsigned long raddr) · 23 unmodified lines
14721307 __gmap_unshadow_sgt(sg, raddr, __va(sgt));
14731308 /* Free segment table */
14741309 page = phys_to_page(sgt);
1475− list_del(&page->lru);
14761310 __free_pages(page, CRST_ALLOC_ORDER);
14771311 }
14781312
@@ -1500,7 +1334,6 @@ static void __gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr, · 21 unmodified lines
15001334 __gmap_unshadow_sgt(sg, raddr, __va(sgt));
15011335 /* Free segment table */
15021336 page = phys_to_page(sgt);
1503− list_del(&page->lru);
15041337 __free_pages(page, CRST_ALLOC_ORDER);
15051338 }
15061339 }
@@ -1530,7 +1363,6 @@ static void gmap_unshadow_r3t(struct gmap *sg, unsigned long raddr) · 23 unmodified lines
15301363 __gmap_unshadow_r3t(sg, raddr, __va(r3t));
15311364 /* Free region 3 table */
15321365 page = phys_to_page(r3t);
1533− list_del(&page->lru);
15341366 __free_pages(page, CRST_ALLOC_ORDER);
15351367 }
15361368
@@ -1558,7 +1390,6 @@ static void __gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr, · 21 unmodified lines
15581390 __gmap_unshadow_r3t(sg, raddr, __va(r3t));
15591391 /* Free region 3 table */
15601392 page = phys_to_page(r3t);
1561− list_del(&page->lru);
15621393 __free_pages(page, CRST_ALLOC_ORDER);
15631394 }
15641395 }
@@ -1588,7 +1419,6 @@ static void gmap_unshadow_r2t(struct gmap *sg, unsigned long raddr) · 23 unmodified lines
15881419 __gmap_unshadow_r2t(sg, raddr, __va(r2t));
15891420 /* Free region 2 table */
15901421 page = phys_to_page(r2t);
1591− list_del(&page->lru);
15921422 __free_pages(page, CRST_ALLOC_ORDER);
15931423 }
15941424
@@ -1620,7 +1450,6 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, · 25 unmodified lines
16201450 r1t[i] = _REGION1_ENTRY_EMPTY;
16211451 /* Free region 2 table */
16221452 page = phys_to_page(r2t);
1623− list_del(&page->lru);
16241453 __free_pages(page, CRST_ALLOC_ORDER);
16251454 }
16261455 }
@@ -1631,7 +1460,7 @@ static void __gmap_unshadow_r1t(struct gmap *sg, unsigned long raddr, · 4 unmodified lines
16311460 *
16321461 * Called with sg->guest_table_lock
16331462 */
1634−static void gmap_unshadow(struct gmap *sg)
1463+void gmap_unshadow(struct gmap *sg)
16351464 {
16361465 unsigned long *table;
16371466
@@ -1657,143 +1486,7 @@ static void gmap_unshadow(struct gmap *sg) · 19 unmodified lines
16571486 break;
16581487 }
16591488 }
1660−
1661−/**
1662− * gmap_find_shadow - find a specific asce in the list of shadow tables
1663− * @parent: pointer to the parent gmap
1664− * @asce: ASCE for which the shadow table is created
1665− * @edat_level: edat level to be used for the shadow translation
1666− *
1667− * Returns the pointer to a gmap if a shadow table with the given asce is
1668− * already available, ERR_PTR(-EAGAIN) if another one is just being created,
1669− * otherwise NULL
1670− */
1671−static struct gmap *gmap_find_shadow(struct gmap *parent, unsigned long asce,
1672− int edat_level)
1673−{
1674− struct gmap *sg;
1675−
1676− list_for_each_entry(sg, &parent->children, list) {
1677− if (sg->orig_asce != asce || sg->edat_level != edat_level ||
1678− sg->removed)
1679− continue;
1680− if (!sg->initialized)
1681− return ERR_PTR(-EAGAIN);
1682− refcount_inc(&sg->ref_count);
1683− return sg;
1684− }
1685− return NULL;
1686−}
1687−
1688−/**
1689− * gmap_shadow_valid - check if a shadow guest address space matches the
1690− * given properties and is still valid
1691− * @sg: pointer to the shadow guest address space structure
1692− * @asce: ASCE for which the shadow table is requested
1693− * @edat_level: edat level to be used for the shadow translation
1694− *
1695− * Returns 1 if the gmap shadow is still valid and matches the given
1696− * properties, the caller can continue using it. Returns 0 otherwise, the
1697− * caller has to request a new shadow gmap in this case.
1698− *
1699− */
1700−int gmap_shadow_valid(struct gmap *sg, unsigned long asce, int edat_level)
1701−{
1702− if (sg->removed)
1703− return 0;
1704− return sg->orig_asce == asce && sg->edat_level == edat_level;
1705−}
1706−EXPORT_SYMBOL_GPL(gmap_shadow_valid);
1707−
1708−/**
1709− * gmap_shadow - create/find a shadow guest address space
1710− * @parent: pointer to the parent gmap
1711− * @asce: ASCE for which the shadow table is created
1712− * @edat_level: edat level to be used for the shadow translation
1713− *
1714− * The pages of the top level page table referred by the asce parameter
1715− * will be set to read-only and marked in the PGSTEs of the kvm process.
1716− * The shadow table will be removed automatically on any change to the
1717− * PTE mapping for the source table.
1718− *
1719− * Returns a guest address space structure, ERR_PTR(-ENOMEM) if out of memory,
1720− * ERR_PTR(-EAGAIN) if the caller has to retry and ERR_PTR(-EFAULT) if the
1721− * parent gmap table could not be protected.
1722− */
1723−struct gmap *gmap_shadow(struct gmap *parent, unsigned long asce,
1724− int edat_level)
1725−{
1726− struct gmap *sg, *new;
1727− unsigned long limit;
1728− int rc;
1729−
1730− BUG_ON(parent->mm->context.allow_gmap_hpage_1m);
1731− BUG_ON(gmap_is_shadow(parent));
1732− spin_lock(&parent->shadow_lock);
1733− sg = gmap_find_shadow(parent, asce, edat_level);
1734− spin_unlock(&parent->shadow_lock);
1735− if (sg)
1736− return sg;
1737− /* Create a new shadow gmap */
1738− limit = -1UL >> (33 - (((asce & _ASCE_TYPE_MASK) >> 2) * 11));
1739− if (asce & _ASCE_REAL_SPACE)
1740− limit = -1UL;
1741− new = gmap_alloc(limit);
1742− if (!new)
1743− return ERR_PTR(-ENOMEM);
1744− new->mm = parent->mm;
1745− new->parent = gmap_get(parent);
1746− new->private = parent->private;
1747− new->orig_asce = asce;
1748− new->edat_level = edat_level;
1749− new->initialized = false;
1750− spin_lock(&parent->shadow_lock);
1751− /* Recheck if another CPU created the same shadow */
1752− sg = gmap_find_shadow(parent, asce, edat_level);
1753− if (sg) {
1754− spin_unlock(&parent->shadow_lock);
1755− gmap_free(new);
1756− return sg;
1757− }
1758− if (asce & _ASCE_REAL_SPACE) {
1759− /* only allow one real-space gmap shadow */
1760− list_for_each_entry(sg, &parent->children, list) {
1761− if (sg->orig_asce & _ASCE_REAL_SPACE) {
1762− spin_lock(&sg->guest_table_lock);
1763− gmap_unshadow(sg);
1764− spin_unlock(&sg->guest_table_lock);
1765− list_del(&sg->list);
1766− gmap_put(sg);
1767− break;
1768− }
1769− }
1770− }
1771− refcount_set(&new->ref_count, 2);
1772− list_add(&new->list, &parent->children);
1773− if (asce & _ASCE_REAL_SPACE) {
1774− /* nothing to protect, return right away */
1775− new->initialized = true;
1776− spin_unlock(&parent->shadow_lock);
1777− return new;
1778− }
1779− spin_unlock(&parent->shadow_lock);
1780− /* protect after insertion, so it will get properly invalidated */
1781− mmap_read_lock(parent->mm);
1782− rc = gmap_protect_range(parent, asce & _ASCE_ORIGIN,
1783− ((asce & _ASCE_TABLE_LENGTH) + 1) * PAGE_SIZE,
1784− PROT_READ, GMAP_NOTIFY_SHADOW);
1785− mmap_read_unlock(parent->mm);
1786− spin_lock(&parent->shadow_lock);
1787− new->initialized = true;
1788− if (rc) {
1789− list_del(&new->list);
1790− gmap_free(new);
1791− new = ERR_PTR(rc);
1792− }
1793− spin_unlock(&parent->shadow_lock);
1794− return new;
1795−}
1796−EXPORT_SYMBOL_GPL(gmap_shadow);
1489+EXPORT_SYMBOL(gmap_unshadow);
17971490
17981491 /**
17991492 * gmap_shadow_r2t - create an empty shadow region 2 table
@@ -1827,9 +1520,6 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, · 27 unmodified lines
18271520 page = gmap_alloc_crst();
18281521 if (!page)
18291522 return -ENOMEM;
1830− page->index = r2t & _REGION_ENTRY_ORIGIN;
1831− if (fake)
1832− page->index |= GMAP_SHADOW_FAKE_TABLE;
18331523 s_r2t = page_to_phys(page);
18341524 /* Install shadow region second table */
18351525 spin_lock(&sg->guest_table_lock);
@@ -1851,7 +1541,6 @@ int gmap_shadow_r2t(struct gmap *sg, unsigned long saddr, unsigned long r2t, · 15 unmodified lines
18511541 _REGION_ENTRY_TYPE_R1 | _REGION_ENTRY_INVALID;
18521542 if (sg->edat_level >= 1)
18531543 *table |= (r2t & _REGION_ENTRY_PROTECT);
1854− list_add(&page->lru, &sg->crst_list);
18551544 if (fake) {
18561545 /* nothing to protect for fake tables */
18571546 *table &= ~_REGION_ENTRY_INVALID;
@@ -1911,9 +1600,6 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, · 53 unmodified lines
19111600 page = gmap_alloc_crst();
19121601 if (!page)
19131602 return -ENOMEM;
1914− page->index = r3t & _REGION_ENTRY_ORIGIN;
1915− if (fake)
1916− page->index |= GMAP_SHADOW_FAKE_TABLE;
19171603 s_r3t = page_to_phys(page);
19181604 /* Install shadow region second table */
19191605 spin_lock(&sg->guest_table_lock);
@@ -1935,7 +1621,6 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t, · 15 unmodified lines
19351621 _REGION_ENTRY_TYPE_R2 | _REGION_ENTRY_INVALID;
19361622 if (sg->edat_level >= 1)
19371623 *table |= (r3t & _REGION_ENTRY_PROTECT);
1938− list_add(&page->lru, &sg->crst_list);
19391624 if (fake) {
19401625 /* nothing to protect for fake tables */
19411626 *table &= ~_REGION_ENTRY_INVALID;
@@ -1995,9 +1680,6 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, · 53 unmodified lines
19951680 page = gmap_alloc_crst();
19961681 if (!page)
19971682 return -ENOMEM;
1998− page->index = sgt & _REGION_ENTRY_ORIGIN;
1999− if (fake)
2000− page->index |= GMAP_SHADOW_FAKE_TABLE;
20011683 s_sgt = page_to_phys(page);
20021684 /* Install shadow region second table */
20031685 spin_lock(&sg->guest_table_lock);
@@ -2019,7 +1701,6 @@ int gmap_shadow_sgt(struct gmap *sg, unsigned long saddr, unsigned long sgt, · 15 unmodified lines
20191701 _REGION_ENTRY_TYPE_R3 | _REGION_ENTRY_INVALID;
20201702 if (sg->edat_level >= 1)
20211703 *table |= sgt & _REGION_ENTRY_PROTECT;
2022− list_add(&page->lru, &sg->crst_list);
20231704 if (fake) {
20241705 /* nothing to protect for fake tables */
20251706 *table &= ~_REGION_ENTRY_INVALID;
@@ -2052,45 +1733,22 @@ out_free: · 26 unmodified lines
20521733 }
20531734 EXPORT_SYMBOL_GPL(gmap_shadow_sgt);
20541735
2055−/**
2056− * gmap_shadow_pgt_lookup - find a shadow page table
2057− * @sg: pointer to the shadow guest address space structure
2058− * @saddr: the address in the shadow aguest address space
2059− * @pgt: parent gmap address of the page table to get shadowed
2060− * @dat_protection: if the pgtable is marked as protected by dat
2061− * @fake: pgt references contiguous guest memory block, not a pgtable
2062− *
2063− * Returns 0 if the shadow page table was found and -EAGAIN if the page
2064− * table was not found.
2065− *
2066− * Called with sg->mm->mmap_lock in read.
2067− */
2068−int gmap_shadow_pgt_lookup(struct gmap *sg, unsigned long saddr,
2069− unsigned long *pgt, int *dat_protection,
2070− int *fake)
1736+static void gmap_pgste_set_pgt_addr(struct ptdesc *ptdesc, unsigned long pgt_addr)
20711737 {
2072− unsigned long *table;
2073− struct page *page;
2074− int rc;
1738+ unsigned long *pgstes = page_to_virt(ptdesc_page(ptdesc));
20751739
2076− BUG_ON(!gmap_is_shadow(sg));
2077− spin_lock(&sg->guest_table_lock);
2078− table = gmap_table_walk(sg, saddr, 1); /* get segment pointer */
2079− if (table && !(*table & _SEGMENT_ENTRY_INVALID)) {
2080− /* Shadow page tables are full pages (pte+pgste) */
2081− page = pfn_to_page(*table >> PAGE_SHIFT);
2082− *pgt = page->index & ~GMAP_SHADOW_FAKE_TABLE;
2083− *dat_protection = !!(*table & _SEGMENT_ENTRY_PROTECT);
2084− *fake = !!(page->index & GMAP_SHADOW_FAKE_TABLE);
2085− rc = 0;
2086− } else {
2087− rc = -EAGAIN;
2088− }
2089− spin_unlock(&sg->guest_table_lock);
2090− return rc;
1740+ pgstes += _PAGE_ENTRIES;
1741+
1742+ pgstes[0] &= ~PGSTE_ST2_MASK;
1743+ pgstes[1] &= ~PGSTE_ST2_MASK;
1744+ pgstes[2] &= ~PGSTE_ST2_MASK;
1745+ pgstes[3] &= ~PGSTE_ST2_MASK;
20911746
1747+ pgstes[0] |= (pgt_addr >> 16) & PGSTE_ST2_MASK;
1748+ pgstes[1] |= pgt_addr & PGSTE_ST2_MASK;
1749+ pgstes[2] |= (pgt_addr << 16) & PGSTE_ST2_MASK;
1750+ pgstes[3] |= (pgt_addr << 32) & PGSTE_ST2_MASK;
20921751 }
2093−EXPORT_SYMBOL_GPL(gmap_shadow_pgt_lookup);
20941752
20951753 /**
20961754 * gmap_shadow_pgt - instantiate a shadow page table
@@ -2119,9 +1777,10 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, · 22 unmodified lines
21191777 ptdesc = page_table_alloc_pgste(sg->mm);
21201778 if (!ptdesc)
21211779 return -ENOMEM;
2122− ptdesc->pt_index = pgt & _SEGMENT_ENTRY_ORIGIN;
1780+ origin = pgt & _SEGMENT_ENTRY_ORIGIN;
21231781 if (fake)
2124− ptdesc->pt_index |= GMAP_SHADOW_FAKE_TABLE;
1782+ origin |= GMAP_SHADOW_FAKE_TABLE;
1783+ gmap_pgste_set_pgt_addr(ptdesc, origin);
21251784 s_pgt = page_to_phys(ptdesc_page(ptdesc));
21261785 /* Install shadow page table */
21271786 spin_lock(&sg->guest_table_lock);
@@ -2140,7 +1799,6 @@ int gmap_shadow_pgt(struct gmap *sg, unsigned long saddr, unsigned long pgt, · 12 unmodified lines
21401799 /* mark as invalid as long as the parent table is not protected */
21411800 *table = (unsigned long) s_pgt | _SEGMENT_ENTRY |
21421801 (pgt & _SEGMENT_ENTRY_PROTECT) | _SEGMENT_ENTRY_INVALID;
2143− list_add(&ptdesc->pt_list, &sg->pt_list);
21441802 if (fake) {
21451803 /* nothing to protect for fake tables */
21461804 *table &= ~_SEGMENT_ENTRY_INVALID;
@@ -2318,7 +1976,6 @@ void ptep_notify(struct mm_struct *mm, unsigned long vmaddr, · 171 unmodified lines
23181976 pte_t *pte, unsigned long bits)
23191977 {
23201978 unsigned long offset, gaddr = 0;
2321− unsigned long *table;
23221979 struct gmap *gmap, *sg, *next;
23231980
23241981 offset = ((unsigned long) pte) & (255 * sizeof(pte_t));
@@ -2326,12 +1983,9 @@ void ptep_notify(struct mm_struct *mm, unsigned long vmaddr, · 1 unmodified line
23261983 rcu_read_lock();
23271984 list_for_each_entry_rcu(gmap, &mm->context.gmap_list, list) {
23281985 spin_lock(&gmap->guest_table_lock);
2329− table = radix_tree_lookup(&gmap->host_to_guest,
2330− vmaddr >> PMD_SHIFT);
2331− if (table)
2332− gaddr = __gmap_segment_gaddr(table) + offset;
1986+ gaddr = host_to_guest_lookup(gmap, vmaddr) + offset;
23331987 spin_unlock(&gmap->guest_table_lock);
2334− if (!table)
1988+ if (!IS_GADDR_VALID(gaddr))
23351989 continue;
23361990
23371991 if (!list_empty(&gmap->children) && (bits & PGSTE_VSIE_BIT)) {
@@ -2391,10 +2045,8 @@ static void gmap_pmdp_clear(struct mm_struct *mm, unsigned long vmaddr, · 53 unmodified lines
23912045 rcu_read_lock();
23922046 list_for_each_entry_rcu(gmap, &mm->context.gmap_list, list) {
23932047 spin_lock(&gmap->guest_table_lock);
2394− pmdp = (pmd_t *)radix_tree_delete(&gmap->host_to_guest,
2395− vmaddr >> PMD_SHIFT);
2048+ pmdp = host_to_guest_pmd_delete(gmap, vmaddr, &gaddr);
23962049 if (pmdp) {
2397− gaddr = __gmap_segment_gaddr((unsigned long *)pmdp);
23982050 pmdp_notify_gmap(gmap, pmdp, gaddr);
23992051 WARN_ON(pmd_val(*pmdp) & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
24002052 _SEGMENT_ENTRY_GMAP_UC |
@@ -2438,28 +2090,25 @@ EXPORT_SYMBOL_GPL(gmap_pmdp_csp); · 37 unmodified lines
24382090 */
24392091 void gmap_pmdp_idte_local(struct mm_struct *mm, unsigned long vmaddr)
24402092 {
2441− unsigned long *entry, gaddr;
2093+ unsigned long gaddr;
24422094 struct gmap *gmap;
24432095 pmd_t *pmdp;
24442096
24452097 rcu_read_lock();
24462098 list_for_each_entry_rcu(gmap, &mm->context.gmap_list, list) {
24472099 spin_lock(&gmap->guest_table_lock);
2448− entry = radix_tree_delete(&gmap->host_to_guest,
2449− vmaddr >> PMD_SHIFT);
2450− if (entry) {
2451− pmdp = (pmd_t *)entry;
2452− gaddr = __gmap_segment_gaddr(entry);
2100+ pmdp = host_to_guest_pmd_delete(gmap, vmaddr, &gaddr);
2101+ if (pmdp) {
24532102 pmdp_notify_gmap(gmap, pmdp, gaddr);
2454− WARN_ON(*entry & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
2455− _SEGMENT_ENTRY_GMAP_UC |
2456− _SEGMENT_ENTRY));
2103+ WARN_ON(pmd_val(*pmdp) & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
2104+ _SEGMENT_ENTRY_GMAP_UC |
2105+ _SEGMENT_ENTRY));
24572106 if (MACHINE_HAS_TLB_GUEST)
24582107 __pmdp_idte(gaddr, pmdp, IDTE_GUEST_ASCE,
24592108 gmap->asce, IDTE_LOCAL);
24602109 else if (MACHINE_HAS_IDTE)
24612110 __pmdp_idte(gaddr, pmdp, 0, 0, IDTE_LOCAL);
2462− *entry = _SEGMENT_ENTRY_EMPTY;
2111+ *pmdp = __pmd(_SEGMENT_ENTRY_EMPTY);
24632112 }
24642113 spin_unlock(&gmap->guest_table_lock);
24652114 }
@@ -2474,22 +2123,19 @@ EXPORT_SYMBOL_GPL(gmap_pmdp_idte_local); · 8 unmodified lines
24742123 */
24752124 void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr)
24762125 {
2477− unsigned long *entry, gaddr;
2126+ unsigned long gaddr;
24782127 struct gmap *gmap;
24792128 pmd_t *pmdp;
24802129
24812130 rcu_read_lock();
24822131 list_for_each_entry_rcu(gmap, &mm->context.gmap_list, list) {
24832132 spin_lock(&gmap->guest_table_lock);
2484− entry = radix_tree_delete(&gmap->host_to_guest,
2485− vmaddr >> PMD_SHIFT);
2486− if (entry) {
2487− pmdp = (pmd_t *)entry;
2488− gaddr = __gmap_segment_gaddr(entry);
2133+ pmdp = host_to_guest_pmd_delete(gmap, vmaddr, &gaddr);
2134+ if (pmdp) {
24892135 pmdp_notify_gmap(gmap, pmdp, gaddr);
2490− WARN_ON(*entry & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
2491− _SEGMENT_ENTRY_GMAP_UC |
2492− _SEGMENT_ENTRY));
2136+ WARN_ON(pmd_val(*pmdp) & ~(_SEGMENT_ENTRY_HARDWARE_BITS_LARGE |
2137+ _SEGMENT_ENTRY_GMAP_UC |
2138+ _SEGMENT_ENTRY));
24932139 if (MACHINE_HAS_TLB_GUEST)
24942140 __pmdp_idte(gaddr, pmdp, IDTE_GUEST_ASCE,
24952141 gmap->asce, IDTE_GLOBAL);
@@ -2497,7 +2143,7 @@ void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr) · 1 unmodified line
24972143 __pmdp_idte(gaddr, pmdp, 0, 0, IDTE_GLOBAL);
24982144 else
24992145 __pmdp_csp(pmdp);
2500− *entry = _SEGMENT_ENTRY_EMPTY;
2146+ *pmdp = __pmd(_SEGMENT_ENTRY_EMPTY);
25012147 }
25022148 spin_unlock(&gmap->guest_table_lock);
25032149 }
@@ -2942,49 +2588,6 @@ int __s390_uv_destroy_range(struct mm_struct *mm, unsigned long start, · 438 unmodified lines
29422588 }
29432589 EXPORT_SYMBOL_GPL(__s390_uv_destroy_range);
29442590
2945−/**
2946− * s390_unlist_old_asce - Remove the topmost level of page tables from the
2947− * list of page tables of the gmap.
2948− * @gmap: the gmap whose table is to be removed
2949− *
2950− * On s390x, KVM keeps a list of all pages containing the page tables of the
2951− * gmap (the CRST list). This list is used at tear down time to free all
2952− * pages that are now not needed anymore.
2953− *
2954− * This function removes the topmost page of the tree (the one pointed to by
2955− * the ASCE) from the CRST list.
2956− *
2957− * This means that it will not be freed when the VM is torn down, and needs
2958− * to be handled separately by the caller, unless a leak is actually
2959− * intended. Notice that this function will only remove the page from the
2960− * list, the page will still be used as a top level page table (and ASCE).
2961− */
2962−void s390_unlist_old_asce(struct gmap *gmap)
2963−{
2964− struct page *old;
2965−
2966− old = virt_to_page(gmap->table);
2967− spin_lock(&gmap->guest_table_lock);
2968− list_del(&old->lru);
2969− /*
2970− * Sometimes the topmost page might need to be "removed" multiple
2971− * times, for example if the VM is rebooted into secure mode several
2972− * times concurrently, or if s390_replace_asce fails after calling
2973− * s390_remove_old_asce and is attempted again later. In that case
2974− * the old asce has been removed from the list, and therefore it
2975− * will not be freed when the VM terminates, but the ASCE is still
2976− * in use and still pointed to.
2977− * A subsequent call to replace_asce will follow the pointer and try
2978− * to remove the same page from the list again.
2979− * Therefore it's necessary that the page of the ASCE has valid
2980− * pointers, so list_del can work (and do nothing) without
2981− * dereferencing stale or invalid pointers.
2982− */
2983− INIT_LIST_HEAD(&old->lru);
2984− spin_unlock(&gmap->guest_table_lock);
2985−}
2986−EXPORT_SYMBOL_GPL(s390_unlist_old_asce);
2987−
29882591 /**
29892592 * s390_replace_asce - Try to replace the current ASCE of a gmap with a copy
29902593 * @gmap: the gmap whose ASCE needs to be replaced
@@ -3004,8 +2607,6 @@ int s390_replace_asce(struct gmap *gmap) · 13 unmodified lines
30042607 struct page *page;
30052608 void *table;
30062609
3007− s390_unlist_old_asce(gmap);
3008−
30092610 /* Replacing segment type ASCEs would cause serious issues */
30102611 if ((gmap->asce & _ASCE_TYPE_MASK) == _ASCE_TYPE_SEGMENT)
30112612 return -EINVAL;
@@ -3013,19 +2614,9 @@ int s390_replace_asce(struct gmap *gmap) · 1 unmodified line
30132614 page = gmap_alloc_crst();
30142615 if (!page)
30152616 return -ENOMEM;
3016− page->index = 0;
30172617 table = page_to_virt(page);
30182618 memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT));
30192619
3020− /*
3021− * The caller has to deal with the old ASCE, but here we make sure
3022− * the new one is properly added to the CRST list, so that
3023− * it will be freed when the VM is torn down.
3024− */
3025− spin_lock(&gmap->guest_table_lock);
3026− list_add(&page->lru, &gmap->crst_list);
3027− spin_unlock(&gmap->guest_table_lock);
3028−
30292620 /* Set new table origin while preserving existing ASCE control bits */
30302621 asce = (gmap->asce & ~_ASCE_ORIGIN) | __pa(table);
30312622 WRITE_ONCE(gmap->asce, asce);
@@ -3035,3 +2626,31 @@ int s390_replace_asce(struct gmap *gmap) · 3 unmodified lines
30352626 return 0;
30362627 }
30372628 EXPORT_SYMBOL_GPL(s390_replace_asce);
2629+
2630+/**
2631+ * kvm_s390_wiggle_split_folio() - try to drain extra references to a folio and optionally split
2632+ * @mm: the mm containing the folio to work on
2633+ * @folio: the folio
2634+ * @split: whether to split a large folio
2635+ *
2636+ * Context: Must be called while holding an extra reference to the folio;
2637+ * the mm lock should not be held.
2638+ */
2639+int kvm_s390_wiggle_split_folio(struct mm_struct *mm, struct folio *folio, bool split)
2640+{
2641+ int rc;
2642+
2643+ lockdep_assert_not_held(&mm->mmap_lock);
2644+ folio_wait_writeback(folio);
2645+ lru_add_drain_all();
2646+ if (split) {
2647+ folio_lock(folio);
2648+ rc = split_folio(folio);
2649+ folio_unlock(folio);
2650+
2651+ if (rc != -EBUSY)
2652+ return rc;
2653+ }
2654+ return -EAGAIN;
2655+}
2656+EXPORT_SYMBOL_GPL(kvm_s390_wiggle_split_folio);
arch/s390/mm/pgalloc.c+0−2
@@ -176,8 +176,6 @@ unsigned long *page_table_alloc(struct mm_struct *mm) · 175 unmodified lines
176176 }
177177 table = ptdesc_to_virt(ptdesc);
178178 __arch_set_page_dat(table, 1);
179− /* pt_list is used by gmap only */
180− INIT_LIST_HEAD(&ptdesc->pt_list);
181179 memset64((u64 *)table, _PAGE_INVALID, PTRS_PER_PTE);
182180 memset64((u64 *)table + PTRS_PER_PTE, 0, PTRS_PER_PTE);
183181 return table;
arch/s390/pci/pci_bus.c+20−0
@@ -331,6 +331,17 @@ error: · 330 unmodified lines
331331 return rc;
332332 }
333333
334+static bool zpci_bus_is_isolated_vf(struct zpci_bus *zbus, struct zpci_dev *zdev)
335+{
336+ struct pci_dev *pdev;
337+
338+ pdev = zpci_iov_find_parent_pf(zbus, zdev);
339+ if (!pdev)
340+ return true;
341+ pci_dev_put(pdev);
342+ return false;
343+}
344+
334345 int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops)
335346 {
336347 bool topo_is_tid = zdev->tid_avail;
@@ -345,6 +356,15 @@ int zpci_bus_device_register(struct zpci_dev *zdev, struct pci_ops *ops) · 8 unmodified lines
345356
346357 topo = topo_is_tid ? zdev->tid : zdev->pchid;
347358 zbus = zpci_bus_get(topo, topo_is_tid);
359+ /*
360+ * An isolated VF gets its own domain/bus even if there exists
361+ * a matching domain/bus already
362+ */
363+ if (zbus && zpci_bus_is_isolated_vf(zbus, zdev)) {
364+ zpci_bus_put(zbus);
365+ zbus = NULL;
366+ }
367+
348368 if (!zbus) {
349369 zbus = zpci_bus_alloc(topo, topo_is_tid);
350370 if (!zbus)
arch/s390/pci/pci_iov.c+42−14
@@ -60,18 +60,35 @@ static int zpci_iov_link_virtfn(struct pci_dev *pdev, struct pci_dev *virtfn, in · 59 unmodified lines
6060 return 0;
6161 }
6262
63−int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn)
63+/**
64+ * zpci_iov_find_parent_pf - Find the parent PF, if any, of the given function
65+ * @zbus: The bus that the PCI function is on, or would be added on
66+ * @zdev: The PCI function
67+ *
68+ * Finds the parent PF, if it exists and is configured, of the given PCI function
69+ * and increments its refcount. Th PF is searched for on the provided bus so the
70+ * caller has to ensure that this is the correct bus to search. This function may
71+ * be used before adding the PCI function to a zbus.
72+ *
73+ * Return: Pointer to the struct pci_dev of the parent PF or NULL if it not
74+ * found. If the function is not a VF or has no RequesterID information,
75+ * NULL is returned as well.
76+ */
77+struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev)
6478 {
65− int i, cand_devfn;
66− struct zpci_dev *zdev;
79+ int i, vfid, devfn, cand_devfn;
6780 struct pci_dev *pdev;
68− int vfid = vfn - 1; /* Linux' vfid's start at 0 vfn at 1*/
69− int rc = 0;
7081
7182 if (!zbus->multifunction)
72− return 0;
73−
74− /* If the parent PF for the given VF is also configured in the
83+ return NULL;
84+ /* Non-VFs and VFs without RID available don't have a parent */
85+ if (!zdev->vfn || !zdev->rid_available)
86+ return NULL;
87+ /* Linux vfid starts at 0 vfn at 1 */
88+ vfid = zdev->vfn - 1;
89+ devfn = zdev->rid & ZPCI_RID_MASK_DEVFN;
90+ /*
91+ * If the parent PF for the given VF is also configured in the
7592 * instance, it must be on the same zbus.
7693 * We can then identify the parent PF by checking what
7794 * devfn the VF would have if it belonged to that PF using the PF's
@@ -85,15 +102,26 @@ int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn · 7 unmodified lines
85102 if (!pdev)
86103 continue;
87104 cand_devfn = pci_iov_virtfn_devfn(pdev, vfid);
88− if (cand_devfn == virtfn->devfn) {
89− rc = zpci_iov_link_virtfn(pdev, virtfn, vfid);
90− /* balance pci_get_slot() */
91− pci_dev_put(pdev);
92− break;
93− }
105+ if (cand_devfn == devfn)
106+ return pdev;
94107 /* balance pci_get_slot() */
95108 pci_dev_put(pdev);
96109 }
97110 }
111+ return NULL;
112+}
113+
114+int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn)
115+{
116+ struct zpci_dev *zdev = to_zpci(virtfn);
117+ struct pci_dev *pdev_pf;
118+ int rc = 0;
119+
120+ pdev_pf = zpci_iov_find_parent_pf(zbus, zdev);
121+ if (pdev_pf) {
122+ /* Linux' vfids start at 0 while zdev->vfn starts at 1 */
123+ rc = zpci_iov_link_virtfn(pdev_pf, virtfn, zdev->vfn - 1);
124+ pci_dev_put(pdev_pf);
125+ }
98126 return rc;
99127 }
arch/s390/pci/pci_iov.h+7−0
@@ -19,6 +19,8 @@ void zpci_iov_map_resources(struct pci_dev *pdev); · 18 unmodified lines
1919
2020 int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *virtfn, int vfn);
2121
22+struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev);
23+
2224 #else /* CONFIG_PCI_IOV */
2325 static inline void zpci_iov_remove_virtfn(struct pci_dev *pdev, int vfn) {}
2426
@@ -28,5 +30,10 @@ static inline int zpci_iov_setup_virtfn(struct zpci_bus *zbus, struct pci_dev *v · 3 unmodified lines
2830 {
2931 return 0;
3032 }
33+
34+static inline struct pci_dev *zpci_iov_find_parent_pf(struct zpci_bus *zbus, struct zpci_dev *zdev)
35+{
36+ return NULL;
37+}
3138 #endif /* CONFIG_PCI_IOV */
3239 #endif /* __S390_PCI_IOV_h */
arch/um/drivers/virt-pci.c+102−96
@@ -25,8 +25,10 @@ · 24 unmodified lines
2525 #define MAX_IRQ_MSG_SIZE (sizeof(struct virtio_pcidev_msg) + sizeof(u32))
2626 #define NUM_IRQ_MSGS 10
2727
28−#define HANDLE_NO_FREE(ptr) ((void *)((unsigned long)(ptr) | 1))
29−#define HANDLE_IS_NO_FREE(ptr) ((unsigned long)(ptr) & 1)
28+struct um_pci_message_buffer {
29+ struct virtio_pcidev_msg hdr;
30+ u8 data[8];
31+};
3032
3133 struct um_pci_device {
3234 struct virtio_device *vdev;
@@ -36,6 +38,11 @@ struct um_pci_device { · 3 unmodified lines
3638
3739 struct virtqueue *cmd_vq, *irq_vq;
3840
41+#define UM_PCI_WRITE_BUFS 20
42+ struct um_pci_message_buffer bufs[UM_PCI_WRITE_BUFS + 1];
43+ void *extra_ptrs[UM_PCI_WRITE_BUFS + 1];
44+ DECLARE_BITMAP(used_bufs, UM_PCI_WRITE_BUFS);
45+
3946 #define UM_PCI_STAT_WAITING 0
4047 unsigned long status;
4148
@@ -61,12 +68,40 @@ static unsigned long um_pci_msi_used[BITS_TO_LONGS(MAX_MSI_VECTORS)]; · 19 unmodified lines
6168 static unsigned int um_pci_max_delay_us = 40000;
6269 module_param_named(max_delay_us, um_pci_max_delay_us, uint, 0644);
6370
64−struct um_pci_message_buffer {
65− struct virtio_pcidev_msg hdr;
66− u8 data[8];
67−};
71+static int um_pci_get_buf(struct um_pci_device *dev, bool *posted)
72+{
73+ int i;
74+
75+ for (i = 0; i < UM_PCI_WRITE_BUFS; i++) {
76+ if (!test_and_set_bit(i, dev->used_bufs))
77+ return i;
78+ }
6879
69−static struct um_pci_message_buffer __percpu *um_pci_msg_bufs;
80+ *posted = false;
81+ return UM_PCI_WRITE_BUFS;
82+}
83+
84+static void um_pci_free_buf(struct um_pci_device *dev, void *buf)
85+{
86+ int i;
87+
88+ if (buf == &dev->bufs[UM_PCI_WRITE_BUFS]) {
89+ kfree(dev->extra_ptrs[UM_PCI_WRITE_BUFS]);
90+ dev->extra_ptrs[UM_PCI_WRITE_BUFS] = NULL;
91+ return;
92+ }
93+
94+ for (i = 0; i < UM_PCI_WRITE_BUFS; i++) {
95+ if (buf == &dev->bufs[i]) {
96+ kfree(dev->extra_ptrs[i]);
97+ dev->extra_ptrs[i] = NULL;
98+ WARN_ON(!test_and_clear_bit(i, dev->used_bufs));
99+ return;
100+ }
101+ }
102+
103+ WARN_ON(1);
104+}
70105
71106 static int um_pci_send_cmd(struct um_pci_device *dev,
72107 struct virtio_pcidev_msg *cmd,
@@ -82,7 +117,9 @@ static int um_pci_send_cmd(struct um_pci_device *dev, · 9 unmodified lines
82117 };
83118 struct um_pci_message_buffer *buf;
84119 int delay_count = 0;
120+ bool bounce_out;
85121 int ret, len;
122+ int buf_idx;
86123 bool posted;
87124
88125 if (WARN_ON(cmd_size < sizeof(*cmd) || cmd_size > sizeof(*buf)))
@@ -101,26 +138,28 @@ static int um_pci_send_cmd(struct um_pci_device *dev, · 12 unmodified lines
101138 break;
102139 }
103140
104− buf = get_cpu_var(um_pci_msg_bufs);
105− if (buf)
106− memcpy(buf, cmd, cmd_size);
141+ bounce_out = !posted && cmd_size <= sizeof(*cmd) &&
142+ out && out_size <= sizeof(buf->data);
107143
108− if (posted) {
109− u8 *ncmd = kmalloc(cmd_size + extra_size, GFP_ATOMIC);
110−
111− if (ncmd) {
112− memcpy(ncmd, cmd, cmd_size);
113− if (extra)
114− memcpy(ncmd + cmd_size, extra, extra_size);
115− cmd = (void *)ncmd;
116− cmd_size += extra_size;
117− extra = NULL;
118− extra_size = 0;
119− } else {
120− /* try without allocating memory */
121− posted = false;
122− cmd = (void *)buf;
144+ buf_idx = um_pci_get_buf(dev, &posted);
145+ buf = &dev->bufs[buf_idx];
146+ memcpy(buf, cmd, cmd_size);
147+
148+ if (posted && extra && extra_size > sizeof(buf) - cmd_size) {
149+ dev->extra_ptrs[buf_idx] = kmemdup(extra, extra_size,
150+ GFP_ATOMIC);
151+
152+ if (!dev->extra_ptrs[buf_idx]) {
153+ um_pci_free_buf(dev, buf);
154+ return -ENOMEM;
123155 }
156+ extra = dev->extra_ptrs[buf_idx];
157+ } else if (extra && extra_size <= sizeof(buf) - cmd_size) {
158+ memcpy((u8 *)buf + cmd_size, extra, extra_size);
159+ cmd_size += extra_size;
160+ extra_size = 0;
161+ extra = NULL;
162+ cmd = (void *)buf;
124163 } else {
125164 cmd = (void *)buf;
126165 }
@@ -128,39 +167,40 @@ static int um_pci_send_cmd(struct um_pci_device *dev, · 1 unmodified line
128167 sg_init_one(&out_sg, cmd, cmd_size);
129168 if (extra)
130169 sg_init_one(&extra_sg, extra, extra_size);
131− if (out)
170+ /* allow stack for small buffers */
171+ if (bounce_out)
172+ sg_init_one(&in_sg, buf->data, out_size);
173+ else if (out)
132174 sg_init_one(&in_sg, out, out_size);
133175
134176 /* add to internal virtio queue */
135177 ret = virtqueue_add_sgs(dev->cmd_vq, sgs_list,
136178 extra ? 2 : 1,
137179 out ? 1 : 0,
138− posted ? cmd : HANDLE_NO_FREE(cmd),
139− GFP_ATOMIC);
180+ cmd, GFP_ATOMIC);
140181 if (ret) {
141− if (posted)
142− kfree(cmd);
143− goto out;
182+ um_pci_free_buf(dev, buf);
183+ return ret;
144184 }
145185
146186 if (posted) {
147187 virtqueue_kick(dev->cmd_vq);
148− ret = 0;
149− goto out;
188+ return 0;
150189 }
151190
152191 /* kick and poll for getting a response on the queue */
153192 set_bit(UM_PCI_STAT_WAITING, &dev->status);
154193 virtqueue_kick(dev->cmd_vq);
194+ ret = 0;
155195
156196 while (1) {
157197 void *completed = virtqueue_get_buf(dev->cmd_vq, &len);
158198
159− if (completed == HANDLE_NO_FREE(cmd))
199+ if (completed == buf)
160200 break;
161201
162− if (completed && !HANDLE_IS_NO_FREE(completed))
163− kfree(completed);
202+ if (completed)
203+ um_pci_free_buf(dev, completed);
164204
165205 if (WARN_ONCE(virtqueue_is_broken(dev->cmd_vq) ||
166206 ++delay_count > um_pci_max_delay_us,
@@ -172,8 +212,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev, · 5 unmodified lines
172212 }
173213 clear_bit(UM_PCI_STAT_WAITING, &dev->status);
174214
175−out:
176− put_cpu_var(um_pci_msg_bufs);
215+ if (bounce_out)
216+ memcpy(out, buf->data, out_size);
217+
218+ um_pci_free_buf(dev, buf);
219+
177220 return ret;
178221 }
179222
@@ -187,20 +230,13 @@ static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset, · 7 unmodified lines
187230 .size = size,
188231 .addr = offset,
189232 };
190− /* buf->data is maximum size - we may only use parts of it */
191− struct um_pci_message_buffer *buf;
192− u8 *data;
193− unsigned long ret = ULONG_MAX;
194− size_t bytes = sizeof(buf->data);
233+ /* max 8, we might not use it all */
234+ u8 data[8];
195235
196236 if (!dev)
197237 return ULONG_MAX;
198238
199− buf = get_cpu_var(um_pci_msg_bufs);
200− data = buf->data;
201−
202− if (buf)
203− memset(data, 0xff, bytes);
239+ memset(data, 0xff, sizeof(data));
204240
205241 switch (size) {
206242 case 1:
@@ -212,34 +248,26 @@ static unsigned long um_pci_cfgspace_read(void *priv, unsigned int offset, · 5 unmodified lines
212248 break;
213249 default:
214250 WARN(1, "invalid config space read size %d\n", size);
215− goto out;
251+ return ULONG_MAX;
216252 }
217253
218− if (um_pci_send_cmd(dev, &hdr, sizeof(hdr), NULL, 0, data, bytes))
219− goto out;
254+ if (um_pci_send_cmd(dev, &hdr, sizeof(hdr), NULL, 0, data, size))
255+ return ULONG_MAX;
220256
221257 switch (size) {
222258 case 1:
223− ret = data[0];
224− break;
259+ return data[0];
225260 case 2:
226− ret = le16_to_cpup((void *)data);
227− break;
261+ return le16_to_cpup((void *)data);
228262 case 4:
229− ret = le32_to_cpup((void *)data);
230− break;
263+ return le32_to_cpup((void *)data);
231264 #ifdef CONFIG_64BIT
232265 case 8:
233− ret = le64_to_cpup((void *)data);
234− break;
266+ return le64_to_cpup((void *)data);
235267 #endif
236268 default:
237− break;
269+ return ULONG_MAX;
238270 }
239−
240−out:
241− put_cpu_var(um_pci_msg_bufs);
242− return ret;
243271 }
244272
245273 static void um_pci_cfgspace_write(void *priv, unsigned int offset, int size,
@@ -312,13 +340,8 @@ static void um_pci_bar_copy_from(void *priv, void *buffer, · 66 unmodified lines
312340 static unsigned long um_pci_bar_read(void *priv, unsigned int offset,
313341 int size)
314342 {
315− /* buf->data is maximum size - we may only use parts of it */
316− struct um_pci_message_buffer *buf;
317− u8 *data;
318− unsigned long ret = ULONG_MAX;
319−
320− buf = get_cpu_var(um_pci_msg_bufs);
321− data = buf->data;
343+ /* 8 is maximum size - we may only use parts of it */
344+ u8 data[8];
322345
323346 switch (size) {
324347 case 1:
@@ -330,33 +353,25 @@ static unsigned long um_pci_bar_read(void *priv, unsigned int offset, · 5 unmodified lines
330353 break;
331354 default:
332355 WARN(1, "invalid config space read size %d\n", size);
333− goto out;
356+ return ULONG_MAX;
334357 }
335358
336359 um_pci_bar_copy_from(priv, data, offset, size);
337360
338361 switch (size) {
339362 case 1:
340− ret = data[0];
341− break;
363+ return data[0];
342364 case 2:
343− ret = le16_to_cpup((void *)data);
344− break;
365+ return le16_to_cpup((void *)data);
345366 case 4:
346− ret = le32_to_cpup((void *)data);
347− break;
367+ return le32_to_cpup((void *)data);
348368 #ifdef CONFIG_64BIT
349369 case 8:
350− ret = le64_to_cpup((void *)data);
351− break;
370+ return le64_to_cpup((void *)data);
352371 #endif
353372 default:
354− break;
373+ return ULONG_MAX;
355374 }
356−
357−out:
358− put_cpu_var(um_pci_msg_bufs);
359− return ret;
360375 }
361376
362377 static void um_pci_bar_copy_to(void *priv, unsigned int offset,
@@ -523,11 +538,8 @@ static void um_pci_cmd_vq_cb(struct virtqueue *vq) · 160 unmodified lines
523538 if (test_bit(UM_PCI_STAT_WAITING, &dev->status))
524539 return;
525540
526− while ((cmd = virtqueue_get_buf(vq, &len))) {
527− if (WARN_ON(HANDLE_IS_NO_FREE(cmd)))
528− continue;
529− kfree(cmd);
530− }
541+ while ((cmd = virtqueue_get_buf(vq, &len)))
542+ um_pci_free_buf(dev, cmd);
531543 }
532544
533545 static void um_pci_irq_vq_cb(struct virtqueue *vq)
@@ -1006,10 +1018,6 @@ static int __init um_pci_init(void) · 472 unmodified lines
10061018 "No virtio device ID configured for PCI - no PCI support\n"))
10071019 return 0;
10081020
1009− um_pci_msg_bufs = alloc_percpu(struct um_pci_message_buffer);
1010− if (!um_pci_msg_bufs)
1011− return -ENOMEM;
1012−
10131021 bridge = pci_alloc_host_bridge(0);
10141022 if (!bridge) {
10151023 err = -ENOMEM;
@@ -1070,7 +1078,6 @@ free: · 54 unmodified lines
10701078 pci_free_resource_list(&bridge->windows);
10711079 pci_free_host_bridge(bridge);
10721080 }
1073− free_percpu(um_pci_msg_bufs);
10741081 return err;
10751082 }
10761083 module_init(um_pci_init);
@@ -1082,6 +1089,5 @@ static void __exit um_pci_exit(void) · 5 unmodified lines
10821089 irq_domain_remove(um_pci_inner_domain);
10831090 pci_free_resource_list(&bridge->windows);
10841091 pci_free_host_bridge(bridge);
1085− free_percpu(um_pci_msg_bufs);
10861092 }
10871093 module_exit(um_pci_exit);
arch/um/drivers/virtio_uml.c+4−4
@@ -52,7 +52,7 @@ struct virtio_uml_device { · 51 unmodified lines
5252 struct platform_device *pdev;
5353 struct virtio_uml_platform_data *pdata;
5454
55− spinlock_t sock_lock;
55+ raw_spinlock_t sock_lock;
5656 int sock, req_fd, irq;
5757 u64 features;
5858 u64 protocol_features;
@@ -246,7 +246,7 @@ static int vhost_user_send(struct virtio_uml_device *vu_dev, · 187 unmodified lines
246246 if (request_ack)
247247 msg->header.flags |= VHOST_USER_FLAG_NEED_REPLY;
248248
249− spin_lock_irqsave(&vu_dev->sock_lock, flags);
249+ raw_spin_lock_irqsave(&vu_dev->sock_lock, flags);
250250 rc = full_sendmsg_fds(vu_dev->sock, msg, size, fds, num_fds);
251251 if (rc < 0)
252252 goto out;
@@ -266,7 +266,7 @@ static int vhost_user_send(struct virtio_uml_device *vu_dev, · 13 unmodified lines
266266 }
267267
268268 out:
269− spin_unlock_irqrestore(&vu_dev->sock_lock, flags);
269+ raw_spin_unlock_irqrestore(&vu_dev->sock_lock, flags);
270270 return rc;
271271 }
272272
@@ -1239,7 +1239,7 @@ static int virtio_uml_probe(struct platform_device *pdev) · 966 unmodified lines
12391239 goto error_free;
12401240 vu_dev->sock = rc;
12411241
1242− spin_lock_init(&vu_dev->sock_lock);
1242+ raw_spin_lock_init(&vu_dev->sock_lock);
12431243
12441244 rc = vhost_user_init(vu_dev);
12451245 if (rc)
arch/um/kernel/irq.c+47−32
@@ -52,7 +52,7 @@ struct irq_entry { · 51 unmodified lines
5252 bool sigio_workaround;
5353 };
5454
55−static DEFINE_SPINLOCK(irq_lock);
55+static DEFINE_RAW_SPINLOCK(irq_lock);
5656 static LIST_HEAD(active_fds);
5757 static DECLARE_BITMAP(irqs_allocated, UM_LAST_SIGNAL_IRQ);
5858 static bool irqs_suspended;
@@ -257,7 +257,7 @@ static struct irq_entry *get_irq_entry_by_fd(int fd) · 198 unmodified lines
257257 return NULL;
258258 }
259259
260−static void free_irq_entry(struct irq_entry *to_free, bool remove)
260+static void remove_irq_entry(struct irq_entry *to_free, bool remove)
261261 {
262262 if (!to_free)
263263 return;
@@ -265,7 +265,6 @@ static void free_irq_entry(struct irq_entry *to_free, bool remove) · 1 unmodified line
265265 if (remove)
266266 os_del_epoll_fd(to_free->fd);
267267 list_del(&to_free->list);
268− kfree(to_free);
269268 }
270269
271270 static bool update_irq_entry(struct irq_entry *entry)
@@ -286,17 +285,19 @@ static bool update_irq_entry(struct irq_entry *entry) · 14 unmodified lines
286285 return false;
287286 }
288287
289−static void update_or_free_irq_entry(struct irq_entry *entry)
288+static struct irq_entry *update_or_remove_irq_entry(struct irq_entry *entry)
290289 {
291− if (!update_irq_entry(entry))
292− free_irq_entry(entry, false);
290+ if (update_irq_entry(entry))
291+ return NULL;
292+ remove_irq_entry(entry, false);
293+ return entry;
293294 }
294295
295296 static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id,
296297 void (*timetravel_handler)(int, int, void *,
297298 struct time_travel_event *))
298299 {
299− struct irq_entry *irq_entry;
300+ struct irq_entry *irq_entry, *to_free = NULL;
300301 int err, events = os_event_mask(type);
301302 unsigned long flags;
302303
@@ -304,9 +305,10 @@ static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id, · 1 unmodified line
304305 if (err < 0)
305306 goto out;
306307
307− spin_lock_irqsave(&irq_lock, flags);
308+ raw_spin_lock_irqsave(&irq_lock, flags);
308309 irq_entry = get_irq_entry_by_fd(fd);
309310 if (irq_entry) {
311+already:
310312 /* cannot register the same FD twice with the same type */
311313 if (WARN_ON(irq_entry->reg[type].events)) {
312314 err = -EALREADY;
@@ -316,11 +318,22 @@ static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id, · 3 unmodified lines
316318 /* temporarily disable to avoid IRQ-side locking */
317319 os_del_epoll_fd(fd);
318320 } else {
319− irq_entry = kzalloc(sizeof(*irq_entry), GFP_ATOMIC);
320− if (!irq_entry) {
321− err = -ENOMEM;
322− goto out_unlock;
321+ struct irq_entry *new;
322+
323+ /* don't restore interrupts */
324+ raw_spin_unlock(&irq_lock);
325+ new = kzalloc(sizeof(*irq_entry), GFP_ATOMIC);
326+ if (!new) {
327+ local_irq_restore(flags);
328+ return -ENOMEM;
323329 }
330+ raw_spin_lock(&irq_lock);
331+ irq_entry = get_irq_entry_by_fd(fd);
332+ if (irq_entry) {
333+ to_free = new;
334+ goto already;
335+ }
336+ irq_entry = new;
324337 irq_entry->fd = fd;
325338 list_add_tail(&irq_entry->list, &active_fds);
326339 maybe_sigio_broken(fd);
@@ -339,12 +352,11 @@ static int activate_fd(int irq, int fd, enum um_irq_type type, void *dev_id, · 12 unmodified lines
339352 #endif
340353
341354 WARN_ON(!update_irq_entry(irq_entry));
342− spin_unlock_irqrestore(&irq_lock, flags);
343−
344− return 0;
355+ err = 0;
345356 out_unlock:
346− spin_unlock_irqrestore(&irq_lock, flags);
357+ raw_spin_unlock_irqrestore(&irq_lock, flags);
347358 out:
359+ kfree(to_free);
348360 return err;
349361 }
350362
@@ -358,19 +370,20 @@ void free_irq_by_fd(int fd) · 7 unmodified lines
358370 struct irq_entry *to_free;
359371 unsigned long flags;
360372
361− spin_lock_irqsave(&irq_lock, flags);
373+ raw_spin_lock_irqsave(&irq_lock, flags);
362374 to_free = get_irq_entry_by_fd(fd);
363− free_irq_entry(to_free, true);
364− spin_unlock_irqrestore(&irq_lock, flags);
375+ remove_irq_entry(to_free, true);
376+ raw_spin_unlock_irqrestore(&irq_lock, flags);
377+ kfree(to_free);
365378 }
366379 EXPORT_SYMBOL(free_irq_by_fd);
367380
368381 static void free_irq_by_irq_and_dev(unsigned int irq, void *dev)
369382 {
370− struct irq_entry *entry;
383+ struct irq_entry *entry, *to_free = NULL;
371384 unsigned long flags;
372385
373− spin_lock_irqsave(&irq_lock, flags);
386+ raw_spin_lock_irqsave(&irq_lock, flags);
374387 list_for_each_entry(entry, &active_fds, list) {
375388 enum um_irq_type i;
376389
@@ -386,12 +399,13 @@ static void free_irq_by_irq_and_dev(unsigned int irq, void *dev) · 9 unmodified lines
386399
387400 os_del_epoll_fd(entry->fd);
388401 reg->events = 0;
389− update_or_free_irq_entry(entry);
402+ to_free = update_or_remove_irq_entry(entry);
390403 goto out;
391404 }
392405 }
393406 out:
394− spin_unlock_irqrestore(&irq_lock, flags);
407+ raw_spin_unlock_irqrestore(&irq_lock, flags);
408+ kfree(to_free);
395409 }
396410
397411 void deactivate_fd(int fd, int irqnum)
@@ -402,7 +416,7 @@ void deactivate_fd(int fd, int irqnum) · 4 unmodified lines
402416
403417 os_del_epoll_fd(fd);
404418
405− spin_lock_irqsave(&irq_lock, flags);
419+ raw_spin_lock_irqsave(&irq_lock, flags);
406420 entry = get_irq_entry_by_fd(fd);
407421 if (!entry)
408422 goto out;
@@ -414,9 +428,10 @@ void deactivate_fd(int fd, int irqnum) · 5 unmodified lines
414428 entry->reg[i].events = 0;
415429 }
416430
417− update_or_free_irq_entry(entry);
431+ entry = update_or_remove_irq_entry(entry);
418432 out:
419− spin_unlock_irqrestore(&irq_lock, flags);
433+ raw_spin_unlock_irqrestore(&irq_lock, flags);
434+ kfree(entry);
420435
421436 ignore_sigio_fd(fd);
422437 }
@@ -546,7 +561,7 @@ void um_irqs_suspend(void) · 123 unmodified lines
546561
547562 irqs_suspended = true;
548563
549− spin_lock_irqsave(&irq_lock, flags);
564+ raw_spin_lock_irqsave(&irq_lock, flags);
550565 list_for_each_entry(entry, &active_fds, list) {
551566 enum um_irq_type t;
552567 bool clear = true;
@@ -579,7 +594,7 @@ void um_irqs_suspend(void) · 26 unmodified lines
579594 !__ignore_sigio_fd(entry->fd);
580595 }
581596 }
582− spin_unlock_irqrestore(&irq_lock, flags);
597+ raw_spin_unlock_irqrestore(&irq_lock, flags);
583598 }
584599
585600 void um_irqs_resume(void)
@@ -588,7 +603,7 @@ void um_irqs_resume(void) · 2 unmodified lines
588603 unsigned long flags;
589604
590605
591− spin_lock_irqsave(&irq_lock, flags);
606+ raw_spin_lock_irqsave(&irq_lock, flags);
592607 list_for_each_entry(entry, &active_fds, list) {
593608 if (entry->suspended) {
594609 int err = os_set_fd_async(entry->fd);
@@ -602,7 +617,7 @@ void um_irqs_resume(void) · 7 unmodified lines
602617 }
603618 }
604619 }
605− spin_unlock_irqrestore(&irq_lock, flags);
620+ raw_spin_unlock_irqrestore(&irq_lock, flags);
606621
607622 irqs_suspended = false;
608623 send_sigio_to_self();
@@ -613,7 +628,7 @@ static int normal_irq_set_wake(struct irq_data *d, unsigned int on) · 4 unmodified lines
613628 struct irq_entry *entry;
614629 unsigned long flags;
615630
616− spin_lock_irqsave(&irq_lock, flags);
631+ raw_spin_lock_irqsave(&irq_lock, flags);
617632 list_for_each_entry(entry, &active_fds, list) {
618633 enum um_irq_type t;
619634
@@ -628,7 +643,7 @@ static int normal_irq_set_wake(struct irq_data *d, unsigned int on) · 8 unmodified lines
628643 }
629644 }
630645 unlock:
631− spin_unlock_irqrestore(&irq_lock, flags);
646+ raw_spin_unlock_irqrestore(&irq_lock, flags);
632647 return 0;
633648 }
634649 #else
arch/um/kernel/process.c+9−1
@@ -191,7 +191,15 @@ void initial_thread_cb(void (*proc)(void *), void *arg) · 190 unmodified lines
191191 int arch_dup_task_struct(struct task_struct *dst,
192192 struct task_struct *src)
193193 {
194− memcpy(dst, src, arch_task_struct_size);
194+ /* init_task is not dynamically sized (missing FPU state) */
195+ if (unlikely(src == &init_task)) {
196+ memcpy(dst, src, sizeof(init_task));
197+ memset((void *)dst + sizeof(init_task), 0,
198+ arch_task_struct_size - sizeof(init_task));
199+ } else {
200+ memcpy(dst, src, arch_task_struct_size);
201+ }
202+
195203 return 0;
196204 }
197205
arch/um/os-Linux/skas/process.c+13−3
@@ -181,6 +181,10 @@ extern char __syscall_stub_start[]; · 180 unmodified lines
181181
182182 static int stub_exe_fd;
183183
184+#ifndef CLOSE_RANGE_CLOEXEC
185+#define CLOSE_RANGE_CLOEXEC (1U << 2)
186+#endif
187+
184188 static int userspace_tramp(void *stack)
185189 {
186190 char *const argv[] = { "uml-userspace", NULL };
@@ -202,8 +206,12 @@ static int userspace_tramp(void *stack) · 15 unmodified lines
202206 init_data.stub_data_fd = phys_mapping(uml_to_phys(stack), &offset);
203207 init_data.stub_data_offset = MMAP_OFFSET(offset);
204208
205− /* Set CLOEXEC on all FDs and then unset on all memory related FDs */
206− close_range(0, ~0U, CLOSE_RANGE_CLOEXEC);
209+ /*
210+ * Avoid leaking unneeded FDs to the stub by setting CLOEXEC on all FDs
211+ * and then unsetting it on all memory related FDs.
212+ * This is not strictly necessary from a safety perspective.
213+ */
214+ syscall(__NR_close_range, 0, ~0U, CLOSE_RANGE_CLOEXEC);
207215
208216 fcntl(init_data.stub_data_fd, F_SETFD, 0);
209217 for (iomem = iomem_regions; iomem; iomem = iomem->next)
@@ -224,7 +232,9 @@ static int userspace_tramp(void *stack) · 14 unmodified lines
224232 if (ret != sizeof(init_data))
225233 exit(4);
226234
227− execveat(stub_exe_fd, "", argv, NULL, AT_EMPTY_PATH);
235+ /* Raw execveat for compatibility with older libc versions */
236+ syscall(__NR_execveat, stub_exe_fd, (unsigned long)"",
237+ (unsigned long)argv, NULL, AT_EMPTY_PATH);
228238
229239 exit(5);
230240 }
arch/x86/Kconfig+2−1
@@ -2599,7 +2599,8 @@ config MITIGATION_IBPB_ENTRY · 2598 unmodified lines
25992599 depends on CPU_SUP_AMD && X86_64
26002600 default y
26012601 help
2602− Compile the kernel with support for the retbleed=ibpb mitigation.
2602+ Compile the kernel with support for the retbleed=ibpb and
2603+ spec_rstack_overflow={ibpb,ibpb-vmexit} mitigations.
26032604
26042605 config MITIGATION_IBRS_ENTRY
26052606 bool "Enable IBRS on kernel entry"
arch/x86/boot/compressed/Makefile+1−0
@@ -25,6 +25,7 @@ targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma \ · 24 unmodified lines
2525 # avoid errors with '-march=i386', and future flags may depend on the target to
2626 # be valid.
2727 KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS)
28+KBUILD_CFLAGS += -std=gnu11
2829 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE
2930 KBUILD_CFLAGS += -Wundef
3031 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
arch/x86/events/intel/core.c+14−19
@@ -4905,20 +4905,22 @@ static inline bool intel_pmu_broken_perf_cap(void) · 4904 unmodified lines
49054905
49064906 static void update_pmu_cap(struct x86_hybrid_pmu *pmu)
49074907 {
4908− unsigned int sub_bitmaps, eax, ebx, ecx, edx;
4908+ unsigned int cntr, fixed_cntr, ecx, edx;
4909+ union cpuid35_eax eax;
4910+ union cpuid35_ebx ebx;
49094911
4910− cpuid(ARCH_PERFMON_EXT_LEAF, &sub_bitmaps, &ebx, &ecx, &edx);
4912+ cpuid(ARCH_PERFMON_EXT_LEAF, &eax.full, &ebx.full, &ecx, &edx);
49114913
4912− if (ebx & ARCH_PERFMON_EXT_UMASK2)
4914+ if (ebx.split.umask2)
49134915 pmu->config_mask |= ARCH_PERFMON_EVENTSEL_UMASK2;
4914− if (ebx & ARCH_PERFMON_EXT_EQ)
4916+ if (ebx.split.eq)
49154917 pmu->config_mask |= ARCH_PERFMON_EVENTSEL_EQ;
49164918
4917− if (sub_bitmaps & ARCH_PERFMON_NUM_COUNTER_LEAF_BIT) {
4919+ if (eax.split.cntr_subleaf) {
49184920 cpuid_count(ARCH_PERFMON_EXT_LEAF, ARCH_PERFMON_NUM_COUNTER_LEAF,
4919− &eax, &ebx, &ecx, &edx);
4920− pmu->cntr_mask64 = eax;
4921− pmu->fixed_cntr_mask64 = ebx;
4921+ &cntr, &fixed_cntr, &ecx, &edx);
4922+ pmu->cntr_mask64 = cntr;
4923+ pmu->fixed_cntr_mask64 = fixed_cntr;
49224924 }
49234925
49244926 if (!intel_pmu_broken_perf_cap()) {
@@ -4941,11 +4943,6 @@ static void intel_pmu_check_hybrid_pmus(struct x86_hybrid_pmu *pmu) · 16 unmodified lines
49414943 else
49424944 pmu->intel_ctrl &= ~(1ULL << GLOBAL_CTRL_EN_PERF_METRICS);
49434945
4944− if (pmu->intel_cap.pebs_output_pt_available)
4945− pmu->pmu.capabilities |= PERF_PMU_CAP_AUX_OUTPUT;
4946− else
4947− pmu->pmu.capabilities &= ~PERF_PMU_CAP_AUX_OUTPUT;
4948−
49494946 intel_pmu_check_event_constraints(pmu->event_constraints,
49504947 pmu->cntr_mask64,
49514948 pmu->fixed_cntr_mask64,
@@ -5023,9 +5020,6 @@ static bool init_hybrid_pmu(int cpu) · 71 unmodified lines
50235020
50245021 pr_info("%s PMU driver: ", pmu->name);
50255022
5026− if (pmu->intel_cap.pebs_output_pt_available)
5027− pr_cont("PEBS-via-PT ");
5028−
50295023 pr_cont("\n");
50305024
50315025 x86_pmu_show_pmu_cap(&pmu->pmu);
@@ -5048,8 +5042,11 @@ static void intel_pmu_cpu_starting(int cpu) · 16 unmodified lines
50485042
50495043 init_debug_store_on_cpu(cpu);
50505044 /*
5051− * Deal with CPUs that don't clear their LBRs on power-up.
5045+ * Deal with CPUs that don't clear their LBRs on power-up, and that may
5046+ * even boot with LBRs enabled.
50525047 */
5048+ if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && x86_pmu.lbr_nr)
5049+ msr_clear_bit(MSR_IA32_DEBUGCTLMSR, DEBUGCTLMSR_LBR_BIT);
50535050 intel_pmu_lbr_reset();
50545051
50555052 cpuc->lbr_sel = NULL;
@@ -6370,11 +6367,9 @@ static __always_inline int intel_pmu_init_hybrid(enum hybrid_pmu_type pmus) · 1314 unmodified lines
63706367 pmu->intel_cap.capabilities = x86_pmu.intel_cap.capabilities;
63716368 if (pmu->pmu_type & hybrid_small_tiny) {
63726369 pmu->intel_cap.perf_metrics = 0;
6373− pmu->intel_cap.pebs_output_pt_available = 1;
63746370 pmu->mid_ack = true;
63756371 } else if (pmu->pmu_type & hybrid_big) {
63766372 pmu->intel_cap.perf_metrics = 1;
6377− pmu->intel_cap.pebs_output_pt_available = 0;
63786373 pmu->late_ack = true;
63796374 }
63806375 }
arch/x86/events/intel/ds.c+9−1
@@ -2578,7 +2578,15 @@ void __init intel_ds_init(void) · 2577 unmodified lines
25782578 }
25792579 pr_cont("PEBS fmt4%c%s, ", pebs_type, pebs_qual);
25802580
2581− if (!is_hybrid() && x86_pmu.intel_cap.pebs_output_pt_available) {
2581+ /*
2582+ * The PEBS-via-PT is not supported on hybrid platforms,
2583+ * because not all CPUs of a hybrid machine support it.
2584+ * The global x86_pmu.intel_cap, which only contains the
2585+ * common capabilities, is used to check the availability
2586+ * of the feature. The per-PMU pebs_output_pt_available
2587+ * in a hybrid machine should be ignored.
2588+ */
2589+ if (x86_pmu.intel_cap.pebs_output_pt_available) {
25822590 pr_cont("PEBS-via-PT, ");
25832591 x86_get_pmu(smp_processor_id())->capabilities |= PERF_PMU_CAP_AUX_OUTPUT;
25842592 }
arch/x86/events/rapl.c+4−8
@@ -370,6 +370,10 @@ static int rapl_pmu_event_init(struct perf_event *event) · 369 unmodified lines
370370 unsigned int rapl_pmu_idx;
371371 struct rapl_pmus *rapl_pmus;
372372
373+ /* only look at RAPL events */
374+ if (event->attr.type != event->pmu->type)
375+ return -ENOENT;
376+
373377 /* unsupported modes and filters */
374378 if (event->attr.sample_period) /* no sampling */
375379 return -EINVAL;
@@ -387,10 +391,6 @@ static int rapl_pmu_event_init(struct perf_event *event) · 11 unmodified lines
387391 rapl_pmus_scope = rapl_pmus->pmu.scope;
388392
389393 if (rapl_pmus_scope == PERF_PMU_SCOPE_PKG || rapl_pmus_scope == PERF_PMU_SCOPE_DIE) {
390− /* only look at RAPL package events */
391− if (event->attr.type != rapl_pmus_pkg->pmu.type)
392− return -ENOENT;
393−
394394 cfg = array_index_nospec((long)cfg, NR_RAPL_PKG_DOMAINS + 1);
395395 if (!cfg || cfg >= NR_RAPL_PKG_DOMAINS + 1)
396396 return -EINVAL;
@@ -398,10 +398,6 @@ static int rapl_pmu_event_init(struct perf_event *event) · 1 unmodified line
398398 bit = cfg - 1;
399399 event->hw.event_base = rapl_model->rapl_pkg_msrs[bit].msr;
400400 } else if (rapl_pmus_scope == PERF_PMU_SCOPE_CORE) {
401− /* only look at RAPL core events */
402− if (event->attr.type != rapl_pmus_core->pmu.type)
403− return -ENOENT;
404−
405401 cfg = array_index_nospec((long)cfg, NR_RAPL_CORE_DOMAINS + 1);
406402 if (!cfg || cfg >= NR_RAPL_PKG_DOMAINS + 1)
407403 return -EINVAL;
arch/x86/include/asm/kvm-x86-ops.h+1−0
@@ -48,6 +48,7 @@ KVM_X86_OP(set_idt) · 47 unmodified lines
4848 KVM_X86_OP(get_gdt)
4949 KVM_X86_OP(set_gdt)
5050 KVM_X86_OP(sync_dirty_debug_regs)
51+KVM_X86_OP(set_dr6)
5152 KVM_X86_OP(set_dr7)
5253 KVM_X86_OP(cache_reg)
5354 KVM_X86_OP(get_rflags)
arch/x86/include/asm/kvm_host.h+1−0
@@ -1696,6 +1696,7 @@ struct kvm_x86_ops { · 1695 unmodified lines
16961696 void (*get_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
16971697 void (*set_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
16981698 void (*sync_dirty_debug_regs)(struct kvm_vcpu *vcpu);
1699+ void (*set_dr6)(struct kvm_vcpu *vcpu, unsigned long value);
16991700 void (*set_dr7)(struct kvm_vcpu *vcpu, unsigned long value);
17001701 void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg);
17011702 unsigned long (*get_rflags)(struct kvm_vcpu *vcpu);
arch/x86/include/asm/msr-index.h+2−1
@@ -395,7 +395,8 @@ · 394 unmodified lines
395395 #define MSR_IA32_PASID_VALID BIT_ULL(31)
396396
397397 /* DEBUGCTLMSR bits (others vary by model): */
398−#define DEBUGCTLMSR_LBR (1UL << 0) /* last branch recording */
398+#define DEBUGCTLMSR_LBR_BIT 0 /* last branch recording */
399+#define DEBUGCTLMSR_LBR (1UL << DEBUGCTLMSR_LBR_BIT)
399400 #define DEBUGCTLMSR_BTF_SHIFT 1
400401 #define DEBUGCTLMSR_BTF (1UL << 1) /* single-step on branches */
401402 #define DEBUGCTLMSR_BUS_LOCK_DETECT (1UL << 2)
arch/x86/include/asm/perf_event.h+25−3
@@ -188,11 +188,33 @@ union cpuid10_edx { · 187 unmodified lines
188188 * detection/enumeration details:
189189 */
190190 #define ARCH_PERFMON_EXT_LEAF 0x00000023
191−#define ARCH_PERFMON_EXT_UMASK2 0x1
192−#define ARCH_PERFMON_EXT_EQ 0x2
193−#define ARCH_PERFMON_NUM_COUNTER_LEAF_BIT 0x1
194191 #define ARCH_PERFMON_NUM_COUNTER_LEAF 0x1
195192
193+union cpuid35_eax {
194+ struct {
195+ unsigned int leaf0:1;
196+ /* Counters Sub-Leaf */
197+ unsigned int cntr_subleaf:1;
198+ /* Auto Counter Reload Sub-Leaf */
199+ unsigned int acr_subleaf:1;
200+ /* Events Sub-Leaf */
201+ unsigned int events_subleaf:1;
202+ unsigned int reserved:28;
203+ } split;
204+ unsigned int full;
205+};
206+
207+union cpuid35_ebx {
208+ struct {
209+ /* UnitMask2 Supported */
210+ unsigned int umask2:1;
211+ /* EQ-bit Supported */
212+ unsigned int eq:1;
213+ unsigned int reserved:30;
214+ } split;
215+ unsigned int full;
216+};
217+
196218 /*
197219 * Intel Architectural LBR CPUID detection/enumeration details:
198220 */
arch/x86/include/asm/sev.h+2−0
@@ -531,6 +531,7 @@ static inline void __init snp_secure_tsc_init(void) { } · 530 unmodified lines
531531
532532 #ifdef CONFIG_KVM_AMD_SEV
533533 bool snp_probe_rmptable_info(void);
534+int snp_rmptable_init(void);
534535 int snp_lookup_rmpentry(u64 pfn, bool *assigned, int *level);
535536 void snp_dump_hva_rmpentry(unsigned long address);
536537 int psmash(u64 pfn);
@@ -541,6 +542,7 @@ void kdump_sev_callback(void); · 4 unmodified lines
541542 void snp_fixup_e820_tables(void);
542543 #else
543544 static inline bool snp_probe_rmptable_info(void) { return false; }
545+static inline int snp_rmptable_init(void) { return -ENOSYS; }
544546 static inline int snp_lookup_rmpentry(u64 pfn, bool *assigned, int *level) { return -ENODEV; }
545547 static inline void snp_dump_hva_rmpentry(unsigned long address) {}
546548 static inline int psmash(u64 pfn) { return -ENODEV; }
arch/x86/kernel/cpu/bugs.c+14−7
@@ -1115,6 +1115,8 @@ do_cmd_auto: · 1114 unmodified lines
11151115
11161116 case RETBLEED_MITIGATION_IBPB:
11171117 setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
1118+ setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
1119+ mitigate_smt = true;
11181120
11191121 /*
11201122 * IBPB on entry already obviates the need for
@@ -1124,9 +1126,6 @@ do_cmd_auto: · 3 unmodified lines
11241126 setup_clear_cpu_cap(X86_FEATURE_UNRET);
11251127 setup_clear_cpu_cap(X86_FEATURE_RETHUNK);
11261128
1127− setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
1128− mitigate_smt = true;
1129−
11301129 /*
11311130 * There is no need for RSB filling: entry_ibpb() ensures
11321131 * all predictions, including the RSB, are invalidated,
@@ -2646,6 +2645,7 @@ static void __init srso_select_mitigation(void) · 1513 unmodified lines
26462645 if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) {
26472646 if (has_microcode) {
26482647 setup_force_cpu_cap(X86_FEATURE_ENTRY_IBPB);
2648+ setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
26492649 srso_mitigation = SRSO_MITIGATION_IBPB;
26502650
26512651 /*
@@ -2655,6 +2655,13 @@ static void __init srso_select_mitigation(void) · 3 unmodified lines
26552655 */
26562656 setup_clear_cpu_cap(X86_FEATURE_UNRET);
26572657 setup_clear_cpu_cap(X86_FEATURE_RETHUNK);
2658+
2659+ /*
2660+ * There is no need for RSB filling: entry_ibpb() ensures
2661+ * all predictions, including the RSB, are invalidated,
2662+ * regardless of IBPB implementation.
2663+ */
2664+ setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
26582665 }
26592666 } else {
26602667 pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n");
@@ -2663,8 +2670,8 @@ static void __init srso_select_mitigation(void) · 2 unmodified lines
26632670
26642671 ibpb_on_vmexit:
26652672 case SRSO_CMD_IBPB_ON_VMEXIT:
2666− if (IS_ENABLED(CONFIG_MITIGATION_SRSO)) {
2667− if (!boot_cpu_has(X86_FEATURE_ENTRY_IBPB) && has_microcode) {
2673+ if (IS_ENABLED(CONFIG_MITIGATION_IBPB_ENTRY)) {
2674+ if (has_microcode) {
26682675 setup_force_cpu_cap(X86_FEATURE_IBPB_ON_VMEXIT);
26692676 srso_mitigation = SRSO_MITIGATION_IBPB_ON_VMEXIT;
26702677
@@ -2676,8 +2683,8 @@ ibpb_on_vmexit: · 5 unmodified lines
26762683 setup_clear_cpu_cap(X86_FEATURE_RSB_VMEXIT);
26772684 }
26782685 } else {
2679− pr_err("WARNING: kernel not compiled with MITIGATION_SRSO.\n");
2680− }
2686+ pr_err("WARNING: kernel not compiled with MITIGATION_IBPB_ENTRY.\n");
2687+ }
26812688 break;
26822689 default:
26832690 break;
arch/x86/kvm/cpuid.c+1−1
@@ -1180,7 +1180,7 @@ void kvm_set_cpu_caps(void) · 1179 unmodified lines
11801180 SYNTHESIZED_F(SBPB),
11811181 SYNTHESIZED_F(IBPB_BRTYPE),
11821182 SYNTHESIZED_F(SRSO_NO),
1183− SYNTHESIZED_F(SRSO_USER_KERNEL_NO),
1183+ F(SRSO_USER_KERNEL_NO),
11841184 );
11851185
11861186 kvm_cpu_cap_init(CPUID_8000_0022_EAX,
arch/x86/kvm/hyperv.c+5−1
@@ -2226,6 +2226,9 @@ static u64 kvm_hv_send_ipi(struct kvm_vcpu *vcpu, struct kvm_hv_hcall *hc) · 2225 unmodified lines
22262226 u32 vector;
22272227 bool all_cpus;
22282228
2229+ if (!lapic_in_kernel(vcpu))
2230+ return HV_STATUS_INVALID_HYPERCALL_INPUT;
2231+
22292232 if (hc->code == HVCALL_SEND_IPI) {
22302233 if (!hc->fast) {
22312234 if (unlikely(kvm_read_guest(kvm, hc->ingpa, &send_ipi,
@@ -2852,7 +2855,8 @@ int kvm_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, · 620 unmodified lines
28522855 ent->eax |= HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED;
28532856 ent->eax |= HV_X64_APIC_ACCESS_RECOMMENDED;
28542857 ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED;
2855− ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED;
2858+ if (!vcpu || lapic_in_kernel(vcpu))
2859+ ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED;
28562860 ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED;
28572861 if (evmcs_ver)
28582862 ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED;
arch/x86/kvm/mmu/mmu.c+27−8
@@ -5540,7 +5540,7 @@ void kvm_init_shadow_npt_mmu(struct kvm_vcpu *vcpu, unsigned long cr0, · 5539 unmodified lines
55405540 union kvm_mmu_page_role root_role;
55415541
55425542 /* NPT requires CR0.PG=1. */
5543− WARN_ON_ONCE(cpu_role.base.direct);
5543+ WARN_ON_ONCE(cpu_role.base.direct || !cpu_role.base.guest_mode);
55445544
55455545 root_role = cpu_role.base;
55465546 root_role.level = kvm_mmu_get_tdp_level(vcpu);
@@ -7120,6 +7120,19 @@ static void mmu_destroy_caches(void) · 1573 unmodified lines
71207120 kmem_cache_destroy(mmu_page_header_cache);
71217121 }
71227122
7123+static void kvm_wake_nx_recovery_thread(struct kvm *kvm)
7124+{
7125+ /*
7126+ * The NX recovery thread is spawned on-demand at the first KVM_RUN and
7127+ * may not be valid even though the VM is globally visible. Do nothing,
7128+ * as such a VM can't have any possible NX huge pages.
7129+ */
7130+ struct vhost_task *nx_thread = READ_ONCE(kvm->arch.nx_huge_page_recovery_thread);
7131+
7132+ if (nx_thread)
7133+ vhost_task_wake(nx_thread);
7134+}
7135+
71237136 static int get_nx_huge_pages(char *buffer, const struct kernel_param *kp)
71247137 {
71257138 if (nx_hugepage_mitigation_hard_disabled)
@@ -7180,7 +7193,7 @@ static int set_nx_huge_pages(const char *val, const struct kernel_param *kp) · 54 unmodified lines
71807193 kvm_mmu_zap_all_fast(kvm);
71817194 mutex_unlock(&kvm->slots_lock);
71827195
7183− vhost_task_wake(kvm->arch.nx_huge_page_recovery_thread);
7196+ kvm_wake_nx_recovery_thread(kvm);
71847197 }
71857198 mutex_unlock(&kvm_lock);
71867199 }
@@ -7315,7 +7328,7 @@ static int set_nx_huge_pages_recovery_param(const char *val, const struct kernel · 128 unmodified lines
73157328 mutex_lock(&kvm_lock);
73167329
73177330 list_for_each_entry(kvm, &vm_list, vm_list)
7318− vhost_task_wake(kvm->arch.nx_huge_page_recovery_thread);
7331+ kvm_wake_nx_recovery_thread(kvm);
73197332
73207333 mutex_unlock(&kvm_lock);
73217334 }
@@ -7451,14 +7464,20 @@ static void kvm_mmu_start_lpage_recovery(struct once *once) · 129 unmodified lines
74517464 {
74527465 struct kvm_arch *ka = container_of(once, struct kvm_arch, nx_once);
74537466 struct kvm *kvm = container_of(ka, struct kvm, arch);
7467+ struct vhost_task *nx_thread;
74547468
74557469 kvm->arch.nx_huge_page_last = get_jiffies_64();
7456− kvm->arch.nx_huge_page_recovery_thread = vhost_task_create(
7457− kvm_nx_huge_page_recovery_worker, kvm_nx_huge_page_recovery_worker_kill,
7458− kvm, "kvm-nx-lpage-recovery");
7470+ nx_thread = vhost_task_create(kvm_nx_huge_page_recovery_worker,
7471+ kvm_nx_huge_page_recovery_worker_kill,
7472+ kvm, "kvm-nx-lpage-recovery");
74597473
7460− if (kvm->arch.nx_huge_page_recovery_thread)
7461− vhost_task_start(kvm->arch.nx_huge_page_recovery_thread);
7474+ if (!nx_thread)
7475+ return;
7476+
7477+ vhost_task_start(nx_thread);
7478+
7479+ /* Make the task visible only once it is fully started. */
7480+ WRITE_ONCE(kvm->arch.nx_huge_page_recovery_thread, nx_thread);
74627481 }
74637482
74647483 int kvm_mmu_post_init_vm(struct kvm *kvm)
arch/x86/kvm/svm/nested.c+5−5
@@ -646,6 +646,11 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm, · 645 unmodified lines
646646 u32 pause_count12;
647647 u32 pause_thresh12;
648648
649+ nested_svm_transition_tlb_flush(vcpu);
650+
651+ /* Enter Guest-Mode */
652+ enter_guest_mode(vcpu);
653+
649654 /*
650655 * Filled at exit: exit_code, exit_code_hi, exit_info_1, exit_info_2,
651656 * exit_int_info, exit_int_info_err, next_rip, insn_len, insn_bytes.
@@ -762,11 +767,6 @@ static void nested_vmcb02_prepare_control(struct vcpu_svm *svm, · 110 unmodified lines
762767 }
763768 }
764769
765− nested_svm_transition_tlb_flush(vcpu);
766−
767− /* Enter Guest-Mode */
768− enter_guest_mode(vcpu);
769−
770770 /*
771771 * Merge guest and host intercepts - must be called with vcpu in
772772 * guest-mode to take effect.
arch/x86/kvm/svm/sev.c+10−0
@@ -2972,6 +2972,16 @@ void __init sev_hardware_setup(void) · 2971 unmodified lines
29722972 WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_FLUSHBYASID)))
29732973 goto out;
29742974
2975+ /*
2976+ * The kernel's initcall infrastructure lacks the ability to express
2977+ * dependencies between initcalls, whereas the modules infrastructure
2978+ * automatically handles dependencies via symbol loading. Ensure the
2979+ * PSP SEV driver is initialized before proceeding if KVM is built-in,
2980+ * as the dependency isn't handled by the initcall infrastructure.
2981+ */
2982+ if (IS_BUILTIN(CONFIG_KVM_AMD) && sev_module_init())
2983+ goto out;
2984+
29752985 /* Retrieve SEV CPUID information */
29762986 cpuid(0x8000001f, &eax, &ebx, &ecx, &edx);
29772987
arch/x86/kvm/svm/svm.c+6−7
@@ -1991,11 +1991,11 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) · 1990 unmodified lines
19911991 svm->asid = sd->next_asid++;
19921992 }
19931993
1994−static void svm_set_dr6(struct vcpu_svm *svm, unsigned long value)
1994+static void svm_set_dr6(struct kvm_vcpu *vcpu, unsigned long value)
19951995 {
1996− struct vmcb *vmcb = svm->vmcb;
1996+ struct vmcb *vmcb = to_svm(vcpu)->vmcb;
19971997
1998− if (svm->vcpu.arch.guest_state_protected)
1998+ if (vcpu->arch.guest_state_protected)
19991999 return;
20002000
20012001 if (unlikely(value != vmcb->save.dr6)) {
@@ -4247,10 +4247,8 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, · 2245 unmodified lines
42474247 * Run with all-zero DR6 unless needed, so that we can get the exact cause
42484248 * of a #DB.
42494249 */
4250− if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))
4251− svm_set_dr6(svm, vcpu->arch.dr6);
4252− else
4253− svm_set_dr6(svm, DR6_ACTIVE_LOW);
4250+ if (likely(!(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)))
4251+ svm_set_dr6(vcpu, DR6_ACTIVE_LOW);
42544252
42554253 clgi();
42564254 kvm_load_guest_xsave_state(vcpu);
@@ -5043,6 +5041,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata = { · 786 unmodified lines
50435041 .set_idt = svm_set_idt,
50445042 .get_gdt = svm_get_gdt,
50455043 .set_gdt = svm_set_gdt,
5044+ .set_dr6 = svm_set_dr6,
50465045 .set_dr7 = svm_set_dr7,
50475046 .sync_dirty_debug_regs = svm_sync_dirty_debug_regs,
50485047 .cache_reg = svm_cache_reg,
arch/x86/kvm/vmx/main.c+1−0
@@ -61,6 +61,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = { · 60 unmodified lines
6161 .set_idt = vmx_set_idt,
6262 .get_gdt = vmx_get_gdt,
6363 .set_gdt = vmx_set_gdt,
64+ .set_dr6 = vmx_set_dr6,
6465 .set_dr7 = vmx_set_dr7,
6566 .sync_dirty_debug_regs = vmx_sync_dirty_debug_regs,
6667 .cache_reg = vmx_cache_reg,
arch/x86/kvm/vmx/vmx.c+6−4
@@ -5648,6 +5648,12 @@ void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu) · 5647 unmodified lines
56485648 set_debugreg(DR6_RESERVED, 6);
56495649 }
56505650
5651+void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val)
5652+{
5653+ lockdep_assert_irqs_disabled();
5654+ set_debugreg(vcpu->arch.dr6, 6);
5655+}
5656+
56515657 void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val)
56525658 {
56535659 vmcs_writel(GUEST_DR7, val);
@@ -7417,10 +7423,6 @@ fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu, bool force_immediate_exit) · 1763 unmodified lines
74177423 vmx->loaded_vmcs->host_state.cr4 = cr4;
74187424 }
74197425
7420− /* When KVM_DEBUGREG_WONT_EXIT, dr6 is accessible in guest. */
7421− if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))
7422− set_debugreg(vcpu->arch.dr6, 6);
7423−
74247426 /* When single-stepping over STI and MOV SS, we must clear the
74257427 * corresponding interruptibility bits in the guest state. Otherwise
74267428 * vmentry fails as it then expects bit 14 (BS) in pending debug
arch/x86/kvm/vmx/x86_ops.h+1−0
@@ -73,6 +73,7 @@ void vmx_get_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt); · 72 unmodified lines
7373 void vmx_set_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
7474 void vmx_get_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
7575 void vmx_set_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
76+void vmx_set_dr6(struct kvm_vcpu *vcpu, unsigned long val);
7677 void vmx_set_dr7(struct kvm_vcpu *vcpu, unsigned long val);
7778 void vmx_sync_dirty_debug_regs(struct kvm_vcpu *vcpu);
7879 void vmx_cache_reg(struct kvm_vcpu *vcpu, enum kvm_reg reg);
arch/x86/kvm/x86.c+4−6
@@ -10961,6 +10961,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) · 10960 unmodified lines
1096110961 set_debugreg(vcpu->arch.eff_db[1], 1);
1096210962 set_debugreg(vcpu->arch.eff_db[2], 2);
1096310963 set_debugreg(vcpu->arch.eff_db[3], 3);
10964+ /* When KVM_DEBUGREG_WONT_EXIT, dr6 is accessible in guest. */
10965+ if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT))
10966+ kvm_x86_call(set_dr6)(vcpu, vcpu->arch.dr6);
1096410967 } else if (unlikely(hw_breakpoint_active())) {
1096510968 set_debugreg(0, 7);
1096610969 }
@@ -12741,6 +12744,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 1774 unmodified lines
1274112744 "does not run without ignore_msrs=1, please report it to kvm@vger.kernel.org.\n");
1274212745 }
1274312746
12747+ once_init(&kvm->arch.nx_once);
1274412748 return 0;
1274512749
1274612750 out_uninit_mmu:
@@ -12750,12 +12754,6 @@ out: · 3 unmodified lines
1275012754 return ret;
1275112755 }
1275212756
12753−int kvm_arch_post_init_vm(struct kvm *kvm)
12754−{
12755− once_init(&kvm->arch.nx_once);
12756− return 0;
12757−}
12758−
1275912757 static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
1276012758 {
1276112759 vcpu_load(vcpu);
arch/x86/um/os-Linux/registers.c+18−3
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <registers.h>
1919 #include <sys/mman.h>
2020
21+static unsigned long ptrace_regset;
2122 unsigned long host_fp_size;
2223
2324 int get_fp_registers(int pid, unsigned long *regs)
@@ -27,7 +28,7 @@ int get_fp_registers(int pid, unsigned long *regs) · 3 unmodified lines
2728 .iov_len = host_fp_size,
2829 };
2930
30− if (ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov) < 0)
31+ if (ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov) < 0)
3132 return -errno;
3233 return 0;
3334 }
@@ -39,7 +40,7 @@ int put_fp_registers(int pid, unsigned long *regs) · 5 unmodified lines
3940 .iov_len = host_fp_size,
4041 };
4142
42− if (ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov) < 0)
43+ if (ptrace(PTRACE_SETREGSET, pid, ptrace_regset, &iov) < 0)
4344 return -errno;
4445 return 0;
4546 }
@@ -58,9 +59,23 @@ int arch_init_registers(int pid) · 12 unmodified lines
5859 return -ENOMEM;
5960
6061 /* GDB has x86_xsave_length, which uses x86_cpuid_count */
61− ret = ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov);
62+ ptrace_regset = NT_X86_XSTATE;
63+ ret = ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov);
6264 if (ret)
6365 ret = -errno;
66+
67+ if (ret == -ENODEV) {
68+#ifdef CONFIG_X86_32
69+ ptrace_regset = NT_PRXFPREG;
70+#else
71+ ptrace_regset = NT_PRFPREG;
72+#endif
73+ iov.iov_len = 2 * 1024 * 1024;
74+ ret = ptrace(PTRACE_GETREGSET, pid, ptrace_regset, &iov);
75+ if (ret)
76+ ret = -errno;
77+ }
78+
6479 munmap(iov.iov_base, 2 * 1024 * 1024);
6580
6681 host_fp_size = iov.iov_len;
arch/x86/um/signal.c+10−3
@@ -187,7 +187,12 @@ static int copy_sc_to_user(struct sigcontext __user *to, · 186 unmodified lines
187187 * Put magic/size values for userspace. We do not bother to verify them
188188 * later on, however, userspace needs them should it try to read the
189189 * XSTATE data. And ptrace does not fill in these parts.
190+ *
191+ * Skip this if we do not have an XSTATE frame.
190192 */
193+ if (host_fp_size <= sizeof(to_fp64->fpstate))
194+ return 0;
195+
191196 BUILD_BUG_ON(sizeof(int) != FP_XSTATE_MAGIC2_SIZE);
192197 #ifdef CONFIG_X86_32
193198 __put_user(offsetof(struct _fpstate_32, _fxsr_env) +
@@ -367,11 +372,13 @@ int setup_signal_stack_si(unsigned long stack_top, struct ksignal *ksig, · 173 unmodified lines
367372 int err = 0, sig = ksig->sig;
368373 unsigned long fp_to;
369374
370− frame = (struct rt_sigframe __user *)
371− round_down(stack_top - sizeof(struct rt_sigframe), 16);
375+ frame = (void __user *)stack_top - sizeof(struct rt_sigframe);
372376
373377 /* Add required space for math frame */
374− frame = (struct rt_sigframe __user *)((unsigned long)frame - math_size);
378+ frame = (void __user *)((unsigned long)frame - math_size);
379+
380+ /* ABI requires 16 byte boundary alignment */
381+ frame = (void __user *)round_down((unsigned long)frame, 16);
375382
376383 /* Subtract 128 for a red zone and 8 for proper alignment */
377384 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
arch/x86/virt/svm/sev.c+7−16
@@ -505,19 +505,19 @@ static bool __init setup_rmptable(void) · 504 unmodified lines
505505 * described in the SNP_INIT_EX firmware command description in the SNP
506506 * firmware ABI spec.
507507 */
508−static int __init snp_rmptable_init(void)
508+int __init snp_rmptable_init(void)
509509 {
510510 unsigned int i;
511511 u64 val;
512512
513− if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
514− return 0;
513+ if (WARN_ON_ONCE(!cc_platform_has(CC_ATTR_HOST_SEV_SNP)))
514+ return -ENOSYS;
515515
516− if (!amd_iommu_snp_en)
517− goto nosnp;
516+ if (WARN_ON_ONCE(!amd_iommu_snp_en))
517+ return -ENOSYS;
518518
519519 if (!setup_rmptable())
520− goto nosnp;
520+ return -ENOSYS;
521521
522522 /*
523523 * Check if SEV-SNP is already enabled, this can happen in case of
@@ -530,7 +530,7 @@ static int __init snp_rmptable_init(void) · 6 unmodified lines
530530 /* Zero out the RMP bookkeeping area */
531531 if (!clear_rmptable_bookkeeping()) {
532532 free_rmp_segment_table();
533− goto nosnp;
533+ return -ENOSYS;
534534 }
535535
536536 /* Zero out the RMP entries */
@@ -562,17 +562,8 @@ skip_enable: · 25 unmodified lines
562562 crash_kexec_post_notifiers = true;
563563
564564 return 0;
565−
566−nosnp:
567− cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
568− return -ENOSYS;
569565 }
570566
571−/*
572− * This must be called after the IOMMU has been initialized.
573− */
574−device_initcall(snp_rmptable_init);
575−
576567 static void set_rmp_segment_info(unsigned int segment_shift)
577568 {
578569 rmp_segment_shift = segment_shift;
arch/x86/xen/mmu_pv.c+62−9
@@ -111,6 +111,51 @@ static pud_t level3_user_vsyscall[PTRS_PER_PUD] __page_aligned_bss; · 110 unmodified lines
111111 */
112112 static DEFINE_SPINLOCK(xen_reservation_lock);
113113
114+/* Protected by xen_reservation_lock. */
115+#define MIN_CONTIG_ORDER 9 /* 2MB */
116+static unsigned int discontig_frames_order = MIN_CONTIG_ORDER;
117+static unsigned long discontig_frames_early[1UL << MIN_CONTIG_ORDER] __initdata;
118+static unsigned long *discontig_frames __refdata = discontig_frames_early;
119+static bool discontig_frames_dyn;
120+
121+static int alloc_discontig_frames(unsigned int order)
122+{
123+ unsigned long *new_array, *old_array;
124+ unsigned int old_order;
125+ unsigned long flags;
126+
127+ BUG_ON(order < MIN_CONTIG_ORDER);
128+ BUILD_BUG_ON(sizeof(discontig_frames_early) != PAGE_SIZE);
129+
130+ new_array = (unsigned long *)__get_free_pages(GFP_KERNEL,
131+ order - MIN_CONTIG_ORDER);
132+ if (!new_array)
133+ return -ENOMEM;
134+
135+ spin_lock_irqsave(&xen_reservation_lock, flags);
136+
137+ old_order = discontig_frames_order;
138+
139+ if (order > discontig_frames_order || !discontig_frames_dyn) {
140+ if (!discontig_frames_dyn)
141+ old_array = NULL;
142+ else
143+ old_array = discontig_frames;
144+
145+ discontig_frames = new_array;
146+ discontig_frames_order = order;
147+ discontig_frames_dyn = true;
148+ } else {
149+ old_array = new_array;
150+ }
151+
152+ spin_unlock_irqrestore(&xen_reservation_lock, flags);
153+
154+ free_pages((unsigned long)old_array, old_order - MIN_CONTIG_ORDER);
155+
156+ return 0;
157+}
158+
114159 /*
115160 * Note about cr3 (pagetable base) values:
116161 *
@@ -814,6 +859,9 @@ static void __init xen_after_bootmem(void) · 697 unmodified lines
814859 SetPagePinned(virt_to_page(level3_user_vsyscall));
815860 #endif
816861 xen_pgd_walk(&init_mm, xen_mark_pinned, FIXADDR_TOP);
862+
863+ if (alloc_discontig_frames(MIN_CONTIG_ORDER))
864+ BUG();
817865 }
818866
819867 static void xen_unpin_page(struct mm_struct *mm, struct page *page,
@@ -2203,10 +2251,6 @@ void __init xen_init_mmu_ops(void) · 1383 unmodified lines
22032251 memset(dummy_mapping, 0xff, PAGE_SIZE);
22042252 }
22052253
2206−/* Protected by xen_reservation_lock. */
2207−#define MAX_CONTIG_ORDER 9 /* 2MB */
2208−static unsigned long discontig_frames[1<<MAX_CONTIG_ORDER];
2209−
22102254 #define VOID_PTE (mfn_pte(0, __pgprot(0)))
22112255 static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order,
22122256 unsigned long *in_frames,
@@ -2323,18 +2367,25 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, · 110 unmodified lines
23232367 unsigned int address_bits,
23242368 dma_addr_t *dma_handle)
23252369 {
2326− unsigned long *in_frames = discontig_frames, out_frame;
2370+ unsigned long *in_frames, out_frame;
23272371 unsigned long flags;
23282372 int success;
23292373 unsigned long vstart = (unsigned long)phys_to_virt(pstart);
23302374
2331− if (unlikely(order > MAX_CONTIG_ORDER))
2332− return -ENOMEM;
2375+ if (unlikely(order > discontig_frames_order)) {
2376+ if (!discontig_frames_dyn)
2377+ return -ENOMEM;
2378+
2379+ if (alloc_discontig_frames(order))
2380+ return -ENOMEM;
2381+ }
23332382
23342383 memset((void *) vstart, 0, PAGE_SIZE << order);
23352384
23362385 spin_lock_irqsave(&xen_reservation_lock, flags);
23372386
2387+ in_frames = discontig_frames;
2388+
23382389 /* 1. Zap current PTEs, remembering MFNs. */
23392390 xen_zap_pfn_range(vstart, order, in_frames, NULL);
23402391
@@ -2358,12 +2409,12 @@ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, · 17 unmodified lines
23582409
23592410 void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order)
23602411 {
2361− unsigned long *out_frames = discontig_frames, in_frame;
2412+ unsigned long *out_frames, in_frame;
23622413 unsigned long flags;
23632414 int success;
23642415 unsigned long vstart;
23652416
2366− if (unlikely(order > MAX_CONTIG_ORDER))
2417+ if (unlikely(order > discontig_frames_order))
23672418 return;
23682419
23692420 vstart = (unsigned long)phys_to_virt(pstart);
@@ -2371,6 +2422,8 @@ void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order) · 1 unmodified line
23712422
23722423 spin_lock_irqsave(&xen_reservation_lock, flags);
23732424
2425+ out_frames = discontig_frames;
2426+
23742427 /* 1. Find start MFN of contiguous extent. */
23752428 in_frame = virt_to_mfn((void *)vstart);
23762429
arch/x86/xen/xen-head.S+3−8
@@ -100,9 +100,6 @@ SYM_FUNC_START(xen_hypercall_hvm) · 99 unmodified lines
100100 push %r10
101101 push %r9
102102 push %r8
103−#ifdef CONFIG_FRAME_POINTER
104− pushq $0 /* Dummy push for stack alignment. */
105−#endif
106103 #endif
107104 /* Set the vendor specific function. */
108105 call __xen_hypercall_setfunc
@@ -117,11 +114,8 @@ SYM_FUNC_START(xen_hypercall_hvm) · 8 unmodified lines
117114 pop %ebx
118115 pop %eax
119116 #else
120− lea xen_hypercall_amd(%rip), %rbx
121− cmp %rax, %rbx
122−#ifdef CONFIG_FRAME_POINTER
123− pop %rax /* Dummy pop. */
124−#endif
117+ lea xen_hypercall_amd(%rip), %rcx
118+ cmp %rax, %rcx
125119 pop %r8
126120 pop %r9
127121 pop %r10
@@ -132,6 +126,7 @@ SYM_FUNC_START(xen_hypercall_hvm) · 4 unmodified lines
132126 pop %rcx
133127 pop %rax
134128 #endif
129+ FRAME_END
135130 /* Use correct hypercall function. */
136131 jz xen_hypercall_amd
137132 jmp xen_hypercall_intel
block/partitions/mac.c+15−3
@@ -53,13 +53,25 @@ int mac_partition(struct parsed_partitions *state) · 52 unmodified lines
5353 }
5454 secsize = be16_to_cpu(md->block_size);
5555 put_dev_sector(sect);
56+
57+ /*
58+ * If the "block size" is not a power of 2, things get weird - we might
59+ * end up with a partition straddling a sector boundary, so we wouldn't
60+ * be able to read a partition entry with read_part_sector().
61+ * Real block sizes are probably (?) powers of two, so just require
62+ * that.
63+ */
64+ if (!is_power_of_2(secsize))
65+ return -1;
5666 datasize = round_down(secsize, 512);
5767 data = read_part_sector(state, datasize / 512, &sect);
5868 if (!data)
5969 return -1;
6070 partoffset = secsize % 512;
61− if (partoffset + sizeof(*part) > datasize)
71+ if (partoffset + sizeof(*part) > datasize) {
72+ put_dev_sector(sect);
6273 return -1;
74+ }
6375 part = (struct mac_partition *) (data + partoffset);
6476 if (be16_to_cpu(part->signature) != MAC_PARTITION_MAGIC) {
6577 put_dev_sector(sect);
@@ -112,8 +124,8 @@ int mac_partition(struct parsed_partitions *state) · 46 unmodified lines
112124 int i, l;
113125
114126 goodness++;
115− l = strlen(part->name);
116− if (strcmp(part->name, "/") == 0)
127+ l = strnlen(part->name, sizeof(part->name));
128+ if (strncmp(part->name, "/", sizeof(part->name)) == 0)
117129 goodness++;
118130 for (i = 0; i <= l - 4; ++i) {
119131 if (strncasecmp(part->name + i, "root",
drivers/accel/amdxdna/amdxdna_pci_drv.c+5−0
@@ -21,6 +21,11 @@ · 20 unmodified lines
2121
2222 #define AMDXDNA_AUTOSUSPEND_DELAY 5000 /* milliseconds */
2323
24+MODULE_FIRMWARE("amdnpu/1502_00/npu.sbin");
25+MODULE_FIRMWARE("amdnpu/17f0_10/npu.sbin");
26+MODULE_FIRMWARE("amdnpu/17f0_11/npu.sbin");
27+MODULE_FIRMWARE("amdnpu/17f0_20/npu.sbin");
28+
2429 /*
2530 * Bind the driver base on (vendor_id, device_id) pair and later use the
2631 * (device_id, rev_id) pair as a key to select the devices. The devices with
drivers/accel/ivpu/ivpu_drv.c+6−2
@@ -397,15 +397,19 @@ int ivpu_boot(struct ivpu_device *vdev) · 396 unmodified lines
397397 if (ivpu_fw_is_cold_boot(vdev)) {
398398 ret = ivpu_pm_dct_init(vdev);
399399 if (ret)
400− goto err_diagnose_failure;
400+ goto err_disable_ipc;
401401
402402 ret = ivpu_hw_sched_init(vdev);
403403 if (ret)
404− goto err_diagnose_failure;
404+ goto err_disable_ipc;
405405 }
406406
407407 return 0;
408408
409+err_disable_ipc:
410+ ivpu_ipc_disable(vdev);
411+ ivpu_hw_irq_disable(vdev);
412+ disable_irq(vdev->irq);
409413 err_diagnose_failure:
410414 ivpu_hw_diagnose_failure(vdev);
411415 ivpu_mmu_evtq_dump(vdev);
drivers/accel/ivpu/ivpu_pm.c+47−37
@@ -115,41 +115,57 @@ err_power_down: · 114 unmodified lines
115115 return ret;
116116 }
117117
118−static void ivpu_pm_recovery_work(struct work_struct *work)
118+static void ivpu_pm_reset_begin(struct ivpu_device *vdev)
119119 {
120− struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);
121− struct ivpu_device *vdev = pm->vdev;
122− char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
123− int ret;
124−
125− ivpu_err(vdev, "Recovering the NPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter));
126−
127− ret = pm_runtime_resume_and_get(vdev->drm.dev);
128− if (ret)
129− ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
130−
131− ivpu_jsm_state_dump(vdev);
132− ivpu_dev_coredump(vdev);
120+ pm_runtime_disable(vdev->drm.dev);
133121
134122 atomic_inc(&vdev->pm->reset_counter);
135123 atomic_set(&vdev->pm->reset_pending, 1);
136124 down_write(&vdev->pm->reset_lock);
125+}
126+
127+static void ivpu_pm_reset_complete(struct ivpu_device *vdev)
128+{
129+ int ret;
137130
138− ivpu_suspend(vdev);
139131 ivpu_pm_prepare_cold_boot(vdev);
140132 ivpu_jobs_abort_all(vdev);
141133 ivpu_ms_cleanup_all(vdev);
142134
143135 ret = ivpu_resume(vdev);
144− if (ret)
136+ if (ret) {
145137 ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
138+ pm_runtime_set_suspended(vdev->drm.dev);
139+ } else {
140+ pm_runtime_set_active(vdev->drm.dev);
141+ }
146142
147143 up_write(&vdev->pm->reset_lock);
148144 atomic_set(&vdev->pm->reset_pending, 0);
149145
150− kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt);
151146 pm_runtime_mark_last_busy(vdev->drm.dev);
152− pm_runtime_put_autosuspend(vdev->drm.dev);
147+ pm_runtime_enable(vdev->drm.dev);
148+}
149+
150+static void ivpu_pm_recovery_work(struct work_struct *work)
151+{
152+ struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work);
153+ struct ivpu_device *vdev = pm->vdev;
154+ char *evt[2] = {"IVPU_PM_EVENT=IVPU_RECOVER", NULL};
155+
156+ ivpu_err(vdev, "Recovering the NPU (reset #%d)\n", atomic_read(&vdev->pm->reset_counter));
157+
158+ ivpu_pm_reset_begin(vdev);
159+
160+ if (!pm_runtime_status_suspended(vdev->drm.dev)) {
161+ ivpu_jsm_state_dump(vdev);
162+ ivpu_dev_coredump(vdev);
163+ ivpu_suspend(vdev);
164+ }
165+
166+ ivpu_pm_reset_complete(vdev);
167+
168+ kobject_uevent_env(&vdev->drm.dev->kobj, KOBJ_CHANGE, evt);
153169 }
154170
155171 void ivpu_pm_trigger_recovery(struct ivpu_device *vdev, const char *reason)
@@ -309,7 +325,10 @@ int ivpu_rpm_get(struct ivpu_device *vdev) · 153 unmodified lines
309325 int ret;
310326
311327 ret = pm_runtime_resume_and_get(vdev->drm.dev);
312− drm_WARN_ON(&vdev->drm, ret < 0);
328+ if (ret < 0) {
329+ ivpu_err(vdev, "Failed to resume NPU: %d\n", ret);
330+ pm_runtime_set_suspended(vdev->drm.dev);
331+ }
313332
314333 return ret;
315334 }
@@ -325,16 +344,13 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev) · 9 unmodified lines
325344 struct ivpu_device *vdev = pci_get_drvdata(pdev);
326345
327346 ivpu_dbg(vdev, PM, "Pre-reset..\n");
328− atomic_inc(&vdev->pm->reset_counter);
329− atomic_set(&vdev->pm->reset_pending, 1);
330347
331− pm_runtime_get_sync(vdev->drm.dev);
332− down_write(&vdev->pm->reset_lock);
333− ivpu_prepare_for_reset(vdev);
334− ivpu_hw_reset(vdev);
335− ivpu_pm_prepare_cold_boot(vdev);
336− ivpu_jobs_abort_all(vdev);
337− ivpu_ms_cleanup_all(vdev);
348+ ivpu_pm_reset_begin(vdev);
349+
350+ if (!pm_runtime_status_suspended(vdev->drm.dev)) {
351+ ivpu_prepare_for_reset(vdev);
352+ ivpu_hw_reset(vdev);
353+ }
338354
339355 ivpu_dbg(vdev, PM, "Pre-reset done.\n");
340356 }
@@ -342,18 +358,12 @@ void ivpu_pm_reset_prepare_cb(struct pci_dev *pdev) · 1 unmodified line
342358 void ivpu_pm_reset_done_cb(struct pci_dev *pdev)
343359 {
344360 struct ivpu_device *vdev = pci_get_drvdata(pdev);
345− int ret;
346361
347362 ivpu_dbg(vdev, PM, "Post-reset..\n");
348− ret = ivpu_resume(vdev);
349− if (ret)
350− ivpu_err(vdev, "Failed to set RESUME state: %d\n", ret);
351− up_write(&vdev->pm->reset_lock);
352− atomic_set(&vdev->pm->reset_pending, 0);
353− ivpu_dbg(vdev, PM, "Post-reset done.\n");
354363
355− pm_runtime_mark_last_busy(vdev->drm.dev);
356− pm_runtime_put_autosuspend(vdev->drm.dev);
364+ ivpu_pm_reset_complete(vdev);
365+
366+ ivpu_dbg(vdev, PM, "Post-reset done.\n");
357367 }
358368
359369 void ivpu_pm_init(struct ivpu_device *vdev)
drivers/acpi/arm64/gtdt.c+8−4
@@ -163,7 +163,7 @@ int __init acpi_gtdt_init(struct acpi_table_header *table, · 162 unmodified lines
163163 {
164164 void *platform_timer;
165165 struct acpi_table_gtdt *gtdt;
166− int cnt = 0;
166+ u32 cnt = 0;
167167
168168 gtdt = container_of(table, struct acpi_table_gtdt, header);
169169 acpi_gtdt_desc.gtdt = gtdt;
@@ -188,13 +188,17 @@ int __init acpi_gtdt_init(struct acpi_table_header *table, · 18 unmodified lines
188188 cnt++;
189189
190190 if (cnt != gtdt->platform_timer_count) {
191+ cnt = min(cnt, gtdt->platform_timer_count);
192+ pr_err(FW_BUG "limiting Platform Timer count to %d\n", cnt);
193+ }
194+
195+ if (!cnt) {
191196 acpi_gtdt_desc.platform_timer = NULL;
192− pr_err(FW_BUG "invalid timer data.\n");
193− return -EINVAL;
197+ return 0;
194198 }
195199
196200 if (platform_timer_count)
197− *platform_timer_count = gtdt->platform_timer_count;
201+ *platform_timer_count = cnt;
198202
199203 return 0;
200204 }
drivers/acpi/prmt.c+1−3
@@ -287,9 +287,7 @@ static acpi_status acpi_platformrt_space_handler(u32 function, · 286 unmodified lines
287287 if (!handler || !module)
288288 goto invalid_guid;
289289
290− if (!handler->handler_addr ||
291− !handler->static_data_buffer_addr ||
292− !handler->acpi_param_buffer_addr) {
290+ if (!handler->handler_addr) {
293291 buffer->prm_status = PRM_HANDLER_ERROR;
294292 return AE_OK;
295293 }
drivers/acpi/property.c+5−5
@@ -1187,8 +1187,6 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, · 1186 unmodified lines
11871187 }
11881188 break;
11891189 }
1190− if (nval == 0)
1191− return -EINVAL;
11921190
11931191 if (obj->type == ACPI_TYPE_BUFFER) {
11941192 if (proptype != DEV_PROP_U8)
@@ -1212,9 +1210,11 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, · 17 unmodified lines
12121210 ret = acpi_copy_property_array_uint(items, (u64 *)val, nval);
12131211 break;
12141212 case DEV_PROP_STRING:
1215− ret = acpi_copy_property_array_string(
1216− items, (char **)val,
1217− min_t(u32, nval, obj->package.count));
1213+ nval = min_t(u32, nval, obj->package.count);
1214+ if (nval == 0)
1215+ return -ENODATA;
1216+
1217+ ret = acpi_copy_property_array_string(items, (char **)val, nval);
12181218 break;
12191219 default:
12201220 ret = -EINVAL;
drivers/acpi/resource.c+6−0
@@ -563,6 +563,12 @@ static const struct dmi_system_id irq1_edge_low_force_override[] = { · 562 unmodified lines
563563 DMI_MATCH(DMI_BOARD_NAME, "RP-15"),
564564 },
565565 },
566+ {
567+ .matches = {
568+ DMI_MATCH(DMI_SYS_VENDOR, "Eluktronics Inc."),
569+ DMI_MATCH(DMI_BOARD_NAME, "MECH-17"),
570+ },
571+ },
566572 {
567573 /* TongFang GM6XGxX/TUXEDO Stellaris 16 Gen5 AMD */
568574 .matches = {
drivers/base/Makefile+1−1
@@ -6,7 +6,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ · 5 unmodified lines
66 cpu.o firmware.o init.o map.o devres.o \
77 attribute_container.o transport_class.o \
88 topology.o container.o property.o cacheinfo.o \
9− swnode.o
9+ swnode.o faux.o
1010 obj-$(CONFIG_AUXILIARY_BUS) += auxiliary.o
1111 obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
1212 obj-y += power/
drivers/base/base.h+1−0
@@ -137,6 +137,7 @@ int hypervisor_init(void); · 136 unmodified lines
137137 static inline int hypervisor_init(void) { return 0; }
138138 #endif
139139 int platform_bus_init(void);
140+int faux_bus_init(void);
140141 void cpu_dev_init(void);
141142 void container_dev_init(void);
142143 #ifdef CONFIG_AUXILIARY_BUS
drivers/base/faux.c+232−0
@@ -0,0 +1,232 @@
1+// SPDX-License-Identifier: GPL-2.0-only
2+/*
3+ * Copyright (c) 2025 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4+ * Copyright (c) 2025 The Linux Foundation
5+ *
6+ * A "simple" faux bus that allows devices to be created and added
7+ * automatically to it. This is to be used whenever you need to create a
8+ * device that is not associated with any "real" system resources, and do
9+ * not want to have to deal with a bus/driver binding logic. It is
10+ * intended to be very simple, with only a create and a destroy function
11+ * available.
12+ */
13+#include <linux/err.h>
14+#include <linux/init.h>
15+#include <linux/slab.h>
16+#include <linux/string.h>
17+#include <linux/container_of.h>
18+#include <linux/device/faux.h>
19+#include "base.h"
20+
21+/*
22+ * Internal wrapper structure so we can hold a pointer to the
23+ * faux_device_ops for this device.
24+ */
25+struct faux_object {
26+ struct faux_device faux_dev;
27+ const struct faux_device_ops *faux_ops;
28+};
29+#define to_faux_object(dev) container_of_const(dev, struct faux_object, faux_dev.dev)
30+
31+static struct device faux_bus_root = {
32+ .init_name = "faux",
33+};
34+
35+static int faux_match(struct device *dev, const struct device_driver *drv)
36+{
37+ /* Match always succeeds, we only have one driver */
38+ return 1;
39+}
40+
41+static int faux_probe(struct device *dev)
42+{
43+ struct faux_object *faux_obj = to_faux_object(dev);
44+ struct faux_device *faux_dev = &faux_obj->faux_dev;
45+ const struct faux_device_ops *faux_ops = faux_obj->faux_ops;
46+ int ret = 0;
47+
48+ if (faux_ops && faux_ops->probe)
49+ ret = faux_ops->probe(faux_dev);
50+
51+ return ret;
52+}
53+
54+static void faux_remove(struct device *dev)
55+{
56+ struct faux_object *faux_obj = to_faux_object(dev);
57+ struct faux_device *faux_dev = &faux_obj->faux_dev;
58+ const struct faux_device_ops *faux_ops = faux_obj->faux_ops;
59+
60+ if (faux_ops && faux_ops->remove)
61+ faux_ops->remove(faux_dev);
62+}
63+
64+static const struct bus_type faux_bus_type = {
65+ .name = "faux",
66+ .match = faux_match,
67+ .probe = faux_probe,
68+ .remove = faux_remove,
69+};
70+
71+static struct device_driver faux_driver = {
72+ .name = "faux_driver",
73+ .bus = &faux_bus_type,
74+ .probe_type = PROBE_FORCE_SYNCHRONOUS,
75+};
76+
77+static void faux_device_release(struct device *dev)
78+{
79+ struct faux_object *faux_obj = to_faux_object(dev);
80+
81+ kfree(faux_obj);
82+}
83+
84+/**
85+ * faux_device_create_with_groups - Create and register with the driver
86+ * core a faux device and populate the device with an initial
87+ * set of sysfs attributes.
88+ * @name: The name of the device we are adding, must be unique for
89+ * all faux devices.
90+ * @parent: Pointer to a potential parent struct device. If set to
91+ * NULL, the device will be created in the "root" of the faux
92+ * device tree in sysfs.
93+ * @faux_ops: struct faux_device_ops that the new device will call back
94+ * into, can be NULL.
95+ * @groups: The set of sysfs attributes that will be created for this
96+ * device when it is registered with the driver core.
97+ *
98+ * Create a new faux device and register it in the driver core properly.
99+ * If present, callbacks in @faux_ops will be called with the device that
100+ * for the caller to do something with at the proper time given the
101+ * device's lifecycle.
102+ *
103+ * Note, when this function is called, the functions specified in struct
104+ * faux_ops can be called before the function returns, so be prepared for
105+ * everything to be properly initialized before that point in time.
106+ *
107+ * Return:
108+ * * NULL if an error happened with creating the device
109+ * * pointer to a valid struct faux_device that is registered with sysfs
110+ */
111+struct faux_device *faux_device_create_with_groups(const char *name,
112+ struct device *parent,
113+ const struct faux_device_ops *faux_ops,
114+ const struct attribute_group **groups)
115+{
116+ struct faux_object *faux_obj;
117+ struct faux_device *faux_dev;
118+ struct device *dev;
119+ int ret;
120+
121+ faux_obj = kzalloc(sizeof(*faux_obj), GFP_KERNEL);
122+ if (!faux_obj)
123+ return NULL;
124+
125+ /* Save off the callbacks so we can use them in the future */
126+ faux_obj->faux_ops = faux_ops;
127+
128+ /* Initialize the device portion and register it with the driver core */
129+ faux_dev = &faux_obj->faux_dev;
130+ dev = &faux_dev->dev;
131+
132+ device_initialize(dev);
133+ dev->release = faux_device_release;
134+ if (parent)
135+ dev->parent = parent;
136+ else
137+ dev->parent = &faux_bus_root;
138+ dev->bus = &faux_bus_type;
139+ dev->groups = groups;
140+ dev_set_name(dev, "%s", name);
141+
142+ ret = device_add(dev);
143+ if (ret) {
144+ pr_err("%s: device_add for faux device '%s' failed with %d\n",
145+ __func__, name, ret);
146+ put_device(dev);
147+ return NULL;
148+ }
149+
150+ return faux_dev;
151+}
152+EXPORT_SYMBOL_GPL(faux_device_create_with_groups);
153+
154+/**
155+ * faux_device_create - create and register with the driver core a faux device
156+ * @name: The name of the device we are adding, must be unique for all
157+ * faux devices.
158+ * @parent: Pointer to a potential parent struct device. If set to
159+ * NULL, the device will be created in the "root" of the faux
160+ * device tree in sysfs.
161+ * @faux_ops: struct faux_device_ops that the new device will call back
162+ * into, can be NULL.
163+ *
164+ * Create a new faux device and register it in the driver core properly.
165+ * If present, callbacks in @faux_ops will be called with the device that
166+ * for the caller to do something with at the proper time given the
167+ * device's lifecycle.
168+ *
169+ * Note, when this function is called, the functions specified in struct
170+ * faux_ops can be called before the function returns, so be prepared for
171+ * everything to be properly initialized before that point in time.
172+ *
173+ * Return:
174+ * * NULL if an error happened with creating the device
175+ * * pointer to a valid struct faux_device that is registered with sysfs
176+ */
177+struct faux_device *faux_device_create(const char *name,
178+ struct device *parent,
179+ const struct faux_device_ops *faux_ops)
180+{
181+ return faux_device_create_with_groups(name, parent, faux_ops, NULL);
182+}
183+EXPORT_SYMBOL_GPL(faux_device_create);
184+
185+/**
186+ * faux_device_destroy - destroy a faux device
187+ * @faux_dev: faux device to destroy
188+ *
189+ * Unregisters and cleans up a device that was created with a call to
190+ * faux_device_create()
191+ */
192+void faux_device_destroy(struct faux_device *faux_dev)
193+{
194+ struct device *dev = &faux_dev->dev;
195+
196+ if (!faux_dev)
197+ return;
198+
199+ device_del(dev);
200+
201+ /* The final put_device() will clean up the memory we allocated for this device. */
202+ put_device(dev);
203+}
204+EXPORT_SYMBOL_GPL(faux_device_destroy);
205+
206+int __init faux_bus_init(void)
207+{
208+ int ret;
209+
210+ ret = device_register(&faux_bus_root);
211+ if (ret) {
212+ put_device(&faux_bus_root);
213+ return ret;
214+ }
215+
216+ ret = bus_register(&faux_bus_type);
217+ if (ret)
218+ goto error_bus;
219+
220+ ret = driver_register(&faux_driver);
221+ if (ret)
222+ goto error_driver;
223+
224+ return ret;
225+
226+error_driver:
227+ bus_unregister(&faux_bus_type);
228+
229+error_bus:
230+ device_unregister(&faux_bus_root);
231+ return ret;
232+}
drivers/base/init.c+1−0
@@ -32,6 +32,7 @@ void __init driver_init(void) · 31 unmodified lines
3232 /* These are also core pieces, but must come after the
3333 * core core pieces.
3434 */
35+ faux_bus_init();
3536 of_core_init();
3637 platform_bus_init();
3738 auxiliary_bus_init();
drivers/base/power/main.c+9−12
@@ -1191,24 +1191,18 @@ static pm_message_t resume_event(pm_message_t sleep_state) · 1190 unmodified lines
11911191 return PMSG_ON;
11921192 }
11931193
1194−static void dpm_superior_set_must_resume(struct device *dev, bool set_active)
1194+static void dpm_superior_set_must_resume(struct device *dev)
11951195 {
11961196 struct device_link *link;
11971197 int idx;
11981198
1199− if (dev->parent) {
1199+ if (dev->parent)
12001200 dev->parent->power.must_resume = true;
1201− if (set_active)
1202− dev->parent->power.set_active = true;
1203− }
12041201
12051202 idx = device_links_read_lock();
12061203
1207− list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) {
1204+ list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node)
12081205 link->supplier->power.must_resume = true;
1209− if (set_active)
1210− link->supplier->power.set_active = true;
1211− }
12121206
12131207 device_links_read_unlock(idx);
12141208 }
@@ -1287,9 +1281,12 @@ Skip: · 72 unmodified lines
12871281 dev->power.must_resume = true;
12881282
12891283 if (dev->power.must_resume) {
1290− dev->power.set_active = dev->power.set_active ||
1291− dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND);
1292− dpm_superior_set_must_resume(dev, dev->power.set_active);
1284+ if (dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) {
1285+ dev->power.set_active = true;
1286+ if (dev->parent && !dev->parent->power.ignore_children)
1287+ dev->parent->power.set_active = true;
1288+ }
1289+ dpm_superior_set_must_resume(dev);
12931290 }
12941291
12951292 Complete:
drivers/base/regmap/regmap-irq.c+2−0
@@ -906,6 +906,7 @@ err_alloc: · 905 unmodified lines
906906 kfree(d->wake_buf);
907907 kfree(d->mask_buf_def);
908908 kfree(d->mask_buf);
909+ kfree(d->main_status_buf);
909910 kfree(d->status_buf);
910911 kfree(d->status_reg_buf);
911912 if (d->config_buf) {
@@ -981,6 +982,7 @@ void regmap_del_irq_chip(int irq, struct regmap_irq_chip_data *d) · 69 unmodified lines
981982 kfree(d->wake_buf);
982983 kfree(d->mask_buf_def);
983984 kfree(d->mask_buf);
985+ kfree(d->main_status_buf);
984986 kfree(d->status_reg_buf);
985987 kfree(d->status_buf);
986988 if (d->config_buf) {
drivers/block/sunvdc.c+2−2
@@ -1127,8 +1127,8 @@ static void vdc_queue_drain(struct vdc_port *port) · 1126 unmodified lines
11271127
11281128 spin_lock_irq(&port->vio.lock);
11291129 port->drain = 0;
1130− blk_mq_unquiesce_queue(q, memflags);
1131− blk_mq_unfreeze_queue(q);
1130+ blk_mq_unquiesce_queue(q);
1131+ blk_mq_unfreeze_queue(q, memflags);
11321132 }
11331133
11341134 static void vdc_ldc_reset_timer_work(struct work_struct *work)
drivers/bluetooth/btintel_pcie.c+4−1
@@ -1320,6 +1320,10 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev, · 1319 unmodified lines
13201320 if (opcode == 0xfc01)
13211321 btintel_pcie_inject_cmd_complete(hdev, opcode);
13221322 }
1323+ /* Firmware raises alive interrupt on HCI_OP_RESET */
1324+ if (opcode == HCI_OP_RESET)
1325+ data->gp0_received = false;
1326+
13231327 hdev->stat.cmd_tx++;
13241328 break;
13251329 case HCI_ACLDATA_PKT:
@@ -1357,7 +1361,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev, · 31 unmodified lines
13571361 opcode, btintel_pcie_alivectxt_state2str(old_ctxt),
13581362 btintel_pcie_alivectxt_state2str(data->alive_intr_ctxt));
13591363 if (opcode == HCI_OP_RESET) {
1360− data->gp0_received = false;
13611364 ret = wait_event_timeout(data->gp0_wait_q,
13621365 data->gp0_received,
13631366 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
drivers/bus/moxtet.c+1−1
@@ -657,7 +657,7 @@ static void moxtet_irq_print_chip(struct irq_data *d, struct seq_file *p) · 656 unmodified lines
657657
658658 id = moxtet->modules[pos->idx];
659659
660− seq_printf(p, " moxtet-%s.%i#%i", mox_module_name(id), pos->idx,
660+ seq_printf(p, "moxtet-%s.%i#%i", mox_module_name(id), pos->idx,
661661 pos->bit);
662662 }
663663
drivers/cpufreq/Kconfig.arm+2−1
@@ -17,7 +17,8 @@ config ARM_ALLWINNER_SUN50I_CPUFREQ_NVMEM · 16 unmodified lines
1717
1818 config ARM_AIROHA_SOC_CPUFREQ
1919 tristate "Airoha EN7581 SoC CPUFreq support"
20− depends on (ARCH_AIROHA && OF) || COMPILE_TEST
20+ depends on ARCH_AIROHA || COMPILE_TEST
21+ depends on OF
2122 select PM_OPP
2223 default ARCH_AIROHA
2324 help
drivers/cpufreq/amd-pstate.c+10−10
@@ -699,7 +699,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu, · 698 unmodified lines
699699 if (min_perf < lowest_nonlinear_perf)
700700 min_perf = lowest_nonlinear_perf;
701701
702− max_perf = cap_perf;
702+ max_perf = cpudata->max_limit_perf;
703703 if (max_perf < min_perf)
704704 max_perf = min_perf;
705705
@@ -747,7 +747,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state) · 41 unmodified lines
747747 guard(mutex)(&amd_pstate_driver_lock);
748748
749749 ret = amd_pstate_cpu_boost_update(policy, state);
750− policy->boost_enabled = !ret ? state : false;
751750 refresh_frequency_limits(policy);
752751
753752 return ret;
@@ -822,25 +821,28 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata) · 68 unmodified lines
822821
823822 static void amd_pstate_update_limits(unsigned int cpu)
824823 {
825− struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
824+ struct cpufreq_policy *policy = NULL;
826825 struct amd_cpudata *cpudata;
827826 u32 prev_high = 0, cur_high = 0;
828827 int ret;
829828 bool highest_perf_changed = false;
830829
830+ if (!amd_pstate_prefcore)
831+ return;
832+
833+ policy = cpufreq_cpu_get(cpu);
831834 if (!policy)
832835 return;
833836
834837 cpudata = policy->driver_data;
835838
836− if (!amd_pstate_prefcore)
837− return;
838−
839839 guard(mutex)(&amd_pstate_driver_lock);
840840
841841 ret = amd_get_highest_perf(cpu, &cur_high);
842− if (ret)
843− goto free_cpufreq_put;
842+ if (ret) {
843+ cpufreq_cpu_put(policy);
844+ return;
845+ }
844846
845847 prev_high = READ_ONCE(cpudata->prefcore_ranking);
846848 highest_perf_changed = (prev_high != cur_high);
@@ -850,8 +852,6 @@ static void amd_pstate_update_limits(unsigned int cpu) · 3 unmodified lines
850852 if (cur_high < CPPC_MAX_PERF)
851853 sched_set_itmt_core_prio((int)cur_high, cpu);
852854 }
853−
854−free_cpufreq_put:
855855 cpufreq_cpu_put(policy);
856856
857857 if (!highest_perf_changed)
drivers/cpufreq/cpufreq.c+2−1
@@ -1571,7 +1571,8 @@ static int cpufreq_online(unsigned int cpu) · 1570 unmodified lines
15711571 policy->cdev = of_cpufreq_cooling_register(policy);
15721572
15731573 /* Let the per-policy boost flag mirror the cpufreq_driver boost during init */
1574− if (policy->boost_enabled != cpufreq_boost_enabled()) {
1574+ if (cpufreq_driver->set_boost &&
1575+ policy->boost_enabled != cpufreq_boost_enabled()) {
15751576 policy->boost_enabled = cpufreq_boost_enabled();
15761577 ret = cpufreq_driver->set_boost(policy, policy->boost_enabled);
15771578 if (ret) {
drivers/crypto/ccp/sp-dev.c+14−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/types.h>
2020 #include <linux/ccp.h>
2121
22+#include "sev-dev.h"
2223 #include "ccp-dev.h"
2324 #include "sp-dev.h"
2425
@@ -253,8 +254,12 @@ unlock: · 228 unmodified lines
253254 static int __init sp_mod_init(void)
254255 {
255256 #ifdef CONFIG_X86
257+ static bool initialized;
256258 int ret;
257259
260+ if (initialized)
261+ return 0;
262+
258263 ret = sp_pci_init();
259264 if (ret)
260265 return ret;
@@ -263,6 +268,8 @@ static int __init sp_mod_init(void) · 2 unmodified lines
263268 psp_pci_init();
264269 #endif
265270
271+ initialized = true;
272+
266273 return 0;
267274 #endif
268275
@@ -279,6 +286,13 @@ static int __init sp_mod_init(void) · 10 unmodified lines
279286 return -ENODEV;
280287 }
281288
289+#if IS_BUILTIN(CONFIG_KVM_AMD) && IS_ENABLED(CONFIG_KVM_AMD_SEV)
290+int __init sev_module_init(void)
291+{
292+ return sp_mod_init();
293+}
294+#endif
295+
282296 static void __exit sp_mod_exit(void)
283297 {
284298 #ifdef CONFIG_X86
drivers/dma/tegra210-adma.c+14−3
@@ -887,7 +887,7 @@ static int tegra_adma_probe(struct platform_device *pdev) · 886 unmodified lines
887887 const struct tegra_adma_chip_data *cdata;
888888 struct tegra_adma *tdma;
889889 struct resource *res_page, *res_base;
890− int ret, i, page_no;
890+ int ret, i;
891891
892892 cdata = of_device_get_match_data(&pdev->dev);
893893 if (!cdata) {
@@ -914,9 +914,20 @@ static int tegra_adma_probe(struct platform_device *pdev) · 20 unmodified lines
914914
915915 res_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "global");
916916 if (res_base) {
917− page_no = (res_page->start - res_base->start) / cdata->ch_base_offset;
918− if (page_no <= 0)
917+ resource_size_t page_offset, page_no;
918+ unsigned int ch_base_offset;
919+
920+ if (res_page->start < res_base->start)
921+ return -EINVAL;
922+ page_offset = res_page->start - res_base->start;
923+ ch_base_offset = cdata->ch_base_offset;
924+ if (!ch_base_offset)
919925 return -EINVAL;
926+
927+ page_no = div_u64(page_offset, ch_base_offset);
928+ if (!page_no || page_no > INT_MAX)
929+ return -EINVAL;
930+
920931 tdma->ch_page_no = page_no - 1;
921932 tdma->base_addr = devm_ioremap_resource(&pdev->dev, res_base);
922933 if (IS_ERR(tdma->base_addr))
drivers/firmware/Kconfig+1−1
@@ -106,7 +106,7 @@ config ISCSI_IBFT · 105 unmodified lines
106106 select ISCSI_BOOT_SYSFS
107107 select ISCSI_IBFT_FIND if X86
108108 depends on ACPI && SCSI && SCSI_LOWLEVEL
109− default n
109+ default n
110110 help
111111 This option enables support for detection and exposing of iSCSI
112112 Boot Firmware Table (iBFT) via sysfs to userspace. If you wish to
drivers/firmware/efi/efi.c+4−2
@@ -934,13 +934,15 @@ char * __init efi_md_typeattr_format(char *buf, size_t size, · 933 unmodified lines
934934 EFI_MEMORY_WB | EFI_MEMORY_UCE | EFI_MEMORY_RO |
935935 EFI_MEMORY_WP | EFI_MEMORY_RP | EFI_MEMORY_XP |
936936 EFI_MEMORY_NV | EFI_MEMORY_SP | EFI_MEMORY_CPU_CRYPTO |
937− EFI_MEMORY_RUNTIME | EFI_MEMORY_MORE_RELIABLE))
937+ EFI_MEMORY_MORE_RELIABLE | EFI_MEMORY_HOT_PLUGGABLE |
938+ EFI_MEMORY_RUNTIME))
938939 snprintf(pos, size, "|attr=0x%016llx]",
939940 (unsigned long long)attr);
940941 else
941942 snprintf(pos, size,
942− "|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
943+ "|%3s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%2s|%3s|%2s|%2s|%2s|%2s]",
943944 attr & EFI_MEMORY_RUNTIME ? "RUN" : "",
945+ attr & EFI_MEMORY_HOT_PLUGGABLE ? "HP" : "",
944946 attr & EFI_MEMORY_MORE_RELIABLE ? "MR" : "",
945947 attr & EFI_MEMORY_CPU_CRYPTO ? "CC" : "",
946948 attr & EFI_MEMORY_SP ? "SP" : "",
drivers/firmware/efi/libstub/randomalloc.c+3−0
@@ -25,6 +25,9 @@ static unsigned long get_entry_num_slots(efi_memory_desc_t *md, · 24 unmodified lines
2525 if (md->type != EFI_CONVENTIONAL_MEMORY)
2626 return 0;
2727
28+ if (md->attribute & EFI_MEMORY_HOT_PLUGGABLE)
29+ return 0;
30+
2831 if (efi_soft_reserve_enabled() &&
2932 (md->attribute & EFI_MEMORY_SP))
3033 return 0;
drivers/firmware/efi/libstub/relocate.c+3−0
@@ -53,6 +53,9 @@ efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align, · 52 unmodified lines
5353 if (desc->type != EFI_CONVENTIONAL_MEMORY)
5454 continue;
5555
56+ if (desc->attribute & EFI_MEMORY_HOT_PLUGGABLE)
57+ continue;
58+
5659 if (efi_soft_reserve_enabled() &&
5760 (desc->attribute & EFI_MEMORY_SP))
5861 continue;
drivers/firmware/iscsi_ibft.c+4−1
@@ -310,7 +310,10 @@ static ssize_t ibft_attr_show_nic(void *data, int type, char *buf) · 309 unmodified lines
310310 str += sprintf_ipaddr(str, nic->ip_addr);
311311 break;
312312 case ISCSI_BOOT_ETH_SUBNET_MASK:
313− val = cpu_to_be32(~((1 << (32-nic->subnet_mask_prefix))-1));
313+ if (nic->subnet_mask_prefix > 32)
314+ val = cpu_to_be32(~0);
315+ else
316+ val = cpu_to_be32(~((1 << (32-nic->subnet_mask_prefix))-1));
314317 str += sprintf(str, "%pI4", &val);
315318 break;
316319 case ISCSI_BOOT_ETH_PREFIX_LEN:
drivers/gpio/Kconfig+1−0
@@ -338,6 +338,7 @@ config GPIO_GRANITERAPIDS · 337 unmodified lines
338338
339339 config GPIO_GRGPIO
340340 tristate "Aeroflex Gaisler GRGPIO support"
341+ depends on OF || COMPILE_TEST
341342 select GPIO_GENERIC
342343 select IRQ_DOMAIN
343344 help
drivers/gpio/gpio-bcm-kona.c+58−13
@@ -69,6 +69,22 @@ struct bcm_kona_gpio { · 68 unmodified lines
6969 struct bcm_kona_gpio_bank {
7070 int id;
7171 int irq;
72+ /*
73+ * Used to keep track of lock/unlock operations for each GPIO in the
74+ * bank.
75+ *
76+ * All GPIOs are locked by default (see bcm_kona_gpio_reset), and the
77+ * unlock count for all GPIOs is 0 by default. Each unlock increments
78+ * the counter, and each lock decrements the counter.
79+ *
80+ * The lock function only locks the GPIO once its unlock counter is
81+ * down to 0. This is necessary because the GPIO is unlocked in two
82+ * places in this driver: once for requested GPIOs, and once for
83+ * requested IRQs. Since it is possible for a GPIO to be requested
84+ * as both a GPIO and an IRQ, we need to ensure that we don't lock it
85+ * too early.
86+ */
87+ u8 gpio_unlock_count[GPIO_PER_BANK];
7288 /* Used in the interrupt handler */
7389 struct bcm_kona_gpio *kona_gpio;
7490 };
@@ -86,14 +102,24 @@ static void bcm_kona_gpio_lock_gpio(struct bcm_kona_gpio *kona_gpio, · 11 unmodified lines
86102 u32 val;
87103 unsigned long flags;
88104 int bank_id = GPIO_BANK(gpio);
105+ int bit = GPIO_BIT(gpio);
106+ struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id];
89107
90− raw_spin_lock_irqsave(&kona_gpio->lock, flags);
108+ if (bank->gpio_unlock_count[bit] == 0) {
109+ dev_err(kona_gpio->gpio_chip.parent,
110+ "Unbalanced locks for GPIO %u\n", gpio);
111+ return;
112+ }
91113
92− val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
93− val |= BIT(gpio);
94− bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);
114+ if (--bank->gpio_unlock_count[bit] == 0) {
115+ raw_spin_lock_irqsave(&kona_gpio->lock, flags);
95116
96− raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);
117+ val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
118+ val |= BIT(bit);
119+ bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);
120+
121+ raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);
122+ }
97123 }
98124
99125 static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio,
@@ -102,14 +128,20 @@ static void bcm_kona_gpio_unlock_gpio(struct bcm_kona_gpio *kona_gpio, · 2 unmodified lines
102128 u32 val;
103129 unsigned long flags;
104130 int bank_id = GPIO_BANK(gpio);
131+ int bit = GPIO_BIT(gpio);
132+ struct bcm_kona_gpio_bank *bank = &kona_gpio->banks[bank_id];
105133
106− raw_spin_lock_irqsave(&kona_gpio->lock, flags);
134+ if (bank->gpio_unlock_count[bit] == 0) {
135+ raw_spin_lock_irqsave(&kona_gpio->lock, flags);
107136
108− val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
109− val &= ~BIT(gpio);
110− bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);
137+ val = readl(kona_gpio->reg_base + GPIO_PWD_STATUS(bank_id));
138+ val &= ~BIT(bit);
139+ bcm_kona_gpio_write_lock_regs(kona_gpio->reg_base, bank_id, val);
111140
112− raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);
141+ raw_spin_unlock_irqrestore(&kona_gpio->lock, flags);
142+ }
143+
144+ ++bank->gpio_unlock_count[bit];
113145 }
114146
115147 static int bcm_kona_gpio_get_dir(struct gpio_chip *chip, unsigned gpio)
@@ -360,6 +392,7 @@ static void bcm_kona_gpio_irq_mask(struct irq_data *d) · 244 unmodified lines
360392
361393 kona_gpio = irq_data_get_irq_chip_data(d);
362394 reg_base = kona_gpio->reg_base;
395+
363396 raw_spin_lock_irqsave(&kona_gpio->lock, flags);
364397
365398 val = readl(reg_base + GPIO_INT_MASK(bank_id));
@@ -382,6 +415,7 @@ static void bcm_kona_gpio_irq_unmask(struct irq_data *d) · 16 unmodified lines
382415
383416 kona_gpio = irq_data_get_irq_chip_data(d);
384417 reg_base = kona_gpio->reg_base;
418+
385419 raw_spin_lock_irqsave(&kona_gpio->lock, flags);
386420
387421 val = readl(reg_base + GPIO_INT_MSKCLR(bank_id));
@@ -477,15 +511,26 @@ static void bcm_kona_gpio_irq_handler(struct irq_desc *desc) · 89 unmodified lines
477511 static int bcm_kona_gpio_irq_reqres(struct irq_data *d)
478512 {
479513 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);
514+ unsigned int gpio = d->hwirq;
480515
481− return gpiochip_reqres_irq(&kona_gpio->gpio_chip, d->hwirq);
516+ /*
517+ * We need to unlock the GPIO before any other operations are performed
518+ * on the relevant GPIO configuration registers
519+ */
520+ bcm_kona_gpio_unlock_gpio(kona_gpio, gpio);
521+
522+ return gpiochip_reqres_irq(&kona_gpio->gpio_chip, gpio);
482523 }
483524
484525 static void bcm_kona_gpio_irq_relres(struct irq_data *d)
485526 {
486527 struct bcm_kona_gpio *kona_gpio = irq_data_get_irq_chip_data(d);
528+ unsigned int gpio = d->hwirq;
529+
530+ /* Once we no longer use it, lock the GPIO again */
531+ bcm_kona_gpio_lock_gpio(kona_gpio, gpio);
487532
488− gpiochip_relres_irq(&kona_gpio->gpio_chip, d->hwirq);
533+ gpiochip_relres_irq(&kona_gpio->gpio_chip, gpio);
489534 }
490535
491536 static struct irq_chip bcm_gpio_irq_chip = {
@@ -614,7 +659,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev) · 122 unmodified lines
614659 bank->irq = platform_get_irq(pdev, i);
615660 bank->kona_gpio = kona_gpio;
616661 if (bank->irq < 0) {
617− dev_err(dev, "Couldn't get IRQ for bank %d", i);
662+ dev_err(dev, "Couldn't get IRQ for bank %d\n", i);
618663 ret = -ENOENT;
619664 goto err_irq_domain;
620665 }
drivers/gpio/gpio-pca953x.c+0−19
@@ -841,25 +841,6 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendin · 840 unmodified lines
841841 DECLARE_BITMAP(trigger, MAX_LINE);
842842 int ret;
843843
844− if (chip->driver_data & PCA_PCAL) {
845− /* Read the current interrupt status from the device */
846− ret = pca953x_read_regs(chip, PCAL953X_INT_STAT, trigger);
847− if (ret)
848− return false;
849−
850− /* Check latched inputs and clear interrupt status */
851− ret = pca953x_read_regs(chip, chip->regs->input, cur_stat);
852− if (ret)
853− return false;
854−
855− /* Apply filter for rising/falling edge selection */
856− bitmap_replace(new_stat, chip->irq_trig_fall, chip->irq_trig_raise, cur_stat, gc->ngpio);
857−
858− bitmap_and(pending, new_stat, trigger, gc->ngpio);
859−
860− return !bitmap_empty(pending, gc->ngpio);
861− }
862−
863844 ret = pca953x_read_regs(chip, chip->regs->input, cur_stat);
864845 if (ret)
865846 return false;
drivers/gpio/gpio-sim.c+8−5
@@ -1028,20 +1028,23 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock) · 1027 unmodified lines
10281028 struct configfs_subsystem *subsys = dev->group.cg_subsys;
10291029 struct gpio_sim_bank *bank;
10301030 struct gpio_sim_line *line;
1031+ struct config_item *item;
10311032
10321033 /*
1033− * The device only needs to depend on leaf line entries. This is
1034+ * The device only needs to depend on leaf entries. This is
10341035 * sufficient to lock up all the configfs entries that the
10351036 * instantiated, alive device depends on.
10361037 */
10371038 list_for_each_entry(bank, &dev->bank_list, siblings) {
10381039 list_for_each_entry(line, &bank->line_list, siblings) {
1040+ item = line->hog ? &line->hog->item
1041+ : &line->group.cg_item;
1042+
10391043 if (lock)
1040− WARN_ON(configfs_depend_item_unlocked(
1041− subsys, &line->group.cg_item));
1044+ WARN_ON(configfs_depend_item_unlocked(subsys,
1045+ item));
10421046 else
1043− configfs_undepend_item_unlocked(
1044− &line->group.cg_item);
1047+ configfs_undepend_item_unlocked(item);
10451048 }
10461049 }
10471050 }
drivers/gpio/gpio-stmpe.c+12−3
@@ -191,7 +191,7 @@ static void stmpe_gpio_irq_sync_unlock(struct irq_data *d) · 190 unmodified lines
191191 [REG_IE][CSB] = STMPE_IDX_IEGPIOR_CSB,
192192 [REG_IE][MSB] = STMPE_IDX_IEGPIOR_MSB,
193193 };
194− int i, j;
194+ int ret, i, j;
195195
196196 /*
197197 * STMPE1600: to be able to get IRQ from pins,
@@ -199,8 +199,16 @@ static void stmpe_gpio_irq_sync_unlock(struct irq_data *d) · 1 unmodified line
199199 * GPSR or GPCR registers
200200 */
201201 if (stmpe->partnum == STMPE1600) {
202− stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]);
203− stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]);
202+ ret = stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_LSB]);
203+ if (ret < 0) {
204+ dev_err(stmpe->dev, "Failed to read GPMR_LSB: %d\n", ret);
205+ goto err;
206+ }
207+ ret = stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_GPMR_CSB]);
208+ if (ret < 0) {
209+ dev_err(stmpe->dev, "Failed to read GPMR_CSB: %d\n", ret);
210+ goto err;
211+ }
204212 }
205213
206214 for (i = 0; i < CACHE_NR_REGS; i++) {
@@ -222,6 +230,7 @@ static void stmpe_gpio_irq_sync_unlock(struct irq_data *d) · 15 unmodified lines
222230 }
223231 }
224232
233+err:
225234 mutex_unlock(&stmpe_gpio->irq_lock);
226235 }
227236
drivers/gpio/gpiolib-acpi.c+14−0
@@ -1689,6 +1689,20 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] __initconst = { · 1688 unmodified lines
16891689 .ignore_wake = "PNP0C50:00@8",
16901690 },
16911691 },
1692+ {
1693+ /*
1694+ * Spurious wakeups from GPIO 11
1695+ * Found in BIOS 1.04
1696+ * https://gitlab.freedesktop.org/drm/amd/-/issues/3954
1697+ */
1698+ .matches = {
1699+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
1700+ DMI_MATCH(DMI_PRODUCT_FAMILY, "Acer Nitro V 14"),
1701+ },
1702+ .driver_data = &(struct acpi_gpiolib_dmi_quirk) {
1703+ .ignore_interrupt = "AMDI0030:00@11",
1704+ },
1705+ },
16921706 {} /* Terminating entry */
16931707 };
16941708
drivers/gpio/gpiolib.c+3−3
@@ -904,13 +904,13 @@ int gpiochip_get_ngpios(struct gpio_chip *gc, struct device *dev) · 903 unmodified lines
904904 }
905905
906906 if (gc->ngpio == 0) {
907− chip_err(gc, "tried to insert a GPIO chip with zero lines\n");
907+ dev_err(dev, "tried to insert a GPIO chip with zero lines\n");
908908 return -EINVAL;
909909 }
910910
911911 if (gc->ngpio > FASTPATH_NGPIO)
912− chip_warn(gc, "line cnt %u is greater than fast path cnt %u\n",
913− gc->ngpio, FASTPATH_NGPIO);
912+ dev_warn(dev, "line cnt %u is greater than fast path cnt %u\n",
913+ gc->ngpio, FASTPATH_NGPIO);
914914
915915 return 0;
916916 }
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c+3−1
@@ -119,9 +119,11 @@ · 118 unmodified lines
119119 * - 3.57.0 - Compute tunneling on GFX10+
120120 * - 3.58.0 - Add GFX12 DCC support
121121 * - 3.59.0 - Cleared VRAM
122+ * - 3.60.0 - Add AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE (Vulkan requirement)
123+ * - 3.61.0 - Contains fix for RV/PCO compute queues
122124 */
123125 #define KMS_DRIVER_MAJOR 3
124−#define KMS_DRIVER_MINOR 59
126+#define KMS_DRIVER_MINOR 61
125127 #define KMS_DRIVER_PATCHLEVEL 0
126128
127129 /*
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c+3−2
@@ -3815,9 +3815,10 @@ int psp_init_cap_microcode(struct psp_context *psp, const char *chip_name) · 3814 unmodified lines
38153815 if (err == -ENODEV) {
38163816 dev_warn(adev->dev, "cap microcode does not exist, skip\n");
38173817 err = 0;
3818− goto out;
3818+ } else {
3819+ dev_err(adev->dev, "fail to initialize cap microcode\n");
38193820 }
3820− dev_err(adev->dev, "fail to initialize cap microcode\n");
3821+ goto out;
38213822 }
38223823
38233824 info = &adev->firmware.ucode[AMDGPU_UCODE_ID_CAP];
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c+6−2
@@ -309,7 +309,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 308 unmodified lines
309309 mutex_lock(&adev->mman.gtt_window_lock);
310310 while (src_mm.remaining) {
311311 uint64_t from, to, cur_size, tiling_flags;
312− uint32_t num_type, data_format, max_com;
312+ uint32_t num_type, data_format, max_com, write_compress_disable;
313313 struct dma_fence *next;
314314
315315 /* Never copy more than 256MiB at once to avoid a timeout */
@@ -340,9 +340,13 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, · 24 unmodified lines
340340 max_com = AMDGPU_TILING_GET(tiling_flags, GFX12_DCC_MAX_COMPRESSED_BLOCK);
341341 num_type = AMDGPU_TILING_GET(tiling_flags, GFX12_DCC_NUMBER_TYPE);
342342 data_format = AMDGPU_TILING_GET(tiling_flags, GFX12_DCC_DATA_FORMAT);
343+ write_compress_disable =
344+ AMDGPU_TILING_GET(tiling_flags, GFX12_DCC_WRITE_COMPRESS_DISABLE);
343345 copy_flags |= (AMDGPU_COPY_FLAGS_SET(MAX_COMPRESSED, max_com) |
344346 AMDGPU_COPY_FLAGS_SET(NUMBER_TYPE, num_type) |
345− AMDGPU_COPY_FLAGS_SET(DATA_FORMAT, data_format));
347+ AMDGPU_COPY_FLAGS_SET(DATA_FORMAT, data_format) |
348+ AMDGPU_COPY_FLAGS_SET(WRITE_COMPRESS_DISABLE,
349+ write_compress_disable));
346350 }
347351
348352 r = amdgpu_copy_buffer(ring, from, to, cur_size, resv,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h+2−0
@@ -119,6 +119,8 @@ struct amdgpu_copy_mem { · 118 unmodified lines
119119 #define AMDGPU_COPY_FLAGS_NUMBER_TYPE_MASK 0x07
120120 #define AMDGPU_COPY_FLAGS_DATA_FORMAT_SHIFT 8
121121 #define AMDGPU_COPY_FLAGS_DATA_FORMAT_MASK 0x3f
122+#define AMDGPU_COPY_FLAGS_WRITE_COMPRESS_DISABLE_SHIFT 14
123+#define AMDGPU_COPY_FLAGS_WRITE_COMPRESS_DISABLE_MASK 0x1
122124
123125 #define AMDGPU_COPY_FLAGS_SET(field, value) \
124126 (((__u32)(value) & AMDGPU_COPY_FLAGS_##field##_MASK) << AMDGPU_COPY_FLAGS_##field##_SHIFT)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+34−2
@@ -7437,6 +7437,38 @@ static void gfx_v9_0_ring_emit_cleaner_shader(struct amdgpu_ring *ring) · 7436 unmodified lines
74377437 amdgpu_ring_write(ring, 0); /* RESERVED field, programmed to zero */
74387438 }
74397439
7440+static void gfx_v9_0_ring_begin_use_compute(struct amdgpu_ring *ring)
7441+{
7442+ struct amdgpu_device *adev = ring->adev;
7443+ struct amdgpu_ip_block *gfx_block =
7444+ amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
7445+
7446+ amdgpu_gfx_enforce_isolation_ring_begin_use(ring);
7447+
7448+ /* Raven and PCO APUs seem to have stability issues
7449+ * with compute and gfxoff and gfx pg. Disable gfx pg during
7450+ * submission and allow again afterwards.
7451+ */
7452+ if (gfx_block && amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 1, 0))
7453+ gfx_v9_0_set_powergating_state(gfx_block, AMD_PG_STATE_UNGATE);
7454+}
7455+
7456+static void gfx_v9_0_ring_end_use_compute(struct amdgpu_ring *ring)
7457+{
7458+ struct amdgpu_device *adev = ring->adev;
7459+ struct amdgpu_ip_block *gfx_block =
7460+ amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
7461+
7462+ /* Raven and PCO APUs seem to have stability issues
7463+ * with compute and gfxoff and gfx pg. Disable gfx pg during
7464+ * submission and allow again afterwards.
7465+ */
7466+ if (gfx_block && amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(9, 1, 0))
7467+ gfx_v9_0_set_powergating_state(gfx_block, AMD_PG_STATE_GATE);
7468+
7469+ amdgpu_gfx_enforce_isolation_ring_end_use(ring);
7470+}
7471+
74407472 static const struct amd_ip_funcs gfx_v9_0_ip_funcs = {
74417473 .name = "gfx_v9_0",
74427474 .early_init = gfx_v9_0_early_init,
@@ -7613,8 +7645,8 @@ static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_compute = { · 170 unmodified lines
76137645 .emit_wave_limit = gfx_v9_0_emit_wave_limit,
76147646 .reset = gfx_v9_0_reset_kcq,
76157647 .emit_cleaner_shader = gfx_v9_0_ring_emit_cleaner_shader,
7616− .begin_use = amdgpu_gfx_enforce_isolation_ring_begin_use,
7617− .end_use = amdgpu_gfx_enforce_isolation_ring_end_use,
7648+ .begin_use = gfx_v9_0_ring_begin_use_compute,
7649+ .end_use = gfx_v9_0_ring_end_use_compute,
76187650 };
76197651
76207652 static const struct amdgpu_ring_funcs gfx_v9_0_ring_funcs_kiq = {
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c+3−2
@@ -1741,11 +1741,12 @@ static void sdma_v7_0_emit_copy_buffer(struct amdgpu_ib *ib, · 1740 unmodified lines
17411741 uint32_t byte_count,
17421742 uint32_t copy_flags)
17431743 {
1744− uint32_t num_type, data_format, max_com;
1744+ uint32_t num_type, data_format, max_com, write_cm;
17451745
17461746 max_com = AMDGPU_COPY_FLAGS_GET(copy_flags, MAX_COMPRESSED);
17471747 data_format = AMDGPU_COPY_FLAGS_GET(copy_flags, DATA_FORMAT);
17481748 num_type = AMDGPU_COPY_FLAGS_GET(copy_flags, NUMBER_TYPE);
1749+ write_cm = AMDGPU_COPY_FLAGS_GET(copy_flags, WRITE_COMPRESS_DISABLE) ? 2 : 1;
17491750
17501751 ib->ptr[ib->length_dw++] = SDMA_PKT_COPY_LINEAR_HEADER_OP(SDMA_OP_COPY) |
17511752 SDMA_PKT_COPY_LINEAR_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR) |
@@ -1762,7 +1763,7 @@ static void sdma_v7_0_emit_copy_buffer(struct amdgpu_ib *ib, · 10 unmodified lines
17621763 if ((copy_flags & (AMDGPU_COPY_FLAGS_READ_DECOMPRESSED | AMDGPU_COPY_FLAGS_WRITE_COMPRESSED)))
17631764 ib->ptr[ib->length_dw++] = SDMA_DCC_DATA_FORMAT(data_format) | SDMA_DCC_NUM_TYPE(num_type) |
17641765 ((copy_flags & AMDGPU_COPY_FLAGS_READ_DECOMPRESSED) ? SDMA_DCC_READ_CM(2) : 0) |
1765− ((copy_flags & AMDGPU_COPY_FLAGS_WRITE_COMPRESSED) ? SDMA_DCC_WRITE_CM(1) : 0) |
1766+ ((copy_flags & AMDGPU_COPY_FLAGS_WRITE_COMPRESSED) ? SDMA_DCC_WRITE_CM(write_cm) : 0) |
17661767 SDMA_DCC_MAX_COM(max_com) | SDMA_DCC_MAX_UCOM(1);
17671768 else
17681769 ib->ptr[ib->length_dw++] = 0;
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h+2−1
@@ -4121,7 +4121,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = { · 4120 unmodified lines
41214121 0x0000ffff, 0x8bfe7e7e,
41224122 0x8bea6a6a, 0xb97af804,
41234123 0xbe804ec2, 0xbf94fffe,
4124− 0xbe804a6c, 0xbfb10000,
4124+ 0xbe804a6c, 0xbe804ec2,
4125+ 0xbf94fffe, 0xbfb10000,
41254126 0xbf9f0000, 0xbf9f0000,
41264127 0xbf9f0000, 0xbf9f0000,
41274128 0xbf9f0000, 0x00000000,
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm+4−0
@@ -1049,6 +1049,10 @@ L_SKIP_BARRIER_RESTORE: · 1048 unmodified lines
10491049 s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
10501050
10511051 L_END_PGM:
1052+ // Make sure that no wave of the workgroup can exit the trap handler
1053+ // before the workgroup barrier state is saved.
1054+ s_barrier_signal -2
1055+ s_barrier_wait -2
10521056 s_endpgm_saved
10531057 end
10541058
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c+1−1
@@ -300,7 +300,7 @@ static int init_user_queue(struct process_queue_manager *pqm, · 299 unmodified lines
300300 return 0;
301301
302302 free_gang_ctx_bo:
303− amdgpu_amdkfd_free_gtt_mem(dev->adev, (*q)->gang_ctx_bo);
303+ amdgpu_amdkfd_free_gtt_mem(dev->adev, &(*q)->gang_ctx_bo);
304304 cleanup:
305305 uninit_queue(*q);
306306 *q = NULL;
drivers/gpu/drm/amd/display/dc/core/dc.c+1−1
@@ -2133,7 +2133,7 @@ static enum dc_status dc_commit_state_no_check(struct dc *dc, struct dc_state *c · 2132 unmodified lines
21332133
21342134 dc_enable_stereo(dc, context, dc_streams, context->stream_count);
21352135
2136− if (context->stream_count > get_seamless_boot_stream_count(context) ||
2136+ if (get_seamless_boot_stream_count(context) == 0 ||
21372137 context->stream_count == 0) {
21382138 /* Must wait for no flips to be pending before doing optimize bw */
21392139 hwss_wait_for_no_pipes_pending(dc, context);
drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c+1−2
@@ -63,8 +63,7 @@ void dmub_hw_lock_mgr_inbox0_cmd(struct dc_dmub_srv *dmub_srv, · 62 unmodified lines
6363
6464 bool should_use_dmub_lock(struct dc_link *link)
6565 {
66− if (link->psr_settings.psr_version == DC_PSR_VERSION_SU_1 ||
67− link->psr_settings.psr_version == DC_PSR_VERSION_1)
66+ if (link->psr_settings.psr_version == DC_PSR_VERSION_SU_1)
6867 return true;
6968
7069 if (link->replay_settings.replay_feature_enabled)
drivers/gpu/drm/amd/display/dc/dml/Makefile+9−5
@@ -29,11 +29,15 @@ dml_ccflags := $(CC_FLAGS_FPU) · 28 unmodified lines
2929 dml_rcflags := $(CC_FLAGS_NO_FPU)
3030
3131 ifneq ($(CONFIG_FRAME_WARN),0)
32−ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
33−frame_warn_flag := -Wframe-larger-than=3072
34−else
35−frame_warn_flag := -Wframe-larger-than=2048
36−endif
32+ ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
33+ frame_warn_limit := 3072
34+ else
35+ frame_warn_limit := 2048
36+ endif
37+
38+ ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
39+ frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
40+ endif
3741 endif
3842
3943 CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
drivers/gpu/drm/amd/display/dc/dml2/Makefile+13−9
@@ -28,15 +28,19 @@ dml2_ccflags := $(CC_FLAGS_FPU) · 27 unmodified lines
2828 dml2_rcflags := $(CC_FLAGS_NO_FPU)
2929
3030 ifneq ($(CONFIG_FRAME_WARN),0)
31−ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
32−ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
33−frame_warn_flag := -Wframe-larger-than=4096
34−else
35−frame_warn_flag := -Wframe-larger-than=3072
36−endif
37−else
38−frame_warn_flag := -Wframe-larger-than=2048
39−endif
31+ ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)
32+ ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy)
33+ frame_warn_limit := 4096
34+ else
35+ frame_warn_limit := 3072
36+ endif
37+ else
38+ frame_warn_limit := 2048
39+ endif
40+
41+ ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y)
42+ frame_warn_flag := -Wframe-larger-than=$(frame_warn_limit)
43+ endif
4044 endif
4145
4246 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/dml2
drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_translation_helper.c+2−2
@@ -1017,7 +1017,7 @@ bool dml21_map_dc_state_into_dml_display_cfg(const struct dc *in_dc, struct dc_s · 1016 unmodified lines
10171017 if (disp_cfg_stream_location < 0)
10181018 disp_cfg_stream_location = dml_dispcfg->num_streams++;
10191019
1020− ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1020+ ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
10211021 populate_dml21_timing_config_from_stream_state(&dml_dispcfg->stream_descriptors[disp_cfg_stream_location].timing, context->streams[stream_index], dml_ctx);
10221022 adjust_dml21_hblank_timing_config_from_pipe_ctx(&dml_dispcfg->stream_descriptors[disp_cfg_stream_location].timing, &context->res_ctx.pipe_ctx[stream_index]);
10231023 populate_dml21_output_config_from_stream_state(&dml_dispcfg->stream_descriptors[disp_cfg_stream_location].output, context->streams[stream_index], &context->res_ctx.pipe_ctx[stream_index]);
@@ -1042,7 +1042,7 @@ bool dml21_map_dc_state_into_dml_display_cfg(const struct dc *in_dc, struct dc_s · 18 unmodified lines
10421042 if (disp_cfg_plane_location < 0)
10431043 disp_cfg_plane_location = dml_dispcfg->num_planes++;
10441044
1045− ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1045+ ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
10461046
10471047 populate_dml21_surface_config_from_plane_state(in_dc, &dml_dispcfg->plane_descriptors[disp_cfg_plane_location].surface, context->stream_status[stream_index].plane_states[plane_index]);
10481048 populate_dml21_plane_config_from_plane_state(dml_ctx, &dml_dispcfg->plane_descriptors[disp_cfg_plane_location], context->stream_status[stream_index].plane_states[plane_index], context, stream_index);
drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c+3−3
@@ -786,7 +786,7 @@ static void populate_dml_output_cfg_from_stream_state(struct dml_output_cfg_st * · 785 unmodified lines
786786 case SIGNAL_TYPE_DISPLAY_PORT_MST:
787787 case SIGNAL_TYPE_DISPLAY_PORT:
788788 out->OutputEncoder[location] = dml_dp;
789− if (dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location] != -1)
789+ if (location < MAX_HPO_DP2_ENCODERS && dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location] != -1)
790790 out->OutputEncoder[dml2->v20.scratch.hpo_stream_to_link_encoder_mapping[location]] = dml_dp2p0;
791791 break;
792792 case SIGNAL_TYPE_EDP:
@@ -1343,7 +1343,7 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_stat · 550 unmodified lines
13431343 if (disp_cfg_stream_location < 0)
13441344 disp_cfg_stream_location = dml_dispcfg->num_timings++;
13451345
1346− ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1346+ ASSERT(disp_cfg_stream_location >= 0 && disp_cfg_stream_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
13471347
13481348 populate_dml_timing_cfg_from_stream_state(&dml_dispcfg->timing, disp_cfg_stream_location, context->streams[i]);
13491349 populate_dml_output_cfg_from_stream_state(&dml_dispcfg->output, disp_cfg_stream_location, context->streams[i], current_pipe_context, dml2);
@@ -1383,7 +1383,7 @@ void map_dc_state_into_dml_display_cfg(struct dml2_context *dml2, struct dc_stat · 33 unmodified lines
13831383 if (disp_cfg_plane_location < 0)
13841384 disp_cfg_plane_location = dml_dispcfg->num_surfaces++;
13851385
1386− ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location <= __DML2_WRAPPER_MAX_STREAMS_PLANES__);
1386+ ASSERT(disp_cfg_plane_location >= 0 && disp_cfg_plane_location < __DML2_WRAPPER_MAX_STREAMS_PLANES__);
13871387
13881388 populate_dml_surface_cfg_from_plane_state(dml2->v20.dml_core_ctx.project, &dml_dispcfg->surface, disp_cfg_plane_location, context->stream_status[i].plane_states[j]);
13891389 populate_dml_plane_cfg_from_plane_state(
drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c+2−1
@@ -129,7 +129,8 @@ bool hubbub3_program_watermarks( · 128 unmodified lines
129129 REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
130130 DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);
131131
132− hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
132+ if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter)
133+ hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
133134
134135 return wm_pending;
135136 }
drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c+2−1
@@ -750,7 +750,8 @@ static bool hubbub31_program_watermarks( · 749 unmodified lines
750750 REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
751751 DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/
752752
753− hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
753+ if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter)
754+ hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
754755 return wm_pending;
755756 }
756757
drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c+2−1
@@ -786,7 +786,8 @@ static bool hubbub32_program_watermarks( · 785 unmodified lines
786786 REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
787787 DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/
788788
789− hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
789+ if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter)
790+ hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
790791
791792 hubbub32_force_usr_retraining_allow(hubbub, hubbub->ctx->dc->debug.force_usr_allow);
792793
drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c+2−1
@@ -326,7 +326,8 @@ static bool hubbub35_program_watermarks( · 325 unmodified lines
326326 DCHUBBUB_ARB_MIN_REQ_OUTSTAND_COMMIT_THRESHOLD, 0xA);/*hw delta*/
327327 REG_UPDATE(DCHUBBUB_ARB_HOSTVM_CNTL, DCHUBBUB_ARB_MAX_QOS_COMMIT_THRESHOLD, 0xF);
328328
329− hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
329+ if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter)
330+ hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
330331
331332 hubbub32_force_usr_retraining_allow(hubbub, hubbub->ctx->dc->debug.force_usr_allow);
332333
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c+2−0
@@ -500,6 +500,8 @@ void hubp3_init(struct hubp *hubp) · 499 unmodified lines
500500 //hubp[i].HUBPREQ_DEBUG.HUBPREQ_DEBUG[26] = 1;
501501 REG_WRITE(HUBPREQ_DEBUG, 1 << 26);
502502
503+ REG_UPDATE(DCHUBP_CNTL, HUBP_TTU_DISABLE, 0);
504+
503505 hubp_reset(hubp);
504506 }
505507
drivers/gpu/drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c+2−0
@@ -168,6 +168,8 @@ void hubp32_init(struct hubp *hubp) · 167 unmodified lines
168168 {
169169 struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
170170 REG_WRITE(HUBPREQ_DEBUG_DB, 1 << 8);
171+
172+ REG_UPDATE(DCHUBP_CNTL, HUBP_TTU_DISABLE, 0);
171173 }
172174 static struct hubp_funcs dcn32_hubp_funcs = {
173175 .hubp_enable_tripleBuffer = hubp2_enable_triplebuffer,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c+2−1
@@ -236,7 +236,8 @@ void dcn35_init_hw(struct dc *dc) · 235 unmodified lines
236236 }
237237
238238 hws->funcs.init_pipes(dc, dc->current_state);
239− if (dc->res_pool->hubbub->funcs->allow_self_refresh_control)
239+ if (dc->res_pool->hubbub->funcs->allow_self_refresh_control &&
240+ !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter)
240241 dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub,
241242 !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter);
242243 }
drivers/gpu/drm/amd/pm/amdgpu_dpm.c+1−1
@@ -78,7 +78,7 @@ int amdgpu_dpm_set_powergating_by_smu(struct amdgpu_device *adev, · 77 unmodified lines
7878 int ret = 0;
7979 const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
8080 enum ip_power_state pwr_state = gate ? POWER_STATE_OFF : POWER_STATE_ON;
81− bool is_vcn = (block_type == AMD_IP_BLOCK_TYPE_UVD || block_type == AMD_IP_BLOCK_TYPE_VCN);
81+ bool is_vcn = block_type == AMD_IP_BLOCK_TYPE_VCN;
8282
8383 if (atomic_read(&adev->pm.pwr_state[block_type]) == pwr_state &&
8484 (!is_vcn || adev->vcn.num_vcn_inst == 1)) {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c+2−1
@@ -612,7 +612,8 @@ static int smu_sys_set_pp_table(void *handle, · 611 unmodified lines
612612 return -EIO;
613613 }
614614
615− if (!smu_table->hardcode_pptable) {
615+ if (!smu_table->hardcode_pptable || smu_table->power_play_table_size < size) {
616+ kfree(smu_table->hardcode_pptable);
616617 smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
617618 if (!smu_table->hardcode_pptable)
618619 return -ENOMEM;
drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c+4−0
@@ -160,6 +160,10 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, · 159 unmodified lines
160160 formats = komeda_get_layer_fourcc_list(&mdev->fmt_tbl,
161161 kwb_conn->wb_layer->layer_type,
162162 &n_formats);
163+ if (!formats) {
164+ kfree(kwb_conn);
165+ return -ENOMEM;
166+ }
163167
164168 err = drm_writeback_connector_init(&kms->base, wb_conn,
165169 &komeda_wb_connector_funcs,
drivers/gpu/drm/ast/ast_dp.c+1−1
@@ -195,7 +195,7 @@ static bool __ast_dp_wait_enable(struct ast_device *ast, bool enabled) · 194 unmodified lines
195195 if (enabled)
196196 vgacrdf_test |= AST_IO_VGACRDF_DP_VIDEO_ENABLE;
197197
198− for (i = 0; i < 200; ++i) {
198+ for (i = 0; i < 1000; ++i) {
199199 if (i)
200200 mdelay(1);
201201 vgacrdf = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xdf,
drivers/gpu/drm/display/drm_dp_cec.c+3−11
@@ -311,16 +311,6 @@ void drm_dp_cec_attach(struct drm_dp_aux *aux, u16 source_physical_address) · 310 unmodified lines
311311 if (!aux->transfer)
312312 return;
313313
314−#ifndef CONFIG_MEDIA_CEC_RC
315− /*
316− * CEC_CAP_RC is part of CEC_CAP_DEFAULTS, but it is stripped by
317− * cec_allocate_adapter() if CONFIG_MEDIA_CEC_RC is undefined.
318− *
319− * Do this here as well to ensure the tests against cec_caps are
320− * correct.
321− */
322− cec_caps &= ~CEC_CAP_RC;
323−#endif
324314 cancel_delayed_work_sync(&aux->cec.unregister_work);
325315
326316 mutex_lock(&aux->cec.lock);
@@ -337,7 +327,9 @@ void drm_dp_cec_attach(struct drm_dp_aux *aux, u16 source_physical_address) · 10 unmodified lines
337327 num_las = CEC_MAX_LOG_ADDRS;
338328
339329 if (aux->cec.adap) {
340− if (aux->cec.adap->capabilities == cec_caps &&
330+ /* Check if the adapter properties have changed */
331+ if ((aux->cec.adap->capabilities & CEC_CAP_MONITOR_ALL) ==
332+ (cec_caps & CEC_CAP_MONITOR_ALL) &&
341333 aux->cec.adap->available_log_addrs == num_las) {
342334 /* Unchanged, so just set the phys addr */
343335 cec_s_phys_addr(aux->cec.adap, source_physical_address, false);
drivers/gpu/drm/display/drm_dp_helper.c+1−1
@@ -2544,7 +2544,7 @@ u8 drm_dp_dsc_sink_bpp_incr(const u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) · 2543 unmodified lines
25442544 {
25452545 u8 bpp_increment_dpcd = dsc_dpcd[DP_DSC_BITS_PER_PIXEL_INC - DP_DSC_SUPPORT];
25462546
2547− switch (bpp_increment_dpcd) {
2547+ switch (bpp_increment_dpcd & DP_DSC_BITS_PER_PIXEL_MASK) {
25482548 case DP_DSC_BITS_PER_PIXEL_1_16:
25492549 return 16;
25502550 case DP_DSC_BITS_PER_PIXEL_1_8:
drivers/gpu/drm/hisilicon/hibmc/Kconfig+2−0
@@ -4,6 +4,8 @@ config DRM_HISI_HIBMC · 3 unmodified lines
44 depends on DRM && PCI
55 depends on MMU
66 select DRM_CLIENT_SELECTION
7+ select DRM_DISPLAY_HELPER
8+ select DRM_DISPLAY_DP_HELPER
79 select DRM_KMS_HELPER
810 select DRM_VRAM_HELPER
911 select DRM_TTM
drivers/gpu/drm/i915/display/intel_backlight.c+3−2
@@ -41,8 +41,9 @@ static u32 scale(u32 source_val, · 40 unmodified lines
4141 {
4242 u64 target_val;
4343
44− WARN_ON(source_min > source_max);
45− WARN_ON(target_min > target_max);
44+ if (WARN_ON(source_min >= source_max) ||
45+ WARN_ON(target_min > target_max))
46+ return target_min;
4647
4748 /* defensive */
4849 source_val = clamp(source_val, source_min, source_max);
drivers/gpu/drm/i915/display/intel_dp.c+5−7
@@ -1791,7 +1791,7 @@ int intel_dp_dsc_max_src_input_bpc(struct intel_display *display) · 1790 unmodified lines
17911791 if (DISPLAY_VER(display) == 11)
17921792 return 10;
17931793
1794− return 0;
1794+ return intel_dp_dsc_min_src_input_bpc();
17951795 }
17961796
17971797 int intel_dp_dsc_compute_max_bpp(const struct intel_connector *connector,
@@ -2072,11 +2072,10 @@ icl_dsc_compute_link_config(struct intel_dp *intel_dp, · 274 unmodified lines
20722072 /* Compressed BPP should be less than the Input DSC bpp */
20732073 dsc_max_bpp = min(dsc_max_bpp, pipe_bpp - 1);
20742074
2075− for (i = 0; i < ARRAY_SIZE(valid_dsc_bpp); i++) {
2076− if (valid_dsc_bpp[i] < dsc_min_bpp)
2075+ for (i = ARRAY_SIZE(valid_dsc_bpp) - 1; i >= 0; i--) {
2076+ if (valid_dsc_bpp[i] < dsc_min_bpp ||
2077+ valid_dsc_bpp[i] > dsc_max_bpp)
20772078 continue;
2078− if (valid_dsc_bpp[i] > dsc_max_bpp)
2079− break;
20802079
20812080 ret = dsc_compute_link_config(intel_dp,
20822081 pipe_config,
@@ -2829,7 +2828,6 @@ static void intel_dp_compute_as_sdp(struct intel_dp *intel_dp, · 746 unmodified lines
28292828
28302829 crtc_state->infoframes.enable |= intel_hdmi_infoframe_enable(DP_SDP_ADAPTIVE_SYNC);
28312830
2832− /* Currently only DP_AS_SDP_AVT_FIXED_VTOTAL mode supported */
28332831 as_sdp->sdp_type = DP_SDP_ADAPTIVE_SYNC;
28342832 as_sdp->length = 0x9;
28352833 as_sdp->duration_incr_ms = 0;
@@ -2840,7 +2838,7 @@ static void intel_dp_compute_as_sdp(struct intel_dp *intel_dp, · 4 unmodified lines
28402838 as_sdp->target_rr = drm_mode_vrefresh(adjusted_mode);
28412839 as_sdp->target_rr_divider = true;
28422840 } else {
2843− as_sdp->mode = DP_AS_SDP_AVT_FIXED_VTOTAL;
2841+ as_sdp->mode = DP_AS_SDP_AVT_DYNAMIC_VTOTAL;
28442842 as_sdp->vtotal = adjusted_mode->vtotal;
28452843 as_sdp->target_rr = 0;
28462844 }
drivers/gpu/drm/i915/display/intel_dp_mst.c+4−0
@@ -341,6 +341,10 @@ int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp, · 340 unmodified lines
341341
342342 break;
343343 }
344+
345+ /* Allow using zero step to indicate one try */
346+ if (!step)
347+ break;
344348 }
345349
346350 if (slots < 0) {
drivers/gpu/drm/i915/display/intel_hdcp.c+14−1
@@ -41,7 +41,7 @@ intel_hdcp_adjust_hdcp_line_rekeying(struct intel_encoder *encoder, · 40 unmodified lines
4141 u32 rekey_bit = 0;
4242
4343 /* Here we assume HDMI is in TMDS mode of operation */
44− if (encoder->type != INTEL_OUTPUT_HDMI)
44+ if (!intel_encoder_is_hdmi(encoder))
4545 return;
4646
4747 if (DISPLAY_VER(display) >= 30) {
@@ -2188,6 +2188,19 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) · 2140 unmodified lines
21882188
21892189 drm_dbg_kms(display->drm,
21902190 "HDCP2.2 Downstream topology change\n");
2191+
2192+ ret = hdcp2_authenticate_repeater_topology(connector);
2193+ if (!ret) {
2194+ intel_hdcp_update_value(connector,
2195+ DRM_MODE_CONTENT_PROTECTION_ENABLED,
2196+ true);
2197+ goto out;
2198+ }
2199+
2200+ drm_dbg_kms(display->drm,
2201+ "[CONNECTOR:%d:%s] Repeater topology auth failed.(%d)\n",
2202+ connector->base.base.id, connector->base.name,
2203+ ret);
21912204 } else {
21922205 drm_dbg_kms(display->drm,
21932206 "[CONNECTOR:%d:%s] HDCP2.2 link failed, retrying auth\n",
drivers/gpu/drm/i915/display/skl_universal_plane.c+0−4
@@ -106,8 +106,6 @@ static const u32 icl_sdr_y_plane_formats[] = { · 105 unmodified lines
106106 DRM_FORMAT_Y216,
107107 DRM_FORMAT_XYUV8888,
108108 DRM_FORMAT_XVYU2101010,
109− DRM_FORMAT_XVYU12_16161616,
110− DRM_FORMAT_XVYU16161616,
111109 };
112110
113111 static const u32 icl_sdr_uv_plane_formats[] = {
@@ -134,8 +132,6 @@ static const u32 icl_sdr_uv_plane_formats[] = { · 20 unmodified lines
134132 DRM_FORMAT_Y216,
135133 DRM_FORMAT_XYUV8888,
136134 DRM_FORMAT_XVYU2101010,
137− DRM_FORMAT_XVYU12_16161616,
138− DRM_FORMAT_XVYU16161616,
139135 };
140136
141137 static const u32 icl_hdr_plane_formats[] = {
drivers/gpu/drm/i915/gem/i915_gem_shmem.c+1−5
@@ -209,8 +209,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj) · 208 unmodified lines
209209 struct address_space *mapping = obj->base.filp->f_mapping;
210210 unsigned int max_segment = i915_sg_segment_size(i915->drm.dev);
211211 struct sg_table *st;
212− struct sgt_iter sgt_iter;
213− struct page *page;
214212 int ret;
215213
216214 /*
@@ -239,9 +237,7 @@ rebuild_st: · 22 unmodified lines
239237 * for PAGE_SIZE chunks instead may be helpful.
240238 */
241239 if (max_segment > PAGE_SIZE) {
242− for_each_sgt_page(page, sgt_iter, st)
243− put_page(page);
244− sg_free_table(st);
240+ shmem_sg_free_table(st, mapping, false, false);
245241 kfree(st);
246242
247243 max_segment = PAGE_SIZE;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+30−6
@@ -1469,6 +1469,19 @@ static void __reset_guc_busyness_stats(struct intel_guc *guc) · 1468 unmodified lines
14691469 spin_unlock_irqrestore(&guc->timestamp.lock, flags);
14701470 }
14711471
1472+static void __update_guc_busyness_running_state(struct intel_guc *guc)
1473+{
1474+ struct intel_gt *gt = guc_to_gt(guc);
1475+ struct intel_engine_cs *engine;
1476+ enum intel_engine_id id;
1477+ unsigned long flags;
1478+
1479+ spin_lock_irqsave(&guc->timestamp.lock, flags);
1480+ for_each_engine(engine, gt, id)
1481+ engine->stats.guc.running = false;
1482+ spin_unlock_irqrestore(&guc->timestamp.lock, flags);
1483+}
1484+
14721485 static void __update_guc_busyness_stats(struct intel_guc *guc)
14731486 {
14741487 struct intel_gt *gt = guc_to_gt(guc);
@@ -1619,6 +1632,9 @@ void intel_guc_busyness_park(struct intel_gt *gt) · 144 unmodified lines
16191632 if (!guc_submission_initialized(guc))
16201633 return;
16211634
1635+ /* Assume no engines are running and set running state to false */
1636+ __update_guc_busyness_running_state(guc);
1637+
16221638 /*
16231639 * There is a race with suspend flow where the worker runs after suspend
16241640 * and causes an unclaimed register access warning. Cancel the worker
@@ -5519,12 +5535,20 @@ static inline void guc_log_context(struct drm_printer *p, · 3894 unmodified lines
55195535 {
55205536 drm_printf(p, "GuC lrc descriptor %u:\n", ce->guc_id.id);
55215537 drm_printf(p, "\tHW Context Desc: 0x%08x\n", ce->lrc.lrca);
5522− drm_printf(p, "\t\tLRC Head: Internal %u, Memory %u\n",
5523− ce->ring->head,
5524− ce->lrc_reg_state[CTX_RING_HEAD]);
5525− drm_printf(p, "\t\tLRC Tail: Internal %u, Memory %u\n",
5526− ce->ring->tail,
5527− ce->lrc_reg_state[CTX_RING_TAIL]);
5538+ if (intel_context_pin_if_active(ce)) {
5539+ drm_printf(p, "\t\tLRC Head: Internal %u, Memory %u\n",
5540+ ce->ring->head,
5541+ ce->lrc_reg_state[CTX_RING_HEAD]);
5542+ drm_printf(p, "\t\tLRC Tail: Internal %u, Memory %u\n",
5543+ ce->ring->tail,
5544+ ce->lrc_reg_state[CTX_RING_TAIL]);
5545+ intel_context_unpin(ce);
5546+ } else {
5547+ drm_printf(p, "\t\tLRC Head: Internal %u, Memory not pinned\n",
5548+ ce->ring->head);
5549+ drm_printf(p, "\t\tLRC Tail: Internal %u, Memory not pinned\n",
5550+ ce->ring->tail);
5551+ }
55285552 drm_printf(p, "\t\tContext Pin Count: %u\n",
55295553 atomic_read(&ce->pin_count));
55305554 drm_printf(p, "\t\tGuC ID Ref Count: %u\n",
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c+2−2
@@ -168,7 +168,7 @@ static int igt_ppgtt_alloc(void *arg) · 167 unmodified lines
168168 return PTR_ERR(ppgtt);
169169
170170 if (!ppgtt->vm.allocate_va_range)
171− goto err_ppgtt_cleanup;
171+ goto ppgtt_vm_put;
172172
173173 /*
174174 * While we only allocate the page tables here and so we could
@@ -236,7 +236,7 @@ err_ppgtt_cleanup: · 61 unmodified lines
236236 goto retry;
237237 }
238238 i915_gem_ww_ctx_fini(&ww);
239−
239+ppgtt_vm_put:
240240 i915_vm_put(&ppgtt->vm);
241241 return err;
242242 }
drivers/gpu/drm/panthor/panthor_drv.c+1−0
@@ -802,6 +802,7 @@ static void panthor_query_group_priorities_info(struct drm_file *file, · 801 unmodified lines
802802 {
803803 int prio;
804804
805+ memset(arg, 0, sizeof(*arg));
805806 for (prio = PANTHOR_GROUP_PRIORITY_REALTIME; prio >= 0; prio--) {
806807 if (!group_priority_permit(file, prio))
807808 arg->allowed_mask |= BIT(prio);
drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c+103−97
@@ -70,10 +70,17 @@ static int light_up_connector(struct kunit *test, · 69 unmodified lines
7070 state = drm_kunit_helper_atomic_state_alloc(test, drm, ctx);
7171 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, state);
7272
73+retry:
7374 conn_state = drm_atomic_get_connector_state(state, connector);
7475 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, conn_state);
7576
7677 ret = drm_atomic_set_crtc_for_connector(conn_state, crtc);
78+ if (ret == -EDEADLK) {
79+ drm_atomic_state_clear(state);
80+ ret = drm_modeset_backoff(ctx);
81+ if (!ret)
82+ goto retry;
83+ }
7784 KUNIT_EXPECT_EQ(test, ret, 0);
7885
7986 crtc_state = drm_atomic_get_crtc_state(state, crtc);
@@ -282,15 +289,16 @@ static void drm_test_check_broadcast_rgb_crtc_mode_changed(struct kunit *test) · 202 unmodified lines
282289 8);
283290 KUNIT_ASSERT_NOT_NULL(test, priv);
284291
285− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
286− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
287−
292+ drm = &priv->drm;
293+ crtc = priv->crtc;
288294 conn = &priv->connector;
295+
289296 preferred = find_preferred_mode(conn);
290297 KUNIT_ASSERT_NOT_NULL(test, preferred);
291298
292− drm = &priv->drm;
293− crtc = priv->crtc;
299+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
300+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
301+
294302 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
295303 KUNIT_ASSERT_EQ(test, ret, 0);
296304
@@ -345,15 +353,16 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_changed(struct kunit *tes · 48 unmodified lines
345353 8);
346354 KUNIT_ASSERT_NOT_NULL(test, priv);
347355
348− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
349− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
350−
356+ drm = &priv->drm;
357+ crtc = priv->crtc;
351358 conn = &priv->connector;
359+
352360 preferred = find_preferred_mode(conn);
353361 KUNIT_ASSERT_NOT_NULL(test, preferred);
354362
355− drm = &priv->drm;
356− crtc = priv->crtc;
363+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
364+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
365+
357366 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
358367 KUNIT_ASSERT_EQ(test, ret, 0);
359368
@@ -408,18 +417,18 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(struct kunit *test) · 48 unmodified lines
408417 8);
409418 KUNIT_ASSERT_NOT_NULL(test, priv);
410419
420+ drm = &priv->drm;
421+ crtc = priv->crtc;
411422 conn = &priv->connector;
412423 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi);
413424
414− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
415− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
416−
417425 preferred = find_preferred_mode(conn);
418426 KUNIT_ASSERT_NOT_NULL(test, preferred);
419427 KUNIT_ASSERT_NE(test, drm_match_cea_mode(preferred), 1);
420428
421− drm = &priv->drm;
422− crtc = priv->crtc;
429+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
430+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
431+
423432 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
424433 KUNIT_ASSERT_EQ(test, ret, 0);
425434
@@ -474,7 +483,6 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_vic_1(struct kunit *test) · 48 unmodified lines
474483 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1);
475484 KUNIT_ASSERT_NOT_NULL(test, mode);
476485
477− drm = &priv->drm;
478486 crtc = priv->crtc;
479487 ret = light_up_connector(test, drm, crtc, conn, mode, ctx);
480488 KUNIT_ASSERT_EQ(test, ret, 0);
@@ -520,18 +528,18 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(struct kunit *test) · 39 unmodified lines
520528 8);
521529 KUNIT_ASSERT_NOT_NULL(test, priv);
522530
531+ drm = &priv->drm;
532+ crtc = priv->crtc;
523533 conn = &priv->connector;
524534 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi);
525535
526− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
527− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
528−
529536 preferred = find_preferred_mode(conn);
530537 KUNIT_ASSERT_NOT_NULL(test, preferred);
531538 KUNIT_ASSERT_NE(test, drm_match_cea_mode(preferred), 1);
532539
533− drm = &priv->drm;
534− crtc = priv->crtc;
540+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
541+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
542+
535543 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
536544 KUNIT_ASSERT_EQ(test, ret, 0);
537545
@@ -588,7 +596,6 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_vic_1(struct kunit *test) · 50 unmodified lines
588596 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1);
589597 KUNIT_ASSERT_NOT_NULL(test, mode);
590598
591− drm = &priv->drm;
592599 crtc = priv->crtc;
593600 ret = light_up_connector(test, drm, crtc, conn, mode, ctx);
594601 KUNIT_ASSERT_EQ(test, ret, 0);
@@ -636,18 +643,18 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode(struct kunit *test) · 41 unmodified lines
636643 8);
637644 KUNIT_ASSERT_NOT_NULL(test, priv);
638645
646+ drm = &priv->drm;
647+ crtc = priv->crtc;
639648 conn = &priv->connector;
640649 KUNIT_ASSERT_TRUE(test, conn->display_info.is_hdmi);
641650
642− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
643− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
644−
645651 preferred = find_preferred_mode(conn);
646652 KUNIT_ASSERT_NOT_NULL(test, preferred);
647653 KUNIT_ASSERT_NE(test, drm_match_cea_mode(preferred), 1);
648654
649− drm = &priv->drm;
650− crtc = priv->crtc;
655+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
656+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
657+
651658 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
652659 KUNIT_ASSERT_EQ(test, ret, 0);
653660
@@ -704,7 +711,6 @@ static void drm_test_check_broadcast_rgb_limited_cea_mode_vic_1(struct kunit *te · 50 unmodified lines
704711 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1);
705712 KUNIT_ASSERT_NOT_NULL(test, mode);
706713
707− drm = &priv->drm;
708714 crtc = priv->crtc;
709715 ret = light_up_connector(test, drm, crtc, conn, mode, ctx);
710716 KUNIT_ASSERT_EQ(test, ret, 0);
@@ -754,20 +760,20 @@ static void drm_test_check_output_bpc_crtc_mode_changed(struct kunit *test) · 43 unmodified lines
754760 10);
755761 KUNIT_ASSERT_NOT_NULL(test, priv);
756762
763+ drm = &priv->drm;
764+ crtc = priv->crtc;
757765 conn = &priv->connector;
758766 ret = set_connector_edid(test, conn,
759767 test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
760768 ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
761769 KUNIT_ASSERT_GT(test, ret, 0);
762770
763− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
764− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
765−
766771 preferred = find_preferred_mode(conn);
767772 KUNIT_ASSERT_NOT_NULL(test, preferred);
768773
769− drm = &priv->drm;
770− crtc = priv->crtc;
774+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
775+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
776+
771777 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
772778 KUNIT_ASSERT_EQ(test, ret, 0);
773779
@@ -828,20 +834,20 @@ static void drm_test_check_output_bpc_crtc_mode_not_changed(struct kunit *test) · 54 unmodified lines
828834 10);
829835 KUNIT_ASSERT_NOT_NULL(test, priv);
830836
837+ drm = &priv->drm;
838+ crtc = priv->crtc;
831839 conn = &priv->connector;
832840 ret = set_connector_edid(test, conn,
833841 test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
834842 ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz));
835843 KUNIT_ASSERT_GT(test, ret, 0);
836844
837− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
838− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
839−
840845 preferred = find_preferred_mode(conn);
841846 KUNIT_ASSERT_NOT_NULL(test, preferred);
842847
843− drm = &priv->drm;
844− crtc = priv->crtc;
848+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
849+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
850+
845851 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
846852 KUNIT_ASSERT_EQ(test, ret, 0);
847853
@@ -899,6 +905,8 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) · 51 unmodified lines
899905 12);
900906 KUNIT_ASSERT_NOT_NULL(test, priv);
901907
908+ drm = &priv->drm;
909+ crtc = priv->crtc;
902910 conn = &priv->connector;
903911 ret = set_connector_edid(test, conn,
904912 test_edid_dvi_1080p,
@@ -908,14 +916,12 @@ static void drm_test_check_output_bpc_dvi(struct kunit *test) · 3 unmodified lines
908916 info = &conn->display_info;
909917 KUNIT_ASSERT_FALSE(test, info->is_hdmi);
910918
911− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
912− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
913−
914919 preferred = find_preferred_mode(conn);
915920 KUNIT_ASSERT_NOT_NULL(test, preferred);
916921
917− drm = &priv->drm;
918− crtc = priv->crtc;
922+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
923+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
924+
919925 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
920926 KUNIT_ASSERT_EQ(test, ret, 0);
921927
@@ -946,21 +952,21 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(struct kunit *test) · 24 unmodified lines
946952 8);
947953 KUNIT_ASSERT_NOT_NULL(test, priv);
948954
955+ drm = &priv->drm;
956+ crtc = priv->crtc;
949957 conn = &priv->connector;
950958 ret = set_connector_edid(test, conn,
951959 test_edid_hdmi_1080p_rgb_max_200mhz,
952960 ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz));
953961 KUNIT_ASSERT_GT(test, ret, 0);
954962
955− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
956− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
957−
958963 preferred = find_preferred_mode(conn);
959964 KUNIT_ASSERT_NOT_NULL(test, preferred);
960965 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
961966
962− drm = &priv->drm;
963− crtc = priv->crtc;
967+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
968+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
969+
964970 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
965971 KUNIT_ASSERT_EQ(test, ret, 0);
966972
@@ -993,21 +999,21 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(struct kunit *test) · 26 unmodified lines
993999 10);
9941000 KUNIT_ASSERT_NOT_NULL(test, priv);
9951001
1002+ drm = &priv->drm;
1003+ crtc = priv->crtc;
9961004 conn = &priv->connector;
9971005 ret = set_connector_edid(test, conn,
9981006 test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
9991007 ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));
10001008 KUNIT_ASSERT_GT(test, ret, 0);
10011009
1002− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1003− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1004−
10051010 preferred = find_preferred_mode(conn);
10061011 KUNIT_ASSERT_NOT_NULL(test, preferred);
10071012 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
10081013
1009− drm = &priv->drm;
1010− crtc = priv->crtc;
1014+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1015+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1016+
10111017 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
10121018 KUNIT_ASSERT_EQ(test, ret, 0);
10131019
@@ -1040,21 +1046,21 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(struct kunit *test) · 26 unmodified lines
10401046 12);
10411047 KUNIT_ASSERT_NOT_NULL(test, priv);
10421048
1049+ drm = &priv->drm;
1050+ crtc = priv->crtc;
10431051 conn = &priv->connector;
10441052 ret = set_connector_edid(test, conn,
10451053 test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
10461054 ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz));
10471055 KUNIT_ASSERT_GT(test, ret, 0);
10481056
1049− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1050− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1051−
10521057 preferred = find_preferred_mode(conn);
10531058 KUNIT_ASSERT_NOT_NULL(test, preferred);
10541059 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
10551060
1056− drm = &priv->drm;
1057− crtc = priv->crtc;
1061+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1062+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1063+
10581064 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
10591065 KUNIT_ASSERT_EQ(test, ret, 0);
10601066
@@ -1091,15 +1097,16 @@ static void drm_test_check_hdmi_funcs_reject_rate(struct kunit *test) · 30 unmodified lines
10911097 8);
10921098 KUNIT_ASSERT_NOT_NULL(test, priv);
10931099
1094− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1095− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1096−
1100+ drm = &priv->drm;
1101+ crtc = priv->crtc;
10971102 conn = &priv->connector;
1103+
10981104 preferred = find_preferred_mode(conn);
10991105 KUNIT_ASSERT_NOT_NULL(test, preferred);
11001106
1101− drm = &priv->drm;
1102− crtc = priv->crtc;
1107+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1108+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1109+
11031110 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
11041111 KUNIT_ASSERT_EQ(test, ret, 0);
11051112
@@ -1147,6 +1154,8 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) · 41 unmodified lines
11471154 12);
11481155 KUNIT_ASSERT_NOT_NULL(test, priv);
11491156
1157+ drm = &priv->drm;
1158+ crtc = priv->crtc;
11501159 conn = &priv->connector;
11511160 ret = set_connector_edid(test, conn,
11521161 test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -1157,9 +1166,6 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) · 4 unmodified lines
11571166 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
11581167 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
11591168
1160− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1161− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1162−
11631169 preferred = find_preferred_mode(conn);
11641170 KUNIT_ASSERT_NOT_NULL(test, preferred);
11651171 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
@@ -1170,8 +1176,9 @@ static void drm_test_check_max_tmds_rate_bpc_fallback(struct kunit *test) · 4 unmodified lines
11701176 rate = drm_hdmi_compute_mode_clock(preferred, 10, HDMI_COLORSPACE_RGB);
11711177 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
11721178
1173− drm = &priv->drm;
1174− crtc = priv->crtc;
1179+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1180+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1181+
11751182 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
11761183 KUNIT_EXPECT_EQ(test, ret, 0);
11771184
@@ -1216,6 +1223,8 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) · 38 unmodified lines
12161223 12);
12171224 KUNIT_ASSERT_NOT_NULL(test, priv);
12181225
1226+ drm = &priv->drm;
1227+ crtc = priv->crtc;
12191228 conn = &priv->connector;
12201229 ret = set_connector_edid(test, conn,
12211230 test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -1226,9 +1235,6 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) · 4 unmodified lines
12261235 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
12271236 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
12281237
1229− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1230− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1231−
12321238 preferred = find_preferred_mode(conn);
12331239 KUNIT_ASSERT_NOT_NULL(test, preferred);
12341240 KUNIT_ASSERT_FALSE(test, preferred->flags & DRM_MODE_FLAG_DBLCLK);
@@ -1242,8 +1248,9 @@ static void drm_test_check_max_tmds_rate_format_fallback(struct kunit *test) · 7 unmodified lines
12421248 rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422);
12431249 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
12441250
1245− drm = &priv->drm;
1246− crtc = priv->crtc;
1251+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1252+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1253+
12471254 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
12481255 KUNIT_EXPECT_EQ(test, ret, 0);
12491256
@@ -1290,9 +1297,6 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) · 40 unmodified lines
12901297 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
12911298 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
12921299
1293− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1294− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1295−
12961300 mode = drm_kunit_display_mode_from_cea_vic(test, drm, 1);
12971301 KUNIT_ASSERT_NOT_NULL(test, mode);
12981302
@@ -1306,7 +1310,9 @@ static void drm_test_check_output_bpc_format_vic_1(struct kunit *test) · 7 unmodified lines
13061310 rate = mode->clock * 1500;
13071311 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
13081312
1309− drm = &priv->drm;
1313+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1314+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1315+
13101316 crtc = priv->crtc;
13111317 ret = light_up_connector(test, drm, crtc, conn, mode, ctx);
13121318 KUNIT_EXPECT_EQ(test, ret, 0);
@@ -1340,6 +1346,8 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) · 27 unmodified lines
13401346 12);
13411347 KUNIT_ASSERT_NOT_NULL(test, priv);
13421348
1349+ drm = &priv->drm;
1350+ crtc = priv->crtc;
13431351 conn = &priv->connector;
13441352 ret = set_connector_edid(test, conn,
13451353 test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz,
@@ -1350,9 +1358,6 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) · 4 unmodified lines
13501358 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
13511359 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
13521360
1353− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1354− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1355−
13561361 preferred = find_preferred_mode(conn);
13571362 KUNIT_ASSERT_NOT_NULL(test, preferred);
13581363
@@ -1371,8 +1376,9 @@ static void drm_test_check_output_bpc_format_driver_rgb_only(struct kunit *test) · 12 unmodified lines
13711376 rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422);
13721377 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
13731378
1374− drm = &priv->drm;
1375− crtc = priv->crtc;
1379+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1380+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1381+
13761382 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
13771383 KUNIT_EXPECT_EQ(test, ret, 0);
13781384
@@ -1407,6 +1413,8 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test · 28 unmodified lines
14071413 12);
14081414 KUNIT_ASSERT_NOT_NULL(test, priv);
14091415
1416+ drm = &priv->drm;
1417+ crtc = priv->crtc;
14101418 conn = &priv->connector;
14111419 ret = set_connector_edid(test, conn,
14121420 test_edid_hdmi_1080p_rgb_max_200mhz,
@@ -1417,9 +1425,6 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test · 4 unmodified lines
14171425 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
14181426 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
14191427
1420− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1421− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1422−
14231428 preferred = find_preferred_mode(conn);
14241429 KUNIT_ASSERT_NOT_NULL(test, preferred);
14251430
@@ -1438,8 +1443,9 @@ static void drm_test_check_output_bpc_format_display_rgb_only(struct kunit *test · 12 unmodified lines
14381443 rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_YUV422);
14391444 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
14401445
1441− drm = &priv->drm;
1442− crtc = priv->crtc;
1446+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1447+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1448+
14431449 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
14441450 KUNIT_EXPECT_EQ(test, ret, 0);
14451451
@@ -1473,6 +1479,8 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test · 27 unmodified lines
14731479 8);
14741480 KUNIT_ASSERT_NOT_NULL(test, priv);
14751481
1482+ drm = &priv->drm;
1483+ crtc = priv->crtc;
14761484 conn = &priv->connector;
14771485 ret = set_connector_edid(test, conn,
14781486 test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz,
@@ -1483,9 +1491,6 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test · 4 unmodified lines
14831491 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
14841492 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
14851493
1486− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1487− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1488−
14891494 preferred = find_preferred_mode(conn);
14901495 KUNIT_ASSERT_NOT_NULL(test, preferred);
14911496
@@ -1496,8 +1501,9 @@ static void drm_test_check_output_bpc_format_driver_8bpc_only(struct kunit *test · 4 unmodified lines
14961501 rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB);
14971502 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
14981503
1499− drm = &priv->drm;
1500− crtc = priv->crtc;
1504+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1505+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1506+
15011507 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
15021508 KUNIT_EXPECT_EQ(test, ret, 0);
15031509
@@ -1533,6 +1539,8 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes · 29 unmodified lines
15331539 12);
15341540 KUNIT_ASSERT_NOT_NULL(test, priv);
15351541
1542+ drm = &priv->drm;
1543+ crtc = priv->crtc;
15361544 conn = &priv->connector;
15371545 ret = set_connector_edid(test, conn,
15381546 test_edid_hdmi_1080p_rgb_max_340mhz,
@@ -1543,9 +1551,6 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes · 4 unmodified lines
15431551 KUNIT_ASSERT_TRUE(test, info->is_hdmi);
15441552 KUNIT_ASSERT_GT(test, info->max_tmds_clock, 0);
15451553
1546− ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1547− KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1548−
15491554 preferred = find_preferred_mode(conn);
15501555 KUNIT_ASSERT_NOT_NULL(test, preferred);
15511556
@@ -1556,8 +1561,9 @@ static void drm_test_check_output_bpc_format_display_8bpc_only(struct kunit *tes · 4 unmodified lines
15561561 rate = drm_hdmi_compute_mode_clock(preferred, 12, HDMI_COLORSPACE_RGB);
15571562 KUNIT_ASSERT_LT(test, rate, info->max_tmds_clock * 1000);
15581563
1559− drm = &priv->drm;
1560− crtc = priv->crtc;
1564+ ctx = drm_kunit_helper_acquire_ctx_alloc(test);
1565+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx);
1566+
15611567 ret = light_up_connector(test, drm, crtc, conn, preferred, ctx);
15621568 KUNIT_EXPECT_EQ(test, ret, 0);
15631569
drivers/gpu/drm/xe/regs/xe_oa_regs.h+6−0
@@ -51,6 +51,10 @@ · 50 unmodified lines
5151 /* Common to all OA units */
5252 #define OA_OACONTROL_REPORT_BC_MASK REG_GENMASK(9, 9)
5353 #define OA_OACONTROL_COUNTER_SIZE_MASK REG_GENMASK(8, 8)
54+#define OAG_OACONTROL_USED_BITS \
55+ (OAG_OACONTROL_OA_PES_DISAG_EN | OAG_OACONTROL_OA_CCS_SELECT_MASK | \
56+ OAG_OACONTROL_OA_COUNTER_SEL_MASK | OAG_OACONTROL_OA_COUNTER_ENABLE | \
57+ OA_OACONTROL_REPORT_BC_MASK | OA_OACONTROL_COUNTER_SIZE_MASK)
5458
5559 #define OAG_OA_DEBUG XE_REG(0xdaf8, XE_REG_OPTION_MASKED)
5660 #define OAG_OA_DEBUG_DISABLE_MMIO_TRG REG_BIT(14)
@@ -78,6 +82,8 @@ · 21 unmodified lines
7882 #define OAM_CONTEXT_CONTROL_OFFSET (0x1bc)
7983 #define OAM_CONTROL_OFFSET (0x194)
8084 #define OAM_CONTROL_COUNTER_SEL_MASK REG_GENMASK(3, 1)
85+#define OAM_OACONTROL_USED_BITS \
86+ (OAM_CONTROL_COUNTER_SEL_MASK | OAG_OACONTROL_OA_COUNTER_ENABLE)
8187 #define OAM_DEBUG_OFFSET (0x198)
8288 #define OAM_STATUS_OFFSET (0x19c)
8389 #define OAM_MMIO_TRG_OFFSET (0x1d0)
drivers/gpu/drm/xe/xe_devcoredump.c+14−26
@@ -119,11 +119,7 @@ static ssize_t __xe_devcoredump_read(char *buffer, size_t count, · 118 unmodified lines
119119 drm_puts(&p, "\n**** GuC CT ****\n");
120120 xe_guc_ct_snapshot_print(ss->guc.ct, &p);
121121
122− /*
123− * Don't add a new section header here because the mesa debug decoder
124− * tool expects the context information to be in the 'GuC CT' section.
125− */
126− /* drm_puts(&p, "\n**** Contexts ****\n"); */
122+ drm_puts(&p, "\n**** Contexts ****\n");
127123 xe_guc_exec_queue_snapshot_print(ss->ge, &p);
128124
129125 drm_puts(&p, "\n**** Job ****\n");
@@ -395,42 +391,34 @@ int xe_devcoredump_init(struct xe_device *xe) · 265 unmodified lines
395391 /**
396392 * xe_print_blob_ascii85 - print a BLOB to some useful location in ASCII85
397393 *
398− * The output is split to multiple lines because some print targets, e.g. dmesg
399− * cannot handle arbitrarily long lines. Note also that printing to dmesg in
400− * piece-meal fashion is not possible, each separate call to drm_puts() has a
401− * line-feed automatically added! Therefore, the entire output line must be
402− * constructed in a local buffer first, then printed in one atomic output call.
394+ * The output is split into multiple calls to drm_puts() because some print
395+ * targets, e.g. dmesg, cannot handle arbitrarily long lines. These targets may
396+ * add newlines, as is the case with dmesg: each drm_puts() call creates a
397+ * separate line.
403398 *
404399 * There is also a scheduler yield call to prevent the 'task has been stuck for
405400 * 120s' kernel hang check feature from firing when printing to a slow target
406401 * such as dmesg over a serial port.
407402 *
408− * TODO: Add compression prior to the ASCII85 encoding to shrink huge buffers down.
409− *
410403 * @p: the printer object to output to
411404 * @prefix: optional prefix to add to output string
405+ * @suffix: optional suffix to add at the end. 0 disables it and is
406+ * not added to the output, which is useful when using multiple calls
407+ * to dump data to @p
412408 * @blob: the Binary Large OBject to dump out
413409 * @offset: offset in bytes to skip from the front of the BLOB, must be a multiple of sizeof(u32)
414410 * @size: the size in bytes of the BLOB, must be a multiple of sizeof(u32)
415411 */
416−void xe_print_blob_ascii85(struct drm_printer *p, const char *prefix,
412+void xe_print_blob_ascii85(struct drm_printer *p, const char *prefix, char suffix,
417413 const void *blob, size_t offset, size_t size)
418414 {
419415 const u32 *blob32 = (const u32 *)blob;
420416 char buff[ASCII85_BUFSZ], *line_buff;
421417 size_t line_pos = 0;
422418
423− /*
424− * Splitting blobs across multiple lines is not compatible with the mesa
425− * debug decoder tool. Note that even dropping the explicit '\n' below
426− * doesn't help because the GuC log is so big some underlying implementation
427− * still splits the lines at 512K characters. So just bail completely for
428− * the moment.
429− */
430− return;
431−
432419 #define DMESG_MAX_LINE_LEN 800
433−#define MIN_SPACE (ASCII85_BUFSZ + 2) /* 85 + "\n\0" */
420+ /* Always leave space for the suffix char and the \0 */
421+#define MIN_SPACE (ASCII85_BUFSZ + 2) /* 85 + "<suffix>\0" */
434422
435423 if (size & 3)
436424 drm_printf(p, "Size not word aligned: %zu", size);
@@ -462,7 +450,6 @@ void xe_print_blob_ascii85(struct drm_printer *p, const char *prefix, · 25 unmodified lines
462450 line_pos += strlen(line_buff + line_pos);
463451
464452 if ((line_pos + MIN_SPACE) >= DMESG_MAX_LINE_LEN) {
465− line_buff[line_pos++] = '\n';
466453 line_buff[line_pos++] = 0;
467454
468455 drm_puts(p, line_buff);
@@ -474,10 +461,11 @@ void xe_print_blob_ascii85(struct drm_printer *p, const char *prefix, · 5 unmodified lines
474461 }
475462 }
476463
464+ if (suffix)
465+ line_buff[line_pos++] = suffix;
466+
477467 if (line_pos) {
478− line_buff[line_pos++] = '\n';
479468 line_buff[line_pos++] = 0;
480−
481469 drm_puts(p, line_buff);
482470 }
483471
drivers/gpu/drm/xe/xe_devcoredump.h+1−1
@@ -29,7 +29,7 @@ static inline int xe_devcoredump_init(struct xe_device *xe) · 28 unmodified lines
2929 }
3030 #endif
3131
32−void xe_print_blob_ascii85(struct drm_printer *p, const char *prefix,
32+void xe_print_blob_ascii85(struct drm_printer *p, const char *prefix, char suffix,
3333 const void *blob, size_t offset, size_t size);
3434
3535 #endif
drivers/gpu/drm/xe/xe_drm_client.c+1−1
@@ -135,8 +135,8 @@ void xe_drm_client_add_bo(struct xe_drm_client *client, · 134 unmodified lines
135135 XE_WARN_ON(bo->client);
136136 XE_WARN_ON(!list_empty(&bo->client_link));
137137
138− spin_lock(&client->bos_lock);
139138 bo->client = xe_drm_client_get(client);
139+ spin_lock(&client->bos_lock);
140140 list_add_tail(&bo->client_link, &client->bos_list);
141141 spin_unlock(&client->bos_lock);
142142 }
drivers/gpu/drm/xe/xe_gt.c+3−1
@@ -532,8 +532,10 @@ static int all_fw_domain_init(struct xe_gt *gt) · 531 unmodified lines
532532 if (IS_SRIOV_PF(gt_to_xe(gt)) && !xe_gt_is_media_type(gt))
533533 xe_lmtt_init_hw(&gt_to_tile(gt)->sriov.pf.lmtt);
534534
535− if (IS_SRIOV_PF(gt_to_xe(gt)))
535+ if (IS_SRIOV_PF(gt_to_xe(gt))) {
536+ xe_gt_sriov_pf_init(gt);
536537 xe_gt_sriov_pf_init_hw(gt);
538+ }
537539
538540 xe_force_wake_put(gt_to_fw(gt), fw_ref);
539541
drivers/gpu/drm/xe/xe_gt_sriov_pf.c+13−1
@@ -68,6 +68,19 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt) · 67 unmodified lines
6868 return 0;
6969 }
7070
71+/**
72+ * xe_gt_sriov_pf_init - Prepare SR-IOV PF data structures on PF.
73+ * @gt: the &xe_gt to initialize
74+ *
75+ * Late one-time initialization of the PF data.
76+ *
77+ * Return: 0 on success or a negative error code on failure.
78+ */
79+int xe_gt_sriov_pf_init(struct xe_gt *gt)
80+{
81+ return xe_gt_sriov_pf_migration_init(gt);
82+}
83+
7184 static bool pf_needs_enable_ggtt_guest_update(struct xe_device *xe)
7285 {
7386 return GRAPHICS_VERx100(xe) == 1200;
@@ -90,7 +103,6 @@ void xe_gt_sriov_pf_init_hw(struct xe_gt *gt) · 16 unmodified lines
90103 pf_enable_ggtt_guest_update(gt);
91104
92105 xe_gt_sriov_pf_service_update(gt);
93− xe_gt_sriov_pf_migration_init(gt);
94106 }
95107
96108 static u32 pf_get_vf_regs_stride(struct xe_device *xe)
drivers/gpu/drm/xe/xe_gt_sriov_pf.h+6−0
@@ -10,6 +10,7 @@ struct xe_gt; · 9 unmodified lines
1010
1111 #ifdef CONFIG_PCI_IOV
1212 int xe_gt_sriov_pf_init_early(struct xe_gt *gt);
13+int xe_gt_sriov_pf_init(struct xe_gt *gt);
1314 void xe_gt_sriov_pf_init_hw(struct xe_gt *gt);
1415 void xe_gt_sriov_pf_sanitize_hw(struct xe_gt *gt, unsigned int vfid);
1516 void xe_gt_sriov_pf_restart(struct xe_gt *gt);
@@ -19,6 +20,11 @@ static inline int xe_gt_sriov_pf_init_early(struct xe_gt *gt) · 3 unmodified lines
1920 return 0;
2021 }
2122
23+static inline int xe_gt_sriov_pf_init(struct xe_gt *gt)
24+{
25+ return 0;
26+}
27+
2228 static inline void xe_gt_sriov_pf_init_hw(struct xe_gt *gt)
2329 {
2430 }
drivers/gpu/drm/xe/xe_guc_ct.c+2−1
@@ -1724,7 +1724,8 @@ void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot, · 1723 unmodified lines
17241724 snapshot->g2h_outstanding);
17251725
17261726 if (snapshot->ctb)
1727− xe_print_blob_ascii85(p, "CTB data", snapshot->ctb, 0, snapshot->ctb_size);
1727+ xe_print_blob_ascii85(p, "CTB data", '\n',
1728+ snapshot->ctb, 0, snapshot->ctb_size);
17281729 } else {
17291730 drm_puts(p, "CT disabled\n");
17301731 }
drivers/gpu/drm/xe/xe_guc_log.c+3−1
@@ -211,8 +211,10 @@ void xe_guc_log_snapshot_print(struct xe_guc_log_snapshot *snapshot, struct drm_ · 210 unmodified lines
211211 remain = snapshot->size;
212212 for (i = 0; i < snapshot->num_chunks; i++) {
213213 size_t size = min(GUC_LOG_CHUNK_SIZE, remain);
214+ const char *prefix = i ? NULL : "Log data";
215+ char suffix = i == snapshot->num_chunks - 1 ? '\n' : 0;
214216
215− xe_print_blob_ascii85(p, i ? NULL : "Log data", snapshot->copy[i], 0, size);
217+ xe_print_blob_ascii85(p, prefix, suffix, snapshot->copy[i], 0, size);
216218 remain -= size;
217219 }
218220 }
drivers/gpu/drm/xe/xe_oa.c+13−8
@@ -237,7 +237,6 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream) · 236 unmodified lines
237237 u32 tail, hw_tail, partial_report_size, available;
238238 int report_size = stream->oa_buffer.format->size;
239239 unsigned long flags;
240− bool pollin;
241240
242241 spin_lock_irqsave(&stream->oa_buffer.ptr_lock, flags);
243242
@@ -282,11 +281,11 @@ static bool xe_oa_buffer_check_unlocked(struct xe_oa_stream *stream) · 38 unmodified lines
282281 stream->oa_buffer.tail = tail;
283282
284283 available = xe_oa_circ_diff(stream, stream->oa_buffer.tail, stream->oa_buffer.head);
285− pollin = available >= stream->wait_num_reports * report_size;
284+ stream->pollin = available >= stream->wait_num_reports * report_size;
286285
287286 spin_unlock_irqrestore(&stream->oa_buffer.ptr_lock, flags);
288287
289− return pollin;
288+ return stream->pollin;
290289 }
291290
292291 static enum hrtimer_restart xe_oa_poll_check_timer_cb(struct hrtimer *hrtimer)
@@ -294,10 +293,8 @@ static enum hrtimer_restart xe_oa_poll_check_timer_cb(struct hrtimer *hrtimer) · 1 unmodified line
294293 struct xe_oa_stream *stream =
295294 container_of(hrtimer, typeof(*stream), poll_check_timer);
296295
297− if (xe_oa_buffer_check_unlocked(stream)) {
298− stream->pollin = true;
296+ if (xe_oa_buffer_check_unlocked(stream))
299297 wake_up(&stream->poll_wq);
300− }
301298
302299 hrtimer_forward_now(hrtimer, ns_to_ktime(stream->poll_period_ns));
303300
@@ -452,6 +449,12 @@ static u32 __oa_ccs_select(struct xe_oa_stream *stream) · 148 unmodified lines
452449 return val;
453450 }
454451
452+static u32 __oactrl_used_bits(struct xe_oa_stream *stream)
453+{
454+ return stream->hwe->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG ?
455+ OAG_OACONTROL_USED_BITS : OAM_OACONTROL_USED_BITS;
456+}
457+
455458 static void xe_oa_enable(struct xe_oa_stream *stream)
456459 {
457460 const struct xe_oa_format *format = stream->oa_buffer.format;
@@ -472,14 +475,14 @@ static void xe_oa_enable(struct xe_oa_stream *stream) · 14 unmodified lines
472475 stream->hwe->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG)
473476 val |= OAG_OACONTROL_OA_PES_DISAG_EN;
474477
475− xe_mmio_write32(&stream->gt->mmio, regs->oa_ctrl, val);
478+ xe_mmio_rmw32(&stream->gt->mmio, regs->oa_ctrl, __oactrl_used_bits(stream), val);
476479 }
477480
478481 static void xe_oa_disable(struct xe_oa_stream *stream)
479482 {
480483 struct xe_mmio *mmio = &stream->gt->mmio;
481484
482− xe_mmio_write32(mmio, __oa_regs(stream)->oa_ctrl, 0);
485+ xe_mmio_rmw32(mmio, __oa_regs(stream)->oa_ctrl, __oactrl_used_bits(stream), 0);
483486 if (xe_mmio_wait32(mmio, __oa_regs(stream)->oa_ctrl,
484487 OAG_OACONTROL_OA_COUNTER_ENABLE, 0, 50000, NULL, false))
485488 drm_err(&stream->oa->xe->drm,
@@ -2534,6 +2537,8 @@ static void __xe_oa_init_oa_units(struct xe_gt *gt) · 2048 unmodified lines
25342537 u->type = DRM_XE_OA_UNIT_TYPE_OAM;
25352538 }
25362539
2540+ xe_mmio_write32(&gt->mmio, u->regs.oa_ctrl, 0);
2541+
25372542 /* Ensure MMIO trigger remains disabled till there is a stream */
25382543 xe_mmio_write32(&gt->mmio, u->regs.oa_debug,
25392544 oag_configure_mmio_trigger(NULL, false));
drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c+30−24
@@ -57,12 +57,35 @@ bool xe_ttm_stolen_cpu_access_needs_ggtt(struct xe_device *xe) · 56 unmodified lines
5757 return GRAPHICS_VERx100(xe) < 1270 && !IS_DGFX(xe);
5858 }
5959
60+static u32 get_wopcm_size(struct xe_device *xe)
61+{
62+ u32 wopcm_size;
63+ u64 val;
64+
65+ val = xe_mmio_read64_2x32(xe_root_tile_mmio(xe), STOLEN_RESERVED);
66+ val = REG_FIELD_GET64(WOPCM_SIZE_MASK, val);
67+
68+ switch (val) {
69+ case 0x5 ... 0x6:
70+ val--;
71+ fallthrough;
72+ case 0x0 ... 0x3:
73+ wopcm_size = (1U << val) * SZ_1M;
74+ break;
75+ default:
76+ WARN(1, "Missing case wopcm_size=%llx\n", val);
77+ wopcm_size = 0;
78+ }
79+
80+ return wopcm_size;
81+}
82+
6083 static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
6184 {
6285 struct xe_tile *tile = xe_device_get_root_tile(xe);
6386 struct xe_mmio *mmio = xe_root_tile_mmio(xe);
6487 struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
65− u64 stolen_size;
88+ u64 stolen_size, wopcm_size;
6689 u64 tile_offset;
6790 u64 tile_size;
6891
@@ -74,7 +97,13 @@ static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr) · 5 unmodified lines
7497 if (drm_WARN_ON(&xe->drm, tile_size < mgr->stolen_base))
7598 return 0;
7699
100+ /* Carve out the top of DSM as it contains the reserved WOPCM region */
101+ wopcm_size = get_wopcm_size(xe);
102+ if (drm_WARN_ON(&xe->drm, !wopcm_size))
103+ return 0;
104+
77105 stolen_size = tile_size - mgr->stolen_base;
106+ stolen_size -= wopcm_size;
78107
79108 /* Verify usage fits in the actual resource available */
80109 if (mgr->stolen_base + stolen_size <= pci_resource_len(pdev, LMEM_BAR))
@@ -89,29 +118,6 @@ static s64 detect_bar2_dgfx(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr) · 8 unmodified lines
89118 return ALIGN_DOWN(stolen_size, SZ_1M);
90119 }
91120
92−static u32 get_wopcm_size(struct xe_device *xe)
93−{
94− u32 wopcm_size;
95− u64 val;
96−
97− val = xe_mmio_read64_2x32(xe_root_tile_mmio(xe), STOLEN_RESERVED);
98− val = REG_FIELD_GET64(WOPCM_SIZE_MASK, val);
99−
100− switch (val) {
101− case 0x5 ... 0x6:
102− val--;
103− fallthrough;
104− case 0x0 ... 0x3:
105− wopcm_size = (1U << val) * SZ_1M;
106− break;
107− default:
108− WARN(1, "Missing case wopcm_size=%llx\n", val);
109− wopcm_size = 0;
110− }
111−
112− return wopcm_size;
113−}
114−
115121 static u32 detect_bar2_integrated(struct xe_device *xe, struct xe_ttm_stolen_mgr *mgr)
116122 {
117123 struct pci_dev *pdev = to_pci_dev(xe->drm.dev);
drivers/gpu/host1x/dev.c+2−0
@@ -619,6 +619,8 @@ static int host1x_probe(struct platform_device *pdev) · 618 unmodified lines
619619 goto free_contexts;
620620 }
621621
622+ mutex_init(&host->intr_mutex);
623+
622624 pm_runtime_enable(&pdev->dev);
623625
624626 err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
drivers/gpu/host1x/intr.c+0−2
@@ -104,8 +104,6 @@ int host1x_intr_init(struct host1x *host) · 103 unmodified lines
104104 unsigned int id;
105105 int i, err;
106106
107− mutex_init(&host->intr_mutex);
108−
109107 for (id = 0; id < host1x_syncpt_nb_pts(host); ++id) {
110108 struct host1x_syncpt *syncpt = &host->syncpt[id];
111109
drivers/hid/Kconfig+10−5
@@ -570,6 +570,8 @@ config HID_LED · 569 unmodified lines
570570
571571 config HID_LENOVO
572572 tristate "Lenovo / Thinkpad devices"
573+ depends on ACPI
574+ select ACPI_PLATFORM_PROFILE
573575 select NEW_LEDS
574576 select LEDS_CLASS
575577 help
@@ -1167,7 +1169,8 @@ config HID_TOPRE · 591 unmodified lines
11671169 tristate "Topre REALFORCE keyboards"
11681170 depends on HID
11691171 help
1170− Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key keyboards.
1172+ Say Y for N-key rollover support on Topre REALFORCE R2 108/87 key and
1173+ Topre REALFORCE R3S 87 key keyboards.
11711174
11721175 config HID_THINGM
11731176 tristate "ThingM blink(1) USB RGB LED"
@@ -1374,10 +1377,6 @@ endmenu · 200 unmodified lines
13741377
13751378 source "drivers/hid/bpf/Kconfig"
13761379
1377−endif # HID
1378−
1379−source "drivers/hid/usbhid/Kconfig"
1380−
13811380 source "drivers/hid/i2c-hid/Kconfig"
13821381
13831382 source "drivers/hid/intel-ish-hid/Kconfig"
@@ -1388,4 +1387,10 @@ source "drivers/hid/surface-hid/Kconfig" · 4 unmodified lines
13881387
13891388 source "drivers/hid/intel-thc-hid/Kconfig"
13901389
1390+endif # HID
1391+
1392+# USB support may be used with HID disabled
1393+
1394+source "drivers/hid/usbhid/Kconfig"
1395+
13911396 endif # HID_SUPPORT
drivers/hid/amd-sfh-hid/Kconfig+0−1
@@ -5,7 +5,6 @@ menu "AMD SFH HID Support" · 4 unmodified lines
55
66 config AMD_SFH_HID
77 tristate "AMD Sensor Fusion Hub"
8− depends on HID
98 depends on X86
109 help
1110 If you say yes to this option, support will be included for the
drivers/hid/hid-apple.c+8−0
@@ -474,6 +474,7 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, · 473 unmodified lines
474474 hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2015)
475475 table = magic_keyboard_2015_fn_keys;
476476 else if (hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 ||
477+ hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 ||
477478 hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 ||
478479 hid->product == USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021)
479480 table = apple2021_fn_keys;
@@ -545,6 +546,9 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input, · 65 unmodified lines
545546 }
546547 }
547548
549+ if (usage->hid == 0xc0301) /* Omoton KB066 quirk */
550+ code = KEY_F6;
551+
548552 if (usage->code != code) {
549553 input_event_with_scancode(input, usage->type, code, usage->hid, value);
550554
@@ -1150,6 +1154,10 @@ static const struct hid_device_id apple_devices[] = { · 599 unmodified lines
11501154 .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
11511155 { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021),
11521156 .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
1157+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024),
1158+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
1159+ { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024),
1160+ .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
11531161 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021),
11541162 .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK | APPLE_RDESC_BATTERY },
11551163 { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021),
drivers/hid/hid-corsair-void.c+2−1
@@ -553,7 +553,7 @@ static void corsair_void_battery_remove_work_handler(struct work_struct *work) · 552 unmodified lines
553553 static void corsair_void_battery_add_work_handler(struct work_struct *work)
554554 {
555555 struct corsair_void_drvdata *drvdata;
556− struct power_supply_config psy_cfg;
556+ struct power_supply_config psy_cfg = {};
557557 struct power_supply *new_supply;
558558
559559 drvdata = container_of(work, struct corsair_void_drvdata,
@@ -726,6 +726,7 @@ static void corsair_void_remove(struct hid_device *hid_dev) · 166 unmodified lines
726726 if (drvdata->battery)
727727 power_supply_unregister(drvdata->battery);
728728
729+ cancel_delayed_work_sync(&drvdata->delayed_status_work);
729730 cancel_delayed_work_sync(&drvdata->delayed_firmware_work);
730731 sysfs_remove_group(&hid_dev->dev.kobj, &corsair_void_attr_group);
731732 }
drivers/hid/hid-ids.h+3−0
@@ -184,6 +184,7 @@ · 183 unmodified lines
184184 #define USB_DEVICE_ID_APPLE_IRCONTROL4 0x8242
185185 #define USB_DEVICE_ID_APPLE_IRCONTROL5 0x8243
186186 #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2021 0x029c
187+#define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_2024 0x0320
187188 #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_FINGERPRINT_2021 0x029a
188189 #define USB_DEVICE_ID_APPLE_MAGIC_KEYBOARD_NUMPAD_2021 0x029f
189190 #define USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT 0x8102
@@ -1095,6 +1096,7 @@ · 905 unmodified lines
10951096 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001
10961097 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3003 0x3003
10971098 #define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008
1099+#define USB_DEVICE_ID_QUANTA_HP_5MP_CAMERA_5473 0x5473
10981100
10991101 #define I2C_VENDOR_ID_RAYDIUM 0x2386
11001102 #define I2C_PRODUCT_ID_RAYDIUM_4B33 0x4b33
@@ -1301,6 +1303,7 @@ · 200 unmodified lines
13011303 #define USB_VENDOR_ID_TOPRE 0x0853
13021304 #define USB_DEVICE_ID_TOPRE_REALFORCE_R2_108 0x0148
13031305 #define USB_DEVICE_ID_TOPRE_REALFORCE_R2_87 0x0146
1306+#define USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87 0x0313
13041307
13051308 #define USB_VENDOR_ID_TOPSEED 0x0766
13061309 #define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
drivers/hid/hid-lenovo.c+1−6
@@ -32,9 +32,7 @@ · 31 unmodified lines
3232 #include <linux/leds.h>
3333 #include <linux/workqueue.h>
3434
35−#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
3635 #include <linux/platform_profile.h>
37−#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
3836
3937 #include "hid-ids.h"
4038
@@ -730,13 +728,10 @@ static int lenovo_raw_event_TP_X12_tab(struct hid_device *hdev, u32 raw_data) · 689 unmodified lines
730728 if (hdev->product == USB_DEVICE_ID_LENOVO_X12_TAB) {
731729 report_key_event(input, KEY_RFKILL);
732730 return 1;
733− }
734−#if IS_ENABLED(CONFIG_ACPI_PLATFORM_PROFILE)
735− else {
731+ } else {
736732 platform_profile_cycle();
737733 return 1;
738734 }
739−#endif /* CONFIG_ACPI_PLATFORM_PROFILE */
740735 return 0;
741736 case TP_X12_RAW_HOTKEY_FN_F10:
742737 /* TAB1 has PICKUP Phone and TAB2 use Snipping tool*/
drivers/hid/hid-multitouch.c+4−1
@@ -1679,9 +1679,12 @@ static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi) · 1678 unmodified lines
16791679 break;
16801680 }
16811681
1682− if (suffix)
1682+ if (suffix) {
16831683 hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
16841684 "%s %s", hdev->name, suffix);
1685+ if (!hi->input->name)
1686+ return -ENOMEM;
1687+ }
16851688
16861689 return 0;
16871690 }
drivers/hid/hid-quirks.c+1−0
@@ -891,6 +891,7 @@ static const struct hid_device_id hid_ignore_list[] = { · 890 unmodified lines
891891 { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_DPAD) },
892892 #endif
893893 { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
894+ { HID_USB_DEVICE(USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_HP_5MP_CAMERA_5473) },
894895 { }
895896 };
896897
drivers/hid/hid-steam.c+35−11
@@ -313,6 +313,7 @@ struct steam_device { · 312 unmodified lines
313313 u16 rumble_left;
314314 u16 rumble_right;
315315 unsigned int sensor_timestamp_us;
316+ struct work_struct unregister_work;
316317 };
317318
318319 static int steam_recv_report(struct steam_device *steam,
@@ -1050,10 +1051,10 @@ static void steam_mode_switch_cb(struct work_struct *work) · 731 unmodified lines
10501051 struct steam_device, mode_switch);
10511052 unsigned long flags;
10521053 bool client_opened;
1053− steam->gamepad_mode = !steam->gamepad_mode;
10541054 if (!lizard_mode)
10551055 return;
10561056
1057+ steam->gamepad_mode = !steam->gamepad_mode;
10571058 if (steam->gamepad_mode)
10581059 steam_set_lizard_mode(steam, false);
10591060 else {
@@ -1072,6 +1073,31 @@ static void steam_mode_switch_cb(struct work_struct *work) · 12 unmodified lines
10721073 }
10731074 }
10741075
1076+static void steam_work_unregister_cb(struct work_struct *work)
1077+{
1078+ struct steam_device *steam = container_of(work, struct steam_device,
1079+ unregister_work);
1080+ unsigned long flags;
1081+ bool connected;
1082+ bool opened;
1083+
1084+ spin_lock_irqsave(&steam->lock, flags);
1085+ opened = steam->client_opened;
1086+ connected = steam->connected;
1087+ spin_unlock_irqrestore(&steam->lock, flags);
1088+
1089+ if (connected) {
1090+ if (opened) {
1091+ steam_sensors_unregister(steam);
1092+ steam_input_unregister(steam);
1093+ } else {
1094+ steam_set_lizard_mode(steam, lizard_mode);
1095+ steam_input_register(steam);
1096+ steam_sensors_register(steam);
1097+ }
1098+ }
1099+}
1100+
10751101 static bool steam_is_valve_interface(struct hid_device *hdev)
10761102 {
10771103 struct hid_report_enum *rep_enum;
@@ -1117,8 +1143,7 @@ static int steam_client_ll_open(struct hid_device *hdev) · 39 unmodified lines
11171143 steam->client_opened++;
11181144 spin_unlock_irqrestore(&steam->lock, flags);
11191145
1120− steam_sensors_unregister(steam);
1121− steam_input_unregister(steam);
1146+ schedule_work(&steam->unregister_work);
11221147
11231148 return 0;
11241149 }
@@ -1135,11 +1160,7 @@ static void steam_client_ll_close(struct hid_device *hdev) · 10 unmodified lines
11351160 connected = steam->connected && !steam->client_opened;
11361161 spin_unlock_irqrestore(&steam->lock, flags);
11371162
1138− if (connected) {
1139− steam_set_lizard_mode(steam, lizard_mode);
1140− steam_input_register(steam);
1141− steam_sensors_register(steam);
1142− }
1163+ schedule_work(&steam->unregister_work);
11431164 }
11441165
11451166 static int steam_client_ll_raw_request(struct hid_device *hdev,
@@ -1231,6 +1252,7 @@ static int steam_probe(struct hid_device *hdev, · 85 unmodified lines
12311252 INIT_LIST_HEAD(&steam->list);
12321253 INIT_WORK(&steam->rumble_work, steam_haptic_rumble_cb);
12331254 steam->sensor_timestamp_us = 0;
1255+ INIT_WORK(&steam->unregister_work, steam_work_unregister_cb);
12341256
12351257 /*
12361258 * With the real steam controller interface, do not connect hidraw.
@@ -1291,6 +1313,7 @@ err_cancel_work: · 54 unmodified lines
12911313 cancel_work_sync(&steam->work_connect);
12921314 cancel_delayed_work_sync(&steam->mode_switch);
12931315 cancel_work_sync(&steam->rumble_work);
1316+ cancel_work_sync(&steam->unregister_work);
12941317
12951318 return ret;
12961319 }
@@ -1307,6 +1330,7 @@ static void steam_remove(struct hid_device *hdev) · 10 unmodified lines
13071330 cancel_delayed_work_sync(&steam->mode_switch);
13081331 cancel_work_sync(&steam->work_connect);
13091332 cancel_work_sync(&steam->rumble_work);
1333+ cancel_work_sync(&steam->unregister_work);
13101334 hid_destroy_device(steam->client_hdev);
13111335 steam->client_hdev = NULL;
13121336 steam->client_opened = 0;
@@ -1593,13 +1617,13 @@ static void steam_do_deck_input_event(struct steam_device *steam, · 280 unmodified lines
15931617
15941618 if (!(b9 & BIT(6)) && steam->did_mode_switch) {
15951619 steam->did_mode_switch = false;
1596− cancel_delayed_work_sync(&steam->mode_switch);
1620+ cancel_delayed_work(&steam->mode_switch);
15971621 } else if (!steam->client_opened && (b9 & BIT(6)) && !steam->did_mode_switch) {
15981622 steam->did_mode_switch = true;
15991623 schedule_delayed_work(&steam->mode_switch, 45 * HZ / 100);
16001624 }
16011625
1602− if (!steam->gamepad_mode)
1626+ if (!steam->gamepad_mode && lizard_mode)
16031627 return;
16041628
16051629 lpad_touched = b10 & BIT(3);
@@ -1669,7 +1693,7 @@ static void steam_do_deck_sensors_event(struct steam_device *steam, · 63 unmodified lines
16691693 */
16701694 steam->sensor_timestamp_us += 4000;
16711695
1672− if (!steam->gamepad_mode)
1696+ if (!steam->gamepad_mode && lizard_mode)
16731697 return;
16741698
16751699 input_event(sensors, EV_MSC, MSC_TIMESTAMP, steam->sensor_timestamp_us);
drivers/hid/hid-thrustmaster.c+1−1
@@ -171,7 +171,7 @@ static void thrustmaster_interrupts(struct hid_device *hdev) · 170 unmodified lines
171171 b_ep = ep->desc.bEndpointAddress;
172172
173173 /* Are the expected endpoints present? */
174− u8 ep_addr[1] = {b_ep};
174+ u8 ep_addr[2] = {b_ep, 0};
175175
176176 if (!usb_check_int_endpoints(usbif, ep_addr)) {
177177 hid_err(hdev, "Unexpected non-int endpoint\n");
drivers/hid/hid-topre.c+7−0
@@ -29,6 +29,11 @@ static const __u8 *topre_report_fixup(struct hid_device *hdev, __u8 *rdesc, · 28 unmodified lines
2929 hid_info(hdev,
3030 "fixing up Topre REALFORCE keyboard report descriptor\n");
3131 rdesc[72] = 0x02;
32+ } else if (*rsize >= 106 && rdesc[28] == 0x29 && rdesc[29] == 0xe7 &&
33+ rdesc[30] == 0x81 && rdesc[31] == 0x00) {
34+ hid_info(hdev,
35+ "fixing up Topre REALFORCE keyboard report descriptor\n");
36+ rdesc[31] = 0x02;
3237 }
3338 return rdesc;
3439 }
@@ -38,6 +43,8 @@ static const struct hid_device_id topre_id_table[] = { · 3 unmodified lines
3843 USB_DEVICE_ID_TOPRE_REALFORCE_R2_108) },
3944 { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
4045 USB_DEVICE_ID_TOPRE_REALFORCE_R2_87) },
46+ { HID_USB_DEVICE(USB_VENDOR_ID_TOPRE,
47+ USB_DEVICE_ID_TOPRE_REALFORCE_R3S_87) },
4148 { }
4249 };
4350 MODULE_DEVICE_TABLE(hid, topre_id_table);
drivers/hid/hid-winwing.c+2−0
@@ -106,6 +106,8 @@ static int winwing_init_led(struct hid_device *hdev, · 105 unmodified lines
106106 "%s::%s",
107107 dev_name(&input->dev),
108108 info->led_name);
109+ if (!led->cdev.name)
110+ return -ENOMEM;
109111
110112 ret = devm_led_classdev_register(&hdev->dev, &led->cdev);
111113 if (ret)
drivers/hid/i2c-hid/Kconfig+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 menuconfig I2C_HID
33 tristate "I2C HID support"
44 default y
5− depends on I2C && INPUT && HID
5+ depends on I2C
66
77 if I2C_HID
88
drivers/hid/intel-ish-hid/Kconfig+0−1
@@ -6,7 +6,6 @@ config INTEL_ISH_HID · 5 unmodified lines
66 tristate "Intel Integrated Sensor Hub"
77 default n
88 depends on X86
9− depends on HID
109 help
1110 The Integrated Sensor Hub (ISH) enables the ability to offload
1211 sensor polling and algorithm processing to a dedicated low power
drivers/hid/intel-ish-hid/ipc/hw-ish.h+2−0
@@ -36,6 +36,8 @@ · 35 unmodified lines
3636 #define PCI_DEVICE_ID_INTEL_ISH_ARL_H 0x7745
3737 #define PCI_DEVICE_ID_INTEL_ISH_ARL_S 0x7F78
3838 #define PCI_DEVICE_ID_INTEL_ISH_LNL_M 0xA845
39+#define PCI_DEVICE_ID_INTEL_ISH_PTL_H 0xE345
40+#define PCI_DEVICE_ID_INTEL_ISH_PTL_P 0xE445
3941
4042 #define REVISION_ID_CHT_A0 0x6
4143 #define REVISION_ID_CHT_Ax_SI 0x0
drivers/hid/intel-ish-hid/ipc/ipc.c+9−6
@@ -517,6 +517,10 @@ static int ish_fw_reset_handler(struct ishtp_device *dev) · 516 unmodified lines
517517 /* ISH FW is dead */
518518 if (!ish_is_input_ready(dev))
519519 return -EPIPE;
520+
521+ /* Send clock sync at once after reset */
522+ ishtp_dev->prev_sync = 0;
523+
520524 /*
521525 * Set HOST2ISH.ILUP. Apparently we need this BEFORE sending
522526 * RESET_NOTIFY_ACK - FW will be checking for it
@@ -577,15 +581,14 @@ static void fw_reset_work_fn(struct work_struct *work) · 54 unmodified lines
577581 */
578582 static void _ish_sync_fw_clock(struct ishtp_device *dev)
579583 {
580− static unsigned long prev_sync;
581− uint64_t usec;
584+ struct ipc_time_update_msg time = {};
582585
583− if (prev_sync && time_before(jiffies, prev_sync + 20 * HZ))
586+ if (dev->prev_sync && time_before(jiffies, dev->prev_sync + 20 * HZ))
584587 return;
585588
586− prev_sync = jiffies;
587− usec = ktime_to_us(ktime_get_boottime());
588− ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &usec, sizeof(uint64_t));
589+ dev->prev_sync = jiffies;
590+ /* The fields of time would be updated while sending message */
591+ ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &time, sizeof(time));
589592 }
590593
591594 /**
drivers/hid/intel-ish-hid/ipc/pci-ish.c+7−0
@@ -26,9 +26,11 @@ · 25 unmodified lines
2626 enum ishtp_driver_data_index {
2727 ISHTP_DRIVER_DATA_NONE,
2828 ISHTP_DRIVER_DATA_LNL_M,
29+ ISHTP_DRIVER_DATA_PTL,
2930 };
3031
3132 #define ISH_FW_GEN_LNL_M "lnlm"
33+#define ISH_FW_GEN_PTL "ptl"
3234
3335 #define ISH_FIRMWARE_PATH(gen) "intel/ish/ish_" gen ".bin"
3436 #define ISH_FIRMWARE_PATH_ALL "intel/ish/ish_*.bin"
@@ -37,6 +39,9 @@ static struct ishtp_driver_data ishtp_driver_data[] = { · 2 unmodified lines
3739 [ISHTP_DRIVER_DATA_LNL_M] = {
3840 .fw_generation = ISH_FW_GEN_LNL_M,
3941 },
42+ [ISHTP_DRIVER_DATA_PTL] = {
43+ .fw_generation = ISH_FW_GEN_PTL,
44+ },
4045 };
4146
4247 static const struct pci_device_id ish_pci_tbl[] = {
@@ -63,6 +68,8 @@ static const struct pci_device_id ish_pci_tbl[] = { · 20 unmodified lines
6368 {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_H)},
6469 {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_ARL_S)},
6570 {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_LNL_M), .driver_data = ISHTP_DRIVER_DATA_LNL_M},
71+ {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_PTL_H), .driver_data = ISHTP_DRIVER_DATA_PTL},
72+ {PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ISH_PTL_P), .driver_data = ISHTP_DRIVER_DATA_PTL},
6673 {}
6774 };
6875 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h+2−0
@@ -253,6 +253,8 @@ struct ishtp_device { · 252 unmodified lines
253253 unsigned int ipc_tx_cnt;
254254 unsigned long long ipc_tx_bytes_cnt;
255255
256+ /* Time of the last clock sync */
257+ unsigned long prev_sync;
256258 const struct ishtp_hw_ops *ops;
257259 size_t mtu;
258260 uint32_t ishtp_msg_hdr;
drivers/hid/intel-thc-hid/Kconfig+0−1
@@ -7,7 +7,6 @@ menu "Intel THC HID Support" · 6 unmodified lines
77 config INTEL_THC_HID
88 tristate "Intel Touch Host Controller"
99 depends on ACPI
10− select HID
1110 help
1211 THC (Touch Host Controller) is the name of the IP block in PCH that
1312 interfaces with Touch Devices (ex: touchscreen, touchpad etc.). It
drivers/hid/surface-hid/Kconfig+0−2
@@ -1,7 +1,6 @@
11 # SPDX-License-Identifier: GPL-2.0+
22 menu "Surface System Aggregator Module HID support"
33 depends on SURFACE_AGGREGATOR
4− depends on INPUT
54
65 config SURFACE_HID
76 tristate "HID transport driver for Surface System Aggregator Module"
@@ -39,4 +38,3 @@ endmenu · 31 unmodified lines
3938
4039 config SURFACE_HID_CORE
4140 tristate
42− select HID
drivers/hid/usbhid/Kconfig+1−2
@@ -5,8 +5,7 @@ menu "USB HID support" · 4 unmodified lines
55 config USB_HID
66 tristate "USB HID transport layer"
77 default y
8− depends on USB && INPUT
9− select HID
8+ depends on HID
109 help
1110 Say Y here if you want to connect USB keyboards,
1211 mice, joysticks, graphic tablets, or any other HID based devices
drivers/i2c/i2c-core-base.c+75−38
@@ -1300,12 +1300,14 @@ new_device_store(struct device *dev, struct device_attribute *attr, · 1299 unmodified lines
13001300 info.flags |= I2C_CLIENT_SLAVE;
13011301 }
13021302
1303− info.flags |= I2C_CLIENT_USER;
1304−
13051303 client = i2c_new_client_device(adap, &info);
13061304 if (IS_ERR(client))
13071305 return PTR_ERR(client);
13081306
1307+ /* Keep track of the added device */
1308+ mutex_lock(&adap->userspace_clients_lock);
1309+ list_add_tail(&client->detected, &adap->userspace_clients);
1310+ mutex_unlock(&adap->userspace_clients_lock);
13091311 dev_info(dev, "%s: Instantiated device %s at 0x%02hx\n", "new_device",
13101312 info.type, info.addr);
13111313
@@ -1313,15 +1315,6 @@ new_device_store(struct device *dev, struct device_attribute *attr, · 1 unmodified line
13131315 }
13141316 static DEVICE_ATTR_WO(new_device);
13151317
1316−static int __i2c_find_user_addr(struct device *dev, const void *addrp)
1317−{
1318− struct i2c_client *client = i2c_verify_client(dev);
1319− unsigned short addr = *(unsigned short *)addrp;
1320−
1321− return client && client->flags & I2C_CLIENT_USER &&
1322− i2c_encode_flags_to_addr(client) == addr;
1323−}
1324−
13251318 /*
13261319 * And of course let the users delete the devices they instantiated, if
13271320 * they got it wrong. This interface can only be used to delete devices
@@ -1336,7 +1329,7 @@ delete_device_store(struct device *dev, struct device_attribute *attr, · 8 unmodified lines
13361329 const char *buf, size_t count)
13371330 {
13381331 struct i2c_adapter *adap = to_i2c_adapter(dev);
1339− struct device *child_dev;
1332+ struct i2c_client *client, *next;
13401333 unsigned short addr;
13411334 char end;
13421335 int res;
@@ -1352,19 +1345,28 @@ delete_device_store(struct device *dev, struct device_attribute *attr, · 9 unmodified lines
13521345 return -EINVAL;
13531346 }
13541347
1355− mutex_lock(&core_lock);
13561348 /* Make sure the device was added through sysfs */
1357− child_dev = device_find_child(&adap->dev, &addr, __i2c_find_user_addr);
1358− if (child_dev) {
1359− i2c_unregister_device(i2c_verify_client(child_dev));
1360− put_device(child_dev);
1361− } else {
1362− dev_err(dev, "Can't find userspace-created device at %#x\n", addr);
1363− count = -ENOENT;
1349+ res = -ENOENT;
1350+ mutex_lock_nested(&adap->userspace_clients_lock,
1351+ i2c_adapter_depth(adap));
1352+ list_for_each_entry_safe(client, next, &adap->userspace_clients,
1353+ detected) {
1354+ if (i2c_encode_flags_to_addr(client) == addr) {
1355+ dev_info(dev, "%s: Deleting device %s at 0x%02hx\n",
1356+ "delete_device", client->name, client->addr);
1357+
1358+ list_del(&client->detected);
1359+ i2c_unregister_device(client);
1360+ res = count;
1361+ break;
1362+ }
13641363 }
1365− mutex_unlock(&core_lock);
1364+ mutex_unlock(&adap->userspace_clients_lock);
13661365
1367− return count;
1366+ if (res < 0)
1367+ dev_err(dev, "%s: Can't find device in list\n",
1368+ "delete_device");
1369+ return res;
13681370 }
13691371 static DEVICE_ATTR_IGNORE_LOCKDEP(delete_device, S_IWUSR, NULL,
13701372 delete_device_store);
@@ -1535,6 +1537,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap) · 164 unmodified lines
15351537 adap->locked_flags = 0;
15361538 rt_mutex_init(&adap->bus_lock);
15371539 rt_mutex_init(&adap->mux_lock);
1540+ mutex_init(&adap->userspace_clients_lock);
1541+ INIT_LIST_HEAD(&adap->userspace_clients);
15381542
15391543 /* Set default timeout to 1 second if not already set */
15401544 if (adap->timeout == 0)
@@ -1700,6 +1704,23 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adap) · 159 unmodified lines
17001704 }
17011705 EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);
17021706
1707+static void i2c_do_del_adapter(struct i2c_driver *driver,
1708+ struct i2c_adapter *adapter)
1709+{
1710+ struct i2c_client *client, *_n;
1711+
1712+ /* Remove the devices we created ourselves as the result of hardware
1713+ * probing (using a driver's detect method) */
1714+ list_for_each_entry_safe(client, _n, &driver->clients, detected) {
1715+ if (client->adapter == adapter) {
1716+ dev_dbg(&adapter->dev, "Removing %s at 0x%x\n",
1717+ client->name, client->addr);
1718+ list_del(&client->detected);
1719+ i2c_unregister_device(client);
1720+ }
1721+ }
1722+}
1723+
17031724 static int __unregister_client(struct device *dev, void *dummy)
17041725 {
17051726 struct i2c_client *client = i2c_verify_client(dev);
@@ -1715,6 +1736,12 @@ static int __unregister_dummy(struct device *dev, void *dummy) · 9 unmodified lines
17151736 return 0;
17161737 }
17171738
1739+static int __process_removed_adapter(struct device_driver *d, void *data)
1740+{
1741+ i2c_do_del_adapter(to_i2c_driver(d), data);
1742+ return 0;
1743+}
1744+
17181745 /**
17191746 * i2c_del_adapter - unregister I2C adapter
17201747 * @adap: the adapter being unregistered
@@ -1726,6 +1753,7 @@ static int __unregister_dummy(struct device *dev, void *dummy) · 5 unmodified lines
17261753 void i2c_del_adapter(struct i2c_adapter *adap)
17271754 {
17281755 struct i2c_adapter *found;
1756+ struct i2c_client *client, *next;
17291757
17301758 /* First make sure that this adapter was ever added */
17311759 mutex_lock(&core_lock);
@@ -1737,16 +1765,31 @@ void i2c_del_adapter(struct i2c_adapter *adap) · 5 unmodified lines
17371765 }
17381766
17391767 i2c_acpi_remove_space_handler(adap);
1768+ /* Tell drivers about this removal */
1769+ mutex_lock(&core_lock);
1770+ bus_for_each_drv(&i2c_bus_type, NULL, adap,
1771+ __process_removed_adapter);
1772+ mutex_unlock(&core_lock);
1773+
1774+ /* Remove devices instantiated from sysfs */
1775+ mutex_lock_nested(&adap->userspace_clients_lock,
1776+ i2c_adapter_depth(adap));
1777+ list_for_each_entry_safe(client, next, &adap->userspace_clients,
1778+ detected) {
1779+ dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name,
1780+ client->addr);
1781+ list_del(&client->detected);
1782+ i2c_unregister_device(client);
1783+ }
1784+ mutex_unlock(&adap->userspace_clients_lock);
17401785
17411786 /* Detach any active clients. This can't fail, thus we do not
17421787 * check the returned value. This is a two-pass process, because
17431788 * we can't remove the dummy devices during the first pass: they
17441789 * could have been instantiated by real devices wishing to clean
17451790 * them up properly, so we give them a chance to do that first. */
1746− mutex_lock(&core_lock);
17471791 device_for_each_child(&adap->dev, NULL, __unregister_client);
17481792 device_for_each_child(&adap->dev, NULL, __unregister_dummy);
1749− mutex_unlock(&core_lock);
17501793
17511794 /* device name is gone after device_unregister */
17521795 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
@@ -1966,6 +2009,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) · 213 unmodified lines
19662009 /* add the driver to the list of i2c drivers in the driver core */
19672010 driver->driver.owner = owner;
19682011 driver->driver.bus = &i2c_bus_type;
2012+ INIT_LIST_HEAD(&driver->clients);
19692013
19702014 /* When registration returns, the driver core
19712015 * will have called probe() for all matching-but-unbound devices.
@@ -1983,13 +2027,10 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) · 11 unmodified lines
19832027 }
19842028 EXPORT_SYMBOL(i2c_register_driver);
19852029
1986−static int __i2c_unregister_detected_client(struct device *dev, void *argp)
2030+static int __process_removed_driver(struct device *dev, void *data)
19872031 {
1988− struct i2c_client *client = i2c_verify_client(dev);
1989−
1990− if (client && client->flags & I2C_CLIENT_AUTO)
1991− i2c_unregister_device(client);
1992−
2032+ if (dev->type == &i2c_adapter_type)
2033+ i2c_do_del_adapter(data, to_i2c_adapter(dev));
19932034 return 0;
19942035 }
19952036
@@ -2000,12 +2041,7 @@ static int __i2c_unregister_detected_client(struct device *dev, void *argp) · 4 unmodified lines
20002041 */
20012042 void i2c_del_driver(struct i2c_driver *driver)
20022043 {
2003− mutex_lock(&core_lock);
2004− /* Satisfy __must_check, function can't fail */
2005− if (driver_for_each_device(&driver->driver, NULL, NULL,
2006− __i2c_unregister_detected_client)) {
2007− }
2008− mutex_unlock(&core_lock);
2044+ i2c_for_each_dev(driver, __process_removed_driver);
20092045
20102046 driver_unregister(&driver->driver);
20112047 pr_debug("driver [%s] unregistered\n", driver->driver.name);
@@ -2432,7 +2468,6 @@ static int i2c_detect_address(struct i2c_client *temp_client, · 420 unmodified lines
24322468 /* Finally call the custom detection function */
24332469 memset(&info, 0, sizeof(struct i2c_board_info));
24342470 info.addr = addr;
2435− info.flags = I2C_CLIENT_AUTO;
24362471 err = driver->detect(temp_client, &info);
24372472 if (err) {
24382473 /* -ENODEV is returned if the detection fails. We catch it
@@ -2459,7 +2494,9 @@ static int i2c_detect_address(struct i2c_client *temp_client, · 20 unmodified lines
24592494 dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n",
24602495 info.type, info.addr);
24612496 client = i2c_new_client_device(adapter, &info);
2462− if (IS_ERR(client))
2497+ if (!IS_ERR(client))
2498+ list_add_tail(&client->detected, &driver->clients);
2499+ else
24632500 dev_err(&adapter->dev, "Failed creating %s at 0x%02x\n",
24642501 info.type, info.addr);
24652502 }
drivers/iommu/amd/amd_iommu_types.h+1−0
@@ -175,6 +175,7 @@ · 174 unmodified lines
175175 #define CONTROL_GAM_EN 25
176176 #define CONTROL_GALOG_EN 28
177177 #define CONTROL_GAINT_EN 29
178+#define CONTROL_EPH_EN 45
178179 #define CONTROL_XT_EN 50
179180 #define CONTROL_INTCAPXT_EN 51
180181 #define CONTROL_IRTCACHEDIS 59
drivers/iommu/amd/init.c+34−4
@@ -2653,6 +2653,10 @@ static void iommu_init_flags(struct amd_iommu *iommu) · 2652 unmodified lines
26532653
26542654 /* Set IOTLB invalidation timeout to 1s */
26552655 iommu_set_inv_tlb_timeout(iommu, CTRL_INV_TO_1S);
2656+
2657+ /* Enable Enhanced Peripheral Page Request Handling */
2658+ if (check_feature(FEATURE_EPHSUP))
2659+ iommu_feature_enable(iommu, CONTROL_EPH_EN);
26562660 }
26572661
26582662 static void iommu_apply_resume_quirks(struct amd_iommu *iommu)
@@ -3194,7 +3198,7 @@ out: · 535 unmodified lines
31943198 return true;
31953199 }
31963200
3197−static void iommu_snp_enable(void)
3201+static __init void iommu_snp_enable(void)
31983202 {
31993203 #ifdef CONFIG_KVM_AMD_SEV
32003204 if (!cc_platform_has(CC_ATTR_HOST_SEV_SNP))
@@ -3219,6 +3223,14 @@ static void iommu_snp_enable(void) · 18 unmodified lines
32193223 goto disable_snp;
32203224 }
32213225
3226+ /*
3227+ * Enable host SNP support once SNP support is checked on IOMMU.
3228+ */
3229+ if (snp_rmptable_init()) {
3230+ pr_warn("SNP: RMP initialization failed, SNP cannot be supported.\n");
3231+ goto disable_snp;
3232+ }
3233+
32223234 pr_info("IOMMU SNP support enabled.\n");
32233235 return;
32243236
@@ -3318,6 +3330,19 @@ static int __init iommu_go_to_state(enum iommu_init_state state) · 93 unmodified lines
33183330 ret = state_next();
33193331 }
33203332
3333+ /*
3334+ * SNP platform initilazation requires IOMMUs to be fully configured.
3335+ * If the SNP support on IOMMUs has NOT been checked, simply mark SNP
3336+ * as unsupported. If the SNP support on IOMMUs has been checked and
3337+ * host SNP support enabled but RMP enforcement has not been enabled
3338+ * in IOMMUs, then the system is in a half-baked state, but can limp
3339+ * along as all memory should be Hypervisor-Owned in the RMP. WARN,
3340+ * but leave SNP as "supported" to avoid confusing the kernel.
3341+ */
3342+ if (ret && cc_platform_has(CC_ATTR_HOST_SEV_SNP) &&
3343+ !WARN_ON_ONCE(amd_iommu_snp_en))
3344+ cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
3345+
33213346 return ret;
33223347 }
33233348
@@ -3426,18 +3451,23 @@ void __init amd_iommu_detect(void) · 102 unmodified lines
34263451 int ret;
34273452
34283453 if (no_iommu || (iommu_detected && !gart_iommu_aperture))
3429− return;
3454+ goto disable_snp;
34303455
34313456 if (!amd_iommu_sme_check())
3432− return;
3457+ goto disable_snp;
34333458
34343459 ret = iommu_go_to_state(IOMMU_IVRS_DETECTED);
34353460 if (ret)
3436− return;
3461+ goto disable_snp;
34373462
34383463 amd_iommu_detected = true;
34393464 iommu_detected = 1;
34403465 x86_init.iommu.iommu_init = amd_iommu_init;
3466+ return;
3467+
3468+disable_snp:
3469+ if (cc_platform_has(CC_ATTR_HOST_SEV_SNP))
3470+ cc_platform_clear(CC_ATTR_HOST_SEV_SNP);
34413471 }
34423472
34433473 /****************************************************************************
drivers/iommu/exynos-iommu.c+3−3
@@ -249,7 +249,7 @@ struct exynos_iommu_domain { · 248 unmodified lines
249249 struct list_head clients; /* list of sysmmu_drvdata.domain_node */
250250 sysmmu_pte_t *pgtable; /* lv1 page table, 16KB */
251251 short *lv2entcnt; /* free lv2 entry counter for each section */
252− spinlock_t lock; /* lock for modyfying list of clients */
252+ spinlock_t lock; /* lock for modifying list of clients */
253253 spinlock_t pgtablelock; /* lock for modifying page table @ pgtable */
254254 struct iommu_domain domain; /* generic domain data structure */
255255 };
@@ -292,7 +292,7 @@ struct sysmmu_drvdata { · 36 unmodified lines
292292 struct clk *aclk; /* SYSMMU's aclk clock */
293293 struct clk *pclk; /* SYSMMU's pclk clock */
294294 struct clk *clk_master; /* master's device clock */
295− spinlock_t lock; /* lock for modyfying state */
295+ spinlock_t lock; /* lock for modifying state */
296296 bool active; /* current status */
297297 struct exynos_iommu_domain *domain; /* domain we belong to */
298298 struct list_head domain_node; /* node for domain clients list */
@@ -746,7 +746,7 @@ static int exynos_sysmmu_probe(struct platform_device *pdev) · 447 unmodified lines
746746 ret = devm_request_irq(dev, irq, exynos_sysmmu_irq, 0,
747747 dev_name(dev), data);
748748 if (ret) {
749− dev_err(dev, "Unabled to register handler of irq %d\n", irq);
749+ dev_err(dev, "Unable to register handler of irq %d\n", irq);
750750 return ret;
751751 }
752752
drivers/iommu/intel/prq.c+3−1
@@ -87,7 +87,9 @@ prq_retry: · 86 unmodified lines
8787 struct page_req_dsc *req;
8888
8989 req = &iommu->prq[head / sizeof(*req)];
90− if (!req->pasid_present || req->pasid != pasid) {
90+ if (req->rid != sid ||
91+ (req->pasid_present && pasid != req->pasid) ||
92+ (!req->pasid_present && pasid != IOMMU_NO_PASID)) {
9193 head = (head + sizeof(*req)) & PRQ_RING_MASK;
9294 continue;
9395 }
drivers/iommu/io-pgfault.c+1−0
@@ -478,6 +478,7 @@ void iopf_queue_remove_device(struct iopf_queue *queue, struct device *dev) · 477 unmodified lines
478478
479479 ops->page_response(dev, iopf, &resp);
480480 list_del_init(&group->pending_node);
481+ iopf_free_group(group);
481482 }
482483 mutex_unlock(&fault_param->lock);
483484
drivers/iommu/iommu.c+1−1
@@ -1756,7 +1756,7 @@ static int iommu_get_def_domain_type(struct iommu_group *group, · 1755 unmodified lines
17561756 group->id);
17571757
17581758 /*
1759− * Try to recover, drivers are allowed to force IDENITY or DMA, IDENTITY
1759+ * Try to recover, drivers are allowed to force IDENTITY or DMA, IDENTITY
17601760 * takes precedence.
17611761 */
17621762 if (type == IOMMU_DOMAIN_IDENTITY)
drivers/irqchip/Kconfig+1−0
@@ -169,6 +169,7 @@ config IXP4XX_IRQ · 168 unmodified lines
169169
170170 config LAN966X_OIC
171171 tristate "Microchip LAN966x OIC Support"
172+ depends on MCHP_LAN966X_PCI || COMPILE_TEST
172173 select GENERIC_IRQ_CHIP
173174 select IRQ_DOMAIN
174175 help
drivers/irqchip/irq-apple-aic.c+2−1
@@ -577,7 +577,8 @@ static void __exception_irq_entry aic_handle_fiq(struct pt_regs *regs) · 576 unmodified lines
577577 AIC_FIQ_HWIRQ(AIC_TMR_EL02_VIRT));
578578 }
579579
580− if (read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & PMCR0_IACT) {
580+ if ((read_sysreg_s(SYS_IMP_APL_PMCR0_EL1) & (PMCR0_IMODE | PMCR0_IACT)) ==
581+ (FIELD_PREP(PMCR0_IMODE, PMCR0_IMODE_FIQ) | PMCR0_IACT)) {
581582 int irq;
582583 if (cpumask_test_cpu(smp_processor_id(),
583584 &aic_irqc->fiq_aff[AIC_CPU_PMU_P]->aff))
drivers/irqchip/irq-mvebu-icu.c+2−1
@@ -68,7 +68,8 @@ static int mvebu_icu_translate(struct irq_domain *d, struct irq_fwspec *fwspec, · 67 unmodified lines
6868 unsigned long *hwirq, unsigned int *type)
6969 {
7070 unsigned int param_count = static_branch_unlikely(&legacy_bindings) ? 3 : 2;
71− struct mvebu_icu_msi_data *msi_data = d->host_data;
71+ struct msi_domain_info *info = d->host_data;
72+ struct mvebu_icu_msi_data *msi_data = info->chip_data;
7273 struct mvebu_icu *icu = msi_data->icu;
7374
7475 /* Check the count of the parameters in dt */
drivers/irqchip/irq-partition-percpu.c+1−1
@@ -98,7 +98,7 @@ static void partition_irq_print_chip(struct irq_data *d, struct seq_file *p) · 97 unmodified lines
9898 struct irq_chip *chip = irq_desc_get_chip(part->chained_desc);
9999 struct irq_data *data = irq_desc_get_irq_data(part->chained_desc);
100100
101− seq_printf(p, " %5s-%lu", chip->name, data->hwirq);
101+ seq_printf(p, "%5s-%lu", chip->name, data->hwirq);
102102 }
103103
104104 static struct irq_chip partition_irq_chip = {
drivers/irqchip/irq-riscv-imsic-early.c+1−1
@@ -27,7 +27,7 @@ static void imsic_ipi_send(unsigned int cpu) · 26 unmodified lines
2727 {
2828 struct imsic_local_config *local = per_cpu_ptr(imsic->global.local, cpu);
2929
30− writel_relaxed(IMSIC_IPI_ID, local->msi_va);
30+ writel(IMSIC_IPI_ID, local->msi_va);
3131 }
3232
3333 static void imsic_ipi_starting_cpu(void)
drivers/irqchip/irq-thead-c900-aclint-sswi.c+1−1
@@ -31,7 +31,7 @@ static DEFINE_PER_CPU(void __iomem *, sswi_cpu_regs); · 30 unmodified lines
3131
3232 static void thead_aclint_sswi_ipi_send(unsigned int cpu)
3333 {
34− writel_relaxed(0x1, per_cpu(sswi_cpu_regs, cpu));
34+ writel(0x1, per_cpu(sswi_cpu_regs, cpu));
3535 }
3636
3737 static void thead_aclint_sswi_ipi_clear(void)
drivers/md/md-linear.c+1−3
@@ -76,10 +76,8 @@ static int linear_set_limits(struct mddev *mddev) · 75 unmodified lines
7676 lim.max_write_zeroes_sectors = mddev->chunk_sectors;
7777 lim.io_min = mddev->chunk_sectors << 9;
7878 err = mddev_stack_rdev_limits(mddev, &lim, MDDEV_STACK_INTEGRITY);
79− if (err) {
80− queue_limits_cancel_update(mddev->gendisk->queue);
79+ if (err)
8180 return err;
82− }
8381
8482 return queue_limits_set(mddev->gendisk->queue, &lim);
8583 }
drivers/mfd/syscon.c+26−3
@@ -159,6 +159,7 @@ err_regmap: · 158 unmodified lines
159159 }
160160
161161 static struct regmap *device_node_get_regmap(struct device_node *np,
162+ bool create_regmap,
162163 bool check_res)
163164 {
164165 struct syscon *entry, *syscon = NULL;
@@ -172,7 +173,7 @@ static struct regmap *device_node_get_regmap(struct device_node *np, · 7 unmodified lines
172173 }
173174
174175 if (!syscon) {
175− if (of_device_is_compatible(np, "syscon"))
176+ if (create_regmap)
176177 syscon = of_syscon_register(np, check_res);
177178 else
178179 syscon = ERR_PTR(-EINVAL);
@@ -233,15 +234,37 @@ err_unlock: · 54 unmodified lines
233234 }
234235 EXPORT_SYMBOL_GPL(of_syscon_register_regmap);
235236
237+/**
238+ * device_node_to_regmap() - Get or create a regmap for specified device node
239+ * @np: Device tree node
240+ *
241+ * Get a regmap for the specified device node. If there's not an existing
242+ * regmap, then one is instantiated. This function should not be used if the
243+ * device node has a custom regmap driver or has resources (clocks, resets) to
244+ * be managed. Use syscon_node_to_regmap() instead for those cases.
245+ *
246+ * Return: regmap ptr on success, negative error code on failure.
247+ */
236248 struct regmap *device_node_to_regmap(struct device_node *np)
237249 {
238− return device_node_get_regmap(np, false);
250+ return device_node_get_regmap(np, true, false);
239251 }
240252 EXPORT_SYMBOL_GPL(device_node_to_regmap);
241253
254+/**
255+ * syscon_node_to_regmap() - Get or create a regmap for specified syscon device node
256+ * @np: Device tree node
257+ *
258+ * Get a regmap for the specified device node. If there's not an existing
259+ * regmap, then one is instantiated if the node is a generic "syscon". This
260+ * function is safe to use for a syscon registered with
261+ * of_syscon_register_regmap().
262+ *
263+ * Return: regmap ptr on success, negative error code on failure.
264+ */
242265 struct regmap *syscon_node_to_regmap(struct device_node *np)
243266 {
244− return device_node_get_regmap(np, true);
267+ return device_node_get_regmap(np, of_device_is_compatible(np, "syscon"), true);
245268 }
246269 EXPORT_SYMBOL_GPL(syscon_node_to_regmap);
247270
drivers/mmc/host/mtk-sd.c+20−11
@@ -273,6 +273,7 @@ · 272 unmodified lines
273273 #define MSDC_PAD_TUNE_CMD2_SEL BIT(21) /* RW */
274274
275275 #define PAD_DS_TUNE_DLY_SEL BIT(0) /* RW */
276+#define PAD_DS_TUNE_DLY2_SEL BIT(1) /* RW */
276277 #define PAD_DS_TUNE_DLY1 GENMASK(6, 2) /* RW */
277278 #define PAD_DS_TUNE_DLY2 GENMASK(11, 7) /* RW */
278279 #define PAD_DS_TUNE_DLY3 GENMASK(16, 12) /* RW */
@@ -318,6 +319,7 @@ · 39 unmodified lines
318319
319320 /* EMMC50_PAD_DS_TUNE mask */
320321 #define PAD_DS_DLY_SEL BIT(16) /* RW */
322+#define PAD_DS_DLY2_SEL BIT(15) /* RW */
321323 #define PAD_DS_DLY1 GENMASK(14, 10) /* RW */
322324 #define PAD_DS_DLY3 GENMASK(4, 0) /* RW */
323325
@@ -2504,13 +2506,23 @@ tune_done: · 2180 unmodified lines
25042506 static int msdc_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_ios *ios)
25052507 {
25062508 struct msdc_host *host = mmc_priv(mmc);
2509+
25072510 host->hs400_mode = true;
25082511
2509− if (host->top_base)
2510− writel(host->hs400_ds_delay,
2511− host->top_base + EMMC50_PAD_DS_TUNE);
2512− else
2513− writel(host->hs400_ds_delay, host->base + PAD_DS_TUNE);
2512+ if (host->top_base) {
2513+ if (host->hs400_ds_dly3)
2514+ sdr_set_field(host->top_base + EMMC50_PAD_DS_TUNE,
2515+ PAD_DS_DLY3, host->hs400_ds_dly3);
2516+ if (host->hs400_ds_delay)
2517+ writel(host->hs400_ds_delay,
2518+ host->top_base + EMMC50_PAD_DS_TUNE);
2519+ } else {
2520+ if (host->hs400_ds_dly3)
2521+ sdr_set_field(host->base + PAD_DS_TUNE,
2522+ PAD_DS_TUNE_DLY3, host->hs400_ds_dly3);
2523+ if (host->hs400_ds_delay)
2524+ writel(host->hs400_ds_delay, host->base + PAD_DS_TUNE);
2525+ }
25142526 /* hs400 mode must set it to 0 */
25152527 sdr_clr_bits(host->base + MSDC_PATCH_BIT2, MSDC_PATCH_BIT2_CFGCRCSTS);
25162528 /* to improve read performance, set outstanding to 2 */
@@ -2530,14 +2542,11 @@ static int msdc_execute_hs400_tuning(struct mmc_host *mmc, struct mmc_card *card · 13 unmodified lines
25302542 if (host->top_base) {
25312543 sdr_set_bits(host->top_base + EMMC50_PAD_DS_TUNE,
25322544 PAD_DS_DLY_SEL);
2533− if (host->hs400_ds_dly3)
2534− sdr_set_field(host->top_base + EMMC50_PAD_DS_TUNE,
2535− PAD_DS_DLY3, host->hs400_ds_dly3);
2545+ sdr_clr_bits(host->top_base + EMMC50_PAD_DS_TUNE,
2546+ PAD_DS_DLY2_SEL);
25362547 } else {
25372548 sdr_set_bits(host->base + PAD_DS_TUNE, PAD_DS_TUNE_DLY_SEL);
2538− if (host->hs400_ds_dly3)
2539− sdr_set_field(host->base + PAD_DS_TUNE,
2540− PAD_DS_TUNE_DLY3, host->hs400_ds_dly3);
2549+ sdr_clr_bits(host->base + PAD_DS_TUNE, PAD_DS_TUNE_DLY2_SEL);
25412550 }
25422551
25432552 host->hs400_tuning = true;
drivers/mmc/host/sdhci_am654.c+0−30
@@ -155,7 +155,6 @@ struct sdhci_am654_data { · 154 unmodified lines
155155 u32 tuning_loop;
156156
157157 #define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
158−#define SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA BIT(1)
159158 };
160159
161160 struct window {
@@ -357,29 +356,6 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host, · 195 unmodified lines
357356 sdhci_set_clock(host, clock);
358357 }
359358
360−static int sdhci_am654_start_signal_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios)
361−{
362− struct sdhci_host *host = mmc_priv(mmc);
363− struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
364− struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
365− int ret;
366−
367− if ((sdhci_am654->quirks & SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA) &&
368− ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) {
369− if (!IS_ERR(mmc->supply.vqmmc)) {
370− ret = mmc_regulator_set_vqmmc(mmc, ios);
371− if (ret < 0) {
372− pr_err("%s: Switching to 1.8V signalling voltage failed,\n",
373− mmc_hostname(mmc));
374− return -EIO;
375− }
376− }
377− return 0;
378− }
379−
380− return sdhci_start_signal_voltage_switch(mmc, ios);
381−}
382−
383359 static u8 sdhci_am654_write_power_on(struct sdhci_host *host, u8 val, int reg)
384360 {
385361 writeb(val, host->ioaddr + reg);
@@ -868,11 +844,6 @@ static int sdhci_am654_get_of_property(struct platform_device *pdev, · 482 unmodified lines
868844 if (device_property_read_bool(dev, "ti,fails-without-test-cd"))
869845 sdhci_am654->quirks |= SDHCI_AM654_QUIRK_FORCE_CDTEST;
870846
871− /* Suppress v1p8 ena for eMMC and SD with vqmmc supply */
872− if (!!of_parse_phandle(dev->of_node, "vmmc-supply", 0) ==
873− !!of_parse_phandle(dev->of_node, "vqmmc-supply", 0))
874− sdhci_am654->quirks |= SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA;
875−
876847 sdhci_get_of_property(pdev);
877848
878849 return 0;
@@ -969,7 +940,6 @@ static int sdhci_am654_probe(struct platform_device *pdev) · 90 unmodified lines
969940 goto err_pltfm_free;
970941 }
971942
972− host->mmc_host_ops.start_signal_voltage_switch = sdhci_am654_start_signal_voltage_switch;
973943 host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
974944
975945 pm_runtime_get_noresume(dev);
drivers/net/can/c_can/c_can_platform.c+3−2
@@ -385,15 +385,16 @@ static int c_can_plat_probe(struct platform_device *pdev) · 384 unmodified lines
385385 if (ret) {
386386 dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
387387 KBUILD_MODNAME, ret);
388− goto exit_free_device;
388+ goto exit_pm_runtime;
389389 }
390390
391391 dev_info(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
392392 KBUILD_MODNAME, priv->base, dev->irq);
393393 return 0;
394394
395−exit_free_device:
395+exit_pm_runtime:
396396 pm_runtime_disable(priv->device);
397+exit_free_device:
397398 free_c_can_dev(dev);
398399 exit:
399400 dev_err(&pdev->dev, "probe failed\n");
drivers/net/can/ctucanfd/ctucanfd_base.c+6−4
@@ -867,10 +867,12 @@ static void ctucan_err_interrupt(struct net_device *ndev, u32 isr) · 866 unmodified lines
867867 }
868868 break;
869869 case CAN_STATE_ERROR_ACTIVE:
870− cf->can_id |= CAN_ERR_CNT;
871− cf->data[1] = CAN_ERR_CRTL_ACTIVE;
872− cf->data[6] = bec.txerr;
873− cf->data[7] = bec.rxerr;
870+ if (skb) {
871+ cf->can_id |= CAN_ERR_CNT;
872+ cf->data[1] = CAN_ERR_CRTL_ACTIVE;
873+ cf->data[6] = bec.txerr;
874+ cf->data[7] = bec.rxerr;
875+ }
874876 break;
875877 default:
876878 netdev_warn(ndev, "unhandled error state (%d:%s)!\n",
drivers/net/can/rockchip/rockchip_canfd-core.c+1−1
@@ -622,7 +622,7 @@ rkcanfd_handle_rx_fifo_overflow_int(struct rkcanfd_priv *priv) · 621 unmodified lines
622622 netdev_dbg(priv->ndev, "RX-FIFO overflow\n");
623623
624624 skb = rkcanfd_alloc_can_err_skb(priv, &cf, &timestamp);
625− if (skb)
625+ if (!skb)
626626 return 0;
627627
628628 rkcanfd_get_berr_counter_corrected(priv, &bec);
drivers/net/can/usb/etas_es58x/es58x_devlink.c+5−1
@@ -248,7 +248,11 @@ static int es58x_devlink_info_get(struct devlink *devlink, · 247 unmodified lines
248248 return ret;
249249 }
250250
251− return devlink_info_serial_number_put(req, es58x_dev->udev->serial);
251+ if (es58x_dev->udev->serial)
252+ ret = devlink_info_serial_number_put(req,
253+ es58x_dev->udev->serial);
254+
255+ return ret;
252256 }
253257
254258 const struct devlink_ops es58x_dl_ops = {
drivers/net/ethernet/aquantia/atlantic/aq_nic.c+3−1
@@ -1441,7 +1441,9 @@ void aq_nic_deinit(struct aq_nic_s *self, bool link_down) · 1440 unmodified lines
14411441 aq_ptp_ring_free(self);
14421442 aq_ptp_free(self);
14431443
1444− if (likely(self->aq_fw_ops->deinit) && link_down) {
1444+ /* May be invoked during hot unplug. */
1445+ if (pci_device_is_present(self->pdev) &&
1446+ likely(self->aq_fw_ops->deinit) && link_down) {
14451447 mutex_lock(&self->fwreq_mutex);
14461448 self->aq_fw_ops->deinit(self->aq_hw);
14471449 mutex_unlock(&self->fwreq_mutex);
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c+12−4
@@ -41,9 +41,12 @@ void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) · 40 unmodified lines
4141 {
4242 struct bcmgenet_priv *priv = netdev_priv(dev);
4343 struct device *kdev = &priv->pdev->dev;
44+ u32 phy_wolopts = 0;
4445
45− if (dev->phydev)
46+ if (dev->phydev) {
4647 phy_ethtool_get_wol(dev->phydev, wol);
48+ phy_wolopts = wol->wolopts;
49+ }
4750
4851 /* MAC is not wake-up capable, return what the PHY does */
4952 if (!device_can_wakeup(kdev))
@@ -51,9 +54,14 @@ void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) · 1 unmodified line
5154
5255 /* Overlay MAC capabilities with that of the PHY queried before */
5356 wol->supported |= WAKE_MAGIC | WAKE_MAGICSECURE | WAKE_FILTER;
54− wol->wolopts = priv->wolopts;
55− memset(wol->sopass, 0, sizeof(wol->sopass));
57+ wol->wolopts |= priv->wolopts;
5658
59+ /* Return the PHY configured magic password */
60+ if (phy_wolopts & WAKE_MAGICSECURE)
61+ return;
62+
63+ /* Otherwise the MAC one */
64+ memset(wol->sopass, 0, sizeof(wol->sopass));
5765 if (wol->wolopts & WAKE_MAGICSECURE)
5866 memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass));
5967 }
@@ -70,7 +78,7 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) · 10 unmodified lines
7078 /* Try Wake-on-LAN from the PHY first */
7179 if (dev->phydev) {
7280 ret = phy_ethtool_set_wol(dev->phydev, wol);
73− if (ret != -EOPNOTSUPP)
81+ if (ret != -EOPNOTSUPP && wol->wolopts)
7482 return ret;
7583 }
7684
drivers/net/ethernet/broadcom/tg3.c+58−0
@@ -55,6 +55,7 @@ · 54 unmodified lines
5555 #include <linux/hwmon.h>
5656 #include <linux/hwmon-sysfs.h>
5757 #include <linux/crc32poly.h>
58+#include <linux/dmi.h>
5859
5960 #include <net/checksum.h>
6061 #include <net/gso.h>
@@ -18212,6 +18213,50 @@ unlock: · 18151 unmodified lines
1821218213
1821318214 static SIMPLE_DEV_PM_OPS(tg3_pm_ops, tg3_suspend, tg3_resume);
1821418215
18216+/* Systems where ACPI _PTS (Prepare To Sleep) S5 will result in a fatal
18217+ * PCIe AER event on the tg3 device if the tg3 device is not, or cannot
18218+ * be, powered down.
18219+ */
18220+static const struct dmi_system_id tg3_restart_aer_quirk_table[] = {
18221+ {
18222+ .matches = {
18223+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
18224+ DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R440"),
18225+ },
18226+ },
18227+ {
18228+ .matches = {
18229+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
18230+ DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R540"),
18231+ },
18232+ },
18233+ {
18234+ .matches = {
18235+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
18236+ DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R640"),
18237+ },
18238+ },
18239+ {
18240+ .matches = {
18241+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
18242+ DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R650"),
18243+ },
18244+ },
18245+ {
18246+ .matches = {
18247+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
18248+ DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R740"),
18249+ },
18250+ },
18251+ {
18252+ .matches = {
18253+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
18254+ DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R750"),
18255+ },
18256+ },
18257+ {}
18258+};
18259+
1821518260 static void tg3_shutdown(struct pci_dev *pdev)
1821618261 {
1821718262 struct net_device *dev = pci_get_drvdata(pdev);
@@ -18228,6 +18273,19 @@ static void tg3_shutdown(struct pci_dev *pdev) · 10 unmodified lines
1822818273
1822918274 if (system_state == SYSTEM_POWER_OFF)
1823018275 tg3_power_down(tp);
18276+ else if (system_state == SYSTEM_RESTART &&
18277+ dmi_first_match(tg3_restart_aer_quirk_table) &&
18278+ pdev->current_state != PCI_D3cold &&
18279+ pdev->current_state != PCI_UNKNOWN) {
18280+ /* Disable PCIe AER on the tg3 to avoid a fatal
18281+ * error during this system restart.
18282+ */
18283+ pcie_capability_clear_word(pdev, PCI_EXP_DEVCTL,
18284+ PCI_EXP_DEVCTL_CERE |
18285+ PCI_EXP_DEVCTL_NFERE |
18286+ PCI_EXP_DEVCTL_FERE |
18287+ PCI_EXP_DEVCTL_URRE);
18288+ }
1823118289
1823218290 rtnl_unlock();
1823318291
drivers/net/ethernet/google/gve/gve.h+10−0
@@ -1116,6 +1116,16 @@ static inline u32 gve_xdp_tx_start_queue_id(struct gve_priv *priv) · 1115 unmodified lines
11161116 return gve_xdp_tx_queue_id(priv, 0);
11171117 }
11181118
1119+static inline bool gve_supports_xdp_xmit(struct gve_priv *priv)
1120+{
1121+ switch (priv->queue_format) {
1122+ case GVE_GQI_QPL_FORMAT:
1123+ return true;
1124+ default:
1125+ return false;
1126+ }
1127+}
1128+
11191129 /* gqi napi handler defined in gve_main.c */
11201130 int gve_napi_poll(struct napi_struct *napi, int budget);
11211131
drivers/net/ethernet/google/gve/gve_main.c+5−1
@@ -1903,6 +1903,8 @@ static void gve_turndown(struct gve_priv *priv) · 1902 unmodified lines
19031903 /* Stop tx queues */
19041904 netif_tx_disable(priv->dev);
19051905
1906+ xdp_features_clear_redirect_target(priv->dev);
1907+
19061908 gve_clear_napi_enabled(priv);
19071909 gve_clear_report_stats(priv);
19081910
@@ -1972,6 +1974,9 @@ static void gve_turnup(struct gve_priv *priv) · 63 unmodified lines
19721974 napi_schedule(&block->napi);
19731975 }
19741976
1977+ if (priv->num_xdp_queues && gve_supports_xdp_xmit(priv))
1978+ xdp_features_set_redirect_target(priv->dev, false);
1979+
19751980 gve_set_napi_enabled(priv);
19761981 }
19771982
@@ -2246,7 +2251,6 @@ static void gve_set_netdev_xdp_features(struct gve_priv *priv) · 268 unmodified lines
22462251 if (priv->queue_format == GVE_GQI_QPL_FORMAT) {
22472252 xdp_features = NETDEV_XDP_ACT_BASIC;
22482253 xdp_features |= NETDEV_XDP_ACT_REDIRECT;
2249− xdp_features |= NETDEV_XDP_ACT_NDO_XMIT;
22502254 xdp_features |= NETDEV_XDP_ACT_XSK_ZEROCOPY;
22512255 } else {
22522256 xdp_features = 0;
drivers/net/ethernet/ibm/ibmvnic.c+3−1
@@ -2408,6 +2408,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 2407 unmodified lines
24082408 dma_addr_t data_dma_addr;
24092409 struct netdev_queue *txq;
24102410 unsigned long lpar_rc;
2411+ unsigned int skblen;
24112412 union sub_crq tx_crq;
24122413 unsigned int offset;
24132414 bool use_scrq_send_direct = false;
@@ -2522,6 +2523,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 108 unmodified lines
25222523 tx_buff->skb = skb;
25232524 tx_buff->index = bufidx;
25242525 tx_buff->pool_index = queue_num;
2526+ skblen = skb->len;
25252527
25262528 memset(&tx_crq, 0, sizeof(tx_crq));
25272529 tx_crq.v1.first = IBMVNIC_CRQ_CMD;
@@ -2614,7 +2616,7 @@ early_exit: · 86 unmodified lines
26142616 netif_stop_subqueue(netdev, queue_num);
26152617 }
26162618
2617− tx_bytes += skb->len;
2619+ tx_bytes += skblen;
26182620 txq_trans_cond_update(txq);
26192621 ret = NETDEV_TX_OK;
26202622 goto out;
drivers/net/ethernet/intel/iavf/iavf_main.c+1−1
@@ -2903,8 +2903,8 @@ static void iavf_watchdog_task(struct work_struct *work) · 2902 unmodified lines
29032903 }
29042904
29052905 mutex_unlock(&adapter->crit_lock);
2906− netdev_unlock(netdev);
29072906 restart_watchdog:
2907+ netdev_unlock(netdev);
29082908 if (adapter->state >= __IAVF_DOWN)
29092909 queue_work(adapter->wq, &adapter->adminq_task);
29102910 if (adapter->aq_required)
drivers/net/ethernet/intel/ice/devlink/devlink.c+3−0
@@ -981,6 +981,9 @@ static int ice_devlink_rate_node_new(struct devlink_rate *rate_node, void **priv · 980 unmodified lines
981981
982982 /* preallocate memory for ice_sched_node */
983983 node = devm_kzalloc(ice_hw_to_dev(pi->hw), sizeof(*node), GFP_KERNEL);
984+ if (!node)
985+ return -ENOMEM;
986+
984987 *priv = node;
985988
986989 return 0;
drivers/net/ethernet/intel/ice/ice_txrx.c+103−47
@@ -527,15 +527,14 @@ err: · 526 unmodified lines
527527 * @xdp: xdp_buff used as input to the XDP program
528528 * @xdp_prog: XDP program to run
529529 * @xdp_ring: ring to be used for XDP_TX action
530− * @rx_buf: Rx buffer to store the XDP action
531530 * @eop_desc: Last descriptor in packet to read metadata from
532531 *
533532 * Returns any of ICE_XDP_{PASS, CONSUMED, TX, REDIR}
534533 */
535−static void
534+static u32
536535 ice_run_xdp(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp,
537536 struct bpf_prog *xdp_prog, struct ice_tx_ring *xdp_ring,
538− struct ice_rx_buf *rx_buf, union ice_32b_rx_flex_desc *eop_desc)
537+ union ice_32b_rx_flex_desc *eop_desc)
539538 {
540539 unsigned int ret = ICE_XDP_PASS;
541540 u32 act;
@@ -574,7 +573,7 @@ out_failure: · 32 unmodified lines
574573 ret = ICE_XDP_CONSUMED;
575574 }
576575 exit:
577− ice_set_rx_bufs_act(xdp, rx_ring, ret);
576+ return ret;
578577 }
579578
580579 /**
@@ -860,10 +859,8 @@ ice_add_xdp_frag(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp, · 279 unmodified lines
860859 xdp_buff_set_frags_flag(xdp);
861860 }
862861
863− if (unlikely(sinfo->nr_frags == MAX_SKB_FRAGS)) {
864− ice_set_rx_bufs_act(xdp, rx_ring, ICE_XDP_CONSUMED);
862+ if (unlikely(sinfo->nr_frags == MAX_SKB_FRAGS))
865863 return -ENOMEM;
866− }
867864
868865 __skb_fill_page_desc_noacc(sinfo, sinfo->nr_frags++, rx_buf->page,
869866 rx_buf->page_offset, size);
@@ -924,7 +921,6 @@ ice_get_rx_buf(struct ice_rx_ring *rx_ring, const unsigned int size, · 54 unmodified lines
924921 struct ice_rx_buf *rx_buf;
925922
926923 rx_buf = &rx_ring->rx_buf[ntc];
927− rx_buf->pgcnt = page_count(rx_buf->page);
928924 prefetchw(rx_buf->page);
929925
930926 if (!size)
@@ -940,6 +936,31 @@ ice_get_rx_buf(struct ice_rx_ring *rx_ring, const unsigned int size, · 9 unmodified lines
940936 return rx_buf;
941937 }
942938
939+/**
940+ * ice_get_pgcnts - grab page_count() for gathered fragments
941+ * @rx_ring: Rx descriptor ring to store the page counts on
942+ *
943+ * This function is intended to be called right before running XDP
944+ * program so that the page recycling mechanism will be able to take
945+ * a correct decision regarding underlying pages; this is done in such
946+ * way as XDP program can change the refcount of page
947+ */
948+static void ice_get_pgcnts(struct ice_rx_ring *rx_ring)
949+{
950+ u32 nr_frags = rx_ring->nr_frags + 1;
951+ u32 idx = rx_ring->first_desc;
952+ struct ice_rx_buf *rx_buf;
953+ u32 cnt = rx_ring->count;
954+
955+ for (int i = 0; i < nr_frags; i++) {
956+ rx_buf = &rx_ring->rx_buf[idx];
957+ rx_buf->pgcnt = page_count(rx_buf->page);
958+
959+ if (++idx == cnt)
960+ idx = 0;
961+ }
962+}
963+
943964 /**
944965 * ice_build_skb - Build skb around an existing buffer
945966 * @rx_ring: Rx descriptor ring to transact packets on
@@ -1051,12 +1072,12 @@ ice_construct_skb(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp) · 105 unmodified lines
10511072 rx_buf->page_offset + headlen, size,
10521073 xdp->frame_sz);
10531074 } else {
1054− /* buffer is unused, change the act that should be taken later
1055− * on; data was copied onto skb's linear part so there's no
1075+ /* buffer is unused, restore biased page count in Rx buffer;
1076+ * data was copied onto skb's linear part so there's no
10561077 * need for adjusting page offset and we can reuse this buffer
10571078 * as-is
10581079 */
1059− rx_buf->act = ICE_SKB_CONSUMED;
1080+ rx_buf->pagecnt_bias++;
10601081 }
10611082
10621083 if (unlikely(xdp_buff_has_frags(xdp))) {
@@ -1103,6 +1124,65 @@ ice_put_rx_buf(struct ice_rx_ring *rx_ring, struct ice_rx_buf *rx_buf) · 40 unmodified lines
11031124 rx_buf->page = NULL;
11041125 }
11051126
1127+/**
1128+ * ice_put_rx_mbuf - ice_put_rx_buf() caller, for all frame frags
1129+ * @rx_ring: Rx ring with all the auxiliary data
1130+ * @xdp: XDP buffer carrying linear + frags part
1131+ * @xdp_xmit: XDP_TX/XDP_REDIRECT verdict storage
1132+ * @ntc: a current next_to_clean value to be stored at rx_ring
1133+ * @verdict: return code from XDP program execution
1134+ *
1135+ * Walk through gathered fragments and satisfy internal page
1136+ * recycle mechanism; we take here an action related to verdict
1137+ * returned by XDP program;
1138+ */
1139+static void ice_put_rx_mbuf(struct ice_rx_ring *rx_ring, struct xdp_buff *xdp,
1140+ u32 *xdp_xmit, u32 ntc, u32 verdict)
1141+{
1142+ u32 nr_frags = rx_ring->nr_frags + 1;
1143+ u32 idx = rx_ring->first_desc;
1144+ u32 cnt = rx_ring->count;
1145+ u32 post_xdp_frags = 1;
1146+ struct ice_rx_buf *buf;
1147+ int i;
1148+
1149+ if (unlikely(xdp_buff_has_frags(xdp)))
1150+ post_xdp_frags += xdp_get_shared_info_from_buff(xdp)->nr_frags;
1151+
1152+ for (i = 0; i < post_xdp_frags; i++) {
1153+ buf = &rx_ring->rx_buf[idx];
1154+
1155+ if (verdict & (ICE_XDP_TX | ICE_XDP_REDIR)) {
1156+ ice_rx_buf_adjust_pg_offset(buf, xdp->frame_sz);
1157+ *xdp_xmit |= verdict;
1158+ } else if (verdict & ICE_XDP_CONSUMED) {
1159+ buf->pagecnt_bias++;
1160+ } else if (verdict == ICE_XDP_PASS) {
1161+ ice_rx_buf_adjust_pg_offset(buf, xdp->frame_sz);
1162+ }
1163+
1164+ ice_put_rx_buf(rx_ring, buf);
1165+
1166+ if (++idx == cnt)
1167+ idx = 0;
1168+ }
1169+ /* handle buffers that represented frags released by XDP prog;
1170+ * for these we keep pagecnt_bias as-is; refcount from struct page
1171+ * has been decremented within XDP prog and we do not have to increase
1172+ * the biased refcnt
1173+ */
1174+ for (; i < nr_frags; i++) {
1175+ buf = &rx_ring->rx_buf[idx];
1176+ ice_put_rx_buf(rx_ring, buf);
1177+ if (++idx == cnt)
1178+ idx = 0;
1179+ }
1180+
1181+ xdp->data = NULL;
1182+ rx_ring->first_desc = ntc;
1183+ rx_ring->nr_frags = 0;
1184+}
1185+
11061186 /**
11071187 * ice_clean_rx_irq - Clean completed descriptors from Rx ring - bounce buf
11081188 * @rx_ring: Rx descriptor ring to transact packets on
@@ -1120,15 +1200,13 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) · 11 unmodified lines
11201200 unsigned int total_rx_bytes = 0, total_rx_pkts = 0;
11211201 unsigned int offset = rx_ring->rx_offset;
11221202 struct xdp_buff *xdp = &rx_ring->xdp;
1123− u32 cached_ntc = rx_ring->first_desc;
11241203 struct ice_tx_ring *xdp_ring = NULL;
11251204 struct bpf_prog *xdp_prog = NULL;
11261205 u32 ntc = rx_ring->next_to_clean;
1206+ u32 cached_ntu, xdp_verdict;
11271207 u32 cnt = rx_ring->count;
11281208 u32 xdp_xmit = 0;
1129− u32 cached_ntu;
11301209 bool failure;
1131− u32 first;
11321210
11331211 xdp_prog = READ_ONCE(rx_ring->xdp_prog);
11341212 if (xdp_prog) {
@@ -1190,6 +1268,7 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) · 55 unmodified lines
11901268 xdp_prepare_buff(xdp, hard_start, offset, size, !!offset);
11911269 xdp_buff_clear_frags_flag(xdp);
11921270 } else if (ice_add_xdp_frag(rx_ring, xdp, rx_buf, size)) {
1271+ ice_put_rx_mbuf(rx_ring, xdp, NULL, ntc, ICE_XDP_CONSUMED);
11931272 break;
11941273 }
11951274 if (++ntc == cnt)
@@ -1199,15 +1278,15 @@ int ice_clean_rx_irq(struct ice_rx_ring *rx_ring, int budget) · 3 unmodified lines
11991278 if (ice_is_non_eop(rx_ring, rx_desc))
12001279 continue;
12011280
1202− ice_run_xdp(rx_ring, xdp, xdp_prog, xdp_ring, rx_buf, rx_desc);
1203− if (rx_buf->act == ICE_XDP_PASS)
1281+ ice_get_pgcnts(rx_ring);
1282+ xdp_verdict = ice_run_xdp(rx_ring, xdp, xdp_prog, xdp_ring, rx_desc);
1283+ if (xdp_verdict == ICE_XDP_PASS)
12041284 goto construct_skb;
12051285 total_rx_bytes += xdp_get_buff_len(xdp);
12061286 total_rx_pkts++;
12071287
1208− xdp->data = NULL;
1209− rx_ring->first_desc = ntc;
1210− rx_ring->nr_frags = 0;
1288+ ice_put_rx_mbuf(rx_ring, xdp, &xdp_xmit, ntc, xdp_verdict);
1289+
12111290 continue;
12121291 construct_skb:
12131292 if (likely(ice_ring_uses_build_skb(rx_ring)))
@@ -1217,18 +1296,12 @@ construct_skb: · 3 unmodified lines
12171296 /* exit if we failed to retrieve a buffer */
12181297 if (!skb) {
12191298 rx_ring->ring_stats->rx_stats.alloc_page_failed++;
1220− rx_buf->act = ICE_XDP_CONSUMED;
1221− if (unlikely(xdp_buff_has_frags(xdp)))
1222− ice_set_rx_bufs_act(xdp, rx_ring,
1223− ICE_XDP_CONSUMED);
1224− xdp->data = NULL;
1225− rx_ring->first_desc = ntc;
1226− rx_ring->nr_frags = 0;
1227− break;
1299+ xdp_verdict = ICE_XDP_CONSUMED;
12281300 }
1229− xdp->data = NULL;
1230− rx_ring->first_desc = ntc;
1231− rx_ring->nr_frags = 0;
1301+ ice_put_rx_mbuf(rx_ring, xdp, &xdp_xmit, ntc, xdp_verdict);
1302+
1303+ if (!skb)
1304+ break;
12321305
12331306 stat_err_bits = BIT(ICE_RX_FLEX_DESC_STATUS0_RXE_S);
12341307 if (unlikely(ice_test_staterr(rx_desc->wb.status_error0,
@@ -1257,23 +1330,6 @@ construct_skb: · 22 unmodified lines
12571330 total_rx_pkts++;
12581331 }
12591332
1260− first = rx_ring->first_desc;
1261− while (cached_ntc != first) {
1262− struct ice_rx_buf *buf = &rx_ring->rx_buf[cached_ntc];
1263−
1264− if (buf->act & (ICE_XDP_TX | ICE_XDP_REDIR)) {
1265− ice_rx_buf_adjust_pg_offset(buf, xdp->frame_sz);
1266− xdp_xmit |= buf->act;
1267− } else if (buf->act & ICE_XDP_CONSUMED) {
1268− buf->pagecnt_bias++;
1269− } else if (buf->act == ICE_XDP_PASS) {
1270− ice_rx_buf_adjust_pg_offset(buf, xdp->frame_sz);
1271− }
1272−
1273− ice_put_rx_buf(rx_ring, buf);
1274− if (++cached_ntc >= cnt)
1275− cached_ntc = 0;
1276− }
12771333 rx_ring->next_to_clean = ntc;
12781334 /* return up to cleaned_count buffers to hardware */
12791335 failure = ice_alloc_rx_bufs(rx_ring, ICE_RX_DESC_UNUSED(rx_ring));
drivers/net/ethernet/intel/ice/ice_txrx.h+0−1
@@ -201,7 +201,6 @@ struct ice_rx_buf { · 200 unmodified lines
201201 struct page *page;
202202 unsigned int page_offset;
203203 unsigned int pgcnt;
204− unsigned int act;
205204 unsigned int pagecnt_bias;
206205 };
207206
drivers/net/ethernet/intel/ice/ice_txrx_lib.h+0−43
@@ -5,49 +5,6 @@ · 4 unmodified lines
55 #define _ICE_TXRX_LIB_H_
66 #include "ice.h"
77
8−/**
9− * ice_set_rx_bufs_act - propagate Rx buffer action to frags
10− * @xdp: XDP buffer representing frame (linear and frags part)
11− * @rx_ring: Rx ring struct
12− * act: action to store onto Rx buffers related to XDP buffer parts
13− *
14− * Set action that should be taken before putting Rx buffer from first frag
15− * to the last.
16− */
17−static inline void
18−ice_set_rx_bufs_act(struct xdp_buff *xdp, const struct ice_rx_ring *rx_ring,
19− const unsigned int act)
20−{
21− u32 sinfo_frags = xdp_get_shared_info_from_buff(xdp)->nr_frags;
22− u32 nr_frags = rx_ring->nr_frags + 1;
23− u32 idx = rx_ring->first_desc;
24− u32 cnt = rx_ring->count;
25− struct ice_rx_buf *buf;
26−
27− for (int i = 0; i < nr_frags; i++) {
28− buf = &rx_ring->rx_buf[idx];
29− buf->act = act;
30−
31− if (++idx == cnt)
32− idx = 0;
33− }
34−
35− /* adjust pagecnt_bias on frags freed by XDP prog */
36− if (sinfo_frags < rx_ring->nr_frags && act == ICE_XDP_CONSUMED) {
37− u32 delta = rx_ring->nr_frags - sinfo_frags;
38−
39− while (delta) {
40− if (idx == 0)
41− idx = cnt - 1;
42− else
43− idx--;
44− buf = &rx_ring->rx_buf[idx];
45− buf->pagecnt_bias--;
46− delta--;
47− }
48− }
49−}
50−
518 /**
529 * ice_test_staterr - tests bits in Rx descriptor status and error fields
5310 * @status_err_n: Rx descriptor status_error0 or status_error1 bits
drivers/net/ethernet/intel/idpf/idpf_lib.c+5−0
@@ -2159,8 +2159,13 @@ static int idpf_open(struct net_device *netdev) · 2158 unmodified lines
21592159 idpf_vport_ctrl_lock(netdev);
21602160 vport = idpf_netdev_to_vport(netdev);
21612161
2162+ err = idpf_set_real_num_queues(vport);
2163+ if (err)
2164+ goto unlock;
2165+
21622166 err = idpf_vport_open(vport);
21632167
2168+unlock:
21642169 idpf_vport_ctrl_unlock(netdev);
21652170
21662171 return err;
drivers/net/ethernet/intel/idpf/idpf_txrx.c+1−4
@@ -3008,8 +3008,6 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb, · 3007 unmodified lines
30083008 return -EINVAL;
30093009
30103010 rsc_segments = DIV_ROUND_UP(skb->data_len, rsc_seg_len);
3011− if (unlikely(rsc_segments == 1))
3012− return 0;
30133011
30143012 NAPI_GRO_CB(skb)->count = rsc_segments;
30153013 skb_shinfo(skb)->gso_size = rsc_seg_len;
@@ -3072,6 +3070,7 @@ idpf_rx_process_skb_fields(struct idpf_rx_queue *rxq, struct sk_buff *skb, · 56 unmodified lines
30723070 idpf_rx_hash(rxq, skb, rx_desc, decoded);
30733071
30743072 skb->protocol = eth_type_trans(skb, rxq->netdev);
3073+ skb_record_rx_queue(skb, rxq->idx);
30753074
30763075 if (le16_get_bits(rx_desc->hdrlen_flags,
30773076 VIRTCHNL2_RX_FLEX_DESC_ADV_RSC_M))
@@ -3080,8 +3079,6 @@ idpf_rx_process_skb_fields(struct idpf_rx_queue *rxq, struct sk_buff *skb, · 2 unmodified lines
30803079 csum_bits = idpf_rx_splitq_extract_csum_bits(rx_desc);
30813080 idpf_rx_csum(rxq, skb, csum_bits, decoded);
30823081
3083− skb_record_rx_queue(skb, rxq->idx);
3084−
30853082 return 0;
30863083 }
30873084
drivers/net/ethernet/intel/igc/igc_main.c+13−9
@@ -1096,6 +1096,7 @@ static int igc_init_empty_frame(struct igc_ring *ring, · 1095 unmodified lines
10961096 return -ENOMEM;
10971097 }
10981098
1099+ buffer->type = IGC_TX_BUFFER_TYPE_SKB;
10991100 buffer->skb = skb;
11001101 buffer->protocol = 0;
11011102 buffer->bytecount = skb->len;
@@ -2701,8 +2702,9 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget) · 1599 unmodified lines
27012702 }
27022703
27032704 static struct sk_buff *igc_construct_skb_zc(struct igc_ring *ring,
2704− struct xdp_buff *xdp)
2705+ struct igc_xdp_buff *ctx)
27052706 {
2707+ struct xdp_buff *xdp = &ctx->xdp;
27062708 unsigned int totalsize = xdp->data_end - xdp->data_meta;
27072709 unsigned int metasize = xdp->data - xdp->data_meta;
27082710 struct sk_buff *skb;
@@ -2721,27 +2723,28 @@ static struct sk_buff *igc_construct_skb_zc(struct igc_ring *ring, · 12 unmodified lines
27212723 __skb_pull(skb, metasize);
27222724 }
27232725
2726+ if (ctx->rx_ts) {
2727+ skb_shinfo(skb)->tx_flags |= SKBTX_HW_TSTAMP_NETDEV;
2728+ skb_hwtstamps(skb)->netdev_data = ctx->rx_ts;
2729+ }
2730+
27242731 return skb;
27252732 }
27262733
27272734 static void igc_dispatch_skb_zc(struct igc_q_vector *q_vector,
27282735 union igc_adv_rx_desc *desc,
2729− struct xdp_buff *xdp,
2730− ktime_t timestamp)
2736+ struct igc_xdp_buff *ctx)
27312737 {
27322738 struct igc_ring *ring = q_vector->rx.ring;
27332739 struct sk_buff *skb;
27342740
2735− skb = igc_construct_skb_zc(ring, xdp);
2741+ skb = igc_construct_skb_zc(ring, ctx);
27362742 if (!skb) {
27372743 ring->rx_stats.alloc_failed++;
27382744 set_bit(IGC_RING_FLAG_RX_ALLOC_FAILED, &ring->flags);
27392745 return;
27402746 }
27412747
2742− if (timestamp)
2743− skb_hwtstamps(skb)->hwtstamp = timestamp;
2744−
27452748 if (igc_cleanup_headers(ring, desc, skb))
27462749 return;
27472750
@@ -2777,7 +2780,6 @@ static int igc_clean_rx_irq_zc(struct igc_q_vector *q_vector, const int budget) · 29 unmodified lines
27772780 union igc_adv_rx_desc *desc;
27782781 struct igc_rx_buffer *bi;
27792782 struct igc_xdp_buff *ctx;
2780− ktime_t timestamp = 0;
27812783 unsigned int size;
27822784 int res;
27832785
@@ -2807,6 +2809,8 @@ static int igc_clean_rx_irq_zc(struct igc_q_vector *q_vector, const int budget) · 23 unmodified lines
28072809 */
28082810 bi->xdp->data_meta += IGC_TS_HDR_LEN;
28092811 size -= IGC_TS_HDR_LEN;
2812+ } else {
2813+ ctx->rx_ts = NULL;
28102814 }
28112815
28122816 bi->xdp->data_end = bi->xdp->data + size;
@@ -2815,7 +2819,7 @@ static int igc_clean_rx_irq_zc(struct igc_q_vector *q_vector, const int budget) · 2 unmodified lines
28152819 res = __igc_xdp_run_prog(adapter, prog, bi->xdp);
28162820 switch (res) {
28172821 case IGC_XDP_PASS:
2818− igc_dispatch_skb_zc(q_vector, desc, bi->xdp, timestamp);
2822+ igc_dispatch_skb_zc(q_vector, desc, ctx);
28192823 fallthrough;
28202824 case IGC_XDP_CONSUMED:
28212825 xsk_buff_free(bi->xdp);
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+1−1
@@ -2105,7 +2105,7 @@ static void ixgbe_put_rx_buffer(struct ixgbe_ring *rx_ring, · 2104 unmodified lines
21052105 /* hand second half of page back to the ring */
21062106 ixgbe_reuse_rx_page(rx_ring, rx_buffer);
21072107 } else {
2108− if (!IS_ERR(skb) && IXGBE_CB(skb)->dma == rx_buffer->dma) {
2108+ if (skb && IXGBE_CB(skb)->dma == rx_buffer->dma) {
21092109 /* the page has been released from the ring */
21102110 IXGBE_CB(skb)->page_released = true;
21112111 } else {
drivers/net/ethernet/mellanox/mlxsw/spectrum_ethtool.c+3−1
@@ -768,7 +768,9 @@ static void __mlxsw_sp_port_get_stats(struct net_device *dev, · 767 unmodified lines
768768 err = mlxsw_sp_get_hw_stats_by_group(&hw_stats, &len, grp);
769769 if (err)
770770 return;
771− mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
771+ err = mlxsw_sp_port_get_stats_raw(dev, grp, prio, ppcnt_pl);
772+ if (err)
773+ return;
772774 for (i = 0; i < len; i++) {
773775 data[data_index + i] = hw_stats[i].getter(ppcnt_pl);
774776 if (!hw_stats[i].cells_bytes)
drivers/net/ethernet/netronome/nfp/bpf/cmsg.c+2−0
@@ -20,6 +20,8 @@ nfp_bpf_cmsg_alloc(struct nfp_app_bpf *bpf, unsigned int size) · 19 unmodified lines
2020 struct sk_buff *skb;
2121
2222 skb = nfp_app_ctrl_msg_alloc(bpf->app, size, GFP_KERNEL);
23+ if (!skb)
24+ return NULL;
2325 skb_put(skb, size);
2426
2527 return skb;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+22−18
@@ -2094,6 +2094,11 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv, · 2093 unmodified lines
20942094 pp_params.offset = stmmac_rx_offset(priv);
20952095 pp_params.max_len = dma_conf->dma_buf_sz;
20962096
2097+ if (priv->sph) {
2098+ pp_params.offset = 0;
2099+ pp_params.max_len += stmmac_rx_offset(priv);
2100+ }
2101+
20972102 rx_q->page_pool = page_pool_create(&pp_params);
20982103 if (IS_ERR(rx_q->page_pool)) {
20992104 ret = PTR_ERR(rx_q->page_pool);
@@ -2424,6 +2429,11 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv) · 324 unmodified lines
24242429 u32 chan = 0;
24252430 u8 qmode = 0;
24262431
2432+ if (rxfifosz == 0)
2433+ rxfifosz = priv->dma_cap.rx_fifo_size;
2434+ if (txfifosz == 0)
2435+ txfifosz = priv->dma_cap.tx_fifo_size;
2436+
24272437 /* Split up the shared Tx/Rx FIFO memory on DW QoS Eth and DW XGMAC */
24282438 if (priv->plat->has_gmac4 || priv->plat->has_xgmac) {
24292439 rxfifosz /= rx_channels_count;
@@ -2892,6 +2902,11 @@ static void stmmac_set_dma_operation_mode(struct stmmac_priv *priv, u32 txmode, · 462 unmodified lines
28922902 int rxfifosz = priv->plat->rx_fifo_size;
28932903 int txfifosz = priv->plat->tx_fifo_size;
28942904
2905+ if (rxfifosz == 0)
2906+ rxfifosz = priv->dma_cap.rx_fifo_size;
2907+ if (txfifosz == 0)
2908+ txfifosz = priv->dma_cap.tx_fifo_size;
2909+
28952910 /* Adjust for real per queue fifo size */
28962911 rxfifosz /= rx_channels_count;
28972912 txfifosz /= tx_channels_count;
@@ -5868,6 +5883,9 @@ static int stmmac_change_mtu(struct net_device *dev, int new_mtu) · 2970 unmodified lines
58685883 const int mtu = new_mtu;
58695884 int ret;
58705885
5886+ if (txfifosz == 0)
5887+ txfifosz = priv->dma_cap.tx_fifo_size;
5888+
58715889 txfifosz /= priv->plat->tx_queues_to_use;
58725890
58735891 if (stmmac_xdp_is_enabled(priv) && new_mtu > ETH_DATA_LEN) {
@@ -7219,29 +7237,15 @@ static int stmmac_hw_init(struct stmmac_priv *priv) · 1345 unmodified lines
72197237 priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues;
72207238 }
72217239
7222− if (!priv->plat->rx_fifo_size) {
7223− if (priv->dma_cap.rx_fifo_size) {
7224− priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
7225− } else {
7226− dev_err(priv->device, "Can't specify Rx FIFO size\n");
7227− return -ENODEV;
7228− }
7229− } else if (priv->dma_cap.rx_fifo_size &&
7230− priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) {
7240+ if (priv->dma_cap.rx_fifo_size &&
7241+ priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) {
72317242 dev_warn(priv->device,
72327243 "Rx FIFO size (%u) exceeds dma capability\n",
72337244 priv->plat->rx_fifo_size);
72347245 priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size;
72357246 }
7236− if (!priv->plat->tx_fifo_size) {
7237− if (priv->dma_cap.tx_fifo_size) {
7238− priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size;
7239− } else {
7240− dev_err(priv->device, "Can't specify Tx FIFO size\n");
7241− return -ENODEV;
7242− }
7243− } else if (priv->dma_cap.tx_fifo_size &&
7244− priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) {
7247+ if (priv->dma_cap.tx_fifo_size &&
7248+ priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) {
72457249 dev_warn(priv->device,
72467250 "Tx FIFO size (%u) exceeds dma capability\n",
72477251 priv->plat->tx_fifo_size);
drivers/net/ethernet/ti/am65-cpsw-nuss.c+31−19
@@ -828,21 +828,30 @@ static void am65_cpsw_nuss_xmit_free(struct am65_cpsw_tx_chn *tx_chn, · 827 unmodified lines
828828 static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
829829 {
830830 struct am65_cpsw_tx_chn *tx_chn = data;
831+ enum am65_cpsw_tx_buf_type buf_type;
831832 struct cppi5_host_desc_t *desc_tx;
833+ struct xdp_frame *xdpf;
832834 struct sk_buff *skb;
833835 void **swdata;
834836
835837 desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool, desc_dma);
836838 swdata = cppi5_hdesc_get_swdata(desc_tx);
837− skb = *(swdata);
838− am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
839+ buf_type = am65_cpsw_nuss_buf_type(tx_chn, desc_dma);
840+ if (buf_type == AM65_CPSW_TX_BUF_TYPE_SKB) {
841+ skb = *(swdata);
842+ dev_kfree_skb_any(skb);
843+ } else {
844+ xdpf = *(swdata);
845+ xdp_return_frame(xdpf);
846+ }
839847
840− dev_kfree_skb_any(skb);
848+ am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
841849 }
842850
843851 static struct sk_buff *am65_cpsw_build_skb(void *page_addr,
844852 struct net_device *ndev,
845− unsigned int len)
853+ unsigned int len,
854+ unsigned int headroom)
846855 {
847856 struct sk_buff *skb;
848857
@@ -852,7 +861,7 @@ static struct sk_buff *am65_cpsw_build_skb(void *page_addr, · 3 unmodified lines
852861 if (unlikely(!skb))
853862 return NULL;
854863
855− skb_reserve(skb, AM65_CPSW_HEADROOM);
864+ skb_reserve(skb, headroom);
856865 skb->dev = ndev;
857866
858867 return skb;
@@ -1169,9 +1178,11 @@ static int am65_cpsw_run_xdp(struct am65_cpsw_rx_flow *flow, · 310 unmodified lines
11691178 struct xdp_frame *xdpf;
11701179 struct bpf_prog *prog;
11711180 struct page *page;
1181+ int pkt_len;
11721182 u32 act;
11731183 int err;
11741184
1185+ pkt_len = *len;
11751186 prog = READ_ONCE(port->xdp_prog);
11761187 if (!prog)
11771188 return AM65_CPSW_XDP_PASS;
@@ -1189,8 +1200,10 @@ static int am65_cpsw_run_xdp(struct am65_cpsw_rx_flow *flow, · 11 unmodified lines
11891200 netif_txq = netdev_get_tx_queue(ndev, tx_chn->id);
11901201
11911202 xdpf = xdp_convert_buff_to_frame(xdp);
1192− if (unlikely(!xdpf))
1203+ if (unlikely(!xdpf)) {
1204+ ndev->stats.tx_dropped++;
11931205 goto drop;
1206+ }
11941207
11951208 __netif_tx_lock(netif_txq, cpu);
11961209 err = am65_cpsw_xdp_tx_frame(ndev, tx_chn, xdpf,
@@ -1199,14 +1212,14 @@ static int am65_cpsw_run_xdp(struct am65_cpsw_rx_flow *flow, · 2 unmodified lines
11991212 if (err)
12001213 goto drop;
12011214
1202− dev_sw_netstats_tx_add(ndev, 1, *len);
1215+ dev_sw_netstats_rx_add(ndev, pkt_len);
12031216 ret = AM65_CPSW_XDP_CONSUMED;
12041217 goto out;
12051218 case XDP_REDIRECT:
12061219 if (unlikely(xdp_do_redirect(ndev, xdp, prog)))
12071220 goto drop;
12081221
1209− dev_sw_netstats_rx_add(ndev, *len);
1222+ dev_sw_netstats_rx_add(ndev, pkt_len);
12101223 ret = AM65_CPSW_XDP_REDIRECT;
12111224 goto out;
12121225 default:
@@ -1315,16 +1328,8 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_rx_flow *flow, · 102 unmodified lines
13151328 dev_dbg(dev, "%s rx csum_info:%#x\n", __func__, csum_info);
13161329
13171330 dma_unmap_single(rx_chn->dma_dev, buf_dma, buf_dma_len, DMA_FROM_DEVICE);
1318−
13191331 k3_cppi_desc_pool_free(rx_chn->desc_pool, desc_rx);
13201332
1321− skb = am65_cpsw_build_skb(page_addr, ndev,
1322− AM65_CPSW_MAX_PACKET_SIZE);
1323− if (unlikely(!skb)) {
1324− new_page = page;
1325− goto requeue;
1326− }
1327−
13281333 if (port->xdp_prog) {
13291334 xdp_init_buff(&xdp, PAGE_SIZE, &port->xdp_rxq[flow->id]);
13301335 xdp_prepare_buff(&xdp, page_addr, AM65_CPSW_HEADROOM,
@@ -1334,9 +1339,16 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_rx_flow *flow, · 3 unmodified lines
13341339 if (*xdp_state != AM65_CPSW_XDP_PASS)
13351340 goto allocate;
13361341
1337− /* Compute additional headroom to be reserved */
1338− headroom = (xdp.data - xdp.data_hard_start) - skb_headroom(skb);
1339− skb_reserve(skb, headroom);
1342+ headroom = xdp.data - xdp.data_hard_start;
1343+ } else {
1344+ headroom = AM65_CPSW_HEADROOM;
1345+ }
1346+
1347+ skb = am65_cpsw_build_skb(page_addr, ndev,
1348+ AM65_CPSW_MAX_PACKET_SIZE, headroom);
1349+ if (unlikely(!skb)) {
1350+ new_page = page;
1351+ goto requeue;
13401352 }
13411353
13421354 ndev_priv = netdev_priv(ndev);
drivers/net/ethernet/xilinx/xilinx_axienet_main.c+1−0
@@ -2897,6 +2897,7 @@ static int axienet_probe(struct platform_device *pdev) · 2896 unmodified lines
28972897
28982898 lp->phylink_config.dev = &ndev->dev;
28992899 lp->phylink_config.type = PHYLINK_NETDEV;
2900+ lp->phylink_config.mac_managed_pm = true;
29002901 lp->phylink_config.mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE |
29012902 MAC_10FD | MAC_100FD | MAC_1000FD;
29022903
drivers/net/geneve.c+2−14
@@ -1902,21 +1902,9 @@ static void geneve_destroy_tunnels(struct net *net, struct list_head *head) · 1901 unmodified lines
19021902 {
19031903 struct geneve_net *gn = net_generic(net, geneve_net_id);
19041904 struct geneve_dev *geneve, *next;
1905− struct net_device *dev, *aux;
19061905
1907− /* gather any geneve devices that were moved into this ns */
1908− for_each_netdev_safe(net, dev, aux)
1909− if (dev->rtnl_link_ops == &geneve_link_ops)
1910− unregister_netdevice_queue(dev, head);
1911−
1912− /* now gather any other geneve devices that were created in this ns */
1913− list_for_each_entry_safe(geneve, next, &gn->geneve_list, next) {
1914− /* If geneve->dev is in the same netns, it was already added
1915− * to the list by the previous loop.
1916− */
1917− if (!net_eq(dev_net(geneve->dev), net))
1918− unregister_netdevice_queue(geneve->dev, head);
1919− }
1906+ list_for_each_entry_safe(geneve, next, &gn->geneve_list, next)
1907+ geneve_dellink(geneve->dev, head);
19201908 }
19211909
19221910 static void __net_exit geneve_exit_batch_rtnl(struct list_head *net_list,
drivers/net/gtp.c+0−5
@@ -2481,11 +2481,6 @@ static void __net_exit gtp_net_exit_batch_rtnl(struct list_head *net_list, · 2480 unmodified lines
24812481 list_for_each_entry(net, net_list, exit_list) {
24822482 struct gtp_net *gn = net_generic(net, gtp_net_id);
24832483 struct gtp_dev *gtp, *gtp_next;
2484− struct net_device *dev;
2485−
2486− for_each_netdev(net, dev)
2487− if (dev->rtnl_link_ops == &gtp_link_ops)
2488− gtp_dellink(dev, dev_to_kill);
24892484
24902485 list_for_each_entry_safe(gtp, gtp_next, &gn->gtp_dev_list, list)
24912486 gtp_dellink(gtp->dev, dev_to_kill);
drivers/net/phy/phylink.c+9−6
@@ -2265,12 +2265,15 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, · 2264 unmodified lines
22652265 /* Allow the MAC to stop its clock if the PHY has the capability */
22662266 pl->mac_tx_clk_stop = phy_eee_tx_clock_stop_capable(phy) > 0;
22672267
2268− /* Explicitly configure whether the PHY is allowed to stop it's
2269− * receive clock.
2270− */
2271− ret = phy_eee_rx_clock_stop(phy, pl->config->eee_rx_clk_stop_enable);
2272− if (ret == -EOPNOTSUPP)
2273− ret = 0;
2268+ if (pl->mac_supports_eee_ops) {
2269+ /* Explicitly configure whether the PHY is allowed to stop it's
2270+ * receive clock.
2271+ */
2272+ ret = phy_eee_rx_clock_stop(phy,
2273+ pl->config->eee_rx_clk_stop_enable);
2274+ if (ret == -EOPNOTSUPP)
2275+ ret = 0;
2276+ }
22742277
22752278 return ret;
22762279 }
drivers/net/pse-pd/pd692x0.c+1−1
@@ -1047,7 +1047,7 @@ static int pd692x0_pi_get_pw_limit(struct pse_controller_dev *pcdev, · 1046 unmodified lines
10471047 if (ret < 0)
10481048 return ret;
10491049
1050− return pd692x0_pi_get_pw_from_table(buf.data[2], buf.data[3]);
1050+ return pd692x0_pi_get_pw_from_table(buf.data[0], buf.data[1]);
10511051 }
10521052
10531053 static int pd692x0_pi_set_pw_limit(struct pse_controller_dev *pcdev,
drivers/net/pse-pd/pse_core.c+2−2
@@ -319,7 +319,7 @@ static int pse_pi_get_current_limit(struct regulator_dev *rdev) · 318 unmodified lines
319319 goto out;
320320 mW = ret;
321321
322− ret = pse_pi_get_voltage(rdev);
322+ ret = _pse_pi_get_voltage(rdev);
323323 if (!ret) {
324324 dev_err(pcdev->dev, "Voltage null\n");
325325 ret = -ERANGE;
@@ -356,7 +356,7 @@ static int pse_pi_set_current_limit(struct regulator_dev *rdev, int min_uA, · 30 unmodified lines
356356
357357 id = rdev_get_id(rdev);
358358 mutex_lock(&pcdev->lock);
359− ret = pse_pi_get_voltage(rdev);
359+ ret = _pse_pi_get_voltage(rdev);
360360 if (!ret) {
361361 dev_err(pcdev->dev, "Voltage null\n");
362362 ret = -ERANGE;
drivers/net/team/team_core.c+3−1
@@ -2639,7 +2639,9 @@ int team_nl_options_set_doit(struct sk_buff *skb, struct genl_info *info) · 2638 unmodified lines
26392639 ctx.data.u32_val = nla_get_u32(attr_data);
26402640 break;
26412641 case TEAM_OPTION_TYPE_STRING:
2642− if (nla_len(attr_data) > TEAM_STRING_MAX_LEN) {
2642+ if (nla_len(attr_data) > TEAM_STRING_MAX_LEN ||
2643+ !memchr(nla_data(attr_data), '\0',
2644+ nla_len(attr_data))) {
26432645 err = -EINVAL;
26442646 goto team_put;
26452647 }
drivers/net/tun.c+5−9
@@ -574,18 +574,14 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb, · 573 unmodified lines
574574 return ret;
575575 }
576576
577−static inline bool tun_capable(struct tun_struct *tun)
577+static inline bool tun_not_capable(struct tun_struct *tun)
578578 {
579579 const struct cred *cred = current_cred();
580580 struct net *net = dev_net(tun->dev);
581581
582− if (ns_capable(net->user_ns, CAP_NET_ADMIN))
583− return 1;
584− if (uid_valid(tun->owner) && uid_eq(cred->euid, tun->owner))
585− return 1;
586− if (gid_valid(tun->group) && in_egroup_p(tun->group))
587− return 1;
588− return 0;
582+ return ((uid_valid(tun->owner) && !uid_eq(cred->euid, tun->owner)) ||
583+ (gid_valid(tun->group) && !in_egroup_p(tun->group))) &&
584+ !ns_capable(net->user_ns, CAP_NET_ADMIN);
589585 }
590586
591587 static void tun_set_real_num_queues(struct tun_struct *tun)
@@ -2782,7 +2778,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) · 2190 unmodified lines
27822778 !!(tun->flags & IFF_MULTI_QUEUE))
27832779 return -EINVAL;
27842780
2785− if (!tun_capable(tun))
2781+ if (tun_not_capable(tun))
27862782 return -EPERM;
27872783 err = security_tun_dev_open(tun->security);
27882784 if (err < 0)
drivers/net/vmxnet3/vmxnet3_xdp.c+12−2
@@ -28,7 +28,7 @@ vmxnet3_xdp_get_tq(struct vmxnet3_adapter *adapter) · 27 unmodified lines
2828 if (likely(cpu < tq_number))
2929 tq = &adapter->tx_queue[cpu];
3030 else
31− tq = &adapter->tx_queue[reciprocal_scale(cpu, tq_number)];
31+ tq = &adapter->tx_queue[cpu % tq_number];
3232
3333 return tq;
3434 }
@@ -124,6 +124,7 @@ vmxnet3_xdp_xmit_frame(struct vmxnet3_adapter *adapter, · 89 unmodified lines
124124 u32 buf_size;
125125 u32 dw2;
126126
127+ spin_lock_irq(&tq->tx_lock);
127128 dw2 = (tq->tx_ring.gen ^ 0x1) << VMXNET3_TXD_GEN_SHIFT;
128129 dw2 |= xdpf->len;
129130 ctx.sop_txd = tq->tx_ring.base + tq->tx_ring.next2fill;
@@ -134,6 +135,7 @@ vmxnet3_xdp_xmit_frame(struct vmxnet3_adapter *adapter, · 4 unmodified lines
134135
135136 if (vmxnet3_cmd_ring_desc_avail(&tq->tx_ring) == 0) {
136137 tq->stats.tx_ring_full++;
138+ spin_unlock_irq(&tq->tx_lock);
137139 return -ENOSPC;
138140 }
139141
@@ -142,8 +144,10 @@ vmxnet3_xdp_xmit_frame(struct vmxnet3_adapter *adapter, · 2 unmodified lines
142144 tbi->dma_addr = dma_map_single(&adapter->pdev->dev,
143145 xdpf->data, buf_size,
144146 DMA_TO_DEVICE);
145− if (dma_mapping_error(&adapter->pdev->dev, tbi->dma_addr))
147+ if (dma_mapping_error(&adapter->pdev->dev, tbi->dma_addr)) {
148+ spin_unlock_irq(&tq->tx_lock);
146149 return -EFAULT;
150+ }
147151 tbi->map_type |= VMXNET3_MAP_SINGLE;
148152 } else { /* XDP buffer from page pool */
149153 page = virt_to_page(xdpf->data);
@@ -182,6 +186,7 @@ vmxnet3_xdp_xmit_frame(struct vmxnet3_adapter *adapter, · 32 unmodified lines
182186 dma_wmb();
183187 gdesc->dword[2] = cpu_to_le32(le32_to_cpu(gdesc->dword[2]) ^
184188 VMXNET3_TXD_GEN);
189+ spin_unlock_irq(&tq->tx_lock);
185190
186191 /* No need to handle the case when tx_num_deferred doesn't reach
187192 * threshold. Backend driver at hypervisor side will poll and reset
@@ -225,6 +230,7 @@ vmxnet3_xdp_xmit(struct net_device *dev, · 37 unmodified lines
225230 {
226231 struct vmxnet3_adapter *adapter = netdev_priv(dev);
227232 struct vmxnet3_tx_queue *tq;
233+ struct netdev_queue *nq;
228234 int i;
229235
230236 if (unlikely(test_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state)))
@@ -236,6 +242,9 @@ vmxnet3_xdp_xmit(struct net_device *dev, · 5 unmodified lines
236242 if (tq->stopped)
237243 return -ENETDOWN;
238244
245+ nq = netdev_get_tx_queue(adapter->netdev, tq->qid);
246+
247+ __netif_tx_lock(nq, smp_processor_id());
239248 for (i = 0; i < n; i++) {
240249 if (vmxnet3_xdp_xmit_frame(adapter, frames[i], tq, true)) {
241250 tq->stats.xdp_xmit_err++;
@@ -243,6 +252,7 @@ vmxnet3_xdp_xmit(struct net_device *dev, · 1 unmodified line
243252 }
244253 }
245254 tq->stats.xdp_xmit += i;
255+ __netif_tx_unlock(nq);
246256
247257 return i;
248258 }
drivers/net/vxlan/vxlan_core.c+5−2
@@ -2898,8 +2898,11 @@ static int vxlan_init(struct net_device *dev) · 2897 unmodified lines
28982898 struct vxlan_dev *vxlan = netdev_priv(dev);
28992899 int err;
29002900
2901− if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
2902− vxlan_vnigroup_init(vxlan);
2901+ if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
2902+ err = vxlan_vnigroup_init(vxlan);
2903+ if (err)
2904+ return err;
2905+ }
29032906
29042907 err = gro_cells_init(&vxlan->gro_cells, dev);
29052908 if (err)
drivers/net/wireless/ath/ath12k/wmi.c+45−16
@@ -4851,6 +4851,22 @@ static struct ath12k_reg_rule · 4850 unmodified lines
48514851 return reg_rule_ptr;
48524852 }
48534853
4854+static u8 ath12k_wmi_ignore_num_extra_rules(struct ath12k_wmi_reg_rule_ext_params *rule,
4855+ u32 num_reg_rules)
4856+{
4857+ u8 num_invalid_5ghz_rules = 0;
4858+ u32 count, start_freq;
4859+
4860+ for (count = 0; count < num_reg_rules; count++) {
4861+ start_freq = le32_get_bits(rule[count].freq_info, REG_RULE_START_FREQ);
4862+
4863+ if (start_freq >= ATH12K_MIN_6G_FREQ)
4864+ num_invalid_5ghz_rules++;
4865+ }
4866+
4867+ return num_invalid_5ghz_rules;
4868+}
4869+
48544870 static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab,
48554871 struct sk_buff *skb,
48564872 struct ath12k_reg_info *reg_info)
@@ -4861,6 +4877,7 @@ static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab, · 4 unmodified lines
48614877 u32 num_2g_reg_rules, num_5g_reg_rules;
48624878 u32 num_6g_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
48634879 u32 num_6g_reg_rules_cl[WMI_REG_CURRENT_MAX_AP_TYPE][WMI_REG_MAX_CLIENT_TYPE];
4880+ u8 num_invalid_5ghz_ext_rules;
48644881 u32 total_reg_rules = 0;
48654882 int ret, i, j;
48664883
@@ -4954,20 +4971,6 @@ static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab, · 87 unmodified lines
49544971
49554972 memcpy(reg_info->alpha2, &ev->alpha2, REG_ALPHA2_LEN);
49564973
4957− /* FIXME: Currently FW includes 6G reg rule also in 5G rule
4958− * list for country US.
4959− * Having same 6G reg rule in 5G and 6G rules list causes
4960− * intersect check to be true, and same rules will be shown
4961− * multiple times in iw cmd. So added hack below to avoid
4962− * parsing 6G rule from 5G reg rule list, and this can be
4963− * removed later, after FW updates to remove 6G reg rule
4964− * from 5G rules list.
4965− */
4966− if (memcmp(reg_info->alpha2, "US", 2) == 0) {
4967− reg_info->num_5g_reg_rules = REG_US_5G_NUM_REG_RULES;
4968− num_5g_reg_rules = reg_info->num_5g_reg_rules;
4969− }
4970−
49714974 reg_info->dfs_region = le32_to_cpu(ev->dfs_region);
49724975 reg_info->phybitmap = le32_to_cpu(ev->phybitmap);
49734976 reg_info->num_phy = le32_to_cpu(ev->num_phy);
@@ -5070,8 +5073,29 @@ static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab, · 96 unmodified lines
50705073 }
50715074 }
50725075
5076+ ext_wmi_reg_rule += num_2g_reg_rules;
5077+
5078+ /* Firmware might include 6 GHz reg rule in 5 GHz rule list
5079+ * for few countries along with separate 6 GHz rule.
5080+ * Having same 6 GHz reg rule in 5 GHz and 6 GHz rules list
5081+ * causes intersect check to be true, and same rules will be
5082+ * shown multiple times in iw cmd.
5083+ * Hence, avoid parsing 6 GHz rule from 5 GHz reg rule list
5084+ */
5085+ num_invalid_5ghz_ext_rules = ath12k_wmi_ignore_num_extra_rules(ext_wmi_reg_rule,
5086+ num_5g_reg_rules);
5087+
5088+ if (num_invalid_5ghz_ext_rules) {
5089+ ath12k_dbg(ab, ATH12K_DBG_WMI,
5090+ "CC: %s 5 GHz reg rules number %d from fw, %d number of invalid 5 GHz rules",
5091+ reg_info->alpha2, reg_info->num_5g_reg_rules,
5092+ num_invalid_5ghz_ext_rules);
5093+
5094+ num_5g_reg_rules = num_5g_reg_rules - num_invalid_5ghz_ext_rules;
5095+ reg_info->num_5g_reg_rules = num_5g_reg_rules;
5096+ }
5097+
50735098 if (num_5g_reg_rules) {
5074− ext_wmi_reg_rule += num_2g_reg_rules;
50755099 reg_info->reg_rules_5g_ptr =
50765100 create_ext_reg_rules_from_wmi(num_5g_reg_rules,
50775101 ext_wmi_reg_rule);
@@ -5083,7 +5107,12 @@ static int ath12k_pull_reg_chan_list_ext_update_ev(struct ath12k_base *ab, · 5 unmodified lines
50835107 }
50845108 }
50855109
5086− ext_wmi_reg_rule += num_5g_reg_rules;
5110+ /* We have adjusted the number of 5 GHz reg rules above. But still those
5111+ * many rules needs to be adjusted in ext_wmi_reg_rule.
5112+ *
5113+ * NOTE: num_invalid_5ghz_ext_rules will be 0 for rest other cases.
5114+ */
5115+ ext_wmi_reg_rule += (num_5g_reg_rules + num_invalid_5ghz_ext_rules);
50875116
50885117 for (i = 0; i < WMI_REG_CURRENT_MAX_AP_TYPE; i++) {
50895118 reg_info->reg_rules_6g_ap_ptr[i] =
drivers/net/wireless/ath/ath12k/wmi.h+0−1
@@ -4073,7 +4073,6 @@ struct ath12k_wmi_eht_rate_set_params { · 4072 unmodified lines
40734073 #define MAX_REG_RULES 10
40744074 #define REG_ALPHA2_LEN 2
40754075 #define MAX_6G_REG_RULES 5
4076−#define REG_US_5G_NUM_REG_RULES 4
40774076
40784077 enum wmi_start_event_param {
40794078 WMI_VDEV_START_RESP_EVENT = 0,
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c+2−2
@@ -2712,7 +2712,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = { · 2711 unmodified lines
27122712 BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID, WCC),
27132713 BRCMF_PCIE_DEVICE_SUB(0x4355, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4355, WCC),
27142714 BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_RAW_DEVICE_ID, WCC),
2715− BRCMF_PCIE_DEVICE(BRCM_PCIE_4355_DEVICE_ID, WCC),
2715+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4355_DEVICE_ID, WCC_SEED),
27162716 BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID, WCC),
27172717 BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID, WCC),
27182718 BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID, WCC),
@@ -2723,7 +2723,7 @@ static const struct pci_device_id brcmf_pcie_devid_table[] = { · 4 unmodified lines
27232723 BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_2G_DEVICE_ID, WCC),
27242724 BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_5G_DEVICE_ID, WCC),
27252725 BRCMF_PCIE_DEVICE(BRCM_PCIE_43602_RAW_DEVICE_ID, WCC),
2726− BRCMF_PCIE_DEVICE(BRCM_PCIE_4364_DEVICE_ID, WCC),
2726+ BRCMF_PCIE_DEVICE(BRCM_PCIE_4364_DEVICE_ID, WCC_SEED),
27272727 BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_DEVICE_ID, BCA),
27282728 BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_2G_DEVICE_ID, BCA),
27292729 BRCMF_PCIE_DEVICE(BRCM_PCIE_4365_5G_DEVICE_ID, BCA),
drivers/net/wwan/mhi_wwan_mbim.c+1−1
@@ -220,7 +220,7 @@ static int mbim_rx_verify_nth16(struct mhi_mbim_context *mbim, struct sk_buff *s · 219 unmodified lines
220220 if (mbim->rx_seq + 1 != le16_to_cpu(nth16->wSequence) &&
221221 (mbim->rx_seq || le16_to_cpu(nth16->wSequence)) &&
222222 !(mbim->rx_seq == 0xffff && !le16_to_cpu(nth16->wSequence))) {
223− net_err_ratelimited("sequence number glitch prev=%d curr=%d\n",
223+ net_dbg_ratelimited("sequence number glitch prev=%d curr=%d\n",
224224 mbim->rx_seq, le16_to_cpu(nth16->wSequence));
225225 }
226226 mbim->rx_seq = le16_to_cpu(nth16->wSequence);
drivers/nvme/host/core.c+7−1
@@ -1700,7 +1700,13 @@ int nvme_set_queue_count(struct nvme_ctrl *ctrl, int *count) · 1699 unmodified lines
17001700
17011701 status = nvme_set_features(ctrl, NVME_FEAT_NUM_QUEUES, q_count, NULL, 0,
17021702 &result);
1703− if (status < 0)
1703+
1704+ /*
1705+ * It's either a kernel error or the host observed a connection
1706+ * lost. In either case it's not possible communicate with the
1707+ * controller and thus enter the error code path.
1708+ */
1709+ if (status < 0 || status == NVME_SC_HOST_PATH_ERROR)
17041710 return status;
17051711
17061712 /*
drivers/nvme/host/fc.c+25−10
@@ -781,11 +781,19 @@ restart: · 780 unmodified lines
781781 static void
782782 nvme_fc_ctrl_connectivity_loss(struct nvme_fc_ctrl *ctrl)
783783 {
784+ enum nvme_ctrl_state state;
785+ unsigned long flags;
786+
784787 dev_info(ctrl->ctrl.device,
785788 "NVME-FC{%d}: controller connectivity lost. Awaiting "
786789 "Reconnect", ctrl->cnum);
787790
788− switch (nvme_ctrl_state(&ctrl->ctrl)) {
791+ spin_lock_irqsave(&ctrl->lock, flags);
792+ set_bit(ASSOC_FAILED, &ctrl->flags);
793+ state = nvme_ctrl_state(&ctrl->ctrl);
794+ spin_unlock_irqrestore(&ctrl->lock, flags);
795+
796+ switch (state) {
789797 case NVME_CTRL_NEW:
790798 case NVME_CTRL_LIVE:
791799 /*
@@ -2079,7 +2087,8 @@ done: · 1287 unmodified lines
20792087 nvme_fc_complete_rq(rq);
20802088
20812089 check_error:
2082− if (terminate_assoc && ctrl->ctrl.state != NVME_CTRL_RESETTING)
2090+ if (terminate_assoc &&
2091+ nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_RESETTING)
20832092 queue_work(nvme_reset_wq, &ctrl->ioerr_work);
20842093 }
20852094
@@ -2533,6 +2542,8 @@ __nvme_fc_abort_outstanding_ios(struct nvme_fc_ctrl *ctrl, bool start_queues) · 447 unmodified lines
25332542 static void
25342543 nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
25352544 {
2545+ enum nvme_ctrl_state state = nvme_ctrl_state(&ctrl->ctrl);
2546+
25362547 /*
25372548 * if an error (io timeout, etc) while (re)connecting, the remote
25382549 * port requested terminating of the association (disconnect_ls)
@@ -2540,9 +2551,8 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) · 1 unmodified line
25402551 * the controller. Abort any ios on the association and let the
25412552 * create_association error path resolve things.
25422553 */
2543− if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
2554+ if (state == NVME_CTRL_CONNECTING) {
25442555 __nvme_fc_abort_outstanding_ios(ctrl, true);
2545− set_bit(ASSOC_FAILED, &ctrl->flags);
25462556 dev_warn(ctrl->ctrl.device,
25472557 "NVME-FC{%d}: transport error during (re)connect\n",
25482558 ctrl->cnum);
@@ -2550,7 +2560,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg) · 1 unmodified line
25502560 }
25512561
25522562 /* Otherwise, only proceed if in LIVE state - e.g. on first error */
2553− if (ctrl->ctrl.state != NVME_CTRL_LIVE)
2563+ if (state != NVME_CTRL_LIVE)
25542564 return;
25552565
25562566 dev_warn(ctrl->ctrl.device,
@@ -3167,12 +3177,18 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) · 610 unmodified lines
31673177 else
31683178 ret = nvme_fc_recreate_io_queues(ctrl);
31693179 }
3170− if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
3171− ret = -EIO;
31723180 if (ret)
31733181 goto out_term_aen_ops;
31743182
3175− changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
3183+ spin_lock_irqsave(&ctrl->lock, flags);
3184+ if (!test_bit(ASSOC_FAILED, &ctrl->flags))
3185+ changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
3186+ else
3187+ ret = -EIO;
3188+ spin_unlock_irqrestore(&ctrl->lock, flags);
3189+
3190+ if (ret)
3191+ goto out_term_aen_ops;
31763192
31773193 ctrl->ctrl.nr_reconnects = 0;
31783194
@@ -3578,8 +3594,7 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, · 399 unmodified lines
35783594 list_add_tail(&ctrl->ctrl_list, &rport->ctrl_list);
35793595 spin_unlock_irqrestore(&rport->lock, flags);
35803596
3581− if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING) ||
3582− !nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
3597+ if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) {
35833598 dev_err(ctrl->ctrl.device,
35843599 "NVME-FC{%d}: failed to init ctrl state\n", ctrl->cnum);
35853600 goto fail_ctrl;
drivers/nvme/host/pci.c+3−9
@@ -2153,14 +2153,6 @@ static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred, · 2152 unmodified lines
21532153 return 0;
21542154
21552155 out_free_bufs:
2156− while (--i >= 0) {
2157− size_t size = le32_to_cpu(descs[i].size) * NVME_CTRL_PAGE_SIZE;
2158−
2159− dma_free_attrs(dev->dev, size, bufs[i],
2160− le64_to_cpu(descs[i].addr),
2161− DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
2162− }
2163−
21642156 kfree(bufs);
21652157 out_free_descs:
21662158 dma_free_coherent(dev->dev, descs_size, descs, descs_dma);
@@ -3147,7 +3139,9 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev) · 980 unmodified lines
31473139 * because of high power consumption (> 2 Watt) in s2idle
31483140 * sleep. Only some boards with Intel CPU are affected.
31493141 */
3150− if (dmi_match(DMI_BOARD_NAME, "GMxPXxx") ||
3142+ if (dmi_match(DMI_BOARD_NAME, "DN50Z-140HC-YD") ||
3143+ dmi_match(DMI_BOARD_NAME, "GMxPXxx") ||
3144+ dmi_match(DMI_BOARD_NAME, "GXxMRXx") ||
31513145 dmi_match(DMI_BOARD_NAME, "PH4PG31") ||
31523146 dmi_match(DMI_BOARD_NAME, "PH4PRX1_PH6PRX1") ||
31533147 dmi_match(DMI_BOARD_NAME, "PH6PG01_PH6PG71"))
drivers/nvme/host/sysfs.c+1−1
@@ -792,7 +792,7 @@ static umode_t nvme_tls_attrs_are_visible(struct kobject *kobj, · 791 unmodified lines
792792 return a->mode;
793793 }
794794
795−const struct attribute_group nvme_tls_attrs_group = {
795+static const struct attribute_group nvme_tls_attrs_group = {
796796 .attrs = nvme_tls_attrs,
797797 .is_visible = nvme_tls_attrs_are_visible,
798798 };
drivers/nvme/target/admin-cmd.c+1−0
@@ -1068,6 +1068,7 @@ static void nvme_execute_identify_ns_nvm(struct nvmet_req *req) · 1067 unmodified lines
10681068 goto out;
10691069 }
10701070 status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id));
1071+ kfree(id);
10711072 out:
10721073 nvmet_req_complete(req, status);
10731074 }
drivers/nvme/target/fabrics-cmd.c+1−1
@@ -287,7 +287,7 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req) · 286 unmodified lines
287287 args.subsysnqn = d->subsysnqn;
288288 args.hostnqn = d->hostnqn;
289289 args.hostid = &d->hostid;
290− args.kato = c->kato;
290+ args.kato = le32_to_cpu(c->kato);
291291
292292 ctrl = nvmet_alloc_ctrl(&args);
293293 if (!ctrl)
drivers/nvme/target/io-cmd-bdev.c+1−1
@@ -272,7 +272,7 @@ static void nvmet_bdev_execute_rw(struct nvmet_req *req) · 271 unmodified lines
272272 iter_flags = SG_MITER_FROM_SG;
273273 }
274274
275− if (req->cmd->rw.control & NVME_RW_LR)
275+ if (req->cmd->rw.control & cpu_to_le16(NVME_RW_LR))
276276 opf |= REQ_FAILFAST_DEV;
277277
278278 if (is_pci_p2pdma_page(sg_page(req->sg)))
drivers/nvme/target/nvmet.h+1−1
@@ -589,7 +589,7 @@ struct nvmet_alloc_ctrl_args { · 588 unmodified lines
589589 const struct nvmet_fabrics_ops *ops;
590590 struct device *p2p_client;
591591 u32 kato;
592− u32 result;
592+ __le32 result;
593593 u16 error_loc;
594594 u16 status;
595595 };
drivers/of/address.c+4−1
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616 #include <linux/string.h>
1717 #include <linux/dma-direct.h> /* for bus_dma_region */
1818
19+#include <kunit/visibility.h>
20+
1921 /* Uncomment me to enable of_dump_addr() debugging output */
2022 // #define DEBUG
2123
@@ -183,7 +185,7 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns, · 161 unmodified lines
183185
184186 #endif /* CONFIG_PCI */
185187
186−static int __of_address_resource_bounds(struct resource *r, u64 start, u64 size)
188+VISIBLE_IF_KUNIT int __of_address_resource_bounds(struct resource *r, u64 start, u64 size)
187189 {
188190 if (overflows_type(start, r->start))
189191 return -EOVERFLOW;
@@ -197,6 +199,7 @@ static int __of_address_resource_bounds(struct resource *r, u64 start, u64 size) · 7 unmodified lines
197199
198200 return 0;
199201 }
202+EXPORT_SYMBOL_IF_KUNIT(__of_address_resource_bounds);
200203
201204 /*
202205 * of_pci_range_to_resource - Create a resource from an of_pci_range
drivers/of/of_private.h+4−0
@@ -208,4 +208,8 @@ static void __maybe_unused of_dump_addr(const char *s, const __be32 *addr, int n · 207 unmodified lines
208208 static void __maybe_unused of_dump_addr(const char *s, const __be32 *addr, int na) { }
209209 #endif
210210
211+#if IS_ENABLED(CONFIG_KUNIT)
212+int __of_address_resource_bounds(struct resource *r, u64 start, u64 size);
213+#endif
214+
211215 #endif /* _LINUX_OF_PRIVATE_H */
drivers/of/of_test.c+118−1
@@ -2,6 +2,7 @@ · 1 unmodified line
22 /*
33 * KUnit tests for OF APIs
44 */
5+#include <linux/ioport.h>
56 #include <linux/module.h>
67 #include <linux/of.h>
78
@@ -54,8 +55,124 @@ static struct kunit_suite of_dtb_suite = { · 46 unmodified lines
5455 .init = of_dtb_test_init,
5556 };
5657
58+struct of_address_resource_bounds_case {
59+ u64 start;
60+ u64 size;
61+ int ret;
62+
63+ u64 res_start;
64+ u64 res_end;
65+};
66+
67+static void of_address_resource_bounds_case_desc(const struct of_address_resource_bounds_case *p,
68+ char *name)
69+{
70+ snprintf(name, KUNIT_PARAM_DESC_SIZE, "start=0x%016llx,size=0x%016llx", p->start, p->size);
71+}
72+
73+static const struct of_address_resource_bounds_case of_address_resource_bounds_cases[] = {
74+ {
75+ .start = 0,
76+ .size = 0,
77+ .ret = 0,
78+ .res_start = 0,
79+ .res_end = -1,
80+ },
81+ {
82+ .start = 0,
83+ .size = 0x1000,
84+ .ret = 0,
85+ .res_start = 0,
86+ .res_end = 0xfff,
87+ },
88+ {
89+ .start = 0x1000,
90+ .size = 0,
91+ .ret = 0,
92+ .res_start = 0x1000,
93+ .res_end = 0xfff,
94+ },
95+ {
96+ .start = 0x1000,
97+ .size = 0x1000,
98+ .ret = 0,
99+ .res_start = 0x1000,
100+ .res_end = 0x1fff,
101+ },
102+ {
103+ .start = 1,
104+ .size = RESOURCE_SIZE_MAX,
105+ .ret = 0,
106+ .res_start = 1,
107+ .res_end = RESOURCE_SIZE_MAX,
108+ },
109+ {
110+ .start = RESOURCE_SIZE_MAX,
111+ .size = 1,
112+ .ret = 0,
113+ .res_start = RESOURCE_SIZE_MAX,
114+ .res_end = RESOURCE_SIZE_MAX,
115+ },
116+ {
117+ .start = 2,
118+ .size = RESOURCE_SIZE_MAX,
119+ .ret = -EOVERFLOW,
120+ },
121+ {
122+ .start = RESOURCE_SIZE_MAX,
123+ .size = 2,
124+ .ret = -EOVERFLOW,
125+ },
126+ {
127+ .start = ULL(0x100000000),
128+ .size = 1,
129+ .ret = sizeof(resource_size_t) > sizeof(u32) ? 0 : -EOVERFLOW,
130+ .res_start = ULL(0x100000000),
131+ .res_end = ULL(0x100000000),
132+ },
133+ {
134+ .start = 0x1000,
135+ .size = 0xffffffff,
136+ .ret = sizeof(resource_size_t) > sizeof(u32) ? 0 : -EOVERFLOW,
137+ .res_start = 0x1000,
138+ .res_end = ULL(0x100000ffe),
139+ },
140+};
141+
142+KUNIT_ARRAY_PARAM(of_address_resource_bounds,
143+ of_address_resource_bounds_cases, of_address_resource_bounds_case_desc);
144+
145+static void of_address_resource_bounds(struct kunit *test)
146+{
147+ const struct of_address_resource_bounds_case *param = test->param_value;
148+ struct resource r; /* Intentionally uninitialized */
149+ int ret;
150+
151+ if (!IS_ENABLED(CONFIG_OF_ADDRESS))
152+ kunit_skip(test, "CONFIG_OF_ADDRESS not enabled\n");
153+
154+ ret = __of_address_resource_bounds(&r, param->start, param->size);
155+ KUNIT_EXPECT_EQ(test, param->ret, ret);
156+ if (ret == 0) {
157+ KUNIT_EXPECT_EQ(test, (resource_size_t)param->res_start, r.start);
158+ KUNIT_EXPECT_EQ(test, (resource_size_t)param->res_end, r.end);
159+ KUNIT_EXPECT_EQ(test, param->size, resource_size(&r));
160+ }
161+}
162+
163+static struct kunit_case of_address_test_cases[] = {
164+ KUNIT_CASE_PARAM(of_address_resource_bounds, of_address_resource_bounds_gen_params),
165+ {}
166+};
167+
168+static struct kunit_suite of_address_suite = {
169+ .name = "of_address",
170+ .test_cases = of_address_test_cases,
171+};
172+
57173 kunit_test_suites(
58− &of_dtb_suite,
174+ &of_dtb_suite, &of_address_suite,
59175 );
60176 MODULE_DESCRIPTION("KUnit tests for OF APIs");
177+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
61178 MODULE_LICENSE("GPL");
drivers/pci/pcie/aspm.c+0−3
@@ -108,9 +108,6 @@ void pci_save_aspm_l1ss_state(struct pci_dev *pdev) · 107 unmodified lines
108108 pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CTL2, cap++);
109109 pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CTL1, cap++);
110110
111− if (parent->state_saved)
112− return;
113−
114111 /*
115112 * Save parent's L1 substate configuration so we have it for
116113 * pci_restore_aspm_l1ss_state(pdev) to restore.
drivers/pci/probe.c+3−2
@@ -339,13 +339,14 @@ out: · 338 unmodified lines
339339 return (res->flags & IORESOURCE_MEM_64) ? 1 : 0;
340340 }
341341
342−static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
342+static __always_inline void pci_read_bases(struct pci_dev *dev,
343+ unsigned int howmany, int rom)
343344 {
344345 u32 rombar, stdbars[PCI_STD_NUM_BARS];
345346 unsigned int pos, reg;
346347 u16 orig_cmd;
347348
348− BUILD_BUG_ON(howmany > PCI_STD_NUM_BARS);
349+ BUILD_BUG_ON(statically_true(howmany > PCI_STD_NUM_BARS));
349350
350351 if (dev->non_compliant_bars)
351352 return;
drivers/pci/quirks.c+2−1
@@ -5522,7 +5522,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x443, quirk_intel_qat_vf_cap); · 5521 unmodified lines
55225522 * AMD Matisse USB 3.0 Host Controller 0x149c
55235523 * Intel 82579LM Gigabit Ethernet Controller 0x1502
55245524 * Intel 82579V Gigabit Ethernet Controller 0x1503
5525− *
5525+ * Mediatek MT7922 802.11ax PCI Express Wireless Network Adapter
55265526 */
55275527 static void quirk_no_flr(struct pci_dev *dev)
55285528 {
@@ -5534,6 +5534,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x149c, quirk_no_flr); · 5 unmodified lines
55345534 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AMD, 0x7901, quirk_no_flr);
55355535 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1502, quirk_no_flr);
55365536 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1503, quirk_no_flr);
5537+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_MEDIATEK, 0x0616, quirk_no_flr);
55375538
55385539 /* FLR may cause the SolidRun SNET DPU (rev 0x1) to hang */
55395540 static void quirk_no_flr_snet(struct pci_dev *dev)
drivers/pci/tph.c+1−1
@@ -360,7 +360,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag) · 359 unmodified lines
360360 return err;
361361 }
362362
363− set_ctrl_reg_req_en(pdev, pdev->tph_mode);
363+ set_ctrl_reg_req_en(pdev, pdev->tph_req_type);
364364
365365 pci_dbg(pdev, "set steering tag: %s table, index=%d, tag=%#04x\n",
366366 (loc == PCI_TPH_LOC_MSIX) ? "MSI-X" : "ST", index, tag);
drivers/pinctrl/pinconf-generic.c+4−4
@@ -89,12 +89,12 @@ static void pinconf_generic_dump_one(struct pinctrl_dev *pctldev, · 88 unmodified lines
8989 seq_puts(s, items[i].display);
9090 /* Print unit if available */
9191 if (items[i].has_arg) {
92− seq_printf(s, " (0x%x",
93− pinconf_to_config_argument(config));
92+ u32 val = pinconf_to_config_argument(config);
93+
9494 if (items[i].format)
95− seq_printf(s, " %s)", items[i].format);
95+ seq_printf(s, " (%u %s)", val, items[i].format);
9696 else
97− seq_puts(s, ")");
97+ seq_printf(s, " (0x%x)", val);
9898 }
9999 }
100100 }
drivers/pinctrl/pinctrl-cy8c95x0.c+25−17
@@ -42,7 +42,7 @@ · 41 unmodified lines
4242 #define CY8C95X0_PORTSEL 0x18
4343 /* Port settings, write PORTSEL first */
4444 #define CY8C95X0_INTMASK 0x19
45−#define CY8C95X0_PWMSEL 0x1A
45+#define CY8C95X0_SELPWM 0x1A
4646 #define CY8C95X0_INVERT 0x1B
4747 #define CY8C95X0_DIRECTION 0x1C
4848 /* Drive mode register change state on writing '1' */
@@ -328,14 +328,14 @@ static int cypress_get_pin_mask(struct cy8c95x0_pinctrl *chip, unsigned int pin) · 279 unmodified lines
328328 static bool cy8c95x0_readable_register(struct device *dev, unsigned int reg)
329329 {
330330 /*
331− * Only 12 registers are present per port (see Table 6 in the
332− * datasheet).
331+ * Only 12 registers are present per port (see Table 6 in the datasheet).
333332 */
334− if (reg >= CY8C95X0_VIRTUAL && (reg % MUXED_STRIDE) < 12)
335− return true;
333+ if (reg >= CY8C95X0_VIRTUAL && (reg % MUXED_STRIDE) >= 12)
334+ return false;
336335
337336 switch (reg) {
338337 case 0x24 ... 0x27:
338+ case 0x31 ... 0x3f:
339339 return false;
340340 default:
341341 return true;
@@ -344,8 +344,11 @@ static bool cy8c95x0_readable_register(struct device *dev, unsigned int reg) · 2 unmodified lines
344344
345345 static bool cy8c95x0_writeable_register(struct device *dev, unsigned int reg)
346346 {
347− if (reg >= CY8C95X0_VIRTUAL)
348− return true;
347+ /*
348+ * Only 12 registers are present per port (see Table 6 in the datasheet).
349+ */
350+ if (reg >= CY8C95X0_VIRTUAL && (reg % MUXED_STRIDE) >= 12)
351+ return false;
349352
350353 switch (reg) {
351354 case CY8C95X0_INPUT_(0) ... CY8C95X0_INPUT_(7):
@@ -353,6 +356,7 @@ static bool cy8c95x0_writeable_register(struct device *dev, unsigned int reg) · 1 unmodified line
353356 case CY8C95X0_DEVID:
354357 return false;
355358 case 0x24 ... 0x27:
359+ case 0x31 ... 0x3f:
356360 return false;
357361 default:
358362 return true;
@@ -365,8 +369,8 @@ static bool cy8c95x0_volatile_register(struct device *dev, unsigned int reg) · 6 unmodified lines
365369 case CY8C95X0_INPUT_(0) ... CY8C95X0_INPUT_(7):
366370 case CY8C95X0_INTSTATUS_(0) ... CY8C95X0_INTSTATUS_(7):
367371 case CY8C95X0_INTMASK:
372+ case CY8C95X0_SELPWM:
368373 case CY8C95X0_INVERT:
369− case CY8C95X0_PWMSEL:
370374 case CY8C95X0_DIRECTION:
371375 case CY8C95X0_DRV_PU:
372376 case CY8C95X0_DRV_PD:
@@ -395,7 +399,7 @@ static bool cy8c95x0_muxed_register(unsigned int reg) · 22 unmodified lines
395399 {
396400 switch (reg) {
397401 case CY8C95X0_INTMASK:
398− case CY8C95X0_PWMSEL:
402+ case CY8C95X0_SELPWM:
399403 case CY8C95X0_INVERT:
400404 case CY8C95X0_DIRECTION:
401405 case CY8C95X0_DRV_PU:
@@ -466,7 +470,11 @@ static const struct regmap_config cy8c9520_i2c_regmap = { · 64 unmodified lines
466470 .max_register = 0, /* Updated at runtime */
467471 .num_reg_defaults_raw = 0, /* Updated at runtime */
468472 .use_single_read = true, /* Workaround for regcache bug */
473+#if IS_ENABLED(CONFIG_DEBUG_PINCTRL)
474+ .disable_locking = false,
475+#else
469476 .disable_locking = true,
477+#endif
470478 };
471479
472480 static inline int cy8c95x0_regmap_update_bits_base(struct cy8c95x0_pinctrl *chip,
@@ -789,7 +797,7 @@ static int cy8c95x0_gpio_get_pincfg(struct cy8c95x0_pinctrl *chip, · 316 unmodified lines
789797 reg = CY8C95X0_DIRECTION;
790798 break;
791799 case PIN_CONFIG_MODE_PWM:
792− reg = CY8C95X0_PWMSEL;
800+ reg = CY8C95X0_SELPWM;
793801 break;
794802 case PIN_CONFIG_OUTPUT:
795803 reg = CY8C95X0_OUTPUT;
@@ -868,7 +876,7 @@ static int cy8c95x0_gpio_set_pincfg(struct cy8c95x0_pinctrl *chip, · 72 unmodified lines
868876 reg = CY8C95X0_DRV_PP_FAST;
869877 break;
870878 case PIN_CONFIG_MODE_PWM:
871− reg = CY8C95X0_PWMSEL;
879+ reg = CY8C95X0_SELPWM;
872880 break;
873881 case PIN_CONFIG_OUTPUT_ENABLE:
874882 return cy8c95x0_pinmux_direction(chip, off, !arg);
@@ -1153,7 +1161,7 @@ static void cy8c95x0_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file * · 278 unmodified lines
11531161 bitmap_zero(mask, MAX_LINE);
11541162 __set_bit(pin, mask);
11551163
1156− if (cy8c95x0_read_regs_mask(chip, CY8C95X0_PWMSEL, pwm, mask)) {
1164+ if (cy8c95x0_read_regs_mask(chip, CY8C95X0_SELPWM, pwm, mask)) {
11571165 seq_puts(s, "not available");
11581166 return;
11591167 }
@@ -1198,7 +1206,7 @@ static int cy8c95x0_set_mode(struct cy8c95x0_pinctrl *chip, unsigned int off, bo · 38 unmodified lines
11981206 u8 port = cypress_get_port(chip, off);
11991207 u8 bit = cypress_get_pin_mask(chip, off);
12001208
1201− return cy8c95x0_regmap_write_bits(chip, CY8C95X0_PWMSEL, port, bit, mode ? bit : 0);
1209+ return cy8c95x0_regmap_write_bits(chip, CY8C95X0_SELPWM, port, bit, mode ? bit : 0);
12021210 }
12031211
12041212 static int cy8c95x0_pinmux_mode(struct cy8c95x0_pinctrl *chip,
@@ -1347,7 +1355,7 @@ static int cy8c95x0_irq_setup(struct cy8c95x0_pinctrl *chip, int irq) · 142 unmodified lines
13471355
13481356 ret = devm_request_threaded_irq(chip->dev, irq,
13491357 NULL, cy8c95x0_irq_handler,
1350− IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_HIGH,
1358+ IRQF_ONESHOT | IRQF_SHARED,
13511359 dev_name(chip->dev), chip);
13521360 if (ret) {
13531361 dev_err(chip->dev, "failed to request irq %d\n", irq);
@@ -1438,15 +1446,15 @@ static int cy8c95x0_probe(struct i2c_client *client) · 84 unmodified lines
14381446 switch (chip->tpin) {
14391447 case 20:
14401448 strscpy(chip->name, cy8c95x0_id[0].name);
1441− regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 3 * MUXED_STRIDE;
1449+ regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 3 * MUXED_STRIDE - 1;
14421450 break;
14431451 case 40:
14441452 strscpy(chip->name, cy8c95x0_id[1].name);
1445− regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 6 * MUXED_STRIDE;
1453+ regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 6 * MUXED_STRIDE - 1;
14461454 break;
14471455 case 60:
14481456 strscpy(chip->name, cy8c95x0_id[2].name);
1449− regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 8 * MUXED_STRIDE;
1457+ regmap_range_conf.range_max = CY8C95X0_VIRTUAL + 8 * MUXED_STRIDE - 1;
14501458 break;
14511459 default:
14521460 return -ENODEV;
drivers/platform/x86/ideapad-laptop.c+1−1
@@ -1121,7 +1121,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) · 1120 unmodified lines
11211121
11221122 /* Create platform_profile structure and register */
11231123 priv->dytc->ppdev = devm_platform_profile_register(&priv->platform_device->dev,
1124− "ideapad-laptop", &priv->dytc,
1124+ "ideapad-laptop", priv->dytc,
11251125 &dytc_profile_ops);
11261126 if (IS_ERR(priv->dytc->ppdev)) {
11271127 err = PTR_ERR(priv->dytc->ppdev);
drivers/platform/x86/intel/ifs/ifs.h+4−5
@@ -23,12 +23,14 @@ · 22 unmodified lines
2323 * IFS Image
2424 * ---------
2525 *
26− * Intel provides a firmware file containing the scan tests via
27− * github [#f1]_. Similar to microcode there is a separate file for each
26+ * Intel provides firmware files containing the scan tests via the webpage [#f1]_.
27+ * Look under "In-Field Scan Test Images Download" section towards the
28+ * end of the page. Similar to microcode, there are separate files for each
2829 * family-model-stepping. IFS Images are not applicable for some test types.
2930 * Wherever applicable the sysfs directory would provide a "current_batch" file
3031 * (see below) for loading the image.
3132 *
33+ * .. [#f1] https://intel.com/InFieldScan
3234 *
3335 * IFS Image Loading
3436 * -----------------
@@ -125,9 +127,6 @@ · 90 unmodified lines
125127 * 2) Hardware allows for some number of cores to be tested in parallel.
126128 * The driver does not make use of this, it only tests one core at a time.
127129 *
128− * .. [#f1] https://github.com/intel/TBD
129− *
130− *
131130 * Structural Based Functional Test at Field (SBAF):
132131 * -------------------------------------------------
133132 *
drivers/platform/x86/intel/int3472/discrete.c+65−20
@@ -2,6 +2,7 @@ · 1 unmodified line
22 /* Author: Dan Scally <djrscally@gmail.com> */
33
44 #include <linux/acpi.h>
5+#include <linux/array_size.h>
56 #include <linux/bitfield.h>
67 #include <linux/device.h>
78 #include <linux/gpio/consumer.h>
@@ -55,7 +56,7 @@ static void skl_int3472_log_sensor_module_name(struct int3472_discrete_device *i · 47 unmodified lines
5556
5657 static int skl_int3472_fill_gpiod_lookup(struct gpiod_lookup *table_entry,
5758 struct acpi_resource_gpio *agpio,
58− const char *func, u32 polarity)
59+ const char *func, unsigned long gpio_flags)
5960 {
6061 char *path = agpio->resource_source.string_ptr;
6162 struct acpi_device *adev;
@@ -70,14 +71,14 @@ static int skl_int3472_fill_gpiod_lookup(struct gpiod_lookup *table_entry, · 8 unmodified lines
7071 if (!adev)
7172 return -ENODEV;
7273
73− *table_entry = GPIO_LOOKUP(acpi_dev_name(adev), agpio->pin_table[0], func, polarity);
74+ *table_entry = GPIO_LOOKUP(acpi_dev_name(adev), agpio->pin_table[0], func, gpio_flags);
7475
7576 return 0;
7677 }
7778
7879 static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int3472,
7980 struct acpi_resource_gpio *agpio,
80− const char *func, u32 polarity)
81+ const char *func, unsigned long gpio_flags)
8182 {
8283 int ret;
8384
@@ -87,7 +88,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 · 3 unmodified lines
8788 }
8889
8990 ret = skl_int3472_fill_gpiod_lookup(&int3472->gpios.table[int3472->n_sensor_gpios],
90− agpio, func, polarity);
91+ agpio, func, gpio_flags);
9192 if (ret)
9293 return ret;
9394
@@ -100,7 +101,7 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 · 6 unmodified lines
100101 static struct gpio_desc *
101102 skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472,
102103 struct acpi_resource_gpio *agpio,
103− const char *func, u32 polarity)
104+ const char *func, unsigned long gpio_flags)
104105 {
105106 struct gpio_desc *desc;
106107 int ret;
@@ -111,7 +112,7 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472, · 4 unmodified lines
111112 return ERR_PTR(-ENOMEM);
112113
113114 lookup->dev_id = dev_name(int3472->dev);
114− ret = skl_int3472_fill_gpiod_lookup(&lookup->table[0], agpio, func, polarity);
115+ ret = skl_int3472_fill_gpiod_lookup(&lookup->table[0], agpio, func, gpio_flags);
115116 if (ret)
116117 return ERR_PTR(ret);
117118
@@ -122,32 +123,76 @@ skl_int3472_gpiod_get_from_temp_lookup(struct int3472_discrete_device *int3472, · 4 unmodified lines
122123 return desc;
123124 }
124125
125−static void int3472_get_func_and_polarity(u8 type, const char **func, u32 *polarity)
126+/**
127+ * struct int3472_gpio_map - Map GPIOs to whatever is expected by the
128+ * sensor driver (as in DT bindings)
129+ * @hid: The ACPI HID of the device without the instance number e.g. INT347E
130+ * @type_from: The GPIO type from ACPI ?SDT
131+ * @type_to: The assigned GPIO type, typically same as @type_from
132+ * @func: The function, e.g. "enable"
133+ * @polarity_low: GPIO_ACTIVE_LOW true if the @polarity_low is true,
134+ * GPIO_ACTIVE_HIGH otherwise
135+ */
136+struct int3472_gpio_map {
137+ const char *hid;
138+ u8 type_from;
139+ u8 type_to;
140+ bool polarity_low;
141+ const char *func;
142+};
143+
144+static const struct int3472_gpio_map int3472_gpio_map[] = {
145+ { "INT347E", INT3472_GPIO_TYPE_RESET, INT3472_GPIO_TYPE_RESET, false, "enable" },
146+};
147+
148+static void int3472_get_func_and_polarity(struct acpi_device *adev, u8 *type,
149+ const char **func, unsigned long *gpio_flags)
126150 {
127− switch (type) {
151+ unsigned int i;
152+
153+ for (i = 0; i < ARRAY_SIZE(int3472_gpio_map); i++) {
154+ /*
155+ * Map the firmware-provided GPIO to whatever a driver expects
156+ * (as in DT bindings). First check if the type matches with the
157+ * GPIO map, then further check that the device _HID matches.
158+ */
159+ if (*type != int3472_gpio_map[i].type_from)
160+ continue;
161+
162+ if (!acpi_dev_hid_uid_match(adev, int3472_gpio_map[i].hid, NULL))
163+ continue;
164+
165+ *type = int3472_gpio_map[i].type_to;
166+ *gpio_flags = int3472_gpio_map[i].polarity_low ?
167+ GPIO_ACTIVE_LOW : GPIO_ACTIVE_HIGH;
168+ *func = int3472_gpio_map[i].func;
169+ return;
170+ }
171+
172+ switch (*type) {
128173 case INT3472_GPIO_TYPE_RESET:
129174 *func = "reset";
130− *polarity = GPIO_ACTIVE_LOW;
175+ *gpio_flags = GPIO_ACTIVE_LOW;
131176 break;
132177 case INT3472_GPIO_TYPE_POWERDOWN:
133178 *func = "powerdown";
134− *polarity = GPIO_ACTIVE_LOW;
179+ *gpio_flags = GPIO_ACTIVE_LOW;
135180 break;
136181 case INT3472_GPIO_TYPE_CLK_ENABLE:
137182 *func = "clk-enable";
138− *polarity = GPIO_ACTIVE_HIGH;
183+ *gpio_flags = GPIO_ACTIVE_HIGH;
139184 break;
140185 case INT3472_GPIO_TYPE_PRIVACY_LED:
141186 *func = "privacy-led";
142− *polarity = GPIO_ACTIVE_HIGH;
187+ *gpio_flags = GPIO_ACTIVE_HIGH;
143188 break;
144189 case INT3472_GPIO_TYPE_POWER_ENABLE:
145190 *func = "power-enable";
146− *polarity = GPIO_ACTIVE_HIGH;
191+ *gpio_flags = GPIO_ACTIVE_HIGH;
147192 break;
148193 default:
149194 *func = "unknown";
150− *polarity = GPIO_ACTIVE_HIGH;
195+ *gpio_flags = GPIO_ACTIVE_HIGH;
151196 break;
152197 }
153198 }
@@ -194,7 +239,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 40 unmodified lines
194239 struct gpio_desc *gpio;
195240 const char *err_msg;
196241 const char *func;
197− u32 polarity;
242+ unsigned long gpio_flags;
198243 int ret;
199244
200245 if (!acpi_gpio_get_io_resource(ares, &agpio))
@@ -217,7 +262,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 16 unmodified lines
217262
218263 type = FIELD_GET(INT3472_GPIO_DSM_TYPE, obj->integer.value);
219264
220− int3472_get_func_and_polarity(type, &func, &polarity);
265+ int3472_get_func_and_polarity(int3472->sensor, &type, &func, &gpio_flags);
221266
222267 pin = FIELD_GET(INT3472_GPIO_DSM_PIN, obj->integer.value);
223268 /* Pin field is not really used under Windows and wraps around at 8 bits */
@@ -227,16 +272,16 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 3 unmodified lines
227272
228273 active_value = FIELD_GET(INT3472_GPIO_DSM_SENSOR_ON_VAL, obj->integer.value);
229274 if (!active_value)
230− polarity ^= GPIO_ACTIVE_LOW;
275+ gpio_flags ^= GPIO_ACTIVE_LOW;
231276
232277 dev_dbg(int3472->dev, "%s %s pin %d active-%s\n", func,
233278 agpio->resource_source.string_ptr, agpio->pin_table[0],
234− str_high_low(polarity == GPIO_ACTIVE_HIGH));
279+ str_high_low(gpio_flags == GPIO_ACTIVE_HIGH));
235280
236281 switch (type) {
237282 case INT3472_GPIO_TYPE_RESET:
238283 case INT3472_GPIO_TYPE_POWERDOWN:
239− ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, polarity);
284+ ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, func, gpio_flags);
240285 if (ret)
241286 err_msg = "Failed to map GPIO pin to sensor\n";
242287
@@ -244,7 +289,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 1 unmodified line
244289 case INT3472_GPIO_TYPE_CLK_ENABLE:
245290 case INT3472_GPIO_TYPE_PRIVACY_LED:
246291 case INT3472_GPIO_TYPE_POWER_ENABLE:
247− gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, func, polarity);
292+ gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, func, gpio_flags);
248293 if (IS_ERR(gpio)) {
249294 ret = PTR_ERR(gpio);
250295 err_msg = "Failed to get GPIO\n";
drivers/platform/x86/intel/pmc/core.c+2−2
@@ -626,8 +626,8 @@ static u32 convert_ltr_scale(u32 val) · 625 unmodified lines
626626 static int pmc_core_ltr_show(struct seq_file *s, void *unused)
627627 {
628628 struct pmc_dev *pmcdev = s->private;
629− u64 decoded_snoop_ltr, decoded_non_snoop_ltr;
630− u32 ltr_raw_data, scale, val;
629+ u64 decoded_snoop_ltr, decoded_non_snoop_ltr, val;
630+ u32 ltr_raw_data, scale;
631631 u16 snoop_ltr, nonsnoop_ltr;
632632 unsigned int i, index, ltr_index = 0;
633633
drivers/platform/x86/thinkpad_acpi.c+45−16
@@ -7885,6 +7885,7 @@ static struct ibm_struct volume_driver_data = { · 7884 unmodified lines
78857885
78867886 #define FAN_NS_CTRL_STATUS BIT(2) /* Bit which determines control is enabled or not */
78877887 #define FAN_NS_CTRL BIT(4) /* Bit which determines control is by host or EC */
7888+#define FAN_CLOCK_TPM (22500*60) /* Ticks per minute for a 22.5 kHz clock */
78887889
78897890 enum { /* Fan control constants */
78907891 fan_status_offset = 0x2f, /* EC register 0x2f */
@@ -7940,6 +7941,7 @@ static int fan_watchdog_maxinterval; · 49 unmodified lines
79407941
79417942 static bool fan_with_ns_addr;
79427943 static bool ecfw_with_fan_dec_rpm;
7944+static bool fan_speed_in_tpr;
79437945
79447946 static struct mutex fan_mutex;
79457947
@@ -8142,8 +8144,11 @@ static int fan_get_speed(unsigned int *speed) · 196 unmodified lines
81428144 !acpi_ec_read(fan_rpm_offset + 1, &hi)))
81438145 return -EIO;
81448146
8145− if (likely(speed))
8147+ if (likely(speed)) {
81468148 *speed = (hi << 8) | lo;
8149+ if (fan_speed_in_tpr && *speed != 0)
8150+ *speed = FAN_CLOCK_TPM / *speed;
8151+ }
81478152 break;
81488153 case TPACPI_FAN_RD_TPEC_NS:
81498154 if (!acpi_ec_read(fan_rpm_status_ns, &lo))
@@ -8176,8 +8181,11 @@ static int fan2_get_speed(unsigned int *speed) · 26 unmodified lines
81768181 if (rc)
81778182 return -EIO;
81788183
8179− if (likely(speed))
8184+ if (likely(speed)) {
81808185 *speed = (hi << 8) | lo;
8186+ if (fan_speed_in_tpr && *speed != 0)
8187+ *speed = FAN_CLOCK_TPM / *speed;
8188+ }
81818189 break;
81828190
81838191 case TPACPI_FAN_RD_TPEC_NS:
@@ -8788,6 +8796,7 @@ static const struct attribute_group fan_driver_attr_group = { · 604 unmodified lines
87888796 #define TPACPI_FAN_NOFAN 0x0008 /* no fan available */
87898797 #define TPACPI_FAN_NS 0x0010 /* For EC with non-Standard register addresses */
87908798 #define TPACPI_FAN_DECRPM 0x0020 /* For ECFW's with RPM in register as decimal */
8799+#define TPACPI_FAN_TPR 0x0040 /* Fan speed is in Ticks Per Revolution */
87918800
87928801 static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
87938802 TPACPI_QEC_IBM('1', 'Y', TPACPI_FAN_Q1),
@@ -8817,6 +8826,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = { · 23 unmodified lines
88178826 TPACPI_Q_LNV3('R', '0', 'V', TPACPI_FAN_NS), /* 11e Gen5 KL-Y */
88188827 TPACPI_Q_LNV3('N', '1', 'O', TPACPI_FAN_NOFAN), /* X1 Tablet (2nd gen) */
88198828 TPACPI_Q_LNV3('R', '0', 'Q', TPACPI_FAN_DECRPM),/* L480 */
8829+ TPACPI_Q_LNV('8', 'F', TPACPI_FAN_TPR), /* ThinkPad x120e */
88208830 };
88218831
88228832 static int __init fan_init(struct ibm_init_struct *iibm)
@@ -8887,6 +8897,8 @@ static int __init fan_init(struct ibm_init_struct *iibm) · 64 unmodified lines
88878897
88888898 if (quirks & TPACPI_FAN_Q1)
88898899 fan_quirk1_setup();
8900+ if (quirks & TPACPI_FAN_TPR)
8901+ fan_speed_in_tpr = true;
88908902 /* Try and probe the 2nd fan */
88918903 tp_features.second_fan = 1; /* needed for get_speed to work */
88928904 res = fan2_get_speed(&speed);
@@ -10319,6 +10331,10 @@ static struct ibm_struct proxsensor_driver_data = { · 1426 unmodified lines
1031910331 #define DYTC_MODE_PSC_BALANCE 5 /* Default mode aka balanced */
1032010332 #define DYTC_MODE_PSC_PERFORM 7 /* High power mode aka performance */
1032110333
10334+#define DYTC_MODE_PSCV9_LOWPOWER 1 /* Low power mode */
10335+#define DYTC_MODE_PSCV9_BALANCE 3 /* Default mode aka balanced */
10336+#define DYTC_MODE_PSCV9_PERFORM 4 /* High power mode aka performance */
10337+
1032210338 #define DYTC_ERR_MASK 0xF /* Bits 0-3 in cmd result are the error result */
1032310339 #define DYTC_ERR_SUCCESS 1 /* CMD completed successful */
1032410340
@@ -10339,6 +10355,10 @@ static int dytc_capabilities; · 14 unmodified lines
1033910355 static bool dytc_mmc_get_available;
1034010356 static int profile_force;
1034110357
10358+static int platform_psc_profile_lowpower = DYTC_MODE_PSC_LOWPOWER;
10359+static int platform_psc_profile_balanced = DYTC_MODE_PSC_BALANCE;
10360+static int platform_psc_profile_performance = DYTC_MODE_PSC_PERFORM;
10361+
1034210362 static int convert_dytc_to_profile(int funcmode, int dytcmode,
1034310363 enum platform_profile_option *profile)
1034410364 {
@@ -10360,19 +10380,15 @@ static int convert_dytc_to_profile(int funcmode, int dytcmode, · 15 unmodified lines
1036010380 }
1036110381 return 0;
1036210382 case DYTC_FUNCTION_PSC:
10363− switch (dytcmode) {
10364− case DYTC_MODE_PSC_LOWPOWER:
10383+ if (dytcmode == platform_psc_profile_lowpower)
1036510384 *profile = PLATFORM_PROFILE_LOW_POWER;
10366− break;
10367− case DYTC_MODE_PSC_BALANCE:
10385+ else if (dytcmode == platform_psc_profile_balanced)
1036810386 *profile = PLATFORM_PROFILE_BALANCED;
10369− break;
10370− case DYTC_MODE_PSC_PERFORM:
10387+ else if (dytcmode == platform_psc_profile_performance)
1037110388 *profile = PLATFORM_PROFILE_PERFORMANCE;
10372− break;
10373− default: /* Unknown mode */
10389+ else
1037410390 return -EINVAL;
10375− }
10391+
1037610392 return 0;
1037710393 case DYTC_FUNCTION_AMT:
1037810394 /* For now return balanced. It's the closest we have to 'auto' */
@@ -10393,19 +10409,19 @@ static int convert_profile_to_dytc(enum platform_profile_option profile, int *pe · 14 unmodified lines
1039310409 if (dytc_capabilities & BIT(DYTC_FC_MMC))
1039410410 *perfmode = DYTC_MODE_MMC_LOWPOWER;
1039510411 else if (dytc_capabilities & BIT(DYTC_FC_PSC))
10396− *perfmode = DYTC_MODE_PSC_LOWPOWER;
10412+ *perfmode = platform_psc_profile_lowpower;
1039710413 break;
1039810414 case PLATFORM_PROFILE_BALANCED:
1039910415 if (dytc_capabilities & BIT(DYTC_FC_MMC))
1040010416 *perfmode = DYTC_MODE_MMC_BALANCE;
1040110417 else if (dytc_capabilities & BIT(DYTC_FC_PSC))
10402− *perfmode = DYTC_MODE_PSC_BALANCE;
10418+ *perfmode = platform_psc_profile_balanced;
1040310419 break;
1040410420 case PLATFORM_PROFILE_PERFORMANCE:
1040510421 if (dytc_capabilities & BIT(DYTC_FC_MMC))
1040610422 *perfmode = DYTC_MODE_MMC_PERFORM;
1040710423 else if (dytc_capabilities & BIT(DYTC_FC_PSC))
10408− *perfmode = DYTC_MODE_PSC_PERFORM;
10424+ *perfmode = platform_psc_profile_performance;
1040910425 break;
1041010426 default: /* Unknown profile */
1041110427 return -EOPNOTSUPP;
@@ -10599,6 +10615,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 187 unmodified lines
1059910615 if (output & BIT(DYTC_QUERY_ENABLE_BIT))
1060010616 dytc_version = (output >> DYTC_QUERY_REV_BIT) & 0xF;
1060110617
10618+ dbg_printk(TPACPI_DBG_INIT, "DYTC version %d\n", dytc_version);
1060210619 /* Check DYTC is enabled and supports mode setting */
1060310620 if (dytc_version < 5)
1060410621 return -ENODEV;
@@ -10637,6 +10654,11 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 32 unmodified lines
1063710654 }
1063810655 } else if (dytc_capabilities & BIT(DYTC_FC_PSC)) { /* PSC MODE */
1063910656 pr_debug("PSC is supported\n");
10657+ if (dytc_version >= 9) { /* update profiles for DYTC 9 and up */
10658+ platform_psc_profile_lowpower = DYTC_MODE_PSCV9_LOWPOWER;
10659+ platform_psc_profile_balanced = DYTC_MODE_PSCV9_BALANCE;
10660+ platform_psc_profile_performance = DYTC_MODE_PSCV9_PERFORM;
10661+ }
1064010662 } else {
1064110663 dbg_printk(TPACPI_DBG_INIT, "No DYTC support available\n");
1064210664 return -ENODEV;
@@ -10646,8 +10668,8 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 3 unmodified lines
1064610668 "DYTC version %d: thermal mode available\n", dytc_version);
1064710669
1064810670 /* Create platform_profile structure and register */
10649− tpacpi_pprof = devm_platform_profile_register(&tpacpi_pdev->dev, "thinkpad-acpi",
10650− NULL, &dytc_profile_ops);
10671+ tpacpi_pprof = platform_profile_register(&tpacpi_pdev->dev, "thinkpad-acpi-profile",
10672+ NULL, &dytc_profile_ops);
1065110673 /*
1065210674 * If for some reason platform_profiles aren't enabled
1065310675 * don't quit terminally.
@@ -10665,8 +10687,15 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) · 11 unmodified lines
1066510687 return 0;
1066610688 }
1066710689
10690+static void dytc_profile_exit(void)
10691+{
10692+ if (!IS_ERR_OR_NULL(tpacpi_pprof))
10693+ platform_profile_remove(tpacpi_pprof);
10694+}
10695+
1066810696 static struct ibm_struct dytc_profile_driver_data = {
1066910697 .name = "dytc-profile",
10698+ .exit = dytc_profile_exit,
1067010699 };
1067110700
1067210701 /*************************************************************************
drivers/powercap/powercap_sys.c+1−2
@@ -627,8 +627,7 @@ struct powercap_control_type *powercap_register_control_type( · 626 unmodified lines
627627 dev_set_name(&control_type->dev, "%s", name);
628628 result = device_register(&control_type->dev);
629629 if (result) {
630− if (control_type->allocated)
631− kfree(control_type);
630+ put_device(&control_type->dev);
632631 return ERR_PTR(result);
633632 }
634633 idr_init(&control_type->idr);
drivers/ptp/ptp_vmclock.c+21−26
@@ -414,16 +414,16 @@ static ssize_t vmclock_miscdev_read(struct file *fp, char __user *buf, · 413 unmodified lines
414414 }
415415
416416 static const struct file_operations vmclock_miscdev_fops = {
417+ .owner = THIS_MODULE,
417418 .mmap = vmclock_miscdev_mmap,
418419 .read = vmclock_miscdev_read,
419420 };
420421
421422 /* module operations */
422423
423−static void vmclock_remove(struct platform_device *pdev)
424+static void vmclock_remove(void *data)
424425 {
425− struct device *dev = &pdev->dev;
426− struct vmclock_state *st = dev_get_drvdata(dev);
426+ struct vmclock_state *st = data;
427427
428428 if (st->ptp_clock)
429429 ptp_clock_unregister(st->ptp_clock);
@@ -506,14 +506,13 @@ static int vmclock_probe(struct platform_device *pdev) · 76 unmodified lines
506506
507507 if (ret) {
508508 dev_info(dev, "Failed to obtain physical address: %d\n", ret);
509− goto out;
509+ return ret;
510510 }
511511
512512 if (resource_size(&st->res) < VMCLOCK_MIN_SIZE) {
513513 dev_info(dev, "Region too small (0x%llx)\n",
514514 resource_size(&st->res));
515− ret = -EINVAL;
516− goto out;
515+ return -EINVAL;
517516 }
518517 st->clk = devm_memremap(dev, st->res.start, resource_size(&st->res),
519518 MEMREMAP_WB | MEMREMAP_DEC);
@@ -521,31 +520,34 @@ static int vmclock_probe(struct platform_device *pdev) · 1 unmodified line
521520 ret = PTR_ERR(st->clk);
522521 dev_info(dev, "failed to map shared memory\n");
523522 st->clk = NULL;
524− goto out;
523+ return ret;
525524 }
526525
527526 if (le32_to_cpu(st->clk->magic) != VMCLOCK_MAGIC ||
528527 le32_to_cpu(st->clk->size) > resource_size(&st->res) ||
529528 le16_to_cpu(st->clk->version) != 1) {
530529 dev_info(dev, "vmclock magic fields invalid\n");
531− ret = -EINVAL;
532− goto out;
530+ return -EINVAL;
533531 }
534532
535533 ret = ida_alloc(&vmclock_ida, GFP_KERNEL);
536534 if (ret < 0)
537− goto out;
535+ return ret;
538536
539537 st->index = ret;
540538 ret = devm_add_action_or_reset(&pdev->dev, vmclock_put_idx, st);
541539 if (ret)
542− goto out;
540+ return ret;
543541
544542 st->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "vmclock%d", st->index);
545− if (!st->name) {
546− ret = -ENOMEM;
547− goto out;
548− }
543+ if (!st->name)
544+ return -ENOMEM;
545+
546+ st->miscdev.minor = MISC_DYNAMIC_MINOR;
547+
548+ ret = devm_add_action_or_reset(&pdev->dev, vmclock_remove, st);
549+ if (ret)
550+ return ret;
549551
550552 /*
551553 * If the structure is big enough, it can be mapped to userspace.
@@ -554,13 +556,12 @@ static int vmclock_probe(struct platform_device *pdev) · 2 unmodified lines
554556 * cross that bridge if/when we come to it.
555557 */
556558 if (le32_to_cpu(st->clk->size) >= PAGE_SIZE) {
557− st->miscdev.minor = MISC_DYNAMIC_MINOR;
558559 st->miscdev.fops = &vmclock_miscdev_fops;
559560 st->miscdev.name = st->name;
560561
561562 ret = misc_register(&st->miscdev);
562563 if (ret)
563− goto out;
564+ return ret;
564565 }
565566
566567 /* If there is valid clock information, register a PTP clock */
@@ -570,16 +571,14 @@ static int vmclock_probe(struct platform_device *pdev) · 3 unmodified lines
570571 if (IS_ERR(st->ptp_clock)) {
571572 ret = PTR_ERR(st->ptp_clock);
572573 st->ptp_clock = NULL;
573− vmclock_remove(pdev);
574− goto out;
574+ return ret;
575575 }
576576 }
577577
578578 if (!st->miscdev.minor && !st->ptp_clock) {
579579 /* Neither miscdev nor PTP registered */
580580 dev_info(dev, "vmclock: Neither miscdev nor PTP available; not registering\n");
581− ret = -ENODEV;
582− goto out;
581+ return -ENODEV;
583582 }
584583
585584 dev_info(dev, "%s: registered %s%s%s\n", st->name,
@@ -587,10 +586,7 @@ static int vmclock_probe(struct platform_device *pdev) · 1 unmodified line
587586 (st->miscdev.minor && st->ptp_clock) ? ", " : "",
588587 st->ptp_clock ? "PTP" : "");
589588
590− dev_set_drvdata(dev, st);
591−
592− out:
593− return ret;
589+ return 0;
594590 }
595591
596592 static const struct acpi_device_id vmclock_acpi_ids[] = {
@@ -601,7 +597,6 @@ MODULE_DEVICE_TABLE(acpi, vmclock_acpi_ids); · 4 unmodified lines
601597
602598 static struct platform_driver vmclock_platform_driver = {
603599 .probe = vmclock_probe,
604− .remove = vmclock_remove,
605600 .driver = {
606601 .name = "vmclock",
607602 .acpi_match_table = vmclock_acpi_ids,
drivers/regulator/core.c+27−34
@@ -5774,43 +5774,36 @@ regulator_register(struct device *dev, · 5773 unmodified lines
57745774 goto clean;
57755775 }
57765776
5777− if (config->init_data) {
5778− /*
5779− * Providing of_match means the framework is expected to parse
5780− * DT to get the init_data. This would conflict with provided
5781− * init_data, if set. Warn if it happens.
5782− */
5783− if (regulator_desc->of_match)
5784− dev_warn(dev, "Using provided init data - OF match ignored\n");
5777+ /*
5778+ * DT may override the config->init_data provided if the platform
5779+ * needs to do so. If so, config->init_data is completely ignored.
5780+ */
5781+ init_data = regulator_of_get_init_data(dev, regulator_desc, config,
5782+ &rdev->dev.of_node);
57855783
5784+ /*
5785+ * Sometimes not all resources are probed already so we need to take
5786+ * that into account. This happens most the time if the ena_gpiod comes
5787+ * from a gpio extender or something else.
5788+ */
5789+ if (PTR_ERR(init_data) == -EPROBE_DEFER) {
5790+ ret = -EPROBE_DEFER;
5791+ goto clean;
5792+ }
5793+
5794+ /*
5795+ * We need to keep track of any GPIO descriptor coming from the
5796+ * device tree until we have handled it over to the core. If the
5797+ * config that was passed in to this function DOES NOT contain
5798+ * a descriptor, and the config after this call DOES contain
5799+ * a descriptor, we definitely got one from parsing the device
5800+ * tree.
5801+ */
5802+ if (!cfg->ena_gpiod && config->ena_gpiod)
5803+ dangling_of_gpiod = true;
5804+ if (!init_data) {
57865805 init_data = config->init_data;
57875806 rdev->dev.of_node = of_node_get(config->of_node);
5788−
5789− } else {
5790− init_data = regulator_of_get_init_data(dev, regulator_desc,
5791− config,
5792− &rdev->dev.of_node);
5793−
5794− /*
5795− * Sometimes not all resources are probed already so we need to
5796− * take that into account. This happens most the time if the
5797− * ena_gpiod comes from a gpio extender or something else.
5798− */
5799− if (PTR_ERR(init_data) == -EPROBE_DEFER) {
5800− ret = -EPROBE_DEFER;
5801− goto clean;
5802− }
5803−
5804− /*
5805− * We need to keep track of any GPIO descriptor coming from the
5806− * device tree until we have handled it over to the core. If the
5807− * config that was passed in to this function DOES NOT contain a
5808− * descriptor, and the config after this call DOES contain a
5809− * descriptor, we definitely got one from parsing the device
5810− * tree.
5811− */
5812− if (!cfg->ena_gpiod && config->ena_gpiod)
5813− dangling_of_gpiod = true;
58145807 }
58155808
58165809 ww_mutex_init(&rdev->mutex, &regulator_ww_class);
drivers/s390/cio/chp.c+2−1
@@ -695,7 +695,8 @@ static int info_update(void) · 694 unmodified lines
695695 if (time_after(jiffies, chp_info_expires)) {
696696 /* Data is too old, update. */
697697 rc = sclp_chp_read_info(&chp_info);
698− chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL ;
698+ if (!rc)
699+ chp_info_expires = jiffies + CHP_INFO_UPDATE_INTERVAL;
699700 }
700701 mutex_unlock(&info_lock);
701702
drivers/s390/net/ism_drv.c+12−2
@@ -588,6 +588,15 @@ out: · 587 unmodified lines
588588 return ret;
589589 }
590590
591+static void ism_dev_release(struct device *dev)
592+{
593+ struct ism_dev *ism;
594+
595+ ism = container_of(dev, struct ism_dev, dev);
596+
597+ kfree(ism);
598+}
599+
591600 static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)
592601 {
593602 struct ism_dev *ism;
@@ -601,6 +610,7 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 7 unmodified lines
601610 dev_set_drvdata(&pdev->dev, ism);
602611 ism->pdev = pdev;
603612 ism->dev.parent = &pdev->dev;
613+ ism->dev.release = ism_dev_release;
604614 device_initialize(&ism->dev);
605615 dev_set_name(&ism->dev, dev_name(&pdev->dev));
606616 ret = device_add(&ism->dev);
@@ -637,7 +647,7 @@ err: · 30 unmodified lines
637647 device_del(&ism->dev);
638648 err_dev:
639649 dev_set_drvdata(&pdev->dev, NULL);
640− kfree(ism);
650+ put_device(&ism->dev);
641651
642652 return ret;
643653 }
@@ -682,7 +692,7 @@ static void ism_remove(struct pci_dev *pdev) · 38 unmodified lines
682692 pci_disable_device(pdev);
683693 device_del(&ism->dev);
684694 dev_set_drvdata(&pdev->dev, NULL);
685− kfree(ism);
695+ put_device(&ism->dev);
686696 }
687697
688698 static struct pci_driver ism_driver = {
drivers/s390/net/qeth_core_main.c+5−3
@@ -7050,14 +7050,16 @@ int qeth_open(struct net_device *dev) · 7049 unmodified lines
70507050 card->data.state = CH_STATE_UP;
70517051 netif_tx_start_all_queues(dev);
70527052
7053− local_bh_disable();
70547053 qeth_for_each_output_queue(card, queue, i) {
70557054 netif_napi_add_tx(dev, &queue->napi, qeth_tx_poll);
70567055 napi_enable(&queue->napi);
7057− napi_schedule(&queue->napi);
70587056 }
7059−
70607057 napi_enable(&card->napi);
7058+
7059+ local_bh_disable();
7060+ qeth_for_each_output_queue(card, queue, i) {
7061+ napi_schedule(&queue->napi);
7062+ }
70617063 napi_schedule(&card->napi);
70627064 /* kick-start the NAPI softirq: */
70637065 local_bh_enable();
drivers/scsi/qla1280.c+1−1
@@ -2867,7 +2867,7 @@ qla1280_64bit_start_scsi(struct scsi_qla_host *ha, struct srb * sp) · 2866 unmodified lines
28672867 dprintk(3, "S/G Segment phys_addr=%x %x, len=0x%x\n",
28682868 cpu_to_le32(upper_32_bits(dma_handle)),
28692869 cpu_to_le32(lower_32_bits(dma_handle)),
2870− cpu_to_le32(sg_dma_len(sg_next(s))));
2870+ cpu_to_le32(sg_dma_len(s)));
28712871 remseg--;
28722872 }
28732873 dprintk(5, "qla1280_64bit_start_scsi: Scatter/gather "
drivers/scsi/scsi_lib.c+7−2
@@ -872,13 +872,18 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result) · 871 unmodified lines
872872 case 0x1a: /* start stop unit in progress */
873873 case 0x1b: /* sanitize in progress */
874874 case 0x1d: /* configuration in progress */
875− case 0x24: /* depopulation in progress */
876− case 0x25: /* depopulation restore in progress */
877875 action = ACTION_DELAYED_RETRY;
878876 break;
879877 case 0x0a: /* ALUA state transition */
880878 action = ACTION_DELAYED_REPREP;
881879 break;
880+ /*
881+ * Depopulation might take many hours,
882+ * thus it is not worthwhile to retry.
883+ */
884+ case 0x24: /* depopulation in progress */
885+ case 0x25: /* depopulation restore in progress */
886+ fallthrough;
882887 default:
883888 action = ACTION_FAIL;
884889 break;
drivers/scsi/scsi_lib_test.c+7−0
@@ -67,6 +67,13 @@ static void scsi_lib_test_multiple_sense(struct kunit *test) · 66 unmodified lines
6767 };
6868 int i;
6969
70+ /* Success */
71+ sc.result = 0;
72+ KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, &failures));
73+ KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL));
74+ /* Command failed but caller did not pass in a failures array */
75+ scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36);
76+ KUNIT_EXPECT_EQ(test, 0, scsi_check_passthrough(&sc, NULL));
7077 /* Match end of array */
7178 scsi_build_sense(&sc, 0, ILLEGAL_REQUEST, 0x91, 0x36);
7279 KUNIT_EXPECT_EQ(test, -EAGAIN, scsi_check_passthrough(&sc, &failures));
drivers/scsi/scsi_scan.c+1−1
@@ -246,7 +246,7 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev, · 245 unmodified lines
246246 }
247247 ret = sbitmap_init_node(&sdev->budget_map,
248248 scsi_device_max_queue_depth(sdev),
249− new_shift, GFP_KERNEL,
249+ new_shift, GFP_NOIO,
250250 sdev->request_queue->node, false, true);
251251 if (!ret)
252252 sbitmap_resize(&sdev->budget_map, depth);
drivers/scsi/storvsc_drv.c+1−0
@@ -1800,6 +1800,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) · 1799 unmodified lines
18001800
18011801 length = scsi_bufflen(scmnd);
18021802 payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb;
1803+ payload->range.len = 0;
18031804 payload_sz = 0;
18041805
18051806 if (scsi_sg_count(scmnd)) {
drivers/soc/qcom/smp2p.c+1−1
@@ -365,7 +365,7 @@ static void smp2p_irq_print_chip(struct irq_data *irqd, struct seq_file *p) · 364 unmodified lines
365365 {
366366 struct smp2p_entry *entry = irq_data_get_irq_chip_data(irqd);
367367
368− seq_printf(p, " %8s", dev_name(entry->smp2p->dev));
368+ seq_printf(p, "%8s", dev_name(entry->smp2p->dev));
369369 }
370370
371371 static struct irq_chip smp2p_irq_chip = {
drivers/spi/atmel-quadspi.c+2−2
@@ -235,8 +235,8 @@ · 234 unmodified lines
235235 /**
236236 * struct atmel_qspi_pcal - Pad Calibration Clock Division
237237 * @pclk_rate: peripheral clock rate.
238− * @pclkdiv: calibration clock division. The clock applied to the calibration
239− * cell is divided by pclkdiv + 1.
238+ * @pclk_div: calibration clock division. The clock applied to the calibration
239+ * cell is divided by pclk_div + 1.
240240 */
241241 struct atmel_qspi_pcal {
242242 u32 pclk_rate;
drivers/spi/spi-pxa2xx.c+1−1
@@ -399,7 +399,7 @@ static void lpss_ssp_cs_control(struct spi_device *spi, bool enable) · 398 unmodified lines
399399 lpss_ssp_select_cs(spi, config);
400400
401401 mask = LPSS_CS_CONTROL_CS_HIGH;
402− __lpss_ssp_update_priv(drv_data, config->reg_cs_ctrl, mask, enable ? mask : 0);
402+ __lpss_ssp_update_priv(drv_data, config->reg_cs_ctrl, mask, enable ? 0 : mask);
403403 if (config->cs_clk_stays_gated) {
404404 /*
405405 * Changing CS alone when dynamic clock gating is on won't
drivers/spi/spi-sn-f-ospi.c+3−0
@@ -116,6 +116,9 @@ struct f_ospi { · 115 unmodified lines
116116
117117 static u32 f_ospi_get_dummy_cycle(const struct spi_mem_op *op)
118118 {
119+ if (!op->dummy.nbytes)
120+ return 0;
121+
119122 return (op->dummy.nbytes * 8) / op->dummy.buswidth;
120123 }
121124
drivers/target/target_core_stat.c+2−2
@@ -117,9 +117,9 @@ static ssize_t target_stat_tgt_status_show(struct config_item *item, · 116 unmodified lines
117117 char *page)
118118 {
119119 if (to_stat_tgt_dev(item)->export_count)
120− return snprintf(page, PAGE_SIZE, "activated");
120+ return snprintf(page, PAGE_SIZE, "activated\n");
121121 else
122− return snprintf(page, PAGE_SIZE, "deactivated");
122+ return snprintf(page, PAGE_SIZE, "deactivated\n");
123123 }
124124
125125 static ssize_t target_stat_tgt_non_access_lus_show(struct config_item *item,
drivers/thermal/cpufreq_cooling.c+0−2
@@ -57,8 +57,6 @@ struct time_in_idle { · 56 unmodified lines
5757 * @max_level: maximum cooling level. One less than total number of valid
5858 * cpufreq frequencies.
5959 * @em: Reference on the Energy Model of the device
60− * @cdev: thermal_cooling_device pointer to keep track of the
61− * registered cooling device.
6260 * @policy: cpufreq policy.
6361 * @cooling_ops: cpufreq callbacks to thermal cooling device ops
6462 * @idle_time: idle time stats
drivers/tty/pty.c+1−1
@@ -798,7 +798,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) · 797 unmodified lines
798798 nonseekable_open(inode, filp);
799799
800800 /* We refuse fsnotify events on ptmx, since it's a shared resource */
801− filp->f_mode |= FMODE_NONOTIFY;
801+ file_set_fsnotify_mode(filp, FMODE_NONOTIFY);
802802
803803 retval = tty_alloc_file(filp);
804804 if (retval)
drivers/tty/serial/8250/8250.h+2−0
@@ -374,6 +374,7 @@ static inline int is_omap1510_8250(struct uart_8250_port *pt) · 373 unmodified lines
374374
375375 #ifdef CONFIG_SERIAL_8250_DMA
376376 extern int serial8250_tx_dma(struct uart_8250_port *);
377+extern void serial8250_tx_dma_flush(struct uart_8250_port *);
377378 extern int serial8250_rx_dma(struct uart_8250_port *);
378379 extern void serial8250_rx_dma_flush(struct uart_8250_port *);
379380 extern int serial8250_request_dma(struct uart_8250_port *);
@@ -406,6 +407,7 @@ static inline int serial8250_tx_dma(struct uart_8250_port *p) · 26 unmodified lines
406407 {
407408 return -1;
408409 }
410+static inline void serial8250_tx_dma_flush(struct uart_8250_port *p) { }
409411 static inline int serial8250_rx_dma(struct uart_8250_port *p)
410412 {
411413 return -1;
drivers/tty/serial/8250/8250_dma.c+16−0
@@ -149,6 +149,22 @@ err: · 148 unmodified lines
149149 return ret;
150150 }
151151
152+void serial8250_tx_dma_flush(struct uart_8250_port *p)
153+{
154+ struct uart_8250_dma *dma = p->dma;
155+
156+ if (!dma->tx_running)
157+ return;
158+
159+ /*
160+ * kfifo_reset() has been called by the serial core, avoid
161+ * advancing and underflowing in __dma_tx_complete().
162+ */
163+ dma->tx_size = 0;
164+
165+ dmaengine_terminate_async(dma->rxchan);
166+}
167+
152168 int serial8250_rx_dma(struct uart_8250_port *p)
153169 {
154170 struct uart_8250_dma *dma = p->dma;
drivers/tty/serial/8250/8250_of.c+0−1
@@ -110,7 +110,6 @@ static int of_platform_serial_setup(struct platform_device *ofdev, · 109 unmodified lines
110110 spin_lock_init(&port->lock);
111111
112112 if (resource_type(&resource) == IORESOURCE_IO) {
113− port->iotype = UPIO_PORT;
114113 port->iobase = resource.start;
115114 } else {
116115 port->mapbase = resource.start;
drivers/tty/serial/8250/8250_platform.c+0−9
@@ -112,7 +112,6 @@ static int serial8250_probe_acpi(struct platform_device *pdev) · 111 unmodified lines
112112 struct device *dev = &pdev->dev;
113113 struct uart_8250_port uart = { };
114114 struct resource *regs;
115− unsigned char iotype;
116115 int ret, line;
117116
118117 regs = platform_get_mem_or_io(pdev, 0);
@@ -122,13 +121,11 @@ static int serial8250_probe_acpi(struct platform_device *pdev) · 3 unmodified lines
122121 switch (resource_type(regs)) {
123122 case IORESOURCE_IO:
124123 uart.port.iobase = regs->start;
125− iotype = UPIO_PORT;
126124 break;
127125 case IORESOURCE_MEM:
128126 uart.port.mapbase = regs->start;
129127 uart.port.mapsize = resource_size(regs);
130128 uart.port.flags = UPF_IOREMAP;
131− iotype = UPIO_MEM;
132129 break;
133130 default:
134131 return -EINVAL;
@@ -147,12 +144,6 @@ static int serial8250_probe_acpi(struct platform_device *pdev) · 12 unmodified lines
147144 if (ret)
148145 return ret;
149146
150− /*
151− * The previous call may not set iotype correctly when reg-io-width
152− * property is absent and it doesn't support IO port resource.
153− */
154− uart.port.iotype = iotype;
155−
156147 line = serial8250_register_8250_port(&uart);
157148 if (line < 0)
158149 return line;
drivers/tty/serial/8250/8250_pnp.c+0−10
@@ -436,7 +436,6 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) · 435 unmodified lines
436436 {
437437 struct uart_8250_port uart, *port;
438438 int ret, flags = dev_id->driver_data;
439− unsigned char iotype;
440439 long line;
441440
442441 if (flags & UNKNOWN_DEV) {
@@ -448,14 +447,11 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) · 5 unmodified lines
448447 memset(&uart, 0, sizeof(uart));
449448 if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) {
450449 uart.port.iobase = pnp_port_start(dev, 2);
451− iotype = UPIO_PORT;
452450 } else if (pnp_port_valid(dev, 0)) {
453451 uart.port.iobase = pnp_port_start(dev, 0);
454− iotype = UPIO_PORT;
455452 } else if (pnp_mem_valid(dev, 0)) {
456453 uart.port.mapbase = pnp_mem_start(dev, 0);
457454 uart.port.mapsize = pnp_mem_len(dev, 0);
458− iotype = UPIO_MEM;
459455 uart.port.flags = UPF_IOREMAP;
460456 } else
461457 return -ENODEV;
@@ -471,12 +467,6 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) · 9 unmodified lines
471467 if (ret)
472468 return ret;
473469
474− /*
475− * The previous call may not set iotype correctly when reg-io-width
476− * property is absent and it doesn't support IO port resource.
477− */
478− uart.port.iotype = iotype;
479−
480470 if (flags & CIR_PORT) {
481471 uart.port.flags |= UPF_FIXED_PORT | UPF_FIXED_TYPE;
482472 uart.port.type = PORT_8250_CIR;
drivers/tty/serial/8250/8250_port.c+9−0
@@ -2555,6 +2555,14 @@ static void serial8250_shutdown(struct uart_port *port) · 2554 unmodified lines
25552555 serial8250_do_shutdown(port);
25562556 }
25572557
2558+static void serial8250_flush_buffer(struct uart_port *port)
2559+{
2560+ struct uart_8250_port *up = up_to_u8250p(port);
2561+
2562+ if (up->dma)
2563+ serial8250_tx_dma_flush(up);
2564+}
2565+
25582566 static unsigned int serial8250_do_get_divisor(struct uart_port *port,
25592567 unsigned int baud,
25602568 unsigned int *frac)
@@ -3244,6 +3252,7 @@ static const struct uart_ops serial8250_pops = { · 683 unmodified lines
32443252 .break_ctl = serial8250_break_ctl,
32453253 .startup = serial8250_startup,
32463254 .shutdown = serial8250_shutdown,
3255+ .flush_buffer = serial8250_flush_buffer,
32473256 .set_termios = serial8250_set_termios,
32483257 .set_ldisc = serial8250_set_ldisc,
32493258 .pm = serial8250_pm,
drivers/tty/serial/sc16is7xx.c+1−1
@@ -1561,7 +1561,7 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype, · 1560 unmodified lines
15611561 /* Always ask for fixed clock rate from a property. */
15621562 device_property_read_u32(dev, "clock-frequency", &uartclk);
15631563
1564− s->polling = !!irq;
1564+ s->polling = (irq <= 0);
15651565 if (s->polling)
15661566 dev_dbg(dev,
15671567 "No interrupt pin definition, falling back to polling mode\n");
drivers/tty/serial/serial_port.c+7−5
@@ -173,6 +173,7 @@ EXPORT_SYMBOL(uart_remove_one_port); · 172 unmodified lines
173173 * The caller is responsible to initialize the following fields of the @port
174174 * ->dev (must be valid)
175175 * ->flags
176+ * ->iobase
176177 * ->mapbase
177178 * ->mapsize
178179 * ->regshift (if @use_defaults is false)
@@ -214,7 +215,7 @@ static int __uart_read_properties(struct uart_port *port, bool use_defaults) · 35 unmodified lines
214215 /* Read the registers I/O access type (default: MMIO 8-bit) */
215216 ret = device_property_read_u32(dev, "reg-io-width", &value);
216217 if (ret) {
217− port->iotype = UPIO_MEM;
218+ port->iotype = port->iobase ? UPIO_PORT : UPIO_MEM;
218219 } else {
219220 switch (value) {
220221 case 1:
@@ -227,15 +228,16 @@ static int __uart_read_properties(struct uart_port *port, bool use_defaults) · 6 unmodified lines
227228 port->iotype = device_is_big_endian(dev) ? UPIO_MEM32BE : UPIO_MEM32;
228229 break;
229230 default:
230− if (!use_defaults) {
231− dev_err(dev, "Unsupported reg-io-width (%u)\n", value);
232− return -EINVAL;
233− }
234231 port->iotype = UPIO_UNKNOWN;
235232 break;
236233 }
237234 }
238235
236+ if (!use_defaults && port->iotype == UPIO_UNKNOWN) {
237+ dev_err(dev, "Unsupported reg-io-width (%u)\n", value);
238+ return -EINVAL;
239+ }
240+
239241 /* Read the address mapping base offset (default: no offset) */
240242 ret = device_property_read_u32(dev, "reg-offset", &value);
241243 if (ret)
drivers/ufs/core/ufshcd.c+35−33
@@ -2120,8 +2120,6 @@ static void ufshcd_init_clk_gating(struct ufs_hba *hba) · 2119 unmodified lines
21202120 INIT_DELAYED_WORK(&hba->clk_gating.gate_work, ufshcd_gate_work);
21212121 INIT_WORK(&hba->clk_gating.ungate_work, ufshcd_ungate_work);
21222122
2123− spin_lock_init(&hba->clk_gating.lock);
2124−
21252123 hba->clk_gating.clk_gating_workq = alloc_ordered_workqueue(
21262124 "ufs_clk_gating_%d", WQ_MEM_RECLAIM | WQ_HIGHPRI,
21272125 hba->host->host_no);
@@ -3106,8 +3104,13 @@ ufshcd_dev_cmd_completion(struct ufs_hba *hba, struct ufshcd_lrb *lrbp) · 978 unmodified lines
31063104 case UPIU_TRANSACTION_QUERY_RSP: {
31073105 u8 response = lrbp->ucd_rsp_ptr->header.response;
31083106
3109− if (response == 0)
3107+ if (response == 0) {
31103108 err = ufshcd_copy_query_response(hba, lrbp);
3109+ } else {
3110+ err = -EINVAL;
3111+ dev_err(hba->dev, "%s: unexpected response in Query RSP: %x\n",
3112+ __func__, response);
3113+ }
31113114 break;
31123115 }
31133116 case UPIU_TRANSACTION_REJECT_UPIU:
@@ -5976,24 +5979,6 @@ out: · 2862 unmodified lines
59765979 __func__, err);
59775980 }
59785981
5979−static void ufshcd_temp_exception_event_handler(struct ufs_hba *hba, u16 status)
5980−{
5981− u32 value;
5982−
5983− if (ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR,
5984− QUERY_ATTR_IDN_CASE_ROUGH_TEMP, 0, 0, &value))
5985− return;
5986−
5987− dev_info(hba->dev, "exception Tcase %d\n", value - 80);
5988−
5989− ufs_hwmon_notify_event(hba, status & MASK_EE_URGENT_TEMP);
5990−
5991− /*
5992− * A placeholder for the platform vendors to add whatever additional
5993− * steps required
5994− */
5995−}
5996−
59975982 static int __ufshcd_wb_toggle(struct ufs_hba *hba, bool set, enum flag_idn idn)
59985983 {
59995984 u8 index;
@@ -6214,7 +6199,7 @@ static void ufshcd_exception_event_handler(struct work_struct *work) · 214 unmodified lines
62146199 ufshcd_bkops_exception_event_handler(hba);
62156200
62166201 if (status & hba->ee_drv_mask & MASK_EE_URGENT_TEMP)
6217− ufshcd_temp_exception_event_handler(hba, status);
6202+ ufs_hwmon_notify_event(hba, status & MASK_EE_URGENT_TEMP);
62186203
62196204 ufs_debugfs_exception_event(hba, status);
62206205 }
@@ -9160,7 +9145,7 @@ out: · 2939 unmodified lines
91609145 if (!IS_ERR_OR_NULL(clki->clk) && clki->enabled)
91619146 clk_disable_unprepare(clki->clk);
91629147 }
9163− } else if (!ret && on) {
9148+ } else if (!ret && on && hba->clk_gating.is_initialized) {
91649149 scoped_guard(spinlock_irqsave, &hba->clk_gating.lock)
91659150 hba->clk_gating.state = CLKS_ON;
91669151 trace_ufshcd_clk_gating(dev_name(hba->dev),
@@ -10246,16 +10231,6 @@ int ufshcd_system_thaw(struct device *dev) · 1079 unmodified lines
1024610231 EXPORT_SYMBOL_GPL(ufshcd_system_thaw);
1024710232 #endif /* CONFIG_PM_SLEEP */
1024810233
10249−/**
10250− * ufshcd_dealloc_host - deallocate Host Bus Adapter (HBA)
10251− * @hba: pointer to Host Bus Adapter (HBA)
10252− */
10253−void ufshcd_dealloc_host(struct ufs_hba *hba)
10254−{
10255− scsi_host_put(hba->host);
10256−}
10257−EXPORT_SYMBOL_GPL(ufshcd_dealloc_host);
10258−
1025910234 /**
1026010235 * ufshcd_set_dma_mask - Set dma mask based on the controller
1026110236 * addressing capability
@@ -10274,12 +10249,26 @@ static int ufshcd_set_dma_mask(struct ufs_hba *hba) · 12 unmodified lines
1027410249 return dma_set_mask_and_coherent(hba->dev, DMA_BIT_MASK(32));
1027510250 }
1027610251
10252+/**
10253+ * ufshcd_devres_release - devres cleanup handler, invoked during release of
10254+ * hba->dev
10255+ * @host: pointer to SCSI host
10256+ */
10257+static void ufshcd_devres_release(void *host)
10258+{
10259+ scsi_host_put(host);
10260+}
10261+
1027710262 /**
1027810263 * ufshcd_alloc_host - allocate Host Bus Adapter (HBA)
1027910264 * @dev: pointer to device handle
1028010265 * @hba_handle: driver private handle
1028110266 *
1028210267 * Return: 0 on success, non-zero value on failure.
10268+ *
10269+ * NOTE: There is no corresponding ufshcd_dealloc_host() because this function
10270+ * keeps track of its allocations using devres and deallocates everything on
10271+ * device removal automatically.
1028310272 */
1028410273 int ufshcd_alloc_host(struct device *dev, struct ufs_hba **hba_handle)
1028510274 {
@@ -10301,6 +10290,13 @@ int ufshcd_alloc_host(struct device *dev, struct ufs_hba **hba_handle) · 15 unmodified lines
1030110290 err = -ENOMEM;
1030210291 goto out_error;
1030310292 }
10293+
10294+ err = devm_add_action_or_reset(dev, ufshcd_devres_release,
10295+ host);
10296+ if (err)
10297+ return dev_err_probe(dev, err,
10298+ "failed to add ufshcd dealloc action\n");
10299+
1030410300 host->nr_maps = HCTX_TYPE_POLL + 1;
1030510301 hba = shost_priv(host);
1030610302 hba->host = host;
@@ -10429,6 +10425,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) · 122 unmodified lines
1042910425 hba->irq = irq;
1043010426 hba->vps = &ufs_hba_vps;
1043110427
10428+ /*
10429+ * Initialize clk_gating.lock early since it is being used in
10430+ * ufshcd_setup_clocks()
10431+ */
10432+ spin_lock_init(&hba->clk_gating.lock);
10433+
1043210434 err = ufshcd_hba_init(hba);
1043310435 if (err)
1043410436 goto out_error;
drivers/ufs/host/ufshcd-pci.c+0−2
@@ -562,7 +562,6 @@ static void ufshcd_pci_remove(struct pci_dev *pdev) · 561 unmodified lines
562562 pm_runtime_forbid(&pdev->dev);
563563 pm_runtime_get_noresume(&pdev->dev);
564564 ufshcd_remove(hba);
565− ufshcd_dealloc_host(hba);
566565 }
567566
568567 /**
@@ -605,7 +604,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) · 36 unmodified lines
605604 err = ufshcd_init(hba, mmio_base, pdev->irq);
606605 if (err) {
607606 dev_err(&pdev->dev, "Initialization failed\n");
608− ufshcd_dealloc_host(hba);
609607 return err;
610608 }
611609
drivers/ufs/host/ufshcd-pltfrm.c+9−19
@@ -465,21 +465,17 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, · 464 unmodified lines
465465 struct device *dev = &pdev->dev;
466466
467467 mmio_base = devm_platform_ioremap_resource(pdev, 0);
468− if (IS_ERR(mmio_base)) {
469− err = PTR_ERR(mmio_base);
470− goto out;
471− }
468+ if (IS_ERR(mmio_base))
469+ return PTR_ERR(mmio_base);
472470
473471 irq = platform_get_irq(pdev, 0);
474− if (irq < 0) {
475− err = irq;
476− goto out;
477− }
472+ if (irq < 0)
473+ return irq;
478474
479475 err = ufshcd_alloc_host(dev, &hba);
480476 if (err) {
481477 dev_err(dev, "Allocation failed\n");
482− goto out;
478+ return err;
483479 }
484480
485481 hba->vops = vops;
@@ -488,13 +484,13 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, · 2 unmodified lines
488484 if (err) {
489485 dev_err(dev, "%s: clock parse failed %d\n",
490486 __func__, err);
491− goto dealloc_host;
487+ return err;
492488 }
493489 err = ufshcd_parse_regulator_info(hba);
494490 if (err) {
495491 dev_err(dev, "%s: regulator init failed %d\n",
496492 __func__, err);
497− goto dealloc_host;
493+ return err;
498494 }
499495
500496 ufshcd_init_lanes_per_dir(hba);
@@ -502,25 +498,20 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, · 1 unmodified line
502498 err = ufshcd_parse_operating_points(hba);
503499 if (err) {
504500 dev_err(dev, "%s: OPP parse failed %d\n", __func__, err);
505− goto dealloc_host;
501+ return err;
506502 }
507503
508504 err = ufshcd_init(hba, mmio_base, irq);
509505 if (err) {
510506 dev_err_probe(dev, err, "Initialization failed with error %d\n",
511507 err);
512− goto dealloc_host;
508+ return err;
513509 }
514510
515511 pm_runtime_set_active(dev);
516512 pm_runtime_enable(dev);
517513
518514 return 0;
519−
520−dealloc_host:
521− ufshcd_dealloc_host(hba);
522−out:
523− return err;
524515 }
525516 EXPORT_SYMBOL_GPL(ufshcd_pltfrm_init);
526517
@@ -534,7 +525,6 @@ void ufshcd_pltfrm_remove(struct platform_device *pdev) · 7 unmodified lines
534525
535526 pm_runtime_get_sync(&pdev->dev);
536527 ufshcd_remove(hba);
537− ufshcd_dealloc_host(hba);
538528 pm_runtime_disable(&pdev->dev);
539529 pm_runtime_put_noidle(&pdev->dev);
540530 }
drivers/usb/class/cdc-acm.c+21−7
@@ -371,7 +371,7 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) · 370 unmodified lines
371371 static void acm_ctrl_irq(struct urb *urb)
372372 {
373373 struct acm *acm = urb->context;
374− struct usb_cdc_notification *dr = urb->transfer_buffer;
374+ struct usb_cdc_notification *dr;
375375 unsigned int current_size = urb->actual_length;
376376 unsigned int expected_size, copy_size, alloc_size;
377377 int retval;
@@ -398,14 +398,25 @@ static void acm_ctrl_irq(struct urb *urb) · 20 unmodified lines
398398
399399 usb_mark_last_busy(acm->dev);
400400
401− if (acm->nb_index)
401+ if (acm->nb_index == 0) {
402+ /*
403+ * The first chunk of a message must contain at least the
404+ * notification header with the length field, otherwise we
405+ * can't get an expected_size.
406+ */
407+ if (current_size < sizeof(struct usb_cdc_notification)) {
408+ dev_dbg(&acm->control->dev, "urb too short\n");
409+ goto exit;
410+ }
411+ dr = urb->transfer_buffer;
412+ } else {
402413 dr = (struct usb_cdc_notification *)acm->notification_buffer;
403−
414+ }
404415 /* size = notification-header + (optional) data */
405416 expected_size = sizeof(struct usb_cdc_notification) +
406417 le16_to_cpu(dr->wLength);
407418
408− if (current_size < expected_size) {
419+ if (acm->nb_index != 0 || current_size < expected_size) {
409420 /* notification is transmitted fragmented, reassemble */
410421 if (acm->nb_size < expected_size) {
411422 u8 *new_buffer;
@@ -1727,13 +1738,16 @@ static const struct usb_device_id acm_ids[] = { · 1315 unmodified lines
17271738 { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */
17281739 .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
17291740 },
1730− { USB_DEVICE(0x045b, 0x023c), /* Renesas USB Download mode */
1741+ { USB_DEVICE(0x045b, 0x023c), /* Renesas R-Car H3 USB Download mode */
1742+ .driver_info = DISABLE_ECHO, /* Don't echo banner */
1743+ },
1744+ { USB_DEVICE(0x045b, 0x0247), /* Renesas R-Car D3 USB Download mode */
17311745 .driver_info = DISABLE_ECHO, /* Don't echo banner */
17321746 },
1733− { USB_DEVICE(0x045b, 0x0248), /* Renesas USB Download mode */
1747+ { USB_DEVICE(0x045b, 0x0248), /* Renesas R-Car M3-N USB Download mode */
17341748 .driver_info = DISABLE_ECHO, /* Don't echo banner */
17351749 },
1736− { USB_DEVICE(0x045b, 0x024D), /* Renesas USB Download mode */
1750+ { USB_DEVICE(0x045b, 0x024D), /* Renesas R-Car E3 USB Download mode */
17371751 .driver_info = DISABLE_ECHO, /* Don't echo banner */
17381752 },
17391753 { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; andrey.arapov@gmail.com */
drivers/usb/core/hub.c+12−2
@@ -1848,6 +1848,17 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) · 1847 unmodified lines
18481848 desc = intf->cur_altsetting;
18491849 hdev = interface_to_usbdev(intf);
18501850
1851+ /*
1852+ * The USB 2.0 spec prohibits hubs from having more than one
1853+ * configuration or interface, and we rely on this prohibition.
1854+ * Refuse to accept a device that violates it.
1855+ */
1856+ if (hdev->descriptor.bNumConfigurations > 1 ||
1857+ hdev->actconfig->desc.bNumInterfaces > 1) {
1858+ dev_err(&intf->dev, "Invalid hub with more than one config or interface\n");
1859+ return -EINVAL;
1860+ }
1861+
18511862 /*
18521863 * Set default autosuspend delay as 0 to speedup bus suspend,
18531864 * based on the below considerations:
@@ -4698,7 +4709,6 @@ void usb_ep0_reinit(struct usb_device *udev) · 2844 unmodified lines
46984709 EXPORT_SYMBOL_GPL(usb_ep0_reinit);
46994710
47004711 #define usb_sndaddr0pipe() (PIPE_CONTROL << 30)
4701−#define usb_rcvaddr0pipe() ((PIPE_CONTROL << 30) | USB_DIR_IN)
47024712
47034713 static int hub_set_address(struct usb_device *udev, int devnum)
47044714 {
@@ -4804,7 +4814,7 @@ static int get_bMaxPacketSize0(struct usb_device *udev, · 99 unmodified lines
48044814 for (i = 0; i < GET_MAXPACKET0_TRIES; ++i) {
48054815 /* Start with invalid values in case the transfer fails */
48064816 buf->bDescriptorType = buf->bMaxPacketSize0 = 0;
4807− rc = usb_control_msg(udev, usb_rcvaddr0pipe(),
4817+ rc = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
48084818 USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
48094819 USB_DT_DEVICE << 8, 0,
48104820 buf, size,
drivers/usb/core/quirks.c+6−0
@@ -435,6 +435,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 434 unmodified lines
435435 { USB_DEVICE(0x0c45, 0x7056), .driver_info =
436436 USB_QUIRK_IGNORE_REMOTE_WAKEUP },
437437
438+ /* Sony Xperia XZ1 Compact (lilac) smartphone in fastboot mode */
439+ { USB_DEVICE(0x0fce, 0x0dde), .driver_info = USB_QUIRK_NO_LPM },
440+
438441 /* Action Semiconductor flash disk */
439442 { USB_DEVICE(0x10d6, 0x2200), .driver_info =
440443 USB_QUIRK_STRING_FETCH_255 },
@@ -525,6 +528,9 @@ static const struct usb_device_id usb_quirk_list[] = { · 84 unmodified lines
525528 /* Blackmagic Design UltraStudio SDI */
526529 { USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM },
527530
531+ /* Teclast disk */
532+ { USB_DEVICE(0x1f75, 0x0917), .driver_info = USB_QUIRK_NO_LPM },
533+
528534 /* Hauppauge HVR-950q */
529535 { USB_DEVICE(0x2040, 0x7200), .driver_info =
530536 USB_QUIRK_CONFIG_INTF_STRINGS },
drivers/usb/dwc2/gadget.c+1−0
@@ -4615,6 +4615,7 @@ static int dwc2_hsotg_udc_stop(struct usb_gadget *gadget) · 4614 unmodified lines
46154615 spin_lock_irqsave(&hsotg->lock, flags);
46164616
46174617 hsotg->driver = NULL;
4618+ hsotg->gadget.dev.of_node = NULL;
46184619 hsotg->gadget.speed = USB_SPEED_UNKNOWN;
46194620 hsotg->enabled = 0;
46204621
drivers/usb/dwc3/core.h+1−0
@@ -717,6 +717,7 @@ struct dwc3_event_buffer { · 716 unmodified lines
717717 /**
718718 * struct dwc3_ep - device side endpoint representation
719719 * @endpoint: usb endpoint
720+ * @nostream_work: work for handling bulk NoStream
720721 * @cancelled_list: list of cancelled requests for this endpoint
721722 * @pending_list: list of pending requests for this endpoint
722723 * @started_list: list of started requests on this endpoint
drivers/usb/dwc3/gadget.c+34−0
@@ -2629,10 +2629,38 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on) · 2628 unmodified lines
26292629 {
26302630 u32 reg;
26312631 u32 timeout = 2000;
2632+ u32 saved_config = 0;
26322633
26332634 if (pm_runtime_suspended(dwc->dev))
26342635 return 0;
26352636
2637+ /*
2638+ * When operating in USB 2.0 speeds (HS/FS), ensure that
2639+ * GUSB2PHYCFG.ENBLSLPM and GUSB2PHYCFG.SUSPHY are cleared before starting
2640+ * or stopping the controller. This resolves timeout issues that occur
2641+ * during frequent role switches between host and device modes.
2642+ *
2643+ * Save and clear these settings, then restore them after completing the
2644+ * controller start or stop sequence.
2645+ *
2646+ * This solution was discovered through experimentation as it is not
2647+ * mentioned in the dwc3 programming guide. It has been tested on an
2648+ * Exynos platforms.
2649+ */
2650+ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
2651+ if (reg & DWC3_GUSB2PHYCFG_SUSPHY) {
2652+ saved_config |= DWC3_GUSB2PHYCFG_SUSPHY;
2653+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
2654+ }
2655+
2656+ if (reg & DWC3_GUSB2PHYCFG_ENBLSLPM) {
2657+ saved_config |= DWC3_GUSB2PHYCFG_ENBLSLPM;
2658+ reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM;
2659+ }
2660+
2661+ if (saved_config)
2662+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
2663+
26362664 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
26372665 if (is_on) {
26382666 if (DWC3_VER_IS_WITHIN(DWC3, ANY, 187A)) {
@@ -2660,6 +2688,12 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on) · 21 unmodified lines
26602688 reg &= DWC3_DSTS_DEVCTRLHLT;
26612689 } while (--timeout && !(!is_on ^ !reg));
26622690
2691+ if (saved_config) {
2692+ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
2693+ reg |= saved_config;
2694+ dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
2695+ }
2696+
26632697 if (!timeout)
26642698 return -ETIMEDOUT;
26652699
drivers/usb/gadget/function/f_midi.c+14−5
@@ -283,7 +283,7 @@ f_midi_complete(struct usb_ep *ep, struct usb_request *req) · 282 unmodified lines
283283 /* Our transmit completed. See if there's more to go.
284284 * f_midi_transmit eats req, don't queue it again. */
285285 req->length = 0;
286− f_midi_transmit(midi);
286+ queue_work(system_highpri_wq, &midi->work);
287287 return;
288288 }
289289 break;
@@ -907,6 +907,15 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) · 617 unmodified lines
907907
908908 status = -ENODEV;
909909
910+ /*
911+ * Reset wMaxPacketSize with maximum packet size of FS bulk transfer before
912+ * endpoint claim. This ensures that the wMaxPacketSize does not exceed the
913+ * limit during bind retries where configured dwc3 TX/RX FIFO's maxpacket
914+ * size of 512 bytes for IN/OUT endpoints in support HS speed only.
915+ */
916+ bulk_in_desc.wMaxPacketSize = cpu_to_le16(64);
917+ bulk_out_desc.wMaxPacketSize = cpu_to_le16(64);
918+
910919 /* allocate instance-specific endpoints */
911920 midi->in_ep = usb_ep_autoconfig(cdev->gadget, &bulk_in_desc);
912921 if (!midi->in_ep)
@@ -1000,11 +1009,11 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f) · 87 unmodified lines
10001009 }
10011010
10021011 /* configure the endpoint descriptors ... */
1003− ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
1004− ms_out_desc.bNumEmbMIDIJack = midi->in_ports;
1012+ ms_out_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
1013+ ms_out_desc.bNumEmbMIDIJack = midi->out_ports;
10051014
1006− ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->out_ports);
1007− ms_in_desc.bNumEmbMIDIJack = midi->out_ports;
1015+ ms_in_desc.bLength = USB_DT_MS_ENDPOINT_SIZE(midi->in_ports);
1016+ ms_in_desc.bNumEmbMIDIJack = midi->in_ports;
10081017
10091018 /* ... and add them to the list */
10101019 endpoint_descriptor_index = i;
drivers/usb/gadget/function/uvc_video.c+1−1
@@ -818,7 +818,7 @@ int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc) · 817 unmodified lines
818818 return -EINVAL;
819819
820820 /* Allocate a kthread for asynchronous hw submit handler. */
821− video->kworker = kthread_create_worker(0, "UVCG");
821+ video->kworker = kthread_run_worker(0, "UVCG");
822822 if (IS_ERR(video->kworker)) {
823823 uvcg_err(&video->uvc->func, "failed to create UVCG kworker\n");
824824 return PTR_ERR(video->kworker);
drivers/usb/gadget/udc/core.c+1−1
@@ -1543,8 +1543,8 @@ void usb_del_gadget(struct usb_gadget *gadget) · 1542 unmodified lines
15431543
15441544 kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE);
15451545 sysfs_remove_link(&udc->dev.kobj, "gadget");
1546− flush_work(&gadget->work);
15471546 device_del(&gadget->dev);
1547+ flush_work(&gadget->work);
15481548 ida_free(&gadget_id_numbers, gadget->id_number);
15491549 cancel_work_sync(&udc->vbus_work);
15501550 device_unregister(&udc->dev);
drivers/usb/gadget/udc/renesas_usb3.c+1−1
@@ -310,7 +310,7 @@ struct renesas_usb3_request { · 309 unmodified lines
310310 struct list_head queue;
311311 };
312312
313−#define USB3_EP_NAME_SIZE 8
313+#define USB3_EP_NAME_SIZE 16
314314 struct renesas_usb3_ep {
315315 struct usb_ep ep;
316316 struct renesas_usb3 *usb3;
drivers/usb/host/pci-quirks.c+9−0
@@ -958,6 +958,15 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev) · 957 unmodified lines
958958 * booting from USB disk or using a usb keyboard
959959 */
960960 hcc_params = readl(base + EHCI_HCC_PARAMS);
961+
962+ /* LS7A EHCI controller doesn't have extended capabilities, the
963+ * EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS
964+ * register should be 0x0 but it reads as 0xa0. So clear it to
965+ * avoid error messages on boot.
966+ */
967+ if (pdev->vendor == PCI_VENDOR_ID_LOONGSON && pdev->device == 0x7a14)
968+ hcc_params &= ~(0xffL << 8);
969+
961970 offset = (hcc_params >> 8) & 0xff;
962971 while (offset && --count) {
963972 pci_read_config_dword(pdev, offset, &cap);
drivers/usb/host/xhci-pci.c+4−3
@@ -653,8 +653,8 @@ put_runtime_pm: · 652 unmodified lines
653653 }
654654 EXPORT_SYMBOL_NS_GPL(xhci_pci_common_probe, "xhci");
655655
656−static const struct pci_device_id pci_ids_reject[] = {
657− /* handled by xhci-pci-renesas */
656+/* handled by xhci-pci-renesas if enabled */
657+static const struct pci_device_id pci_ids_renesas[] = {
658658 { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, 0x0014) },
659659 { PCI_DEVICE(PCI_VENDOR_ID_RENESAS, 0x0015) },
660660 { /* end: all zeroes */ }
@@ -662,7 +662,8 @@ static const struct pci_device_id pci_ids_reject[] = { · 1 unmodified line
662662
663663 static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
664664 {
665− if (pci_match_id(pci_ids_reject, dev))
665+ if (IS_ENABLED(CONFIG_USB_XHCI_PCI_RENESAS) &&
666+ pci_match_id(pci_ids_renesas, dev))
666667 return -ENODEV;
667668
668669 return xhci_pci_common_probe(dev, id);
drivers/usb/phy/phy-generic.c+1−1
@@ -212,7 +212,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) · 211 unmodified lines
212212 if (of_property_read_u32(node, "clock-frequency", &clk_rate))
213213 clk_rate = 0;
214214
215− needs_clk = of_property_read_bool(node, "clocks");
215+ needs_clk = of_property_present(node, "clocks");
216216 }
217217 nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset",
218218 GPIOD_ASIS);
drivers/usb/roles/class.c+3−2
@@ -387,8 +387,11 @@ usb_role_switch_register(struct device *parent, · 386 unmodified lines
387387 dev_set_name(&sw->dev, "%s-role-switch",
388388 desc->name ? desc->name : dev_name(parent));
389389
390+ sw->registered = true;
391+
390392 ret = device_register(&sw->dev);
391393 if (ret) {
394+ sw->registered = false;
392395 put_device(&sw->dev);
393396 return ERR_PTR(ret);
394397 }
@@ -399,8 +402,6 @@ usb_role_switch_register(struct device *parent, · 4 unmodified lines
399402 dev_warn(&sw->dev, "failed to add component\n");
400403 }
401404
402− sw->registered = true;
403−
404405 /* TODO: Symlinks for the host port and the device controller. */
405406
406407 return sw;
drivers/usb/serial/option.c+29−20
@@ -619,15 +619,6 @@ static void option_instat_callback(struct urb *urb); · 618 unmodified lines
619619 /* Luat Air72*U series based on UNISOC UIS8910 uses UNISOC's vendor ID */
620620 #define LUAT_PRODUCT_AIR720U 0x4e00
621621
622−/* MeiG Smart Technology products */
623−#define MEIGSMART_VENDOR_ID 0x2dee
624−/* MeiG Smart SRM815/SRM825L based on Qualcomm 315 */
625−#define MEIGSMART_PRODUCT_SRM825L 0x4d22
626−/* MeiG Smart SLM320 based on UNISOC UIS8910 */
627−#define MEIGSMART_PRODUCT_SLM320 0x4d41
628−/* MeiG Smart SLM770A based on ASR1803 */
629−#define MEIGSMART_PRODUCT_SLM770A 0x4d57
630−
631622 /* Device flags */
632623
633624 /* Highest interface number which can be used with NCTRL() and RSVD() */
@@ -1367,15 +1358,15 @@ static const struct usb_device_id option_ids[] = { · 733 unmodified lines
13671358 .driver_info = NCTRL(2) | RSVD(3) },
13681359 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1063, 0xff), /* Telit LN920 (ECM) */
13691360 .driver_info = NCTRL(0) | RSVD(1) },
1370− { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990 (rmnet) */
1361+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1070, 0xff), /* Telit FN990A (rmnet) */
13711362 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
1372− { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990 (MBIM) */
1363+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1071, 0xff), /* Telit FN990A (MBIM) */
13731364 .driver_info = NCTRL(0) | RSVD(1) },
1374− { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990 (RNDIS) */
1365+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1072, 0xff), /* Telit FN990A (RNDIS) */
13751366 .driver_info = NCTRL(2) | RSVD(3) },
1376− { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990 (ECM) */
1367+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1073, 0xff), /* Telit FN990A (ECM) */
13771368 .driver_info = NCTRL(0) | RSVD(1) },
1378− { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990 (PCIe) */
1369+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1075, 0xff), /* Telit FN990A (PCIe) */
13791370 .driver_info = RSVD(0) },
13801371 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x1080, 0xff), /* Telit FE990 (rmnet) */
13811372 .driver_info = NCTRL(0) | RSVD(1) | RSVD(2) },
@@ -1403,6 +1394,22 @@ static const struct usb_device_id option_ids[] = { · 21 unmodified lines
14031394 .driver_info = RSVD(0) | NCTRL(3) },
14041395 { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x10c8, 0xff), /* Telit FE910C04 (rmnet) */
14051396 .driver_info = RSVD(0) | NCTRL(2) | RSVD(3) | RSVD(4) },
1397+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x60) }, /* Telit FN990B (rmnet) */
1398+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x40) },
1399+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d0, 0x30),
1400+ .driver_info = NCTRL(5) },
1401+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x60) }, /* Telit FN990B (MBIM) */
1402+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x40) },
1403+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d1, 0x30),
1404+ .driver_info = NCTRL(6) },
1405+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x60) }, /* Telit FN990B (RNDIS) */
1406+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x40) },
1407+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d2, 0x30),
1408+ .driver_info = NCTRL(6) },
1409+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x60) }, /* Telit FN990B (ECM) */
1410+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x40) },
1411+ { USB_DEVICE_INTERFACE_PROTOCOL(TELIT_VENDOR_ID, 0x10d3, 0x30),
1412+ .driver_info = NCTRL(6) },
14061413 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910),
14071414 .driver_info = NCTRL(0) | RSVD(1) | RSVD(3) },
14081415 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_ME910_DUAL_MODEM),
@@ -2347,6 +2354,14 @@ static const struct usb_device_id option_ids[] = { · 938 unmodified lines
23472354 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a05, 0xff) }, /* Fibocom FM650-CN (NCM mode) */
23482355 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a06, 0xff) }, /* Fibocom FM650-CN (RNDIS mode) */
23492356 { USB_DEVICE_INTERFACE_CLASS(0x2cb7, 0x0a07, 0xff) }, /* Fibocom FM650-CN (MBIM mode) */
2357+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d41, 0xff, 0, 0) }, /* MeiG Smart SLM320 */
2358+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d57, 0xff, 0, 0) }, /* MeiG Smart SLM770A */
2359+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0, 0) }, /* MeiG Smart SRM815 */
2360+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x02) }, /* MeiG Smart SLM828 */
2361+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0x10, 0x03) }, /* MeiG Smart SLM828 */
2362+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x30) }, /* MeiG Smart SRM815 and SRM825L */
2363+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x40) }, /* MeiG Smart SRM825L */
2364+ { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d22, 0xff, 0xff, 0x60) }, /* MeiG Smart SRM825L */
23502365 { USB_DEVICE_INTERFACE_CLASS(0x2df3, 0x9d03, 0xff) }, /* LongSung M5710 */
23512366 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1404, 0xff) }, /* GosunCn GM500 RNDIS */
23522367 { USB_DEVICE_INTERFACE_CLASS(0x305a, 0x1405, 0xff) }, /* GosunCn GM500 MBIM */
@@ -2403,12 +2418,6 @@ static const struct usb_device_id option_ids[] = { · 50 unmodified lines
24032418 { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) },
24042419 { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) },
24052420 { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) },
2406− { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) },
2407− { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM770A, 0xff, 0, 0) },
2408− { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0, 0) },
2409− { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) },
2410− { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) },
2411− { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) },
24122421 { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */
24132422 .driver_info = NCTRL(1) },
24142423 { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0640, 0xff), /* TCL IK512 ECM */
drivers/usb/typec/tcpm/tcpm.c+1−2
@@ -5591,8 +5591,7 @@ static void run_state_machine(struct tcpm_port *port) · 5590 unmodified lines
55915591 tcpm_set_auto_vbus_discharge_threshold(port, TYPEC_PWR_MODE_USB,
55925592 port->pps_data.active, 0);
55935593 tcpm_set_charge(port, false);
5594− tcpm_set_state(port, hard_reset_state(port),
5595− port->timings.ps_src_off_time);
5594+ tcpm_set_state(port, ERROR_RECOVERY, port->timings.ps_src_off_time);
55965595 break;
55975596 case PR_SWAP_SNK_SRC_SOURCE_ON:
55985597 tcpm_enable_auto_vbus_discharge(port, true);
drivers/xen/swiotlb-xen.c+13−9
@@ -74,19 +74,21 @@ static inline phys_addr_t xen_dma_to_phys(struct device *dev, · 73 unmodified lines
7474 return xen_bus_to_phys(dev, dma_to_phys(dev, dma_addr));
7575 }
7676
77+static inline bool range_requires_alignment(phys_addr_t p, size_t size)
78+{
79+ phys_addr_t algn = 1ULL << (get_order(size) + PAGE_SHIFT);
80+ phys_addr_t bus_addr = pfn_to_bfn(XEN_PFN_DOWN(p)) << XEN_PAGE_SHIFT;
81+
82+ return IS_ALIGNED(p, algn) && !IS_ALIGNED(bus_addr, algn);
83+}
84+
7785 static inline int range_straddles_page_boundary(phys_addr_t p, size_t size)
7886 {
7987 unsigned long next_bfn, xen_pfn = XEN_PFN_DOWN(p);
8088 unsigned int i, nr_pages = XEN_PFN_UP(xen_offset_in_page(p) + size);
81− phys_addr_t algn = 1ULL << (get_order(size) + PAGE_SHIFT);
8289
8390 next_bfn = pfn_to_bfn(xen_pfn);
8491
85− /* If buffer is physically aligned, ensure DMA alignment. */
86− if (IS_ALIGNED(p, algn) &&
87− !IS_ALIGNED((phys_addr_t)next_bfn << XEN_PAGE_SHIFT, algn))
88− return 1;
89−
9092 for (i = 1; i < nr_pages; i++)
9193 if (pfn_to_bfn(++xen_pfn) != ++next_bfn)
9294 return 1;
@@ -111,7 +113,7 @@ static struct io_tlb_pool *xen_swiotlb_find_pool(struct device *dev, · 18 unmodified lines
111113 }
112114
113115 #ifdef CONFIG_X86
114−int xen_swiotlb_fixup(void *buf, unsigned long nslabs)
116+int __init xen_swiotlb_fixup(void *buf, unsigned long nslabs)
115117 {
116118 int rc;
117119 unsigned int order = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT);
@@ -156,7 +158,8 @@ xen_swiotlb_alloc_coherent(struct device *dev, size_t size, · 38 unmodified lines
156158
157159 *dma_handle = xen_phys_to_dma(dev, phys);
158160 if (*dma_handle + size - 1 > dma_mask ||
159− range_straddles_page_boundary(phys, size)) {
161+ range_straddles_page_boundary(phys, size) ||
162+ range_requires_alignment(phys, size)) {
160163 if (xen_create_contiguous_region(phys, order, fls64(dma_mask),
161164 dma_handle) != 0)
162165 goto out_free_pages;
@@ -182,7 +185,8 @@ xen_swiotlb_free_coherent(struct device *dev, size_t size, void *vaddr, · 19 unmodified lines
182185 size = ALIGN(size, XEN_PAGE_SIZE);
183186
184187 if (WARN_ON_ONCE(dma_handle + size - 1 > dev->coherent_dma_mask) ||
185− WARN_ON_ONCE(range_straddles_page_boundary(phys, size)))
188+ WARN_ON_ONCE(range_straddles_page_boundary(phys, size) ||
189+ range_requires_alignment(phys, size)))
186190 return;
187191
188192 if (TestClearPageXenRemapped(virt_to_page(vaddr)))
fs/bcachefs/Kconfig+7−0
@@ -61,6 +61,13 @@ config BCACHEFS_DEBUG · 60 unmodified lines
6161 The resulting code will be significantly slower than normal; you
6262 probably shouldn't select this option unless you're a developer.
6363
64+config BCACHEFS_INJECT_TRANSACTION_RESTARTS
65+ bool "Randomly inject transaction restarts"
66+ depends on BCACHEFS_DEBUG
67+ help
68+ Randomly inject transaction restarts in a few core paths - may have a
69+ significant performance penalty
70+
6471 config BCACHEFS_TESTS
6572 bool "bcachefs unit and performance tests"
6673 depends on BCACHEFS_FS
fs/bcachefs/alloc_background.c+25−22
@@ -1803,7 +1803,6 @@ struct discard_buckets_state { · 1802 unmodified lines
18031803 u64 open;
18041804 u64 need_journal_commit;
18051805 u64 discarded;
1806− u64 need_journal_commit_this_dev;
18071806 };
18081807
18091808 static int bch2_discard_one_bucket(struct btree_trans *trans,
@@ -1827,11 +1826,11 @@ static int bch2_discard_one_bucket(struct btree_trans *trans, · 17 unmodified lines
18271826 goto out;
18281827 }
18291828
1830− if (bch2_bucket_needs_journal_commit(&c->buckets_waiting_for_journal,
1831− c->journal.flushed_seq_ondisk,
1832− pos.inode, pos.offset)) {
1833− s->need_journal_commit++;
1834− s->need_journal_commit_this_dev++;
1829+ u64 seq_ready = bch2_bucket_journal_seq_ready(&c->buckets_waiting_for_journal,
1830+ pos.inode, pos.offset);
1831+ if (seq_ready > c->journal.flushed_seq_ondisk) {
1832+ if (seq_ready > c->journal.flushing_seq)
1833+ s->need_journal_commit++;
18351834 goto out;
18361835 }
18371836
@@ -1865,23 +1864,24 @@ static int bch2_discard_one_bucket(struct btree_trans *trans, · 27 unmodified lines
18651864 discard_locked = true;
18661865 }
18671866
1868− if (!bkey_eq(*discard_pos_done, iter.pos) &&
1869− ca->mi.discard && !c->opts.nochanges) {
1870− /*
1871− * This works without any other locks because this is the only
1872− * thread that removes items from the need_discard tree
1873− */
1874− bch2_trans_unlock_long(trans);
1875− blkdev_issue_discard(ca->disk_sb.bdev,
1876− k.k->p.offset * ca->mi.bucket_size,
1877− ca->mi.bucket_size,
1878− GFP_KERNEL);
1879− *discard_pos_done = iter.pos;
1867+ if (!bkey_eq(*discard_pos_done, iter.pos)) {
18801868 s->discarded++;
1869+ *discard_pos_done = iter.pos;
18811870
1882− ret = bch2_trans_relock_notrace(trans);
1883− if (ret)
1884− goto out;
1871+ if (ca->mi.discard && !c->opts.nochanges) {
1872+ /*
1873+ * This works without any other locks because this is the only
1874+ * thread that removes items from the need_discard tree
1875+ */
1876+ bch2_trans_unlock_long(trans);
1877+ blkdev_issue_discard(ca->disk_sb.bdev,
1878+ k.k->p.offset * ca->mi.bucket_size,
1879+ ca->mi.bucket_size,
1880+ GFP_KERNEL);
1881+ ret = bch2_trans_relock_notrace(trans);
1882+ if (ret)
1883+ goto out;
1884+ }
18851885 }
18861886
18871887 SET_BCH_ALLOC_V4_NEED_DISCARD(&a->v, false);
@@ -1929,6 +1929,9 @@ static void bch2_do_discards_work(struct work_struct *work) · 41 unmodified lines
19291929 POS(ca->dev_idx, U64_MAX), 0, k,
19301930 bch2_discard_one_bucket(trans, ca, &iter, &discard_pos_done, &s, false)));
19311931
1932+ if (s.need_journal_commit > dev_buckets_available(ca, BCH_WATERMARK_normal))
1933+ bch2_journal_flush_async(&c->journal, NULL);
1934+
19321935 trace_discard_buckets(c, s.seen, s.open, s.need_journal_commit, s.discarded,
19331936 bch2_err_str(ret));
19341937
@@ -2024,7 +2027,7 @@ static void bch2_do_discards_fast_work(struct work_struct *work) · 89 unmodified lines
20242027 break;
20252028 }
20262029
2027− trace_discard_buckets(c, s.seen, s.open, s.need_journal_commit, s.discarded, bch2_err_str(ret));
2030+ trace_discard_buckets_fast(c, s.seen, s.open, s.need_journal_commit, s.discarded, bch2_err_str(ret));
20282031
20292032 bch2_trans_put(trans);
20302033 percpu_ref_put(&ca->io_ref);
fs/bcachefs/alloc_foreground.c+7−3
@@ -205,8 +205,12 @@ static inline bool may_alloc_bucket(struct bch_fs *c, · 204 unmodified lines
205205 return false;
206206 }
207207
208− if (bch2_bucket_needs_journal_commit(&c->buckets_waiting_for_journal,
209− c->journal.flushed_seq_ondisk, bucket.inode, bucket.offset)) {
208+ u64 journal_seq_ready =
209+ bch2_bucket_journal_seq_ready(&c->buckets_waiting_for_journal,
210+ bucket.inode, bucket.offset);
211+ if (journal_seq_ready > c->journal.flushed_seq_ondisk) {
212+ if (journal_seq_ready > c->journal.flushing_seq)
213+ s->need_journal_commit++;
210214 s->skipped_need_journal_commit++;
211215 return false;
212216 }
@@ -570,7 +574,7 @@ alloc: · 357 unmodified lines
570574 ? bch2_bucket_alloc_freelist(trans, ca, watermark, &s, cl)
571575 : bch2_bucket_alloc_early(trans, ca, watermark, &s, cl);
572576
573− if (s.skipped_need_journal_commit * 2 > avail)
577+ if (s.need_journal_commit * 2 > avail)
574578 bch2_journal_flush_async(&c->journal, NULL);
575579
576580 if (!ob && s.btree_bitmap != BTREE_BITMAP_ANY) {
fs/bcachefs/alloc_types.h+1−0
@@ -18,6 +18,7 @@ struct bucket_alloc_state { · 17 unmodified lines
1818 u64 buckets_seen;
1919 u64 skipped_open;
2020 u64 skipped_need_journal_commit;
21+ u64 need_journal_commit;
2122 u64 skipped_nocow;
2223 u64 skipped_nouse;
2324 u64 skipped_mi_btree_bitmap;
fs/bcachefs/btree_iter.c+32−1
@@ -2357,6 +2357,12 @@ struct bkey_s_c bch2_btree_iter_peek_max(struct btree_iter *iter, struct bpos en · 2356 unmodified lines
23572357 bch2_btree_iter_verify_entry_exit(iter);
23582358 EBUG_ON((iter->flags & BTREE_ITER_filter_snapshots) && bkey_eq(end, POS_MAX));
23592359
2360+ ret = trans_maybe_inject_restart(trans, _RET_IP_);
2361+ if (unlikely(ret)) {
2362+ k = bkey_s_c_err(ret);
2363+ goto out_no_locked;
2364+ }
2365+
23602366 if (iter->update_path) {
23612367 bch2_path_put_nokeep(trans, iter->update_path,
23622368 iter->flags & BTREE_ITER_intent);
@@ -2622,6 +2628,12 @@ struct bkey_s_c bch2_btree_iter_peek_prev_min(struct btree_iter *iter, struct bp · 259 unmodified lines
26222628 bch2_btree_iter_verify_entry_exit(iter);
26232629 EBUG_ON((iter->flags & BTREE_ITER_filter_snapshots) && bpos_eq(end, POS_MIN));
26242630
2631+ int ret = trans_maybe_inject_restart(trans, _RET_IP_);
2632+ if (unlikely(ret)) {
2633+ k = bkey_s_c_err(ret);
2634+ goto out_no_locked;
2635+ }
2636+
26252637 while (1) {
26262638 k = __bch2_btree_iter_peek_prev(iter, search_key);
26272639 if (unlikely(!k.k))
@@ -2749,6 +2761,12 @@ struct bkey_s_c bch2_btree_iter_peek_slot(struct btree_iter *iter) · 121 unmodified lines
27492761 bch2_btree_iter_verify_entry_exit(iter);
27502762 EBUG_ON(btree_iter_path(trans, iter)->level && (iter->flags & BTREE_ITER_with_key_cache));
27512763
2764+ ret = trans_maybe_inject_restart(trans, _RET_IP_);
2765+ if (unlikely(ret)) {
2766+ k = bkey_s_c_err(ret);
2767+ goto out_no_locked;
2768+ }
2769+
27522770 /* extents can't span inode numbers: */
27532771 if ((iter->flags & BTREE_ITER_is_extents) &&
27542772 unlikely(iter->pos.offset == KEY_OFFSET_MAX)) {
@@ -3106,6 +3124,10 @@ void *__bch2_trans_kmalloc(struct btree_trans *trans, size_t size) · 351 unmodified lines
31063124
31073125 WARN_ON_ONCE(new_bytes > BTREE_TRANS_MEM_MAX);
31083126
3127+ ret = trans_maybe_inject_restart(trans, _RET_IP_);
3128+ if (ret)
3129+ return ERR_PTR(ret);
3130+
31093131 struct btree_transaction_stats *s = btree_trans_stats(trans);
31103132 s->max_mem = max(s->max_mem, new_bytes);
31113133
@@ -3163,7 +3185,8 @@ out_new_mem: · 51 unmodified lines
31633185
31643186 if (old_bytes) {
31653187 trace_and_count(c, trans_restart_mem_realloced, trans, _RET_IP_, new_bytes);
3166− return ERR_PTR(btree_trans_restart(trans, BCH_ERR_transaction_restart_mem_realloced));
3188+ return ERR_PTR(btree_trans_restart_ip(trans,
3189+ BCH_ERR_transaction_restart_mem_realloced, _RET_IP_));
31673190 }
31683191 out_change_top:
31693192 p = trans->mem + trans->mem_top;
@@ -3271,6 +3294,14 @@ u32 bch2_trans_begin(struct btree_trans *trans) · 101 unmodified lines
32713294
32723295 trans->last_begin_ip = _RET_IP_;
32733296
3297+#ifdef CONFIG_BCACHEFS_INJECT_TRANSACTION_RESTARTS
3298+ if (trans->restarted) {
3299+ trans->restart_count_this_trans++;
3300+ } else {
3301+ trans->restart_count_this_trans = 0;
3302+ }
3303+#endif
3304+
32743305 trans_set_locked(trans, false);
32753306
32763307 if (trans->restarted) {
fs/bcachefs/btree_iter.h+13−1
@@ -355,6 +355,18 @@ static int btree_trans_restart(struct btree_trans *trans, int err) · 354 unmodified lines
355355 return btree_trans_restart_ip(trans, err, _THIS_IP_);
356356 }
357357
358+static inline int trans_maybe_inject_restart(struct btree_trans *trans, unsigned long ip)
359+{
360+#ifdef CONFIG_BCACHEFS_INJECT_TRANSACTION_RESTARTS
361+ if (!(ktime_get_ns() & ~(~0ULL << min(63, (10 + trans->restart_count_this_trans))))) {
362+ trace_and_count(trans->c, trans_restart_injected, trans, ip);
363+ return btree_trans_restart_ip(trans,
364+ BCH_ERR_transaction_restart_fault_inject, ip);
365+ }
366+#endif
367+ return 0;
368+}
369+
358370 bool bch2_btree_node_upgrade(struct btree_trans *,
359371 struct btree_path *, unsigned);
360372
@@ -739,7 +751,7 @@ transaction_restart: \ · 378 unmodified lines
739751 if (!_ret2) \
740752 bch2_trans_verify_not_restarted(_trans, _restart_count);\
741753 \
742− _ret2 ?: trans_was_restarted(_trans, _restart_count); \
754+ _ret2 ?: trans_was_restarted(_trans, _orig_restart_count); \
743755 })
744756
745757 #define for_each_btree_key_max_continue(_trans, _iter, \
fs/bcachefs/btree_key_cache.c+0−1
@@ -748,7 +748,6 @@ void bch2_fs_btree_key_cache_exit(struct btree_key_cache *bc) · 747 unmodified lines
748748 rcu_read_unlock();
749749 mutex_lock(&bc->table.mutex);
750750 mutex_unlock(&bc->table.mutex);
751− rcu_read_lock();
752751 continue;
753752 }
754753 for (i = 0; i < tbl->size; i++)
fs/bcachefs/btree_trans_commit.c+4−0
@@ -999,6 +999,10 @@ int __bch2_trans_commit(struct btree_trans *trans, unsigned flags) · 998 unmodified lines
999999
10001000 bch2_trans_verify_not_unlocked_or_in_restart(trans);
10011001
1002+ ret = trans_maybe_inject_restart(trans, _RET_IP_);
1003+ if (unlikely(ret))
1004+ goto out_reset;
1005+
10021006 if (!trans->nr_updates &&
10031007 !trans->journal_entries_u64s)
10041008 goto out_reset;
fs/bcachefs/btree_types.h+3−0
@@ -509,6 +509,9 @@ struct btree_trans { · 508 unmodified lines
509509 bool notrace_relock_fail:1;
510510 enum bch_errcode restarted:16;
511511 u32 restart_count;
512+#ifdef CONFIG_BCACHEFS_INJECT_TRANSACTION_RESTARTS
513+ u32 restart_count_this_trans;
514+#endif
512515
513516 u64 last_begin_time;
514517 unsigned long last_begin_ip;
fs/bcachefs/btree_update_interior.c+2−0
@@ -681,9 +681,11 @@ static void btree_update_nodes_written(struct btree_update *as) · 680 unmodified lines
681681
682682 b = as->old_nodes[i];
683683
684+ bch2_trans_begin(trans);
684685 btree_node_lock_nopath_nofail(trans, &b->c, SIX_LOCK_read);
685686 seq = b->data ? b->data->keys.seq : 0;
686687 six_unlock_read(&b->c.lock);
688+ bch2_trans_unlock_long(trans);
687689
688690 if (seq == as->old_nodes_seq[i])
689691 wait_on_bit_io(&b->flags, BTREE_NODE_write_in_flight_inner,
fs/bcachefs/btree_update_interior.h+2−2
@@ -278,12 +278,12 @@ static inline struct btree_node_entry *want_new_bset(struct bch_fs *c, struct bt · 277 unmodified lines
278278 {
279279 struct bset_tree *t = bset_tree_last(b);
280280 struct btree_node_entry *bne = max(write_block(b),
281− (void *) btree_bkey_last(b, bset_tree_last(b)));
281+ (void *) btree_bkey_last(b, t));
282282 ssize_t remaining_space =
283283 __bch2_btree_u64s_remaining(b, bne->keys.start);
284284
285285 if (unlikely(bset_written(b, bset(b, t)))) {
286− if (remaining_space > (ssize_t) (block_bytes(c) >> 3))
286+ if (b->written + block_sectors(c) <= btree_sectors(c))
287287 return bne;
288288 } else {
289289 if (unlikely(bset_u64s(t) * sizeof(u64) > btree_write_set_buffer(b)) &&
fs/bcachefs/buckets_waiting_for_journal.c+5−7
@@ -22,23 +22,21 @@ static void bucket_table_init(struct buckets_waiting_for_journal_table *t, size_ · 21 unmodified lines
2222 memset(t->d, 0, sizeof(t->d[0]) << t->bits);
2323 }
2424
25−bool bch2_bucket_needs_journal_commit(struct buckets_waiting_for_journal *b,
26− u64 flushed_seq,
27− unsigned dev, u64 bucket)
25+u64 bch2_bucket_journal_seq_ready(struct buckets_waiting_for_journal *b,
26+ unsigned dev, u64 bucket)
2827 {
2928 struct buckets_waiting_for_journal_table *t;
3029 u64 dev_bucket = (u64) dev << 56 | bucket;
31− bool ret = false;
32− unsigned i;
30+ u64 ret = 0;
3331
3432 mutex_lock(&b->lock);
3533 t = b->t;
3634
37− for (i = 0; i < ARRAY_SIZE(t->hash_seeds); i++) {
35+ for (unsigned i = 0; i < ARRAY_SIZE(t->hash_seeds); i++) {
3836 struct bucket_hashed *h = bucket_hash(t, i, dev_bucket);
3937
4038 if (h->dev_bucket == dev_bucket) {
41− ret = h->journal_seq > flushed_seq;
39+ ret = h->journal_seq;
4240 break;
4341 }
4442 }
fs/bcachefs/buckets_waiting_for_journal.h+2−2
@@ -4,8 +4,8 @@ · 3 unmodified lines
44
55 #include "buckets_waiting_for_journal_types.h"
66
7−bool bch2_bucket_needs_journal_commit(struct buckets_waiting_for_journal *,
8− u64, unsigned, u64);
7+u64 bch2_bucket_journal_seq_ready(struct buckets_waiting_for_journal *,
8+ unsigned, u64);
99 int bch2_set_bucket_needs_journal_commit(struct buckets_waiting_for_journal *,
1010 u64, unsigned, u64, u64);
1111
fs/bcachefs/disk_accounting.h+2−0
@@ -210,11 +210,13 @@ static inline void bch2_accounting_mem_read_counters(struct bch_accounting_mem * · 209 unmodified lines
210210 static inline void bch2_accounting_mem_read(struct bch_fs *c, struct bpos p,
211211 u64 *v, unsigned nr)
212212 {
213+ percpu_down_read(&c->mark_lock);
213214 struct bch_accounting_mem *acc = &c->accounting;
214215 unsigned idx = eytzinger0_find(acc->k.data, acc->k.nr, sizeof(acc->k.data[0]),
215216 accounting_pos_cmp, &p);
216217
217218 bch2_accounting_mem_read_counters(acc, idx, v, nr, false);
219+ percpu_up_read(&c->mark_lock);
218220 }
219221
220222 static inline struct bversion journal_pos_to_bversion(struct journal_res *res, unsigned offset)
fs/bcachefs/fsck.c+31−47
@@ -823,6 +823,7 @@ struct inode_walker_entry { · 822 unmodified lines
823823 struct bch_inode_unpacked inode;
824824 u32 snapshot;
825825 u64 count;
826+ u64 i_size;
826827 };
827828
828829 struct inode_walker {
@@ -910,8 +911,9 @@ found: · 81 unmodified lines
910911 if (k.k->p.snapshot != i->snapshot && !is_whiteout) {
911912 struct inode_walker_entry new = *i;
912913
913− new.snapshot = k.k->p.snapshot;
914− new.count = 0;
914+ new.snapshot = k.k->p.snapshot;
915+ new.count = 0;
916+ new.i_size = 0;
915917
916918 struct printbuf buf = PRINTBUF;
917919 bch2_bkey_val_to_text(&buf, c, k);
@@ -1116,37 +1118,6 @@ err: · 198 unmodified lines
11161118 return ret;
11171119 }
11181120
1119−static int check_directory_size(struct btree_trans *trans,
1120− struct bch_inode_unpacked *inode_u,
1121− struct bkey_s_c inode_k, bool *write_inode)
1122−{
1123− struct btree_iter iter;
1124− struct bkey_s_c k;
1125− u64 new_size = 0;
1126− int ret;
1127−
1128− for_each_btree_key_max_norestart(trans, iter, BTREE_ID_dirents,
1129− SPOS(inode_k.k->p.offset, 0, inode_k.k->p.snapshot),
1130− POS(inode_k.k->p.offset, U64_MAX),
1131− 0, k, ret) {
1132− if (k.k->type != KEY_TYPE_dirent)
1133− continue;
1134−
1135− struct bkey_s_c_dirent dirent = bkey_s_c_to_dirent(k);
1136− struct qstr name = bch2_dirent_get_name(dirent);
1137−
1138− new_size += dirent_occupied_size(&name);
1139− }
1140− bch2_trans_iter_exit(trans, &iter);
1141−
1142− if (!ret && inode_u->bi_size != new_size) {
1143− inode_u->bi_size = new_size;
1144− *write_inode = true;
1145− }
1146−
1147− return ret;
1148−}
1149−
11501121 static int check_inode(struct btree_trans *trans,
11511122 struct btree_iter *iter,
11521123 struct bkey_s_c k,
@@ -1335,16 +1306,6 @@ static int check_inode(struct btree_trans *trans, · 182 unmodified lines
13351306 u.bi_journal_seq = journal_cur_seq(&c->journal);
13361307 do_update = true;
13371308 }
1338−
1339− if (S_ISDIR(u.bi_mode)) {
1340− ret = check_directory_size(trans, &u, k, &do_update);
1341−
1342− fsck_err_on(ret,
1343− trans, directory_size_mismatch,
1344− "directory inode %llu:%u with the mismatch directory size",
1345− u.bi_inum, k.k->p.snapshot);
1346− ret = 0;
1347− }
13481309 do_update:
13491310 if (do_update) {
13501311 ret = __bch2_fsck_write_inode(trans, &u);
@@ -2017,10 +1978,31 @@ fsck_err: · 666 unmodified lines
20171978 return ret;
20181979 }
20191980
2020−static int check_subdir_count(struct btree_trans *trans, struct inode_walker *w)
1981+static int check_dir_i_size_notnested(struct btree_trans *trans, struct inode_walker *w)
1982+{
1983+ struct bch_fs *c = trans->c;
1984+ int ret = 0;
1985+
1986+ darray_for_each(w->inodes, i)
1987+ if (fsck_err_on(i->inode.bi_size != i->i_size,
1988+ trans, inode_dir_wrong_nlink,
1989+ "directory %llu:%u with wrong i_size: got %llu, should be %llu",
1990+ w->last_pos.inode, i->snapshot, i->inode.bi_size, i->i_size)) {
1991+ i->inode.bi_size = i->i_size;
1992+ ret = bch2_fsck_write_inode(trans, &i->inode);
1993+ if (ret)
1994+ break;
1995+ }
1996+fsck_err:
1997+ bch_err_fn(c, ret);
1998+ return ret;
1999+}
2000+
2001+static int check_subdir_dirents_count(struct btree_trans *trans, struct inode_walker *w)
20212002 {
20222003 u32 restart_count = trans->restart_count;
20232004 return check_subdir_count_notnested(trans, w) ?:
2005+ check_dir_i_size_notnested(trans, w) ?:
20242006 trans_was_restarted(trans, restart_count);
20252007 }
20262008
@@ -2367,7 +2349,7 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter, · 340 unmodified lines
23672349 goto out;
23682350
23692351 if (dir->last_pos.inode != k.k->p.inode && dir->have_inodes) {
2370− ret = check_subdir_count(trans, dir);
2352+ ret = check_subdir_dirents_count(trans, dir);
23712353 if (ret)
23722354 goto err;
23732355 }
@@ -2457,9 +2439,11 @@ static int check_dirent(struct btree_trans *trans, struct btree_iter *iter, · 83 unmodified lines
24572439 if (ret)
24582440 goto err;
24592441
2460− if (d.v->d_type == DT_DIR)
2461− for_each_visible_inode(c, s, dir, d.k->p.snapshot, i)
2442+ for_each_visible_inode(c, s, dir, d.k->p.snapshot, i) {
2443+ if (d.v->d_type == DT_DIR)
24622444 i->count++;
2445+ i->i_size += bkey_bytes(d.k);
2446+ }
24632447 out:
24642448 err:
24652449 fsck_err:
fs/bcachefs/inode.h+3−1
@@ -285,12 +285,14 @@ void bch2_inode_opts_get(struct bch_io_opts *, struct bch_fs *, · 284 unmodified lines
285285 struct bch_inode_unpacked *);
286286 int bch2_inum_opts_get(struct btree_trans*, subvol_inum, struct bch_io_opts *);
287287
288+#include "rebalance.h"
289+
288290 static inline struct bch_extent_rebalance
289291 bch2_inode_rebalance_opts_get(struct bch_fs *c, struct bch_inode_unpacked *inode)
290292 {
291293 struct bch_io_opts io_opts;
292294 bch2_inode_opts_get(&io_opts, c, inode);
293− return io_opts_to_rebalance_opts(&io_opts);
295+ return io_opts_to_rebalance_opts(c, &io_opts);
294296 }
295297
296298 int bch2_inode_rm_snapshot(struct btree_trans *, u64, u32);
fs/bcachefs/io_write.c+11−1
@@ -411,6 +411,16 @@ void bch2_write_op_error(struct printbuf *out, struct bch_write_op *op) · 410 unmodified lines
411411 __bch2_write_op_error(out, op, op->pos.offset);
412412 }
413413
414+static void bch2_write_op_error_trans(struct btree_trans *trans, struct printbuf *out,
415+ struct bch_write_op *op, u64 offset)
416+{
417+ bch2_inum_offset_err_msg_trans(trans, out,
418+ (subvol_inum) { op->subvol, op->pos.inode, },
419+ offset << 9);
420+ prt_printf(out, "write error%s: ",
421+ op->flags & BCH_WRITE_MOVE ? "(internal move)" : "");
422+}
423+
414424 void bch2_submit_wbio_replicas(struct bch_write_bio *wbio, struct bch_fs *c,
415425 enum bch_data_type type,
416426 const struct bkey_i *k,
@@ -1193,7 +1203,7 @@ static void bch2_nocow_write_convert_unwritten(struct bch_write_op *op) · 776 unmodified lines
11931203 struct bkey_i *insert = bch2_keylist_front(&op->insert_keys);
11941204
11951205 struct printbuf buf = PRINTBUF;
1196− __bch2_write_op_error(&buf, op, bkey_start_offset(&insert->k));
1206+ bch2_write_op_error_trans(trans, &buf, op, bkey_start_offset(&insert->k));
11971207 prt_printf(&buf, "btree update error: %s", bch2_err_str(ret));
11981208 bch_err_ratelimited(c, "%s", buf.buf);
11991209 printbuf_exit(&buf);
fs/bcachefs/journal.c+16−2
@@ -319,6 +319,16 @@ void bch2_journal_halt(struct journal *j) · 318 unmodified lines
319319 spin_unlock(&j->lock);
320320 }
321321
322+void bch2_journal_halt_locked(struct journal *j)
323+{
324+ lockdep_assert_held(&j->lock);
325+
326+ __journal_entry_close(j, JOURNAL_ENTRY_ERROR_VAL, true);
327+ if (!j->err_seq)
328+ j->err_seq = journal_cur_seq(j);
329+ journal_wake(j);
330+}
331+
322332 static bool journal_entry_want_write(struct journal *j)
323333 {
324334 bool ret = !journal_entry_is_open(j) ||
@@ -381,9 +391,12 @@ static int journal_entry_open(struct journal *j) · 56 unmodified lines
381391 if (nr_unwritten_journal_entries(j) == ARRAY_SIZE(j->buf))
382392 return JOURNAL_ERR_max_in_flight;
383393
384− if (bch2_fs_fatal_err_on(journal_cur_seq(j) >= JOURNAL_SEQ_MAX,
385− c, "cannot start: journal seq overflow"))
394+ if (journal_cur_seq(j) >= JOURNAL_SEQ_MAX) {
395+ bch_err(c, "cannot start: journal seq overflow");
396+ if (bch2_fs_emergency_read_only_locked(c))
397+ bch_err(c, "fatal error - emergency read only");
386398 return JOURNAL_ERR_insufficient_devices; /* -EROFS */
399+ }
387400
388401 BUG_ON(!j->cur_entry_sectors);
389402
@@ -783,6 +796,7 @@ recheck_need_open: · 393 unmodified lines
783796 }
784797
785798 buf->must_flush = true;
799+ j->flushing_seq = max(j->flushing_seq, seq);
786800
787801 if (parent && !closure_wait(&buf->wait, parent))
788802 BUG();
fs/bcachefs/journal.h+1−0
@@ -409,6 +409,7 @@ bool bch2_journal_noflush_seq(struct journal *, u64, u64); · 408 unmodified lines
409409 int bch2_journal_meta(struct journal *);
410410
411411 void bch2_journal_halt(struct journal *);
412+void bch2_journal_halt_locked(struct journal *);
412413
413414 static inline int bch2_journal_error(struct journal *j)
414415 {
fs/bcachefs/journal_reclaim.c+18−19
@@ -384,12 +384,16 @@ void bch2_journal_pin_drop(struct journal *j, · 383 unmodified lines
384384 spin_unlock(&j->lock);
385385 }
386386
387−static enum journal_pin_type journal_pin_type(journal_pin_flush_fn fn)
387+static enum journal_pin_type journal_pin_type(struct journal_entry_pin *pin,
388+ journal_pin_flush_fn fn)
388389 {
389390 if (fn == bch2_btree_node_flush0 ||
390− fn == bch2_btree_node_flush1)
391− return JOURNAL_PIN_TYPE_btree;
392− else if (fn == bch2_btree_key_cache_journal_flush)
391+ fn == bch2_btree_node_flush1) {
392+ unsigned idx = fn == bch2_btree_node_flush1;
393+ struct btree *b = container_of(pin, struct btree, writes[idx].journal);
394+
395+ return JOURNAL_PIN_TYPE_btree0 - b->c.level;
396+ } else if (fn == bch2_btree_key_cache_journal_flush)
393397 return JOURNAL_PIN_TYPE_key_cache;
394398 else
395399 return JOURNAL_PIN_TYPE_other;
@@ -441,7 +445,7 @@ void bch2_journal_pin_copy(struct journal *j, · 45 unmodified lines
441445
442446 bool reclaim = __journal_pin_drop(j, dst);
443447
444− bch2_journal_pin_set_locked(j, seq, dst, flush_fn, journal_pin_type(flush_fn));
448+ bch2_journal_pin_set_locked(j, seq, dst, flush_fn, journal_pin_type(dst, flush_fn));
445449
446450 if (reclaim)
447451 bch2_journal_reclaim_fast(j);
@@ -465,7 +469,7 @@ void bch2_journal_pin_set(struct journal *j, u64 seq, · 17 unmodified lines
465469
466470 bool reclaim = __journal_pin_drop(j, pin);
467471
468− bch2_journal_pin_set_locked(j, seq, pin, flush_fn, journal_pin_type(flush_fn));
472+ bch2_journal_pin_set_locked(j, seq, pin, flush_fn, journal_pin_type(pin, flush_fn));
469473
470474 if (reclaim)
471475 bch2_journal_reclaim_fast(j);
@@ -587,7 +591,7 @@ static size_t journal_flush_pins(struct journal *j, · 115 unmodified lines
587591 spin_lock(&j->lock);
588592 /* Pin might have been dropped or rearmed: */
589593 if (likely(!err && !j->flush_in_progress_dropped))
590− list_move(&pin->list, &journal_seq_pin(j, seq)->flushed[journal_pin_type(flush_fn)]);
594+ list_move(&pin->list, &journal_seq_pin(j, seq)->flushed[journal_pin_type(pin, flush_fn)]);
591595 j->flush_in_progress = NULL;
592596 j->flush_in_progress_dropped = false;
593597 spin_unlock(&j->lock);
@@ -869,18 +873,13 @@ static int journal_flush_done(struct journal *j, u64 seq_to_flush, · 275 unmodified lines
869873
870874 mutex_lock(&j->reclaim_lock);
871875
872− if (journal_flush_pins_or_still_flushing(j, seq_to_flush,
873− BIT(JOURNAL_PIN_TYPE_key_cache)|
874− BIT(JOURNAL_PIN_TYPE_other))) {
875− *did_work = true;
876− goto unlock;
877− }
878−
879− if (journal_flush_pins_or_still_flushing(j, seq_to_flush,
880− BIT(JOURNAL_PIN_TYPE_btree))) {
881− *did_work = true;
882− goto unlock;
883− }
876+ for (int type = JOURNAL_PIN_TYPE_NR - 1;
877+ type >= 0;
878+ --type)
879+ if (journal_flush_pins_or_still_flushing(j, seq_to_flush, BIT(type))) {
880+ *did_work = true;
881+ goto unlock;
882+ }
884883
885884 if (seq_to_flush > journal_cur_seq(j))
886885 bch2_journal_entry_close(j);
fs/bcachefs/journal_types.h+5−1
@@ -53,7 +53,10 @@ struct journal_buf { · 52 unmodified lines
5353 */
5454
5555 enum journal_pin_type {
56− JOURNAL_PIN_TYPE_btree,
56+ JOURNAL_PIN_TYPE_btree3,
57+ JOURNAL_PIN_TYPE_btree2,
58+ JOURNAL_PIN_TYPE_btree1,
59+ JOURNAL_PIN_TYPE_btree0,
5760 JOURNAL_PIN_TYPE_key_cache,
5861 JOURNAL_PIN_TYPE_other,
5962 JOURNAL_PIN_TYPE_NR,
@@ -237,6 +240,7 @@ struct journal { · 177 unmodified lines
237240 /* seq, last_seq from the most recent journal entry successfully written */
238241 u64 seq_ondisk;
239242 u64 flushed_seq_ondisk;
243+ u64 flushing_seq;
240244 u64 last_seq_ondisk;
241245 u64 err_seq;
242246 u64 last_empty_seq;
fs/bcachefs/opts.h+0−14
@@ -659,18 +659,4 @@ static inline void bch2_io_opts_fixups(struct bch_io_opts *opts) · 658 unmodified lines
659659 struct bch_io_opts bch2_opts_to_inode_opts(struct bch_opts);
660660 bool bch2_opt_is_inode_opt(enum bch_opt_id);
661661
662−/* rebalance opts: */
663−
664−static inline struct bch_extent_rebalance io_opts_to_rebalance_opts(struct bch_io_opts *opts)
665−{
666− return (struct bch_extent_rebalance) {
667− .type = BIT(BCH_EXTENT_ENTRY_rebalance),
668−#define x(_name) \
669− ._name = opts->_name, \
670− ._name##_from_inode = opts->_name##_from_inode,
671− BCH_REBALANCE_OPTS()
672−#undef x
673− };
674−};
675−
676662 #endif /* _BCACHEFS_OPTS_H */
fs/bcachefs/rebalance.c+3−5
@@ -121,12 +121,10 @@ u64 bch2_bkey_sectors_need_rebalance(struct bch_fs *c, struct bkey_s_c k) · 120 unmodified lines
121121 }
122122 }
123123 incompressible:
124− if (opts->background_target &&
125− bch2_target_accepts_data(c, BCH_DATA_user, opts->background_target)) {
124+ if (opts->background_target)
126125 bkey_for_each_ptr_decode(k.k, ptrs, p, entry)
127126 if (!p.ptr.cached && !bch2_dev_in_target(c, p.ptr.dev, opts->background_target))
128127 sectors += p.crc.compressed_size;
129− }
130128
131129 return sectors;
132130 }
@@ -140,7 +138,7 @@ static bool bch2_bkey_rebalance_needs_update(struct bch_fs *c, struct bch_io_opt · 7 unmodified lines
140138 const struct bch_extent_rebalance *old = bch2_bkey_rebalance_opts(k);
141139
142140 if (k.k->type == KEY_TYPE_reflink_v || bch2_bkey_ptrs_need_rebalance(c, opts, k)) {
143− struct bch_extent_rebalance new = io_opts_to_rebalance_opts(opts);
141+ struct bch_extent_rebalance new = io_opts_to_rebalance_opts(c, opts);
144142 return old == NULL || memcmp(old, &new, sizeof(new));
145143 } else {
146144 return old != NULL;
@@ -163,7 +161,7 @@ int bch2_bkey_set_needs_rebalance(struct bch_fs *c, struct bch_io_opts *opts, · 16 unmodified lines
163161 k.k->u64s += sizeof(*old) / sizeof(u64);
164162 }
165163
166− *old = io_opts_to_rebalance_opts(opts);
164+ *old = io_opts_to_rebalance_opts(c, opts);
167165 } else {
168166 if (old)
169167 extent_entry_drop(k, (union bch_extent_entry *) old);
fs/bcachefs/rebalance.h+20−0
@@ -4,8 +4,28 @@ · 3 unmodified lines
44
55 #include "compress.h"
66 #include "disk_groups.h"
7+#include "opts.h"
78 #include "rebalance_types.h"
89
10+static inline struct bch_extent_rebalance io_opts_to_rebalance_opts(struct bch_fs *c,
11+ struct bch_io_opts *opts)
12+{
13+ struct bch_extent_rebalance r = {
14+ .type = BIT(BCH_EXTENT_ENTRY_rebalance),
15+#define x(_name) \
16+ ._name = opts->_name, \
17+ ._name##_from_inode = opts->_name##_from_inode,
18+ BCH_REBALANCE_OPTS()
19+#undef x
20+ };
21+
22+ if (r.background_target &&
23+ !bch2_target_accepts_data(c, BCH_DATA_user, r.background_target))
24+ r.background_target = 0;
25+
26+ return r;
27+};
28+
929 u64 bch2_bkey_sectors_need_rebalance(struct bch_fs *, struct bkey_s_c);
1030 int bch2_bkey_set_needs_rebalance(struct bch_fs *, struct bch_io_opts *, struct bkey_i *);
1131 int bch2_get_update_rebalance_opts(struct btree_trans *,
fs/bcachefs/reflink.c+8−8
@@ -172,7 +172,7 @@ static int bch2_indirect_extent_missing_error(struct btree_trans *trans, · 171 unmodified lines
172172 bool should_commit)
173173 {
174174 if (REFLINK_P_ERROR(p.v))
175− return -BCH_ERR_missing_indirect_extent;
175+ return 0;
176176
177177 struct bch_fs *c = trans->c;
178178 u64 live_start = REFLINK_P_IDX(p.v);
@@ -259,8 +259,6 @@ struct bkey_s_c bch2_lookup_indirect_extent(struct btree_trans *trans, · 80 unmodified lines
259259 return k;
260260
261261 if (unlikely(!bkey_extent_is_reflink_data(k.k))) {
262− bch2_trans_iter_exit(trans, iter);
263−
264262 unsigned size = min((u64) k.k->size,
265263 REFLINK_P_IDX(p.v) + p.k->size + le32_to_cpu(p.v->back_pad) -
266264 reflink_offset);
@@ -268,14 +266,16 @@ struct bkey_s_c bch2_lookup_indirect_extent(struct btree_trans *trans, · 1 unmodified line
268266
269267 int ret = bch2_indirect_extent_missing_error(trans, p, reflink_offset,
270268 k.k->p.offset, should_commit);
271− if (ret)
269+ if (ret) {
270+ bch2_trans_iter_exit(trans, iter);
272271 return bkey_s_c_err(ret);
272+ }
273273 } else if (unlikely(REFLINK_P_ERROR(p.v))) {
274− bch2_trans_iter_exit(trans, iter);
275−
276274 int ret = bch2_indirect_extent_not_missing(trans, p, should_commit);
277− if (ret)
275+ if (ret) {
276+ bch2_trans_iter_exit(trans, iter);
278277 return bkey_s_c_err(ret);
278+ }
279279 }
280280
281281 *offset_into_extent = reflink_offset - bkey_start_offset(k.k);
@@ -300,7 +300,7 @@ static int trans_trigger_reflink_p_segment(struct btree_trans *trans, · 18 unmodified lines
300300 if (ret)
301301 return ret;
302302
303− if (bkey_deleted(k.k)) {
303+ if (!bkey_refcount_c(k)) {
304304 if (!(flags & BTREE_TRIGGER_overwrite))
305305 ret = -BCH_ERR_missing_indirect_extent;
306306 goto next;
fs/bcachefs/sb-downgrade.c+1−1
@@ -92,7 +92,7 @@ · 91 unmodified lines
9292 BCH_FSCK_ERR_accounting_key_replicas_nr_devs_0, \
9393 BCH_FSCK_ERR_accounting_key_junk_at_end) \
9494 x(directory_size, \
95− BIT_ULL(BCH_RECOVERY_PASS_check_inodes), \
95+ BIT_ULL(BCH_RECOVERY_PASS_check_dirents), \
9696 BCH_FSCK_ERR_directory_size_mismatch) \
9797
9898 #define DOWNGRADE_TABLE() \
fs/bcachefs/sb-errors_format.h+2−2
@@ -180,9 +180,9 @@ enum bch_fsck_flags { · 179 unmodified lines
180180 x(ptr_crc_nonce_mismatch, 162, 0) \
181181 x(ptr_stripe_redundant, 163, 0) \
182182 x(reservation_key_nr_replicas_invalid, 164, 0) \
183− x(reflink_v_refcount_wrong, 165, 0) \
183+ x(reflink_v_refcount_wrong, 165, FSCK_AUTOFIX) \
184184 x(reflink_v_pos_bad, 292, 0) \
185− x(reflink_p_to_missing_reflink_v, 166, 0) \
185+ x(reflink_p_to_missing_reflink_v, 166, FSCK_AUTOFIX) \
186186 x(reflink_refcount_underflow, 293, 0) \
187187 x(stripe_pos_bad, 167, 0) \
188188 x(stripe_val_size_bad, 168, 0) \
fs/bcachefs/subvolume.c+6−1
@@ -428,7 +428,7 @@ static int __bch2_subvolume_delete(struct btree_trans *trans, u32 subvolid) · 427 unmodified lines
428428 bch2_bkey_get_iter_typed(trans, &snapshot_iter,
429429 BTREE_ID_snapshots, POS(0, snapid),
430430 0, snapshot);
431− ret = bkey_err(subvol);
431+ ret = bkey_err(snapshot);
432432 bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT), trans->c,
433433 "missing snapshot %u", snapid);
434434 if (ret)
@@ -440,6 +440,11 @@ static int __bch2_subvolume_delete(struct btree_trans *trans, u32 subvolid) · 5 unmodified lines
440440 bch2_bkey_get_iter_typed(trans, &snapshot_tree_iter,
441441 BTREE_ID_snapshot_trees, POS(0, treeid),
442442 0, snapshot_tree);
443+ ret = bkey_err(snapshot_tree);
444+ bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT), trans->c,
445+ "missing snapshot tree %u", treeid);
446+ if (ret)
447+ goto err;
443448
444449 if (le32_to_cpu(snapshot_tree.v->master_subvol) == subvolid) {
445450 struct bkey_i_snapshot_tree *snapshot_tree_mut =
fs/bcachefs/super.c+11−0
@@ -411,6 +411,17 @@ bool bch2_fs_emergency_read_only(struct bch_fs *c) · 410 unmodified lines
411411 return ret;
412412 }
413413
414+bool bch2_fs_emergency_read_only_locked(struct bch_fs *c)
415+{
416+ bool ret = !test_and_set_bit(BCH_FS_emergency_ro, &c->flags);
417+
418+ bch2_journal_halt_locked(&c->journal);
419+ bch2_fs_read_only_async(c);
420+
421+ wake_up(&bch2_read_only_wait);
422+ return ret;
423+}
424+
414425 static int bch2_fs_read_write_late(struct bch_fs *c)
415426 {
416427 int ret;
fs/bcachefs/super.h+1−0
@@ -29,6 +29,7 @@ int bch2_dev_resize(struct bch_fs *, struct bch_dev *, u64); · 28 unmodified lines
2929 struct bch_dev *bch2_dev_lookup(struct bch_fs *, const char *);
3030
3131 bool bch2_fs_emergency_read_only(struct bch_fs *);
32+bool bch2_fs_emergency_read_only_locked(struct bch_fs *);
3233 void bch2_fs_read_only(struct bch_fs *);
3334
3435 int bch2_fs_read_write(struct bch_fs *);
fs/bcachefs/trace.h+13−1
@@ -727,7 +727,7 @@ DEFINE_EVENT(fs_str, bucket_alloc_fail, · 726 unmodified lines
727727 TP_ARGS(c, str)
728728 );
729729
730−TRACE_EVENT(discard_buckets,
730+DECLARE_EVENT_CLASS(discard_buckets_class,
731731 TP_PROTO(struct bch_fs *c, u64 seen, u64 open,
732732 u64 need_journal_commit, u64 discarded, const char *err),
733733 TP_ARGS(c, seen, open, need_journal_commit, discarded, err),
@@ -759,6 +759,18 @@ TRACE_EVENT(discard_buckets, · 25 unmodified lines
759759 __entry->err)
760760 );
761761
762+DEFINE_EVENT(discard_buckets_class, discard_buckets,
763+ TP_PROTO(struct bch_fs *c, u64 seen, u64 open,
764+ u64 need_journal_commit, u64 discarded, const char *err),
765+ TP_ARGS(c, seen, open, need_journal_commit, discarded, err)
766+);
767+
768+DEFINE_EVENT(discard_buckets_class, discard_buckets_fast,
769+ TP_PROTO(struct bch_fs *c, u64 seen, u64 open,
770+ u64 need_journal_commit, u64 discarded, const char *err),
771+ TP_ARGS(c, seen, open, need_journal_commit, discarded, err)
772+);
773+
762774 TRACE_EVENT(bucket_invalidate,
763775 TP_PROTO(struct bch_fs *c, unsigned dev, u64 bucket, u32 sectors),
764776 TP_ARGS(c, dev, bucket, sectors),
fs/btrfs/ctree.c+2−0
@@ -1496,6 +1496,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p, · 1495 unmodified lines
14961496
14971497 if (!p->skip_locking) {
14981498 btrfs_unlock_up_safe(p, parent_level + 1);
1499+ btrfs_maybe_reset_lockdep_class(root, tmp);
14991500 tmp_locked = true;
15001501 btrfs_tree_read_lock(tmp);
15011502 btrfs_release_path(p);
@@ -1539,6 +1540,7 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p, · 37 unmodified lines
15391540
15401541 if (!p->skip_locking) {
15411542 ASSERT(ret == -EAGAIN);
1543+ btrfs_maybe_reset_lockdep_class(root, tmp);
15421544 tmp_locked = true;
15431545 btrfs_tree_read_lock(tmp);
15441546 btrfs_release_path(p);
fs/btrfs/extent_io.c+20−9
@@ -523,8 +523,6 @@ static void end_bbio_data_read(struct btrfs_bio *bbio) · 522 unmodified lines
523523 u64 end;
524524 u32 len;
525525
526− /* For now only order 0 folios are supported for data. */
527− ASSERT(folio_order(folio) == 0);
528526 btrfs_debug(fs_info,
529527 "%s: bi_sector=%llu, err=%d, mirror=%u",
530528 __func__, bio->bi_iter.bi_sector, bio->bi_status,
@@ -552,7 +550,6 @@ static void end_bbio_data_read(struct btrfs_bio *bbio) · 21 unmodified lines
552550
553551 if (likely(uptodate)) {
554552 loff_t i_size = i_size_read(inode);
555− pgoff_t end_index = i_size >> folio_shift(folio);
556553
557554 /*
558555 * Zero out the remaining part if this range straddles
@@ -561,9 +558,11 @@ static void end_bbio_data_read(struct btrfs_bio *bbio) · 2 unmodified lines
561558 * Here we should only zero the range inside the folio,
562559 * not touch anything else.
563560 *
564− * NOTE: i_size is exclusive while end is inclusive.
561+ * NOTE: i_size is exclusive while end is inclusive and
562+ * folio_contains() takes PAGE_SIZE units.
565563 */
566− if (folio_index(folio) == end_index && i_size <= end) {
564+ if (folio_contains(folio, i_size >> PAGE_SHIFT) &&
565+ i_size <= end) {
567566 u32 zero_start = max(offset_in_folio(folio, i_size),
568567 offset_in_folio(folio, start));
569568 u32 zero_len = offset_in_folio(folio, end) + 1 -
@@ -899,7 +898,6 @@ static struct extent_map *get_extent_map(struct btrfs_inode *inode, · 329 unmodified lines
899898 u64 len, struct extent_map **em_cached)
900899 {
901900 struct extent_map *em;
902− struct extent_state *cached_state = NULL;
903901
904902 ASSERT(em_cached);
905903
@@ -915,14 +913,12 @@ static struct extent_map *get_extent_map(struct btrfs_inode *inode, · 9 unmodified lines
915913 *em_cached = NULL;
916914 }
917915
918− btrfs_lock_and_flush_ordered_range(inode, start, start + len - 1, &cached_state);
919916 em = btrfs_get_extent(inode, folio, start, len);
920917 if (!IS_ERR(em)) {
921918 BUG_ON(*em_cached);
922919 refcount_inc(&em->refs);
923920 *em_cached = em;
924921 }
925− unlock_extent(&inode->io_tree, start, start + len - 1, &cached_state);
926922
927923 return em;
928924 }
@@ -956,7 +952,7 @@ static int btrfs_do_readpage(struct folio *folio, struct extent_map **em_cached, · 27 unmodified lines
956952 return ret;
957953 }
958954
959− if (folio->index == last_byte >> folio_shift(folio)) {
955+ if (folio_contains(folio, last_byte >> PAGE_SHIFT)) {
960956 size_t zero_offset = offset_in_folio(folio, last_byte);
961957
962958 if (zero_offset) {
@@ -1079,11 +1075,18 @@ static int btrfs_do_readpage(struct folio *folio, struct extent_map **em_cached, · 116 unmodified lines
10791075
10801076 int btrfs_read_folio(struct file *file, struct folio *folio)
10811077 {
1078+ struct btrfs_inode *inode = folio_to_inode(folio);
1079+ const u64 start = folio_pos(folio);
1080+ const u64 end = start + folio_size(folio) - 1;
1081+ struct extent_state *cached_state = NULL;
10821082 struct btrfs_bio_ctrl bio_ctrl = { .opf = REQ_OP_READ };
10831083 struct extent_map *em_cached = NULL;
10841084 int ret;
10851085
1086+ btrfs_lock_and_flush_ordered_range(inode, start, end, &cached_state);
10861087 ret = btrfs_do_readpage(folio, &em_cached, &bio_ctrl, NULL);
1088+ unlock_extent(&inode->io_tree, start, end, &cached_state);
1089+
10871090 free_extent_map(em_cached);
10881091
10891092 /*
@@ -2380,12 +2383,20 @@ void btrfs_readahead(struct readahead_control *rac) · 1290 unmodified lines
23802383 {
23812384 struct btrfs_bio_ctrl bio_ctrl = { .opf = REQ_OP_READ | REQ_RAHEAD };
23822385 struct folio *folio;
2386+ struct btrfs_inode *inode = BTRFS_I(rac->mapping->host);
2387+ const u64 start = readahead_pos(rac);
2388+ const u64 end = start + readahead_length(rac) - 1;
2389+ struct extent_state *cached_state = NULL;
23832390 struct extent_map *em_cached = NULL;
23842391 u64 prev_em_start = (u64)-1;
23852392
2393+ btrfs_lock_and_flush_ordered_range(inode, start, end, &cached_state);
2394+
23862395 while ((folio = readahead_folio(rac)) != NULL)
23872396 btrfs_do_readpage(folio, &em_cached, &bio_ctrl, &prev_em_start);
23882397
2398+ unlock_extent(&inode->io_tree, start, end, &cached_state);
2399+
23892400 if (em_cached)
23902401 free_extent_map(em_cached);
23912402 submit_one_bio(&bio_ctrl);
fs/btrfs/file.c+1−3
@@ -1039,7 +1039,6 @@ int btrfs_write_check(struct kiocb *iocb, size_t count) · 1038 unmodified lines
10391039 loff_t pos = iocb->ki_pos;
10401040 int ret;
10411041 loff_t oldsize;
1042− loff_t start_pos;
10431042
10441043 /*
10451044 * Quickly bail out on NOWAIT writes if we don't have the nodatacow or
@@ -1066,9 +1065,8 @@ int btrfs_write_check(struct kiocb *iocb, size_t count) · 20 unmodified lines
10661065 inode_inc_iversion(inode);
10671066 }
10681067
1069− start_pos = round_down(pos, fs_info->sectorsize);
10701068 oldsize = i_size_read(inode);
1071− if (start_pos > oldsize) {
1069+ if (pos > oldsize) {
10721070 /* Expand hole size to cover write data, preventing empty gap */
10731071 loff_t end_pos = round_up(pos + count, fs_info->sectorsize);
10741072
fs/btrfs/ordered-data.c+12−0
@@ -1229,6 +1229,18 @@ struct btrfs_ordered_extent *btrfs_split_ordered_extent( · 1228 unmodified lines
12291229 */
12301230 if (WARN_ON_ONCE(len >= ordered->num_bytes))
12311231 return ERR_PTR(-EINVAL);
1232+ /*
1233+ * If our ordered extent had an error there's no point in continuing.
1234+ * The error may have come from a transaction abort done either by this
1235+ * task or some other concurrent task, and the transaction abort path
1236+ * iterates over all existing ordered extents and sets the flag
1237+ * BTRFS_ORDERED_IOERR on them.
1238+ */
1239+ if (unlikely(flags & (1U << BTRFS_ORDERED_IOERR))) {
1240+ const int fs_error = BTRFS_FS_ERROR(fs_info);
1241+
1242+ return fs_error ? ERR_PTR(fs_error) : ERR_PTR(-EIO);
1243+ }
12321244 /* We cannot split partially completed ordered extents. */
12331245 if (ordered->bytes_left) {
12341246 ASSERT(!(flags & ~BTRFS_ORDERED_TYPE_FLAGS));
fs/btrfs/qgroup.c+5−6
@@ -1880,11 +1880,7 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su · 1879 unmodified lines
18801880 * Commit current transaction to make sure all the rfer/excl numbers
18811881 * get updated.
18821882 */
1883− trans = btrfs_start_transaction(fs_info->quota_root, 0);
1884− if (IS_ERR(trans))
1885− return PTR_ERR(trans);
1886−
1887− ret = btrfs_commit_transaction(trans);
1883+ ret = btrfs_commit_current_transaction(fs_info->quota_root);
18881884 if (ret < 0)
18891885 return ret;
18901886
@@ -1897,8 +1893,11 @@ int btrfs_qgroup_cleanup_dropped_subvolume(struct btrfs_fs_info *fs_info, u64 su · 6 unmodified lines
18971893 /*
18981894 * It's squota and the subvolume still has numbers needed for future
18991895 * accounting, in this case we can not delete it. Just skip it.
1896+ *
1897+ * Or the qgroup is already removed by a qgroup rescan. For both cases we're
1898+ * safe to ignore them.
19001899 */
1901− if (ret == -EBUSY)
1900+ if (ret == -EBUSY || ret == -ENOENT)
19021901 ret = 0;
19031902 return ret;
19041903 }
fs/btrfs/transaction.c+3−1
@@ -274,8 +274,10 @@ loop: · 273 unmodified lines
274274 cur_trans = fs_info->running_transaction;
275275 if (cur_trans) {
276276 if (TRANS_ABORTED(cur_trans)) {
277+ const int abort_error = cur_trans->aborted;
278+
277279 spin_unlock(&fs_info->trans_lock);
278− return cur_trans->aborted;
280+ return abort_error;
279281 }
280282 if (btrfs_blocked_trans_types[cur_trans->state] & type) {
281283 spin_unlock(&fs_info->trans_lock);
fs/dcache.c+3−3
@@ -1700,7 +1700,7 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) · 1699 unmodified lines
17001700 smp_store_release(&dentry->d_name.name, dname); /* ^^^ */
17011701
17021702 dentry->d_flags = 0;
1703− lockref_init(&dentry->d_lockref, 1);
1703+ lockref_init(&dentry->d_lockref);
17041704 seqcount_spinlock_init(&dentry->d_seq, &dentry->d_lock);
17051705 dentry->d_inode = NULL;
17061706 dentry->d_parent = dentry;
@@ -2966,11 +2966,11 @@ static int __d_unalias(struct dentry *dentry, struct dentry *alias) · 1259 unmodified lines
29662966 goto out_err;
29672967 m2 = &alias->d_parent->d_inode->i_rwsem;
29682968 out_unalias:
2969− if (alias->d_op->d_unalias_trylock &&
2969+ if (alias->d_op && alias->d_op->d_unalias_trylock &&
29702970 !alias->d_op->d_unalias_trylock(alias))
29712971 goto out_err;
29722972 __d_move(alias, dentry, false);
2973− if (alias->d_op->d_unalias_unlock)
2973+ if (alias->d_op && alias->d_op->d_unalias_unlock)
29742974 alias->d_op->d_unalias_unlock(alias);
29752975 ret = 0;
29762976 out_err:
fs/erofs/zdata.c+1−1
@@ -726,7 +726,7 @@ static int z_erofs_register_pcluster(struct z_erofs_frontend *fe) · 725 unmodified lines
726726 if (IS_ERR(pcl))
727727 return PTR_ERR(pcl);
728728
729− lockref_init(&pcl->lockref, 1); /* one ref for this request */
729+ lockref_init(&pcl->lockref); /* one ref for this request */
730730 pcl->algorithmformat = map->m_algorithmformat;
731731 pcl->length = 0;
732732 pcl->partial = true;
fs/file_table.c+16−0
@@ -194,6 +194,11 @@ static int init_file(struct file *f, int flags, const struct cred *cred) · 193 unmodified lines
194194 * refcount bumps we should reinitialize the reused file first.
195195 */
196196 file_ref_init(&f->f_ref, 1);
197+ /*
198+ * Disable permission and pre-content events for all files by default.
199+ * They may be enabled later by file_set_fsnotify_mode_from_watchers().
200+ */
201+ file_set_fsnotify_mode(f, FMODE_NONOTIFY_PERM);
197202 return 0;
198203 }
199204
@@ -375,7 +380,13 @@ struct file *alloc_file_pseudo(struct inode *inode, struct vfsmount *mnt, · 175 unmodified lines
375380 if (IS_ERR(file)) {
376381 ihold(inode);
377382 path_put(&path);
383+ return file;
378384 }
385+ /*
386+ * Disable all fsnotify events for pseudo files by default.
387+ * They may be enabled by caller with file_set_fsnotify_mode().
388+ */
389+ file_set_fsnotify_mode(file, FMODE_NONOTIFY);
379390 return file;
380391 }
381392 EXPORT_SYMBOL(alloc_file_pseudo);
@@ -400,6 +411,11 @@ struct file *alloc_file_pseudo_noaccount(struct inode *inode, · 18 unmodified lines
400411 return file;
401412 }
402413 file_init_path(file, &path, fops);
414+ /*
415+ * Disable all fsnotify events for pseudo files by default.
416+ * They may be enabled by caller with file_set_fsnotify_mode().
417+ */
418+ file_set_fsnotify_mode(file, FMODE_NONOTIFY);
403419 return file;
404420 }
405421 EXPORT_SYMBOL_GPL(alloc_file_pseudo_noaccount);
fs/gfs2/glock.c+1−1
@@ -1201,8 +1201,8 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number, · 1200 unmodified lines
12011201 if (glops->go_instantiate)
12021202 gl->gl_flags |= BIT(GLF_INSTANTIATE_NEEDED);
12031203 gl->gl_name = name;
1204+ lockref_init(&gl->gl_lockref);
12041205 lockdep_set_subclass(&gl->gl_lockref.lock, glops->go_subclass);
1205− gl->gl_lockref.count = 1;
12061206 gl->gl_state = LM_ST_UNLOCKED;
12071207 gl->gl_target = LM_ST_UNLOCKED;
12081208 gl->gl_demote_state = LM_ST_EXCLUSIVE;
fs/gfs2/main.c+0−1
@@ -51,7 +51,6 @@ static void gfs2_init_glock_once(void *foo) · 50 unmodified lines
5151 {
5252 struct gfs2_glock *gl = foo;
5353
54− spin_lock_init(&gl->gl_lockref.lock);
5554 INIT_LIST_HEAD(&gl->gl_holders);
5655 INIT_LIST_HEAD(&gl->gl_lru);
5756 INIT_LIST_HEAD(&gl->gl_ail_list);
fs/gfs2/quota.c+2−2
@@ -236,7 +236,7 @@ static struct gfs2_quota_data *qd_alloc(unsigned hash, struct gfs2_sbd *sdp, str · 235 unmodified lines
236236 return NULL;
237237
238238 qd->qd_sbd = sdp;
239− lockref_init(&qd->qd_lockref, 0);
239+ lockref_init(&qd->qd_lockref);
240240 qd->qd_id = qid;
241241 qd->qd_slot = -1;
242242 INIT_LIST_HEAD(&qd->qd_lru);
@@ -297,7 +297,6 @@ static int qd_get(struct gfs2_sbd *sdp, struct kqid qid, · 54 unmodified lines
297297 spin_lock_bucket(hash);
298298 *qdp = qd = gfs2_qd_search_bucket(hash, sdp, qid);
299299 if (qd == NULL) {
300− new_qd->qd_lockref.count++;
301300 *qdp = new_qd;
302301 list_add(&new_qd->qd_list, &sdp->sd_quota_list);
303302 hlist_bl_add_head_rcu(&new_qd->qd_hlist, &qd_hash_table[hash]);
@@ -1450,6 +1449,7 @@ int gfs2_quota_init(struct gfs2_sbd *sdp) · 1146 unmodified lines
14501449 if (qd == NULL)
14511450 goto fail_brelse;
14521451
1452+ qd->qd_lockref.count = 0;
14531453 set_bit(QDF_CHANGE, &qd->qd_flags);
14541454 qd->qd_change = qc_change;
14551455 qd->qd_slot = slot;
fs/namespace.c+30−24
@@ -5087,30 +5087,29 @@ static int statmount_mnt_opts(struct kstatmount *s, struct seq_file *seq) · 5086 unmodified lines
50875087 {
50885088 struct vfsmount *mnt = s->mnt;
50895089 struct super_block *sb = mnt->mnt_sb;
5090+ size_t start = seq->count;
50905091 int err;
50915092
5092− if (sb->s_op->show_options) {
5093− size_t start = seq->count;
5094−
5095− err = security_sb_show_options(seq, sb);
5096− if (err)
5097− return err;
5093+ err = security_sb_show_options(seq, sb);
5094+ if (err)
5095+ return err;
50985096
5097+ if (sb->s_op->show_options) {
50995098 err = sb->s_op->show_options(seq, mnt->mnt_root);
51005099 if (err)
51015100 return err;
5101+ }
51025102
5103− if (unlikely(seq_has_overflowed(seq)))
5104− return -EAGAIN;
5103+ if (unlikely(seq_has_overflowed(seq)))
5104+ return -EAGAIN;
51055105
5106− if (seq->count == start)
5107− return 0;
5106+ if (seq->count == start)
5107+ return 0;
51085108
5109− /* skip leading comma */
5110− memmove(seq->buf + start, seq->buf + start + 1,
5111− seq->count - start - 1);
5112− seq->count--;
5113− }
5109+ /* skip leading comma */
5110+ memmove(seq->buf + start, seq->buf + start + 1,
5111+ seq->count - start - 1);
5112+ seq->count--;
51145113
51155114 return 0;
51165115 }
@@ -5191,39 +5190,45 @@ static int statmount_string(struct kstatmount *s, u64 flag) · 74 unmodified lines
51915190 size_t kbufsize;
51925191 struct seq_file *seq = &s->seq;
51935192 struct statmount *sm = &s->sm;
5194− u32 start = seq->count;
5193+ u32 start, *offp;
5194+
5195+ /* Reserve an empty string at the beginning for any unset offsets */
5196+ if (!seq->count)
5197+ seq_putc(seq, 0);
5198+
5199+ start = seq->count;
51955200
51965201 switch (flag) {
51975202 case STATMOUNT_FS_TYPE:
5198− sm->fs_type = start;
5203+ offp = &sm->fs_type;
51995204 ret = statmount_fs_type(s, seq);
52005205 break;
52015206 case STATMOUNT_MNT_ROOT:
5202− sm->mnt_root = start;
5207+ offp = &sm->mnt_root;
52035208 ret = statmount_mnt_root(s, seq);
52045209 break;
52055210 case STATMOUNT_MNT_POINT:
5206− sm->mnt_point = start;
5211+ offp = &sm->mnt_point;
52075212 ret = statmount_mnt_point(s, seq);
52085213 break;
52095214 case STATMOUNT_MNT_OPTS:
5210− sm->mnt_opts = start;
5215+ offp = &sm->mnt_opts;
52115216 ret = statmount_mnt_opts(s, seq);
52125217 break;
52135218 case STATMOUNT_OPT_ARRAY:
5214− sm->opt_array = start;
5219+ offp = &sm->opt_array;
52155220 ret = statmount_opt_array(s, seq);
52165221 break;
52175222 case STATMOUNT_OPT_SEC_ARRAY:
5218− sm->opt_sec_array = start;
5223+ offp = &sm->opt_sec_array;
52195224 ret = statmount_opt_sec_array(s, seq);
52205225 break;
52215226 case STATMOUNT_FS_SUBTYPE:
5222− sm->fs_subtype = start;
5227+ offp = &sm->fs_subtype;
52235228 statmount_fs_subtype(s, seq);
52245229 break;
52255230 case STATMOUNT_SB_SOURCE:
5226− sm->sb_source = start;
5231+ offp = &sm->sb_source;
52275232 ret = statmount_sb_source(s, seq);
52285233 break;
52295234 default:
@@ -5251,6 +5256,7 @@ static int statmount_string(struct kstatmount *s, u64 flag) · 21 unmodified lines
52515256
52525257 seq->buf[seq->count++] = '\0';
52535258 sm->mask |= flag;
5259+ *offp = start;
52545260 return 0;
52555261 }
52565262
fs/netfs/buffered_read.c+13−6
@@ -155,8 +155,9 @@ static void netfs_read_cache_to_pagecache(struct netfs_io_request *rreq, · 154 unmodified lines
155155 netfs_cache_read_terminated, subreq);
156156 }
157157
158−static void netfs_issue_read(struct netfs_io_request *rreq,
159− struct netfs_io_subrequest *subreq)
158+static void netfs_queue_read(struct netfs_io_request *rreq,
159+ struct netfs_io_subrequest *subreq,
160+ bool last_subreq)
160161 {
161162 struct netfs_io_stream *stream = &rreq->io_streams[0];
162163
@@ -177,8 +178,17 @@ static void netfs_issue_read(struct netfs_io_request *rreq, · 14 unmodified lines
177178 }
178179 }
179180
181+ if (last_subreq) {
182+ smp_wmb(); /* Write lists before ALL_QUEUED. */
183+ set_bit(NETFS_RREQ_ALL_QUEUED, &rreq->flags);
184+ }
185+
180186 spin_unlock(&rreq->lock);
187+}
181188
189+static void netfs_issue_read(struct netfs_io_request *rreq,
190+ struct netfs_io_subrequest *subreq)
191+{
182192 switch (subreq->source) {
183193 case NETFS_DOWNLOAD_FROM_SERVER:
184194 rreq->netfs_ops->issue_read(subreq);
@@ -293,11 +303,8 @@ static void netfs_read_to_pagecache(struct netfs_io_request *rreq) · 108 unmodified lines
293303 }
294304 size -= slice;
295305 start += slice;
296− if (size <= 0) {
297− smp_wmb(); /* Write lists before ALL_QUEUED. */
298− set_bit(NETFS_RREQ_ALL_QUEUED, &rreq->flags);
299− }
300306
307+ netfs_queue_read(rreq, subreq, size <= 0);
301308 netfs_issue_read(rreq, subreq);
302309 cond_resched();
303310 } while (size > 0);
fs/netfs/internal.h+4−0
@@ -135,6 +135,8 @@ extern atomic_t netfs_n_rh_write_begin; · 134 unmodified lines
135135 extern atomic_t netfs_n_rh_write_done;
136136 extern atomic_t netfs_n_rh_write_failed;
137137 extern atomic_t netfs_n_rh_write_zskip;
138+extern atomic_t netfs_n_rh_retry_read_req;
139+extern atomic_t netfs_n_rh_retry_read_subreq;
138140 extern atomic_t netfs_n_wh_buffered_write;
139141 extern atomic_t netfs_n_wh_writethrough;
140142 extern atomic_t netfs_n_wh_dio_write;
@@ -147,6 +149,8 @@ extern atomic_t netfs_n_wh_upload_failed; · 6 unmodified lines
147149 extern atomic_t netfs_n_wh_write;
148150 extern atomic_t netfs_n_wh_write_done;
149151 extern atomic_t netfs_n_wh_write_failed;
152+extern atomic_t netfs_n_wh_retry_write_req;
153+extern atomic_t netfs_n_wh_retry_write_subreq;
150154 extern atomic_t netfs_n_wb_lock_skip;
151155 extern atomic_t netfs_n_wb_lock_wait;
152156 extern atomic_t netfs_n_folioq;
fs/netfs/read_collect.c+4−2
@@ -470,7 +470,8 @@ void netfs_read_collection_worker(struct work_struct *work) · 469 unmodified lines
470470 */
471471 void netfs_wake_read_collector(struct netfs_io_request *rreq)
472472 {
473− if (test_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &rreq->flags)) {
473+ if (test_bit(NETFS_RREQ_OFFLOAD_COLLECTION, &rreq->flags) &&
474+ !test_bit(NETFS_RREQ_RETRYING, &rreq->flags)) {
474475 if (!work_pending(&rreq->work)) {
475476 netfs_get_request(rreq, netfs_rreq_trace_get_work);
476477 if (!queue_work(system_unbound_wq, &rreq->work))
@@ -586,7 +587,8 @@ void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq) · 109 unmodified lines
586587 smp_mb__after_atomic(); /* Clear IN_PROGRESS before task state */
587588
588589 /* If we are at the head of the queue, wake up the collector. */
589− if (list_is_first(&subreq->rreq_link, &stream->subrequests))
590+ if (list_is_first(&subreq->rreq_link, &stream->subrequests) ||
591+ test_bit(NETFS_RREQ_RETRYING, &rreq->flags))
590592 netfs_wake_read_collector(rreq);
591593
592594 netfs_put_subrequest(subreq, true, netfs_sreq_trace_put_terminated);
fs/netfs/read_retry.c+33−10
@@ -14,7 +14,7 @@ static void netfs_reissue_read(struct netfs_io_request *rreq, · 13 unmodified lines
1414 {
1515 __clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
1616 __set_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags);
17− netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);
17+ netfs_stat(&netfs_n_rh_retry_read_subreq);
1818 subreq->rreq->netfs_ops->issue_read(subreq);
1919 }
2020
@@ -48,6 +48,7 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq) · 27 unmodified lines
4848 __clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
4949 subreq->retry_count++;
5050 netfs_reset_iter(subreq);
51+ netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);
5152 netfs_reissue_read(rreq, subreq);
5253 }
5354 }
@@ -75,7 +76,7 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq) · 21 unmodified lines
7576 struct iov_iter source;
7677 unsigned long long start, len;
7778 size_t part;
78− bool boundary = false;
79+ bool boundary = false, subreq_superfluous = false;
7980
8081 /* Go through the subreqs and find the next span of contiguous
8182 * buffer that we then rejig (cifs, for example, needs the
@@ -116,8 +117,10 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq) · 34 unmodified lines
116117 /* Work through the sublist. */
117118 subreq = from;
118119 list_for_each_entry_from(subreq, &stream->subrequests, rreq_link) {
119− if (!len)
120+ if (!len) {
121+ subreq_superfluous = true;
120122 break;
123+ }
121124 subreq->source = NETFS_DOWNLOAD_FROM_SERVER;
122125 subreq->start = start - subreq->transferred;
123126 subreq->len = len + subreq->transferred;
@@ -154,19 +157,21 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq) · 30 unmodified lines
154157
155158 netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);
156159 netfs_reissue_read(rreq, subreq);
157− if (subreq == to)
160+ if (subreq == to) {
161+ subreq_superfluous = false;
158162 break;
163+ }
159164 }
160165
161166 /* If we managed to use fewer subreqs, we can discard the
162167 * excess; if we used the same number, then we're done.
163168 */
164169 if (!len) {
165− if (subreq == to)
170+ if (!subreq_superfluous)
166171 continue;
167172 list_for_each_entry_safe_from(subreq, tmp,
168173 &stream->subrequests, rreq_link) {
169− trace_netfs_sreq(subreq, netfs_sreq_trace_discard);
174+ trace_netfs_sreq(subreq, netfs_sreq_trace_superfluous);
170175 list_del(&subreq->rreq_link);
171176 netfs_put_subrequest(subreq, false, netfs_sreq_trace_put_done);
172177 if (subreq == to)
@@ -187,14 +192,12 @@ static void netfs_retry_read_subrequests(struct netfs_io_request *rreq) · 14 unmodified lines
187192 subreq->source = NETFS_DOWNLOAD_FROM_SERVER;
188193 subreq->start = start;
189194 subreq->len = len;
190− subreq->debug_index = atomic_inc_return(&rreq->subreq_counter);
191195 subreq->stream_nr = stream->stream_nr;
192196 subreq->retry_count = 1;
193197
194198 trace_netfs_sreq_ref(rreq->debug_id, subreq->debug_index,
195199 refcount_read(&subreq->ref),
196200 netfs_sreq_trace_new);
197− netfs_get_subrequest(subreq, netfs_sreq_trace_get_resubmit);
198201
199202 list_add(&subreq->rreq_link, &to->rreq_link);
200203 to = list_next_entry(to, rreq_link);
@@ -256,14 +259,34 @@ void netfs_retry_reads(struct netfs_io_request *rreq) · 55 unmodified lines
256259 {
257260 struct netfs_io_subrequest *subreq;
258261 struct netfs_io_stream *stream = &rreq->io_streams[0];
262+ DEFINE_WAIT(myself);
263+
264+ netfs_stat(&netfs_n_rh_retry_read_req);
265+
266+ set_bit(NETFS_RREQ_RETRYING, &rreq->flags);
259267
260268 /* Wait for all outstanding I/O to quiesce before performing retries as
261269 * we may need to renegotiate the I/O sizes.
262270 */
263271 list_for_each_entry(subreq, &stream->subrequests, rreq_link) {
264− wait_on_bit(&subreq->flags, NETFS_SREQ_IN_PROGRESS,
265− TASK_UNINTERRUPTIBLE);
272+ if (!test_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags))
273+ continue;
274+
275+ trace_netfs_rreq(rreq, netfs_rreq_trace_wait_queue);
276+ for (;;) {
277+ prepare_to_wait(&rreq->waitq, &myself, TASK_UNINTERRUPTIBLE);
278+
279+ if (!test_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags))
280+ break;
281+
282+ trace_netfs_sreq(subreq, netfs_sreq_trace_wait_for);
283+ schedule();
284+ trace_netfs_rreq(rreq, netfs_rreq_trace_woke_queue);
285+ }
286+
287+ finish_wait(&rreq->waitq, &myself);
266288 }
289+ clear_bit(NETFS_RREQ_RETRYING, &rreq->flags);
267290
268291 trace_netfs_rreq(rreq, netfs_rreq_trace_resubmit);
269292 netfs_retry_read_subrequests(rreq);
fs/netfs/stats.c+9−0
@@ -29,6 +29,8 @@ atomic_t netfs_n_rh_write_begin; · 28 unmodified lines
2929 atomic_t netfs_n_rh_write_done;
3030 atomic_t netfs_n_rh_write_failed;
3131 atomic_t netfs_n_rh_write_zskip;
32+atomic_t netfs_n_rh_retry_read_req;
33+atomic_t netfs_n_rh_retry_read_subreq;
3234 atomic_t netfs_n_wh_buffered_write;
3335 atomic_t netfs_n_wh_writethrough;
3436 atomic_t netfs_n_wh_dio_write;
@@ -41,6 +43,8 @@ atomic_t netfs_n_wh_upload_failed; · 6 unmodified lines
4143 atomic_t netfs_n_wh_write;
4244 atomic_t netfs_n_wh_write_done;
4345 atomic_t netfs_n_wh_write_failed;
46+atomic_t netfs_n_wh_retry_write_req;
47+atomic_t netfs_n_wh_retry_write_subreq;
4448 atomic_t netfs_n_wb_lock_skip;
4549 atomic_t netfs_n_wb_lock_wait;
4650 atomic_t netfs_n_folioq;
@@ -81,6 +85,11 @@ int netfs_stats_show(struct seq_file *m, void *v) · 34 unmodified lines
8185 atomic_read(&netfs_n_wh_write),
8286 atomic_read(&netfs_n_wh_write_done),
8387 atomic_read(&netfs_n_wh_write_failed));
88+ seq_printf(m, "Retries: rq=%u rs=%u wq=%u ws=%u\n",
89+ atomic_read(&netfs_n_rh_retry_read_req),
90+ atomic_read(&netfs_n_rh_retry_read_subreq),
91+ atomic_read(&netfs_n_wh_retry_write_req),
92+ atomic_read(&netfs_n_wh_retry_write_subreq));
8493 seq_printf(m, "Objs : rr=%u sr=%u foq=%u wsc=%u\n",
8594 atomic_read(&netfs_n_rh_rreq),
8695 atomic_read(&netfs_n_rh_sreq),
fs/netfs/write_issue.c+1−0
@@ -253,6 +253,7 @@ void netfs_reissue_write(struct netfs_io_stream *stream, · 252 unmodified lines
253253 subreq->retry_count++;
254254 __clear_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags);
255255 __set_bit(NETFS_SREQ_IN_PROGRESS, &subreq->flags);
256+ netfs_stat(&netfs_n_wh_retry_write_subreq);
256257 netfs_do_issue_write(stream, subreq);
257258 }
258259
fs/netfs/write_retry.c+2−0
@@ -203,6 +203,8 @@ void netfs_retry_writes(struct netfs_io_request *wreq) · 202 unmodified lines
203203 struct netfs_io_stream *stream;
204204 int s;
205205
206+ netfs_stat(&netfs_n_wh_retry_write_req);
207+
206208 /* Wait for all outstanding I/O to quiesce before performing retries as
207209 * we may need to renegotiate the I/O sizes.
208210 */
fs/nfsd/filecache.c+10−1
@@ -446,11 +446,20 @@ nfsd_file_dispose_list_delayed(struct list_head *dispose) · 445 unmodified lines
446446 struct nfsd_file, nf_gc);
447447 struct nfsd_net *nn = net_generic(nf->nf_net, nfsd_net_id);
448448 struct nfsd_fcache_disposal *l = nn->fcache_disposal;
449+ struct svc_serv *serv;
449450
450451 spin_lock(&l->lock);
451452 list_move_tail(&nf->nf_gc, &l->freeme);
452453 spin_unlock(&l->lock);
453− svc_wake_up(nn->nfsd_serv);
454+
455+ /*
456+ * The filecache laundrette is shut down after the
457+ * nn->nfsd_serv pointer is cleared, but before the
458+ * svc_serv is freed.
459+ */
460+ serv = nn->nfsd_serv;
461+ if (serv)
462+ svc_wake_up(serv);
454463 }
455464 }
456465
fs/nfsd/nfs2acl.c+2−0
@@ -84,6 +84,8 @@ out: · 83 unmodified lines
8484 fail:
8585 posix_acl_release(resp->acl_access);
8686 posix_acl_release(resp->acl_default);
87+ resp->acl_access = NULL;
88+ resp->acl_default = NULL;
8789 goto out;
8890 }
8991
fs/nfsd/nfs3acl.c+2−0
@@ -76,6 +76,8 @@ out: · 75 unmodified lines
7676 fail:
7777 posix_acl_release(resp->acl_access);
7878 posix_acl_release(resp->acl_default);
79+ resp->acl_access = NULL;
80+ resp->acl_default = NULL;
7981 goto out;
8082 }
8183
fs/nfsd/nfs4callback.c+6−3
@@ -679,7 +679,7 @@ static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp, · 678 unmodified lines
679679 return status;
680680
681681 status = decode_cb_op_status(xdr, OP_CB_GETATTR, &cb->cb_status);
682− if (unlikely(status || cb->cb_seq_status))
682+ if (unlikely(status || cb->cb_status))
683683 return status;
684684 if (xdr_stream_decode_uint32_array(xdr, bitmap, 3) < 0)
685685 return -NFSERR_BAD_XDR;
@@ -1583,8 +1583,11 @@ nfsd4_run_cb_work(struct work_struct *work) · 897 unmodified lines
15831583 nfsd4_process_cb_update(cb);
15841584
15851585 clnt = clp->cl_cb_client;
1586− if (!clnt) {
1587− /* Callback channel broken, or client killed; give up: */
1586+ if (!clnt || clp->cl_state == NFSD4_COURTESY) {
1587+ /*
1588+ * Callback channel broken, client killed or
1589+ * nfs4_client in courtesy state; give up.
1590+ */
15881591 nfsd41_destroy_cb(cb);
15891592 return;
15901593 }
fs/nfsd/nfs4state.c+2−1
@@ -4459,10 +4459,11 @@ nfsd4_sequence(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 4458 unmodified lines
44594459 }
44604460 } while (slot && --cnt > 0);
44614461 }
4462+
4463+out:
44624464 seq->maxslots = max(session->se_target_maxslots, seq->maxslots);
44634465 seq->target_maxslots = session->se_target_maxslots;
44644466
4465−out:
44664467 switch (clp->cl_cb_state) {
44674468 case NFSD4_CB_DOWN:
44684469 seq->status_flags = SEQ4_STATUS_CB_PATH_DOWN;
fs/nfsd/nfsfh.c+3−2
@@ -380,8 +380,9 @@ __fh_verify(struct svc_rqst *rqstp, · 379 unmodified lines
380380 error = check_nfsd_access(exp, rqstp, may_bypass_gss);
381381 if (error)
382382 goto out;
383−
384− svc_xprt_set_valid(rqstp->rq_xprt);
383+ /* During LOCALIO call to fh_verify will be called with a NULL rqstp */
384+ if (rqstp)
385+ svc_xprt_set_valid(rqstp->rq_xprt);
385386
386387 /* Finally, check access permissions. */
387388 error = nfsd_permission(cred, exp, dentry, access);
fs/notify/fsnotify.c+12−6
@@ -648,7 +648,7 @@ EXPORT_SYMBOL_GPL(fsnotify); · 647 unmodified lines
648648 * Later, fsnotify permission hooks do not check if there are permission event
649649 * watches, but that there were permission event watches at open time.
650650 */
651−void file_set_fsnotify_mode(struct file *file)
651+void file_set_fsnotify_mode_from_watchers(struct file *file)
652652 {
653653 struct dentry *dentry = file->f_path.dentry, *parent;
654654 struct super_block *sb = dentry->d_sb;
@@ -665,7 +665,7 @@ void file_set_fsnotify_mode(struct file *file) · 10 unmodified lines
665665 */
666666 if (likely(!fsnotify_sb_has_priority_watchers(sb,
667667 FSNOTIFY_PRIO_CONTENT))) {
668− file->f_mode |= FMODE_NONOTIFY_PERM;
668+ file_set_fsnotify_mode(file, FMODE_NONOTIFY_PERM);
669669 return;
670670 }
671671
@@ -676,7 +676,7 @@ void file_set_fsnotify_mode(struct file *file) · 4 unmodified lines
676676 if ((!d_is_dir(dentry) && !d_is_reg(dentry)) ||
677677 likely(!fsnotify_sb_has_priority_watchers(sb,
678678 FSNOTIFY_PRIO_PRE_CONTENT))) {
679− file->f_mode |= FMODE_NONOTIFY | FMODE_NONOTIFY_PERM;
679+ file_set_fsnotify_mode(file, FMODE_NONOTIFY | FMODE_NONOTIFY_PERM);
680680 return;
681681 }
682682
@@ -686,19 +686,25 @@ void file_set_fsnotify_mode(struct file *file) · 3 unmodified lines
686686 */
687687 mnt_mask = READ_ONCE(real_mount(file->f_path.mnt)->mnt_fsnotify_mask);
688688 if (unlikely(fsnotify_object_watched(d_inode(dentry), mnt_mask,
689− FSNOTIFY_PRE_CONTENT_EVENTS)))
689+ FSNOTIFY_PRE_CONTENT_EVENTS))) {
690+ /* Enable pre-content events */
691+ file_set_fsnotify_mode(file, 0);
690692 return;
693+ }
691694
692695 /* Is parent watching for pre-content events on this file? */
693696 if (dentry->d_flags & DCACHE_FSNOTIFY_PARENT_WATCHED) {
694697 parent = dget_parent(dentry);
695698 p_mask = fsnotify_inode_watches_children(d_inode(parent));
696699 dput(parent);
697− if (p_mask & FSNOTIFY_PRE_CONTENT_EVENTS)
700+ if (p_mask & FSNOTIFY_PRE_CONTENT_EVENTS) {
701+ /* Enable pre-content events */
702+ file_set_fsnotify_mode(file, 0);
698703 return;
704+ }
699705 }
700706 /* Nobody watching for pre-content events from this file */
701− file->f_mode |= FMODE_NONOTIFY | FMODE_NONOTIFY_PERM;
707+ file_set_fsnotify_mode(file, FMODE_NONOTIFY | FMODE_NONOTIFY_PERM);
702708 }
703709 #endif
704710
fs/open.c+6−5
@@ -905,7 +905,8 @@ static int do_dentry_open(struct file *f, · 904 unmodified lines
905905 f->f_sb_err = file_sample_sb_err(f);
906906
907907 if (unlikely(f->f_flags & O_PATH)) {
908− f->f_mode = FMODE_PATH | FMODE_OPENED | FMODE_NONOTIFY;
908+ f->f_mode = FMODE_PATH | FMODE_OPENED;
909+ file_set_fsnotify_mode(f, FMODE_NONOTIFY);
909910 f->f_op = &empty_fops;
910911 return 0;
911912 }
@@ -935,10 +936,10 @@ static int do_dentry_open(struct file *f, · 23 unmodified lines
935936
936937 /*
937938 * Set FMODE_NONOTIFY_* bits according to existing permission watches.
938− * If FMODE_NONOTIFY was already set for an fanotify fd, this doesn't
939− * change anything.
939+ * If FMODE_NONOTIFY mode was already set for an fanotify fd or for a
940+ * pseudo file, this call will not change the mode.
940941 */
941− file_set_fsnotify_mode(f);
942+ file_set_fsnotify_mode_from_watchers(f);
942943 error = fsnotify_open_perm(f);
943944 if (error)
944945 goto cleanup_all;
@@ -1122,7 +1123,7 @@ struct file *dentry_open_nonotify(const struct path *path, int flags, · 177 unmodified lines
11221123 if (!IS_ERR(f)) {
11231124 int error;
11241125
1125− f->f_mode |= FMODE_NONOTIFY;
1126+ file_set_fsnotify_mode(f, FMODE_NONOTIFY);
11261127 error = vfs_open(path, f);
11271128 if (error) {
11281129 fput(f);
fs/pidfs.c+11−1
@@ -287,7 +287,6 @@ static bool pidfs_ioctl_valid(unsigned int cmd) · 286 unmodified lines
287287 switch (cmd) {
288288 case FS_IOC_GETVERSION:
289289 case PIDFD_GET_CGROUP_NAMESPACE:
290− case PIDFD_GET_INFO:
291290 case PIDFD_GET_IPC_NAMESPACE:
292291 case PIDFD_GET_MNT_NAMESPACE:
293292 case PIDFD_GET_NET_NAMESPACE:
@@ -300,6 +299,17 @@ static bool pidfs_ioctl_valid(unsigned int cmd) · 6 unmodified lines
300299 return true;
301300 }
302301
302+ /* Extensible ioctls require some more careful checks. */
303+ switch (_IOC_NR(cmd)) {
304+ case _IOC_NR(PIDFD_GET_INFO):
305+ /*
306+ * Try to prevent performing a pidfd ioctl when someone
307+ * erronously mistook the file descriptor for a pidfd.
308+ * This is not perfect but will catch most cases.
309+ */
310+ return (_IOC_TYPE(cmd) == _IOC_TYPE(PIDFD_GET_INFO));
311+ }
312+
303313 return false;
304314 }
305315
fs/pipe.c+6−0
@@ -960,6 +960,12 @@ int create_pipe_files(struct file **res, int flags) · 959 unmodified lines
960960 res[1] = f;
961961 stream_open(inode, res[0]);
962962 stream_open(inode, res[1]);
963+ /*
964+ * Disable permission and pre-content events, but enable legacy
965+ * inotify events for legacy users.
966+ */
967+ file_set_fsnotify_mode(res[0], FMODE_NONOTIFY_PERM);
968+ file_set_fsnotify_mode(res[1], FMODE_NONOTIFY_PERM);
963969 return 0;
964970 }
965971
fs/proc/vmcore.c+4−1
@@ -1524,7 +1524,7 @@ int vmcore_add_device_dump(struct vmcoredd_data *data) · 1523 unmodified lines
15241524 pr_warn_once("Unexpected adding of device dump\n");
15251525 if (vmcore_open) {
15261526 ret = -EBUSY;
1527− goto out_err;
1527+ goto unlock;
15281528 }
15291529
15301530 list_add_tail(&dump->list, &vmcoredd_list);
@@ -1532,6 +1532,9 @@ int vmcore_add_device_dump(struct vmcoredd_data *data) · 1 unmodified line
15321532 mutex_unlock(&vmcore_mutex);
15331533 return 0;
15341534
1535+unlock:
1536+ mutex_unlock(&vmcore_mutex);
1537+
15351538 out_err:
15361539 vfree(buf);
15371540 vfree(dump);
fs/smb/client/cifsglob.h+10−10
@@ -253,6 +253,7 @@ struct cifs_cred { · 252 unmodified lines
253253 struct cifs_open_info_data {
254254 bool adjust_tz;
255255 bool reparse_point;
256+ bool contains_posix_file_info;
256257 struct {
257258 /* ioctl response buffer */
258259 struct {
@@ -357,7 +358,7 @@ struct smb_version_operations { · 98 unmodified lines
357358 int (*handle_cancelled_mid)(struct mid_q_entry *, struct TCP_Server_Info *);
358359 void (*downgrade_oplock)(struct TCP_Server_Info *server,
359360 struct cifsInodeInfo *cinode, __u32 oplock,
360− unsigned int epoch, bool *purge_cache);
361+ __u16 epoch, bool *purge_cache);
361362 /* process transaction2 response */
362363 bool (*check_trans2)(struct mid_q_entry *, struct TCP_Server_Info *,
363364 char *, int);
@@ -552,12 +553,12 @@ struct smb_version_operations { · 188 unmodified lines
552553 /* if we can do cache read operations */
553554 bool (*is_read_op)(__u32);
554555 /* set oplock level for the inode */
555− void (*set_oplock_level)(struct cifsInodeInfo *, __u32, unsigned int,
556− bool *);
556+ void (*set_oplock_level)(struct cifsInodeInfo *cinode, __u32 oplock, __u16 epoch,
557+ bool *purge_cache);
557558 /* create lease context buffer for CREATE request */
558559 char * (*create_lease_buf)(u8 *lease_key, u8 oplock);
559560 /* parse lease context buffer and return oplock/epoch info */
560− __u8 (*parse_lease_buf)(void *buf, unsigned int *epoch, char *lkey);
561+ __u8 (*parse_lease_buf)(void *buf, __u16 *epoch, char *lkey);
561562 ssize_t (*copychunk_range)(const unsigned int,
562563 struct cifsFileInfo *src_file,
563564 struct cifsFileInfo *target_file,
@@ -1447,7 +1448,7 @@ struct cifs_fid { · 883 unmodified lines
14471448 __u8 create_guid[16];
14481449 __u32 access;
14491450 struct cifs_pending_open *pending_open;
1450− unsigned int epoch;
1451+ __u16 epoch;
14511452 #ifdef CONFIG_CIFS_DEBUG2
14521453 __u64 mid;
14531454 #endif /* CIFS_DEBUG2 */
@@ -1480,7 +1481,7 @@ struct cifsFileInfo { · 26 unmodified lines
14801481 bool oplock_break_cancelled:1;
14811482 bool status_file_deleted:1; /* file has been deleted */
14821483 bool offload:1; /* offload final part of _put to a wq */
1483− unsigned int oplock_epoch; /* epoch from the lease break */
1484+ __u16 oplock_epoch; /* epoch from the lease break */
14841485 __u32 oplock_level; /* oplock/lease level from the lease break */
14851486 int count;
14861487 spinlock_t file_info_lock; /* protects four flag/count fields above */
@@ -1508,7 +1509,6 @@ struct cifs_io_parms { · 21 unmodified lines
15081509 struct cifs_io_request {
15091510 struct netfs_io_request rreq;
15101511 struct cifsFileInfo *cfile;
1511− struct TCP_Server_Info *server;
15121512 pid_t pid;
15131513 };
15141514
@@ -1577,7 +1577,7 @@ struct cifsInodeInfo { · 62 unmodified lines
15771577 spinlock_t open_file_lock; /* protects openFileList */
15781578 __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
15791579 unsigned int oplock; /* oplock/lease level we have */
1580− unsigned int epoch; /* used to track lease state changes */
1580+ __u16 epoch; /* used to track lease state changes */
15811581 #define CIFS_INODE_PENDING_OPLOCK_BREAK (0) /* oplock break in progress */
15821582 #define CIFS_INODE_PENDING_WRITERS (1) /* Writes in progress */
15831583 #define CIFS_INODE_FLAG_UNUSED (2) /* Unused flag */
@@ -2325,8 +2325,8 @@ struct smb2_compound_vars { · 741 unmodified lines
23252325 struct kvec io_iov[SMB2_IOCTL_IOV_SIZE];
23262326 struct kvec si_iov[SMB2_SET_INFO_IOV_SIZE];
23272327 struct kvec close_iov;
2328− struct smb2_file_rename_info rename_info;
2329− struct smb2_file_link_info link_info;
2328+ struct smb2_file_rename_info_hdr rename_info;
2329+ struct smb2_file_link_info_hdr link_info;
23302330 struct kvec ea_iov;
23312331 };
23322332
fs/smb/client/dfs.c+16−14
@@ -150,25 +150,27 @@ again: · 149 unmodified lines
150150 if (rc)
151151 continue;
152152
153− if (tgt.flags & DFSREF_STORAGE_SERVER) {
154− rc = cifs_mount_get_tcon(mnt_ctx);
155− if (!rc)
156− rc = cifs_is_path_remote(mnt_ctx);
153+ rc = cifs_mount_get_tcon(mnt_ctx);
154+ if (rc) {
155+ if (tgt.server_type == DFS_TYPE_LINK &&
156+ DFS_INTERLINK(tgt.flags))
157+ rc = -EREMOTE;
158+ } else {
159+ rc = cifs_is_path_remote(mnt_ctx);
157160 if (!rc) {
158161 ref_walk_set_tgt_hint(rw);
159162 break;
160163 }
161− if (rc != -EREMOTE)
162− continue;
163164 }
164−
165− rc = ref_walk_advance(rw);
166− if (!rc) {
167− rc = setup_dfs_ref(&tgt, rw);
168− if (rc)
169− break;
170− ref_walk_mark_end(rw);
171− goto again;
165+ if (rc == -EREMOTE) {
166+ rc = ref_walk_advance(rw);
167+ if (!rc) {
168+ rc = setup_dfs_ref(&tgt, rw);
169+ if (rc)
170+ break;
171+ ref_walk_mark_end(rw);
172+ goto again;
173+ }
172174 }
173175 }
174176 } while (rc && ref_walk_descend(rw));
fs/smb/client/dfs.h+7−0
@@ -188,4 +188,11 @@ static inline void dfs_put_root_smb_sessions(struct list_head *head) · 187 unmodified lines
188188 }
189189 }
190190
191+static inline const char *dfs_ses_refpath(struct cifs_ses *ses)
192+{
193+ const char *path = ses->server->leaf_fullpath;
194+
195+ return path ? path + 1 : ERR_PTR(-ENOENT);
196+}
197+
191198 #endif /* _CIFS_DFS_H */
fs/smb/client/dfs_cache.c+5−22
@@ -1136,33 +1136,19 @@ static bool is_ses_good(struct cifs_ses *ses) · 1135 unmodified lines
11361136 return ret;
11371137 }
11381138
1139−static char *get_ses_refpath(struct cifs_ses *ses)
1140−{
1141− struct TCP_Server_Info *server = ses->server;
1142− char *path = ERR_PTR(-ENOENT);
1143−
1144− if (server->leaf_fullpath) {
1145− path = kstrdup(server->leaf_fullpath + 1, GFP_KERNEL);
1146− if (!path)
1147− path = ERR_PTR(-ENOMEM);
1148− }
1149− return path;
1150−}
1151−
11521139 /* Refresh dfs referral of @ses */
11531140 static void refresh_ses_referral(struct cifs_ses *ses)
11541141 {
11551142 struct cache_entry *ce;
11561143 unsigned int xid;
1157− char *path;
1144+ const char *path;
11581145 int rc = 0;
11591146
11601147 xid = get_xid();
11611148
1162− path = get_ses_refpath(ses);
1149+ path = dfs_ses_refpath(ses);
11631150 if (IS_ERR(path)) {
11641151 rc = PTR_ERR(path);
1165− path = NULL;
11661152 goto out;
11671153 }
11681154
@@ -1181,7 +1167,6 @@ static void refresh_ses_referral(struct cifs_ses *ses) · 12 unmodified lines
11811167
11821168 out:
11831169 free_xid(xid);
1184− kfree(path);
11851170 }
11861171
11871172 static int __refresh_tcon_referral(struct cifs_tcon *tcon,
@@ -1231,19 +1216,18 @@ static void refresh_tcon_referral(struct cifs_tcon *tcon, bool force_refresh) · 43 unmodified lines
12311216 struct dfs_info3_param *refs = NULL;
12321217 struct cache_entry *ce;
12331218 struct cifs_ses *ses;
1234− unsigned int xid;
12351219 bool needs_refresh;
1236− char *path;
1220+ const char *path;
1221+ unsigned int xid;
12371222 int numrefs = 0;
12381223 int rc = 0;
12391224
12401225 xid = get_xid();
12411226 ses = tcon->ses;
12421227
1243− path = get_ses_refpath(ses);
1228+ path = dfs_ses_refpath(ses);
12441229 if (IS_ERR(path)) {
12451230 rc = PTR_ERR(path);
1246− path = NULL;
12471231 goto out;
12481232 }
12491233
@@ -1271,7 +1255,6 @@ static void refresh_tcon_referral(struct cifs_tcon *tcon, bool force_refresh) · 21 unmodified lines
12711255
12721256 out:
12731257 free_xid(xid);
1274− kfree(path);
12751258 free_dfs_info_array(refs, numrefs);
12761259 }
12771260
fs/smb/client/file.c+4−3
@@ -147,7 +147,7 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq) · 146 unmodified lines
147147 struct netfs_io_request *rreq = subreq->rreq;
148148 struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
149149 struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
150− struct TCP_Server_Info *server = req->server;
150+ struct TCP_Server_Info *server;
151151 struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
152152 size_t size;
153153 int rc = 0;
@@ -156,6 +156,8 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq) · 2 unmodified lines
156156 rdata->xid = get_xid();
157157 rdata->have_xid = true;
158158 }
159+
160+ server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
159161 rdata->server = server;
160162
161163 if (cifs_sb->ctx->rsize == 0)
@@ -198,7 +200,7 @@ static void cifs_issue_read(struct netfs_io_subrequest *subreq) · 36 unmodified lines
198200 struct netfs_io_request *rreq = subreq->rreq;
199201 struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
200202 struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
201− struct TCP_Server_Info *server = req->server;
203+ struct TCP_Server_Info *server = rdata->server;
202204 int rc = 0;
203205
204206 cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n",
@@ -266,7 +268,6 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file) · 61 unmodified lines
266268 open_file = file->private_data;
267269 rreq->netfs_priv = file->private_data;
268270 req->cfile = cifsFileInfo_get(open_file);
269− req->server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
270271 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
271272 req->pid = req->cfile->pid;
272273 } else if (rreq->origin != NETFS_WRITEBACK) {
fs/smb/client/inode.c+15−2
@@ -1215,6 +1215,19 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data, · 1214 unmodified lines
12151215 rc = server->ops->parse_reparse_point(cifs_sb,
12161216 full_path,
12171217 iov, data);
1218+ /*
1219+ * If the reparse point was not handled but it is the
1220+ * name surrogate which points to directory, then treat
1221+ * is as a new mount point. Name surrogate reparse point
1222+ * represents another named entity in the system.
1223+ */
1224+ if (rc == -EOPNOTSUPP &&
1225+ IS_REPARSE_TAG_NAME_SURROGATE(data->reparse.tag) &&
1226+ (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY)) {
1227+ rc = 0;
1228+ cifs_create_junction_fattr(fattr, sb);
1229+ goto out;
1230+ }
12181231 }
12191232
12201233 if (data->reparse.tag == IO_REPARSE_TAG_SYMLINK && !rc) {
@@ -1408,7 +1421,7 @@ int cifs_get_inode_info(struct inode **inode, · 187 unmodified lines
14081421 struct cifs_fattr fattr = {};
14091422 int rc;
14101423
1411− if (is_inode_cache_good(*inode)) {
1424+ if (!data && is_inode_cache_good(*inode)) {
14121425 cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
14131426 return 0;
14141427 }
@@ -1507,7 +1520,7 @@ int smb311_posix_get_inode_info(struct inode **inode, · 92 unmodified lines
15071520 struct cifs_fattr fattr = {};
15081521 int rc;
15091522
1510− if (is_inode_cache_good(*inode)) {
1523+ if (!data && is_inode_cache_good(*inode)) {
15111524 cifs_dbg(FYI, "No need to revalidate cached inode sizes\n");
15121525 return 0;
15131526 }
fs/smb/client/reparse.c+2−3
@@ -1088,13 +1088,12 @@ int parse_reparse_point(struct reparse_data_buffer *buf, · 1087 unmodified lines
10881088 le32_to_cpu(buf->ReparseTag));
10891089 return -EIO;
10901090 }
1091− break;
1091+ return 0;
10921092 default:
10931093 cifs_tcon_dbg(VFS | ONCE, "unhandled reparse tag: 0x%08x\n",
10941094 le32_to_cpu(buf->ReparseTag));
1095− break;
1095+ return -EOPNOTSUPP;
10961096 }
1097− return 0;
10981097 }
10991098
11001099 int smb2_parse_reparse_point(struct cifs_sb_info *cifs_sb,
fs/smb/client/reparse.h+22−6
@@ -99,14 +99,30 @@ static inline bool reparse_inode_match(struct inode *inode, · 98 unmodified lines
9999
100100 static inline bool cifs_open_data_reparse(struct cifs_open_info_data *data)
101101 {
102− struct smb2_file_all_info *fi = &data->fi;
103− u32 attrs = le32_to_cpu(fi->Attributes);
102+ u32 attrs;
104103 bool ret;
105104
106− ret = data->reparse_point || (attrs & ATTR_REPARSE);
107− if (ret)
108− attrs |= ATTR_REPARSE;
109− fi->Attributes = cpu_to_le32(attrs);
105+ if (data->contains_posix_file_info) {
106+ struct smb311_posix_qinfo *fi = &data->posix_fi;
107+
108+ attrs = le32_to_cpu(fi->DosAttributes);
109+ if (data->reparse_point) {
110+ attrs |= ATTR_REPARSE;
111+ fi->DosAttributes = cpu_to_le32(attrs);
112+ }
113+
114+ } else {
115+ struct smb2_file_all_info *fi = &data->fi;
116+
117+ attrs = le32_to_cpu(fi->Attributes);
118+ if (data->reparse_point) {
119+ attrs |= ATTR_REPARSE;
120+ fi->Attributes = cpu_to_le32(attrs);
121+ }
122+ }
123+
124+ ret = attrs & ATTR_REPARSE;
125+
110126 return ret;
111127 }
112128
fs/smb/client/smb1ops.c+1−1
@@ -377,7 +377,7 @@ coalesce_t2(char *second_buf, struct smb_hdr *target_hdr) · 376 unmodified lines
377377 static void
378378 cifs_downgrade_oplock(struct TCP_Server_Info *server,
379379 struct cifsInodeInfo *cinode, __u32 oplock,
380− unsigned int epoch, bool *purge_cache)
380+ __u16 epoch, bool *purge_cache)
381381 {
382382 cifs_set_oplock_level(cinode, oplock);
383383 }
fs/smb/client/smb2inode.c+4−0
@@ -650,6 +650,7 @@ finished: · 649 unmodified lines
650650 switch (cmds[i]) {
651651 case SMB2_OP_QUERY_INFO:
652652 idata = in_iov[i].iov_base;
653+ idata->contains_posix_file_info = false;
653654 if (rc == 0 && cfile && cfile->symlink_target) {
654655 idata->symlink_target = kstrdup(cfile->symlink_target, GFP_KERNEL);
655656 if (!idata->symlink_target)
@@ -673,6 +674,7 @@ finished: · 17 unmodified lines
673674 break;
674675 case SMB2_OP_POSIX_QUERY_INFO:
675676 idata = in_iov[i].iov_base;
677+ idata->contains_posix_file_info = true;
676678 if (rc == 0 && cfile && cfile->symlink_target) {
677679 idata->symlink_target = kstrdup(cfile->symlink_target, GFP_KERNEL);
678680 if (!idata->symlink_target)
@@ -770,6 +772,7 @@ finished: · 91 unmodified lines
770772 idata = in_iov[i].iov_base;
771773 idata->reparse.io.iov = *iov;
772774 idata->reparse.io.buftype = resp_buftype[i + 1];
775+ idata->contains_posix_file_info = false; /* BB VERIFY */
773776 rbuf = reparse_buf_ptr(iov);
774777 if (IS_ERR(rbuf)) {
775778 rc = PTR_ERR(rbuf);
@@ -791,6 +794,7 @@ finished: · 15 unmodified lines
791794 case SMB2_OP_QUERY_WSL_EA:
792795 if (!rc) {
793796 idata = in_iov[i].iov_base;
797+ idata->contains_posix_file_info = false;
794798 qi_rsp = rsp_iov[i + 1].iov_base;
795799 data[0] = (u8 *)qi_rsp + le16_to_cpu(qi_rsp->OutputBufferOffset);
796800 size[0] = le32_to_cpu(qi_rsp->OutputBufferLength);
fs/smb/client/smb2ops.c+11−10
@@ -1001,6 +1001,7 @@ static int smb2_query_file_info(const unsigned int xid, struct cifs_tcon *tcon, · 1000 unmodified lines
10011001 if (!data->symlink_target)
10021002 return -ENOMEM;
10031003 }
1004+ data->contains_posix_file_info = false;
10041005 return SMB2_query_info(xid, tcon, fid->persistent_fid, fid->volatile_fid, &data->fi);
10051006 }
10061007
@@ -3904,22 +3905,22 @@ static long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode, · 2897 unmodified lines
39043905 static void
39053906 smb2_downgrade_oplock(struct TCP_Server_Info *server,
39063907 struct cifsInodeInfo *cinode, __u32 oplock,
3907− unsigned int epoch, bool *purge_cache)
3908+ __u16 epoch, bool *purge_cache)
39083909 {
39093910 server->ops->set_oplock_level(cinode, oplock, 0, NULL);
39103911 }
39113912
39123913 static void
39133914 smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
3914− unsigned int epoch, bool *purge_cache);
3915+ __u16 epoch, bool *purge_cache);
39153916
39163917 static void
39173918 smb3_downgrade_oplock(struct TCP_Server_Info *server,
39183919 struct cifsInodeInfo *cinode, __u32 oplock,
3919− unsigned int epoch, bool *purge_cache)
3920+ __u16 epoch, bool *purge_cache)
39203921 {
39213922 unsigned int old_state = cinode->oplock;
3922− unsigned int old_epoch = cinode->epoch;
3923+ __u16 old_epoch = cinode->epoch;
39233924 unsigned int new_state;
39243925
39253926 if (epoch > old_epoch) {
@@ -3939,7 +3940,7 @@ smb3_downgrade_oplock(struct TCP_Server_Info *server, · 13 unmodified lines
39393940
39403941 static void
39413942 smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
3942− unsigned int epoch, bool *purge_cache)
3943+ __u16 epoch, bool *purge_cache)
39433944 {
39443945 oplock &= 0xFF;
39453946 cinode->lease_granted = false;
@@ -3963,7 +3964,7 @@ smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, · 17 unmodified lines
39633964
39643965 static void
39653966 smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
3966− unsigned int epoch, bool *purge_cache)
3967+ __u16 epoch, bool *purge_cache)
39673968 {
39683969 char message[5] = {0};
39693970 unsigned int new_oplock = 0;
@@ -4000,7 +4001,7 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock, · 30 unmodified lines
40004001
40014002 static void
40024003 smb3_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
4003− unsigned int epoch, bool *purge_cache)
4004+ __u16 epoch, bool *purge_cache)
40044005 {
40054006 unsigned int old_oplock = cinode->oplock;
40064007
@@ -4114,7 +4115,7 @@ smb3_create_lease_buf(u8 *lease_key, u8 oplock) · 107 unmodified lines
41144115 }
41154116
41164117 static __u8
4117−smb2_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key)
4118+smb2_parse_lease_buf(void *buf, __u16 *epoch, char *lease_key)
41184119 {
41194120 struct create_lease *lc = (struct create_lease *)buf;
41204121
@@ -4125,7 +4126,7 @@ smb2_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key) · 4 unmodified lines
41254126 }
41264127
41274128 static __u8
4128−smb3_parse_lease_buf(void *buf, unsigned int *epoch, char *lease_key)
4129+smb3_parse_lease_buf(void *buf, __u16 *epoch, char *lease_key)
41294130 {
41304131 struct create_lease_v2 *lc = (struct create_lease_v2 *)buf;
41314132
@@ -5146,7 +5147,7 @@ int __cifs_sfu_make_node(unsigned int xid, struct inode *inode, · 1014 unmodified lines
51465147 FILE_CREATE, CREATE_NOT_DIR |
51475148 CREATE_OPTION_SPECIAL, ACL_NO_MODE);
51485149 oparms.fid = &fid;
5149−
5150+ idata.contains_posix_file_info = false;
51505151 rc = server->ops->open(xid, &oparms, &oplock, &idata);
51515152 if (rc)
51525153 goto out;
fs/smb/client/smb2pdu.c+2−2
@@ -2169,7 +2169,7 @@ tcon_exit: · 2168 unmodified lines
21692169
21702170 tcon_error_exit:
21712171 if (rsp && rsp->hdr.Status == STATUS_BAD_NETWORK_NAME)
2172− cifs_tcon_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree);
2172+ cifs_dbg(VFS | ONCE, "BAD_NETWORK_NAME: %s\n", tree);
21732173 goto tcon_exit;
21742174 }
21752175
@@ -2329,7 +2329,7 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info, · 153 unmodified lines
23292329
23302330 int smb2_parse_contexts(struct TCP_Server_Info *server,
23312331 struct kvec *rsp_iov,
2332− unsigned int *epoch,
2332+ __u16 *epoch,
23332333 char *lease_key, __u8 *oplock,
23342334 struct smb2_file_all_info *buf,
23352335 struct create_posix_rsp *posix)
fs/smb/client/smb2proto.h+1−1
@@ -283,7 +283,7 @@ extern enum securityEnum smb2_select_sectype(struct TCP_Server_Info *, · 282 unmodified lines
283283 enum securityEnum);
284284 int smb2_parse_contexts(struct TCP_Server_Info *server,
285285 struct kvec *rsp_iov,
286− unsigned int *epoch,
286+ __u16 *epoch,
287287 char *lease_key, __u8 *oplock,
288288 struct smb2_file_all_info *buf,
289289 struct create_posix_rsp *posix);
fs/smb/common/smb2pdu.h+20−10
@@ -1707,23 +1707,33 @@ struct smb2_file_internal_info { · 1706 unmodified lines
17071707 } __packed; /* level 6 Query */
17081708
17091709 struct smb2_file_rename_info { /* encoding of request for level 10 */
1710− __u8 ReplaceIfExists; /* 1 = replace existing target with new */
1711− /* 0 = fail if target already exists */
1712− __u8 Reserved[7];
1713− __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
1714− __le32 FileNameLength;
1710+ /* New members MUST be added within the struct_group() macro below. */
1711+ __struct_group(smb2_file_rename_info_hdr, __hdr, __packed,
1712+ __u8 ReplaceIfExists; /* 1 = replace existing target with new */
1713+ /* 0 = fail if target already exists */
1714+ __u8 Reserved[7];
1715+ __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
1716+ __le32 FileNameLength;
1717+ );
17151718 char FileName[]; /* New name to be assigned */
17161719 /* padding - overall struct size must be >= 24 so filename + pad >= 6 */
17171720 } __packed; /* level 10 Set */
1721+static_assert(offsetof(struct smb2_file_rename_info, FileName) == sizeof(struct smb2_file_rename_info_hdr),
1722+ "struct member likely outside of __struct_group()");
17181723
17191724 struct smb2_file_link_info { /* encoding of request for level 11 */
1720− __u8 ReplaceIfExists; /* 1 = replace existing link with new */
1721− /* 0 = fail if link already exists */
1722− __u8 Reserved[7];
1723− __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
1724− __le32 FileNameLength;
1725+ /* New members MUST be added within the struct_group() macro below. */
1726+ __struct_group(smb2_file_link_info_hdr, __hdr, __packed,
1727+ __u8 ReplaceIfExists; /* 1 = replace existing link with new */
1728+ /* 0 = fail if link already exists */
1729+ __u8 Reserved[7];
1730+ __u64 RootDirectory; /* MBZ for network operations (why says spec?) */
1731+ __le32 FileNameLength;
1732+ );
17251733 char FileName[]; /* Name to be assigned to new link */
17261734 } __packed; /* level 11 Set */
1735+static_assert(offsetof(struct smb2_file_link_info, FileName) == sizeof(struct smb2_file_link_info_hdr),
1736+ "struct member likely outside of __struct_group()");
17271737
17281738 /*
17291739 * This level 18, although with struct with same name is different from cifs
fs/smb/common/smbfsctl.h+3−0
@@ -159,6 +159,9 @@ · 158 unmodified lines
159159 #define IO_REPARSE_TAG_LX_CHR 0x80000025
160160 #define IO_REPARSE_TAG_LX_BLK 0x80000026
161161
162+/* If Name Surrogate Bit is set, the file or directory represents another named entity in the system. */
163+#define IS_REPARSE_TAG_NAME_SURROGATE(tag) (!!((tag) & 0x20000000))
164+
162165 /* fsctl flags */
163166 /* If Flags is set to this value, the request is an FSCTL not ioctl request */
164167 #define SMB2_0_IOCTL_IS_FSCTL 0x00000001
fs/stat.c+3−1
@@ -281,6 +281,8 @@ static int vfs_statx_path(struct path *path, int flags, struct kstat *stat, · 280 unmodified lines
281281 u32 request_mask)
282282 {
283283 int error = vfs_getattr(path, stat, request_mask, flags);
284+ if (error)
285+ return error;
284286
285287 if (request_mask & STATX_MNT_ID_UNIQUE) {
286288 stat->mnt_id = real_mount(path->mnt)->mnt_id_unique;
@@ -302,7 +304,7 @@ static int vfs_statx_path(struct path *path, int flags, struct kstat *stat, · 15 unmodified lines
302304 if (S_ISBLK(stat->mode))
303305 bdev_statx(path, stat, request_mask);
304306
305− return error;
307+ return 0;
306308 }
307309
308310 static int vfs_statx_fd(int fd, int flags, struct kstat *stat,
fs/vboxsf/super.c+2−1
@@ -21,7 +21,8 @@ · 20 unmodified lines
2121
2222 #define VBOXSF_SUPER_MAGIC 0x786f4256 /* 'VBox' little endian */
2323
24−static const unsigned char VBSF_MOUNT_SIGNATURE[4] = "\000\377\376\375";
24+static const unsigned char VBSF_MOUNT_SIGNATURE[4] = { '\000', '\377', '\376',
25+ '\375' };
2526
2627 static int follow_symlinks;
2728 module_param(follow_symlinks, int, 0444);
fs/xfs/libxfs/xfs_bmap.c+7−6
@@ -3563,12 +3563,12 @@ xfs_bmap_btalloc_at_eof( · 3562 unmodified lines
35633563 int error;
35643564
35653565 /*
3566− * If there are already extents in the file, try an exact EOF block
3567− * allocation to extend the file as a contiguous extent. If that fails,
3568− * or it's the first allocation in a file, just try for a stripe aligned
3569− * allocation.
3566+ * If there are already extents in the file, and xfs_bmap_adjacent() has
3567+ * given a better blkno, try an exact EOF block allocation to extend the
3568+ * file as a contiguous extent. If that fails, or it's the first
3569+ * allocation in a file, just try for a stripe aligned allocation.
35703570 */
3571− if (ap->offset) {
3571+ if (ap->eof) {
35723572 xfs_extlen_t nextminlen = 0;
35733573
35743574 /*
@@ -3736,7 +3736,8 @@ xfs_bmap_btalloc_best_length( · 161 unmodified lines
37363736 int error;
37373737
37383738 ap->blkno = XFS_INO_TO_FSB(args->mp, ap->ip->i_ino);
3739− xfs_bmap_adjacent(ap);
3739+ if (!xfs_bmap_adjacent(ap))
3740+ ap->eof = false;
37403741
37413742 /*
37423743 * Search for an allocation group with a single extent large enough for
fs/xfs/scrub/common.h+0−5
@@ -224,7 +224,6 @@ static inline bool xchk_skip_xref(struct xfs_scrub_metadata *sm) · 223 unmodified lines
224224 bool xchk_dir_looks_zapped(struct xfs_inode *dp);
225225 bool xchk_pptr_looks_zapped(struct xfs_inode *ip);
226226
227−#ifdef CONFIG_XFS_ONLINE_REPAIR
228227 /* Decide if a repair is required. */
229228 static inline bool xchk_needs_repair(const struct xfs_scrub_metadata *sm)
230229 {
@@ -244,10 +243,6 @@ static inline bool xchk_could_repair(const struct xfs_scrub *sc) · 13 unmodified lines
244243 return (sc->sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR) &&
245244 !(sc->flags & XREP_ALREADY_FIXED);
246245 }
247−#else
248−# define xchk_needs_repair(sc) (false)
249−# define xchk_could_repair(sc) (false)
250−#endif /* CONFIG_XFS_ONLINE_REPAIR */
251246
252247 int xchk_metadata_inode_forks(struct xfs_scrub *sc);
253248
fs/xfs/scrub/inode_repair.c+10−2
@@ -1055,9 +1055,17 @@ xrep_dinode_check_dfork( · 1054 unmodified lines
10551055 return true;
10561056 break;
10571057 case S_IFREG:
1058− if (fmt == XFS_DINODE_FMT_LOCAL)
1058+ switch (fmt) {
1059+ case XFS_DINODE_FMT_LOCAL:
10591060 return true;
1060− fallthrough;
1061+ case XFS_DINODE_FMT_EXTENTS:
1062+ case XFS_DINODE_FMT_BTREE:
1063+ case XFS_DINODE_FMT_META_BTREE:
1064+ break;
1065+ default:
1066+ return true;
1067+ }
1068+ break;
10611069 case S_IFLNK:
10621070 case S_IFDIR:
10631071 switch (fmt) {
fs/xfs/scrub/repair.h+10−1
@@ -191,7 +191,16 @@ int xrep_reset_metafile_resv(struct xfs_scrub *sc); · 190 unmodified lines
191191 #else
192192
193193 #define xrep_ino_dqattach(sc) (0)
194−#define xrep_will_attempt(sc) (false)
194+
195+/*
196+ * When online repair is not built into the kernel, we still want to attempt
197+ * the repair so that the stub xrep_attempt below will return EOPNOTSUPP.
198+ */
199+static inline bool xrep_will_attempt(const struct xfs_scrub *sc)
200+{
201+ return (sc->sm->sm_flags & XFS_SCRUB_IFLAG_FORCE_REBUILD) ||
202+ xchk_needs_repair(sc->sm);
203+}
195204
196205 static inline int
197206 xrep_attempt(
fs/xfs/scrub/scrub.c+12−0
@@ -149,6 +149,18 @@ xchk_probe( · 148 unmodified lines
149149 if (xchk_should_terminate(sc, &error))
150150 return error;
151151
152+ /*
153+ * If the caller is probing to see if repair works but repair isn't
154+ * built into the kernel, return EOPNOTSUPP because that's the signal
155+ * that userspace expects. If online repair is built in, set the
156+ * CORRUPT flag (without any of the usual tracing/logging) to force us
157+ * into xrep_probe.
158+ */
159+ if (xchk_could_repair(sc)) {
160+ if (!IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR))
161+ return -EOPNOTSUPP;
162+ sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
163+ }
152164 return 0;
153165 }
154166
fs/xfs/xfs_aops.c+37−4
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include "xfs_reflink.h"
2020 #include "xfs_errortag.h"
2121 #include "xfs_error.h"
22+#include "xfs_icache.h"
2223
2324 struct xfs_writepage_ctx {
2425 struct iomap_writepage_ctx ctx;
@@ -528,12 +529,44 @@ xfs_vm_readahead( · 503 unmodified lines
528529 }
529530
530531 static int
531−xfs_iomap_swapfile_activate(
532+xfs_vm_swap_activate(
532533 struct swap_info_struct *sis,
533534 struct file *swap_file,
534535 sector_t *span)
535536 {
536− sis->bdev = xfs_inode_buftarg(XFS_I(file_inode(swap_file)))->bt_bdev;
537+ struct xfs_inode *ip = XFS_I(file_inode(swap_file));
538+
539+ /*
540+ * Swap file activation can race against concurrent shared extent
541+ * removal in files that have been cloned. If this happens,
542+ * iomap_swapfile_iter() can fail because it encountered a shared
543+ * extent even though an operation is in progress to remove those
544+ * shared extents.
545+ *
546+ * This race becomes problematic when we defer extent removal
547+ * operations beyond the end of a syscall (i.e. use async background
548+ * processing algorithms). Users think the extents are no longer
549+ * shared, but iomap_swapfile_iter() still sees them as shared
550+ * because the refcountbt entries for the extents being removed have
551+ * not yet been updated. Hence the swapon call fails unexpectedly.
552+ *
553+ * The race condition is currently most obvious from the unlink()
554+ * operation as extent removal is deferred until after the last
555+ * reference to the inode goes away. We then process the extent
556+ * removal asynchronously, hence triggers the "syscall completed but
557+ * work not done" condition mentioned above. To close this race
558+ * window, we need to flush any pending inodegc operations to ensure
559+ * they have updated the refcountbt records before we try to map the
560+ * swapfile.
561+ */
562+ xfs_inodegc_flush(ip->i_mount);
563+
564+ /*
565+ * Direct the swap code to the correct block device when this file
566+ * sits on the RT device.
567+ */
568+ sis->bdev = xfs_inode_buftarg(ip)->bt_bdev;
569+
537570 return iomap_swapfile_activate(sis, swap_file, span,
538571 &xfs_read_iomap_ops);
539572 }
@@ -549,11 +582,11 @@ const struct address_space_operations xfs_address_space_operations = { · 9 unmodified lines
549582 .migrate_folio = filemap_migrate_folio,
550583 .is_partially_uptodate = iomap_is_partially_uptodate,
551584 .error_remove_folio = generic_error_remove_folio,
552− .swap_activate = xfs_iomap_swapfile_activate,
585+ .swap_activate = xfs_vm_swap_activate,
553586 };
554587
555588 const struct address_space_operations xfs_dax_aops = {
556589 .writepages = xfs_dax_writepages,
557590 .dirty_folio = noop_dirty_folio,
558− .swap_activate = xfs_iomap_swapfile_activate,
591+ .swap_activate = xfs_vm_swap_activate,
559592 };
fs/xfs/xfs_buf.c+17−19
@@ -41,8 +41,7 @@ struct kmem_cache *xfs_buf_cache; · 40 unmodified lines
4141 *
4242 * xfs_buf_rele:
4343 * b_lock
44− * pag_buf_lock
45− * lru_lock
44+ * lru_lock
4645 *
4746 * xfs_buftarg_drain_rele
4847 * lru_lock
@@ -220,23 +219,25 @@ _xfs_buf_alloc( · 171 unmodified lines
220219 */
221220 flags &= ~(XBF_UNMAPPED | XBF_TRYLOCK | XBF_ASYNC | XBF_READ_AHEAD);
222221
223− spin_lock_init(&bp->b_lock);
222+ /*
223+ * A new buffer is held and locked by the owner. This ensures that the
224+ * buffer is owned by the caller and racing RCU lookups right after
225+ * inserting into the hash table are safe (and will have to wait for
226+ * the unlock to do anything non-trivial).
227+ */
224228 bp->b_hold = 1;
229+ sema_init(&bp->b_sema, 0); /* held, no waiters */
230+
231+ spin_lock_init(&bp->b_lock);
225232 atomic_set(&bp->b_lru_ref, 1);
226233 init_completion(&bp->b_iowait);
227234 INIT_LIST_HEAD(&bp->b_lru);
228235 INIT_LIST_HEAD(&bp->b_list);
229236 INIT_LIST_HEAD(&bp->b_li_list);
230− sema_init(&bp->b_sema, 0); /* held, no waiters */
231237 bp->b_target = target;
232238 bp->b_mount = target->bt_mount;
233239 bp->b_flags = flags;
234240
235− /*
236− * Set length and io_length to the same value initially.
237− * I/O routines should use io_length, which will be the same in
238− * most cases but may be reset (e.g. XFS recovery).
239− */
240241 error = xfs_buf_get_maps(bp, nmaps);
241242 if (error) {
242243 kmem_cache_free(xfs_buf_cache, bp);
@@ -502,7 +503,6 @@ int · 259 unmodified lines
502503 xfs_buf_cache_init(
503504 struct xfs_buf_cache *bch)
504505 {
505− spin_lock_init(&bch->bc_lock);
506506 return rhashtable_init(&bch->bc_hash, &xfs_buf_hash_params);
507507 }
508508
@@ -652,17 +652,20 @@ xfs_buf_find_insert( · 143 unmodified lines
652652 if (error)
653653 goto out_free_buf;
654654
655− spin_lock(&bch->bc_lock);
655+ /* The new buffer keeps the perag reference until it is freed. */
656+ new_bp->b_pag = pag;
657+
658+ rcu_read_lock();
656659 bp = rhashtable_lookup_get_insert_fast(&bch->bc_hash,
657660 &new_bp->b_rhash_head, xfs_buf_hash_params);
658661 if (IS_ERR(bp)) {
662+ rcu_read_unlock();
659663 error = PTR_ERR(bp);
660− spin_unlock(&bch->bc_lock);
661664 goto out_free_buf;
662665 }
663666 if (bp && xfs_buf_try_hold(bp)) {
664667 /* found an existing buffer */
665− spin_unlock(&bch->bc_lock);
668+ rcu_read_unlock();
666669 error = xfs_buf_find_lock(bp, flags);
667670 if (error)
668671 xfs_buf_rele(bp);
@@ -670,10 +673,8 @@ xfs_buf_find_insert( · 1 unmodified line
670673 *bpp = bp;
671674 goto out_free_buf;
672675 }
676+ rcu_read_unlock();
673677
674− /* The new buffer keeps the perag reference until it is freed. */
675− new_bp->b_pag = pag;
676− spin_unlock(&bch->bc_lock);
677678 *bpp = new_bp;
678679 return 0;
679680
@@ -1090,7 +1091,6 @@ xfs_buf_rele_cached( · 410 unmodified lines
10901091 }
10911092
10921093 /* we are asked to drop the last reference */
1093− spin_lock(&bch->bc_lock);
10941094 __xfs_buf_ioacct_dec(bp);
10951095 if (!(bp->b_flags & XBF_STALE) && atomic_read(&bp->b_lru_ref)) {
10961096 /*
@@ -1102,7 +1102,6 @@ xfs_buf_rele_cached( · 5 unmodified lines
11021102 bp->b_state &= ~XFS_BSTATE_DISPOSE;
11031103 else
11041104 bp->b_hold--;
1105− spin_unlock(&bch->bc_lock);
11061105 } else {
11071106 bp->b_hold--;
11081107 /*
@@ -1120,7 +1119,6 @@ xfs_buf_rele_cached( · 11 unmodified lines
11201119 ASSERT(!(bp->b_flags & _XBF_DELWRI_Q));
11211120 rhashtable_remove_fast(&bch->bc_hash, &bp->b_rhash_head,
11221121 xfs_buf_hash_params);
1123− spin_unlock(&bch->bc_lock);
11241122 if (pag)
11251123 xfs_perag_put(pag);
11261124 freebuf = true;
fs/xfs/xfs_buf.h+0−1
@@ -80,7 +80,6 @@ typedef unsigned int xfs_buf_flags_t; · 79 unmodified lines
8080 #define XFS_BSTATE_IN_FLIGHT (1 << 1) /* I/O in flight */
8181
8282 struct xfs_buf_cache {
83− spinlock_t bc_lock;
8483 struct rhashtable bc_hash;
8584 };
8685
fs/xfs/xfs_exchrange.c+27−44
@@ -329,22 +329,6 @@ out_trans_cancel: · 328 unmodified lines
329329 * successfully but before locks are dropped.
330330 */
331331
332−/* Verify that we have security clearance to perform this operation. */
333−static int
334−xfs_exchange_range_verify_area(
335− struct xfs_exchrange *fxr)
336−{
337− int ret;
338−
339− ret = remap_verify_area(fxr->file1, fxr->file1_offset, fxr->length,
340− true);
341− if (ret)
342− return ret;
343−
344− return remap_verify_area(fxr->file2, fxr->file2_offset, fxr->length,
345− true);
346−}
347−
348332 /*
349333 * Performs necessary checks before doing a range exchange, having stabilized
350334 * mutable inode attributes via i_rwsem.
@@ -355,11 +339,13 @@ xfs_exchange_range_checks( · 4 unmodified lines
355339 unsigned int alloc_unit)
356340 {
357341 struct inode *inode1 = file_inode(fxr->file1);
342+ loff_t size1 = i_size_read(inode1);
358343 struct inode *inode2 = file_inode(fxr->file2);
344+ loff_t size2 = i_size_read(inode2);
359345 uint64_t allocmask = alloc_unit - 1;
360346 int64_t test_len;
361347 uint64_t blen;
362− loff_t size1, size2, tmp;
348+ loff_t tmp;
363349 int error;
364350
365351 /* Don't touch certain kinds of inodes */
@@ -368,24 +354,25 @@ xfs_exchange_range_checks( · 2 unmodified lines
368354 if (IS_SWAPFILE(inode1) || IS_SWAPFILE(inode2))
369355 return -ETXTBSY;
370356
371− size1 = i_size_read(inode1);
372− size2 = i_size_read(inode2);
373−
374357 /* Ranges cannot start after EOF. */
375358 if (fxr->file1_offset > size1 || fxr->file2_offset > size2)
376359 return -EINVAL;
377360
378− /*
379− * If the caller said to exchange to EOF, we set the length of the
380− * request large enough to cover everything to the end of both files.
381− */
382361 if (fxr->flags & XFS_EXCHANGE_RANGE_TO_EOF) {
362+ /*
363+ * If the caller said to exchange to EOF, we set the length of
364+ * the request large enough to cover everything to the end of
365+ * both files.
366+ */
383367 fxr->length = max_t(int64_t, size1 - fxr->file1_offset,
384368 size2 - fxr->file2_offset);
385−
386− error = xfs_exchange_range_verify_area(fxr);
387− if (error)
388− return error;
369+ } else {
370+ /*
371+ * Otherwise we require both ranges to end within EOF.
372+ */
373+ if (fxr->file1_offset + fxr->length > size1 ||
374+ fxr->file2_offset + fxr->length > size2)
375+ return -EINVAL;
389376 }
390377
391378 /*
@@ -401,15 +388,6 @@ xfs_exchange_range_checks( · 9 unmodified lines
401388 check_add_overflow(fxr->file2_offset, fxr->length, &tmp))
402389 return -EINVAL;
403390
404− /*
405− * We require both ranges to end within EOF, unless we're exchanging
406− * to EOF.
407− */
408− if (!(fxr->flags & XFS_EXCHANGE_RANGE_TO_EOF) &&
409− (fxr->file1_offset + fxr->length > size1 ||
410− fxr->file2_offset + fxr->length > size2))
411− return -EINVAL;
412−
413391 /*
414392 * Make sure we don't hit any file size limits. If we hit any size
415393 * limits such that test_length was adjusted, we abort the whole
@@ -747,6 +725,7 @@ xfs_exchange_range( · 331 unmodified lines
747725 {
748726 struct inode *inode1 = file_inode(fxr->file1);
749727 struct inode *inode2 = file_inode(fxr->file2);
728+ loff_t check_len = fxr->length;
750729 int ret;
751730
752731 BUILD_BUG_ON(XFS_EXCHANGE_RANGE_ALL_FLAGS &
@@ -779,14 +758,18 @@ xfs_exchange_range( · 26 unmodified lines
779758 return -EBADF;
780759
781760 /*
782− * If we're not exchanging to EOF, we can check the areas before
783− * stabilizing both files' i_size.
761+ * If we're exchanging to EOF we can't calculate the length until taking
762+ * the iolock. Pass a 0 length to remap_verify_area similar to the
763+ * FICLONE and FICLONERANGE ioctls that support cloning to EOF as well.
784764 */
785− if (!(fxr->flags & XFS_EXCHANGE_RANGE_TO_EOF)) {
786− ret = xfs_exchange_range_verify_area(fxr);
787− if (ret)
788− return ret;
789− }
765+ if (fxr->flags & XFS_EXCHANGE_RANGE_TO_EOF)
766+ check_len = 0;
767+ ret = remap_verify_area(fxr->file1, fxr->file1_offset, check_len, true);
768+ if (ret)
769+ return ret;
770+ ret = remap_verify_area(fxr->file2, fxr->file2_offset, check_len, true);
771+ if (ret)
772+ return ret;
790773
791774 /* Update cmtime if the fd/inode don't forbid it. */
792775 if (!(fxr->file1->f_mode & FMODE_NOCMTIME) && !IS_NOCMTIME(inode1))
fs/xfs/xfs_inode.c+5−2
@@ -1404,8 +1404,11 @@ xfs_inactive( · 1403 unmodified lines
14041404 goto out;
14051405
14061406 /* Try to clean out the cow blocks if there are any. */
1407− if (xfs_inode_has_cow_data(ip))
1408− xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
1407+ if (xfs_inode_has_cow_data(ip)) {
1408+ error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
1409+ if (error)
1410+ goto out;
1411+ }
14091412
14101413 if (VFS_I(ip)->i_nlink != 0) {
14111414 /*
fs/xfs/xfs_iomap.c+2−4
@@ -976,10 +976,8 @@ xfs_dax_write_iomap_end( · 975 unmodified lines
976976 if (!xfs_is_cow_inode(ip))
977977 return 0;
978978
979− if (!written) {
980− xfs_reflink_cancel_cow_range(ip, pos, length, true);
981− return 0;
982− }
979+ if (!written)
980+ return xfs_reflink_cancel_cow_range(ip, pos, length, true);
983981
984982 return xfs_reflink_end_cow(ip, pos, written);
985983 }
fs/xfs/xfs_qm_bhv.c+39−16
@@ -78,6 +78,28 @@ xfs_qm_statvfs( · 77 unmodified lines
7878 }
7979 }
8080
81+STATIC int
82+xfs_qm_validate_state_change(
83+ struct xfs_mount *mp,
84+ uint uqd,
85+ uint gqd,
86+ uint pqd)
87+{
88+ int state;
89+
90+ /* Is quota state changing? */
91+ state = ((uqd && !XFS_IS_UQUOTA_ON(mp)) ||
92+ (!uqd && XFS_IS_UQUOTA_ON(mp)) ||
93+ (gqd && !XFS_IS_GQUOTA_ON(mp)) ||
94+ (!gqd && XFS_IS_GQUOTA_ON(mp)) ||
95+ (pqd && !XFS_IS_PQUOTA_ON(mp)) ||
96+ (!pqd && XFS_IS_PQUOTA_ON(mp)));
97+
98+ return state &&
99+ (xfs_dev_is_read_only(mp, "changing quota state") ||
100+ xfs_has_norecovery(mp));
101+}
102+
81103 int
82104 xfs_qm_newmount(
83105 xfs_mount_t *mp,
@@ -97,24 +119,25 @@ xfs_qm_newmount( · 13 unmodified lines
97119 }
98120
99121 /*
100− * If the device itself is read-only, we can't allow
101− * the user to change the state of quota on the mount -
102− * this would generate a transaction on the ro device,
103− * which would lead to an I/O error and shutdown
122+ * If the device itself is read-only and/or in norecovery
123+ * mode, we can't allow the user to change the state of
124+ * quota on the mount - this would generate a transaction
125+ * on the ro device, which would lead to an I/O error and
126+ * shutdown.
104127 */
105128
106− if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) ||
107− (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) ||
108− (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||
109− (!gquotaondisk && XFS_IS_GQUOTA_ON(mp)) ||
110− (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) ||
111− (!pquotaondisk && XFS_IS_PQUOTA_ON(mp))) &&
112− xfs_dev_is_read_only(mp, "changing quota state")) {
113− xfs_warn(mp, "please mount with%s%s%s%s.",
114− (!quotaondisk ? "out quota" : ""),
115− (uquotaondisk ? " usrquota" : ""),
116− (gquotaondisk ? " grpquota" : ""),
117− (pquotaondisk ? " prjquota" : ""));
129+ if (xfs_qm_validate_state_change(mp, uquotaondisk,
130+ gquotaondisk, pquotaondisk)) {
131+
132+ if (xfs_has_metadir(mp))
133+ xfs_warn(mp,
134+ "metadir enabled, please mount without any quota mount options");
135+ else
136+ xfs_warn(mp, "please mount with%s%s%s%s.",
137+ (!quotaondisk ? "out quota" : ""),
138+ (uquotaondisk ? " usrquota" : ""),
139+ (gquotaondisk ? " grpquota" : ""),
140+ (pquotaondisk ? " prjquota" : ""));
118141 return -EPERM;
119142 }
120143
fs/xfs/xfs_super.c+6−2
@@ -1661,8 +1661,12 @@ xfs_fs_fill_super( · 1660 unmodified lines
16611661 #endif
16621662 }
16631663
1664− /* Filesystem claims it needs repair, so refuse the mount. */
1665− if (xfs_has_needsrepair(mp)) {
1664+ /*
1665+ * Filesystem claims it needs repair, so refuse the mount unless
1666+ * norecovery is also specified, in which case the filesystem can
1667+ * be mounted with no risk of further damage.
1668+ */
1669+ if (xfs_has_needsrepair(mp) && !xfs_has_norecovery(mp)) {
16661670 xfs_warn(mp, "Filesystem needs repair. Please run xfs_repair.");
16671671 error = -EFSCORRUPTED;
16681672 goto out_free_sb;
include/asm-generic/vmlinux.lds.h+1−0
@@ -1038,6 +1038,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG) · 1037 unmodified lines
10381038 *(.discard) \
10391039 *(.discard.*) \
10401040 *(.export_symbol) \
1041+ *(.no_trim_symbol) \
10411042 *(.modinfo) \
10421043 /* ld.bfd warns about .gnu.version* even when not emitted */ \
10431044 *(.gnu.version*) \
include/drm/display/drm_dp.h+1−0
@@ -359,6 +359,7 @@ · 358 unmodified lines
359359 # define DP_DSC_BITS_PER_PIXEL_1_4 0x2
360360 # define DP_DSC_BITS_PER_PIXEL_1_2 0x3
361361 # define DP_DSC_BITS_PER_PIXEL_1_1 0x4
362+# define DP_DSC_BITS_PER_PIXEL_MASK 0x7
362363
363364 #define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */
364365 # define DP_PSR_IS_SUPPORTED 1
include/drm/drm_print.h+1−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include <linux/dynamic_debug.h>
3333
3434 #include <drm/drm.h>
35+#include <drm/drm_device.h>
3536
3637 struct debugfs_regset32;
3738 struct drm_device;
include/dt-bindings/clock/qcom,qcs8300-camcc.h+16−0
@@ -0,0 +1,16 @@
1+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2+/*
3+ * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
4+ */
5+
6+#ifndef _DT_BINDINGS_CLK_QCOM_QCS8300_CAM_CC_H
7+#define _DT_BINDINGS_CLK_QCOM_QCS8300_CAM_CC_H
8+
9+#include "qcom,sa8775p-camcc.h"
10+
11+/* QCS8300 introduces below new clocks compared to SA8775P */
12+
13+/* CAM_CC clocks */
14+#define CAM_CC_TITAN_TOP_ACCU_SHIFT_CLK 86
15+
16+#endif
include/dt-bindings/clock/qcom,qcs8300-gpucc.h+17−0
@@ -0,0 +1,17 @@
1+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2+/*
3+ * Copyright (c) 2024, Qualcomm Innovation Center, Inc. All rights reserved.
4+ */
5+
6+#ifndef _DT_BINDINGS_CLK_QCOM_GPUCC_QCS8300_H
7+#define _DT_BINDINGS_CLK_QCOM_GPUCC_QCS8300_H
8+
9+#include "qcom,sa8775p-gpucc.h"
10+
11+/* QCS8300 introduces below new clocks compared to SA8775P */
12+
13+/* GPU_CC clocks */
14+#define GPU_CC_CX_ACCU_SHIFT_CLK 23
15+#define GPU_CC_GX_ACCU_SHIFT_CLK 24
16+
17+#endif
include/linux/blk-mq.h+14−4
@@ -861,12 +861,22 @@ static inline bool blk_mq_add_to_batch(struct request *req, · 860 unmodified lines
861861 void (*complete)(struct io_comp_batch *))
862862 {
863863 /*
864− * blk_mq_end_request_batch() can't end request allocated from
865− * sched tags
864+ * Check various conditions that exclude batch processing:
865+ * 1) No batch container
866+ * 2) Has scheduler data attached
867+ * 3) Not a passthrough request and end_io set
868+ * 4) Not a passthrough request and an ioerror
866869 */
867− if (!iob || (req->rq_flags & RQF_SCHED_TAGS) || ioerror ||
868− (req->end_io && !blk_rq_is_passthrough(req)))
870+ if (!iob)
869871 return false;
872+ if (req->rq_flags & RQF_SCHED_TAGS)
873+ return false;
874+ if (!blk_rq_is_passthrough(req)) {
875+ if (req->end_io)
876+ return false;
877+ if (ioerror < 0)
878+ return false;
879+ }
870880
871881 if (!iob->complete)
872882 iob->complete = complete;
include/linux/cgroup-defs.h+3−3
@@ -71,9 +71,6 @@ enum { · 70 unmodified lines
7171
7272 /* Cgroup is frozen. */
7373 CGRP_FROZEN,
74−
75− /* Control group has to be killed. */
76− CGRP_KILL,
7774 };
7875
7976 /* cgroup_root->flags */
@@ -461,6 +458,9 @@ struct cgroup { · 381 unmodified lines
461458
462459 int nr_threaded_children; /* # of live threaded child cgroups */
463460
461+ /* sequence number for cgroup.kill, serialized by css_set_lock. */
462+ unsigned int kill_seq;
463+
464464 struct kernfs_node *kn; /* cgroup kernfs entry */
465465 struct cgroup_file procs_file; /* handle for "cgroup.procs" */
466466 struct cgroup_file events_file; /* handle for "cgroup.events" */
include/linux/compiler.h+19−13
@@ -191,6 +191,25 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 190 unmodified lines
191191 __v; \
192192 })
193193
194+#ifdef __CHECKER__
195+#define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
196+#else /* __CHECKER__ */
197+#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
198+#endif /* __CHECKER__ */
199+
200+/* &a[0] degrades to a pointer: a different type from an array */
201+#define __is_array(a) (!__same_type((a), &(a)[0]))
202+#define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_array(a), \
203+ "must be array")
204+
205+#define __is_byte_array(a) (__is_array(a) && sizeof((a)[0]) == 1)
206+#define __must_be_byte_array(a) __BUILD_BUG_ON_ZERO_MSG(!__is_byte_array(a), \
207+ "must be byte array")
208+
209+/* Require C Strings (i.e. NUL-terminated) lack the "nonstring" attribute. */
210+#define __must_be_cstr(p) \
211+ __BUILD_BUG_ON_ZERO_MSG(__annotated(p, nonstring), "must be cstr (NUL-terminated)")
212+
194213 #endif /* __KERNEL__ */
195214
196215 /**
@@ -231,19 +250,6 @@ static inline void *offset_to_ptr(const int *off) · 34 unmodified lines
231250
232251 #define __ADDRESSABLE_ASM_STR(sym) __stringify(__ADDRESSABLE_ASM(sym))
233252
234−#ifdef __CHECKER__
235−#define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
236−#else /* __CHECKER__ */
237−#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
238−#endif /* __CHECKER__ */
239−
240−/* &a[0] degrades to a pointer: a different type from an array */
241−#define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
242−
243−/* Require C Strings (i.e. NUL-terminated) lack the "nonstring" attribute. */
244−#define __must_be_cstr(p) \
245− __BUILD_BUG_ON_ZERO_MSG(__annotated(p, nonstring), "must be cstr (NUL-terminated)")
246−
247253 /*
248254 * This returns a constant expression while determining if an argument is
249255 * a constant expression, most importantly without evaluating the argument.
include/linux/device/faux.h+69−0
@@ -0,0 +1,69 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/*
3+ * Copyright (c) 2025 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4+ * Copyright (c) 2025 The Linux Foundation
5+ *
6+ * A "simple" faux bus that allows devices to be created and added
7+ * automatically to it. This is to be used whenever you need to create a
8+ * device that is not associated with any "real" system resources, and do
9+ * not want to have to deal with a bus/driver binding logic. It is
10+ * intended to be very simple, with only a create and a destroy function
11+ * available.
12+ */
13+#ifndef _FAUX_DEVICE_H_
14+#define _FAUX_DEVICE_H_
15+
16+#include <linux/container_of.h>
17+#include <linux/device.h>
18+
19+/**
20+ * struct faux_device - a "faux" device
21+ * @dev: internal struct device of the object
22+ *
23+ * A simple faux device that can be created/destroyed. To be used when a
24+ * driver only needs to have a device to "hang" something off. This can be
25+ * used for downloading firmware or other basic tasks. Use this instead of
26+ * a struct platform_device if the device has no resources assigned to
27+ * it at all.
28+ */
29+struct faux_device {
30+ struct device dev;
31+};
32+#define to_faux_device(x) container_of_const((x), struct faux_device, dev)
33+
34+/**
35+ * struct faux_device_ops - a set of callbacks for a struct faux_device
36+ * @probe: called when a faux device is probed by the driver core
37+ * before the device is fully bound to the internal faux bus
38+ * code. If probe succeeds, return 0, otherwise return a
39+ * negative error number to stop the probe sequence from
40+ * succeeding.
41+ * @remove: called when a faux device is removed from the system
42+ *
43+ * Both @probe and @remove are optional, if not needed, set to NULL.
44+ */
45+struct faux_device_ops {
46+ int (*probe)(struct faux_device *faux_dev);
47+ void (*remove)(struct faux_device *faux_dev);
48+};
49+
50+struct faux_device *faux_device_create(const char *name,
51+ struct device *parent,
52+ const struct faux_device_ops *faux_ops);
53+struct faux_device *faux_device_create_with_groups(const char *name,
54+ struct device *parent,
55+ const struct faux_device_ops *faux_ops,
56+ const struct attribute_group **groups);
57+void faux_device_destroy(struct faux_device *faux_dev);
58+
59+static inline void *faux_device_get_drvdata(const struct faux_device *faux_dev)
60+{
61+ return dev_get_drvdata(&faux_dev->dev);
62+}
63+
64+static inline void faux_device_set_drvdata(struct faux_device *faux_dev, void *data)
65+{
66+ dev_set_drvdata(&faux_dev->dev, data);
67+}
68+
69+#endif /* _FAUX_DEVICE_H_ */
include/linux/efi.h+16−15
@@ -114,21 +114,22 @@ typedef struct { · 113 unmodified lines
114114 #define EFI_MAX_MEMORY_TYPE 16
115115
116116 /* Attribute values: */
117−#define EFI_MEMORY_UC ((u64)0x0000000000000001ULL) /* uncached */
118−#define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */
119−#define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */
120−#define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */
121−#define EFI_MEMORY_UCE ((u64)0x0000000000000010ULL) /* uncached, exported */
122−#define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */
123−#define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */
124−#define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */
125−#define EFI_MEMORY_NV ((u64)0x0000000000008000ULL) /* non-volatile */
126−#define EFI_MEMORY_MORE_RELIABLE \
127− ((u64)0x0000000000010000ULL) /* higher reliability */
128−#define EFI_MEMORY_RO ((u64)0x0000000000020000ULL) /* read-only */
129−#define EFI_MEMORY_SP ((u64)0x0000000000040000ULL) /* soft reserved */
130−#define EFI_MEMORY_CPU_CRYPTO ((u64)0x0000000000080000ULL) /* supports encryption */
131−#define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */
117+#define EFI_MEMORY_UC BIT_ULL(0) /* uncached */
118+#define EFI_MEMORY_WC BIT_ULL(1) /* write-coalescing */
119+#define EFI_MEMORY_WT BIT_ULL(2) /* write-through */
120+#define EFI_MEMORY_WB BIT_ULL(3) /* write-back */
121+#define EFI_MEMORY_UCE BIT_ULL(4) /* uncached, exported */
122+#define EFI_MEMORY_WP BIT_ULL(12) /* write-protect */
123+#define EFI_MEMORY_RP BIT_ULL(13) /* read-protect */
124+#define EFI_MEMORY_XP BIT_ULL(14) /* execute-protect */
125+#define EFI_MEMORY_NV BIT_ULL(15) /* non-volatile */
126+#define EFI_MEMORY_MORE_RELIABLE BIT_ULL(16) /* higher reliability */
127+#define EFI_MEMORY_RO BIT_ULL(17) /* read-only */
128+#define EFI_MEMORY_SP BIT_ULL(18) /* soft reserved */
129+#define EFI_MEMORY_CPU_CRYPTO BIT_ULL(19) /* supports encryption */
130+#define EFI_MEMORY_HOT_PLUGGABLE BIT_ULL(20) /* supports unplugging at runtime */
131+#define EFI_MEMORY_RUNTIME BIT_ULL(63) /* range requires runtime mapping */
132+
132133 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
133134
134135 #define EFI_PAGE_SHIFT 12
include/linux/fs.h+19−1
@@ -222,7 +222,6 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset, · 221 unmodified lines
222222 #define FMODE_FSNOTIFY_HSM(mode) 0
223223 #endif
224224
225−
226225 /*
227226 * Attribute flags. These should be or-ed together to figure out what
228227 * has been changed!
@@ -791,6 +790,19 @@ struct inode { · 562 unmodified lines
791790
792791 static inline void inode_set_cached_link(struct inode *inode, char *link, int linklen)
793792 {
793+ int testlen;
794+
795+ /*
796+ * TODO: patch it into a debug-only check if relevant macros show up.
797+ * In the meantime, since we are suffering strlen even on production kernels
798+ * to find the right length, do a fixup if the wrong value got passed.
799+ */
800+ testlen = strlen(link);
801+ if (testlen != linklen) {
802+ WARN_ONCE(1, "bad length passed for symlink [%s] (got %d, expected %d)",
803+ link, linklen, testlen);
804+ linklen = testlen;
805+ }
794806 inode->i_link = link;
795807 inode->i_linklen = linklen;
796808 inode->i_opflags |= IOP_CACHED_LINK;
@@ -3140,6 +3152,12 @@ static inline void exe_file_allow_write_access(struct file *exe_file) · 2343 unmodified lines
31403152 allow_write_access(exe_file);
31413153 }
31423154
3155+static inline void file_set_fsnotify_mode(struct file *file, fmode_t mode)
3156+{
3157+ file->f_mode &= ~FMODE_FSNOTIFY_MASK;
3158+ file->f_mode |= mode;
3159+}
3160+
31433161 static inline bool inode_is_open_for_write(const struct inode *inode)
31443162 {
31453163 return atomic_read(&inode->i_writecount) > 0;
include/linux/fsnotify.h+2−2
@@ -129,7 +129,7 @@ static inline int fsnotify_file(struct file *file, __u32 mask) · 128 unmodified lines
129129
130130 #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS
131131
132−void file_set_fsnotify_mode(struct file *file);
132+void file_set_fsnotify_mode_from_watchers(struct file *file);
133133
134134 /*
135135 * fsnotify_file_area_perm - permission hook before access to file range
@@ -213,7 +213,7 @@ static inline int fsnotify_open_perm(struct file *file) · 77 unmodified lines
213213 }
214214
215215 #else
216−static inline void file_set_fsnotify_mode(struct file *file)
216+static inline void file_set_fsnotify_mode_from_watchers(struct file *file)
217217 {
218218 }
219219
include/linux/hrtimer_defs.h+1−0
@@ -125,6 +125,7 @@ struct hrtimer_cpu_base { · 124 unmodified lines
125125 ktime_t softirq_expires_next;
126126 struct hrtimer *softirq_next_timer;
127127 struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES];
128+ call_single_data_t csd;
128129 } ____cacheline_aligned;
129130
130131
include/linux/i2c.h+8−2
@@ -244,6 +244,7 @@ enum i2c_driver_flags { · 243 unmodified lines
244244 * @id_table: List of I2C devices supported by this driver
245245 * @detect: Callback for device detection
246246 * @address_list: The I2C addresses to probe (for detect)
247+ * @clients: List of detected clients we created (for i2c-core use only)
247248 * @flags: A bitmask of flags defined in &enum i2c_driver_flags
248249 *
249250 * The driver.owner field should be set to the module owner of this driver.
@@ -298,6 +299,7 @@ struct i2c_driver { · 48 unmodified lines
298299 /* Device detection callback for automatic device creation */
299300 int (*detect)(struct i2c_client *client, struct i2c_board_info *info);
300301 const unsigned short *address_list;
302+ struct list_head clients;
301303
302304 u32 flags;
303305 };
@@ -313,6 +315,8 @@ struct i2c_driver { · 9 unmodified lines
313315 * @dev: Driver model device node for the slave.
314316 * @init_irq: IRQ that was set at initialization
315317 * @irq: indicates the IRQ generated by this device (if any)
318+ * @detected: member of an i2c_driver.clients list or i2c-core's
319+ * userspace_devices list
316320 * @slave_cb: Callback when I2C slave mode of an adapter is used. The adapter
317321 * calls it to pass on slave events to the slave driver.
318322 * @devres_group_id: id of the devres group that will be created for resources
@@ -332,8 +336,6 @@ struct i2c_client { · 13 unmodified lines
332336 #define I2C_CLIENT_SLAVE 0x20 /* we are the slave */
333337 #define I2C_CLIENT_HOST_NOTIFY 0x40 /* We want to use I2C host notify */
334338 #define I2C_CLIENT_WAKE 0x80 /* for board_info; true iff can wake */
335−#define I2C_CLIENT_AUTO 0x100 /* client was auto-detected */
336−#define I2C_CLIENT_USER 0x200 /* client was userspace-created */
337339 #define I2C_CLIENT_SCCB 0x9000 /* Use Omnivision SCCB protocol */
338340 /* Must match I2C_M_STOP|IGNORE_NAK */
339341
@@ -345,6 +347,7 @@ struct i2c_client { · 5 unmodified lines
345347 struct device dev; /* the device structure */
346348 int init_irq; /* irq set at initialization */
347349 int irq; /* irq issued by device */
350+ struct list_head detected;
348351 #if IS_ENABLED(CONFIG_I2C_SLAVE)
349352 i2c_slave_cb_t slave_cb; /* callback for slave mode */
350353 #endif
@@ -751,6 +754,9 @@ struct i2c_adapter { · 400 unmodified lines
751754 char name[48];
752755 struct completion dev_released;
753756
757+ struct mutex userspace_clients_lock;
758+ struct list_head userspace_clients;
759+
754760 struct i2c_bus_recovery_info *bus_recovery_info;
755761 const struct i2c_adapter_quirks *quirks;
756762
include/linux/jiffies.h+1−1
@@ -537,7 +537,7 @@ static __always_inline unsigned long msecs_to_jiffies(const unsigned int m) · 536 unmodified lines
537537 *
538538 * Return: jiffies value
539539 */
540−#define secs_to_jiffies(_secs) ((_secs) * HZ)
540+#define secs_to_jiffies(_secs) (unsigned long)((_secs) * HZ)
541541
542542 extern unsigned long __usecs_to_jiffies(const unsigned int u);
543543 #if !(USEC_PER_SEC % HZ)
include/linux/kvm_host.h+0−1
@@ -1615,7 +1615,6 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu); · 1614 unmodified lines
16151615 bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu);
16161616 bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu);
16171617 bool kvm_arch_vcpu_preempted_in_kernel(struct kvm_vcpu *vcpu);
1618−int kvm_arch_post_init_vm(struct kvm *kvm);
16191618 void kvm_arch_pre_destroy_vm(struct kvm *kvm);
16201619 void kvm_arch_create_vm_debugfs(struct kvm *kvm);
16211620
include/linux/lockref.h+4−3
@@ -37,12 +37,13 @@ struct lockref { · 36 unmodified lines
3737 /**
3838 * lockref_init - Initialize a lockref
3939 * @lockref: pointer to lockref structure
40− * @count: initial count
40+ *
41+ * Initializes @lockref->count to 1.
4142 */
42−static inline void lockref_init(struct lockref *lockref, unsigned int count)
43+static inline void lockref_init(struct lockref *lockref)
4344 {
4445 spin_lock_init(&lockref->lock);
45− lockref->count = count;
46+ lockref->count = 1;
4647 }
4748
4849 void lockref_get(struct lockref *lockref);
include/linux/module.h+4−1
@@ -306,7 +306,10 @@ extern int modules_disabled; /* for sysctl */ · 305 unmodified lines
306306 /* Get/put a kernel symbol (calls must be symmetric) */
307307 void *__symbol_get(const char *symbol);
308308 void *__symbol_get_gpl(const char *symbol);
309−#define symbol_get(x) ((typeof(&x))(__symbol_get(__stringify(x))))
309+#define symbol_get(x) ({ \
310+ static const char __notrim[] \
311+ __used __section(".no_trim_symbol") = __stringify(x); \
312+ (typeof(&x))(__symbol_get(__stringify(x))); })
310313
311314 /* modules using other modules: kdb wants to see this. */
312315 struct module_use {
include/linux/netdevice.h+9−2
@@ -2663,6 +2663,12 @@ struct net *dev_net(const struct net_device *dev) · 2662 unmodified lines
26632663 return read_pnet(&dev->nd_net);
26642664 }
26652665
2666+static inline
2667+struct net *dev_net_rcu(const struct net_device *dev)
2668+{
2669+ return read_pnet_rcu(&dev->nd_net);
2670+}
2671+
26662672 static inline
26672673 void dev_net_set(struct net_device *dev, struct net *net)
26682674 {
@@ -2904,9 +2910,9 @@ struct pcpu_sw_netstats { · 235 unmodified lines
29042910 struct pcpu_dstats {
29052911 u64_stats_t rx_packets;
29062912 u64_stats_t rx_bytes;
2907− u64_stats_t rx_drops;
29082913 u64_stats_t tx_packets;
29092914 u64_stats_t tx_bytes;
2915+ u64_stats_t rx_drops;
29102916 u64_stats_t tx_drops;
29112917 struct u64_stats_sync syncp;
29122918 } __aligned(8 * sizeof(u64));
@@ -3269,6 +3275,8 @@ static inline struct net_device *first_net_device_rcu(struct net *net) · 356 unmodified lines
32693275 }
32703276
32713277 int netdev_boot_setup_check(struct net_device *dev);
3278+struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type,
3279+ const char *hwaddr);
32723280 struct net_device *dev_getbyhwaddr_rcu(struct net *net, unsigned short type,
32733281 const char *hwaddr);
32743282 struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
@@ -4109,7 +4117,6 @@ void netif_receive_skb_list(struct list_head *head); · 834 unmodified lines
41094117 gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
41104118 void napi_gro_flush(struct napi_struct *napi, bool flush_old);
41114119 struct sk_buff *napi_get_frags(struct napi_struct *napi);
4112−void napi_get_frags_check(struct napi_struct *napi);
41134120 gro_result_t napi_gro_frags(struct napi_struct *napi);
41144121
41154122 static inline void napi_free_frags(struct napi_struct *napi)
include/linux/netfs.h+1−1
@@ -278,7 +278,7 @@ struct netfs_io_request { · 277 unmodified lines
278278 #define NETFS_RREQ_PAUSE 11 /* Pause subrequest generation */
279279 #define NETFS_RREQ_USE_IO_ITER 12 /* Use ->io_iter rather than ->i_pages */
280280 #define NETFS_RREQ_ALL_QUEUED 13 /* All subreqs are now queued */
281−#define NETFS_RREQ_NEED_RETRY 14 /* Need to try retrying */
281+#define NETFS_RREQ_RETRYING 14 /* Set if we're in the retry path */
282282 #define NETFS_RREQ_USE_PGPRIV2 31 /* [DEPRECATED] Use PG_private_2 to mark
283283 * write to cache on read */
284284 const struct netfs_request_ops *netfs_ops;
include/linux/pci_ids.h+1−0
@@ -3134,6 +3134,7 @@ · 3133 unmodified lines
31343134 #define PCI_DEVICE_ID_INTEL_HDA_LNL_P 0xa828
31353135 #define PCI_DEVICE_ID_INTEL_S21152BB 0xb152
31363136 #define PCI_DEVICE_ID_INTEL_HDA_BMG 0xe2f7
3137+#define PCI_DEVICE_ID_INTEL_HDA_PTL_H 0xe328
31373138 #define PCI_DEVICE_ID_INTEL_HDA_PTL 0xe428
31383139 #define PCI_DEVICE_ID_INTEL_HDA_CML_R 0xf0c8
31393140 #define PCI_DEVICE_ID_INTEL_HDA_RKL_S 0xf1c8
include/linux/psp-sev.h+9−0
@@ -814,6 +814,15 @@ struct sev_data_snp_commit { · 813 unmodified lines
814814
815815 #ifdef CONFIG_CRYPTO_DEV_SP_PSP
816816
817+/**
818+ * sev_module_init - perform PSP SEV module initialization
819+ *
820+ * Returns:
821+ * 0 if the PSP module is successfully initialized
822+ * negative value if the PSP module initialization fails
823+ */
824+int sev_module_init(void);
825+
817826 /**
818827 * sev_platform_init - perform SEV INIT command
819828 *
include/linux/sched/task.h+1−0
@@ -43,6 +43,7 @@ struct kernel_clone_args { · 42 unmodified lines
4343 void *fn_arg;
4444 struct cgroup *cgrp;
4545 struct css_set *cset;
46+ unsigned int kill_seq;
4647 };
4748
4849 /*
include/linux/skmsg.h+2−0
@@ -91,6 +91,8 @@ struct sk_psock { · 90 unmodified lines
9191 struct sk_psock_progs progs;
9292 #if IS_ENABLED(CONFIG_BPF_STREAM_PARSER)
9393 struct strparser strp;
94+ u32 copied_seq;
95+ u32 ingress_bytes;
9496 #endif
9597 struct sk_buff_head ingress_skb;
9698 struct list_head ingress_msg;
include/linux/string.h+8−4
@@ -414,7 +414,8 @@ void memcpy_and_pad(void *dest, size_t dest_len, const void *src, size_t count, · 413 unmodified lines
414414 * must be discoverable by the compiler.
415415 */
416416 #define strtomem_pad(dest, src, pad) do { \
417− const size_t _dest_len = __builtin_object_size(dest, 1); \
417+ const size_t _dest_len = __must_be_byte_array(dest) + \
418+ ARRAY_SIZE(dest); \
418419 const size_t _src_len = __builtin_object_size(src, 1); \
419420 \
420421 BUILD_BUG_ON(!__builtin_constant_p(_dest_len) || \
@@ -437,7 +438,8 @@ void memcpy_and_pad(void *dest, size_t dest_len, const void *src, size_t count, · 16 unmodified lines
437438 * must be discoverable by the compiler.
438439 */
439440 #define strtomem(dest, src) do { \
440− const size_t _dest_len = __builtin_object_size(dest, 1); \
441+ const size_t _dest_len = __must_be_byte_array(dest) + \
442+ ARRAY_SIZE(dest); \
441443 const size_t _src_len = __builtin_object_size(src, 1); \
442444 \
443445 BUILD_BUG_ON(!__builtin_constant_p(_dest_len) || \
@@ -456,7 +458,8 @@ void memcpy_and_pad(void *dest, size_t dest_len, const void *src, size_t count, · 12 unmodified lines
456458 * Note that sizes of @dest and @src must be known at compile-time.
457459 */
458460 #define memtostr(dest, src) do { \
459− const size_t _dest_len = __builtin_object_size(dest, 1); \
461+ const size_t _dest_len = __must_be_byte_array(dest) + \
462+ ARRAY_SIZE(dest); \
460463 const size_t _src_len = __builtin_object_size(src, 1); \
461464 const size_t _src_chars = strnlen(src, _src_len); \
462465 const size_t _copy_len = min(_dest_len - 1, _src_chars); \
@@ -481,7 +484,8 @@ void memcpy_and_pad(void *dest, size_t dest_len, const void *src, size_t count, · 18 unmodified lines
481484 * Note that sizes of @dest and @src must be known at compile-time.
482485 */
483486 #define memtostr_pad(dest, src) do { \
484− const size_t _dest_len = __builtin_object_size(dest, 1); \
487+ const size_t _dest_len = __must_be_byte_array(dest) + \
488+ ARRAY_SIZE(dest); \
485489 const size_t _src_len = __builtin_object_size(src, 1); \
486490 const size_t _src_chars = strnlen(src, _src_len); \
487491 const size_t _copy_len = min(_dest_len - 1, _src_chars); \
include/net/bluetooth/l2cap.h+2−1
@@ -668,7 +668,7 @@ struct l2cap_conn { · 667 unmodified lines
668668 struct l2cap_chan *smp;
669669
670670 struct list_head chan_l;
671− struct mutex chan_lock;
671+ struct mutex lock;
672672 struct kref ref;
673673 struct list_head users;
674674 };
@@ -970,6 +970,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err); · 295 unmodified lines
970970 void l2cap_send_conn_req(struct l2cap_chan *chan);
971971
972972 struct l2cap_conn *l2cap_conn_get(struct l2cap_conn *conn);
973+struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *conn);
973974 void l2cap_conn_put(struct l2cap_conn *conn);
974975
975976 int l2cap_register_user(struct l2cap_conn *conn, struct l2cap_user *user);
include/net/gro.h+3−0
@@ -11,6 +11,9 @@ · 10 unmodified lines
1111 #include <net/udp.h>
1212 #include <net/hotdata.h>
1313
14+/* This should be increased if a protocol with a bigger head is added. */
15+#define GRO_MAX_HEAD (MAX_HEADER + 128)
16+
1417 struct napi_gro_cb {
1518 union {
1619 struct {
include/net/ip.h+10−3
@@ -471,9 +471,12 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, · 470 unmodified lines
471471 bool forwarding)
472472 {
473473 const struct rtable *rt = dst_rtable(dst);
474− struct net *net = dev_net(dst->dev);
475− unsigned int mtu;
474+ unsigned int mtu, res;
475+ struct net *net;
476+
477+ rcu_read_lock();
476478
479+ net = dev_net_rcu(dst->dev);
477480 if (READ_ONCE(net->ipv4.sysctl_ip_fwd_use_pmtu) ||
478481 ip_mtu_locked(dst) ||
479482 !forwarding) {
@@ -497,7 +500,11 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, · 17 unmodified lines
497500 out:
498501 mtu = min_t(unsigned int, mtu, IP_MAX_MTU);
499502
500− return mtu - lwtunnel_headroom(dst->lwtstate, mtu);
503+ res = mtu - lwtunnel_headroom(dst->lwtstate, mtu);
504+
505+ rcu_read_unlock();
506+
507+ return res;
501508 }
502509
503510 static inline unsigned int ip_skb_dst_mtu(struct sock *sk,
include/net/l3mdev.h+2−0
@@ -198,10 +198,12 @@ struct sk_buff *l3mdev_l3_out(struct sock *sk, struct sk_buff *skb, u16 proto) · 197 unmodified lines
198198 if (netif_is_l3_slave(dev)) {
199199 struct net_device *master;
200200
201+ rcu_read_lock();
201202 master = netdev_master_upper_dev_get_rcu(dev);
202203 if (master && master->l3mdev_ops->l3mdev_l3_out)
203204 skb = master->l3mdev_ops->l3mdev_l3_out(master, sk,
204205 skb, proto);
206+ rcu_read_unlock();
205207 }
206208
207209 return skb;
include/net/net_namespace.h+12−1
@@ -297,6 +297,7 @@ static inline int check_net(const struct net *net) · 296 unmodified lines
297297 }
298298
299299 void net_drop_ns(void *);
300+void net_passive_dec(struct net *net);
300301
301302 #else
302303
@@ -326,8 +327,18 @@ static inline int check_net(const struct net *net) · 23 unmodified lines
326327 }
327328
328329 #define net_drop_ns NULL
330+
331+static inline void net_passive_dec(struct net *net)
332+{
333+ refcount_dec(&net->passive);
334+}
329335 #endif
330336
337+static inline void net_passive_inc(struct net *net)
338+{
339+ refcount_inc(&net->passive);
340+}
341+
331342 /* Returns true if the netns initialization is completed successfully */
332343 static inline bool net_initialized(const struct net *net)
333344 {
@@ -398,7 +409,7 @@ static inline struct net *read_pnet(const possible_net_t *pnet) · 64 unmodified lines
398409 #endif
399410 }
400411
401−static inline struct net *read_pnet_rcu(possible_net_t *pnet)
412+static inline struct net *read_pnet_rcu(const possible_net_t *pnet)
402413 {
403414 #ifdef CONFIG_NET_NS
404415 return rcu_dereference(pnet->net);
include/net/route.h+7−2
@@ -382,10 +382,15 @@ static inline int inet_iif(const struct sk_buff *skb) · 381 unmodified lines
382382 static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
383383 {
384384 int hoplimit = dst_metric_raw(dst, RTAX_HOPLIMIT);
385− struct net *net = dev_net(dst->dev);
386385
387− if (hoplimit == 0)
386+ if (hoplimit == 0) {
387+ const struct net *net;
388+
389+ rcu_read_lock();
390+ net = dev_net_rcu(dst->dev);
388391 hoplimit = READ_ONCE(net->ipv4.sysctl_ip_default_ttl);
392+ rcu_read_unlock();
393+ }
389394 return hoplimit;
390395 }
391396
include/net/sch_generic.h+1−1
@@ -851,7 +851,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch, · 850 unmodified lines
851851 }
852852
853853 static inline void _bstats_update(struct gnet_stats_basic_sync *bstats,
854− __u64 bytes, __u32 packets)
854+ __u64 bytes, __u64 packets)
855855 {
856856 u64_stats_update_begin(&bstats->syncp);
857857 u64_stats_add(&bstats->bytes, bytes);
include/net/strparser.h+2−0
@@ -43,6 +43,8 @@ struct strparser; · 42 unmodified lines
4343 struct strp_callbacks {
4444 int (*parse_msg)(struct strparser *strp, struct sk_buff *skb);
4545 void (*rcv_msg)(struct strparser *strp, struct sk_buff *skb);
46+ int (*read_sock)(struct strparser *strp, read_descriptor_t *desc,
47+ sk_read_actor_t recv_actor);
4648 int (*read_sock_done)(struct strparser *strp, int err);
4749 void (*abort_parser)(struct strparser *strp, int err);
4850 void (*lock)(struct strparser *strp);
include/net/tcp.h+22−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141 #include <net/inet_ecn.h>
4242 #include <net/dst.h>
4343 #include <net/mptcp.h>
44+#include <net/xfrm.h>
4445
4546 #include <linux/seq_file.h>
4647 #include <linux/memcontrol.h>
@@ -683,6 +684,19 @@ void tcp_fin(struct sock *sk); · 636 unmodified lines
683684 void tcp_check_space(struct sock *sk);
684685 void tcp_sack_compress_send_ack(struct sock *sk);
685686
687+static inline void tcp_cleanup_skb(struct sk_buff *skb)
688+{
689+ skb_dst_drop(skb);
690+ secpath_reset(skb);
691+}
692+
693+static inline void tcp_add_receive_queue(struct sock *sk, struct sk_buff *skb)
694+{
695+ DEBUG_NET_WARN_ON_ONCE(skb_dst(skb));
696+ DEBUG_NET_WARN_ON_ONCE(secpath_exists(skb));
697+ __skb_queue_tail(&sk->sk_receive_queue, skb);
698+}
699+
686700 /* tcp_timer.c */
687701 void tcp_init_xmit_timers(struct sock *);
688702 static inline void tcp_clear_xmit_timers(struct sock *sk)
@@ -729,6 +743,9 @@ void tcp_get_info(struct sock *, struct tcp_info *); · 40 unmodified lines
729743 /* Read 'sendfile()'-style from a TCP socket */
730744 int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
731745 sk_read_actor_t recv_actor);
746+int tcp_read_sock_noack(struct sock *sk, read_descriptor_t *desc,
747+ sk_read_actor_t recv_actor, bool noack,
748+ u32 *copied_seq);
732749 int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor);
733750 struct sk_buff *tcp_recv_skb(struct sock *sk, u32 seq, u32 *off);
734751 void tcp_read_done(struct sock *sk, size_t len);
@@ -2599,6 +2616,11 @@ struct sk_psock; · 1864 unmodified lines
25992616 #ifdef CONFIG_BPF_SYSCALL
26002617 int tcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore);
26012618 void tcp_bpf_clone(const struct sock *sk, struct sock *newsk);
2619+#ifdef CONFIG_BPF_STREAM_PARSER
2620+struct strparser;
2621+int tcp_bpf_strp_read_sock(struct strparser *strp, read_descriptor_t *desc,
2622+ sk_read_actor_t recv_actor);
2623+#endif /* CONFIG_BPF_STREAM_PARSER */
26022624 #endif /* CONFIG_BPF_SYSCALL */
26032625
26042626 #ifdef CONFIG_INET
include/trace/events/netfs.h+3−1
@@ -99,7 +99,7 @@ · 98 unmodified lines
9999 EM(netfs_sreq_trace_limited, "LIMIT") \
100100 EM(netfs_sreq_trace_need_clear, "N-CLR") \
101101 EM(netfs_sreq_trace_partial_read, "PARTR") \
102− EM(netfs_sreq_trace_need_retry, "NRTRY") \
102+ EM(netfs_sreq_trace_need_retry, "ND-RT") \
103103 EM(netfs_sreq_trace_prepare, "PREP ") \
104104 EM(netfs_sreq_trace_prep_failed, "PRPFL") \
105105 EM(netfs_sreq_trace_progress, "PRGRS") \
@@ -108,7 +108,9 @@ · 2 unmodified lines
108108 EM(netfs_sreq_trace_short, "SHORT") \
109109 EM(netfs_sreq_trace_split, "SPLIT") \
110110 EM(netfs_sreq_trace_submit, "SUBMT") \
111+ EM(netfs_sreq_trace_superfluous, "SPRFL") \
111112 EM(netfs_sreq_trace_terminated, "TERM ") \
113+ EM(netfs_sreq_trace_wait_for, "_WAIT") \
112114 EM(netfs_sreq_trace_write, "WRITE") \
113115 EM(netfs_sreq_trace_write_skip, "SKIP ") \
114116 E_(netfs_sreq_trace_write_term, "WTERM")
include/trace/events/rxrpc.h+1−0
@@ -219,6 +219,7 @@ · 218 unmodified lines
219219 EM(rxrpc_conn_get_conn_input, "GET inp-conn") \
220220 EM(rxrpc_conn_get_idle, "GET idle ") \
221221 EM(rxrpc_conn_get_poke_abort, "GET pk-abort") \
222+ EM(rxrpc_conn_get_poke_secured, "GET secured ") \
222223 EM(rxrpc_conn_get_poke_timer, "GET poke ") \
223224 EM(rxrpc_conn_get_service_conn, "GET svc-conn") \
224225 EM(rxrpc_conn_new_client, "NEW client ") \
include/uapi/drm/amdgpu_drm.h+8−1
@@ -411,13 +411,20 @@ struct drm_amdgpu_gem_userptr { · 410 unmodified lines
411411 /* GFX12 and later: */
412412 #define AMDGPU_TILING_GFX12_SWIZZLE_MODE_SHIFT 0
413413 #define AMDGPU_TILING_GFX12_SWIZZLE_MODE_MASK 0x7
414−/* These are DCC recompression setting for memory management: */
414+/* These are DCC recompression settings for memory management: */
415415 #define AMDGPU_TILING_GFX12_DCC_MAX_COMPRESSED_BLOCK_SHIFT 3
416416 #define AMDGPU_TILING_GFX12_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 /* 0:64B, 1:128B, 2:256B */
417417 #define AMDGPU_TILING_GFX12_DCC_NUMBER_TYPE_SHIFT 5
418418 #define AMDGPU_TILING_GFX12_DCC_NUMBER_TYPE_MASK 0x7 /* CB_COLOR0_INFO.NUMBER_TYPE */
419419 #define AMDGPU_TILING_GFX12_DCC_DATA_FORMAT_SHIFT 8
420420 #define AMDGPU_TILING_GFX12_DCC_DATA_FORMAT_MASK 0x3f /* [0:4]:CB_COLOR0_INFO.FORMAT, [5]:MM */
421+/* When clearing the buffer or moving it from VRAM to GTT, don't compress and set DCC metadata
422+ * to uncompressed. Set when parts of an allocation bypass DCC and read raw data. */
423+#define AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE_SHIFT 14
424+#define AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE_MASK 0x1
425+/* bit gap */
426+#define AMDGPU_TILING_GFX12_SCANOUT_SHIFT 63
427+#define AMDGPU_TILING_GFX12_SCANOUT_MASK 0x1
421428
422429 /* Set/Get helpers for tiling flags. */
423430 #define AMDGPU_TILING_SET(field, value) \
include/uapi/linux/ethtool.h+2−0
@@ -682,6 +682,7 @@ enum ethtool_link_ext_substate_module { · 681 unmodified lines
682682 * @ETH_SS_STATS_ETH_CTRL: names of IEEE 802.3 MAC Control statistics
683683 * @ETH_SS_STATS_RMON: names of RMON statistics
684684 * @ETH_SS_STATS_PHY: names of PHY(dev) statistics
685+ * @ETH_SS_TS_FLAGS: hardware timestamping flags
685686 *
686687 * @ETH_SS_COUNT: number of defined string sets
687688 */
@@ -708,6 +709,7 @@ enum ethtool_stringset { · 20 unmodified lines
708709 ETH_SS_STATS_ETH_CTRL,
709710 ETH_SS_STATS_RMON,
710711 ETH_SS_STATS_PHY,
712+ ETH_SS_TS_FLAGS,
711713
712714 /* add new constants above here */
713715 ETH_SS_COUNT
include/uapi/linux/taskstats.h+1−1
@@ -34,7 +34,7 @@ · 33 unmodified lines
3434 */
3535
3636
37−#define TASKSTATS_VERSION 14
37+#define TASKSTATS_VERSION 15
3838 #define TS_COMM_LEN 32 /* should be >= TASK_COMM_LEN
3939 * in linux/sched.h */
4040
include/uapi/linux/thermal.h+1−1
@@ -30,7 +30,6 @@ enum thermal_genl_attr { · 29 unmodified lines
3030 THERMAL_GENL_ATTR_TZ,
3131 THERMAL_GENL_ATTR_TZ_ID,
3232 THERMAL_GENL_ATTR_TZ_TEMP,
33− THERMAL_GENL_ATTR_TZ_PREV_TEMP,
3433 THERMAL_GENL_ATTR_TZ_TRIP,
3534 THERMAL_GENL_ATTR_TZ_TRIP_ID,
3635 THERMAL_GENL_ATTR_TZ_TRIP_TYPE,
@@ -54,6 +53,7 @@ enum thermal_genl_attr { · 17 unmodified lines
5453 THERMAL_GENL_ATTR_THRESHOLD,
5554 THERMAL_GENL_ATTR_THRESHOLD_TEMP,
5655 THERMAL_GENL_ATTR_THRESHOLD_DIRECTION,
56+ THERMAL_GENL_ATTR_TZ_PREV_TEMP,
5757 __THERMAL_GENL_ATTR_MAX,
5858 };
5959 #define THERMAL_GENL_ATTR_MAX (__THERMAL_GENL_ATTR_MAX - 1)
include/uapi/linux/virtio_snd.h+1−1
@@ -25,7 +25,7 @@ struct virtio_snd_config { · 24 unmodified lines
2525 __le32 streams;
2626 /* # of available channel maps */
2727 __le32 chmaps;
28− /* # of available control elements */
28+ /* # of available control elements (if VIRTIO_SND_F_CTLS) */
2929 __le32 controls;
3030 };
3131
include/ufs/ufs.h+2−2
@@ -385,8 +385,8 @@ enum { · 384 unmodified lines
385385
386386 /* Possible values for dExtendedUFSFeaturesSupport */
387387 enum {
388− UFS_DEV_LOW_TEMP_NOTIF = BIT(4),
389− UFS_DEV_HIGH_TEMP_NOTIF = BIT(5),
388+ UFS_DEV_HIGH_TEMP_NOTIF = BIT(4),
389+ UFS_DEV_LOW_TEMP_NOTIF = BIT(5),
390390 UFS_DEV_EXT_TEMP_NOTIF = BIT(6),
391391 UFS_DEV_HPB_SUPPORT = BIT(7),
392392 UFS_DEV_WRITE_BOOSTER_SUP = BIT(8),
include/ufs/ufshcd.h+0−1
@@ -1309,7 +1309,6 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) · 1308 unmodified lines
13091309 void ufshcd_enable_irq(struct ufs_hba *hba);
13101310 void ufshcd_disable_irq(struct ufs_hba *hba);
13111311 int ufshcd_alloc_host(struct device *, struct ufs_hba **);
1312−void ufshcd_dealloc_host(struct ufs_hba *);
13131312 int ufshcd_hba_enable(struct ufs_hba *hba);
13141313 int ufshcd_init(struct ufs_hba *, void __iomem *, unsigned int);
13151314 int ufshcd_link_recovery(struct ufs_hba *hba);
io_uring/futex.c+1−1
@@ -338,7 +338,7 @@ int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags) · 337 unmodified lines
338338 hlist_add_head(&req->hash_node, &ctx->futex_list);
339339 io_ring_submit_unlock(ctx, issue_flags);
340340
341− futex_queue(&ifd->q, hb);
341+ futex_queue(&ifd->q, hb, NULL);
342342 return IOU_ISSUE_SKIP_COMPLETE;
343343 }
344344
io_uring/kbuf.c+12−4
@@ -415,6 +415,13 @@ void io_destroy_buffers(struct io_ring_ctx *ctx) · 414 unmodified lines
415415 }
416416 }
417417
418+static void io_destroy_bl(struct io_ring_ctx *ctx, struct io_buffer_list *bl)
419+{
420+ scoped_guard(mutex, &ctx->mmap_lock)
421+ WARN_ON_ONCE(xa_erase(&ctx->io_bl_xa, bl->bgid) != bl);
422+ io_put_bl(ctx, bl);
423+}
424+
418425 int io_remove_buffers_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
419426 {
420427 struct io_provide_buf *p = io_kiocb_to_cmd(req, struct io_provide_buf);
@@ -636,12 +643,13 @@ int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg) · 215 unmodified lines
636643 /* if mapped buffer ring OR classic exists, don't allow */
637644 if (bl->flags & IOBL_BUF_RING || !list_empty(&bl->buf_list))
638645 return -EEXIST;
639− } else {
640− free_bl = bl = kzalloc(sizeof(*bl), GFP_KERNEL);
641− if (!bl)
642− return -ENOMEM;
646+ io_destroy_bl(ctx, bl);
643647 }
644648
649+ free_bl = bl = kzalloc(sizeof(*bl), GFP_KERNEL);
650+ if (!bl)
651+ return -ENOMEM;
652+
645653 mmap_offset = (unsigned long)reg.bgid << IORING_OFF_PBUF_SHIFT;
646654 ring_size = flex_array_size(br, bufs, reg.ring_entries);
647655
io_uring/uring_cmd.c+9−19
@@ -54,9 +54,6 @@ bool io_uring_try_cancel_uring_cmd(struct io_ring_ctx *ctx, · 53 unmodified lines
5454 continue;
5555
5656 if (cmd->flags & IORING_URING_CMD_CANCELABLE) {
57− /* ->sqe isn't available if no async data */
58− if (!req_has_async_data(req))
59− cmd->sqe = NULL;
6057 file->f_op->uring_cmd(cmd, IO_URING_F_CANCEL |
6158 IO_URING_F_COMPLETE_DEFER);
6259 ret = true;
@@ -179,12 +176,13 @@ static int io_uring_cmd_prep_setup(struct io_kiocb *req, · 116 unmodified lines
179176 return -ENOMEM;
180177 cache->op_data = NULL;
181178
182− if (!(req->flags & REQ_F_FORCE_ASYNC)) {
183− /* defer memcpy until we need it */
184− ioucmd->sqe = sqe;
185− return 0;
186− }
187−
179+ /*
180+ * Unconditionally cache the SQE for now - this is only needed for
181+ * requests that go async, but prep handlers must ensure that any
182+ * sqe data is stable beyond prep. Since uring_cmd is special in
183+ * that it doesn't read in per-op data, play it safe and ensure that
184+ * any SQE data is stable beyond prep. This can later get relaxed.
185+ */
188186 memcpy(cache->sqes, sqe, uring_sqe_size(req->ctx));
189187 ioucmd->sqe = cache->sqes;
190188 return 0;
@@ -249,16 +247,8 @@ int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags) · 58 unmodified lines
249247 }
250248
251249 ret = file->f_op->uring_cmd(ioucmd, issue_flags);
252− if (ret == -EAGAIN) {
253− struct io_uring_cmd_data *cache = req->async_data;
254−
255− if (ioucmd->sqe != (void *) cache)
256− memcpy(cache->sqes, ioucmd->sqe, uring_sqe_size(req->ctx));
257− return -EAGAIN;
258− } else if (ret == -EIOCBQUEUED) {
259− return -EIOCBQUEUED;
260− }
261−
250+ if (ret == -EAGAIN || ret == -EIOCBQUEUED)
251+ return ret;
262252 if (ret < 0)
263253 req_set_fail(req);
264254 io_req_uring_cleanup(req, issue_flags);
io_uring/waitid.c+9−9
@@ -118,7 +118,6 @@ static int io_waitid_finish(struct io_kiocb *req, int ret) · 117 unmodified lines
118118 static void io_waitid_complete(struct io_kiocb *req, int ret)
119119 {
120120 struct io_waitid *iw = io_kiocb_to_cmd(req, struct io_waitid);
121− struct io_tw_state ts = {};
122121
123122 /* anyone completing better be holding a reference */
124123 WARN_ON_ONCE(!(atomic_read(&iw->refs) & IO_WAITID_REF_MASK));
@@ -131,7 +130,6 @@ static void io_waitid_complete(struct io_kiocb *req, int ret) · 6 unmodified lines
131130 if (ret < 0)
132131 req_set_fail(req);
133132 io_req_set_res(req, ret, 0);
134− io_req_task_complete(req, &ts);
135133 }
136134
137135 static bool __io_waitid_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req)
@@ -153,6 +151,7 @@ static bool __io_waitid_cancel(struct io_ring_ctx *ctx, struct io_kiocb *req) · 15 unmodified lines
153151 list_del_init(&iwa->wo.child_wait.entry);
154152 spin_unlock_irq(&iw->head->lock);
155153 io_waitid_complete(req, -ECANCELED);
154+ io_req_queue_tw_complete(req, -ECANCELED);
156155 return true;
157156 }
158157
@@ -258,6 +257,7 @@ static void io_waitid_cb(struct io_kiocb *req, struct io_tw_state *ts) · 99 unmodified lines
258257 }
259258
260259 io_waitid_complete(req, ret);
260+ io_req_task_complete(req, ts);
261261 }
262262
263263 static int io_waitid_wait(struct wait_queue_entry *wait, unsigned mode,
@@ -285,10 +285,16 @@ static int io_waitid_wait(struct wait_queue_entry *wait, unsigned mode, · 21 unmodified lines
285285 int io_waitid_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
286286 {
287287 struct io_waitid *iw = io_kiocb_to_cmd(req, struct io_waitid);
288+ struct io_waitid_async *iwa;
288289
289290 if (sqe->addr || sqe->buf_index || sqe->addr3 || sqe->waitid_flags)
290291 return -EINVAL;
291292
293+ iwa = io_uring_alloc_async_data(NULL, req);
294+ if (!unlikely(iwa))
295+ return -ENOMEM;
296+ iwa->req = req;
297+
292298 iw->which = READ_ONCE(sqe->len);
293299 iw->upid = READ_ONCE(sqe->fd);
294300 iw->options = READ_ONCE(sqe->file_index);
@@ -299,16 +305,10 @@ int io_waitid_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) · 4 unmodified lines
299305 int io_waitid(struct io_kiocb *req, unsigned int issue_flags)
300306 {
301307 struct io_waitid *iw = io_kiocb_to_cmd(req, struct io_waitid);
308+ struct io_waitid_async *iwa = req->async_data;
302309 struct io_ring_ctx *ctx = req->ctx;
303− struct io_waitid_async *iwa;
304310 int ret;
305311
306− iwa = io_uring_alloc_async_data(NULL, req);
307− if (!iwa)
308− return -ENOMEM;
309−
310− iwa->req = req;
311−
312312 ret = kernel_waitid_prepare(&iwa->wo, iw->which, iw->upid, &iw->info,
313313 iw->options, NULL);
314314 if (ret)
kernel/acct.c+84−50
@@ -103,48 +103,50 @@ struct bsd_acct_struct { · 102 unmodified lines
103103 atomic_long_t count;
104104 struct rcu_head rcu;
105105 struct mutex lock;
106− int active;
106+ bool active;
107+ bool check_space;
107108 unsigned long needcheck;
108109 struct file *file;
109110 struct pid_namespace *ns;
110111 struct work_struct work;
111112 struct completion done;
113+ acct_t ac;
112114 };
113115
114−static void do_acct_process(struct bsd_acct_struct *acct);
116+static void fill_ac(struct bsd_acct_struct *acct);
117+static void acct_write_process(struct bsd_acct_struct *acct);
115118
116119 /*
117120 * Check the amount of free space and suspend/resume accordingly.
118121 */
119−static int check_free_space(struct bsd_acct_struct *acct)
122+static bool check_free_space(struct bsd_acct_struct *acct)
120123 {
121124 struct kstatfs sbuf;
122125
123− if (time_is_after_jiffies(acct->needcheck))
124− goto out;
126+ if (!acct->check_space)
127+ return acct->active;
125128
126129 /* May block */
127130 if (vfs_statfs(&acct->file->f_path, &sbuf))
128− goto out;
131+ return acct->active;
129132
130133 if (acct->active) {
131134 u64 suspend = sbuf.f_blocks * SUSPEND;
132135 do_div(suspend, 100);
133136 if (sbuf.f_bavail <= suspend) {
134− acct->active = 0;
137+ acct->active = false;
135138 pr_info("Process accounting paused\n");
136139 }
137140 } else {
138141 u64 resume = sbuf.f_blocks * RESUME;
139142 do_div(resume, 100);
140143 if (sbuf.f_bavail >= resume) {
141− acct->active = 1;
144+ acct->active = true;
142145 pr_info("Process accounting resumed\n");
143146 }
144147 }
145148
146149 acct->needcheck = jiffies + ACCT_TIMEOUT*HZ;
147−out:
148150 return acct->active;
149151 }
150152
@@ -189,7 +191,11 @@ static void acct_pin_kill(struct fs_pin *pin) · 38 unmodified lines
189191 {
190192 struct bsd_acct_struct *acct = to_acct(pin);
191193 mutex_lock(&acct->lock);
192− do_acct_process(acct);
194+ /*
195+ * Fill the accounting struct with the exiting task's info
196+ * before punting to the workqueue.
197+ */
198+ fill_ac(acct);
193199 schedule_work(&acct->work);
194200 wait_for_completion(&acct->done);
195201 cmpxchg(&acct->ns->bacct, pin, NULL);
@@ -202,6 +208,9 @@ static void close_work(struct work_struct *work) · 6 unmodified lines
202208 {
203209 struct bsd_acct_struct *acct = container_of(work, struct bsd_acct_struct, work);
204210 struct file *file = acct->file;
211+
212+ /* We were fired by acct_pin_kill() which holds acct->lock. */
213+ acct_write_process(acct);
205214 if (file->f_op->flush)
206215 file->f_op->flush(file, NULL);
207216 __fput_sync(file);
@@ -234,6 +243,20 @@ static int acct_on(struct filename *pathname) · 26 unmodified lines
234243 return -EACCES;
235244 }
236245
246+ /* Exclude kernel kernel internal filesystems. */
247+ if (file_inode(file)->i_sb->s_flags & (SB_NOUSER | SB_KERNMOUNT)) {
248+ kfree(acct);
249+ filp_close(file, NULL);
250+ return -EINVAL;
251+ }
252+
253+ /* Exclude procfs and sysfs. */
254+ if (file_inode(file)->i_sb->s_iflags & SB_I_USERNS_VISIBLE) {
255+ kfree(acct);
256+ filp_close(file, NULL);
257+ return -EINVAL;
258+ }
259+
237260 if (!(file->f_mode & FMODE_CAN_WRITE)) {
238261 kfree(acct);
239262 filp_close(file, NULL);
@@ -430,13 +453,27 @@ static u32 encode_float(u64 value) · 190 unmodified lines
430453 * do_exit() or when switching to a different output file.
431454 */
432455
433−static void fill_ac(acct_t *ac)
456+static void fill_ac(struct bsd_acct_struct *acct)
434457 {
435458 struct pacct_struct *pacct = &current->signal->pacct;
459+ struct file *file = acct->file;
460+ acct_t *ac = &acct->ac;
436461 u64 elapsed, run_time;
437462 time64_t btime;
438463 struct tty_struct *tty;
439464
465+ lockdep_assert_held(&acct->lock);
466+
467+ if (time_is_after_jiffies(acct->needcheck)) {
468+ acct->check_space = false;
469+
470+ /* Don't fill in @ac if nothing will be written. */
471+ if (!acct->active)
472+ return;
473+ } else {
474+ acct->check_space = true;
475+ }
476+
440477 /*
441478 * Fill the accounting struct with the needed info as recorded
442479 * by the different kernel functions.
@@ -484,64 +521,61 @@ static void fill_ac(acct_t *ac) · 41 unmodified lines
484521 ac->ac_majflt = encode_comp_t(pacct->ac_majflt);
485522 ac->ac_exitcode = pacct->ac_exitcode;
486523 spin_unlock_irq(&current->sighand->siglock);
487−}
488−/*
489− * do_acct_process does all actual work. Caller holds the reference to file.
490− */
491−static void do_acct_process(struct bsd_acct_struct *acct)
492−{
493− acct_t ac;
494− unsigned long flim;
495− const struct cred *orig_cred;
496− struct file *file = acct->file;
497524
498− /*
499− * Accounting records are not subject to resource limits.
500− */
501− flim = rlimit(RLIMIT_FSIZE);
502− current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
503− /* Perform file operations on behalf of whoever enabled accounting */
504− orig_cred = override_creds(file->f_cred);
505−
506− /*
507− * First check to see if there is enough free_space to continue
508− * the process accounting system.
509− */
510− if (!check_free_space(acct))
511− goto out;
512−
513− fill_ac(&ac);
514525 /* we really need to bite the bullet and change layout */
515− ac.ac_uid = from_kuid_munged(file->f_cred->user_ns, orig_cred->uid);
516− ac.ac_gid = from_kgid_munged(file->f_cred->user_ns, orig_cred->gid);
526+ ac->ac_uid = from_kuid_munged(file->f_cred->user_ns, current_uid());
527+ ac->ac_gid = from_kgid_munged(file->f_cred->user_ns, current_gid());
517528 #if ACCT_VERSION == 1 || ACCT_VERSION == 2
518529 /* backward-compatible 16 bit fields */
519− ac.ac_uid16 = ac.ac_uid;
520− ac.ac_gid16 = ac.ac_gid;
530+ ac->ac_uid16 = ac->ac_uid;
531+ ac->ac_gid16 = ac->ac_gid;
521532 #elif ACCT_VERSION == 3
522533 {
523534 struct pid_namespace *ns = acct->ns;
524535
525− ac.ac_pid = task_tgid_nr_ns(current, ns);
536+ ac->ac_pid = task_tgid_nr_ns(current, ns);
526537 rcu_read_lock();
527− ac.ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent),
528− ns);
538+ ac->ac_ppid = task_tgid_nr_ns(rcu_dereference(current->real_parent), ns);
529539 rcu_read_unlock();
530540 }
531541 #endif
542+}
543+
544+static void acct_write_process(struct bsd_acct_struct *acct)
545+{
546+ struct file *file = acct->file;
547+ const struct cred *cred;
548+ acct_t *ac = &acct->ac;
549+
550+ /* Perform file operations on behalf of whoever enabled accounting */
551+ cred = override_creds(file->f_cred);
552+
532553 /*
533− * Get freeze protection. If the fs is frozen, just skip the write
534− * as we could deadlock the system otherwise.
554+ * First check to see if there is enough free_space to continue
555+ * the process accounting system. Then get freeze protection. If
556+ * the fs is frozen, just skip the write as we could deadlock
557+ * the system otherwise.
535558 */
536− if (file_start_write_trylock(file)) {
559+ if (check_free_space(acct) && file_start_write_trylock(file)) {
537560 /* it's been opened O_APPEND, so position is irrelevant */
538561 loff_t pos = 0;
539− __kernel_write(file, &ac, sizeof(acct_t), &pos);
562+ __kernel_write(file, ac, sizeof(acct_t), &pos);
540563 file_end_write(file);
541564 }
542−out:
565+
566+ revert_creds(cred);
567+}
568+
569+static void do_acct_process(struct bsd_acct_struct *acct)
570+{
571+ unsigned long flim;
572+
573+ /* Accounting records are not subject to resource limits. */
574+ flim = rlimit(RLIMIT_FSIZE);
575+ current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
576+ fill_ac(acct);
577+ acct_write_process(acct);
543578 current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim;
544− revert_creds(orig_cred);
545579 }
546580
547581 /**
kernel/bpf/arena.c+1−1
@@ -39,7 +39,7 @@ · 38 unmodified lines
3939 */
4040
4141 /* number of bytes addressable by LDX/STX insn with 16-bit 'off' field */
42−#define GUARD_SZ (1ull << sizeof_field(struct bpf_insn, off) * 8)
42+#define GUARD_SZ round_up(1ull << sizeof_field(struct bpf_insn, off) * 8, PAGE_SIZE << 1)
4343 #define KERN_VM_SZ (SZ_4G + GUARD_SZ)
4444
4545 struct bpf_arena {
kernel/bpf/bpf_cgrp_storage.c+1−1
@@ -153,7 +153,7 @@ static struct bpf_map *cgroup_storage_map_alloc(union bpf_attr *attr) · 152 unmodified lines
153153
154154 static void cgroup_storage_map_free(struct bpf_map *map)
155155 {
156− bpf_local_storage_map_free(map, &cgroup_cache, NULL);
156+ bpf_local_storage_map_free(map, &cgroup_cache, &bpf_cgrp_storage_busy);
157157 }
158158
159159 /* *gfp_flags* is a hidden argument provided by the verifier */
kernel/bpf/btf.c+2−0
@@ -6507,6 +6507,8 @@ static const struct bpf_raw_tp_null_args raw_tp_null_args[] = { · 6506 unmodified lines
65076507 { "rxrpc_resend", 0x10 },
65086508 { "rxrpc_tq", 0x10 },
65096509 { "rxrpc_client", 0x1 },
6510+ /* skb */
6511+ {"kfree_skb", 0x1000},
65106512 /* sunrpc */
65116513 { "xs_stream_read_data", 0x1 },
65126514 /* ... from xprt_cong_event event class */
kernel/bpf/ringbuf.c+0−4
@@ -268,8 +268,6 @@ static int ringbuf_map_mmap_kern(struct bpf_map *map, struct vm_area_struct *vma · 267 unmodified lines
268268 /* allow writable mapping for the consumer_pos only */
269269 if (vma->vm_pgoff != 0 || vma->vm_end - vma->vm_start != PAGE_SIZE)
270270 return -EPERM;
271− } else {
272− vm_flags_clear(vma, VM_MAYWRITE);
273271 }
274272 /* remap_vmalloc_range() checks size and offset constraints */
275273 return remap_vmalloc_range(vma, rb_map->rb,
@@ -289,8 +287,6 @@ static int ringbuf_map_mmap_user(struct bpf_map *map, struct vm_area_struct *vma · 13 unmodified lines
289287 * position, and the ring buffer data itself.
290288 */
291289 return -EPERM;
292− } else {
293− vm_flags_clear(vma, VM_MAYWRITE);
294290 }
295291 /* remap_vmalloc_range() checks size and offset constraints */
296292 return remap_vmalloc_range(vma, rb_map->rb, vma->vm_pgoff + RINGBUF_PGOFF);
kernel/bpf/syscall.c+22−21
@@ -1035,7 +1035,7 @@ static const struct vm_operations_struct bpf_map_default_vmops = { · 1034 unmodified lines
10351035 static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma)
10361036 {
10371037 struct bpf_map *map = filp->private_data;
1038− int err;
1038+ int err = 0;
10391039
10401040 if (!map->ops->map_mmap || !IS_ERR_OR_NULL(map->record))
10411041 return -ENOTSUPP;
@@ -1059,24 +1059,33 @@ static int bpf_map_mmap(struct file *filp, struct vm_area_struct *vma) · 17 unmodified lines
10591059 err = -EACCES;
10601060 goto out;
10611061 }
1062+ bpf_map_write_active_inc(map);
10621063 }
1064+out:
1065+ mutex_unlock(&map->freeze_mutex);
1066+ if (err)
1067+ return err;
10631068
10641069 /* set default open/close callbacks */
10651070 vma->vm_ops = &bpf_map_default_vmops;
10661071 vma->vm_private_data = map;
10671072 vm_flags_clear(vma, VM_MAYEXEC);
1073+ /* If mapping is read-only, then disallow potentially re-mapping with
1074+ * PROT_WRITE by dropping VM_MAYWRITE flag. This VM_MAYWRITE clearing
1075+ * means that as far as BPF map's memory-mapped VMAs are concerned,
1076+ * VM_WRITE and VM_MAYWRITE and equivalent, if one of them is set,
1077+ * both should be set, so we can forget about VM_MAYWRITE and always
1078+ * check just VM_WRITE
1079+ */
10681080 if (!(vma->vm_flags & VM_WRITE))
1069− /* disallow re-mapping with PROT_WRITE */
10701081 vm_flags_clear(vma, VM_MAYWRITE);
10711082
10721083 err = map->ops->map_mmap(map, vma);
1073− if (err)
1074− goto out;
1084+ if (err) {
1085+ if (vma->vm_flags & VM_WRITE)
1086+ bpf_map_write_active_dec(map);
1087+ }
10751088
1076− if (vma->vm_flags & VM_MAYWRITE)
1077− bpf_map_write_active_inc(map);
1078−out:
1079− mutex_unlock(&map->freeze_mutex);
10801089 return err;
10811090 }
10821091
@@ -1968,8 +1977,6 @@ int generic_map_update_batch(struct bpf_map *map, struct file *map_file, · 885 unmodified lines
19681977 return err;
19691978 }
19701979
1971−#define MAP_LOOKUP_RETRIES 3
1972−
19731980 int generic_map_lookup_batch(struct bpf_map *map,
19741981 const union bpf_attr *attr,
19751982 union bpf_attr __user *uattr)
@@ -1979,8 +1986,8 @@ int generic_map_lookup_batch(struct bpf_map *map, · 3 unmodified lines
19791986 void __user *values = u64_to_user_ptr(attr->batch.values);
19801987 void __user *keys = u64_to_user_ptr(attr->batch.keys);
19811988 void *buf, *buf_prevkey, *prev_key, *key, *value;
1982− int err, retry = MAP_LOOKUP_RETRIES;
19831989 u32 value_size, cp, max_count;
1990+ int err;
19841991
19851992 if (attr->batch.elem_flags & ~BPF_F_LOCK)
19861993 return -EINVAL;
@@ -2026,14 +2033,8 @@ int generic_map_lookup_batch(struct bpf_map *map, · 39 unmodified lines
20262033 err = bpf_map_copy_value(map, key, value,
20272034 attr->batch.elem_flags);
20282035
2029− if (err == -ENOENT) {
2030− if (retry) {
2031− retry--;
2032− continue;
2033− }
2034− err = -EINTR;
2035− break;
2036− }
2036+ if (err == -ENOENT)
2037+ goto next_key;
20372038
20382039 if (err)
20392040 goto free_buf;
@@ -2048,12 +2049,12 @@ int generic_map_lookup_batch(struct bpf_map *map, · 8 unmodified lines
20482049 goto free_buf;
20492050 }
20502051
2052+ cp++;
2053+next_key:
20512054 if (!prev_key)
20522055 prev_key = buf_prevkey;
20532056
20542057 swap(prev_key, key);
2055− retry = MAP_LOOKUP_RETRIES;
2056− cp++;
20572058 cond_resched();
20582059 }
20592060
kernel/bpf/verifier.c+23−8
@@ -1501,6 +1501,8 @@ static int acquire_lock_state(struct bpf_verifier_env *env, int insn_idx, enum r · 1500 unmodified lines
15011501 struct bpf_reference_state *s;
15021502
15031503 s = acquire_reference_state(env, insn_idx);
1504+ if (!s)
1505+ return -ENOMEM;
15041506 s->type = type;
15051507 s->id = id;
15061508 s->ptr = ptr;
@@ -9230,10 +9232,11 @@ static int check_reg_const_str(struct bpf_verifier_env *env, · 7723 unmodified lines
92309232 return 0;
92319233 }
92329234
9233−/* Returns constant key value if possible, else negative error */
9234−static s64 get_constant_map_key(struct bpf_verifier_env *env,
9235+/* Returns constant key value in `value` if possible, else negative error */
9236+static int get_constant_map_key(struct bpf_verifier_env *env,
92359237 struct bpf_reg_state *key,
9236− u32 key_size)
9238+ u32 key_size,
9239+ s64 *value)
92379240 {
92389241 struct bpf_func_state *state = func(env, key);
92399242 struct bpf_reg_state *reg;
@@ -9260,8 +9263,10 @@ static s64 get_constant_map_key(struct bpf_verifier_env *env, · 20 unmodified lines
92609263 /* First handle precisely tracked STACK_ZERO */
92619264 for (i = off; i >= 0 && stype[i] == STACK_ZERO; i--)
92629265 zero_size++;
9263− if (zero_size >= key_size)
9266+ if (zero_size >= key_size) {
9267+ *value = 0;
92649268 return 0;
9269+ }
92659270
92669271 /* Check that stack contains a scalar spill of expected size */
92679272 if (!is_spilled_scalar_reg(&state->stack[spi]))
@@ -9284,9 +9289,12 @@ static s64 get_constant_map_key(struct bpf_verifier_env *env, · 16 unmodified lines
92849289 if (err < 0)
92859290 return err;
92869291
9287− return reg->var_off.value;
9292+ *value = reg->var_off.value;
9293+ return 0;
92889294 }
92899295
9296+static bool can_elide_value_nullness(enum bpf_map_type type);
9297+
92909298 static int check_func_arg(struct bpf_verifier_env *env, u32 arg,
92919299 struct bpf_call_arg_meta *meta,
92929300 const struct bpf_func_proto *fn,
@@ -9435,9 +9443,16 @@ skip_type_check: · 142 unmodified lines
94359443 err = check_helper_mem_access(env, regno, key_size, BPF_READ, false, NULL);
94369444 if (err)
94379445 return err;
9438− meta->const_map_key = get_constant_map_key(env, reg, key_size);
9439− if (meta->const_map_key < 0 && meta->const_map_key != -EOPNOTSUPP)
9440− return meta->const_map_key;
9446+ if (can_elide_value_nullness(meta->map_ptr->map_type)) {
9447+ err = get_constant_map_key(env, reg, key_size, &meta->const_map_key);
9448+ if (err < 0) {
9449+ meta->const_map_key = -1;
9450+ if (err == -EOPNOTSUPP)
9451+ err = 0;
9452+ else
9453+ return err;
9454+ }
9455+ }
94419456 break;
94429457 case ARG_PTR_TO_MAP_VALUE:
94439458 if (type_may_be_null(arg_type) && register_is_null(reg))
kernel/cgroup/cgroup.c+12−8
@@ -4013,7 +4013,7 @@ static void __cgroup_kill(struct cgroup *cgrp) · 4012 unmodified lines
40134013 lockdep_assert_held(&cgroup_mutex);
40144014
40154015 spin_lock_irq(&css_set_lock);
4016− set_bit(CGRP_KILL, &cgrp->flags);
4016+ cgrp->kill_seq++;
40174017 spin_unlock_irq(&css_set_lock);
40184018
40194019 css_task_iter_start(&cgrp->self, CSS_TASK_ITER_PROCS | CSS_TASK_ITER_THREADED, &it);
@@ -4029,10 +4029,6 @@ static void __cgroup_kill(struct cgroup *cgrp) · 9 unmodified lines
40294029 send_sig(SIGKILL, task, 0);
40304030 }
40314031 css_task_iter_end(&it);
4032−
4033− spin_lock_irq(&css_set_lock);
4034− clear_bit(CGRP_KILL, &cgrp->flags);
4035− spin_unlock_irq(&css_set_lock);
40364032 }
40374033
40384034 static void cgroup_kill(struct cgroup *cgrp)
@@ -6488,6 +6484,10 @@ static int cgroup_css_set_fork(struct kernel_clone_args *kargs) · 2449 unmodified lines
64886484 spin_lock_irq(&css_set_lock);
64896485 cset = task_css_set(current);
64906486 get_css_set(cset);
6487+ if (kargs->cgrp)
6488+ kargs->kill_seq = kargs->cgrp->kill_seq;
6489+ else
6490+ kargs->kill_seq = cset->dfl_cgrp->kill_seq;
64916491 spin_unlock_irq(&css_set_lock);
64926492
64936493 if (!(kargs->flags & CLONE_INTO_CGROUP)) {
@@ -6668,6 +6668,7 @@ void cgroup_post_fork(struct task_struct *child, · 174 unmodified lines
66686668 struct kernel_clone_args *kargs)
66696669 __releases(&cgroup_threadgroup_rwsem) __releases(&cgroup_mutex)
66706670 {
6671+ unsigned int cgrp_kill_seq = 0;
66716672 unsigned long cgrp_flags = 0;
66726673 bool kill = false;
66736674 struct cgroup_subsys *ss;
@@ -6681,10 +6682,13 @@ void cgroup_post_fork(struct task_struct *child, · 7 unmodified lines
66816682
66826683 /* init tasks are special, only link regular threads */
66836684 if (likely(child->pid)) {
6684− if (kargs->cgrp)
6685+ if (kargs->cgrp) {
66856686 cgrp_flags = kargs->cgrp->flags;
6686− else
6687+ cgrp_kill_seq = kargs->cgrp->kill_seq;
6688+ } else {
66876689 cgrp_flags = cset->dfl_cgrp->flags;
6690+ cgrp_kill_seq = cset->dfl_cgrp->kill_seq;
6691+ }
66886692
66896693 WARN_ON_ONCE(!list_empty(&child->cg_list));
66906694 cset->nr_tasks++;
@@ -6719,7 +6723,7 @@ void cgroup_post_fork(struct task_struct *child, · 28 unmodified lines
67196723 * child down right after we finished preparing it for
67206724 * userspace.
67216725 */
6722− kill = test_bit(CGRP_KILL, &cgrp_flags);
6726+ kill = kargs->kill_seq != cgrp_kill_seq;
67236727 }
67246728
67256729 spin_unlock_irq(&css_set_lock);
kernel/cgroup/rstat.c+0−1
@@ -590,7 +590,6 @@ static void root_cgroup_cputime(struct cgroup_base_stat *bstat) · 589 unmodified lines
590590
591591 cputime->sum_exec_runtime += user;
592592 cputime->sum_exec_runtime += sys;
593− cputime->sum_exec_runtime += cpustat[CPUTIME_STEAL];
594593
595594 #ifdef CONFIG_SCHED_CORE
596595 bstat->forceidle_sum += cpustat[CPUTIME_FORCEIDLE];
kernel/futex/core.c+3−2
@@ -532,7 +532,8 @@ void futex_q_unlock(struct futex_hash_bucket *hb) · 531 unmodified lines
532532 futex_hb_waiters_dec(hb);
533533 }
534534
535−void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb)
535+void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb,
536+ struct task_struct *task)
536537 {
537538 int prio;
538539
@@ -548,7 +549,7 @@ void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb) · 9 unmodified lines
548549
549550 plist_node_init(&q->list, prio);
550551 plist_add(&q->list, &hb->chain);
551− q->task = current;
552+ q->task = task;
552553 }
553554
554555 /**
kernel/futex/futex.h+8−3
@@ -285,13 +285,15 @@ static inline int futex_get_value_locked(u32 *dest, u32 __user *from) · 284 unmodified lines
285285 }
286286
287287 extern void __futex_unqueue(struct futex_q *q);
288−extern void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb);
288+extern void __futex_queue(struct futex_q *q, struct futex_hash_bucket *hb,
289+ struct task_struct *task);
289290 extern int futex_unqueue(struct futex_q *q);
290291
291292 /**
292293 * futex_queue() - Enqueue the futex_q on the futex_hash_bucket
293294 * @q: The futex_q to enqueue
294295 * @hb: The destination hash bucket
296+ * @task: Task queueing this futex
295297 *
296298 * The hb->lock must be held by the caller, and is released here. A call to
297299 * futex_queue() is typically paired with exactly one call to futex_unqueue(). The
@@ -299,11 +301,14 @@ extern int futex_unqueue(struct futex_q *q); · 1 unmodified line
299301 * or nothing if the unqueue is done as part of the wake process and the unqueue
300302 * state is implicit in the state of woken task (see futex_wait_requeue_pi() for
301303 * an example).
304+ *
305+ * Note that @task may be NULL, for async usage of futexes.
302306 */
303−static inline void futex_queue(struct futex_q *q, struct futex_hash_bucket *hb)
307+static inline void futex_queue(struct futex_q *q, struct futex_hash_bucket *hb,
308+ struct task_struct *task)
304309 __releases(&hb->lock)
305310 {
306− __futex_queue(q, hb);
311+ __futex_queue(q, hb, task);
307312 spin_unlock(&hb->lock);
308313 }
309314
kernel/futex/pi.c+1−1
@@ -982,7 +982,7 @@ retry_private: · 981 unmodified lines
982982 /*
983983 * Only actually queue now that the atomic ops are done:
984984 */
985− __futex_queue(&q, hb);
985+ __futex_queue(&q, hb, current);
986986
987987 if (trylock) {
988988 ret = rt_mutex_futex_trylock(&q.pi_state->pi_mutex);
kernel/futex/waitwake.c+2−2
@@ -349,7 +349,7 @@ void futex_wait_queue(struct futex_hash_bucket *hb, struct futex_q *q, · 348 unmodified lines
349349 * access to the hash list and forcing another memory barrier.
350350 */
351351 set_current_state(TASK_INTERRUPTIBLE|TASK_FREEZABLE);
352− futex_queue(q, hb);
352+ futex_queue(q, hb, current);
353353
354354 /* Arm the timer */
355355 if (timeout)
@@ -460,7 +460,7 @@ retry: · 104 unmodified lines
460460 * next futex. Queue each futex at this moment so hb can
461461 * be unlocked.
462462 */
463− futex_queue(q, hb);
463+ futex_queue(q, hb, current);
464464 continue;
465465 }
466466
kernel/irq/Kconfig+0−4
@@ -31,10 +31,6 @@ config GENERIC_IRQ_EFFECTIVE_AFF_MASK · 30 unmodified lines
3131 config GENERIC_PENDING_IRQ
3232 bool
3333
34−# Deduce delayed migration from top-level interrupt chip flags
35−config GENERIC_PENDING_IRQ_CHIPFLAGS
36− bool
37−
3834 # Support for generic irq migrating off cpu before the cpu is offline.
3935 config GENERIC_IRQ_MIGRATION
4036 bool
kernel/kthread.c+2−2
@@ -859,7 +859,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask) · 858 unmodified lines
859859 struct kthread *kthread = to_kthread(p);
860860 cpumask_var_t affinity;
861861 unsigned long flags;
862− int ret;
862+ int ret = 0;
863863
864864 if (!wait_task_inactive(p, TASK_UNINTERRUPTIBLE) || kthread->started) {
865865 WARN_ON(1);
@@ -892,7 +892,7 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask) · 26 unmodified lines
892892 out:
893893 free_cpumask_var(affinity);
894894
895− return 0;
895+ return ret;
896896 }
897897
898898 /*
kernel/sched/autogroup.c+2−2
@@ -150,7 +150,7 @@ void sched_autogroup_exit_task(struct task_struct *p) · 149 unmodified lines
150150 * see this thread after that: we can no longer use signal->autogroup.
151151 * See the PF_EXITING check in task_wants_autogroup().
152152 */
153− sched_move_task(p);
153+ sched_move_task(p, true);
154154 }
155155
156156 static void
@@ -182,7 +182,7 @@ autogroup_move_group(struct task_struct *p, struct autogroup *ag) · 25 unmodified lines
182182 * sched_autogroup_exit_task().
183183 */
184184 for_each_thread(p, t)
185− sched_move_task(t);
185+ sched_move_task(t, true);
186186
187187 unlock_task_sighand(p, &flags);
188188 autogroup_kref_put(prev);
kernel/sched/core.c+7−5
@@ -1063,9 +1063,10 @@ void wake_up_q(struct wake_q_head *head) · 1062 unmodified lines
10631063 struct task_struct *task;
10641064
10651065 task = container_of(node, struct task_struct, wake_q);
1066− /* Task can safely be re-inserted now: */
10671066 node = node->next;
1068− task->wake_q.next = NULL;
1067+ /* pairs with cmpxchg_relaxed() in __wake_q_add() */
1068+ WRITE_ONCE(task->wake_q.next, NULL);
1069+ /* Task can safely be re-inserted now. */
10691070
10701071 /*
10711072 * wake_up_process() executes a full barrier, which pairs with
@@ -9050,7 +9051,7 @@ static void sched_change_group(struct task_struct *tsk, struct task_group *group · 7978 unmodified lines
90509051 * now. This function just updates tsk->se.cfs_rq and tsk->se.parent to reflect
90519052 * its new group.
90529053 */
9053−void sched_move_task(struct task_struct *tsk)
9054+void sched_move_task(struct task_struct *tsk, bool for_autogroup)
90549055 {
90559056 int queued, running, queue_flags =
90569057 DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK;
@@ -9079,7 +9080,8 @@ void sched_move_task(struct task_struct *tsk) · 22 unmodified lines
90799080 put_prev_task(rq, tsk);
90809081
90819082 sched_change_group(tsk, group);
9082− scx_move_task(tsk);
9083+ if (!for_autogroup)
9084+ scx_cgroup_move_task(tsk);
90839085
90849086 if (queued)
90859087 enqueue_task(rq, tsk, queue_flags);
@@ -9180,7 +9182,7 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset) · 94 unmodified lines
91809182 struct cgroup_subsys_state *css;
91819183
91829184 cgroup_taskset_for_each(task, css, tset)
9183− sched_move_task(task);
9185+ sched_move_task(task, false);
91849186
91859187 scx_cgroup_finish_attach();
91869188 }
kernel/sched/debug.c+2−0
@@ -1262,6 +1262,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns, · 1261 unmodified lines
12621262 if (task_has_dl_policy(p)) {
12631263 P(dl.runtime);
12641264 P(dl.deadline);
1265+ } else if (fair_policy(p->policy)) {
1266+ P(se.slice);
12651267 }
12661268 #ifdef CONFIG_SCHED_CLASS_EXT
12671269 __PS("ext.enabled", task_on_scx(p));
kernel/sched/ext.c+76−37
@@ -122,6 +122,19 @@ enum scx_ops_flags { · 121 unmodified lines
122122 */
123123 SCX_OPS_SWITCH_PARTIAL = 1LLU << 3,
124124
125+ /*
126+ * A migration disabled task can only execute on its current CPU. By
127+ * default, such tasks are automatically put on the CPU's local DSQ with
128+ * the default slice on enqueue. If this ops flag is set, they also go
129+ * through ops.enqueue().
130+ *
131+ * A migration disabled task never invokes ops.select_cpu() as it can
132+ * only select the current CPU. Also, p->cpus_ptr will only contain its
133+ * current CPU while p->nr_cpus_allowed keeps tracking p->user_cpus_ptr
134+ * and thus may disagree with cpumask_weight(p->cpus_ptr).
135+ */
136+ SCX_OPS_ENQ_MIGRATION_DISABLED = 1LLU << 4,
137+
125138 /*
126139 * CPU cgroup support flags
127140 */
@@ -130,6 +143,7 @@ enum scx_ops_flags { · 2 unmodified lines
130143 SCX_OPS_ALL_FLAGS = SCX_OPS_KEEP_BUILTIN_IDLE |
131144 SCX_OPS_ENQ_LAST |
132145 SCX_OPS_ENQ_EXITING |
146+ SCX_OPS_ENQ_MIGRATION_DISABLED |
133147 SCX_OPS_SWITCH_PARTIAL |
134148 SCX_OPS_HAS_CGROUP_WEIGHT,
135149 };
@@ -416,7 +430,7 @@ struct sched_ext_ops { · 280 unmodified lines
416430
417431 /**
418432 * @update_idle: Update the idle state of a CPU
419− * @cpu: CPU to udpate the idle state for
433+ * @cpu: CPU to update the idle state for
420434 * @idle: whether entering or exiting the idle state
421435 *
422436 * This operation is called when @rq's CPU goes or leaves the idle
@@ -882,6 +896,7 @@ static bool scx_warned_zero_slice; · 459 unmodified lines
882896
883897 static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_last);
884898 static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_exiting);
899+static DEFINE_STATIC_KEY_FALSE(scx_ops_enq_migration_disabled);
885900 static DEFINE_STATIC_KEY_FALSE(scx_ops_cpu_preempt);
886901 static DEFINE_STATIC_KEY_FALSE(scx_builtin_idle_enabled);
887902
@@ -1214,7 +1229,7 @@ static bool scx_kf_allowed_if_unlocked(void) · 326 unmodified lines
12141229
12151230 /**
12161231 * nldsq_next_task - Iterate to the next task in a non-local DSQ
1217− * @dsq: user dsq being interated
1232+ * @dsq: user dsq being iterated
12181233 * @cur: current position, %NULL to start iteration
12191234 * @rev: walk backwards
12201235 *
@@ -2014,6 +2029,11 @@ static void do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags, · 793 unmodified lines
20142029 unlikely(p->flags & PF_EXITING))
20152030 goto local;
20162031
2032+ /* see %SCX_OPS_ENQ_MIGRATION_DISABLED */
2033+ if (!static_branch_unlikely(&scx_ops_enq_migration_disabled) &&
2034+ is_migration_disabled(p))
2035+ goto local;
2036+
20172037 if (!SCX_HAS_OP(enqueue))
20182038 goto global;
20192039
@@ -2078,7 +2098,7 @@ static void set_task_runnable(struct rq *rq, struct task_struct *p) · 58 unmodified lines
20782098
20792099 /*
20802100 * list_add_tail() must be used. scx_ops_bypass() depends on tasks being
2081− * appened to the runnable_list.
2101+ * appended to the runnable_list.
20822102 */
20832103 list_add_tail(&p->scx.runnable_node, &rq->scx.runnable_list);
20842104 }
@@ -2313,12 +2333,35 @@ static void move_remote_task_to_local_dsq(struct task_struct *p, u64 enq_flags, · 228 unmodified lines
23132333 *
23142334 * - The BPF scheduler is bypassed while the rq is offline and we can always say
23152335 * no to the BPF scheduler initiated migrations while offline.
2336+ *
2337+ * The caller must ensure that @p and @rq are on different CPUs.
23162338 */
23172339 static bool task_can_run_on_remote_rq(struct task_struct *p, struct rq *rq,
23182340 bool trigger_error)
23192341 {
23202342 int cpu = cpu_of(rq);
23212343
2344+ SCHED_WARN_ON(task_cpu(p) == cpu);
2345+
2346+ /*
2347+ * If @p has migration disabled, @p->cpus_ptr is updated to contain only
2348+ * the pinned CPU in migrate_disable_switch() while @p is being switched
2349+ * out. However, put_prev_task_scx() is called before @p->cpus_ptr is
2350+ * updated and thus another CPU may see @p on a DSQ inbetween leading to
2351+ * @p passing the below task_allowed_on_cpu() check while migration is
2352+ * disabled.
2353+ *
2354+ * Test the migration disabled state first as the race window is narrow
2355+ * and the BPF scheduler failing to check migration disabled state can
2356+ * easily be masked if task_allowed_on_cpu() is done first.
2357+ */
2358+ if (unlikely(is_migration_disabled(p))) {
2359+ if (trigger_error)
2360+ scx_ops_error("SCX_DSQ_LOCAL[_ON] cannot move migration disabled %s[%d] from CPU %d to %d",
2361+ p->comm, p->pid, task_cpu(p), cpu);
2362+ return false;
2363+ }
2364+
23222365 /*
23232366 * We don't require the BPF scheduler to avoid dispatching to offline
23242367 * CPUs mostly for convenience but also because CPUs can go offline
@@ -2327,14 +2370,11 @@ static bool task_can_run_on_remote_rq(struct task_struct *p, struct rq *rq, · 2 unmodified lines
23272370 */
23282371 if (!task_allowed_on_cpu(p, cpu)) {
23292372 if (trigger_error)
2330− scx_ops_error("SCX_DSQ_LOCAL[_ON] verdict target cpu %d not allowed for %s[%d]",
2331− cpu_of(rq), p->comm, p->pid);
2373+ scx_ops_error("SCX_DSQ_LOCAL[_ON] target CPU %d not allowed for %s[%d]",
2374+ cpu, p->comm, p->pid);
23322375 return false;
23332376 }
23342377
2335− if (unlikely(is_migration_disabled(p)))
2336− return false;
2337−
23382378 if (!scx_rq_online(rq))
23392379 return false;
23402380
@@ -2437,7 +2477,8 @@ static struct rq *move_task_between_dsqs(struct task_struct *p, u64 enq_flags, · 96 unmodified lines
24372477
24382478 if (dst_dsq->id == SCX_DSQ_LOCAL) {
24392479 dst_rq = container_of(dst_dsq, struct rq, scx.local_dsq);
2440− if (!task_can_run_on_remote_rq(p, dst_rq, true)) {
2480+ if (src_rq != dst_rq &&
2481+ unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {
24412482 dst_dsq = find_global_dsq(p);
24422483 dst_rq = src_rq;
24432484 }
@@ -2480,7 +2521,7 @@ static struct rq *move_task_between_dsqs(struct task_struct *p, u64 enq_flags, · 36 unmodified lines
24802521 /*
24812522 * A poorly behaving BPF scheduler can live-lock the system by e.g. incessantly
24822523 * banging on the same DSQ on a large NUMA system to the point where switching
2483− * to the bypass mode can take a long time. Inject artifical delays while the
2524+ * to the bypass mode can take a long time. Inject artificial delays while the
24842525 * bypass mode is switching to guarantee timely completion.
24852526 */
24862527 static void scx_ops_breather(struct rq *rq)
@@ -2575,6 +2616,9 @@ static void dispatch_to_local_dsq(struct rq *rq, struct scx_dispatch_q *dst_dsq, · 88 unmodified lines
25752616 {
25762617 struct rq *src_rq = task_rq(p);
25772618 struct rq *dst_rq = container_of(dst_dsq, struct rq, scx.local_dsq);
2619+#ifdef CONFIG_SMP
2620+ struct rq *locked_rq = rq;
2621+#endif
25782622
25792623 /*
25802624 * We're synchronized against dequeue through DISPATCHING. As @p can't
@@ -2588,7 +2632,8 @@ static void dispatch_to_local_dsq(struct rq *rq, struct scx_dispatch_q *dst_dsq, · 7 unmodified lines
25882632 }
25892633
25902634 #ifdef CONFIG_SMP
2591− if (unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {
2635+ if (src_rq != dst_rq &&
2636+ unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {
25922637 dispatch_enqueue(find_global_dsq(p), p,
25932638 enq_flags | SCX_ENQ_CLEAR_OPSS);
25942639 return;
@@ -2611,8 +2656,9 @@ static void dispatch_to_local_dsq(struct rq *rq, struct scx_dispatch_q *dst_dsq, · 16 unmodified lines
26112656 atomic_long_set_release(&p->scx.ops_state, SCX_OPSS_NONE);
26122657
26132658 /* switch to @src_rq lock */
2614− if (rq != src_rq) {
2615− raw_spin_rq_unlock(rq);
2659+ if (locked_rq != src_rq) {
2660+ raw_spin_rq_unlock(locked_rq);
2661+ locked_rq = src_rq;
26162662 raw_spin_rq_lock(src_rq);
26172663 }
26182664
@@ -2630,6 +2676,8 @@ static void dispatch_to_local_dsq(struct rq *rq, struct scx_dispatch_q *dst_dsq, · 11 unmodified lines
26302676 } else {
26312677 move_remote_task_to_local_dsq(p, enq_flags,
26322678 src_rq, dst_rq);
2679+ /* task has been moved to dst_rq, which is now locked */
2680+ locked_rq = dst_rq;
26332681 }
26342682
26352683 /* if the destination CPU is idle, wake it up */
@@ -2638,8 +2686,8 @@ static void dispatch_to_local_dsq(struct rq *rq, struct scx_dispatch_q *dst_dsq, · 2 unmodified lines
26382686 }
26392687
26402688 /* switch back to @rq lock */
2641− if (rq != dst_rq) {
2642− raw_spin_rq_unlock(dst_rq);
2689+ if (locked_rq != rq) {
2690+ raw_spin_rq_unlock(locked_rq);
26432691 raw_spin_rq_lock(rq);
26442692 }
26452693 #else /* CONFIG_SMP */
@@ -3144,7 +3192,7 @@ static struct task_struct *pick_task_scx(struct rq *rq) · 498 unmodified lines
31443192 *
31453193 * Unless overridden by ops.core_sched_before(), @p->scx.core_sched_at is used
31463194 * to implement the default task ordering. The older the timestamp, the higher
3147− * prority the task - the global FIFO ordering matching the default scheduling
3195+ * priority the task - the global FIFO ordering matching the default scheduling
31483196 * behavior.
31493197 *
31503198 * When ops.core_sched_before() is enabled, @p->scx.core_sched_at is used to
@@ -3851,7 +3899,7 @@ static void task_tick_scx(struct rq *rq, struct task_struct *curr, int queued) · 700 unmodified lines
38513899 curr->scx.slice = 0;
38523900 touch_core_sched(rq, curr);
38533901 } else if (SCX_HAS_OP(tick)) {
3854− SCX_CALL_OP(SCX_KF_REST, tick, curr);
3902+ SCX_CALL_OP_TASK(SCX_KF_REST, tick, curr);
38553903 }
38563904
38573905 if (!curr->scx.slice)
@@ -3998,7 +4046,7 @@ static void scx_ops_disable_task(struct task_struct *p) · 140 unmodified lines
39984046 WARN_ON_ONCE(scx_get_task_state(p) != SCX_TASK_ENABLED);
39994047
40004048 if (SCX_HAS_OP(disable))
4001− SCX_CALL_OP(SCX_KF_REST, disable, p);
4049+ SCX_CALL_OP_TASK(SCX_KF_REST, disable, p);
40024050 scx_set_task_state(p, SCX_TASK_READY);
40034051 }
40044052
@@ -4027,7 +4075,7 @@ static void scx_ops_exit_task(struct task_struct *p) · 22 unmodified lines
40274075 }
40284076
40294077 if (SCX_HAS_OP(exit_task))
4030− SCX_CALL_OP(SCX_KF_REST, exit_task, p, &args);
4078+ SCX_CALL_OP_TASK(SCX_KF_REST, exit_task, p, &args);
40314079 scx_set_task_state(p, SCX_TASK_NONE);
40324080 }
40334081
@@ -4323,24 +4371,11 @@ err: · 289 unmodified lines
43234371 return ops_sanitize_err("cgroup_prep_move", ret);
43244372 }
43254373
4326−void scx_move_task(struct task_struct *p)
4374+void scx_cgroup_move_task(struct task_struct *p)
43274375 {
43284376 if (!scx_cgroup_enabled)
43294377 return;
43304378
4331− /*
4332− * We're called from sched_move_task() which handles both cgroup and
4333− * autogroup moves. Ignore the latter.
4334− *
4335− * Also ignore exiting tasks, because in the exit path tasks transition
4336− * from the autogroup to the root group, so task_group_is_autogroup()
4337− * alone isn't able to catch exiting autogroup tasks. This is safe for
4338− * cgroup_move(), because cgroup migrations never happen for PF_EXITING
4339− * tasks.
4340− */
4341− if (task_group_is_autogroup(task_group(p)) || (p->flags & PF_EXITING))
4342− return;
4343−
43444379 /*
43454380 * @p must have ops.cgroup_prep_move() called on it and thus
43464381 * cgrp_moving_from set.
@@ -4590,7 +4625,7 @@ static int scx_cgroup_init(void) · 243 unmodified lines
45904625 cgroup_warned_missing_idle = false;
45914626
45924627 /*
4593− * scx_tg_on/offline() are excluded thorugh scx_cgroup_rwsem. If we walk
4628+ * scx_tg_on/offline() are excluded through scx_cgroup_rwsem. If we walk
45944629 * cgroups and init, all online cgroups are initialized.
45954630 */
45964631 rcu_read_lock();
@@ -5059,6 +5094,7 @@ static void scx_ops_disable_workfn(struct kthread_work *work) · 462 unmodified lines
50595094 static_branch_disable(&scx_has_op[i]);
50605095 static_branch_disable(&scx_ops_enq_last);
50615096 static_branch_disable(&scx_ops_enq_exiting);
5097+ static_branch_disable(&scx_ops_enq_migration_disabled);
50625098 static_branch_disable(&scx_ops_cpu_preempt);
50635099 static_branch_disable(&scx_builtin_idle_enabled);
50645100 synchronize_rcu();
@@ -5277,9 +5313,10 @@ static void scx_dump_task(struct seq_buf *s, struct scx_dump_ctx *dctx, · 212 unmodified lines
52775313 scx_get_task_state(p), p->scx.flags & ~SCX_TASK_STATE_MASK,
52785314 p->scx.dsq_flags, ops_state & SCX_OPSS_STATE_MASK,
52795315 ops_state >> SCX_OPSS_QSEQ_SHIFT);
5280− dump_line(s, " sticky/holding_cpu=%d/%d dsq_id=%s dsq_vtime=%llu slice=%llu",
5281− p->scx.sticky_cpu, p->scx.holding_cpu, dsq_id_buf,
5282− p->scx.dsq_vtime, p->scx.slice);
5316+ dump_line(s, " sticky/holding_cpu=%d/%d dsq_id=%s",
5317+ p->scx.sticky_cpu, p->scx.holding_cpu, dsq_id_buf);
5318+ dump_line(s, " dsq_vtime=%llu slice=%llu weight=%u",
5319+ p->scx.dsq_vtime, p->scx.slice, p->scx.weight);
52835320 dump_line(s, " cpus=%*pb", cpumask_pr_args(p->cpus_ptr));
52845321
52855322 if (SCX_HAS_OP(dump_task)) {
@@ -5667,6 +5704,8 @@ static int scx_ops_enable(struct sched_ext_ops *ops, struct bpf_link *link) · 381 unmodified lines
56675704
56685705 if (ops->flags & SCX_OPS_ENQ_EXITING)
56695706 static_branch_enable(&scx_ops_enq_exiting);
5707+ if (ops->flags & SCX_OPS_ENQ_MIGRATION_DISABLED)
5708+ static_branch_enable(&scx_ops_enq_migration_disabled);
56705709 if (scx_ops.cpu_acquire || scx_ops.cpu_release)
56715710 static_branch_enable(&scx_ops_cpu_preempt);
56725711
kernel/sched/ext.h+2−2
@@ -73,7 +73,7 @@ static inline void scx_update_idle(struct rq *rq, bool idle, bool do_notify) {} · 72 unmodified lines
7373 int scx_tg_online(struct task_group *tg);
7474 void scx_tg_offline(struct task_group *tg);
7575 int scx_cgroup_can_attach(struct cgroup_taskset *tset);
76−void scx_move_task(struct task_struct *p);
76+void scx_cgroup_move_task(struct task_struct *p);
7777 void scx_cgroup_finish_attach(void);
7878 void scx_cgroup_cancel_attach(struct cgroup_taskset *tset);
7979 void scx_group_set_weight(struct task_group *tg, unsigned long cgrp_weight);
@@ -82,7 +82,7 @@ void scx_group_set_idle(struct task_group *tg, bool idle); · 2 unmodified lines
8282 static inline int scx_tg_online(struct task_group *tg) { return 0; }
8383 static inline void scx_tg_offline(struct task_group *tg) {}
8484 static inline int scx_cgroup_can_attach(struct cgroup_taskset *tset) { return 0; }
85−static inline void scx_move_task(struct task_struct *p) {}
85+static inline void scx_cgroup_move_task(struct task_struct *p) {}
8686 static inline void scx_cgroup_finish_attach(void) {}
8787 static inline void scx_cgroup_cancel_attach(struct cgroup_taskset *tset) {}
8888 static inline void scx_group_set_weight(struct task_group *tg, unsigned long cgrp_weight) {}
kernel/sched/fair.c+19−0
@@ -5385,6 +5385,15 @@ static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq); · 5384 unmodified lines
53855385 static void set_delayed(struct sched_entity *se)
53865386 {
53875387 se->sched_delayed = 1;
5388+
5389+ /*
5390+ * Delayed se of cfs_rq have no tasks queued on them.
5391+ * Do not adjust h_nr_runnable since dequeue_entities()
5392+ * will account it for blocked tasks.
5393+ */
5394+ if (!entity_is_task(se))
5395+ return;
5396+
53885397 for_each_sched_entity(se) {
53895398 struct cfs_rq *cfs_rq = cfs_rq_of(se);
53905399
@@ -5397,6 +5406,16 @@ static void set_delayed(struct sched_entity *se) · 6 unmodified lines
53975406 static void clear_delayed(struct sched_entity *se)
53985407 {
53995408 se->sched_delayed = 0;
5409+
5410+ /*
5411+ * Delayed se of cfs_rq have no tasks queued on them.
5412+ * Do not adjust h_nr_runnable since a dequeue has
5413+ * already accounted for it or an enqueue of a task
5414+ * below it will account for it in enqueue_task_fair().
5415+ */
5416+ if (!entity_is_task(se))
5417+ return;
5418+
54005419 for_each_sched_entity(se) {
54015420 struct cfs_rq *cfs_rq = cfs_rq_of(se);
54025421
kernel/sched/sched.h+1−1
@@ -572,7 +572,7 @@ extern void sched_online_group(struct task_group *tg, · 571 unmodified lines
572572 extern void sched_destroy_group(struct task_group *tg);
573573 extern void sched_release_group(struct task_group *tg);
574574
575−extern void sched_move_task(struct task_struct *tsk);
575+extern void sched_move_task(struct task_struct *tsk, bool for_autogroup);
576576
577577 #ifdef CONFIG_FAIR_GROUP_SCHED
578578 extern int sched_group_set_shares(struct task_group *tg, unsigned long shares);
kernel/seccomp.c+12−0
@@ -749,6 +749,15 @@ static bool seccomp_is_const_allow(struct sock_fprog_kern *fprog, · 748 unmodified lines
749749 if (WARN_ON_ONCE(!fprog))
750750 return false;
751751
752+ /* Our single exception to filtering. */
753+#ifdef __NR_uretprobe
754+#ifdef SECCOMP_ARCH_COMPAT
755+ if (sd->arch == SECCOMP_ARCH_NATIVE)
756+#endif
757+ if (sd->nr == __NR_uretprobe)
758+ return true;
759+#endif
760+
752761 for (pc = 0; pc < fprog->len; pc++) {
753762 struct sock_filter *insn = &fprog->filter[pc];
754763 u16 code = insn->code;
@@ -1023,6 +1032,9 @@ static inline void seccomp_log(unsigned long syscall, long signr, u32 action, · 268 unmodified lines
10231032 */
10241033 static const int mode1_syscalls[] = {
10251034 __NR_seccomp_read, __NR_seccomp_write, __NR_seccomp_exit, __NR_seccomp_sigreturn,
1035+#ifdef __NR_uretprobe
1036+ __NR_uretprobe,
1037+#endif
10261038 -1, /* negative terminated */
10271039 };
10281040
kernel/time/clocksource.c+6−3
@@ -373,16 +373,18 @@ void clocksource_verify_percpu(struct clocksource *cs) · 372 unmodified lines
373373 cpumask_clear(&cpus_ahead);
374374 cpumask_clear(&cpus_behind);
375375 cpus_read_lock();
376− preempt_disable();
376+ migrate_disable();
377377 clocksource_verify_choose_cpus();
378378 if (cpumask_empty(&cpus_chosen)) {
379− preempt_enable();
379+ migrate_enable();
380380 cpus_read_unlock();
381381 pr_warn("Not enough CPUs to check clocksource '%s'.\n", cs->name);
382382 return;
383383 }
384384 testcpu = smp_processor_id();
385− pr_warn("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n", cs->name, testcpu, cpumask_pr_args(&cpus_chosen));
385+ pr_info("Checking clocksource %s synchronization from CPU %d to CPUs %*pbl.\n",
386+ cs->name, testcpu, cpumask_pr_args(&cpus_chosen));
387+ preempt_disable();
386388 for_each_cpu(cpu, &cpus_chosen) {
387389 if (cpu == testcpu)
388390 continue;
@@ -402,6 +404,7 @@ void clocksource_verify_percpu(struct clocksource *cs) · 13 unmodified lines
402404 cs_nsec_min = cs_nsec;
403405 }
404406 preempt_enable();
407+ migrate_enable();
405408 cpus_read_unlock();
406409 if (!cpumask_empty(&cpus_ahead))
407410 pr_warn(" CPUs %*pbl ahead of CPU %d for clocksource %s.\n",
kernel/time/hrtimer.c+94−31
@@ -58,6 +58,8 @@ · 57 unmodified lines
5858 #define HRTIMER_ACTIVE_SOFT (HRTIMER_ACTIVE_HARD << MASK_SHIFT)
5959 #define HRTIMER_ACTIVE_ALL (HRTIMER_ACTIVE_SOFT | HRTIMER_ACTIVE_HARD)
6060
61+static void retrigger_next_event(void *arg);
62+
6163 /*
6264 * The timer bases:
6365 *
@@ -111,7 +113,8 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) = · 47 unmodified lines
111113 .clockid = CLOCK_TAI,
112114 .get_time = &ktime_get_clocktai,
113115 },
114− }
116+ },
117+ .csd = CSD_INIT(retrigger_next_event, NULL)
115118 };
116119
117120 static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {
@@ -124,6 +127,14 @@ static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = { · 6 unmodified lines
124127 [CLOCK_TAI] = HRTIMER_BASE_TAI,
125128 };
126129
130+static inline bool hrtimer_base_is_online(struct hrtimer_cpu_base *base)
131+{
132+ if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
133+ return true;
134+ else
135+ return likely(base->online);
136+}
137+
127138 /*
128139 * Functions and macros which are different for UP/SMP systems are kept in a
129140 * single place
@@ -145,11 +156,6 @@ static struct hrtimer_cpu_base migration_cpu_base = { · 15 unmodified lines
145156
146157 #define migration_base migration_cpu_base.clock_base[0]
147158
148−static inline bool is_migration_base(struct hrtimer_clock_base *base)
149−{
150− return base == &migration_base;
151−}
152−
153159 /*
154160 * We are using hashed locking: holding per_cpu(hrtimer_bases)[n].lock
155161 * means that all timers which are tied to this base via timer->base are
@@ -183,27 +189,54 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, · 27 unmodified lines
183189 }
184190
185191 /*
186− * We do not migrate the timer when it is expiring before the next
187− * event on the target cpu. When high resolution is enabled, we cannot
188− * reprogram the target cpu hardware and we would cause it to fire
189− * late. To keep it simple, we handle the high resolution enabled and
190− * disabled case similar.
192+ * Check if the elected target is suitable considering its next
193+ * event and the hotplug state of the current CPU.
194+ *
195+ * If the elected target is remote and its next event is after the timer
196+ * to queue, then a remote reprogram is necessary. However there is no
197+ * guarantee the IPI handling the operation would arrive in time to meet
198+ * the high resolution deadline. In this case the local CPU becomes a
199+ * preferred target, unless it is offline.
200+ *
201+ * High and low resolution modes are handled the same way for simplicity.
191202 *
192203 * Called with cpu_base->lock of target cpu held.
193204 */
194−static int
195−hrtimer_check_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base)
205+static bool hrtimer_suitable_target(struct hrtimer *timer, struct hrtimer_clock_base *new_base,
206+ struct hrtimer_cpu_base *new_cpu_base,
207+ struct hrtimer_cpu_base *this_cpu_base)
196208 {
197209 ktime_t expires;
198210
211+ /*
212+ * The local CPU clockevent can be reprogrammed. Also get_target_base()
213+ * guarantees it is online.
214+ */
215+ if (new_cpu_base == this_cpu_base)
216+ return true;
217+
218+ /*
219+ * The offline local CPU can't be the default target if the
220+ * next remote target event is after this timer. Keep the
221+ * elected new base. An IPI will we issued to reprogram
222+ * it as a last resort.
223+ */
224+ if (!hrtimer_base_is_online(this_cpu_base))
225+ return true;
226+
199227 expires = ktime_sub(hrtimer_get_expires(timer), new_base->offset);
200− return expires < new_base->cpu_base->expires_next;
228+
229+ return expires >= new_base->cpu_base->expires_next;
201230 }
202231
203−static inline
204−struct hrtimer_cpu_base *get_target_base(struct hrtimer_cpu_base *base,
205− int pinned)
232+static inline struct hrtimer_cpu_base *get_target_base(struct hrtimer_cpu_base *base, int pinned)
206233 {
234+ if (!hrtimer_base_is_online(base)) {
235+ int cpu = cpumask_any_and(cpu_online_mask, housekeeping_cpumask(HK_TYPE_TIMER));
236+
237+ return &per_cpu(hrtimer_bases, cpu);
238+ }
239+
207240 #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
208241 if (static_branch_likely(&timers_migration_enabled) && !pinned)
209242 return &per_cpu(hrtimer_bases, get_nohz_timer_target());
@@ -254,8 +287,8 @@ again: · 44 unmodified lines
254287 raw_spin_unlock(&base->cpu_base->lock);
255288 raw_spin_lock(&new_base->cpu_base->lock);
256289
257− if (new_cpu_base != this_cpu_base &&
258− hrtimer_check_target(timer, new_base)) {
290+ if (!hrtimer_suitable_target(timer, new_base, new_cpu_base,
291+ this_cpu_base)) {
259292 raw_spin_unlock(&new_base->cpu_base->lock);
260293 raw_spin_lock(&base->cpu_base->lock);
261294 new_cpu_base = this_cpu_base;
@@ -264,8 +297,7 @@ again: · 2 unmodified lines
264297 }
265298 WRITE_ONCE(timer->base, new_base);
266299 } else {
267− if (new_cpu_base != this_cpu_base &&
268− hrtimer_check_target(timer, new_base)) {
300+ if (!hrtimer_suitable_target(timer, new_base, new_cpu_base, this_cpu_base)) {
269301 new_cpu_base = this_cpu_base;
270302 goto again;
271303 }
@@ -275,11 +307,6 @@ again: · 3 unmodified lines
275307
276308 #else /* CONFIG_SMP */
277309
278−static inline bool is_migration_base(struct hrtimer_clock_base *base)
279−{
280− return false;
281−}
282−
283310 static inline struct hrtimer_clock_base *
284311 lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags)
285312 __acquires(&timer->base->cpu_base->lock)
@@ -716,8 +743,6 @@ static inline int hrtimer_is_hres_enabled(void) · 430 unmodified lines
716743 return hrtimer_hres_enabled;
717744 }
718745
719−static void retrigger_next_event(void *arg);
720−
721746 /*
722747 * Switch to high resolution mode
723748 */
@@ -1205,6 +1230,7 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, · 481 unmodified lines
12051230 u64 delta_ns, const enum hrtimer_mode mode,
12061231 struct hrtimer_clock_base *base)
12071232 {
1233+ struct hrtimer_cpu_base *this_cpu_base = this_cpu_ptr(&hrtimer_bases);
12081234 struct hrtimer_clock_base *new_base;
12091235 bool force_local, first;
12101236
@@ -1216,9 +1242,15 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, · 5 unmodified lines
12161242 * and enforce reprogramming after it is queued no matter whether
12171243 * it is the new first expiring timer again or not.
12181244 */
1219− force_local = base->cpu_base == this_cpu_ptr(&hrtimer_bases);
1245+ force_local = base->cpu_base == this_cpu_base;
12201246 force_local &= base->cpu_base->next_timer == timer;
12211247
1248+ /*
1249+ * Don't force local queuing if this enqueue happens on a unplugged
1250+ * CPU after hrtimer_cpu_dying() has been invoked.
1251+ */
1252+ force_local &= this_cpu_base->online;
1253+
12221254 /*
12231255 * Remove an active timer from the queue. In case it is not queued
12241256 * on the current CPU, make sure that remove_hrtimer() updates the
@@ -1248,8 +1280,27 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, · 23 unmodified lines
12481280 }
12491281
12501282 first = enqueue_hrtimer(timer, new_base, mode);
1251− if (!force_local)
1252− return first;
1283+ if (!force_local) {
1284+ /*
1285+ * If the current CPU base is online, then the timer is
1286+ * never queued on a remote CPU if it would be the first
1287+ * expiring timer there.
1288+ */
1289+ if (hrtimer_base_is_online(this_cpu_base))
1290+ return first;
1291+
1292+ /*
1293+ * Timer was enqueued remote because the current base is
1294+ * already offline. If the timer is the first to expire,
1295+ * kick the remote CPU to reprogram the clock event.
1296+ */
1297+ if (first) {
1298+ struct hrtimer_cpu_base *new_cpu_base = new_base->cpu_base;
1299+
1300+ smp_call_function_single_async(new_cpu_base->cpu, &new_cpu_base->csd);
1301+ }
1302+ return 0;
1303+ }
12531304
12541305 /*
12551306 * Timer was forced to stay on the current CPU to avoid
@@ -1370,6 +1421,18 @@ static void hrtimer_sync_wait_running(struct hrtimer_cpu_base *cpu_base, · 114 unmodified lines
13701421 }
13711422 }
13721423
1424+#ifdef CONFIG_SMP
1425+static __always_inline bool is_migration_base(struct hrtimer_clock_base *base)
1426+{
1427+ return base == &migration_base;
1428+}
1429+#else
1430+static __always_inline bool is_migration_base(struct hrtimer_clock_base *base)
1431+{
1432+ return false;
1433+}
1434+#endif
1435+
13731436 /*
13741437 * This function is called on PREEMPT_RT kernels when the fast path
13751438 * deletion of a timer failed because the timer callback function was
kernel/time/timer_migration.c+9−1
@@ -1675,6 +1675,9 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node) · 1674 unmodified lines
16751675
16761676 } while (i < tmigr_hierarchy_levels);
16771677
1678+ /* Assert single root */
1679+ WARN_ON_ONCE(!err && !group->parent && !list_is_singular(&tmigr_level_list[top]));
1680+
16781681 while (i > 0) {
16791682 group = stack[--i];
16801683
@@ -1716,7 +1719,12 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node) · 35 unmodified lines
17161719 WARN_ON_ONCE(top == 0);
17171720
17181721 lvllist = &tmigr_level_list[top];
1719− if (group->num_children == 1 && list_is_singular(lvllist)) {
1722+
1723+ /*
1724+ * Newly created root level should have accounted the upcoming
1725+ * CPU's child group and pre-accounted the old root.
1726+ */
1727+ if (group->num_children == 2 && list_is_singular(lvllist)) {
17201728 /*
17211729 * The target CPU must never do the prepare work, except
17221730 * on early boot when the boot CPU is the target. Otherwise
kernel/trace/ring_buffer.c+26−2
@@ -1672,7 +1672,8 @@ static void *rb_range_buffer(struct ring_buffer_per_cpu *cpu_buffer, int idx) · 1671 unmodified lines
16721672 * must be the same.
16731673 */
16741674 static bool rb_meta_valid(struct ring_buffer_meta *meta, int cpu,
1675− struct trace_buffer *buffer, int nr_pages)
1675+ struct trace_buffer *buffer, int nr_pages,
1676+ unsigned long *subbuf_mask)
16761677 {
16771678 int subbuf_size = PAGE_SIZE;
16781679 struct buffer_data_page *subbuf;
@@ -1680,6 +1681,9 @@ static bool rb_meta_valid(struct ring_buffer_meta *meta, int cpu, · 1 unmodified line
16801681 unsigned long buffers_end;
16811682 int i;
16821683
1684+ if (!subbuf_mask)
1685+ return false;
1686+
16831687 /* Check the meta magic and meta struct size */
16841688 if (meta->magic != RING_BUFFER_META_MAGIC ||
16851689 meta->struct_size != sizeof(*meta)) {
@@ -1712,6 +1716,8 @@ static bool rb_meta_valid(struct ring_buffer_meta *meta, int cpu, · 26 unmodified lines
17121716
17131717 subbuf = rb_subbufs_from_meta(meta);
17141718
1719+ bitmap_clear(subbuf_mask, 0, meta->nr_subbufs);
1720+
17151721 /* Is the meta buffers and the subbufs themselves have correct data? */
17161722 for (i = 0; i < meta->nr_subbufs; i++) {
17171723 if (meta->buffers[i] < 0 ||
@@ -1725,6 +1731,12 @@ static bool rb_meta_valid(struct ring_buffer_meta *meta, int cpu, · 7 unmodified lines
17251731 return false;
17261732 }
17271733
1734+ if (test_bit(meta->buffers[i], subbuf_mask)) {
1735+ pr_info("Ring buffer boot meta [%d] array has duplicates\n", cpu);
1736+ return false;
1737+ }
1738+
1739+ set_bit(meta->buffers[i], subbuf_mask);
17281740 subbuf = (void *)subbuf + subbuf_size;
17291741 }
17301742
@@ -1838,6 +1850,11 @@ static void rb_meta_validate_events(struct ring_buffer_per_cpu *cpu_buffer) · 107 unmodified lines
18381850 cpu_buffer->cpu);
18391851 goto invalid;
18401852 }
1853+
1854+ /* If the buffer has content, update pages_touched */
1855+ if (ret)
1856+ local_inc(&cpu_buffer->pages_touched);
1857+
18411858 entries += ret;
18421859 entry_bytes += local_read(&head_page->page->commit);
18431860 local_set(&cpu_buffer->head_page->entries, ret);
@@ -1889,17 +1906,22 @@ static void rb_meta_init_text_addr(struct ring_buffer_meta *meta) · 45 unmodified lines
18891906 static void rb_range_meta_init(struct trace_buffer *buffer, int nr_pages)
18901907 {
18911908 struct ring_buffer_meta *meta;
1909+ unsigned long *subbuf_mask;
18921910 unsigned long delta;
18931911 void *subbuf;
18941912 int cpu;
18951913 int i;
18961914
1915+ /* Create a mask to test the subbuf array */
1916+ subbuf_mask = bitmap_alloc(nr_pages + 1, GFP_KERNEL);
1917+ /* If subbuf_mask fails to allocate, then rb_meta_valid() will return false */
1918+
18971919 for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
18981920 void *next_meta;
18991921
19001922 meta = rb_range_meta(buffer, nr_pages, cpu);
19011923
1902− if (rb_meta_valid(meta, cpu, buffer, nr_pages)) {
1924+ if (rb_meta_valid(meta, cpu, buffer, nr_pages, subbuf_mask)) {
19031925 /* Make the mappings match the current address */
19041926 subbuf = rb_subbufs_from_meta(meta);
19051927 delta = (unsigned long)subbuf - meta->first_buffer;
@@ -1943,6 +1965,7 @@ static void rb_range_meta_init(struct trace_buffer *buffer, int nr_pages) · 37 unmodified lines
19431965 subbuf += meta->subbuf_size;
19441966 }
19451967 }
1968+ bitmap_free(subbuf_mask);
19461969 }
19471970
19481971 static void *rbm_start(struct seq_file *m, loff_t *pos)
@@ -7126,6 +7149,7 @@ int ring_buffer_map(struct trace_buffer *buffer, int cpu, · 5177 unmodified lines
71267149 kfree(cpu_buffer->subbuf_ids);
71277150 cpu_buffer->subbuf_ids = NULL;
71287151 rb_free_meta_page(cpu_buffer);
7152+ atomic_dec(&cpu_buffer->resize_disabled);
71297153 }
71307154
71317155 unlock:
kernel/trace/trace.c+5−7
@@ -5977,8 +5977,6 @@ static int __tracing_resize_ring_buffer(struct trace_array *tr, · 5976 unmodified lines
59775977 ssize_t tracing_resize_ring_buffer(struct trace_array *tr,
59785978 unsigned long size, int cpu_id)
59795979 {
5980− int ret;
5981−
59825980 guard(mutex)(&trace_types_lock);
59835981
59845982 if (cpu_id != RING_BUFFER_ALL_CPUS) {
@@ -5987,11 +5985,7 @@ ssize_t tracing_resize_ring_buffer(struct trace_array *tr, · 2 unmodified lines
59875985 return -EINVAL;
59885986 }
59895987
5990− ret = __tracing_resize_ring_buffer(tr, size, cpu_id);
5991− if (ret < 0)
5992− ret = -ENOMEM;
5993−
5994− return ret;
5988+ return __tracing_resize_ring_buffer(tr, size, cpu_id);
59955989 }
59965990
59975991 static void update_last_data(struct trace_array *tr)
@@ -8285,6 +8279,10 @@ static int tracing_buffers_mmap(struct file *filp, struct vm_area_struct *vma) · 2287 unmodified lines
82858279 struct trace_iterator *iter = &info->iter;
82868280 int ret = 0;
82878281
8282+ /* Currently the boot mapped buffer is not supported for mmap */
8283+ if (iter->tr->flags & TRACE_ARRAY_FL_BOOT)
8284+ return -ENODEV;
8285+
82888286 ret = get_snapshot_map(iter->tr);
82898287 if (ret)
82908288 return ret;
kernel/trace/trace_functions_graph.c+1−1
@@ -198,7 +198,7 @@ int trace_graph_entry(struct ftrace_graph_ent *trace, · 197 unmodified lines
198198 * returning from the function.
199199 */
200200 if (ftrace_graph_notrace_addr(trace->func)) {
201− *task_var |= TRACE_GRAPH_NOTRACE_BIT;
201+ *task_var |= TRACE_GRAPH_NOTRACE;
202202 /*
203203 * Need to return 1 to have the return called
204204 * that will clear the NOTRACE bit.
kernel/workqueue.c+6−6
@@ -3516,12 +3516,6 @@ repeat: · 3515 unmodified lines
35163516 }
35173517 }
35183518
3519− /*
3520− * Put the reference grabbed by send_mayday(). @pool won't
3521− * go away while we're still attached to it.
3522− */
3523− put_pwq(pwq);
3524−
35253519 /*
35263520 * Leave this pool. Notify regular workers; otherwise, we end up
35273521 * with 0 concurrency and stalling the execution.
@@ -3532,6 +3526,12 @@ repeat: · 4 unmodified lines
35323526
35333527 worker_detach_from_pool(rescuer);

10 more lines aren’t shown here.

lib/iov_iter.c+2−1

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

lib/stackinit_kunit.c+4−2

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

lib/test_xarray.c+8−7

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

mm/hugetlb.c+1−1

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

mm/kasan/report.c+33−1

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

mm/madvise.c+10−1

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

mm/memcontrol.c+1−0

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

mm/memory.c+14−3

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

mm/migrate_device.c+4−9

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

mm/zswap.c+16−19

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

net/ax25/af_ax25.c+11−0

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

net/batman-adv/bat_v.c+0−2

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

net/batman-adv/bat_v_elp.c+86−36

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

net/batman-adv/bat_v_elp.h+0−2

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

net/batman-adv/translation-table.c+5−7

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

net/batman-adv/types.h+0−3

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

net/bluetooth/hidp/Kconfig+1−2

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

net/bluetooth/l2cap_core.c+79−90

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

net/bluetooth/l2cap_sock.c+7−8

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

net/bpf/test_run.c+1−4

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

net/can/j1939/socket.c+2−2

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

net/can/j1939/transport.c+3−2

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

net/core/bpf_sk_storage.c+1−12

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

net/core/dev.c+111−11

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

net/core/drop_monitor.c+14−15

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

net/core/fib_rules.c+13−11

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

net/core/flow_dissector.c+40−30

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

net/core/gro.c+0−3

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

net/core/neighbour.c+6−2

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

net/core/net_namespace.c+4−4

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

net/core/rtnetlink.c+1−0

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

net/core/skbuff.c+10−100

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

net/core/skmsg.c+7−0

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

net/core/sock_map.c+7−1

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

net/ethtool/common.c+5−0

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

net/ethtool/common.h+2−0

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

net/ethtool/ioctl.c+1−1

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

net/ethtool/rss.c+2−1

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

net/ethtool/strset.c+5−0

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

net/ethtool/tsconfig.c+23−10

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

net/ipv4/arp.c+4−2

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

net/ipv4/devinet.c+2−1

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

net/ipv4/icmp.c+17−14

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

net/ipv4/route.c+21−9

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

net/ipv4/tcp.c+24−5

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

net/ipv4/tcp_bpf.c+36−0

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

net/ipv4/tcp_fastopen.c+2−2

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

net/ipv4/tcp_input.c+13−7

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

net/ipv4/tcp_ipv4.c+1−1

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

net/ipv4/udp.c+2−2

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

net/ipv6/icmp.c+23−19

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

net/ipv6/ioam6_iptunnel.c+9−5

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

net/ipv6/ip6_input.c+9−5

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

net/ipv6/mcast.c+25−20

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

net/ipv6/ndisc.c+13−11

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

net/ipv6/route.c+6−1

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

net/ipv6/rpl_iptunnel.c+10−5

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

net/ipv6/seg6_iptunnel.c+10−5

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

net/ipv6/udp.c+2−2

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

net/netfilter/nf_flow_table_ip.c+2−6

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

net/openvswitch/datapath.c+9−3

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

net/rose/af_rose.c+16−8

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

net/rxrpc/ar-internal.h+4−5

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

net/rxrpc/call_object.c+2−4

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

net/rxrpc/conn_event.c+11−10

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

net/rxrpc/conn_object.c+1−0

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

net/rxrpc/input.c+10−2

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

net/rxrpc/output.c+35−15

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

net/rxrpc/peer_event.c+7−0

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

net/rxrpc/rxkad.c+5−8

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

net/rxrpc/sendmsg.c+2−4

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

net/rxrpc/txbuf.c+10−27

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

net/sched/cls_api.c+1−1

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

net/sched/sch_fifo.c+3−0

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

net/sched/sch_netem.c+1−1

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

net/sctp/stream.c+1−1

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

net/socket.c+5−0

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

net/strparser/strparser.c+9−2

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

net/vmw_vsock/af_vsock.c+10−1

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

net/vmw_vsock/virtio_transport.c+7−3

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

net/vmw_vsock/vsock_bpf.c+1−1

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

rust/Makefile+3−2

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

rust/bindings/bindings_helper.h+1−0

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

rust/kernel/faux.rs+67−0

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

rust/kernel/init.rs+1−1

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

rust/kernel/lib.rs+1−0

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

rust/kernel/rbtree.rs+1−1

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

samples/hid/Makefile+7−6

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

samples/rust/Kconfig+10−0

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

samples/rust/Makefile+1−0

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

samples/rust/rust_driver_faux.rs+29−0

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

scripts/Makefile.extrawarn+9−6

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

scripts/Makefile.lib+1−1

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

scripts/generate_rust_target.rs+18−0

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

scripts/mod/modpost.c+37−2

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

scripts/mod/modpost.h+6−0

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

scripts/module.lds.S+1−0

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

scripts/package/install-extmod-build+2−2

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

security/tomoyo/common.c+112−33

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

security/tomoyo/domain.c+1−1

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

security/tomoyo/securityfs_if.c+3−3

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

security/tomoyo/tomoyo.c+1−4

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

sound/core/hrtimer.c+1−2

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

sound/core/seq/seq_clientmgr.c+9−3

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

sound/drivers/dummy.c+1−2

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

sound/drivers/pcsp/pcsp.c+1−2

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

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

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

sound/pci/hda/hda_codec.c+3−1

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

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

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

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

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

sound/pci/hda/patch_cs8409-tables.c+6−6

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

sound/pci/hda/patch_cs8409.c+16−10

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

sound/pci/hda/patch_cs8409.h+4−3

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

sound/pci/hda/patch_realtek.c+2−0

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

sound/pci/hda/tas2781_hda_spi.c+14−13

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

sound/pci/hda/tas2781_spi_fwlib.c+5−5

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

sound/sh/sh_dac_audio.c+1−2

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

sound/soc/codecs/arizona.c+7−7

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

sound/soc/codecs/cs35l41.c+23−7

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

sound/soc/codecs/madera.c+5−5

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

sound/soc/codecs/tas2781-i2c.c+1−3

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

sound/soc/codecs/wm5110.c+4−4

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

sound/soc/fsl/fsl_micfil.c+2−0

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

sound/soc/fsl/imx-audmix.c+0−31

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

sound/soc/generic/simple-card-utils.c+1−0

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

sound/soc/intel/boards/sof_sdw.c+35−6

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

sound/soc/intel/common/soc-acpi-intel-mtl-match.c+1−1

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

sound/soc/intel/common/soc-acpi-intel-ptl-match.c+6−6

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

sound/soc/intel/common/soc-acpi-intel-tgl-match.c+8−8

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

sound/soc/renesas/rcar/core.c+0−14

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

sound/soc/renesas/rcar/rsnd.h+0−1

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

sound/soc/renesas/rcar/src.c+93−23

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

sound/soc/renesas/rcar/ssi.c+2−1

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

sound/soc/rockchip/rockchip_i2s_tdm.c+2−2

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

sound/soc/sof/amd/acp-ipc.c+17−8

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

sound/soc/sof/amd/acp.c+1−0

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

sound/soc/sof/amd/acp.h+1−0

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

sound/soc/sof/amd/pci-vangogh.c+0−2

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

sound/soc/sof/amd/vangogh.c+18−4

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

sound/soc/sof/intel/hda-codec.c+1−0

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

sound/soc/sof/intel/pci-ptl.c+1−0

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

sound/soc/sof/ipc4-topology.c+10−2

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

sound/soc/sof/pcm.c+2−0

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

sound/soc/sof/stream-ipc.c+5−1

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

tools/accounting/getdelays.c+16−16

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

tools/mm/page-types.c+2−2

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

tools/objtool/check.c+11−1

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

tools/sched_ext/include/scx/common.bpf.h+22−3

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

tools/testing/selftests/bpf/map_tests/map_in_map_batch_ops.c+44−18

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

tools/testing/selftests/bpf/prog_tests/flow_dissector_classification.c+6−1

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

tools/testing/selftests/bpf/prog_tests/sockmap_basic.c+55−74

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

tools/testing/selftests/bpf/prog_tests/sockmap_strp.c+454−0

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

tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c+2−2

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

tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c+4−4

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

tools/testing/selftests/bpf/progs/test_sockmap_strp.c+53−0

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

tools/testing/selftests/bpf/progs/verifier_array_access.c+15−0

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

tools/testing/selftests/cgroup/test_cpuset_v1_hp.sh+1−1

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

tools/testing/selftests/drivers/net/hw/rss_ctx.py+8−1

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

tools/testing/selftests/filesystems/statmount/statmount_test.c+21−1

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

tools/testing/selftests/kvm/s390/cmma_test.c+2−2

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

tools/testing/selftests/kvm/s390/ucontrol_test.c+12−20

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

tools/testing/selftests/kvm/x86/hyperv_cpuid.c+32−15

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

tools/testing/selftests/livepatch/functions.sh+2−1

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

tools/testing/selftests/mm/run_vmtests.sh+1−1

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

tools/testing/selftests/net/forwarding/tc_flower_port_range.sh+46−0

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

tools/testing/selftests/net/mptcp/mptcp_connect.c+1−1

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

tools/testing/selftests/net/udpgso.c+26−0

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

tools/testing/selftests/sched_ext/create_dsq.c+5−5

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

tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c+5−2

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

tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c+5−2

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

tools/testing/selftests/sched_ext/dsp_local_on.bpf.c+1−1

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

tools/testing/selftests/sched_ext/dsp_local_on.c+1−0

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

tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c+5−5

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

tools/testing/selftests/sched_ext/enq_select_cpu_fails.c+5−5

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

tools/testing/selftests/sched_ext/exit.c+1−0

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

tools/testing/selftests/sched_ext/hotplug.c+4−2

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

tools/testing/selftests/sched_ext/init_enable_count.c+9−18

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

tools/testing/selftests/sched_ext/maximal.c+5−2

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

tools/testing/selftests/sched_ext/maybe_null.c+1−1

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

tools/testing/selftests/sched_ext/minimal.c+5−5

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

tools/testing/selftests/sched_ext/prog_run.c+5−5

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

tools/testing/selftests/sched_ext/reload_loop.c+4−5

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

tools/testing/selftests/sched_ext/select_cpu_dfl.c+5−2

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

tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.c+5−2

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

tools/testing/selftests/sched_ext/select_cpu_dispatch.c+5−2

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

tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.c+5−2

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

tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c+5−2

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

tools/testing/selftests/sched_ext/select_cpu_vtime.c+5−2

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

tools/testing/selftests/seccomp/seccomp_bpf.c+199−0

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

tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json+33−1

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

tools/testing/selftests/tc-testing/tc-tests/qdiscs/fifo.json+23−0

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

tools/testing/vsock/vsock_test.c+41−0

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

virt/kvm/kvm_main.c+9−16

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

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