History

Merge branch 'sched/urgent' into sched/core, to pick up fixes and refresh the branch

Ingo Molnar committed 3 years ago

Commit 8db30572 parents d4d6596 9e0bc36950 files · +8547 −5075Browse files

Unified · Split

950 files
  1. Documentation/admin-guide/cgroup-v1/memory.rst +7 −0
  2. Documentation/arch/arm64/cpu-feature-registers.rst +12 −0
  3. Documentation/arch/arm64/elf_hwcaps.rst +3 −0
  4. Documentation/arch/loongarch/introduction.rst +2 −2
  5. Documentation/devicetree/bindings/ata/pata-common.yaml +1 −0
  6. Documentation/devicetree/bindings/clock/renesas,5p35023.yaml +7 −4
  7. Documentation/devicetree/bindings/i2c/i2c-mxs.yaml +4 −1
  8. Documentation/devicetree/bindings/soc/loongson/loongson,ls2k-pmc.yaml +37 −6
  9. Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml +7 −0
  10. Documentation/filesystems/btrfs.rst +0 −1
  11. Documentation/filesystems/porting.rst +96 −0
  12. Documentation/kbuild/kconfig-language.rst +26 −0
  13. Documentation/networking/ax25.rst +2 −2
  14. Documentation/process/embargoed-hardware-issues.rst +1 −0
  15. Documentation/sound/designs/midi-2.0.rst +2 −2
  16. Documentation/translations/zh_CN/arch/loongarch/introduction.rst +2 −2
  17. MAINTAINERS +26 −23
  18. Makefile +1 −1
  19. arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi +3 −2
  20. arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi +1 −2
  21. arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi +4 −1
  22. arch/arm/boot/dts/ti/omap/omap443x.dtsi +1 −0
  23. arch/arm/boot/dts/ti/omap/omap4460.dtsi +1 −0
  24. arch/arm/include/asm/hardware/locomo.h +1 −1
  25. arch/arm/mach-omap2/pm44xx.c +2 −2
  26. arch/arm/mach-sa1100/include/mach/collie.h +0 −2
  27. arch/arm/mm/cache-uniphier.c +3 −1
  28. arch/arm/xen/enlighten.c +1 −1
  29. arch/arm64/boot/dts/freescale/Makefile +1 −0
  30. arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi +20 −12
  31. arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts +3 −2
  32. arch/arm64/boot/dts/freescale/imx8mp.dtsi +6 −0
  33. arch/arm64/boot/dts/freescale/imx93-tqma9352.dtsi +1 −1
  34. arch/arm64/boot/dts/mediatek/mt8195.dtsi +5 −5
  35. arch/arm64/configs/defconfig +1 −1
  36. arch/arm64/include/asm/cpufeature.h +1 −1
  37. arch/arm64/include/asm/hugetlb.h +1 −1
  38. arch/arm64/include/asm/kvm_hyp.h +1 −1
  39. arch/arm64/kernel/cpufeature.c +2 −1
  40. arch/arm64/kvm/hyp/include/nvhe/ffa.h +1 −1
  41. arch/arm64/kvm/hyp/nvhe/ffa.c +1 −2
  42. arch/arm64/kvm/hyp/nvhe/hyp-init.S +1 −0
  43. arch/arm64/kvm/hyp/nvhe/hyp-main.c +6 −2
  44. arch/arm64/kvm/hyp/nvhe/psci-relay.c +1 −2
  45. arch/arm64/kvm/mmu.c +3 −0
  46. arch/arm64/mm/hugetlbpage.c +7 −16
  47. arch/arm64/tools/sysreg +5 −1
  48. arch/ia64/kernel/acpi.c +4 −0
  49. arch/loongarch/include/asm/addrspace.h +6 −6
  50. arch/loongarch/include/asm/elf.h +9 −0
  51. arch/loongarch/include/asm/exception.h +45 −0
  52. arch/loongarch/include/asm/kasan.h +9 −50
  53. arch/loongarch/include/asm/smp.h +1 −0
  54. arch/loongarch/kernel/Makefile +4 −0
  55. arch/loongarch/kernel/acpi.c +0 −1
  56. arch/loongarch/kernel/mem.c +3 −1
  57. arch/loongarch/kernel/module-sections.c +1 −0
  58. arch/loongarch/kernel/module.c +21 −1
  59. arch/loongarch/kernel/numa.c +1 −1
  60. arch/loongarch/kernel/process.c +1 −0
  61. arch/loongarch/kernel/relocate_kernel.S +0 −1
  62. arch/loongarch/kernel/signal.c +4 −3
  63. arch/loongarch/kernel/smp.c +3 −0
  64. arch/loongarch/kernel/syscall.c +1 −0
  65. arch/loongarch/kernel/time.c +1 −1
  66. arch/loongarch/kernel/topology.c +3 −0
  67. arch/loongarch/kernel/traps.c +5 −20
  68. arch/loongarch/kernel/vmlinux.lds.S +28 −27
  69. arch/loongarch/mm/fault.c +1 −1
  70. arch/loongarch/mm/hugetlbpage.c +0 −12
  71. arch/loongarch/mm/ioremap.c +1 −0
  72. arch/loongarch/mm/kasan_init.c +51 −0
  73. arch/loongarch/mm/tlb.c +1 −1
  74. arch/mips/alchemy/devboards/db1000.c +4 −0
  75. arch/mips/alchemy/devboards/db1200.c +6 −0
  76. arch/mips/alchemy/devboards/db1300.c +4 −0
  77. arch/parisc/include/asm/cache.h +1 −0
  78. arch/parisc/include/asm/hugetlb.h +1 −1
  79. arch/parisc/include/asm/mckinley.h +0 −8
  80. arch/parisc/include/asm/pdc.h +3 −2
  81. arch/parisc/include/asm/processor.h +1 −0
  82. arch/parisc/include/asm/ropes.h +5 −2
  83. arch/parisc/include/asm/shmparam.h +15 −0
  84. arch/parisc/kernel/asm-offsets.c +2 −0
  85. arch/parisc/kernel/cache.c +1 −7
  86. arch/parisc/kernel/drivers.c +1 −1
  87. arch/parisc/kernel/firmware.c +45 −11
  88. arch/parisc/kernel/head.S +13 −3
  89. arch/parisc/kernel/irq.c +1 −1
  90. arch/parisc/kernel/processor.c +2 −0
  91. arch/parisc/kernel/vmlinux.lds.S +1 −0
  92. arch/parisc/mm/hugetlbpage.c +1 −1
  93. arch/parisc/mm/init.c +72 −0
  94. arch/powerpc/Kconfig +1 −1
  95. arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h +2 −1
  96. arch/powerpc/kernel/hw_breakpoint.c +15 −1
  97. arch/powerpc/kernel/hw_breakpoint_constraints.c +6 −1
  98. arch/powerpc/kernel/stacktrace.c +5 −22
  99. arch/powerpc/kernel/traps.c +36 −20
  100. arch/powerpc/mm/book3s64/hugetlbpage.c +4 −1
  101. arch/powerpc/mm/book3s64/radix_hugetlbpage.c +2 −1
  102. arch/powerpc/mm/nohash/8xx.c +2 −1
  103. arch/powerpc/mm/pgtable.c +2 −1
  104. arch/powerpc/perf/hv-24x7.c +1 −1
  105. arch/powerpc/platforms/82xx/Kconfig +1 −2
  106. arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +26 −25
  107. arch/riscv/include/asm/errata_list.h +2 −2
  108. arch/riscv/include/asm/hugetlb.h +2 −1
  109. arch/riscv/kernel/elf_kexec.c +7 −1
  110. arch/riscv/kvm/vcpu_onereg.c +5 −2
  111. arch/riscv/mm/hugetlbpage.c +2 −1
  112. arch/s390/configs/debug_defconfig +10 −4
  113. arch/s390/configs/defconfig +9 −4
  114. arch/s390/configs/zfcpdump_defconfig +2 −2
  115. arch/s390/include/asm/hugetlb.h +4 −2
  116. arch/s390/kernel/cert_store.c +4 −3
  117. arch/s390/mm/hugetlbpage.c +7 −1
  118. arch/sh/mm/ioremap.c +2 −2
  119. arch/sparc/include/asm/hugetlb.h +4 −2
  120. arch/sparc/mm/hugetlbpage.c +7 −1
  121. arch/x86/Kconfig +1 −1
  122. arch/x86/boot/compressed/ident_map_64.c +8 −0
  123. arch/x86/entry/common.c +1 −1
  124. arch/x86/events/amd/core.c +17 −7
  125. arch/x86/include/asm/boot.h +31 −14
  126. arch/x86/include/asm/efi.h +2 −30
  127. arch/x86/include/asm/kvm_host.h +1 −2
  128. arch/x86/include/asm/linkage.h +15 −0
  129. arch/x86/include/asm/mmu_context.h +1 −2
  130. arch/x86/include/asm/paravirt_types.h +0 −15
  131. arch/x86/include/asm/pgtable.h +8 −0
  132. arch/x86/include/asm/processor.h +0 −2
  133. arch/x86/include/asm/xen/hypervisor.h +37 −0
  134. arch/x86/kernel/alternative.c +2 −7
  135. arch/x86/kernel/apic/x2apic_uv_x.c +5 −6
  136. arch/x86/kernel/callthunks.c +0 −1
  137. arch/x86/kernel/cpu/amd.c +9 −19
  138. arch/x86/kernel/cpu/bugs.c +3 −14
  139. arch/x86/kernel/cpu/common.c +1 −1
  140. arch/x86/kernel/cpu/sgx/encl.c +25 −5
  141. arch/x86/kernel/kgdb.c +0 −1
  142. arch/x86/kernel/paravirt.c +0 −67
  143. arch/x86/kernel/process.c +0 −7
  144. arch/x86/kernel/setup.c +2 −6
  145. arch/x86/kernel/shstk.c +31 −2
  146. arch/x86/kernel/smpboot.c +9 −3
  147. arch/x86/kvm/mmu/mmu.c +5 −16
  148. arch/x86/kvm/mmu/mmu_internal.h +7 −8
  149. arch/x86/kvm/mmu/tdp_mmu.c +67 −85
  150. arch/x86/kvm/mmu/tdp_mmu.h +2 −3
  151. arch/x86/kvm/svm/sev.c +26 −8
  152. arch/x86/kvm/svm/svm.c +35 −8
  153. arch/x86/kvm/svm/svm.h +1 −0
  154. arch/x86/kvm/x86.c +1 −4
  155. arch/x86/lib/memcpy_64.S +1 −1
  156. arch/x86/lib/memmove_64.S +1 −1
  157. arch/x86/lib/memset_64.S +1 −1
  158. arch/x86/lib/putuser.S +0 −4
  159. arch/x86/platform/efi/efi_32.c +12 −0
  160. arch/x86/platform/efi/efi_64.c +17 −2
  161. arch/x86/purgatory/Makefile +4 −0
  162. arch/x86/xen/efi.c +1 −1
  163. arch/x86/xen/enlighten.c +1 −1
  164. arch/x86/xen/enlighten_hvm.c +1 −1
  165. arch/x86/xen/enlighten_pv.c +33 −7
  166. arch/x86/xen/mmu_pv.c +36 −19
  167. arch/x86/xen/multicalls.h +2 −2
  168. arch/xtensa/boot/Makefile +1 −2
  169. arch/xtensa/boot/lib/zmem.c +3 −2
  170. arch/xtensa/include/asm/core.h +4 −0
  171. arch/xtensa/include/asm/hw_breakpoint.h +1 −0
  172. arch/xtensa/include/asm/processor.h +5 −0
  173. arch/xtensa/include/asm/ptrace.h +3 −0
  174. arch/xtensa/include/asm/smp.h +1 −0
  175. arch/xtensa/include/asm/tlb.h +2 −0
  176. arch/xtensa/kernel/hw_breakpoint.c +1 −0
  177. arch/xtensa/kernel/irq.c +1 −0
  178. arch/xtensa/kernel/ptrace.c +0 −1
  179. arch/xtensa/kernel/signal.c +2 −0
  180. arch/xtensa/kernel/smp.c +1 −0
  181. arch/xtensa/kernel/stacktrace.c +1 −0
  182. arch/xtensa/kernel/traps.c +1 −0
  183. arch/xtensa/lib/umulsidi3.S +3 −1
  184. arch/xtensa/mm/fault.c +1 −0
  185. arch/xtensa/mm/tlb.c +1 −0
  186. arch/xtensa/platforms/iss/network.c +2 −2
  187. block/blk-mq.c +7 −6
  188. block/blk-rq-qos.c +1 −1
  189. block/disk-events.c +0 −1
  190. crypto/sm2.c +5 −1
  191. drivers/Makefile +1 −1
  192. drivers/accel/ivpu/ivpu_drv.c +2 −1
  193. drivers/accel/ivpu/ivpu_drv.h +2 −0
  194. drivers/accel/ivpu/ivpu_fw.c +5 −3
  195. drivers/accel/ivpu/ivpu_gem.h +5 −0
  196. drivers/accel/ivpu/ivpu_hw_40xx.c +23 −4
  197. drivers/accel/ivpu/ivpu_hw_40xx_reg.h +2 −0
  198. drivers/accel/ivpu/ivpu_ipc.c +4 −7
  199. drivers/acpi/acpi_video.c +5 −2
  200. drivers/acpi/processor_pdc.c +1 −0
  201. drivers/acpi/thermal.c +1 −1
  202. drivers/ata/ahci.c +9 −0
  203. drivers/ata/libahci.c +23 −12
  204. drivers/ata/libata-core.c +139 −17
  205. drivers/ata/libata-eh.c +49 −15
  206. drivers/ata/libata-sata.c +16 −3
  207. drivers/ata/libata-scsi.c +67 −33
  208. drivers/ata/libata-transport.c +8 −1
  209. drivers/ata/libata.h +4 −0
  210. drivers/ata/pata_parport/comm.c +4 −5
  211. drivers/ata/sata_mv.c +2 −2
  212. drivers/base/core.c +2 −0
  213. drivers/block/rbd.c +225 −187
  214. drivers/bus/ti-sysc.c +22 −9
  215. drivers/char/agp/parisc-agp.c +0 −2
  216. drivers/char/tpm/tpm-chip.c +1 −1
  217. drivers/clk/clk-si521xx.c +5 −4
  218. drivers/clk/clk-versaclock3.c +40 −41
  219. drivers/clk/sprd/ums512-clk.c +1 −1
  220. drivers/clk/tegra/clk-bpmp.c +1 −1
  221. drivers/comedi/Kconfig +35 −68
  222. drivers/cxl/acpi.c +2 −2
  223. drivers/cxl/core/mbox.c +12 −11
  224. drivers/cxl/core/port.c +9 −4
  225. drivers/cxl/core/region.c +31 −10
  226. drivers/cxl/pci.c +3 −4
  227. drivers/firewire/core-device.c +1 −1
  228. drivers/firewire/core-topology.c +1 −1
  229. drivers/firewire/sbp2.c +6 −3
  230. drivers/firmware/arm_ffa/driver.c +14 −2
  231. drivers/firmware/arm_scmi/perf.c +2 −2
  232. drivers/firmware/cirrus/cs_dsp.c +17 −17
  233. drivers/firmware/efi/efi.c +29 −3
  234. drivers/firmware/efi/libstub/unaccepted_memory.c +1 −1
  235. drivers/firmware/imx/imx-dsp.c +1 −0
  236. drivers/gpio/gpio-pmic-eic-sprd.c +1 −0
  237. drivers/gpio/gpio-sim.c +23 −37
  238. drivers/gpio/gpio-tb10x.c +5 −1
  239. drivers/gpio/gpio-timberdale.c +3 −2
  240. drivers/gpu/drm/Kconfig +1 −1
  241. drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 −1
  242. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +1 −1
  243. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c +1 −2
  244. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.h +1 −2
  245. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +2 −4
  246. drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h +1 −2
  247. drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +1 −1
  248. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 −26
  249. drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 −1
  250. drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +12 −7
  251. drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 −2
  252. drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +1 −1
  253. drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +1 −1
  254. drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +1 −1
  255. drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +1 −1
  256. drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 −1
  257. drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 −1
  258. drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 −2
  259. drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +34 −42
  260. drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c +3 −0
  261. drivers/gpu/drm/amd/amdgpu/soc21.c +1 −1
  262. drivers/gpu/drm/amd/amdkfd/kfd_crat.c +2 −1
  263. drivers/gpu/drm/amd/amdkfd/kfd_crat.h +4 −0
  264. drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2 −3
  265. drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c +2 −0
  266. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c +26 −8
  267. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h +1 −1
  268. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +1 −1
  269. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c +1 −1
  270. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +42 −1
  271. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c +29 −17
  272. drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c +1 −1
  273. drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +1 −2
  274. drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 −2
  275. drivers/gpu/drm/amd/amdkfd/kfd_topology.c +43 −34
  276. drivers/gpu/drm/amd/amdkfd/kfd_topology.h +1 −1
  277. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +96 −23
  278. drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 −1
  279. drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c +28 −7
  280. drivers/gpu/drm/amd/display/dc/dc.h +1 −0
  281. drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +20 −14
  282. drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +2 −6
  283. drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c +23 −0
  284. drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.c +1 −1
  285. drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 −0
  286. drivers/gpu/drm/amd/display/dc/link/link_factory.c +4 −0
  287. drivers/gpu/drm/amd/include/kgd_kfd_interface.h +4 −5
  288. drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +1 −1
  289. drivers/gpu/drm/drm_connector.c +2 −0
  290. drivers/gpu/drm/drm_exec.c +1 −1
  291. drivers/gpu/drm/i915/display/intel_bios.c +21 −0
  292. drivers/gpu/drm/i915/display/intel_bios.h +1 −0
  293. drivers/gpu/drm/i915/display/intel_dp.c +6 −1
  294. drivers/gpu/drm/i915/gem/i915_gem_shmem.c +7 −4
  295. drivers/gpu/drm/i915/gt/intel_engine_cs.c +0 −1
  296. drivers/gpu/drm/i915/gt/intel_execlists_submission.c +2 −0
  297. drivers/gpu/drm/i915/gt/intel_ggtt.c +17 −6
  298. drivers/gpu/drm/i915/gt/intel_lrc.c +3 −2
  299. drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +35 −3
  300. drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 −0
  301. drivers/gpu/drm/nouveau/nouveau_drv.h +5 −14
  302. drivers/gpu/drm/nouveau/nouveau_exec.c +1 −1
  303. drivers/gpu/drm/nouveau/nouveau_fence.c +1 −1
  304. drivers/gpu/drm/nouveau/nouveau_sched.c +9 −3
  305. drivers/gpu/drm/radeon/radeon_sa.c +1 −1
  306. drivers/gpu/drm/tests/drm_mm_test.c +1 −1
  307. drivers/gpu/drm/tiny/gm12u320.c +5 −5
  308. drivers/gpu/drm/virtio/virtgpu_submit.c +0 −1
  309. drivers/gpu/drm/vkms/vkms_composer.c +2 −7
  310. drivers/gpu/drm/vkms/vkms_crtc.c +4 −5
  311. drivers/gpu/drm/vkms/vkms_drv.h +1 −3
  312. drivers/hwmon/nct6775-core.c +4 −0
  313. drivers/i2c/Kconfig +1 −1
  314. drivers/i2c/busses/Kconfig +2 −2
  315. drivers/i2c/busses/i2c-aspeed.c +5 −2
  316. drivers/i2c/busses/i2c-cadence.c +1 −0
  317. drivers/i2c/busses/i2c-designware-common.c +17 −0
  318. drivers/i2c/busses/i2c-designware-core.h +3 −0
  319. drivers/i2c/busses/i2c-i801.c +1 −0
  320. drivers/i2c/busses/i2c-npcm7xx.c +7 −10
  321. drivers/i2c/busses/i2c-xiic.c +1 −1
  322. drivers/i2c/i2c-mux.c +1 −1
  323. drivers/i2c/muxes/i2c-demux-pinctrl.c +4 −0
  324. drivers/i2c/muxes/i2c-mux-gpio.c +3 −1
  325. drivers/irqchip/irq-xtensa-mx.c +1 −0
  326. drivers/md/dm-core.h +1 −0
  327. drivers/md/dm-ioctl.c +6 −1
  328. drivers/md/dm-table.c +24 −8
  329. drivers/md/dm.c +2 −21
  330. drivers/md/md.c +16 −7
  331. drivers/md/md.h +3 −0
  332. drivers/md/raid1.c +1 −2
  333. drivers/media/common/videobuf2/frame_vector.c +4 −2
  334. drivers/media/i2c/imx219.c +7 −6
  335. drivers/media/i2c/max9286.c +0 −1
  336. drivers/media/i2c/rdacm21.c +0 −1
  337. drivers/media/pci/bt8xx/bttv-risc.c +1 −3
  338. drivers/media/pci/intel/ivsc/Kconfig +4 −1
  339. drivers/media/platform/marvell/Kconfig +2 −2
  340. drivers/media/platform/nxp/imx-mipi-csis.c +0 −2
  341. drivers/media/platform/via/Kconfig +1 −1
  342. drivers/media/usb/em28xx/Kconfig +2 −2
  343. drivers/media/usb/go7007/Kconfig +1 −1
  344. drivers/media/usb/uvc/uvc_ctrl.c +3 −0
  345. drivers/mfd/cs42l43.c +2 −2
  346. drivers/misc/cardreader/rts5227.c +6 −49
  347. drivers/misc/cardreader/rts5228.c +17 −40
  348. drivers/misc/cardreader/rts5249.c +7 −49
  349. drivers/misc/cardreader/rts5260.c +13 −30
  350. drivers/misc/cardreader/rts5261.c +13 −39
  351. drivers/misc/cardreader/rtsx_pcr.c +46 −5
  352. drivers/net/dsa/sja1105/sja1105.h +2 −0
  353. drivers/net/dsa/sja1105/sja1105_dynamic_config.c +44 −49
  354. drivers/net/dsa/sja1105/sja1105_main.c +51 −18
  355. drivers/net/ethernet/adi/adin1110.c +1 −1
  356. drivers/net/ethernet/amazon/ena/ena_netdev.c +3 −0
  357. drivers/net/ethernet/broadcom/asp2/bcmasp.c +8 −2
  358. drivers/net/ethernet/broadcom/asp2/bcmasp.h +2 −2
  359. drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c +1 −1
  360. drivers/net/ethernet/broadcom/bnxt/bnxt.c +5 −0
  361. drivers/net/ethernet/cadence/macb_main.c +3 −2
  362. drivers/net/ethernet/engleder/tsnep_ethtool.c +2 −4
  363. drivers/net/ethernet/engleder/tsnep_main.c +14 −4
  364. drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +9 −0
  365. drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +12 −1
  366. drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +2 −1
  367. drivers/net/ethernet/huawei/hinic/hinic_port.c +0 −3
  368. drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +5 −3
  369. drivers/net/ethernet/intel/iavf/iavf.h +1 −1
  370. drivers/net/ethernet/intel/iavf/iavf_ethtool.c +1 −1
  371. drivers/net/ethernet/intel/iavf/iavf_main.c +8 −9
  372. drivers/net/ethernet/intel/igb/igb_main.c +4 −1
  373. drivers/net/ethernet/intel/igc/igc_ethtool.c +19 −12
  374. drivers/net/ethernet/intel/igc/igc_main.c +1 −1
  375. drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +15 −13
  376. drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c +5 −0
  377. drivers/net/ethernet/marvell/octeon_ep/octep_main.c +4 −4
  378. drivers/net/ethernet/marvell/octeon_ep/octep_tx.c +4 −4
  379. drivers/net/ethernet/marvell/octeon_ep/octep_tx.h +15 −1
  380. drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c +4 −2
  381. drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h +1 −1
  382. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +6 −37
  383. drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +2 −1
  384. drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +4 −3
  385. drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +38 −11
  386. drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +2 −2
  387. drivers/net/ethernet/mediatek/mtk_eth_soc.c +6 −2
  388. drivers/net/ethernet/mediatek/mtk_ppe_offload.c +4 −2
  389. drivers/net/ethernet/microchip/vcap/vcap_api.c +16 −2
  390. drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c +54 −5
  391. drivers/net/ethernet/pensando/ionic/ionic_dev.h +1 −0
  392. drivers/net/ethernet/pensando/ionic/ionic_txrx.c +7 −3
  393. drivers/net/ethernet/renesas/rswitch.c +16 −4
  394. drivers/net/ethernet/renesas/rswitch.h +2 −0
  395. drivers/net/ethernet/sfc/tc.c +18 −3
  396. drivers/net/ethernet/sfc/tc_conntrack.c +6 −1
  397. drivers/net/ethernet/sfc/tc_counters.c +2 −0
  398. drivers/net/ethernet/sfc/tc_encap_actions.c +4 −0
  399. drivers/net/ethernet/stmicro/stmmac/common.h +5 −2
  400. drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +8 −8
  401. drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +8 −8
  402. drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c +8 −8
  403. drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +8 −8
  404. drivers/net/ethernet/stmicro/stmmac/stmmac.h +0 −2
  405. drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +16 −16
  406. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +73 −62
  407. drivers/net/ethernet/ti/Kconfig +1 −0
  408. drivers/net/team/team.c +9 −1
  409. drivers/net/thunderbolt/main.c +1 −2
  410. drivers/net/usb/r8152.c +3 −0
  411. drivers/net/veth.c +2 −0
  412. drivers/net/vxlan/vxlan_core.c +4 −0
  413. drivers/nvme/host/core.c +35 −19
  414. drivers/nvme/host/fc.c +1 −1
  415. drivers/nvme/host/hwmon.c +1 −1
  416. drivers/nvme/host/pci.c +0 −3
  417. drivers/nvme/target/tcp.c +1 −1
  418. drivers/parisc/ccio-dma.c +9 −9
  419. drivers/parisc/iommu-helpers.h +4 −4
  420. drivers/parisc/iosapic.c +2 −2
  421. drivers/parisc/iosapic_private.h +2 −2
  422. drivers/parisc/sba_iommu.c +16 −22
  423. drivers/pci/pcie/aer.c +1 −0
  424. drivers/pci/pcie/portdrv.h +0 −2
  425. drivers/platform/mellanox/Kconfig +3 −2
  426. drivers/platform/mellanox/mlxbf-pmc.c +14 −27
  427. drivers/platform/mellanox/mlxbf-tmfifo.c +66 −24
  428. drivers/platform/x86/asus-nb-wmi.c +9 −0
  429. drivers/platform/x86/intel_scu_ipc.c +40 −26
  430. drivers/platform/x86/thinkpad_acpi.c +2 −0
  431. drivers/pmdomain/Makefile +0 −0
  432. drivers/pmdomain/actions/Makefile +0 −0
  433. drivers/pmdomain/actions/owl-sps-helper.c +0 −0
  434. drivers/pmdomain/actions/owl-sps.c +0 −0
  435. drivers/pmdomain/amlogic/Makefile +0 −0
  436. drivers/pmdomain/amlogic/meson-ee-pwrc.c +0 −0
  437. drivers/pmdomain/amlogic/meson-gx-pwrc-vpu.c +0 −0
  438. drivers/pmdomain/amlogic/meson-secure-pwrc.c +0 −0
  439. drivers/pmdomain/apple/Makefile +0 −0
  440. drivers/pmdomain/apple/pmgr-pwrstate.c +0 −0
  441. drivers/pmdomain/bcm/Makefile +0 −0
  442. drivers/pmdomain/bcm/bcm-pmb.c +0 −0
  443. drivers/pmdomain/bcm/bcm2835-power.c +0 −0
  444. drivers/pmdomain/bcm/bcm63xx-power.c +0 −0
  445. drivers/pmdomain/bcm/raspberrypi-power.c +0 −0
  446. drivers/pmdomain/imx/Makefile +0 −0
  447. drivers/pmdomain/imx/gpc.c +0 −0
  448. drivers/pmdomain/imx/gpcv2.c +0 −0
  449. drivers/pmdomain/imx/imx8m-blk-ctrl.c +0 −0
  450. drivers/pmdomain/imx/imx8mp-blk-ctrl.c +0 −0
  451. drivers/pmdomain/imx/imx93-blk-ctrl.c +0 −0
  452. drivers/pmdomain/imx/imx93-pd.c +0 −0
  453. drivers/pmdomain/imx/scu-pd.c +0 −0
  454. drivers/pmdomain/mediatek/Makefile +0 −0
  455. drivers/pmdomain/mediatek/mt6795-pm-domains.h +0 −0
  456. drivers/pmdomain/mediatek/mt8167-pm-domains.h +0 −0
  457. drivers/pmdomain/mediatek/mt8173-pm-domains.h +0 −0
  458. drivers/pmdomain/mediatek/mt8183-pm-domains.h +0 −0
  459. drivers/pmdomain/mediatek/mt8186-pm-domains.h +0 −0
  460. drivers/pmdomain/mediatek/mt8188-pm-domains.h +0 −0
  461. drivers/pmdomain/mediatek/mt8192-pm-domains.h +0 −0
  462. drivers/pmdomain/mediatek/mt8195-pm-domains.h +0 −0
  463. drivers/pmdomain/mediatek/mtk-pm-domains.c +0 −0
  464. drivers/pmdomain/mediatek/mtk-pm-domains.h +0 −0
  465. drivers/pmdomain/mediatek/mtk-scpsys.c +0 −0
  466. drivers/pmdomain/qcom/Makefile +0 −0
  467. drivers/pmdomain/qcom/cpr.c +0 −0
  468. drivers/pmdomain/qcom/rpmhpd.c +0 −0
  469. drivers/pmdomain/qcom/rpmpd.c +0 −0
  470. drivers/pmdomain/renesas/Makefile +0 −0
  471. drivers/pmdomain/renesas/r8a7742-sysc.c +0 −0
  472. drivers/pmdomain/renesas/r8a7743-sysc.c +0 −0
  473. drivers/pmdomain/renesas/r8a7745-sysc.c +0 −0
  474. drivers/pmdomain/renesas/r8a77470-sysc.c +0 −0
  475. drivers/pmdomain/renesas/r8a774a1-sysc.c +0 −0
  476. drivers/pmdomain/renesas/r8a774b1-sysc.c +0 −0
  477. drivers/pmdomain/renesas/r8a774c0-sysc.c +0 −0
  478. drivers/pmdomain/renesas/r8a774e1-sysc.c +0 −0
  479. drivers/pmdomain/renesas/r8a7779-sysc.c +0 −0
  480. drivers/pmdomain/renesas/r8a7790-sysc.c +0 −0
  481. drivers/pmdomain/renesas/r8a7791-sysc.c +0 −0
  482. drivers/pmdomain/renesas/r8a7792-sysc.c +0 −0
  483. drivers/pmdomain/renesas/r8a7794-sysc.c +0 −0
  484. drivers/pmdomain/renesas/r8a7795-sysc.c +0 −0
  485. drivers/pmdomain/renesas/r8a7796-sysc.c +0 −0
  486. drivers/pmdomain/renesas/r8a77965-sysc.c +0 −0
  487. drivers/pmdomain/renesas/r8a77970-sysc.c +0 −0
  488. drivers/pmdomain/renesas/r8a77980-sysc.c +0 −0
  489. drivers/pmdomain/renesas/r8a77990-sysc.c +0 −0
  490. drivers/pmdomain/renesas/r8a77995-sysc.c +0 −0
  491. drivers/pmdomain/renesas/r8a779a0-sysc.c +0 −0
  492. drivers/pmdomain/renesas/r8a779f0-sysc.c +0 −0
  493. drivers/pmdomain/renesas/r8a779g0-sysc.c +0 −0
  494. drivers/pmdomain/renesas/rcar-gen4-sysc.c +0 −0
  495. drivers/pmdomain/renesas/rcar-gen4-sysc.h +0 −0
  496. drivers/pmdomain/renesas/rcar-sysc.c +0 −0
  497. drivers/pmdomain/renesas/rcar-sysc.h +0 −0
  498. drivers/pmdomain/renesas/rmobile-sysc.c +0 −0
  499. drivers/pmdomain/rockchip/Makefile +0 −0
  500. drivers/pmdomain/rockchip/pm-domains.c +0 −0
  501. drivers/pmdomain/samsung/Makefile +0 −0
  502. drivers/pmdomain/samsung/exynos-pm-domains.c +0 −0
  503. drivers/pmdomain/st/Makefile +0 −0
  504. drivers/pmdomain/st/ste-ux500-pm-domain.c +0 −0
  505. drivers/pmdomain/starfive/Makefile +0 −0
  506. drivers/pmdomain/starfive/jh71xx-pmu.c +0 −0
  507. drivers/pmdomain/sunxi/Makefile +0 −0
  508. drivers/pmdomain/sunxi/sun20i-ppu.c +0 −0
  509. drivers/pmdomain/tegra/Makefile +0 −0
  510. drivers/pmdomain/tegra/powergate-bpmp.c +0 −0
  511. drivers/pmdomain/ti/Makefile +0 −0
  512. drivers/pmdomain/ti/omap_prm.c +0 −0
  513. drivers/pmdomain/ti/ti_sci_pm_domains.c +0 −0
  514. drivers/pmdomain/xilinx/Makefile +0 −0
  515. drivers/pmdomain/xilinx/zynqmp-pm-domains.c +0 −0
  516. drivers/power/reset/Kconfig +1 −1
  517. drivers/power/reset/pwr-mlxbf.c +1 −1
  518. drivers/power/reset/vexpress-poweroff.c +1 −1
  519. drivers/power/supply/Kconfig +1 −0
  520. drivers/power/supply/ab8500_btemp.c +1 −8
  521. drivers/power/supply/ab8500_chargalg.c +1 −1
  522. drivers/power/supply/mt6370-charger.c +1 −1
  523. drivers/power/supply/power_supply_sysfs.c +7 −0
  524. drivers/power/supply/rk817_charger.c +13 −3
  525. drivers/power/supply/rt9467-charger.c +2 −2
  526. drivers/power/supply/ucs1002_power.c +2 −1
  527. drivers/regulator/helpers.c +1 −1
  528. drivers/scsi/iscsi_tcp.c +4 −0
  529. drivers/scsi/lpfc/lpfc_debugfs.c +7 −7
  530. drivers/scsi/lpfc/lpfc_hbadisc.c +3 −2
  531. drivers/scsi/lpfc/lpfc_nvme.c +17 −7
  532. drivers/scsi/megaraid/megaraid_sas.h +1 −1
  533. drivers/scsi/megaraid/megaraid_sas_base.c +9 −12
  534. drivers/scsi/pm8001/pm8001_hwi.c +1 −1
  535. drivers/scsi/pm8001/pm8001_init.c +17 −34
  536. drivers/scsi/pm8001/pm80xx_hwi.c +3 −1
  537. drivers/scsi/ppa.c +2 −2
  538. drivers/scsi/qedf/qedf_io.c +8 −2
  539. drivers/scsi/qedf/qedf_main.c +6 −1
  540. drivers/scsi/qla2xxx/qla_dfs.c +3 −3
  541. drivers/scsi/qla2xxx/qla_inline.h +1 −1
  542. drivers/scsi/qla2xxx/qla_isr.c +3 −3
  543. drivers/scsi/qla2xxx/qla_nvme.c +5 −5
  544. drivers/scsi/qla2xxx/qla_target.c +1 −2
  545. drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 −2
  546. drivers/scsi/scsi.c +11 −0
  547. drivers/scsi/scsi_scan.c +18 −2
  548. drivers/scsi/sd.c +82 −19
  549. drivers/scsi/sd.h +1 −0
  550. drivers/soc/imx/soc-imx8m.c +10 −0
  551. drivers/soc/loongson/Kconfig +1 −0
  552. drivers/soc/loongson/loongson2_guts.c +2 −4
  553. drivers/soc/loongson/loongson2_pm.c +6 −1
  554. drivers/spi/spi-cs42l43.c +0 −1
  555. drivers/spi/spi-gxp.c +1 −1
  556. drivers/spi/spi-imx.c +1 −1
  557. drivers/spi/spi-intel-pci.c +1 −0
  558. drivers/spi/spi-nxp-fspi.c +7 −0
  559. drivers/spi/spi-stm32.c +8 −0
  560. drivers/spi/spi-zynqmp-gqspi.c +8 −4
  561. drivers/target/target_core_configfs.c +12 −12
  562. drivers/target/target_core_transport.c +1 −0
  563. drivers/tee/optee/optee_private.h +0 −2
  564. drivers/tee/tee_private.h +0 −2
  565. drivers/thermal/thermal_core.c +4 −2
  566. drivers/thermal/thermal_of.c +6 −2
  567. drivers/thermal/thermal_sysfs.c +5 −4
  568. drivers/thermal/ti-soc-thermal/ti-thermal-common.c +2 −1
  569. drivers/tty/n_gsm.c +1 −3
  570. drivers/tty/serial/8250/8250_port.c +4 −1
  571. drivers/ufs/core/ufshcd.c +7 −6
  572. drivers/usb/typec/ucsi/debugfs.c +3 −0
  573. drivers/vfio/mdev/mdev_sysfs.c +2 −1
  574. drivers/vfio/pci/pds/Kconfig +1 −1
  575. drivers/vfio/pci/pds/vfio_dev.c +1 −1
  576. drivers/video/console/Kconfig +1 −0
  577. drivers/video/fbdev/Kconfig +1 −1
  578. drivers/video/fbdev/core/Kconfig +1 −1
  579. drivers/w1/masters/ds2482.c +1 −1
  580. drivers/xen/events/events_base.c +2 −19
  581. drivers/xen/platform-pci.c +1 −1
  582. fs/aio.c +1 −1
  583. fs/binfmt_elf_fdpic.c +2 −3
  584. fs/btrfs/Kconfig +1 −1
  585. fs/btrfs/block-group.c +10 −2
  586. fs/btrfs/delayed-inode.c +71 −33
  587. fs/btrfs/delayed-ref.c +35 −11
  588. fs/btrfs/delayed-ref.h +0 −1
  589. fs/btrfs/disk-io.c +12 −10
  590. fs/btrfs/extent-tree.c +10 −8
  591. fs/btrfs/extent_io.c +8 −9
  592. fs/btrfs/file.c +34 −6
  593. fs/btrfs/inode.c +23 −10
  594. fs/btrfs/ioctl.c +7 −1
  595. fs/btrfs/locking.h +1 −1
  596. fs/btrfs/ordered-data.c +1 −1
  597. fs/btrfs/super.c +3 −4
  598. fs/btrfs/transaction.c +27 −18
  599. fs/btrfs/transaction.h +1 −0
  600. fs/btrfs/tree-log.c +1 −1
  601. fs/btrfs/verity.c +31 −33
  602. fs/btrfs/volumes.c +6 −7
  603. fs/buffer.c +24 −12
  604. fs/ceph/crypto.c +2 −4
  605. fs/efivarfs/super.c +10 −4
  606. fs/ext4/mballoc.c +33 −21
  607. fs/ext4/namei.c +15 −11
  608. fs/ext4/super.c +1 −1
  609. fs/fs-writeback.c +8 −3
  610. fs/gfs2/glock.c +3 −1
  611. fs/gfs2/glops.c +5 −4
  612. fs/gfs2/quota.h +2 −1
  613. fs/inode.c +3 −79
  614. fs/iomap/buffered-io.c +19 −13
  615. fs/jbd2/commit.c +6 −10
  616. fs/jbd2/journal.c +2 −0
  617. fs/jbd2/transaction.c +4 −8
  618. fs/libfs.c +1 −0
  619. fs/netfs/buffered_read.c +5 −1
  620. fs/nfs/direct.c +93 −41
  621. fs/nfs/flexfilelayout/flexfilelayout.c +1 −0
  622. fs/nfs/nfs4client.c +5 −1
  623. fs/nfs/nfs4proc.c +5 −1
  624. fs/nfs/write.c +12 −11
  625. fs/nfsd/nfs4proc.c +2 −2
  626. fs/nfsd/nfs4xdr.c +2 −2
  627. fs/nfsd/nfssvc.c +3 −2
  628. fs/nilfs2/gcinode.c +3 −3
  629. fs/ntfs3/super.c +1 −0
  630. fs/overlayfs/copy_up.c +3 −2
  631. fs/overlayfs/file.c +9 −6
  632. fs/pipe.c +0 −1
  633. fs/proc/internal.h +0 −2
  634. fs/proc/task_nommu.c +37 −27
  635. fs/reiserfs/reiserfs.h +3 −3
  636. fs/smb/client/cached_dir.c +6 −0
  637. fs/smb/client/cifsglob.h +2 −1
  638. fs/smb/client/cifsproto.h +1 −1
  639. fs/smb/client/connect.c +6 −2
  640. fs/smb/client/fs_context.c +1 −0
  641. fs/smb/client/inode.c +1 −1
  642. fs/smb/client/misc.c +9 −5
  643. fs/smb/client/smb2inode.c +3 −0
  644. fs/smb/client/smb2maperror.c +0 −2
  645. fs/smb/client/smb2ops.c +3 −3
  646. fs/smb/client/smb2pdu.c +21 −14
  647. fs/smb/client/smbdirect.c +6 −3
  648. fs/smb/client/trace.h +2 −0
  649. fs/smb/client/transport.c +24 −12
  650. fs/smb/server/connection.c +3 −0
  651. fs/smb/server/server.c +3 −1
  652. fs/smb/server/smb2misc.c +1 −3
  653. fs/smb/server/smb2pdu.c +1 −1
  654. fs/smb/server/smbacl.c +0 −1
  655. fs/stat.c +2 −45
  656. fs/tracefs/event_inode.c +122 −24
  657. fs/tracefs/inode.c +4 −1
  658. fs/tracefs/internal.h +3 −2
  659. fs/xfs/Kconfig +1 −1
  660. fs/xfs/libxfs/xfs_log_recover.h +22 −0
  661. fs/xfs/libxfs/xfs_sb.c +2 −1
  662. fs/xfs/libxfs/xfs_trans_inode.c +3 −3
  663. fs/xfs/scrub/scrub.c +2 −2
  664. fs/xfs/scrub/stats.c +4 −1
  665. fs/xfs/xfs_attr_inactive.c +0 −1
  666. fs/xfs/xfs_attr_item.c +4 −3
  667. fs/xfs/xfs_bmap_item.c +3 −1
  668. fs/xfs/xfs_export.c +14 −0
  669. fs/xfs/xfs_extfree_item.c +3 −1
  670. fs/xfs/xfs_fsmap.c +18 −7
  671. fs/xfs/xfs_icache.c +29 −51
  672. fs/xfs/xfs_icache.h +0 −1
  673. fs/xfs/xfs_inode.c +218 −13
  674. fs/xfs/xfs_inode.h +32 −2
  675. fs/xfs/xfs_iops.c +3 −3
  676. fs/xfs/xfs_itable.c +11 −0
  677. fs/xfs/xfs_log.c +0 −17
  678. fs/xfs/xfs_log_cil.c +16 −36
  679. fs/xfs/xfs_log_priv.h +6 −8
  680. fs/xfs/xfs_log_recover.c +2 −2
  681. fs/xfs/xfs_mount.h +13 −4
  682. fs/xfs/xfs_qm.c +16 −0
  683. fs/xfs/xfs_refcount_item.c +4 −2
  684. fs/xfs/xfs_rmap_item.c +4 −2
  685. fs/xfs/xfs_super.c +3 −85
  686. fs/xfs/xfs_trace.h +45 −0
  687. fs/xfs/xfs_xattr.c +11 −0
  688. include/asm-generic/hugetlb.h +1 −1
  689. include/asm-generic/vmlinux.lds.h +0 −7
  690. include/drm/drm_exec.h +31 −4
  691. include/drm/drm_kunit_helpers.h +3 −1
  692. include/linux/aer.h +2 −0
  693. include/linux/arm-smccc.h +2 −0
  694. include/linux/atomic/atomic-arch-fallback.h +1 −9
  695. include/linux/btf_ids.h +1 −1
  696. include/linux/buffer_head.h +4 −1
  697. include/linux/ceph/ceph_fs.h +11 −13
  698. include/linux/cpuhotplug.h +0 −1
  699. include/linux/export-internal.h +2 −0
  700. include/linux/fs.h +2 −44
  701. include/linux/hugetlb.h +4 −2
  702. include/linux/i2c.h +1 −10
  703. include/linux/if_team.h +2 −0
  704. include/linux/instruction_pointer.h +5 −0
  705. include/linux/interrupt.h +5 −1
  706. include/linux/kasan.h +1 −1
  707. include/linux/libata.h +11 −3
  708. include/linux/maple_tree.h +11 −0
  709. include/linux/memcontrol.h +2 −2
  710. include/linux/nfs_fs_sb.h +1 −0
  711. include/linux/nfs_page.h +3 −1
  712. include/linux/nvme-fc-driver.h +3 −3
  713. include/linux/pgtable.h +9 −1
  714. include/linux/resume_user_mode.h +1 −1
  715. include/linux/seqlock.h +1 −1
  716. include/linux/sunrpc/xdr.h +3 −1
  717. include/linux/swiotlb.h +16 −7
  718. include/linux/thermal.h +2 −2
  719. include/linux/trace_events.h +3 −4
  720. include/net/ipv6.h +6 −1
  721. include/net/netfilter/nf_tables.h +4 −3
  722. include/scsi/scsi.h +3 −0
  723. include/scsi/scsi_device.h +4 −1
  724. include/scsi/scsi_host.h +1 −1
  725. include/trace/events/xen.h +6 −6
  726. include/uapi/linux/bpf.h +3 −1
  727. include/uapi/linux/stddef.h +7 −0
  728. include/xen/arm/hypervisor.h +0 −12
  729. include/xen/events.h +1 −2
  730. io_uring/fs.c +1 −1
  731. io_uring/net.c +5 −0
  732. kernel/bpf/btf.c +1 −1
  733. kernel/bpf/cgroup.c +7 −6
  734. kernel/bpf/memalloc.c +90 −4
  735. kernel/bpf/offload.c +7 −5
  736. kernel/bpf/queue_stack_maps.c +18 −3
  737. kernel/crash_core.c +17 −0
  738. kernel/dma/swiotlb.c +22 −9
  739. kernel/panic.c +1 −0
  740. kernel/pid.c +1 −1
  741. kernel/power/hibernate.c +6 −6
  742. kernel/power/power.h +2 −2
  743. kernel/power/swap.c +8 −6
  744. kernel/sched/core.c +1 −1
  745. kernel/sched/cpufreq_schedutil.c +2 −1
  746. kernel/sched/cpupri.c +1 −0
  747. kernel/sched/fair.c +38 −5
  748. kernel/sched/idle.c +1 −0
  749. kernel/task_work.c +1 −0
  750. kernel/trace/bpf_trace.c +19 −1
  751. kernel/trace/ring_buffer.c +25 −13
  752. kernel/trace/trace.c +63 −9
  753. kernel/trace/trace.h +2 −0
  754. kernel/trace/trace_events.c +14 −19
  755. kernel/trace/trace_events_inject.c +2 −1
  756. kernel/trace/trace_events_synth.c +1 −1
  757. kernel/trace/trace_events_user.c +51 −7
  758. kernel/workqueue.c +3 −6
  759. lib/argv_split.c +2 −2
  760. lib/kunit/executor.c +33 −15
  761. lib/kunit/executor_test.c +8 −5
  762. lib/kunit/test.c +2 −1
  763. lib/maple_tree.c +163 −58
  764. lib/scatterlist.c +3 −1
  765. lib/test_maple_tree.c +72 −15
  766. mm/damon/vaddr-test.h +2 −0
  767. mm/damon/vaddr.c +2 −1
  768. mm/filemap.c +50 −23
  769. mm/hugetlb.c +24 −19
  770. mm/kasan/kasan.h +3 −5
  771. mm/memcontrol.c +16 −3
  772. mm/mempolicy.c +19 −20
  773. mm/migrate.c +5 −2
  774. mm/mremap.c +1 −1
  775. mm/page_alloc.c +6 −6
  776. mm/rmap.c +18 −5
  777. mm/shmem.c +1 −1
  778. mm/slab_common.c +18 −18
  779. mm/vmalloc.c +1 −1
  780. mm/zswap.c +20 −0
  781. net/ax25/Kconfig +8 −8
  782. net/bridge/br_forward.c +2 −2
  783. net/bridge/br_input.c +2 −2
  784. net/core/dev.c +3 −3
  785. net/core/flow_dissector.c +1 −1
  786. net/dccp/ipv4.c +2 −7
  787. net/dccp/ipv6.c +2 −7
  788. net/handshake/handshake-test.c +7 −7
  789. net/hsr/hsr_forward.c +1 −0
  790. net/hsr/hsr_framereg.c +2 −2
  791. net/hsr/hsr_main.h +1 −1
  792. net/ipv4/devinet.c +5 −5
  793. net/ipv4/inet_hashtables.c +20 −16
  794. net/ipv4/route.c +3 −1
  795. net/kcm/kcmsock.c +8 −5
  796. net/mptcp/options.c +3 −2
  797. net/mptcp/protocol.c +102 −63
  798. net/mptcp/protocol.h +23 −1
  799. net/mptcp/subflow.c +2 −37
  800. net/ncsi/ncsi-aen.c +5 −0
  801. net/netfilter/ipset/ip_set_core.c +10 −2
  802. net/netfilter/nf_conntrack_bpf.c +2 −0
  803. net/netfilter/nf_conntrack_extend.c +2 −2
  804. net/netfilter/nf_tables_api.c +59 −20
  805. net/netfilter/nft_set_hash.c +4 −7
  806. net/netfilter/nft_set_pipapo.c +2 −2
  807. net/netfilter/nft_set_rbtree.c +3 −5
  808. net/rds/rdma_transport.c +7 −5
  809. net/smc/smc_core.c +2 −0
  810. net/smc/smc_stats.h +2 −1
  811. net/sunrpc/clnt.c +9 −5
  812. net/tls/tls_sw.c +2 −2
  813. scripts/Makefile.modinst +2 −2
  814. scripts/atomic/gen-atomic-fallback.sh +1 −1
  815. scripts/gdb/linux/symbols.py +2 −21
  816. scripts/mod/file2alias.c +1 −1
  817. scripts/mod/modpost.c +22 −2
  818. scripts/package/builddeb +0 −1
  819. scripts/package/install-extmod-build +1 −1
  820. scripts/package/kernel.spec +0 −3
  821. security/selinux/hooks.c +8 −2
  822. sound/core/init.c +2 −5
  823. sound/core/rawmidi.c +1 −1
  824. sound/core/seq/seq_midi.c +2 −2
  825. sound/core/seq/seq_ump_client.c +23 −1
  826. sound/core/seq/seq_ump_convert.c +2 −0
  827. sound/firewire/bebob/bebob_midi.c +3 −3
  828. sound/firewire/dice/dice-midi.c +2 −2
  829. sound/firewire/digi00x/digi00x-midi.c +7 −7
  830. sound/firewire/fireface/ff-midi.c +2 −2
  831. sound/firewire/fireworks/fireworks.c +5 −5
  832. sound/firewire/fireworks/fireworks_midi.c +2 −2
  833. sound/firewire/motu/motu-midi.c +2 −2
  834. sound/firewire/oxfw/oxfw-midi.c +3 −3
  835. sound/firewire/oxfw/oxfw.c +5 −5
  836. sound/firewire/tascam/tascam-midi.c +6 −6
  837. sound/hda/intel-sdw-acpi.c +4 −4
  838. sound/isa/ad1848/ad1848.c +6 −6
  839. sound/isa/cs423x/cs4231.c +6 −6
  840. sound/isa/cs423x/cs4236.c +7 −7
  841. sound/isa/es1688/es1688.c +3 −3
  842. sound/isa/opti9xx/miro.c +4 −4
  843. sound/isa/opti9xx/opti92x-ad1848.c +8 −8
  844. sound/isa/sscape.c +1 −1
  845. sound/pci/cmipci.c +5 −3
  846. sound/pci/hda/cs35l56_hda.c +10 −11
  847. sound/pci/hda/cs35l56_hda_i2c.c +0 −1
  848. sound/pci/hda/hda_generic.c +5 −1
  849. sound/pci/hda/hda_intel.c +1 −0
  850. sound/pci/hda/patch_realtek.c +10 −3
  851. sound/pci/riptide/riptide.c +8 −8
  852. sound/soc/amd/yc/acp6x-mach.c +21 −0
  853. sound/soc/codecs/aw88395/aw88395_lib.c +2 −0
  854. sound/soc/codecs/cs35l56-i2c.c +0 −1
  855. sound/soc/codecs/cs35l56.c +1 −0
  856. sound/soc/codecs/cs42l42-sdw.c +20 −0
  857. sound/soc/codecs/cs42l42.c +20 −1
  858. sound/soc/codecs/cs42l42.h +1 −0
  859. sound/soc/codecs/cs42l43.c +8 −6
  860. sound/soc/codecs/rt5640.c +12 −17
  861. sound/soc/codecs/wm8960.c +14 −5
  862. sound/soc/codecs/wm_adsp.c +11 −2
  863. sound/soc/fsl/imx-audmix.c +1 −1
  864. sound/soc/fsl/imx-pcm-rpmsg.c +1 −0
  865. sound/soc/fsl/imx-rpmsg.c +8 −0
  866. sound/soc/intel/avs/boards/hdaudio.c +3 −0
  867. sound/soc/meson/axg-spdifin.c +17 −32
  868. sound/soc/sh/rcar/core.c +1 −0
  869. sound/soc/soc-pcm.c +11 −12
  870. sound/soc/soc-utils.c +1 −0
  871. sound/soc/sof/core.c +1 −2
  872. sound/soc/sof/intel/mtl.c +1 −1
  873. sound/soc/sof/intel/mtl.h +0 −1
  874. sound/soc/sof/ipc4-topology.c +1 −1
  875. sound/soc/sof/sof-audio.c +2 −1
  876. sound/soc/tegra/tegra_audio_graph_card.c +17 −13
  877. sound/usb/caiaq/device.c +1 −1
  878. sound/usb/mixer.c +2 −4
  879. sound/usb/mixer_scarlett_gen2.c +4 −4
  880. sound/xen/xen_snd_front_cfg.c +1 −1
  881. tools/arch/x86/include/asm/msr-index.h +12 −0
  882. tools/include/linux/btf_ids.h +1 −1
  883. tools/include/linux/mm.h +1 −3
  884. tools/include/linux/seq_file.h +2 −0
  885. tools/include/uapi/asm-generic/unistd.h +4 −1
  886. tools/include/uapi/drm/drm.h +69 −15
  887. tools/include/uapi/linux/bpf.h +3 −1
  888. tools/include/uapi/linux/seccomp.h +157 −0
  889. tools/objtool/check.c +2 −1
  890. tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl +1 −0
  891. tools/perf/arch/powerpc/entry/syscalls/syscall.tbl +1 −0
  892. tools/perf/arch/s390/entry/syscalls/syscall.tbl +1 −0
  893. tools/perf/arch/x86/entry/syscalls/syscall_64.tbl +2 −0
  894. tools/perf/bench/sched-seccomp-notify.c +1 −1
  895. tools/perf/check-headers.sh +1 −0
  896. tools/perf/pmu-events/jevents.py +1 −1
  897. tools/perf/pmu-events/metric.py +2 −2
  898. tools/perf/util/bpf-prologue.c +0 −508
  899. tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +2 −0
  900. tools/perf/util/hashmap.h +0 −10
  901. tools/perf/util/pmu.c +1 −1
  902. tools/testing/memblock/internal.h +4 −0
  903. tools/testing/memblock/mmzone.c +1 −1
  904. tools/testing/memblock/tests/basic_api.c +1 −1
  905. tools/testing/memblock/tests/common.h +1 −0
  906. tools/testing/selftests/alsa/conf.c +0 −1
  907. tools/testing/selftests/alsa/mixer-test.c +3 −8
  908. tools/testing/selftests/alsa/pcm-test.c +2 −2
  909. tools/testing/selftests/alsa/test-pcmtest-driver.c +0 −1
  910. tools/testing/selftests/bpf/DENYLIST.aarch64 +2 −8
  911. tools/testing/selftests/bpf/config +1 −0
  912. tools/testing/selftests/bpf/config.x86_64 +0 −1
  913. tools/testing/selftests/bpf/prog_tests/empty_skb.c +10 −2
  914. tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c +37 −0
  915. tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c +50 −0
  916. tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only.c +61 −0
  917. tools/testing/selftests/bpf/progs/kprobe_multi_override.c +13 −0
  918. tools/testing/selftests/bpf/progs/test_bpf_ma.c +123 −0
  919. tools/testing/selftests/bpf/test_verifier.c +1 −1
  920. tools/testing/selftests/fchmodat2/Makefile +1 −1
  921. tools/testing/selftests/ftrace/ftracetest +17 −1
  922. tools/testing/selftests/ftrace/test.d/instances/instance-event.tc +1 −1
  923. tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc +1 −1
  924. tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic_event_syntax_errors.tc +1 −1
  925. tools/testing/selftests/kselftest/runner.sh +2 −1
  926. tools/testing/selftests/kselftest_deps.sh +65 −12
  927. tools/testing/selftests/kvm/lib/test_util.c +1 −1
  928. tools/testing/selftests/kvm/riscv/get-reg-list.c +42 −16
  929. tools/testing/selftests/lib.mk +2 −2
  930. tools/testing/selftests/mm/charge_reserved_hugetlb.sh +2 −2
  931. tools/testing/selftests/mm/hugetlb_reparenting_test.sh +2 −2
  932. tools/testing/selftests/net/bind_bhash.sh +14 −12
  933. tools/testing/selftests/net/bind_wildcard.c +57 −11
  934. tools/testing/selftests/net/hsr/hsr_ping.sh +143 −123
  935. tools/testing/selftests/net/tls.c +4 −4
  936. tools/testing/selftests/netfilter/.gitignore +1 −0
  937. tools/testing/selftests/netfilter/Makefile +2 −2
  938. tools/testing/selftests/netfilter/audit_logread.c +165 −0
  939. tools/testing/selftests/netfilter/config +1 −0
  940. tools/testing/selftests/netfilter/nft_audit.sh +108 −0
  941. tools/testing/selftests/openat2/Makefile +1 −1
  942. tools/testing/selftests/powerpc/Makefile +3 −4
  943. tools/testing/selftests/powerpc/pmu/Makefile +6 −5
  944. tools/testing/selftests/proc/proc-empty-vm.c +1 −0
  945. tools/testing/selftests/user_events/abi_test.c +5 −0
  946. tools/testing/selftests/user_events/config +1 −0
  947. tools/testing/selftests/user_events/dyn_test.c +5 −0
  948. tools/testing/selftests/user_events/ftrace_test.c +6 −0
  949. tools/testing/selftests/user_events/perf_test.c +6 −0
  950. tools/testing/selftests/user_events/user_events_selftests.h +114 −0
Documentation/admin-guide/cgroup-v1/memory.rst+7−0
@@ -92,6 +92,13 @@ Brief summary of control files. · 91 unmodified lines
9292 memory.oom_control set/show oom controls.
9393 memory.numa_stat show the number of memory usage per numa
9494 node
95+ memory.kmem.limit_in_bytes Deprecated knob to set and read the kernel
96+ memory hard limit. Kernel hard limit is not
97+ supported since 5.16. Writing any value to
98+ do file will not have any effect same as if
99+ nokmem kernel parameter was specified.
100+ Kernel memory is still charged and reported
101+ by memory.kmem.usage_in_bytes.
95102 memory.kmem.usage_in_bytes show current kernel memory allocation
96103 memory.kmem.failcnt show the number of kernel memory usage
97104 hits limits
Documentation/arch/arm64/cpu-feature-registers.rst+12−0
@@ -175,6 +175,8 @@ infrastructure: · 174 unmodified lines
175175 +------------------------------+---------+---------+
176176 | Name | bits | visible |
177177 +------------------------------+---------+---------+
178+ | SME | [27-24] | y |
179+ +------------------------------+---------+---------+
178180 | MTE | [11-8] | y |
179181 +------------------------------+---------+---------+
180182 | SSBS | [7-4] | y |
@@ -288,8 +290,18 @@ infrastructure: · 107 unmodified lines
288290 +------------------------------+---------+---------+
289291 | Name | bits | visible |
290292 +------------------------------+---------+---------+
293+ | CSSC | [55-52] | y |
294+ +------------------------------+---------+---------+
295+ | RPRFM | [51-48] | y |
296+ +------------------------------+---------+---------+
297+ | BC | [23-20] | y |
298+ +------------------------------+---------+---------+
291299 | MOPS | [19-16] | y |
292300 +------------------------------+---------+---------+
301+ | APA3 | [15-12] | y |
302+ +------------------------------+---------+---------+
303+ | GPA3 | [11-8] | y |
304+ +------------------------------+---------+---------+
293305 | RPRES | [7-4] | y |
294306 +------------------------------+---------+---------+
295307 | WFXT | [3-0] | y |
Documentation/arch/arm64/elf_hwcaps.rst+3−0
@@ -305,6 +305,9 @@ HWCAP2_SMEF16F16 · 304 unmodified lines
305305 HWCAP2_MOPS
306306 Functionality implied by ID_AA64ISAR2_EL1.MOPS == 0b0001.
307307
308+HWCAP2_HBC
309+ Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001.
310+
308311 4. Unused AT_HWCAP bits
309312 -----------------------
310313
Documentation/arch/loongarch/introduction.rst+2−2
@@ -381,9 +381,9 @@ Documentation of LoongArch ISA: · 380 unmodified lines
381381
382382 Documentation of LoongArch ELF psABI:
383383
384− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-CN.pdf (in Chinese)
384+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-CN.pdf (in Chinese)
385385
386− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-EN.pdf (in English)
386+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-EN.pdf (in English)
387387
388388 Linux kernel repository of Loongson and LoongArch:
389389
Documentation/devicetree/bindings/ata/pata-common.yaml+1−0
@@ -38,6 +38,7 @@ patternProperties: · 37 unmodified lines
3838 ID number 0 and the slave drive will have ID number 1. The PATA port
3939 nodes will be named "ide-port".
4040 type: object
41+ additionalProperties: false
4142
4243 properties:
4344 reg:
Documentation/devicetree/bindings/clock/renesas,5p35023.yaml+7−4
@@ -37,6 +37,9 @@ properties: · 36 unmodified lines
3737 maxItems: 1
3838
3939 '#clock-cells':
40+ description:
41+ The index in the assigned-clocks is mapped to the output clock as below
42+ 0 - REF, 1 - SE1, 2 - SE2, 3 - SE3, 4 - DIFF1, 5 - DIFF2.
4043 const: 1
4144
4245 clocks:
@@ -68,7 +71,7 @@ examples: · 25 unmodified lines
6871 reg = <0x68>;
6972 #clock-cells = <1>;
7073
71− clocks = <&x1_x2>;
74+ clocks = <&x1>;
7275
7376 renesas,settings = [
7477 80 00 11 19 4c 02 23 7f 83 19 08 a9 5f 25 24 bf
@@ -79,8 +82,8 @@ examples: · 4 unmodified lines
7982 assigned-clocks = <&versa3 0>, <&versa3 1>,
8083 <&versa3 2>, <&versa3 3>,
8184 <&versa3 4>, <&versa3 5>;
82− assigned-clock-rates = <12288000>, <25000000>,
83− <12000000>, <11289600>,
84− <11289600>, <24000000>;
85+ assigned-clock-rates = <24000000>, <11289600>,
86+ <11289600>, <12000000>,
87+ <25000000>, <12288000>;
8588 };
8689 };
Documentation/devicetree/bindings/i2c/i2c-mxs.yaml+4−1
@@ -9,6 +9,9 @@ title: Freescale MXS Inter IC (I2C) Controller · 8 unmodified lines
99 maintainers:
1010 - Shawn Guo <shawnguo@kernel.org>
1111
12+allOf:
13+ - $ref: /schemas/i2c/i2c-controller.yaml#
14+
1215 properties:
1316 compatible:
1417 enum:
@@ -37,7 +40,7 @@ required: · 22 unmodified lines
3740 - dmas
3841 - dma-names
3942
40−additionalProperties: false
43+unevaluatedProperties: false
4144
4245 examples:
4346 - |
Documentation/devicetree/bindings/soc/loongson/loongson,ls2k-pmc.yaml+37−6
@@ -11,11 +11,16 @@ maintainers: · 10 unmodified lines
1111
1212 properties:
1313 compatible:
14− items:
15− - enum:
16− - loongson,ls2k0500-pmc
17− - loongson,ls2k1000-pmc
18− - const: syscon
14+ oneOf:
15+ - items:
16+ - const: loongson,ls2k0500-pmc
17+ - const: syscon
18+ - items:
19+ - enum:
20+ - loongson,ls2k1000-pmc
21+ - loongson,ls2k2000-pmc
22+ - const: loongson,ls2k0500-pmc
23+ - const: syscon
1924
2025 reg:
2126 maxItems: 1
@@ -32,6 +37,18 @@ properties: · 10 unmodified lines
3237 addition, the PM need according to it to indicate that current
3338 SoC whether support Suspend To RAM.
3439
40+ syscon-poweroff:
41+ $ref: /schemas/power/reset/syscon-poweroff.yaml#
42+ type: object
43+ description:
44+ Node for power off method
45+
46+ syscon-reboot:
47+ $ref: /schemas/power/reset/syscon-reboot.yaml#
48+ type: object
49+ description:
50+ Node for reboot method
51+
3552 required:
3653 - compatible
3754 - reg
@@ -44,9 +61,23 @@ examples: · 6 unmodified lines
4461 #include <dt-bindings/interrupt-controller/irq.h>
4562
4663 power-management@1fe27000 {
47− compatible = "loongson,ls2k1000-pmc", "syscon";
64+ compatible = "loongson,ls2k1000-pmc", "loongson,ls2k0500-pmc", "syscon";
4865 reg = <0x1fe27000 0x58>;
4966 interrupt-parent = <&liointc1>;
5067 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
5168 loongson,suspend-address = <0x0 0x1c000500>;
69+
70+ syscon-reboot {
71+ compatible = "syscon-reboot";
72+ offset = <0x30>;
73+ mask = <0x1>;
74+ };
75+
76+ syscon-poweroff {
77+ compatible = "syscon-poweroff";
78+ regmap = <&pmc>;
79+ offset = <0x14>;
80+ mask = <0x3c00>;
81+ value = <0x3c00>;
82+ };
5283 };
Documentation/devicetree/bindings/spi/fsl-imx-cspi.yaml+7−0
@@ -22,6 +22,13 @@ properties: · 21 unmodified lines
2222 - const: fsl,imx35-cspi
2323 - const: fsl,imx51-ecspi
2424 - const: fsl,imx53-ecspi
25+ - items:
26+ - enum:
27+ - fsl,imx25-cspi
28+ - fsl,imx50-cspi
29+ - fsl,imx51-cspi
30+ - fsl,imx53-cspi
31+ - const: fsl,imx35-cspi
2532 - items:
2633 - const: fsl,imx8mp-ecspi
2734 - const: fsl,imx6ul-ecspi
Documentation/filesystems/btrfs.rst+0−1
@@ -37,7 +37,6 @@ For more information please refer to the documentation site or wiki · 36 unmodified lines
3737
3838 https://btrfs.readthedocs.io
3939
40− https://btrfs.wiki.kernel.org
4140
4241 that maintains information about administration tasks, frequently asked
4342 questions, use cases, mount options, comprehensible changelogs, features,
Documentation/filesystems/porting.rst+96−0
@@ -949,3 +949,99 @@ mmap_lock held. All in-tree users have been audited and do not seem to · 948 unmodified lines
949949 depend on the mmap_lock being held, but out of tree users should verify
950950 for themselves. If they do need it, they can return VM_FAULT_RETRY to
951951 be called with the mmap_lock held.
952+
953+---
954+
955+**mandatory**
956+
957+The order of opening block devices and matching or creating superblocks has
958+changed.
959+
960+The old logic opened block devices first and then tried to find a
961+suitable superblock to reuse based on the block device pointer.
962+
963+The new logic tries to find a suitable superblock first based on the device
964+number, and opening the block device afterwards.
965+
966+Since opening block devices cannot happen under s_umount because of lock
967+ordering requirements s_umount is now dropped while opening block devices and
968+reacquired before calling fill_super().
969+
970+In the old logic concurrent mounters would find the superblock on the list of
971+superblocks for the filesystem type. Since the first opener of the block device
972+would hold s_umount they would wait until the superblock became either born or
973+was discarded due to initialization failure.
974+
975+Since the new logic drops s_umount concurrent mounters could grab s_umount and
976+would spin. Instead they are now made to wait using an explicit wait-wake
977+mechanism without having to hold s_umount.
978+
979+---
980+
981+**mandatory**
982+
983+The holder of a block device is now the superblock.
984+
985+The holder of a block device used to be the file_system_type which wasn't
986+particularly useful. It wasn't possible to go from block device to owning
987+superblock without matching on the device pointer stored in the superblock.
988+This mechanism would only work for a single device so the block layer couldn't
989+find the owning superblock of any additional devices.
990+
991+In the old mechanism reusing or creating a superblock for a racing mount(2) and
992+umount(2) relied on the file_system_type as the holder. This was severly
993+underdocumented however:
994+
995+(1) Any concurrent mounter that managed to grab an active reference on an
996+ existing superblock was made to wait until the superblock either became
997+ ready or until the superblock was removed from the list of superblocks of
998+ the filesystem type. If the superblock is ready the caller would simple
999+ reuse it.
1000+
1001+(2) If the mounter came after deactivate_locked_super() but before
1002+ the superblock had been removed from the list of superblocks of the
1003+ filesystem type the mounter would wait until the superblock was shutdown,
1004+ reuse the block device and allocate a new superblock.
1005+
1006+(3) If the mounter came after deactivate_locked_super() and after
1007+ the superblock had been removed from the list of superblocks of the
1008+ filesystem type the mounter would reuse the block device and allocate a new
1009+ superblock (the bd_holder point may still be set to the filesystem type).
1010+
1011+Because the holder of the block device was the file_system_type any concurrent
1012+mounter could open the block devices of any superblock of the same
1013+file_system_type without risking seeing EBUSY because the block device was
1014+still in use by another superblock.
1015+
1016+Making the superblock the owner of the block device changes this as the holder
1017+is now a unique superblock and thus block devices associated with it cannot be
1018+reused by concurrent mounters. So a concurrent mounter in (2) could suddenly
1019+see EBUSY when trying to open a block device whose holder was a different
1020+superblock.
1021+
1022+The new logic thus waits until the superblock and the devices are shutdown in
1023+->kill_sb(). Removal of the superblock from the list of superblocks of the
1024+filesystem type is now moved to a later point when the devices are closed:
1025+
1026+(1) Any concurrent mounter managing to grab an active reference on an existing
1027+ superblock is made to wait until the superblock is either ready or until
1028+ the superblock and all devices are shutdown in ->kill_sb(). If the
1029+ superblock is ready the caller will simply reuse it.
1030+
1031+(2) If the mounter comes after deactivate_locked_super() but before
1032+ the superblock has been removed from the list of superblocks of the
1033+ filesystem type the mounter is made to wait until the superblock and the
1034+ devices are shut down in ->kill_sb() and the superblock is removed from the
1035+ list of superblocks of the filesystem type. The mounter will allocate a new
1036+ superblock and grab ownership of the block device (the bd_holder pointer of
1037+ the block device will be set to the newly allocated superblock).
1038+
1039+(3) This case is now collapsed into (2) as the superblock is left on the list
1040+ of superblocks of the filesystem type until all devices are shutdown in
1041+ ->kill_sb(). In other words, if the superblock isn't on the list of
1042+ superblock of the filesystem type anymore then it has given up ownership of
1043+ all associated block devices (the bd_holder pointer is NULL).
1044+
1045+As this is a VFS level change it has no practical consequences for filesystems
1046+other than that all of them must use one of the provided kill_litter_super(),
1047+kill_anon_super(), or kill_block_super() helpers.
Documentation/kbuild/kconfig-language.rst+26−0
@@ -573,6 +573,32 @@ above, leading to: · 572 unmodified lines
573573 bool "Support for foo hardware"
574574 depends on ARCH_FOO_VENDOR || COMPILE_TEST
575575
576+Optional dependencies
577+~~~~~~~~~~~~~~~~~~~~~
578+
579+Some drivers are able to optionally use a feature from another module
580+or build cleanly with that module disabled, but cause a link failure
581+when trying to use that loadable module from a built-in driver.
582+
583+The most common way to express this optional dependency in Kconfig logic
584+uses the slightly counterintuitive::
585+
586+ config FOO
587+ tristate "Support for foo hardware"
588+ depends on BAR || !BAR
589+
590+This means that there is either a dependency on BAR that disallows
591+the combination of FOO=y with BAR=m, or BAR is completely disabled.
592+For a more formalized approach if there are multiple drivers that have
593+the same dependency, a helper symbol can be used, like::
594+
595+ config FOO
596+ tristate "Support for foo hardware"
597+ depends on BAR_OPTIONAL
598+
599+ config BAR_OPTIONAL
600+ def_tristate BAR || !BAR
601+
576602 Kconfig recursive dependency limitations
577603 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
578604
Documentation/networking/ax25.rst+2−2
@@ -7,9 +7,9 @@ AX.25 · 6 unmodified lines
77 To use the amateur radio protocols within Linux you will need to get a
88 suitable copy of the AX.25 Utilities. More detailed information about
99 AX.25, NET/ROM and ROSE, associated programs and utilities can be
10−found on http://www.linux-ax25.org.
10+found on https://linux-ax25.in-berlin.de.
1111
12−There is an active mailing list for discussing Linux amateur radio matters
12+There is a mailing list for discussing Linux amateur radio matters
1313 called linux-hams@vger.kernel.org. To subscribe to it, send a message to
1414 majordomo@vger.kernel.org with the words "subscribe linux-hams" in the body
1515 of the message, the subject field is ignored. You don't need to be
Documentation/process/embargoed-hardware-issues.rst+1−0
@@ -251,6 +251,7 @@ an involved disclosed party. The current ambassadors list: · 250 unmodified lines
251251 IBM Z Christian Borntraeger <borntraeger@de.ibm.com>
252252 Intel Tony Luck <tony.luck@intel.com>
253253 Qualcomm Trilok Soni <tsoni@codeaurora.org>
254+ RISC-V Palmer Dabbelt <palmer@dabbelt.com>
254255 Samsung Javier González <javier.gonz@samsung.com>
255256
256257 Microsoft James Morris <jamorris@linux.microsoft.com>
Documentation/sound/designs/midi-2.0.rst+2−2
@@ -74,8 +74,8 @@ topology based on those information. When the device is older and · 73 unmodified lines
7474 doesn't respond to the new UMP inquiries, the driver falls back and
7575 builds the topology based on Group Terminal Block (GTB) information
7676 from the USB descriptor. Some device might be screwed up by the
77−unexpected UMP command; in such a case, pass `midi2_probe=0` option to
78−snd-usb-audio driver for skipping the UMP v1.1 inquiries.
77+unexpected UMP command; in such a case, pass `midi2_ump_probe=0`
78+option to snd-usb-audio driver for skipping the UMP v1.1 inquiries.
7979
8080 When the MIDI 2.0 device is probed, the kernel creates a rawmidi
8181 device for each UMP Endpoint of the device. Its device name is
Documentation/translations/zh_CN/arch/loongarch/introduction.rst+2−2
@@ -344,9 +344,9 @@ LoongArch指令集架构的文档: · 343 unmodified lines
344344
345345 LoongArch的ELF psABI文档:
346346
347− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-CN.pdf (中文版)
347+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-CN.pdf (中文版)
348348
349− https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.00-EN.pdf (英文版)
349+ https://github.com/loongson/LoongArch-Documentation/releases/latest/download/LoongArch-ELF-ABI-v2.01-EN.pdf (英文版)
350350
351351 Loongson与LoongArch的Linux内核源码仓库:
352352
MAINTAINERS+26−23
@@ -1662,7 +1662,7 @@ F: arch/arm*/include/asm/perf_event.h · 1661 unmodified lines
16621662 F: arch/arm*/kernel/hw_breakpoint.c
16631663 F: arch/arm*/kernel/perf_*
16641664 F: drivers/perf/
1665−F: include/linux/perf/arm_pmu.h
1665+F: include/linux/perf/arm_pmu*.h
16661666
16671667 ARM PORT
16681668 M: Russell King <linux@armlinux.org.uk>
@@ -1855,7 +1855,7 @@ F: Documentation/devicetree/bindings/phy/amlogic* · 186 unmodified lines
18551855 F: arch/arm/boot/dts/amlogic/
18561856 F: arch/arm/mach-meson/
18571857 F: arch/arm64/boot/dts/amlogic/
1858−F: drivers/genpd/amlogic/
1858+F: drivers/pmdomain/amlogic/
18591859 F: drivers/mmc/host/meson*
18601860 F: drivers/phy/amlogic/
18611861 F: drivers/pinctrl/meson/
@@ -1918,7 +1918,7 @@ F: drivers/bluetooth/hci_bcm4377.c · 56 unmodified lines
19181918 F: drivers/clk/clk-apple-nco.c
19191919 F: drivers/cpufreq/apple-soc-cpufreq.c
19201920 F: drivers/dma/apple-admac.c
1921−F: drivers/genpd/apple/
1921+F: drivers/pmdomain/apple/
19221922 F: drivers/i2c/busses/i2c-pasemi-core.c
19231923 F: drivers/i2c/busses/i2c-pasemi-platform.c
19241924 F: drivers/iommu/apple-dart.c
@@ -1963,12 +1963,12 @@ F: drivers/irqchip/irq-aspeed-i2c-ic.c · 38 unmodified lines
19631963
19641964 ARM/ASPEED MACHINE SUPPORT
19651965 M: Joel Stanley <joel@jms.id.au>
1966−R: Andrew Jeffery <andrew@aj.id.au>
1966+R: Andrew Jeffery <andrew@codeconstruct.com.au>
19671967 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
19681968 L: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
19691969 S: Supported
19701970 Q: https://patchwork.ozlabs.org/project/linux-aspeed/list/
1971−T: git git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed.git
1971+T: git git://git.kernel.org/pub/scm/linux/kernel/git/joel/bmc.git
19721972 F: Documentation/devicetree/bindings/arm/aspeed/
19731973 F: arch/arm/boot/dts/aspeed/
19741974 F: arch/arm/mach-aspeed/
@@ -2435,7 +2435,7 @@ F: arch/arm/mach-ux500/ · 460 unmodified lines
24352435 F: drivers/clk/clk-nomadik.c
24362436 F: drivers/clocksource/clksrc-dbx500-prcmu.c
24372437 F: drivers/dma/ste_dma40*
2438−F: drivers/genpd/st/ste-ux500-pm-domain.c
2438+F: drivers/pmdomain/st/ste-ux500-pm-domain.c
24392439 F: drivers/hwspinlock/u8500_hsem.c
24402440 F: drivers/i2c/busses/i2c-nomadik.c
24412441 F: drivers/iio/adc/ab8500-gpadc.c
@@ -2598,7 +2598,7 @@ F: arch/arm/include/debug/renesas-scif.S · 156 unmodified lines
25982598 F: arch/arm/mach-shmobile/
25992599 F: arch/arm64/boot/dts/renesas/
26002600 F: arch/riscv/boot/dts/renesas/
2601−F: drivers/genpd/renesas/
2601+F: drivers/pmdomain/renesas/
26022602 F: drivers/soc/renesas/
26032603 F: include/linux/soc/renesas/
26042604 K: \brenesas,
@@ -3058,7 +3058,7 @@ F: Documentation/devicetree/bindings/peci/peci-aspeed.yaml · 453 unmodified lines
30583058 F: drivers/peci/controller/peci-aspeed.c
30593059
30603060 ASPEED PINCTRL DRIVERS
3061−M: Andrew Jeffery <andrew@aj.id.au>
3061+M: Andrew Jeffery <andrew@codeconstruct.com.au>
30623062 L: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
30633063 L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
30643064 L: linux-gpio@vger.kernel.org
@@ -3075,7 +3075,7 @@ F: drivers/irqchip/irq-aspeed-scu-ic.c · 10 unmodified lines
30753075 F: include/dt-bindings/interrupt-controller/aspeed-scu-ic.h
30763076
30773077 ASPEED SD/MMC DRIVER
3078−M: Andrew Jeffery <andrew@aj.id.au>
3078+M: Andrew Jeffery <andrew@codeconstruct.com.au>
30793079 L: linux-aspeed@lists.ozlabs.org (moderated for non-subscribers)
30803080 L: openbmc@lists.ozlabs.org (moderated for non-subscribers)
30813081 L: linux-mmc@vger.kernel.org
@@ -3344,7 +3344,7 @@ AX.25 NETWORK LAYER · 262 unmodified lines
33443344 M: Ralf Baechle <ralf@linux-mips.org>
33453345 L: linux-hams@vger.kernel.org
33463346 S: Maintained
3347−W: http://www.linux-ax25.org/
3347+W: https://linux-ax25.in-berlin.de
33483348 F: include/net/ax25.h
33493349 F: include/uapi/linux/ax25.h
33503350 F: net/ax25/
@@ -4026,7 +4026,7 @@ F: arch/mips/kernel/*bmips* · 675 unmodified lines
40264026 F: drivers/irqchip/irq-bcm63*
40274027 F: drivers/irqchip/irq-bcm7*
40284028 F: drivers/irqchip/irq-brcmstb*
4029−F: drivers/genpd/bcm/bcm63xx-power.c
4029+F: drivers/pmdomain/bcm/bcm63xx-power.c
40304030 F: include/linux/bcm963xx_nvram.h
40314031 F: include/linux/bcm963xx_tag.h
40324032
@@ -4082,7 +4082,7 @@ F: drivers/net/wireless/broadcom/brcm80211/ · 49 unmodified lines
40824082
40834083 BROADCOM BRCMSTB GPIO DRIVER
40844084 M: Doug Berger <opendmb@gmail.com>
4085−M: Florian Fainelli <florian.fainelli@broadcom>
4085+M: Florian Fainelli <florian.fainelli@broadcom.com>
40864086 R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>
40874087 S: Supported
40884088 F: Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml
@@ -4248,7 +4248,7 @@ R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> · 159 unmodified lines
42484248 L: linux-pm@vger.kernel.org
42494249 S: Maintained
42504250 T: git https://github.com/broadcom/stblinux.git
4251−F: drivers/genpd/bcm/bcm-pmb.c
4251+F: drivers/pmdomain/bcm/bcm-pmb.c
42524252 F: include/dt-bindings/soc/bcm-pmb.h
42534253
42544254 BROADCOM SPECIFIC AMBA DRIVER (BCMA)
@@ -4378,7 +4378,6 @@ M: David Sterba <dsterba@suse.com> · 123 unmodified lines
43784378 L: linux-btrfs@vger.kernel.org
43794379 S: Maintained
43804380 W: https://btrfs.readthedocs.io
4381−W: https://btrfs.wiki.kernel.org/
43824381 Q: https://patchwork.kernel.org/project/linux-btrfs/list/
43834382 C: irc://irc.libera.chat/btrfs
43844383 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git
@@ -6646,9 +6645,9 @@ F: Documentation/devicetree/bindings/display/panel/novatek,nt36672a.yaml · 2261 unmodified lines
66466645 F: drivers/gpu/drm/panel/panel-novatek-nt36672a.c
66476646
66486647 DRM DRIVER FOR NVIDIA GEFORCE/QUADRO GPUS
6649−M: Ben Skeggs <bskeggs@redhat.com>
66506648 M: Karol Herbst <kherbst@redhat.com>
66516649 M: Lyude Paul <lyude@redhat.com>
6650+M: Danilo Krummrich <dakr@redhat.com>
66526651 L: dri-devel@lists.freedesktop.org
66536652 L: nouveau@lists.freedesktop.org
66546653 S: Supported
@@ -8729,7 +8728,7 @@ M: Ulf Hansson <ulf.hansson@linaro.org> · 2074 unmodified lines
87298728 L: linux-pm@vger.kernel.org
87308729 S: Supported
87318730 T: git git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm.git
8732−F: drivers/genpd/
8731+F: drivers/pmdomain/
87338732
87348733 GENERIC RESISTIVE TOUCHSCREEN ADC DRIVER
87358734 M: Eugen Hristev <eugen.hristev@microchip.com>
@@ -8875,7 +8874,7 @@ F: drivers/gpio/gpio-mockup.c · 139 unmodified lines
88758874 F: tools/testing/selftests/gpio/
88768875
88778876 GPIO REGMAP
8878−R: Michael Walle <michael@walle.cc>
8877+M: Michael Walle <michael@walle.cc>
88798878 S: Maintained
88808879 F: drivers/gpio/gpio-regmap.c
88818880 F: include/linux/gpio/regmap.h
@@ -13617,6 +13616,7 @@ F: drivers/net/ethernet/mellanox/mlxfw/ · 4735 unmodified lines
1361713616
1361813617 MELLANOX HARDWARE PLATFORM SUPPORT
1361913618 M: Hans de Goede <hdegoede@redhat.com>
13619+M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1362013620 M: Mark Gross <markgross@kernel.org>
1362113621 M: Vadim Pasternak <vadimp@nvidia.com>
1362213622 L: platform-driver-x86@vger.kernel.org
@@ -14211,6 +14211,7 @@ F: drivers/platform/surface/surface_gpe.c · 588 unmodified lines
1421114211
1421214212 MICROSOFT SURFACE HARDWARE PLATFORM SUPPORT
1421314213 M: Hans de Goede <hdegoede@redhat.com>
14214+M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1421414215 M: Mark Gross <markgross@kernel.org>
1421514216 M: Maximilian Luz <luzmaximilian@gmail.com>
1421614217 L: platform-driver-x86@vger.kernel.org
@@ -14757,7 +14758,7 @@ NETROM NETWORK LAYER · 540 unmodified lines
1475714758 M: Ralf Baechle <ralf@linux-mips.org>
1475814759 L: linux-hams@vger.kernel.org
1475914760 S: Maintained
14760−W: http://www.linux-ax25.org/
14761+W: https://linux-ax25.in-berlin.de
1476114762 F: include/net/netrom.h
1476214763 F: include/uapi/linux/netrom.h
1476314764 F: net/netrom/
@@ -17680,7 +17681,7 @@ L: linux-pm@vger.kernel.org · 2916 unmodified lines
1768017681 L: linux-arm-msm@vger.kernel.org
1768117682 S: Maintained
1768217683 F: Documentation/devicetree/bindings/power/avs/qcom,cpr.yaml
17683−F: drivers/genpd/qcom/cpr.c
17684+F: drivers/pmdomain/qcom/cpr.c
1768417685
1768517686 QUALCOMM CPUFREQ DRIVER MSM8996/APQ8096
1768617687 M: Ilia Lin <ilia.lin@kernel.org>
@@ -18608,7 +18609,7 @@ ROSE NETWORK LAYER · 921 unmodified lines
1860818609 M: Ralf Baechle <ralf@linux-mips.org>
1860918610 L: linux-hams@vger.kernel.org
1861018611 S: Maintained
18611−W: http://www.linux-ax25.org/
18612+W: https://linux-ax25.in-berlin.de
1861218613 F: include/net/rose.h
1861318614 F: include/uapi/linux/rose.h
1861418615 F: net/rose/
@@ -20514,7 +20515,7 @@ STARFIVE JH71XX PMU CONTROLLER DRIVER · 1899 unmodified lines
2051420515 M: Walker Chen <walker.chen@starfivetech.com>
2051520516 S: Supported
2051620517 F: Documentation/devicetree/bindings/power/starfive*
20517−F: drivers/genpd/starfive/jh71xx-pmu.c
20518+F: drivers/pmdomain/starfive/jh71xx-pmu.c
2051820519 F: include/dt-bindings/power/starfive,jh7110-pmu.h
2051920520
2052020521 STARFIVE SOC DRIVERS
@@ -21339,7 +21340,7 @@ F: drivers/irqchip/irq-ti-sci-inta.c · 818 unmodified lines
2133921340 F: drivers/irqchip/irq-ti-sci-intr.c
2134021341 F: drivers/reset/reset-ti-sci.c
2134121342 F: drivers/soc/ti/ti_sci_inta_msi.c
21342−F: drivers/genpd/ti/ti_sci_pm_domains.c
21343+F: drivers/pmdomain/ti/ti_sci_pm_domains.c
2134321344 F: include/dt-bindings/soc/ti,sci_pm_domain.h
2134421345 F: include/linux/soc/ti/ti_sci_inta_msi.h
2134521346 F: include/linux/soc/ti/ti_sci_protocol.h
@@ -21581,7 +21582,7 @@ L: linux-kernel@vger.kernel.org · 235 unmodified lines
2158121582 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
2158221583 S: Maintained
2158321584 T: git git://git.kernel.org/pub/scm/linux/kernel/git/ti/linux.git
21584−F: drivers/genpd/ti/omap_prm.c
21585+F: drivers/pmdomain/ti/omap_prm.c
2158521586 F: drivers/soc/ti/*
2158621587
2158721588 TI LM49xxx FAMILY ASoC CODEC DRIVERS
@@ -23424,9 +23425,11 @@ F: drivers/platform/x86/x86-android-tablets/ · 1836 unmodified lines
2342423425
2342523426 X86 PLATFORM DRIVERS
2342623427 M: Hans de Goede <hdegoede@redhat.com>
23428+M: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
2342723429 M: Mark Gross <markgross@kernel.org>
2342823430 L: platform-driver-x86@vger.kernel.org
2342923431 S: Maintained
23432+Q: https://patchwork.kernel.org/project/platform-driver-x86/list/
2343023433 T: git git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git
2343123434 F: drivers/platform/olpc/
2343223435 F: drivers/platform/x86/
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 6
33 PATCHLEVEL = 6
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc1
5+EXTRAVERSION = -rc4
66 NAME = Hurr durr I'ma ninja sloth
77
88 # *DOCUMENTATION*
arch/arm/boot/dts/ti/omap/motorola-mapphone-common.dtsi+3−2
@@ -614,12 +614,12 @@ · 613 unmodified lines
614614 /* Configure pwm clock source for timers 8 & 9 */
615615 &timer8 {
616616 assigned-clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>;
617− assigned-clock-parents = <&sys_clkin_ck>;
617+ assigned-clock-parents = <&sys_32k_ck>;
618618 };
619619
620620 &timer9 {
621621 assigned-clocks = <&l4_per_clkctrl OMAP4_TIMER9_CLKCTRL 24>;
622− assigned-clock-parents = <&sys_clkin_ck>;
622+ assigned-clock-parents = <&sys_32k_ck>;
623623 };
624624
625625 /*
@@ -640,6 +640,7 @@ · 14 unmodified lines
640640 &uart3 {
641641 interrupts-extended = <&wakeupgen GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH
642642 &omap4_pmx_core 0x17c>;
643+ overrun-throttle-ms = <500>;
643644 };
644645
645646 &uart4 {
arch/arm/boot/dts/ti/omap/omap3-cpu-thermal.dtsi+1−2
@@ -12,8 +12,7 @@ cpu_thermal: cpu-thermal { · 11 unmodified lines
1212 polling-delay = <1000>; /* milliseconds */
1313 coefficients = <0 20000>;
1414
15− /* sensor ID */
16− thermal-sensors = <&bandgap 0>;
15+ thermal-sensors = <&bandgap>;
1716
1817 cpu_trips: trips {
1918 cpu_alert0: cpu_alert {
arch/arm/boot/dts/ti/omap/omap4-cpu-thermal.dtsi+4−1
@@ -12,7 +12,10 @@ cpu_thermal: cpu_thermal { · 11 unmodified lines
1212 polling-delay-passive = <250>; /* milliseconds */
1313 polling-delay = <1000>; /* milliseconds */
1414
15− /* sensor ID */
15+ /*
16+ * See 44xx files for single sensor addressing, omap5 and dra7 need
17+ * also sensor ID for addressing.
18+ */
1619 thermal-sensors = <&bandgap 0>;
1720
1821 cpu_trips: trips {
arch/arm/boot/dts/ti/omap/omap443x.dtsi+1−0
@@ -69,6 +69,7 @@ · 68 unmodified lines
6969 };
7070
7171 &cpu_thermal {
72+ thermal-sensors = <&bandgap>;
7273 coefficients = <0 20000>;
7374 };
7475
arch/arm/boot/dts/ti/omap/omap4460.dtsi+1−0
@@ -79,6 +79,7 @@ · 78 unmodified lines
7979 };
8080
8181 &cpu_thermal {
82+ thermal-sensors = <&bandgap>;
8283 coefficients = <348 (-9301)>;
8384 };
8485
arch/arm/include/asm/hardware/locomo.h+1−1
@@ -195,7 +195,7 @@ struct locomo_driver { · 194 unmodified lines
195195
196196 #define LOCOMO_DRIVER_NAME(_ldev) ((_ldev)->dev.driver->name)
197197
198−void locomo_lcd_power(struct locomo_dev *, int, unsigned int);
198+extern void locomolcd_power(int on);
199199
200200 int locomo_driver_register(struct locomo_driver *);
201201 void locomo_driver_unregister(struct locomo_driver *);
arch/arm/mach-omap2/pm44xx.c+2−2
@@ -99,7 +99,7 @@ static int omap4_pm_suspend(void) · 98 unmodified lines
9999 * possible causes.
100100 * http://www.spinics.net/lists/arm-kernel/msg218641.html
101101 */
102− pr_warn("A possible cause could be an old bootloader - try u-boot >= v2012.07\n");
102+ pr_debug("A possible cause could be an old bootloader - try u-boot >= v2012.07\n");
103103 } else {
104104 pr_info("Successfully put all powerdomains to target state\n");
105105 }
@@ -257,7 +257,7 @@ int __init omap4_pm_init(void) · 151 unmodified lines
257257 * http://www.spinics.net/lists/arm-kernel/msg218641.html
258258 */
259259 if (cpu_is_omap44xx())
260− pr_warn("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
260+ pr_debug("OMAP4 PM: u-boot >= v2012.07 is required for full PM support\n");
261261
262262 ret = pwrdm_for_each(pwrdms_setup, NULL);
263263 if (ret) {
arch/arm/mach-sa1100/include/mach/collie.h+0−2
@@ -16,8 +16,6 @@ · 15 unmodified lines
1616
1717 #include "hardware.h" /* Gives GPIO_MAX */
1818
19−extern void locomolcd_power(int on);
20−
2119 #define COLLIE_SCOOP_GPIO_BASE (GPIO_MAX + 1)
2220 #define COLLIE_GPIO_CHARGE_ON (COLLIE_SCOOP_GPIO_BASE + 0)
2321 #define COLLIE_SCP_DIAG_BOOT1 SCOOP_GPCR_PA12
arch/arm/mm/cache-uniphier.c+3−1
@@ -58,11 +58,13 @@ · 57 unmodified lines
5858 ((op & UNIPHIER_SSCOQM_S_MASK) == UNIPHIER_SSCOQM_S_RANGE)
5959
6060 /**
61− * uniphier_cache_data - UniPhier outer cache specific data
61+ * struct uniphier_cache_data - UniPhier outer cache specific data
6262 *
6363 * @ctrl_base: virtual base address of control registers
6464 * @rev_base: virtual base address of revision registers
6565 * @op_base: virtual base address of operation registers
66+ * @way_ctrl_base: virtual address of the way control registers for this
67+ * SoC revision
6668 * @way_mask: each bit specifies if the way is present
6769 * @nsets: number of associativity sets
6870 * @line_size: line size in bytes
arch/arm/xen/enlighten.c+1−1
@@ -207,7 +207,7 @@ static void xen_power_off(void) · 206 unmodified lines
207207
208208 static irqreturn_t xen_arm_callback(int irq, void *arg)
209209 {
210− xen_hvm_evtchn_do_upcall();
210+ xen_evtchn_do_upcall();
211211 return IRQ_HANDLED;
212212 }
213213
arch/arm64/boot/dts/freescale/Makefile+1−0
@@ -66,6 +66,7 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mm-mx8menlo.dtb · 65 unmodified lines
6666 dtb-$(CONFIG_ARCH_MXC) += imx8mm-nitrogen-r2.dtb
6767 dtb-$(CONFIG_ARCH_MXC) += imx8mm-phg.dtb
6868 dtb-$(CONFIG_ARCH_MXC) += imx8mm-phyboard-polis-rdk.dtb
69+dtb-$(CONFIG_ARCH_MXC) += imx8mm-prt8mm.dtb
6970 dtb-$(CONFIG_ARCH_MXC) += imx8mm-tqma8mqml-mba8mx.dtb
7071 dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som-symphony.dtb
7172 dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw71xx-0x.dtb
arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi+20−12
@@ -26,7 +26,7 @@ · 25 unmodified lines
2626
2727 port {
2828 hdmi_connector_in: endpoint {
29− remote-endpoint = <&adv7533_out>;
29+ remote-endpoint = <&adv7535_out>;
3030 };
3131 };
3232 };
@@ -72,6 +72,13 @@ · 39 unmodified lines
7272 enable-active-high;
7373 };
7474
75+ reg_vddext_3v3: regulator-vddext-3v3 {
76+ compatible = "regulator-fixed";
77+ regulator-name = "VDDEXT_3V3";
78+ regulator-min-microvolt = <3300000>;
79+ regulator-max-microvolt = <3300000>;
80+ };
81+
7582 backlight: backlight {
7683 compatible = "pwm-backlight";
7784 pwms = <&pwm1 0 5000000 0>;
@@ -317,15 +324,16 @@ · 239 unmodified lines
317324
318325 hdmi@3d {
319326 compatible = "adi,adv7535";
320− reg = <0x3d>, <0x3c>, <0x3e>, <0x3f>;
321− reg-names = "main", "cec", "edid", "packet";
327+ reg = <0x3d>;
328+ interrupt-parent = <&gpio1>;
329+ interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
322330 adi,dsi-lanes = <4>;
323−
324− adi,input-depth = <8>;
325− adi,input-colorspace = "rgb";
326− adi,input-clock = "1x";
327− adi,input-style = <1>;
328− adi,input-justification = "evenly";
331+ avdd-supply = <&buck5_reg>;
332+ dvdd-supply = <&buck5_reg>;
333+ pvdd-supply = <&buck5_reg>;
334+ a2vdd-supply = <&buck5_reg>;
335+ v3p3-supply = <&reg_vddext_3v3>;
336+ v1p2-supply = <&buck5_reg>;
329337
330338 ports {
331339 #address-cells = <1>;
@@ -334,7 +342,7 @@ · 2 unmodified lines
334342 port@0 {
335343 reg = <0>;
336344
337− adv7533_in: endpoint {
345+ adv7535_in: endpoint {
338346 remote-endpoint = <&dsi_out>;
339347 };
340348 };
@@ -342,7 +350,7 @@ · 1 unmodified line
342350 port@1 {
343351 reg = <1>;
344352
345− adv7533_out: endpoint {
353+ adv7535_out: endpoint {
346354 remote-endpoint = <&hdmi_connector_in>;
347355 };
348356 };
@@ -448,7 +456,7 @@ · 99 unmodified lines
448456 reg = <1>;
449457
450458 dsi_out: endpoint {
451− remote-endpoint = <&adv7533_in>;
459+ remote-endpoint = <&adv7535_in>;
452460 data-lanes = <1 2 3 4>;
453461 };
454462 };
arch/arm64/boot/dts/freescale/imx8mp-beacon-kit.dts+3−2
@@ -381,9 +381,10 @@ · 380 unmodified lines
381381 &sai3 {
382382 pinctrl-names = "default";
383383 pinctrl-0 = <&pinctrl_sai3>;
384− assigned-clocks = <&clk IMX8MP_CLK_SAI3>;
384+ assigned-clocks = <&clk IMX8MP_CLK_SAI3>,
385+ <&clk IMX8MP_AUDIO_PLL2> ;
385386 assigned-clock-parents = <&clk IMX8MP_AUDIO_PLL2_OUT>;
386− assigned-clock-rates = <12288000>;
387+ assigned-clock-rates = <12288000>, <361267200>;
387388 fsl,sai-mclk-direction-output;
388389 status = "okay";
389390 };
arch/arm64/boot/dts/freescale/imx8mp.dtsi+6−0
@@ -790,6 +790,12 @@ · 789 unmodified lines
790790 reg = <IMX8MP_POWER_DOMAIN_AUDIOMIX>;
791791 clocks = <&clk IMX8MP_CLK_AUDIO_ROOT>,
792792 <&clk IMX8MP_CLK_AUDIO_AXI>;
793+ assigned-clocks = <&clk IMX8MP_CLK_AUDIO_AHB>,
794+ <&clk IMX8MP_CLK_AUDIO_AXI_SRC>;
795+ assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_800M>,
796+ <&clk IMX8MP_SYS_PLL1_800M>;
797+ assigned-clock-rates = <400000000>,
798+ <600000000>;
793799 };
794800
795801 pgc_gpu2d: power-domain@6 {
arch/arm64/boot/dts/freescale/imx93-tqma9352.dtsi+1−1
@@ -81,7 +81,7 @@ · 80 unmodified lines
8181 &gpio1 {
8282 pmic-irq-hog {
8383 gpio-hog;
84− gpios = <2 GPIO_ACTIVE_LOW>;
84+ gpios = <3 GPIO_ACTIVE_LOW>;
8585 input;
8686 line-name = "PMIC_IRQ#";
8787 };
arch/arm64/boot/dts/mediatek/mt8195.dtsi+5−5
@@ -2957,7 +2957,7 @@ · 2956 unmodified lines
29572957 clock-names = "merge","merge_async";
29582958 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29592959 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xc000 0x1000>;
2960− mediatek,merge-mute = <1>;
2960+ mediatek,merge-mute;
29612961 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE0_DL_ASYNC>;
29622962 };
29632963
@@ -2970,7 +2970,7 @@ · 6 unmodified lines
29702970 clock-names = "merge","merge_async";
29712971 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29722972 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xd000 0x1000>;
2973− mediatek,merge-mute = <1>;
2973+ mediatek,merge-mute;
29742974 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE1_DL_ASYNC>;
29752975 };
29762976
@@ -2983,7 +2983,7 @@ · 6 unmodified lines
29832983 clock-names = "merge","merge_async";
29842984 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29852985 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xe000 0x1000>;
2986− mediatek,merge-mute = <1>;
2986+ mediatek,merge-mute;
29872987 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE2_DL_ASYNC>;
29882988 };
29892989
@@ -2996,7 +2996,7 @@ · 6 unmodified lines
29962996 clock-names = "merge","merge_async";
29972997 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
29982998 mediatek,gce-client-reg = <&gce0 SUBSYS_1c10XXXX 0xf000 0x1000>;
2999− mediatek,merge-mute = <1>;
2999+ mediatek,merge-mute;
30003000 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE3_DL_ASYNC>;
30013001 };
30023002
@@ -3009,7 +3009,7 @@ · 6 unmodified lines
30093009 clock-names = "merge","merge_async";
30103010 power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>;
30113011 mediatek,gce-client-reg = <&gce0 SUBSYS_1c11XXXX 0x0000 0x1000>;
3012− mediatek,merge-fifo-en = <1>;
3012+ mediatek,merge-fifo-en;
30133013 resets = <&vdosys1 MT8195_VDOSYS1_SW0_RST_B_MERGE4_DL_ASYNC>;
30143014 };
30153015
arch/arm64/configs/defconfig+1−1
@@ -636,6 +636,7 @@ CONFIG_POWER_RESET_MSM=y · 635 unmodified lines
636636 CONFIG_POWER_RESET_QCOM_PON=m
637637 CONFIG_POWER_RESET_XGENE=y
638638 CONFIG_POWER_RESET_SYSCON=y
639+CONFIG_POWER_RESET_SYSCON_POWEROFF=y
639640 CONFIG_SYSCON_REBOOT_MODE=y
640641 CONFIG_NVMEM_REBOOT_MODE=m
641642 CONFIG_BATTERY_SBS=m
@@ -1175,7 +1176,6 @@ CONFIG_COMMON_CLK_S2MPS11=y · 533 unmodified lines
11751176 CONFIG_COMMON_CLK_PWM=y
11761177 CONFIG_COMMON_CLK_RS9_PCIE=y
11771178 CONFIG_COMMON_CLK_VC5=y
1178−CONFIG_COMMON_CLK_NPCM8XX=y
11791179 CONFIG_COMMON_CLK_BD718XX=m
11801180 CONFIG_CLK_RASPBERRYPI=m
11811181 CONFIG_CLK_IMX8MM=y
arch/arm64/include/asm/cpufeature.h+1−1
@@ -663,7 +663,7 @@ static inline bool supports_clearbhb(int scope) · 662 unmodified lines
663663 isar2 = read_sanitised_ftr_reg(SYS_ID_AA64ISAR2_EL1);
664664
665665 return cpuid_feature_extract_unsigned_field(isar2,
666− ID_AA64ISAR2_EL1_BC_SHIFT);
666+ ID_AA64ISAR2_EL1_CLRBHB_SHIFT);
667667 }
668668
669669 const struct cpumask *system_32bit_el0_cpumask(void);
arch/arm64/include/asm/hugetlb.h+1−1
@@ -28,7 +28,7 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags); · 27 unmodified lines
2828 #define arch_make_huge_pte arch_make_huge_pte
2929 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
3030 extern void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
31− pte_t *ptep, pte_t pte);
31+ pte_t *ptep, pte_t pte, unsigned long sz);
3232 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
3333 extern int huge_ptep_set_access_flags(struct vm_area_struct *vma,
3434 unsigned long addr, pte_t *ptep,
arch/arm64/include/asm/kvm_hyp.h+1−1
@@ -118,7 +118,7 @@ void deactivate_traps_vhe_put(struct kvm_vcpu *vcpu); · 117 unmodified lines
118118
119119 u64 __guest_enter(struct kvm_vcpu *vcpu);
120120
121−bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt);
121+bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt, u32 func_id);
122122
123123 #ifdef __KVM_NVHE_HYPERVISOR__
124124 void __noreturn __hyp_do_panic(struct kvm_cpu_context *host_ctxt, u64 spsr,
arch/arm64/kernel/cpufeature.c+2−1
@@ -222,7 +222,8 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = { · 221 unmodified lines
222222 static const struct arm64_ftr_bits ftr_id_aa64isar2[] = {
223223 ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CSSC_SHIFT, 4, 0),
224224 ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_RPRFM_SHIFT, 4, 0),
225− ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0),
225+ ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CLRBHB_SHIFT, 4, 0),
226+ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0),
226227 ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_MOPS_SHIFT, 4, 0),
227228 ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH),
228229 FTR_STRICT, FTR_EXACT, ID_AA64ISAR2_EL1_APA3_SHIFT, 4, 0),
arch/arm64/kvm/hyp/include/nvhe/ffa.h+1−1
@@ -12,6 +12,6 @@ · 11 unmodified lines
1212 #define FFA_MAX_FUNC_NUM 0x7F
1313
1414 int hyp_ffa_init(void *pages);
15−bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt);
15+bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id);
1616
1717 #endif /* __KVM_HYP_FFA_H */
arch/arm64/kvm/hyp/nvhe/ffa.c+1−2
@@ -634,9 +634,8 @@ out_handled: · 633 unmodified lines
634634 return true;
635635 }
636636
637−bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt)
637+bool kvm_host_ffa_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
638638 {
639− DECLARE_REG(u64, func_id, host_ctxt, 0);
640639 struct arm_smccc_res res;
641640
642641 /*
arch/arm64/kvm/hyp/nvhe/hyp-init.S+1−0
@@ -57,6 +57,7 @@ __do_hyp_init: · 56 unmodified lines
5757 cmp x0, #HVC_STUB_HCALL_NR
5858 b.lo __kvm_handle_stub_hvc
5959
60+ bic x0, x0, #ARM_SMCCC_CALL_HINTS
6061 mov x3, #KVM_HOST_SMCCC_FUNC(__kvm_hyp_init)
6162 cmp x0, x3
6263 b.eq 1f
arch/arm64/kvm/hyp/nvhe/hyp-main.c+6−2
@@ -368,6 +368,7 @@ static void handle_host_hcall(struct kvm_cpu_context *host_ctxt) · 367 unmodified lines
368368 if (static_branch_unlikely(&kvm_protected_mode_initialized))
369369 hcall_min = __KVM_HOST_SMCCC_FUNC___pkvm_prot_finalize;
370370
371+ id &= ~ARM_SMCCC_CALL_HINTS;
371372 id -= KVM_HOST_SMCCC_ID(0);
372373
373374 if (unlikely(id < hcall_min || id >= ARRAY_SIZE(host_hcall)))
@@ -392,11 +393,14 @@ static void default_host_smc_handler(struct kvm_cpu_context *host_ctxt) · 18 unmodified lines
392393
393394 static void handle_host_smc(struct kvm_cpu_context *host_ctxt)
394395 {
396+ DECLARE_REG(u64, func_id, host_ctxt, 0);
395397 bool handled;
396398
397− handled = kvm_host_psci_handler(host_ctxt);
399+ func_id &= ~ARM_SMCCC_CALL_HINTS;
400+
401+ handled = kvm_host_psci_handler(host_ctxt, func_id);
398402 if (!handled)
399− handled = kvm_host_ffa_handler(host_ctxt);
403+ handled = kvm_host_ffa_handler(host_ctxt, func_id);
400404 if (!handled)
401405 default_host_smc_handler(host_ctxt);
402406
arch/arm64/kvm/hyp/nvhe/psci-relay.c+1−2
@@ -273,9 +273,8 @@ static unsigned long psci_1_0_handler(u64 func_id, struct kvm_cpu_context *host_ · 272 unmodified lines
273273 }
274274 }
275275
276−bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt)
276+bool kvm_host_psci_handler(struct kvm_cpu_context *host_ctxt, u32 func_id)
277277 {
278− DECLARE_REG(u64, func_id, host_ctxt, 0);
279278 unsigned long ret;
280279
281280 switch (kvm_host_psci_config.version) {
arch/arm64/kvm/mmu.c+3−0
@@ -652,6 +652,9 @@ int hyp_alloc_private_va_range(size_t size, unsigned long *haddr) · 651 unmodified lines
652652
653653 mutex_unlock(&kvm_hyp_pgd_mutex);
654654
655+ if (!ret)
656+ *haddr = base;
657+
655658 return ret;
656659 }
657660
arch/arm64/mm/hugetlbpage.c+7−16
@@ -241,15 +241,8 @@ static void clear_flush(struct mm_struct *mm, · 240 unmodified lines
241241 flush_tlb_range(&vma, saddr, addr);
242242 }
243243
244−static inline struct folio *hugetlb_swap_entry_to_folio(swp_entry_t entry)
245−{
246− VM_BUG_ON(!is_migration_entry(entry) && !is_hwpoison_entry(entry));
247−
248− return page_folio(pfn_to_page(swp_offset_pfn(entry)));
249−}
250−
251244 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
252− pte_t *ptep, pte_t pte)
245+ pte_t *ptep, pte_t pte, unsigned long sz)
253246 {
254247 size_t pgsize;
255248 int i;
@@ -257,13 +250,10 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 1 unmodified line
257250 unsigned long pfn, dpfn;
258251 pgprot_t hugeprot;
259252
260− if (!pte_present(pte)) {
261− struct folio *folio;
262−
263− folio = hugetlb_swap_entry_to_folio(pte_to_swp_entry(pte));
264− ncontig = num_contig_ptes(folio_size(folio), &pgsize);
253+ ncontig = num_contig_ptes(sz, &pgsize);
265254
266− for (i = 0; i < ncontig; i++, ptep++)
255+ if (!pte_present(pte)) {
256+ for (i = 0; i < ncontig; i++, ptep++, addr += pgsize)
267257 set_pte_at(mm, addr, ptep, pte);
268258 return;
269259 }
@@ -273,7 +263,6 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 3 unmodified lines
273263 return;
274264 }
275265
276− ncontig = find_num_contig(mm, addr, ptep, &pgsize);
277266 pfn = pte_pfn(pte);
278267 dpfn = pgsize >> PAGE_SHIFT;
279268 hugeprot = pte_pgprot(pte);
@@ -571,5 +560,7 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, unsigned long addr · 291 unmodified lines
571560 void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep,
572561 pte_t old_pte, pte_t pte)
573562 {
574− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
563+ unsigned long psize = huge_page_size(hstate_vma(vma));
564+
565+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
575566 }
arch/arm64/tools/sysreg+5−1
@@ -1347,7 +1347,11 @@ UnsignedEnum 51:48 RPRFM · 1346 unmodified lines
13471347 0b0000 NI
13481348 0b0001 IMP
13491349 EndEnum
1350−Res0 47:28
1350+Res0 47:32
1351+UnsignedEnum 31:28 CLRBHB
1352+ 0b0000 NI
1353+ 0b0001 IMP
1354+EndEnum
13511355 UnsignedEnum 27:24 PAC_frac
13521356 0b0000 NI
13531357 0b0001 IMP
arch/ia64/kernel/acpi.c+4−0
@@ -907,3 +907,7 @@ EXPORT_SYMBOL(acpi_unregister_ioapic); · 906 unmodified lines
907907 * TBD when IA64 starts to support suspend...
908908 */
909909 int acpi_suspend_lowlevel(void) { return 0; }
910+
911+void acpi_proc_quirk_mwait_check(void)
912+{
913+}
arch/loongarch/include/asm/addrspace.h+6−6
@@ -19,7 +19,7 @@ · 18 unmodified lines
1919 */
2020 #ifndef __ASSEMBLY__
2121 #ifndef PHYS_OFFSET
22−#define PHYS_OFFSET _AC(0, UL)
22+#define PHYS_OFFSET _UL(0)
2323 #endif
2424 extern unsigned long vm_map_base;
2525 #endif /* __ASSEMBLY__ */
@@ -43,7 +43,7 @@ extern unsigned long vm_map_base; · 17 unmodified lines
4343 * Memory above this physical address will be considered highmem.
4444 */
4545 #ifndef HIGHMEM_START
46−#define HIGHMEM_START (_AC(1, UL) << _AC(DMW_PABITS, UL))
46+#define HIGHMEM_START (_UL(1) << _UL(DMW_PABITS))
4747 #endif
4848
4949 #define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
@@ -65,16 +65,16 @@ extern unsigned long vm_map_base; · 15 unmodified lines
6565 #define _ATYPE_
6666 #define _ATYPE32_
6767 #define _ATYPE64_
68−#define _CONST64_(x) x
6968 #else
7069 #define _ATYPE_ __PTRDIFF_TYPE__
7170 #define _ATYPE32_ int
7271 #define _ATYPE64_ __s64
72+#endif
73+
7374 #ifdef CONFIG_64BIT
74−#define _CONST64_(x) x ## UL
75+#define _CONST64_(x) _UL(x)
7576 #else
76−#define _CONST64_(x) x ## ULL
77−#endif
77+#define _CONST64_(x) _ULL(x)
7878 #endif
7979
8080 /*
arch/loongarch/include/asm/elf.h+9−0
@@ -111,6 +111,15 @@ · 110 unmodified lines
111111 #define R_LARCH_TLS_GD_HI20 98
112112 #define R_LARCH_32_PCREL 99
113113 #define R_LARCH_RELAX 100
114+#define R_LARCH_DELETE 101
115+#define R_LARCH_ALIGN 102
116+#define R_LARCH_PCREL20_S2 103
117+#define R_LARCH_CFA 104
118+#define R_LARCH_ADD6 105
119+#define R_LARCH_SUB6 106
120+#define R_LARCH_ADD_ULEB128 107
121+#define R_LARCH_SUB_ULEB128 108
122+#define R_LARCH_64_PCREL 109
114123
115124 #ifndef ELF_ARCH
116125
arch/loongarch/include/asm/exception.h+45−0
@@ -0,0 +1,45 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+
3+#ifndef __ASM_EXCEPTION_H
4+#define __ASM_EXCEPTION_H
5+
6+#include <asm/ptrace.h>
7+#include <linux/kprobes.h>
8+
9+void show_registers(struct pt_regs *regs);
10+
11+asmlinkage void cache_parity_error(void);
12+asmlinkage void noinstr do_ade(struct pt_regs *regs);
13+asmlinkage void noinstr do_ale(struct pt_regs *regs);
14+asmlinkage void noinstr do_bce(struct pt_regs *regs);
15+asmlinkage void noinstr do_bp(struct pt_regs *regs);
16+asmlinkage void noinstr do_ri(struct pt_regs *regs);
17+asmlinkage void noinstr do_fpu(struct pt_regs *regs);
18+asmlinkage void noinstr do_fpe(struct pt_regs *regs, unsigned long fcsr);
19+asmlinkage void noinstr do_lsx(struct pt_regs *regs);
20+asmlinkage void noinstr do_lasx(struct pt_regs *regs);
21+asmlinkage void noinstr do_lbt(struct pt_regs *regs);
22+asmlinkage void noinstr do_watch(struct pt_regs *regs);
23+asmlinkage void noinstr do_syscall(struct pt_regs *regs);
24+asmlinkage void noinstr do_reserved(struct pt_regs *regs);
25+asmlinkage void noinstr do_vint(struct pt_regs *regs, unsigned long sp);
26+asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
27+ unsigned long write, unsigned long address);
28+
29+asmlinkage void handle_ade(void);
30+asmlinkage void handle_ale(void);
31+asmlinkage void handle_bce(void);
32+asmlinkage void handle_sys(void);
33+asmlinkage void handle_bp(void);
34+asmlinkage void handle_ri(void);
35+asmlinkage void handle_fpu(void);
36+asmlinkage void handle_fpe(void);
37+asmlinkage void handle_lsx(void);
38+asmlinkage void handle_lasx(void);
39+asmlinkage void handle_lbt(void);
40+asmlinkage void handle_watch(void);
41+asmlinkage void handle_reserved(void);
42+asmlinkage void handle_vint(void);
43+asmlinkage void noinstr handle_loongarch_irq(struct pt_regs *regs);
44+
45+#endif /* __ASM_EXCEPTION_H */
arch/loongarch/include/asm/kasan.h+9−50
@@ -10,8 +10,6 @@ · 9 unmodified lines
1010 #include <asm/io.h>
1111 #include <asm/pgtable.h>
1212
13−#define __HAVE_ARCH_SHADOW_MAP
14−
1513 #define KASAN_SHADOW_SCALE_SHIFT 3
1614 #define KASAN_SHADOW_OFFSET _AC(CONFIG_KASAN_SHADOW_OFFSET, UL)
1715
@@ -62,61 +60,22 @@ · 44 unmodified lines
6260 extern bool kasan_early_stage;
6361 extern unsigned char kasan_early_shadow_page[PAGE_SIZE];
6462
63+#define kasan_mem_to_shadow kasan_mem_to_shadow
64+void *kasan_mem_to_shadow(const void *addr);
65+
66+#define kasan_shadow_to_mem kasan_shadow_to_mem
67+const void *kasan_shadow_to_mem(const void *shadow_addr);
68+
6569 #define kasan_arch_is_ready kasan_arch_is_ready
6670 static __always_inline bool kasan_arch_is_ready(void)
6771 {
6872 return !kasan_early_stage;
6973 }
7074
71−static inline void *kasan_mem_to_shadow(const void *addr)
72−{
73− if (!kasan_arch_is_ready()) {
74− return (void *)(kasan_early_shadow_page);
75− } else {
76− unsigned long maddr = (unsigned long)addr;
77− unsigned long xrange = (maddr >> XRANGE_SHIFT) & 0xffff;
78− unsigned long offset = 0;
79−
80− maddr &= XRANGE_SHADOW_MASK;
81− switch (xrange) {
82− case XKPRANGE_CC_SEG:
83− offset = XKPRANGE_CC_SHADOW_OFFSET;
84− break;
85− case XKPRANGE_UC_SEG:
86− offset = XKPRANGE_UC_SHADOW_OFFSET;
87− break;
88− case XKVRANGE_VC_SEG:
89− offset = XKVRANGE_VC_SHADOW_OFFSET;
90− break;
91− default:
92− WARN_ON(1);
93− return NULL;
94− }
95−
96− return (void *)((maddr >> KASAN_SHADOW_SCALE_SHIFT) + offset);
97− }
98−}
99−
100−static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
75+#define addr_has_metadata addr_has_metadata
76+static __always_inline bool addr_has_metadata(const void *addr)
10177 {
102− unsigned long addr = (unsigned long)shadow_addr;
103−
104− if (unlikely(addr > KASAN_SHADOW_END) ||
105− unlikely(addr < KASAN_SHADOW_START)) {
106− WARN_ON(1);
107− return NULL;
108− }
109−
110− if (addr >= XKVRANGE_VC_SHADOW_OFFSET)
111− return (void *)(((addr - XKVRANGE_VC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKVRANGE_VC_START);
112− else if (addr >= XKPRANGE_UC_SHADOW_OFFSET)
113− return (void *)(((addr - XKPRANGE_UC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_UC_START);
114− else if (addr >= XKPRANGE_CC_SHADOW_OFFSET)
115− return (void *)(((addr - XKPRANGE_CC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_CC_START);
116− else {
117− WARN_ON(1);
118− return NULL;
119− }
78+ return (kasan_mem_to_shadow((void *)addr) != NULL);
12079 }
12180
12281 void kasan_init(void);
arch/loongarch/include/asm/smp.h+1−0
@@ -70,6 +70,7 @@ struct secondary_data { · 69 unmodified lines
7070 extern struct secondary_data cpuboot_data;
7171
7272 extern asmlinkage void smpboot_entry(void);
73+extern asmlinkage void start_secondary(void);
7374
7475 extern void calculate_cpu_foreign_map(void);
7576
arch/loongarch/kernel/Makefile+4−0
@@ -19,6 +19,10 @@ obj-$(CONFIG_CPU_HAS_LBT) += lbt.o · 18 unmodified lines
1919
2020 obj-$(CONFIG_ARCH_STRICT_ALIGN) += unaligned.o
2121
22+CFLAGS_module.o += $(call cc-option,-Wno-override-init,)
23+CFLAGS_syscall.o += $(call cc-option,-Wno-override-init,)
24+CFLAGS_perf_event.o += $(call cc-option,-Wno-override-init,)
25+
2226 ifdef CONFIG_FUNCTION_TRACER
2327 ifndef CONFIG_DYNAMIC_FTRACE
2428 obj-y += mcount.o ftrace.o
arch/loongarch/kernel/acpi.c+0−1
@@ -281,7 +281,6 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa) · 280 unmodified lines
281281 pr_info("SRAT: PXM %u -> CPU 0x%02x -> Node %u\n", pxm, pa->apic_id, node);
282282 }
283283
284−void __init acpi_numa_arch_fixup(void) {}
285284 #endif
286285
287286 void __init arch_reserve_mem_area(acpi_physical_address addr, size_t size)
arch/loongarch/kernel/mem.c+3−1
@@ -50,7 +50,6 @@ void __init memblock_init(void) · 49 unmodified lines
5050 }
5151
5252 memblock_set_current_limit(PFN_PHYS(max_low_pfn));
53− memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
5453
5554 /* Reserve the first 2MB */
5655 memblock_reserve(PHYS_OFFSET, 0x200000);
@@ -58,4 +57,7 @@ void __init memblock_init(void) · 1 unmodified line
5857 /* Reserve the kernel text/data/bss */
5958 memblock_reserve(__pa_symbol(&_text),
6059 __pa_symbol(&_end) - __pa_symbol(&_text));
60+
61+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.memory, 0);
62+ memblock_set_node(0, PHYS_ADDR_MAX, &memblock.reserved, 0);
6163 }
arch/loongarch/kernel/module-sections.c+1−0
@@ -6,6 +6,7 @@ · 5 unmodified lines
66 #include <linux/elf.h>
77 #include <linux/kernel.h>
88 #include <linux/module.h>
9+#include <linux/moduleloader.h>
910 #include <linux/ftrace.h>
1011
1112 Elf_Addr module_emit_got_entry(struct module *mod, Elf_Shdr *sechdrs, Elf_Addr val)
arch/loongarch/kernel/module.c+21−1
@@ -367,6 +367,24 @@ static int apply_r_larch_got_pc(struct module *mod, · 366 unmodified lines
367367 return apply_r_larch_pcala(mod, location, got, rela_stack, rela_stack_top, type);
368368 }
369369
370+static int apply_r_larch_32_pcrel(struct module *mod, u32 *location, Elf_Addr v,
371+ s64 *rela_stack, size_t *rela_stack_top, unsigned int type)
372+{
373+ ptrdiff_t offset = (void *)v - (void *)location;
374+
375+ *(u32 *)location = offset;
376+ return 0;
377+}
378+
379+static int apply_r_larch_64_pcrel(struct module *mod, u32 *location, Elf_Addr v,
380+ s64 *rela_stack, size_t *rela_stack_top, unsigned int type)
381+{
382+ ptrdiff_t offset = (void *)v - (void *)location;
383+
384+ *(u64 *)location = offset;
385+ return 0;
386+}
387+
370388 /*
371389 * reloc_handlers_rela() - Apply a particular relocation to a module
372390 * @mod: the module to apply the reloc to
@@ -382,7 +400,7 @@ typedef int (*reloc_rela_handler)(struct module *mod, u32 *location, Elf_Addr v, · 9 unmodified lines
382400
383401 /* The handlers for known reloc types */
384402 static reloc_rela_handler reloc_rela_handlers[] = {
385− [R_LARCH_NONE ... R_LARCH_RELAX] = apply_r_larch_error,
403+ [R_LARCH_NONE ... R_LARCH_64_PCREL] = apply_r_larch_error,
386404
387405 [R_LARCH_NONE] = apply_r_larch_none,
388406 [R_LARCH_32] = apply_r_larch_32,
@@ -396,6 +414,8 @@ static reloc_rela_handler reloc_rela_handlers[] = { · 7 unmodified lines
396414 [R_LARCH_SOP_POP_32_S_10_5 ... R_LARCH_SOP_POP_32_U] = apply_r_larch_sop_imm_field,
397415 [R_LARCH_ADD32 ... R_LARCH_SUB64] = apply_r_larch_add_sub,
398416 [R_LARCH_PCALA_HI20...R_LARCH_PCALA64_HI12] = apply_r_larch_pcala,
417+ [R_LARCH_32_PCREL] = apply_r_larch_32_pcrel,
418+ [R_LARCH_64_PCREL] = apply_r_larch_64_pcrel,
399419 };
400420
401421 int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
arch/loongarch/kernel/numa.c+1−1
@@ -436,7 +436,7 @@ void __init paging_init(void) · 435 unmodified lines
436436
437437 void __init mem_init(void)
438438 {
439− high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
439+ high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
440440 memblock_free_all();
441441 }
442442
arch/loongarch/kernel/process.c+1−0
@@ -37,6 +37,7 @@ · 36 unmodified lines
3737 #include <asm/bootinfo.h>
3838 #include <asm/cpu.h>
3939 #include <asm/elf.h>
40+#include <asm/exec.h>
4041 #include <asm/fpu.h>
4142 #include <asm/lbt.h>
4243 #include <asm/io.h>
arch/loongarch/kernel/relocate_kernel.S+0−1
@@ -72,7 +72,6 @@ copy_word: · 71 unmodified lines
7272 LONG_ADDI s5, s5, -1
7373 beqz s5, process_entry
7474 b copy_word
75− b process_entry
7675
7776 done:
7877 ibar 0
arch/loongarch/kernel/signal.c+4−3
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/audit.h>
1414 #include <linux/cache.h>
1515 #include <linux/context_tracking.h>
16+#include <linux/entry-common.h>
1617 #include <linux/irqflags.h>
1718 #include <linux/sched.h>
1819 #include <linux/mm.h>
@@ -891,8 +892,8 @@ static unsigned long setup_extcontext(struct extctx_layout *extctx, unsigned lon · 872 unmodified lines
891892 return new_sp;
892893 }
893894
894−void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
895− struct extctx_layout *extctx)
895+static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
896+ struct extctx_layout *extctx)
896897 {
897898 unsigned long sp;
898899
@@ -922,7 +923,7 @@ void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs, · 23 unmodified lines
922923 * Atomically swap in the new signal mask, and wait for a signal.
923924 */
924925
925−asmlinkage long sys_rt_sigreturn(void)
926+SYSCALL_DEFINE0(rt_sigreturn)
926927 {
927928 int sig;
928929 sigset_t set;
arch/loongarch/kernel/smp.c+3−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/cpumask.h>
1414 #include <linux/init.h>
1515 #include <linux/interrupt.h>
16+#include <linux/profile.h>
1617 #include <linux/seq_file.h>
1718 #include <linux/smp.h>
1819 #include <linux/threads.h>
@@ -556,10 +557,12 @@ void smp_send_stop(void) · 537 unmodified lines
556557 smp_call_function(stop_this_cpu, NULL, 0);
557558 }
558559
560+#ifdef CONFIG_PROFILING
559561 int setup_profiling_timer(unsigned int multiplier)
560562 {
561563 return 0;
562564 }
565+#endif
563566
564567 static void flush_tlb_all_ipi(void *info)
565568 {
arch/loongarch/kernel/syscall.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/unistd.h>
1414
1515 #include <asm/asm.h>
16+#include <asm/exception.h>
1617 #include <asm/signal.h>
1718 #include <asm/switch_to.h>
1819 #include <asm-generic/syscalls.h>
arch/loongarch/kernel/time.c+1−1
@@ -29,7 +29,7 @@ static void constant_event_handler(struct clock_event_device *dev) · 28 unmodified lines
2929 {
3030 }
3131
32−irqreturn_t constant_timer_interrupt(int irq, void *data)
32+static irqreturn_t constant_timer_interrupt(int irq, void *data)
3333 {
3434 int cpu = smp_processor_id();
3535 struct clock_event_device *cd;
arch/loongarch/kernel/topology.c+3−0
@@ -1,4 +1,5 @@
11 // SPDX-License-Identifier: GPL-2.0
2+#include <linux/acpi.h>
23 #include <linux/cpu.h>
34 #include <linux/cpumask.h>
45 #include <linux/init.h>
@@ -7,6 +8,8 @@ · 2 unmodified lines
78 #include <linux/percpu.h>
89 #include <asm/bootinfo.h>
910
11+#include <acpi/processor.h>
12+
1013 static DEFINE_PER_CPU(struct cpu, cpu_devices);
1114
1215 #ifdef CONFIG_HOTPLUG_CPU
arch/loongarch/kernel/traps.c+5−20
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525 #include <linux/ptrace.h>
2626 #include <linux/kgdb.h>
2727 #include <linux/kdebug.h>
28−#include <linux/kprobes.h>
2928 #include <linux/notifier.h>
3029 #include <linux/irq.h>
3130 #include <linux/perf_event.h>
@@ -35,6 +34,7 @@ · 3 unmodified lines
3534 #include <asm/branch.h>
3635 #include <asm/break.h>
3736 #include <asm/cpu.h>
37+#include <asm/exception.h>
3838 #include <asm/fpu.h>
3939 #include <asm/lbt.h>
4040 #include <asm/inst.h>
@@ -53,21 +53,6 @@ · 12 unmodified lines
5353
5454 #include "access-helper.h"
5555
56−extern asmlinkage void handle_ade(void);
57−extern asmlinkage void handle_ale(void);
58−extern asmlinkage void handle_bce(void);
59−extern asmlinkage void handle_sys(void);
60−extern asmlinkage void handle_bp(void);
61−extern asmlinkage void handle_ri(void);
62−extern asmlinkage void handle_fpu(void);
63−extern asmlinkage void handle_fpe(void);
64−extern asmlinkage void handle_lbt(void);
65−extern asmlinkage void handle_lsx(void);
66−extern asmlinkage void handle_lasx(void);
67−extern asmlinkage void handle_reserved(void);
68−extern asmlinkage void handle_watch(void);
69−extern asmlinkage void handle_vint(void);
70−
7156 static void show_backtrace(struct task_struct *task, const struct pt_regs *regs,
7257 const char *loglvl, bool user)
7358 {
@@ -439,8 +424,8 @@ static inline void setup_vint_size(unsigned int size) · 365 unmodified lines
439424 * happen together with Overflow or Underflow, and `ptrace' can set
440425 * any bits.
441426 */
442−void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr,
443− struct task_struct *tsk)
427+static void force_fcsr_sig(unsigned long fcsr,
428+ void __user *fault_addr, struct task_struct *tsk)
444429 {
445430 int si_code = FPE_FLTUNK;
446431
@@ -458,7 +443,7 @@ void force_fcsr_sig(unsigned long fcsr, void __user *fault_addr, · 11 unmodified lines
458443 force_sig_fault(SIGFPE, si_code, fault_addr);
459444 }
460445
461−int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr)
446+static int process_fpemu_return(int sig, void __user *fault_addr, unsigned long fcsr)
462447 {
463448 int si_code;
464449
@@ -824,7 +809,7 @@ out: · 359 unmodified lines
824809 asmlinkage void noinstr do_ri(struct pt_regs *regs)
825810 {
826811 int status = SIGILL;
827− unsigned int opcode = 0;
812+ unsigned int __maybe_unused opcode;
828813 unsigned int __user *era = (unsigned int __user *)exception_era(regs);
829814 irqentry_state_t state = irqentry_enter(regs);
830815
arch/loongarch/kernel/vmlinux.lds.S+28−27
@@ -53,33 +53,6 @@ SECTIONS · 52 unmodified lines
5353 . = ALIGN(PECOFF_SEGMENT_ALIGN);
5454 _etext = .;
5555
56− /*
57− * struct alt_inst entries. From the header (alternative.h):
58− * "Alternative instructions for different CPU types or capabilities"
59− * Think locking instructions on spinlocks.
60− */
61− . = ALIGN(4);
62− .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
63− __alt_instructions = .;
64− *(.altinstructions)
65− __alt_instructions_end = .;
66− }
67−
68−#ifdef CONFIG_RELOCATABLE
69− . = ALIGN(8);
70− .la_abs : AT(ADDR(.la_abs) - LOAD_OFFSET) {
71− __la_abs_begin = .;
72− *(.la_abs)
73− __la_abs_end = .;
74− }
75−#endif
76−
77− .got : ALIGN(16) { *(.got) }
78− .plt : ALIGN(16) { *(.plt) }
79− .got.plt : ALIGN(16) { *(.got.plt) }
80−
81− .data.rel : { *(.data.rel*) }
82−
8356 . = ALIGN(PECOFF_SEGMENT_ALIGN);
8457 __init_begin = .;
8558 __inittext_begin = .;
@@ -94,6 +67,18 @@ SECTIONS · 8 unmodified lines
9467
9568 __initdata_begin = .;
9669
70+ /*
71+ * struct alt_inst entries. From the header (alternative.h):
72+ * "Alternative instructions for different CPU types or capabilities"
73+ * Think locking instructions on spinlocks.
74+ */
75+ . = ALIGN(4);
76+ .altinstructions : AT(ADDR(.altinstructions) - LOAD_OFFSET) {
77+ __alt_instructions = .;
78+ *(.altinstructions)
79+ __alt_instructions_end = .;
80+ }
81+
9782 INIT_DATA_SECTION(16)
9883 .exit.data : {
9984 EXIT_DATA
@@ -113,6 +98,11 @@ SECTIONS · 13 unmodified lines
11398
11499 _sdata = .;
115100 RO_DATA(4096)
101+
102+ .got : ALIGN(16) { *(.got) }
103+ .plt : ALIGN(16) { *(.plt) }
104+ .got.plt : ALIGN(16) { *(.got.plt) }
105+
116106 RW_DATA(1 << CONFIG_L1_CACHE_SHIFT, PAGE_SIZE, THREAD_SIZE)
117107
118108 .rela.dyn : ALIGN(8) {
@@ -121,6 +111,17 @@ SECTIONS · 2 unmodified lines
121111 __rela_dyn_end = .;
122112 }
123113
114+ .data.rel : { *(.data.rel*) }
115+
116+#ifdef CONFIG_RELOCATABLE
117+ . = ALIGN(8);
118+ .la_abs : AT(ADDR(.la_abs) - LOAD_OFFSET) {
119+ __la_abs_begin = .;
120+ *(.la_abs)
121+ __la_abs_end = .;
122+ }
123+#endif
124+
124125 .sdata : {
125126 *(.sdata)
126127 }
arch/loongarch/mm/fault.c+1−1
@@ -20,12 +20,12 @@ · 19 unmodified lines
2020 #include <linux/mm.h>
2121 #include <linux/smp.h>
2222 #include <linux/kdebug.h>
23−#include <linux/kprobes.h>
2423 #include <linux/perf_event.h>
2524 #include <linux/uaccess.h>
2625 #include <linux/kfence.h>
2726
2827 #include <asm/branch.h>
28+#include <asm/exception.h>
2929 #include <asm/mmu_context.h>
3030 #include <asm/ptrace.h>
3131
arch/loongarch/mm/hugetlbpage.c+0−12
@@ -50,18 +50,6 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, · 49 unmodified lines
5050 return (pte_t *) pmd;
5151 }
5252
53−/*
54− * This function checks for proper alignment of input addr and len parameters.
55− */
56−int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
57−{
58− if (len & ~HPAGE_MASK)
59− return -EINVAL;
60− if (addr & ~HPAGE_MASK)
61− return -EINVAL;
62− return 0;
63−}
64−
6553 int pmd_huge(pmd_t pmd)
6654 {
6755 return (pmd_val(pmd) & _PAGE_HUGE) != 0;
arch/loongarch/mm/ioremap.c+1−0
@@ -4,6 +4,7 @@ · 3 unmodified lines
44 */
55
66 #include <asm/io.h>
7+#include <asm-generic/early_ioremap.h>
78
89 void __init __iomem *early_ioremap(u64 phys_addr, unsigned long size)
910 {
arch/loongarch/mm/kasan_init.c+51−0
@@ -35,6 +35,57 @@ static pgd_t kasan_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); · 34 unmodified lines
3535
3636 bool kasan_early_stage = true;
3737
38+void *kasan_mem_to_shadow(const void *addr)
39+{
40+ if (!kasan_arch_is_ready()) {
41+ return (void *)(kasan_early_shadow_page);
42+ } else {
43+ unsigned long maddr = (unsigned long)addr;
44+ unsigned long xrange = (maddr >> XRANGE_SHIFT) & 0xffff;
45+ unsigned long offset = 0;
46+
47+ maddr &= XRANGE_SHADOW_MASK;
48+ switch (xrange) {
49+ case XKPRANGE_CC_SEG:
50+ offset = XKPRANGE_CC_SHADOW_OFFSET;
51+ break;
52+ case XKPRANGE_UC_SEG:
53+ offset = XKPRANGE_UC_SHADOW_OFFSET;
54+ break;
55+ case XKVRANGE_VC_SEG:
56+ offset = XKVRANGE_VC_SHADOW_OFFSET;
57+ break;
58+ default:
59+ WARN_ON(1);
60+ return NULL;
61+ }
62+
63+ return (void *)((maddr >> KASAN_SHADOW_SCALE_SHIFT) + offset);
64+ }
65+}
66+
67+const void *kasan_shadow_to_mem(const void *shadow_addr)
68+{
69+ unsigned long addr = (unsigned long)shadow_addr;
70+
71+ if (unlikely(addr > KASAN_SHADOW_END) ||
72+ unlikely(addr < KASAN_SHADOW_START)) {
73+ WARN_ON(1);
74+ return NULL;
75+ }
76+
77+ if (addr >= XKVRANGE_VC_SHADOW_OFFSET)
78+ return (void *)(((addr - XKVRANGE_VC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKVRANGE_VC_START);
79+ else if (addr >= XKPRANGE_UC_SHADOW_OFFSET)
80+ return (void *)(((addr - XKPRANGE_UC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_UC_START);
81+ else if (addr >= XKPRANGE_CC_SHADOW_OFFSET)
82+ return (void *)(((addr - XKPRANGE_CC_SHADOW_OFFSET) << KASAN_SHADOW_SCALE_SHIFT) + XKPRANGE_CC_START);
83+ else {
84+ WARN_ON(1);
85+ return NULL;
86+ }
87+}
88+
3889 /*
3990 * Alloc memory for shadow memory page table.
4091 */
arch/loongarch/mm/tlb.c+1−1
@@ -261,7 +261,7 @@ unsigned long pcpu_handlers[NR_CPUS]; · 260 unmodified lines
261261 #endif
262262 extern long exception_handlers[VECSIZE * 128 / sizeof(long)];
263263
264−void setup_tlb_handler(int cpu)
264+static void setup_tlb_handler(int cpu)
265265 {
266266 setup_ptwalker();
267267 local_flush_tlb_all();
arch/mips/alchemy/devboards/db1000.c+4−0
@@ -164,6 +164,7 @@ static struct platform_device db1x00_audio_dev = { · 163 unmodified lines
164164
165165 /******************************************************************************/
166166
167+#ifdef CONFIG_MMC_AU1X
167168 static irqreturn_t db1100_mmc_cd(int irq, void *ptr)
168169 {
169170 mmc_detect_change(ptr, msecs_to_jiffies(500));
@@ -369,6 +370,7 @@ static struct platform_device db1100_mmc1_dev = { · 199 unmodified lines
369370 .num_resources = ARRAY_SIZE(au1100_mmc1_res),
370371 .resource = au1100_mmc1_res,
371372 };
373+#endif /* CONFIG_MMC_AU1X */
372374
373375 /******************************************************************************/
374376
@@ -440,8 +442,10 @@ static struct platform_device *db1x00_devs[] = { · 65 unmodified lines
440442
441443 static struct platform_device *db1100_devs[] = {
442444 &au1100_lcd_device,
445+#ifdef CONFIG_MMC_AU1X
443446 &db1100_mmc0_dev,
444447 &db1100_mmc1_dev,
448+#endif
445449 };
446450
447451 int __init db1000_dev_setup(void)
arch/mips/alchemy/devboards/db1200.c+6−0
@@ -326,6 +326,7 @@ static struct platform_device db1200_ide_dev = { · 325 unmodified lines
326326
327327 /**********************************************************************/
328328
329+#ifdef CONFIG_MMC_AU1X
329330 /* SD carddetects: they're supposed to be edge-triggered, but ack
330331 * doesn't seem to work (CPLD Rev 2). Instead, the screaming one
331332 * is disabled and its counterpart enabled. The 200ms timeout is
@@ -584,6 +585,7 @@ static struct platform_device pb1200_mmc1_dev = { · 252 unmodified lines
584585 .num_resources = ARRAY_SIZE(au1200_mmc1_res),
585586 .resource = au1200_mmc1_res,
586587 };
588+#endif /* CONFIG_MMC_AU1X */
587589
588590 /**********************************************************************/
589591
@@ -751,7 +753,9 @@ static struct platform_device db1200_audiodma_dev = { · 161 unmodified lines
751753 static struct platform_device *db1200_devs[] __initdata = {
752754 NULL, /* PSC0, selected by S6.8 */
753755 &db1200_ide_dev,
756+#ifdef CONFIG_MMC_AU1X
754757 &db1200_mmc0_dev,
758+#endif
755759 &au1200_lcd_dev,
756760 &db1200_eth_dev,
757761 &db1200_nand_dev,
@@ -762,7 +766,9 @@ static struct platform_device *db1200_devs[] __initdata = { · 4 unmodified lines
762766 };
763767
764768 static struct platform_device *pb1200_devs[] __initdata = {
769+#ifdef CONFIG_MMC_AU1X
765770 &pb1200_mmc1_dev,
771+#endif
766772 };
767773
768774 /* Some peripheral base addresses differ on the PB1200 */
arch/mips/alchemy/devboards/db1300.c+4−0
@@ -450,6 +450,7 @@ static struct platform_device db1300_ide_dev = { · 449 unmodified lines
450450
451451 /**********************************************************************/
452452
453+#ifdef CONFIG_MMC_AU1X
453454 static irqreturn_t db1300_mmc_cd(int irq, void *ptr)
454455 {
455456 disable_irq_nosync(irq);
@@ -632,6 +633,7 @@ static struct platform_device db1300_sd0_dev = { · 176 unmodified lines
632633 .resource = au1300_sd0_res,
633634 .num_resources = ARRAY_SIZE(au1300_sd0_res),
634635 };
636+#endif /* CONFIG_MMC_AU1X */
635637
636638 /**********************************************************************/
637639
@@ -767,8 +769,10 @@ static struct platform_device *db1300_dev[] __initdata = { · 129 unmodified lines
767769 &db1300_5waysw_dev,
768770 &db1300_nand_dev,
769771 &db1300_ide_dev,
772+#ifdef CONFIG_MMC_AU1X
770773 &db1300_sd0_dev,
771774 &db1300_sd1_dev,
775+#endif
772776 &db1300_lcd_dev,
773777 &db1300_ac97_dev,
774778 &db1300_i2s_dev,
arch/parisc/include/asm/cache.h+1−0
@@ -37,6 +37,7 @@ extern int split_tlb; · 36 unmodified lines
3737 extern int dcache_stride;
3838 extern int icache_stride;
3939 extern struct pdc_cache_info cache_info;
40+extern struct pdc_btlb_info btlb_info;
4041 void parisc_setup_cache_timing(void);
4142
4243 #define pdtlb(sr, addr) asm volatile("pdtlb 0(%%sr%0,%1)" \
arch/parisc/include/asm/hugetlb.h+1−1
@@ -6,7 +6,7 @@ · 5 unmodified lines
66
77 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
88 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
9− pte_t *ptep, pte_t pte);
9+ pte_t *ptep, pte_t pte, unsigned long sz);
1010
1111 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
1212 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
arch/parisc/include/asm/mckinley.h+0−8
@@ -1,8 +0,0 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
2−#ifndef ASM_PARISC_MCKINLEY_H
3−#define ASM_PARISC_MCKINLEY_H
4−
5−/* declared in arch/parisc/kernel/setup.c */
6−extern struct proc_dir_entry * proc_mckinley_root;
7−
8−#endif /*ASM_PARISC_MCKINLEY_H*/
arch/parisc/include/asm/pdc.h+3−2
@@ -44,10 +44,11 @@ int pdc_model_capabilities(unsigned long *capabilities); · 43 unmodified lines
4444 int pdc_model_platform_info(char *orig_prod_num, char *current_prod_num, char *serial_no);
4545 int pdc_cache_info(struct pdc_cache_info *cache);
4646 int pdc_spaceid_bits(unsigned long *space_bits);
47−#ifndef CONFIG_PA20
4847 int pdc_btlb_info(struct pdc_btlb_info *btlb);
48+int pdc_btlb_insert(unsigned long long vpage, unsigned long physpage, unsigned long len,
49+ unsigned long entry_info, unsigned long slot);
50+int pdc_btlb_purge_all(void);
4951 int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path);
50−#endif /* !CONFIG_PA20 */
5152 int pdc_pim_toc11(struct pdc_toc_pim_11 *ret);
5253 int pdc_pim_toc20(struct pdc_toc_pim_20 *ret);
5354 int pdc_lan_station_id(char *lan_addr, unsigned long net_hpa);
arch/parisc/include/asm/processor.h+1−0
@@ -310,6 +310,7 @@ extern void do_syscall_trace_exit(struct pt_regs *); · 309 unmodified lines
310310 struct seq_file;
311311 extern void early_trap_init(void);
312312 extern void collect_boot_cpu_data(void);
313+extern void btlb_init_per_cpu(void);
313314 extern int show_cpuinfo (struct seq_file *m, void *v);
314315
315316 /* driver code in driver/parisc */
arch/parisc/include/asm/ropes.h+5−2
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929 struct ioc {
3030 void __iomem *ioc_hpa; /* I/O MMU base address */
3131 char *res_map; /* resource map, bit == pdir entry */
32− u64 *pdir_base; /* physical base address */
32+ __le64 *pdir_base; /* physical base address */
3333 unsigned long ibase; /* pdir IOV Space base - shared w/lba_pci */
3434 unsigned long imask; /* pdir IOV Space mask - shared w/lba_pci */
3535 #ifdef ZX1_SUPPORT
@@ -86,6 +86,9 @@ struct sba_device { · 50 unmodified lines
8686 struct ioc ioc[MAX_IOC];
8787 };
8888
89+/* list of SBA's in system, see drivers/parisc/sba_iommu.c */
90+extern struct sba_device *sba_list;
91+
8992 #define ASTRO_RUNWAY_PORT 0x582
9093 #define IKE_MERCED_PORT 0x803
9194 #define REO_MERCED_PORT 0x804
@@ -110,7 +113,7 @@ static inline int IS_PLUTO(struct parisc_device *d) { · 18 unmodified lines
110113
111114 #define SBA_PDIR_VALID_BIT 0x8000000000000000ULL
112115
113−#define SBA_AGPGART_COOKIE 0x0000badbadc0ffeeULL
116+#define SBA_AGPGART_COOKIE (__force __le64) 0x0000badbadc0ffeeULL
114117
115118 #define SBA_FUNC_ID 0x0000 /* function id */
116119 #define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */
arch/parisc/include/asm/shmparam.h+15−0
@@ -2,6 +2,21 @@ · 1 unmodified line
22 #ifndef _ASMPARISC_SHMPARAM_H
33 #define _ASMPARISC_SHMPARAM_H
44
5+/*
6+ * PA-RISC uses virtually indexed & physically tagged (VIPT) caches
7+ * which has strict requirements when two pages to the same physical
8+ * address are accessed through different mappings. Read the section
9+ * "Address Aliasing" in the arch docs for more detail:
10+ * PA-RISC 1.1 (page 3-6):
11+ * https://parisc.wiki.kernel.org/images-parisc/6/68/Pa11_acd.pdf
12+ * PA-RISC 2.0 (page F-5):
13+ * https://parisc.wiki.kernel.org/images-parisc/7/73/Parisc2.0.pdf
14+ *
15+ * For Linux we allow kernel and userspace to map pages on page size
16+ * granularity (SHMLBA) but have to ensure that, if two pages are
17+ * mapped to the same physical address, the virtual and physical
18+ * addresses modulo SHM_COLOUR are identical.
19+ */
520 #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
621 #define SHM_COLOUR 0x00400000 /* shared mappings colouring */
722
arch/parisc/kernel/asm-offsets.c+2−0
@@ -275,6 +275,8 @@ int main(void) · 274 unmodified lines
275275 * and kernel data on physical huge pages */
276276 #ifdef CONFIG_HUGETLB_PAGE
277277 DEFINE(HUGEPAGE_SIZE, 1UL << REAL_HPAGE_SHIFT);
278+#elif !defined(CONFIG_64BIT)
279+ DEFINE(HUGEPAGE_SIZE, 4*1024*1024);
278280 #else
279281 DEFINE(HUGEPAGE_SIZE, PAGE_SIZE);
280282 #endif
arch/parisc/kernel/cache.c+1−7
@@ -58,7 +58,7 @@ int pa_serialize_tlb_flushes __ro_after_init; · 57 unmodified lines
5858
5959 struct pdc_cache_info cache_info __ro_after_init;
6060 #ifndef CONFIG_PA20
61−static struct pdc_btlb_info btlb_info __ro_after_init;
61+struct pdc_btlb_info btlb_info __ro_after_init;
6262 #endif
6363
6464 DEFINE_STATIC_KEY_TRUE(parisc_has_cache);
@@ -264,12 +264,6 @@ parisc_cache_init(void) · 199 unmodified lines
264264 icache_stride = CAFL_STRIDE(cache_info.ic_conf);
265265 #undef CAFL_STRIDE
266266
267−#ifndef CONFIG_PA20
268− if (pdc_btlb_info(&btlb_info) < 0) {
269− memset(&btlb_info, 0, sizeof btlb_info);
270− }
271−#endif
272−
273267 if ((boot_cpu_data.pdc.capabilities & PDC_MODEL_NVA_MASK) ==
274268 PDC_MODEL_NVA_UNSUPPORTED) {
275269 printk(KERN_WARNING "parisc_cache_init: Only equivalent aliasing supported!\n");
arch/parisc/kernel/drivers.c+1−1
@@ -925,9 +925,9 @@ static __init void qemu_header(void) · 924 unmodified lines
925925 pr_info("#define PARISC_MODEL \"%s\"\n\n",
926926 boot_cpu_data.pdc.sys_model_name);
927927
928+ #define p ((unsigned long *)&boot_cpu_data.pdc.model)
928929 pr_info("#define PARISC_PDC_MODEL 0x%lx, 0x%lx, 0x%lx, "
929930 "0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx, 0x%lx\n\n",
930− #define p ((unsigned long *)&boot_cpu_data.pdc.model)
931931 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]);
932932 #undef p
933933
arch/parisc/kernel/firmware.c+45−11
@@ -687,7 +687,6 @@ int pdc_spaceid_bits(unsigned long *space_bits) · 686 unmodified lines
687687 return retval;
688688 }
689689
690−#ifndef CONFIG_PA20
691690 /**
692691 * pdc_btlb_info - Return block TLB information.
693692 * @btlb: The return buffer.
@@ -696,18 +695,51 @@ int pdc_spaceid_bits(unsigned long *space_bits) · 2 unmodified lines
696695 */
697696 int pdc_btlb_info(struct pdc_btlb_info *btlb)
698697 {
699− int retval;
698+ int retval;
700699 unsigned long flags;
701700
702− spin_lock_irqsave(&pdc_lock, flags);
703− retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0);
704− memcpy(btlb, pdc_result, sizeof(*btlb));
705− spin_unlock_irqrestore(&pdc_lock, flags);
701+ if (IS_ENABLED(CONFIG_PA20))
702+ return PDC_BAD_PROC;
706703
707− if(retval < 0) {
708− btlb->max_size = 0;
709− }
710− return retval;
704+ spin_lock_irqsave(&pdc_lock, flags);
705+ retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INFO, __pa(pdc_result), 0);
706+ memcpy(btlb, pdc_result, sizeof(*btlb));
707+ spin_unlock_irqrestore(&pdc_lock, flags);
708+
709+ if(retval < 0) {
710+ btlb->max_size = 0;
711+ }
712+ return retval;
713+}
714+
715+int pdc_btlb_insert(unsigned long long vpage, unsigned long physpage, unsigned long len,
716+ unsigned long entry_info, unsigned long slot)
717+{
718+ int retval;
719+ unsigned long flags;
720+
721+ if (IS_ENABLED(CONFIG_PA20))
722+ return PDC_BAD_PROC;
723+
724+ spin_lock_irqsave(&pdc_lock, flags);
725+ retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_INSERT, (unsigned long) (vpage >> 32),
726+ (unsigned long) vpage, physpage, len, entry_info, slot);
727+ spin_unlock_irqrestore(&pdc_lock, flags);
728+ return retval;
729+}
730+
731+int pdc_btlb_purge_all(void)
732+{
733+ int retval;
734+ unsigned long flags;
735+
736+ if (IS_ENABLED(CONFIG_PA20))
737+ return PDC_BAD_PROC;
738+
739+ spin_lock_irqsave(&pdc_lock, flags);
740+ retval = mem_pdc_call(PDC_BLOCK_TLB, PDC_BTLB_PURGE_ALL);
741+ spin_unlock_irqrestore(&pdc_lock, flags);
742+ return retval;
711743 }
712744
713745 /**
@@ -728,6 +760,9 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address, · 14 unmodified lines
728760 int retval;
729761 unsigned long flags;
730762
763+ if (IS_ENABLED(CONFIG_PA20))
764+ return PDC_BAD_PROC;
765+
731766 spin_lock_irqsave(&pdc_lock, flags);
732767 memcpy(pdc_result2, mod_path, sizeof(*mod_path));
733768 retval = mem_pdc_call(PDC_MEM_MAP, PDC_MEM_MAP_HPA, __pa(pdc_result),
@@ -737,7 +772,6 @@ int pdc_mem_map_hpa(struct pdc_memory_map *address, · 3 unmodified lines
737772
738773 return retval;
739774 }
740−#endif /* !CONFIG_PA20 */
741775
742776 /**
743777 * pdc_lan_station_id - Get the LAN address.
arch/parisc/kernel/head.S+13−3
@@ -180,10 +180,10 @@ $pgt_fill_loop: · 179 unmodified lines
180180 std %dp,0x18(%r10)
181181 #endif
182182
183−#ifdef CONFIG_64BIT
184− /* Get PDCE_PROC for monarch CPU. */
185183 #define MEM_PDC_LO 0x388
186184 #define MEM_PDC_HI 0x35C
185+#ifdef CONFIG_64BIT
186+ /* Get PDCE_PROC for monarch CPU. */
187187 ldw MEM_PDC_LO(%r0),%r3
188188 ldw MEM_PDC_HI(%r0),%r10
189189 depd %r10, 31, 32, %r3 /* move to upper word */
@@ -269,7 +269,17 @@ stext_pdc_ret: · 79 unmodified lines
269269 tovirt_r1 %r6
270270 mtctl %r6,%cr30 /* restore task thread info */
271271 #endif
272−
272+
273+#ifndef CONFIG_64BIT
274+ /* clear all BTLBs */
275+ ldi PDC_BLOCK_TLB,%arg0
276+ load32 PA(stext_pdc_btlb_ret), %rp
277+ ldw MEM_PDC_LO(%r0),%r3
278+ bv (%r3)
279+ ldi PDC_BTLB_PURGE_ALL,%arg1
280+stext_pdc_btlb_ret:
281+#endif
282+
273283 /* PARANOID: clear user scratch/user space SR's */
274284 mtsp %r0,%sr0
275285 mtsp %r0,%sr1
arch/parisc/kernel/irq.c+1−1
@@ -365,7 +365,7 @@ union irq_stack_union { · 364 unmodified lines
365365 volatile unsigned int lock[1];
366366 };
367367
368−DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = {
368+static DEFINE_PER_CPU(union irq_stack_union, irq_stack_union) = {
369369 .slock = { 1,1,1,1 },
370370 };
371371 #endif
arch/parisc/kernel/processor.c+2−0
@@ -368,6 +368,8 @@ int init_per_cpu(int cpunum) · 367 unmodified lines
368368 /* FUTURE: Enable Performance Monitor : ccr bit 0x20 */
369369 init_percpu_prof(cpunum);
370370
371+ btlb_init_per_cpu();
372+
371373 return ret;
372374 }
373375
arch/parisc/kernel/vmlinux.lds.S+1−0
@@ -154,6 +154,7 @@ SECTIONS · 153 unmodified lines
154154 }
155155
156156 /* End of data section */
157+ . = ALIGN(PAGE_SIZE);
157158 _edata = .;
158159
159160 /* BSS */
arch/parisc/mm/hugetlbpage.c+1−1
@@ -140,7 +140,7 @@ static void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 139 unmodified lines
140140 }
141141
142142 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
143− pte_t *ptep, pte_t entry)
143+ pte_t *ptep, pte_t entry, unsigned long sz)
144144 {
145145 __set_huge_pte_at(mm, addr, ptep, entry);
146146 }
arch/parisc/mm/init.c+72−0
@@ -32,6 +32,7 @@ · 31 unmodified lines
3232 #include <asm/sections.h>
3333 #include <asm/msgbuf.h>
3434 #include <asm/sparsemem.h>
35+#include <asm/asm-offsets.h>
3536
3637 extern int data_start;
3738 extern void parisc_kernel_start(void); /* Kernel entry point in head.S */
@@ -720,6 +721,77 @@ void __init paging_init(void) · 682 unmodified lines
720721 parisc_bootmem_free();
721722 }
722723
724+static void alloc_btlb(unsigned long start, unsigned long end, int *slot,
725+ unsigned long entry_info)
726+{
727+ const int slot_max = btlb_info.fixed_range_info.num_comb;
728+ int min_num_pages = btlb_info.min_size;
729+ unsigned long size;
730+
731+ /* map at minimum 4 pages */
732+ if (min_num_pages < 4)
733+ min_num_pages = 4;
734+
735+ size = HUGEPAGE_SIZE;
736+ while (start < end && *slot < slot_max && size >= PAGE_SIZE) {
737+ /* starting address must have same alignment as size! */
738+ /* if correctly aligned and fits in double size, increase */
739+ if (((start & (2 * size - 1)) == 0) &&
740+ (end - start) >= (2 * size)) {
741+ size <<= 1;
742+ continue;
743+ }
744+ /* if current size alignment is too big, try smaller size */
745+ if ((start & (size - 1)) != 0) {
746+ size >>= 1;
747+ continue;
748+ }
749+ if ((end - start) >= size) {
750+ if ((size >> PAGE_SHIFT) >= min_num_pages)
751+ pdc_btlb_insert(start >> PAGE_SHIFT, __pa(start) >> PAGE_SHIFT,
752+ size >> PAGE_SHIFT, entry_info, *slot);
753+ (*slot)++;
754+ start += size;
755+ continue;
756+ }
757+ size /= 2;
758+ continue;
759+ }
760+}
761+
762+void btlb_init_per_cpu(void)
763+{
764+ unsigned long s, t, e;
765+ int slot;
766+
767+ /* BTLBs are not available on 64-bit CPUs */
768+ if (IS_ENABLED(CONFIG_PA20))
769+ return;
770+ else if (pdc_btlb_info(&btlb_info) < 0) {
771+ memset(&btlb_info, 0, sizeof btlb_info);
772+ }
773+
774+ /* insert BLTLBs for code and data segments */
775+ s = (uintptr_t) dereference_function_descriptor(&_stext);
776+ e = (uintptr_t) dereference_function_descriptor(&_etext);
777+ t = (uintptr_t) dereference_function_descriptor(&_sdata);
778+ BUG_ON(t != e);
779+
780+ /* code segments */
781+ slot = 0;
782+ alloc_btlb(s, e, &slot, 0x13800000);
783+
784+ /* sanity check */
785+ t = (uintptr_t) dereference_function_descriptor(&_edata);
786+ e = (uintptr_t) dereference_function_descriptor(&__bss_start);
787+ BUG_ON(t != e);
788+
789+ /* data segments */
790+ s = (uintptr_t) dereference_function_descriptor(&_sdata);
791+ e = (uintptr_t) dereference_function_descriptor(&__bss_stop);
792+ alloc_btlb(s, e, &slot, 0x11800000);
793+}
794+
723795 #ifdef CONFIG_PA20
724796
725797 /*
arch/powerpc/Kconfig+1−1
@@ -255,7 +255,7 @@ config PPC · 254 unmodified lines
255255 select HAVE_KPROBES
256256 select HAVE_KPROBES_ON_FTRACE
257257 select HAVE_KRETPROBES
258− select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if HAVE_OBJTOOL_MCOUNT
258+ select HAVE_LD_DEAD_CODE_DATA_ELIMINATION if HAVE_OBJTOOL_MCOUNT && (!ARCH_USING_PATCHABLE_FUNCTION_ENTRY || (!CC_IS_GCC || GCC_VERSION >= 110100))
259259 select HAVE_LIVEPATCH if HAVE_DYNAMIC_FTRACE_WITH_REGS
260260 select HAVE_MOD_ARCH_SPECIFIC
261261 select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h+2−1
@@ -46,7 +46,8 @@ static inline int check_and_get_huge_psize(int shift) · 45 unmodified lines
4646 }
4747
4848 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
49−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte);
49+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
50+ pte_t pte, unsigned long sz);
5051
5152 #define __HAVE_ARCH_HUGE_PTE_CLEAR
5253 static inline void huge_pte_clear(struct mm_struct *mm, unsigned long addr,
arch/powerpc/kernel/hw_breakpoint.c+15−1
@@ -230,13 +230,15 @@ void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs) · 229 unmodified lines
230230 struct arch_hw_breakpoint *info;
231231 int i;
232232
233+ preempt_disable();
234+
233235 for (i = 0; i < nr_wp_slots(); i++) {
234236 struct perf_event *bp = __this_cpu_read(bp_per_reg[i]);
235237
236238 if (unlikely(bp && counter_arch_bp(bp)->perf_single_step))
237239 goto reset;
238240 }
239− return;
241+ goto out;
240242
241243 reset:
242244 regs_set_return_msr(regs, regs->msr & ~MSR_SE);
@@ -245,6 +247,9 @@ reset: · 2 unmodified lines
245247 __set_breakpoint(i, info);
246248 info->perf_single_step = false;
247249 }
250+
251+out:
252+ preempt_enable();
248253 }
249254
250255 static bool is_larx_stcx_instr(int type)
@@ -363,6 +368,11 @@ static void handle_p10dd1_spurious_exception(struct perf_event **bp, · 112 unmodified lines
363368 }
364369 }
365370
371+/*
372+ * Handle a DABR or DAWR exception.
373+ *
374+ * Called in atomic context.
375+ */
366376 int hw_breakpoint_handler(struct die_args *args)
367377 {
368378 bool err = false;
@@ -490,6 +500,8 @@ NOKPROBE_SYMBOL(hw_breakpoint_handler); · 121 unmodified lines
490500
491501 /*
492502 * Handle single-step exceptions following a DABR hit.
503+ *
504+ * Called in atomic context.
493505 */
494506 static int single_step_dabr_instruction(struct die_args *args)
495507 {
@@ -541,6 +553,8 @@ NOKPROBE_SYMBOL(single_step_dabr_instruction); · 45 unmodified lines
541553
542554 /*
543555 * Handle debug exception notifications.
556+ *
557+ * Called in atomic context.
544558 */
545559 int hw_breakpoint_exceptions_notify(
546560 struct notifier_block *unused, unsigned long val, void *data)
arch/powerpc/kernel/hw_breakpoint_constraints.c+6−1
@@ -131,8 +131,13 @@ void wp_get_instr_detail(struct pt_regs *regs, ppc_inst_t *instr, · 130 unmodified lines
131131 int *type, int *size, unsigned long *ea)
132132 {
133133 struct instruction_op op;
134+ int err;
134135
135− if (__get_user_instr(*instr, (void __user *)regs->nip))
136+ pagefault_disable();
137+ err = __get_user_instr(*instr, (void __user *)regs->nip);
138+ pagefault_enable();
139+
140+ if (err)
136141 return;
137142
138143 analyse_instr(&op, regs, *instr);
arch/powerpc/kernel/stacktrace.c+5−22
@@ -73,29 +73,12 @@ int __no_sanitize_address arch_stack_walk_reliable(stack_trace_consume_fn consum · 72 unmodified lines
7373 bool firstframe;
7474
7575 stack_end = stack_page + THREAD_SIZE;
76− if (!is_idle_task(task)) {
77− /*
78− * For user tasks, this is the SP value loaded on
79− * kernel entry, see "PACAKSAVE(r13)" in _switch() and
80− * system_call_common().
81− *
82− * Likewise for non-swapper kernel threads,
83− * this also happens to be the top of the stack
84− * as setup by copy_thread().
85− *
86− * Note that stack backlinks are not properly setup by
87− * copy_thread() and thus, a forked task() will have
88− * an unreliable stack trace until it's been
89− * _switch()'ed to for the first time.
90− */
91− stack_end -= STACK_USER_INT_FRAME_SIZE;
92− } else {
93− /*
94− * idle tasks have a custom stack layout,
95− * c.f. cpu_idle_thread_init().
96− */
76+
77+ // See copy_thread() for details.
78+ if (task->flags & PF_KTHREAD)
9779 stack_end -= STACK_FRAME_MIN_SIZE;
98− }
80+ else
81+ stack_end -= STACK_USER_INT_FRAME_SIZE;
9982
10083 if (task == current)
10184 sp = current_stack_frame();
arch/powerpc/kernel/traps.c+36−20
@@ -1512,23 +1512,11 @@ static void do_program_check(struct pt_regs *regs) · 1511 unmodified lines
15121512 return;
15131513 }
15141514
1515− if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE) && user_mode(regs)) {
1516− ppc_inst_t insn;
1517−
1518− if (get_user_instr(insn, (void __user *)regs->nip)) {
1519− _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
1520− return;
1521− }
1522−
1523− if (ppc_inst_primary_opcode(insn) == 31 &&
1524− get_xop(ppc_inst_val(insn)) == OP_31_XOP_HASHCHK) {
1525− _exception(SIGILL, regs, ILL_ILLOPN, regs->nip);
1526− return;
1527− }
1515+ /* User mode considers other cases after enabling IRQs */
1516+ if (!user_mode(regs)) {
1517+ _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
1518+ return;
15281519 }
1529−
1530− _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
1531− return;
15321520 }
15331521 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
15341522 if (reason & REASON_TM) {
@@ -1561,16 +1549,44 @@ static void do_program_check(struct pt_regs *regs) · 26 unmodified lines
15611549
15621550 /*
15631551 * If we took the program check in the kernel skip down to sending a
1564− * SIGILL. The subsequent cases all relate to emulating instructions
1565− * which we should only do for userspace. We also do not want to enable
1566− * interrupts for kernel faults because that might lead to further
1567− * faults, and loose the context of the original exception.
1552+ * SIGILL. The subsequent cases all relate to user space, such as
1553+ * emulating instructions which we should only do for user space. We
1554+ * also do not want to enable interrupts for kernel faults because that
1555+ * might lead to further faults, and loose the context of the original
1556+ * exception.
15681557 */
15691558 if (!user_mode(regs))
15701559 goto sigill;
15711560
15721561 interrupt_cond_local_irq_enable(regs);
15731562
1563+ /*
1564+ * (reason & REASON_TRAP) is mostly handled before enabling IRQs,
1565+ * except get_user_instr() can sleep so we cannot reliably inspect the
1566+ * current instruction in that context. Now that we know we are
1567+ * handling a user space trap and can sleep, we can check if the trap
1568+ * was a hashchk failure.
1569+ */
1570+ if (reason & REASON_TRAP) {
1571+ if (cpu_has_feature(CPU_FTR_DEXCR_NPHIE)) {
1572+ ppc_inst_t insn;
1573+
1574+ if (get_user_instr(insn, (void __user *)regs->nip)) {
1575+ _exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
1576+ return;
1577+ }
1578+
1579+ if (ppc_inst_primary_opcode(insn) == 31 &&
1580+ get_xop(ppc_inst_val(insn)) == OP_31_XOP_HASHCHK) {
1581+ _exception(SIGILL, regs, ILL_ILLOPN, regs->nip);
1582+ return;
1583+ }
1584+ }
1585+
1586+ _exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
1587+ return;
1588+ }
1589+
15741590 /* (reason & REASON_ILLEGAL) would be the obvious thing here,
15751591 * but there seems to be a hardware bug on the 405GP (RevD)
15761592 * that means ESR is sometimes set incorrectly - either to
arch/powerpc/mm/book3s64/hugetlbpage.c+4−1
@@ -143,11 +143,14 @@ pte_t huge_ptep_modify_prot_start(struct vm_area_struct *vma, · 142 unmodified lines
143143 void huge_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr,
144144 pte_t *ptep, pte_t old_pte, pte_t pte)
145145 {
146+ unsigned long psize;
146147
147148 if (radix_enabled())
148149 return radix__huge_ptep_modify_prot_commit(vma, addr, ptep,
149150 old_pte, pte);
150− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
151+
152+ psize = huge_page_size(hstate_vma(vma));
153+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
151154 }
152155
153156 void __init hugetlbpage_init_defaultsize(void)
arch/powerpc/mm/book3s64/radix_hugetlbpage.c+2−1
@@ -47,6 +47,7 @@ void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 46 unmodified lines
4747 pte_t old_pte, pte_t pte)
4848 {
4949 struct mm_struct *mm = vma->vm_mm;
50+ unsigned long psize = huge_page_size(hstate_vma(vma));
5051
5152 /*
5253 * POWER9 NMMU must flush the TLB after clearing the PTE before
@@ -58,5 +59,5 @@ void radix__huge_ptep_modify_prot_commit(struct vm_area_struct *vma, · 5 unmodified lines
5859 atomic_read(&mm->context.copros) > 0)
5960 radix__flush_hugetlb_page(vma, addr);
6061
61− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
62+ set_huge_pte_at(vma->vm_mm, addr, ptep, pte, psize);
6263 }
arch/powerpc/mm/nohash/8xx.c+2−1
@@ -91,7 +91,8 @@ static int __ref __early_map_kernel_hugepage(unsigned long va, phys_addr_t pa, · 90 unmodified lines
9191 if (new && WARN_ON(pte_present(*ptep) && pgprot_val(prot)))
9292 return -EINVAL;
9393
94− set_huge_pte_at(&init_mm, va, ptep, pte_mkhuge(pfn_pte(pa >> PAGE_SHIFT, prot)));
94+ set_huge_pte_at(&init_mm, va, ptep,
95+ pte_mkhuge(pfn_pte(pa >> PAGE_SHIFT, prot)), psize);
9596
9697 return 0;
9798 }
arch/powerpc/mm/pgtable.c+2−1
@@ -288,7 +288,8 @@ int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 287 unmodified lines
288288 }
289289
290290 #if defined(CONFIG_PPC_8xx)
291−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
291+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
292+ pte_t pte, unsigned long sz)
292293 {
293294 pmd_t *pmd = pmd_off(mm, addr);
294295 pte_basic_t val;
arch/powerpc/perf/hv-24x7.c+1−1
@@ -1418,7 +1418,7 @@ static int h_24x7_event_init(struct perf_event *event) · 1417 unmodified lines
14181418 }
14191419
14201420 domain = event_get_domain(event);
1421− if (domain >= HV_PERF_DOMAIN_MAX) {
1421+ if (domain == 0 || domain >= HV_PERF_DOMAIN_MAX) {
14221422 pr_devel("invalid domain %d\n", domain);
14231423 return -EINVAL;
14241424 }
arch/powerpc/platforms/82xx/Kconfig+1−2
@@ -2,6 +2,7 @@ · 1 unmodified line
22 menuconfig PPC_82xx
33 bool "82xx-based boards (PQ II)"
44 depends on PPC_BOOK3S_32
5+ select FSL_SOC
56
67 if PPC_82xx
78
@@ -9,7 +10,6 @@ config EP8248E · 1 unmodified line
910 bool "Embedded Planet EP8248E (a.k.a. CWH-PPC-8248N-VE)"
1011 select CPM2
1112 select PPC_INDIRECT_PCI if PCI
12− select FSL_SOC
1313 select PHYLIB if NETDEVICES
1414 select MDIO_BITBANG if PHYLIB
1515 help
@@ -22,7 +22,6 @@ config MGCOGE · 6 unmodified lines
2222 bool "Keymile MGCOGE"
2323 select CPM2
2424 select PPC_INDIRECT_PCI if PCI
25− select FSL_SOC
2625 help
2726 This enables support for the Keymile MGCOGE board.
2827
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi+26−25
@@ -262,7 +262,7 @@ · 261 unmodified lines
262262 reg = <0x100000 0x400000>;
263263 };
264264 reserved-data@600000 {
265− reg = <0x600000 0x1000000>;
265+ reg = <0x600000 0xa00000>;
266266 };
267267 };
268268 };
@@ -440,30 +440,6 @@ · 171 unmodified lines
440440 };
441441 };
442442
443− uart0_pins: uart0-0 {
444− tx-pins {
445− pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
446− GPOEN_ENABLE,
447− GPI_NONE)>;
448− bias-disable;
449− drive-strength = <12>;
450− input-disable;
451− input-schmitt-disable;
452− slew-rate = <0>;
453− };
454−
455− rx-pins {
456− pinmux = <GPIOMUX(6, GPOUT_LOW,
457− GPOEN_DISABLE,
458− GPI_SYS_UART0_RX)>;
459− bias-disable; /* external pull-up */
460− drive-strength = <2>;
461− input-enable;
462− input-schmitt-enable;
463− slew-rate = <0>;
464− };
465− };
466−
467443 tdm_pins: tdm-0 {
468444 tx-pins {
469445 pinmux = <GPIOMUX(44, GPOUT_SYS_TDM_TXD,
@@ -497,6 +473,30 @@ · 27 unmodified lines
497473 input-enable;
498474 };
499475 };
476+
477+ uart0_pins: uart0-0 {
478+ tx-pins {
479+ pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
480+ GPOEN_ENABLE,
481+ GPI_NONE)>;
482+ bias-disable;
483+ drive-strength = <12>;
484+ input-disable;
485+ input-schmitt-disable;
486+ slew-rate = <0>;
487+ };
488+
489+ rx-pins {
490+ pinmux = <GPIOMUX(6, GPOUT_LOW,
491+ GPOEN_DISABLE,
492+ GPI_SYS_UART0_RX)>;
493+ bias-disable; /* external pull-up */
494+ drive-strength = <2>;
495+ input-enable;
496+ input-schmitt-enable;
497+ slew-rate = <0>;
498+ };
499+ };
500500 };
501501
502502 &tdm {
@@ -513,6 +513,7 @@ · 10 unmodified lines
513513
514514 &usb0 {
515515 dr_mode = "peripheral";
516+ status = "okay";
516517 };
517518
518519 &U74_1 {
arch/riscv/include/asm/errata_list.h+2−2
@@ -105,7 +105,7 @@ asm volatile(ALTERNATIVE( \ · 104 unmodified lines
105105 * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
106106 * 0000001 01001 rs1 000 00000 0001011
107107 * dcache.cva rs1 (clean, virtual address)
108− * 0000001 00100 rs1 000 00000 0001011
108+ * 0000001 00101 rs1 000 00000 0001011
109109 *
110110 * dcache.cipa rs1 (clean then invalidate, physical address)
111111 * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
@@ -118,7 +118,7 @@ asm volatile(ALTERNATIVE( \ · 6 unmodified lines
118118 * 0000000 11001 00000 000 00000 0001011
119119 */
120120 #define THEAD_inval_A0 ".long 0x0265000b"
121−#define THEAD_clean_A0 ".long 0x0245000b"
121+#define THEAD_clean_A0 ".long 0x0255000b"
122122 #define THEAD_flush_A0 ".long 0x0275000b"
123123 #define THEAD_SYNC_S ".long 0x0190000b"
124124
arch/riscv/include/asm/hugetlb.h+2−1
@@ -18,7 +18,8 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr, · 17 unmodified lines
1818
1919 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
2020 void set_huge_pte_at(struct mm_struct *mm,
21− unsigned long addr, pte_t *ptep, pte_t pte);
21+ unsigned long addr, pte_t *ptep, pte_t pte,
22+ unsigned long sz);
2223
2324 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
2425 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
arch/riscv/kernel/elf_kexec.c+7−1
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len, · 97 unmodified lines
9898 kbuf.image = image;
9999 kbuf.buf_min = lowest_paddr;
100100 kbuf.buf_max = ULONG_MAX;
101− kbuf.buf_align = PAGE_SIZE;
101+
102+ /*
103+ * Current riscv boot protocol requires 2MB alignment for
104+ * RV64 and 4MB alignment for RV32
105+ *
106+ */
107+ kbuf.buf_align = PMD_SIZE;
102108 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
103109 kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
104110 kbuf.top_down = false;
arch/riscv/kvm/vcpu_onereg.c+5−2
@@ -460,8 +460,11 @@ static int riscv_vcpu_get_isa_ext_single(struct kvm_vcpu *vcpu, · 459 unmodified lines
460460 reg_num >= ARRAY_SIZE(kvm_isa_ext_arr))
461461 return -ENOENT;
462462
463− *reg_val = 0;
464463 host_isa_ext = kvm_isa_ext_arr[reg_num];
464+ if (!__riscv_isa_extension_available(NULL, host_isa_ext))
465+ return -ENOENT;
466+
467+ *reg_val = 0;
465468 if (__riscv_isa_extension_available(vcpu->arch.isa, host_isa_ext))
466469 *reg_val = 1; /* Mark the given extension as available */
467470
@@ -842,7 +845,7 @@ static int copy_isa_ext_reg_indices(const struct kvm_vcpu *vcpu, · 374 unmodified lines
842845 u64 reg = KVM_REG_RISCV | size | KVM_REG_RISCV_ISA_EXT | i;
843846
844847 isa_ext = kvm_isa_ext_arr[i];
845− if (!__riscv_isa_extension_available(vcpu->arch.isa, isa_ext))
848+ if (!__riscv_isa_extension_available(NULL, isa_ext))
846849 continue;
847850
848851 if (uindices) {
arch/riscv/mm/hugetlbpage.c+2−1
@@ -180,7 +180,8 @@ pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags) · 179 unmodified lines
180180 void set_huge_pte_at(struct mm_struct *mm,
181181 unsigned long addr,
182182 pte_t *ptep,
183− pte_t pte)
183+ pte_t pte,
184+ unsigned long sz)
184185 {
185186 int i, pte_num;
186187
arch/s390/configs/debug_defconfig+10−4
@@ -40,23 +40,25 @@ CONFIG_SCHED_AUTOGROUP=y · 39 unmodified lines
4040 CONFIG_EXPERT=y
4141 # CONFIG_SYSFS_SYSCALL is not set
4242 CONFIG_PROFILING=y
43+CONFIG_KEXEC_FILE=y
44+CONFIG_KEXEC_SIG=y
45+CONFIG_CRASH_DUMP=y
4346 CONFIG_LIVEPATCH=y
4447 CONFIG_MARCH_ZEC12=y
4548 CONFIG_TUNE_ZEC12=y
4649 CONFIG_NR_CPUS=512
4750 CONFIG_NUMA=y
4851 CONFIG_HZ_100=y
49−CONFIG_KEXEC_FILE=y
50−CONFIG_KEXEC_SIG=y
52+CONFIG_CERT_STORE=y
5153 CONFIG_EXPOLINE=y
5254 CONFIG_EXPOLINE_AUTO=y
5355 CONFIG_CHSC_SCH=y
5456 CONFIG_VFIO_CCW=m
5557 CONFIG_VFIO_AP=m
56−CONFIG_CRASH_DUMP=y
5758 CONFIG_PROTECTED_VIRTUALIZATION_GUEST=y
5859 CONFIG_CMM=m
5960 CONFIG_APPLDATA_BASE=y
61+CONFIG_S390_HYPFS_FS=y
6062 CONFIG_KVM=m
6163 CONFIG_S390_UNWIND_SELFTEST=m
6264 CONFIG_S390_KPROBES_SANITY_TEST=m
@@ -434,6 +436,7 @@ CONFIG_SCSI_DH_EMC=m · 371 unmodified lines
434436 CONFIG_SCSI_DH_ALUA=m
435437 CONFIG_MD=y
436438 CONFIG_BLK_DEV_MD=y
439+# CONFIG_MD_BITMAP_FILE is not set
437440 CONFIG_MD_LINEAR=m
438441 CONFIG_MD_MULTIPATH=m
439442 CONFIG_MD_FAULTY=m
@@ -577,6 +580,7 @@ CONFIG_SOFT_WATCHDOG=m · 137 unmodified lines
577580 CONFIG_DIAG288_WATCHDOG=m
578581 # CONFIG_DRM_DEBUG_MODESET_LOCK is not set
579582 CONFIG_FB=y
583+# CONFIG_FB_DEVICE is not set
580584 CONFIG_FRAMEBUFFER_CONSOLE=y
581585 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
582586 # CONFIG_HID_SUPPORT is not set
@@ -647,6 +651,7 @@ CONFIG_PROC_KCORE=y · 64 unmodified lines
647651 CONFIG_TMPFS=y
648652 CONFIG_TMPFS_POSIX_ACL=y
649653 CONFIG_TMPFS_INODE64=y
654+CONFIG_TMPFS_QUOTA=y
650655 CONFIG_HUGETLBFS=y
651656 CONFIG_ECRYPT_FS=m
652657 CONFIG_CRAMFS=m
@@ -703,6 +708,7 @@ CONFIG_IMA_WRITE_POLICY=y · 50 unmodified lines
703708 CONFIG_IMA_APPRAISE=y
704709 CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
705710 CONFIG_INIT_STACK_NONE=y
711+CONFIG_BUG_ON_DATA_CORRUPTION=y
706712 CONFIG_CRYPTO_USER=m
707713 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
708714 CONFIG_CRYPTO_PCRYPT=m
@@ -825,9 +831,9 @@ CONFIG_LOCK_STAT=y · 116 unmodified lines
825831 CONFIG_DEBUG_ATOMIC_SLEEP=y
826832 CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
827833 CONFIG_DEBUG_IRQFLAGS=y
834+CONFIG_DEBUG_LIST=y
828835 CONFIG_DEBUG_SG=y
829836 CONFIG_DEBUG_NOTIFIERS=y
830−CONFIG_BUG_ON_DATA_CORRUPTION=y
831837 CONFIG_DEBUG_CREDENTIALS=y
832838 CONFIG_RCU_TORTURE_TEST=m
833839 CONFIG_RCU_REF_SCALE_TEST=m
arch/s390/configs/defconfig+9−4
@@ -38,23 +38,25 @@ CONFIG_SCHED_AUTOGROUP=y · 37 unmodified lines
3838 CONFIG_EXPERT=y
3939 # CONFIG_SYSFS_SYSCALL is not set
4040 CONFIG_PROFILING=y
41+CONFIG_KEXEC_FILE=y
42+CONFIG_KEXEC_SIG=y
43+CONFIG_CRASH_DUMP=y
4144 CONFIG_LIVEPATCH=y
4245 CONFIG_MARCH_ZEC12=y
4346 CONFIG_TUNE_ZEC12=y
4447 CONFIG_NR_CPUS=512
4548 CONFIG_NUMA=y
4649 CONFIG_HZ_100=y
47−CONFIG_KEXEC_FILE=y
48−CONFIG_KEXEC_SIG=y
50+CONFIG_CERT_STORE=y
4951 CONFIG_EXPOLINE=y
5052 CONFIG_EXPOLINE_AUTO=y
5153 CONFIG_CHSC_SCH=y
5254 CONFIG_VFIO_CCW=m
5355 CONFIG_VFIO_AP=m
54−CONFIG_CRASH_DUMP=y
5556 CONFIG_PROTECTED_VIRTUALIZATION_GUEST=y
5657 CONFIG_CMM=m
5758 CONFIG_APPLDATA_BASE=y
59+CONFIG_S390_HYPFS_FS=y
5860 CONFIG_KVM=m
5961 CONFIG_S390_UNWIND_SELFTEST=m
6062 CONFIG_S390_KPROBES_SANITY_TEST=m
@@ -424,6 +426,7 @@ CONFIG_SCSI_DH_EMC=m · 363 unmodified lines
424426 CONFIG_SCSI_DH_ALUA=m
425427 CONFIG_MD=y
426428 CONFIG_BLK_DEV_MD=y
429+# CONFIG_MD_BITMAP_FILE is not set
427430 CONFIG_MD_LINEAR=m
428431 CONFIG_MD_MULTIPATH=m
429432 CONFIG_MD_FAULTY=m
@@ -566,6 +569,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y · 136 unmodified lines
566569 CONFIG_SOFT_WATCHDOG=m
567570 CONFIG_DIAG288_WATCHDOG=m
568571 CONFIG_FB=y
572+# CONFIG_FB_DEVICE is not set
569573 CONFIG_FRAMEBUFFER_CONSOLE=y
570574 CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
571575 # CONFIG_HID_SUPPORT is not set
@@ -632,6 +636,7 @@ CONFIG_PROC_KCORE=y · 60 unmodified lines
632636 CONFIG_TMPFS=y
633637 CONFIG_TMPFS_POSIX_ACL=y
634638 CONFIG_TMPFS_INODE64=y
639+CONFIG_TMPFS_QUOTA=y
635640 CONFIG_HUGETLBFS=y
636641 CONFIG_CONFIGFS_FS=m
637642 CONFIG_ECRYPT_FS=m
@@ -687,6 +692,7 @@ CONFIG_IMA_WRITE_POLICY=y · 49 unmodified lines
687692 CONFIG_IMA_APPRAISE=y
688693 CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"
689694 CONFIG_INIT_STACK_NONE=y
695+CONFIG_BUG_ON_DATA_CORRUPTION=y
690696 CONFIG_CRYPTO_FIPS=y
691697 CONFIG_CRYPTO_USER=m
692698 # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
@@ -781,7 +787,6 @@ CONFIG_PTDUMP_DEBUGFS=y · 88 unmodified lines
781787 CONFIG_DEBUG_MEMORY_INIT=y
782788 CONFIG_PANIC_ON_OOPS=y
783789 CONFIG_TEST_LOCKUP=m
784−CONFIG_BUG_ON_DATA_CORRUPTION=y
785790 CONFIG_RCU_TORTURE_TEST=m
786791 CONFIG_RCU_REF_SCALE_TEST=m
787792 CONFIG_RCU_CPU_STALL_TIMEOUT=60
arch/s390/configs/zfcpdump_defconfig+2−2
@@ -8,6 +8,7 @@ CONFIG_BPF_SYSCALL=y · 7 unmodified lines
88 # CONFIG_NET_NS is not set
99 CONFIG_BLK_DEV_INITRD=y
1010 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
11+CONFIG_CRASH_DUMP=y
1112 CONFIG_MARCH_ZEC12=y
1213 CONFIG_TUNE_ZEC12=y
1314 # CONFIG_COMPAT is not set
@@ -15,9 +16,8 @@ CONFIG_NR_CPUS=2 · 1 unmodified line
1516 CONFIG_HZ_100=y
1617 # CONFIG_CHSC_SCH is not set
1718 # CONFIG_SCM_BUS is not set
18−CONFIG_CRASH_DUMP=y
1919 # CONFIG_PFAULT is not set
20−# CONFIG_S390_HYPFS_FS is not set
20+# CONFIG_S390_HYPFS is not set
2121 # CONFIG_VIRTUALIZATION is not set
2222 # CONFIG_S390_GUEST is not set
2323 # CONFIG_SECCOMP is not set
arch/s390/include/asm/hugetlb.h+4−2
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616 #define hugepages_supported() (MACHINE_HAS_EDAT1)
1717
1818 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
19+ pte_t *ptep, pte_t pte, unsigned long sz);
20+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
1921 pte_t *ptep, pte_t pte);
2022 pte_t huge_ptep_get(pte_t *ptep);
2123 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
@@ -65,7 +67,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 43 unmodified lines
6567 int changed = !pte_same(huge_ptep_get(ptep), pte);
6668 if (changed) {
6769 huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
68− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
70+ __set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
6971 }
7072 return changed;
7173 }
@@ -74,7 +76,7 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, · 2 unmodified lines
7476 unsigned long addr, pte_t *ptep)
7577 {
7678 pte_t pte = huge_ptep_get_and_clear(mm, addr, ptep);
77− set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
79+ __set_huge_pte_at(mm, addr, ptep, pte_wrprotect(pte));
7880 }
7981
8082 static inline pte_t mk_huge_pte(struct page *page, pgprot_t pgprot)
arch/s390/kernel/cert_store.c+4−3
@@ -432,15 +432,16 @@ static char *get_key_description(struct vcssb *vcssb, const struct vce *vce) · 431 unmodified lines
432432 char *desc;
433433
434434 cs_token = vcssb->cs_token;
435− /* Description string contains "%64s:%04u:%08u\0". */
435+ /* Description string contains "%64s:%05u:%010u\0". */
436436 name_len = sizeof(vce->vce_hdr.vc_name);
437− len = name_len + 1 + 4 + 1 + 8 + 1;
437+ len = name_len + 1 + 5 + 1 + 10 + 1;
438438 desc = kmalloc(len, GFP_KERNEL);
439439 if (!desc)
440440 return NULL;
441441
442442 memcpy(desc, vce->vce_hdr.vc_name, name_len);
443− sprintf(desc + name_len, ":%04u:%08u", vce->vce_hdr.vc_index, cs_token);
443+ snprintf(desc + name_len, len - name_len, ":%05u:%010u",
444+ vce->vce_hdr.vc_index, cs_token);
444445
445446 return desc;
446447 }
arch/s390/mm/hugetlbpage.c+7−1
@@ -142,7 +142,7 @@ static void clear_huge_pte_skeys(struct mm_struct *mm, unsigned long rste) · 141 unmodified lines
142142 __storage_key_init_range(paddr, paddr + size - 1);
143143 }
144144
145−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
145+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
146146 pte_t *ptep, pte_t pte)
147147 {
148148 unsigned long rste;
@@ -163,6 +163,12 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 14 unmodified lines
163163 set_pte(ptep, __pte(rste));
164164 }
165165
166+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
167+ pte_t *ptep, pte_t pte, unsigned long sz)
168+{
169+ __set_huge_pte_at(mm, addr, ptep, pte);
170+}
171+
166172 pte_t huge_ptep_get(pte_t *ptep)
167173 {
168174 return __rste_to_pte(pte_val(*ptep));
arch/sh/mm/ioremap.c+2−2
@@ -72,8 +72,8 @@ __ioremap_29bit(phys_addr_t offset, unsigned long size, pgprot_t prot) · 71 unmodified lines
7272 #define __ioremap_29bit(offset, size, prot) NULL
7373 #endif /* CONFIG_29BIT */
7474
75−void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
76− unsigned long prot)
75+void __iomem __ref *ioremap_prot(phys_addr_t phys_addr, size_t size,
76+ unsigned long prot)
7777 {
7878 void __iomem *mapped;
7979 pgprot_t pgprot = __pgprot(prot);
arch/sparc/include/asm/hugetlb.h+4−2
@@ -14,6 +14,8 @@ extern struct pud_huge_patch_entry __pud_huge_patch, __pud_huge_patch_end; · 13 unmodified lines
1414
1515 #define __HAVE_ARCH_HUGE_SET_HUGE_PTE_AT
1616 void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
17+ pte_t *ptep, pte_t pte, unsigned long sz);
18+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
1719 pte_t *ptep, pte_t pte);
1820
1921 #define __HAVE_ARCH_HUGE_PTEP_GET_AND_CLEAR
@@ -32,7 +34,7 @@ static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, · 12 unmodified lines
3234 unsigned long addr, pte_t *ptep)
3335 {
3436 pte_t old_pte = *ptep;
35− set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
37+ __set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
3638 }
3739
3840 #define __HAVE_ARCH_HUGE_PTEP_SET_ACCESS_FLAGS
@@ -42,7 +44,7 @@ static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, · 3 unmodified lines
4244 {
4345 int changed = !pte_same(*ptep, pte);
4446 if (changed) {
45− set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
47+ __set_huge_pte_at(vma->vm_mm, addr, ptep, pte);
4648 flush_tlb_page(vma, addr);
4749 }
4850 return changed;
arch/sparc/mm/hugetlbpage.c+7−1
@@ -328,7 +328,7 @@ pte_t *huge_pte_offset(struct mm_struct *mm, · 327 unmodified lines
328328 return pte_offset_huge(pmd, addr);
329329 }
330330
331−void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
331+void __set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
332332 pte_t *ptep, pte_t entry)
333333 {
334334 unsigned int nptes, orig_shift, shift;
@@ -364,6 +364,12 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, · 29 unmodified lines
364364 orig_shift);
365365 }
366366
367+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
368+ pte_t *ptep, pte_t entry, unsigned long sz)
369+{
370+ __set_huge_pte_at(mm, addr, ptep, entry);
371+}
372+
367373 pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
368374 pte_t *ptep)
369375 {
arch/x86/Kconfig+1−1
@@ -1945,6 +1945,7 @@ config EFI · 1944 unmodified lines
19451945 select UCS2_STRING
19461946 select EFI_RUNTIME_WRAPPERS
19471947 select ARCH_USE_MEMREMAP_PROT
1948+ select EFI_RUNTIME_MAP if KEXEC_CORE
19481949 help
19491950 This enables the kernel to use EFI runtime services that are
19501951 available (such as the EFI variable services).
@@ -2020,7 +2021,6 @@ config EFI_MAX_FAKE_MEM · 69 unmodified lines
20202021 config EFI_RUNTIME_MAP
20212022 bool "Export EFI runtime maps to sysfs" if EXPERT
20222023 depends on EFI
2023− default KEXEC_CORE
20242024 help
20252025 Export EFI runtime memory regions to /sys/firmware/efi/runtime-map.
20262026 That memory map is required by the 2nd kernel to set up EFI virtual
arch/x86/boot/compressed/ident_map_64.c+8−0
@@ -59,6 +59,14 @@ static void *alloc_pgt_page(void *context) · 58 unmodified lines
5959 return NULL;
6060 }
6161
62+ /* Consumed more tables than expected? */
63+ if (pages->pgt_buf_offset == BOOT_PGT_SIZE_WARN) {
64+ debug_putstr("pgt_buf running low in " __FILE__ "\n");
65+ debug_putstr("Need to raise BOOT_PGT_SIZE?\n");
66+ debug_putaddr(pages->pgt_buf_offset);
67+ debug_putaddr(pages->pgt_buf_size);
68+ }
69+
6270 entry = pages->pgt_buf + pages->pgt_buf_offset;
6371 pages->pgt_buf_offset += PAGE_SIZE;
6472
arch/x86/entry/common.c+1−1
@@ -294,7 +294,7 @@ static void __xen_pv_evtchn_do_upcall(struct pt_regs *regs) · 293 unmodified lines
294294
295295 inc_irq_stat(irq_hv_callback_count);
296296
297− xen_hvm_evtchn_do_upcall();
297+ xen_evtchn_do_upcall();
298298
299299 set_irq_regs(old_regs);
300300 }
arch/x86/events/amd/core.c+17−7
@@ -534,8 +534,12 @@ static void amd_pmu_cpu_reset(int cpu) · 533 unmodified lines
534534 /* Clear enable bits i.e. PerfCntrGlobalCtl.PerfCntrEn */
535535 wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, 0);
536536
537− /* Clear overflow bits i.e. PerfCntrGLobalStatus.PerfCntrOvfl */
538− wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR, amd_pmu_global_cntr_mask);
537+ /*
538+ * Clear freeze and overflow bits i.e. PerfCntrGLobalStatus.LbrFreeze
539+ * and PerfCntrGLobalStatus.PerfCntrOvfl
540+ */
541+ wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR,
542+ GLOBAL_STATUS_LBRS_FROZEN | amd_pmu_global_cntr_mask);
539543 }
540544
541545 static int amd_pmu_cpu_prepare(int cpu)
@@ -570,6 +574,7 @@ static void amd_pmu_cpu_starting(int cpu) · 28 unmodified lines
570574 int i, nb_id;
571575
572576 cpuc->perf_ctr_virt_mask = AMD64_EVENTSEL_HOSTONLY;
577+ amd_pmu_cpu_reset(cpu);
573578
574579 if (!x86_pmu.amd_nb_constraints)
575580 return;
@@ -591,8 +596,6 @@ static void amd_pmu_cpu_starting(int cpu) · 15 unmodified lines
591596
592597 cpuc->amd_nb->nb_id = nb_id;
593598 cpuc->amd_nb->refcnt++;
594−
595− amd_pmu_cpu_reset(cpu);
596599 }
597600
598601 static void amd_pmu_cpu_dead(int cpu)
@@ -601,6 +604,7 @@ static void amd_pmu_cpu_dead(int cpu) · 2 unmodified lines
601604
602605 kfree(cpuhw->lbr_sel);
603606 cpuhw->lbr_sel = NULL;
607+ amd_pmu_cpu_reset(cpu);
604608
605609 if (!x86_pmu.amd_nb_constraints)
606610 return;
@@ -613,8 +617,6 @@ static void amd_pmu_cpu_dead(int cpu) · 6 unmodified lines
613617
614618 cpuhw->amd_nb = NULL;
615619 }
616−
617− amd_pmu_cpu_reset(cpu);
618620 }
619621
620622 static inline void amd_pmu_set_global_ctl(u64 ctl)
@@ -884,7 +886,7 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs) · 263 unmodified lines
884886 struct hw_perf_event *hwc;
885887 struct perf_event *event;
886888 int handled = 0, idx;
887− u64 status, mask;
889+ u64 reserved, status, mask;
888890 bool pmu_enabled;
889891
890892 /*
@@ -909,6 +911,14 @@ static int amd_pmu_v2_handle_irq(struct pt_regs *regs) · 18 unmodified lines
909911 status &= ~GLOBAL_STATUS_LBRS_FROZEN;
910912 }
911913
914+ reserved = status & ~amd_pmu_global_cntr_mask;
915+ if (reserved)
916+ pr_warn_once("Reserved PerfCntrGlobalStatus bits are set (0x%llx), please consider updating microcode\n",
917+ reserved);
918+
919+ /* Clear any reserved bits set by buggy microcode */
920+ status &= amd_pmu_global_cntr_mask;
921+
912922 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
913923 if (!test_bit(idx, cpuc->active_mask))
914924 continue;
arch/x86/include/asm/boot.h+31−14
@@ -40,23 +40,40 @@ · 39 unmodified lines
4040 #ifdef CONFIG_X86_64
4141 # define BOOT_STACK_SIZE 0x4000
4242
43+/*
44+ * Used by decompressor's startup_32() to allocate page tables for identity
45+ * mapping of the 4G of RAM in 4-level paging mode:
46+ * - 1 level4 table;
47+ * - 1 level3 table;
48+ * - 4 level2 table that maps everything with 2M pages;
49+ *
50+ * The additional level5 table needed for 5-level paging is allocated from
51+ * trampoline_32bit memory.
52+ */
4353 # define BOOT_INIT_PGT_SIZE (6*4096)
44−# ifdef CONFIG_RANDOMIZE_BASE
54+
4555 /*
46− * Assuming all cross the 512GB boundary:
47− * 1 page for level4
48− * (2+2)*4 pages for kernel, param, cmd_line, and randomized kernel
49− * 2 pages for first 2M (video RAM: CONFIG_X86_VERBOSE_BOOTUP).
50− * Total is 19 pages.
56+ * Total number of page tables kernel_add_identity_map() can allocate,
57+ * including page tables consumed by startup_32().
58+ *
59+ * Worst-case scenario:
60+ * - 5-level paging needs 1 level5 table;
61+ * - KASLR needs to map kernel, boot_params, cmdline and randomized kernel,
62+ * assuming all of them cross 256T boundary:
63+ * + 4*2 level4 table;
64+ * + 4*2 level3 table;
65+ * + 4*2 level2 table;
66+ * - X86_VERBOSE_BOOTUP needs to map the first 2M (video RAM):
67+ * + 1 level4 table;
68+ * + 1 level3 table;
69+ * + 1 level2 table;
70+ * Total: 28 tables
71+ *
72+ * Add 4 spare table in case decompressor touches anything beyond what is
73+ * accounted above. Warn if it happens.
5174 */
52−# ifdef CONFIG_X86_VERBOSE_BOOTUP
53−# define BOOT_PGT_SIZE (19*4096)
54−# else /* !CONFIG_X86_VERBOSE_BOOTUP */
55−# define BOOT_PGT_SIZE (17*4096)
56−# endif
57−# else /* !CONFIG_RANDOMIZE_BASE */
58−# define BOOT_PGT_SIZE BOOT_INIT_PGT_SIZE
59−# endif
75+# define BOOT_PGT_SIZE_WARN (28*4096)
76+# define BOOT_PGT_SIZE (32*4096)
6077
6178 #else /* !CONFIG_X86_64 */
6279 # define BOOT_STACK_SIZE 0x1000
arch/x86/include/asm/efi.h+2−30
@@ -91,19 +91,6 @@ static inline void efi_fpu_end(void) · 90 unmodified lines
9191
9292 #ifdef CONFIG_X86_32
9393 #define EFI_X86_KERNEL_ALLOC_LIMIT (SZ_512M - 1)
94−
95−#define arch_efi_call_virt_setup() \
96−({ \
97− efi_fpu_begin(); \
98− firmware_restrict_branch_speculation_start(); \
99−})
100−
101−#define arch_efi_call_virt_teardown() \
102−({ \
103− firmware_restrict_branch_speculation_end(); \
104− efi_fpu_end(); \
105−})
106−
10794 #else /* !CONFIG_X86_32 */
10895 #define EFI_X86_KERNEL_ALLOC_LIMIT EFI_ALLOC_LIMIT
10996
@@ -116,14 +103,6 @@ extern bool efi_disable_ibt_for_runtime; · 6 unmodified lines
116103 __efi_call(__VA_ARGS__); \
117104 })
118105
119−#define arch_efi_call_virt_setup() \
120−({ \
121− efi_sync_low_kernel_mappings(); \
122− efi_fpu_begin(); \
123− firmware_restrict_branch_speculation_start(); \
124− efi_enter_mm(); \
125−})
126−
127106 #undef arch_efi_call_virt
128107 #define arch_efi_call_virt(p, f, args...) ({ \
129108 u64 ret, ibt = ibt_save(efi_disable_ibt_for_runtime); \
@@ -132,13 +111,6 @@ extern bool efi_disable_ibt_for_runtime; · 2 unmodified lines
132111 ret; \
133112 })
134113
135−#define arch_efi_call_virt_teardown() \
136−({ \
137− efi_leave_mm(); \
138− firmware_restrict_branch_speculation_end(); \
139− efi_fpu_end(); \
140−})
141−
142114 #ifdef CONFIG_KASAN
143115 /*
144116 * CONFIG_KASAN may redefine memset to __memset. __memset function is present
@@ -168,8 +140,8 @@ extern void efi_delete_dummy_variable(void); · 23 unmodified lines
168140 extern void efi_crash_gracefully_on_page_fault(unsigned long phys_addr);
169141 extern void efi_free_boot_services(void);
170142
171−void efi_enter_mm(void);
172−void efi_leave_mm(void);
143+void arch_efi_call_virt_setup(void);
144+void arch_efi_call_virt_teardown(void);
173145
174146 /* kexec external ABI */
175147 struct efi_setup_data {
arch/x86/include/asm/kvm_host.h+1−2
@@ -1419,7 +1419,6 @@ struct kvm_arch { · 1418 unmodified lines
14191419 * the thread holds the MMU lock in write mode.
14201420 */
14211421 spinlock_t tdp_mmu_pages_lock;
1422− struct workqueue_struct *tdp_mmu_zap_wq;
14231422 #endif /* CONFIG_X86_64 */
14241423
14251424 /*
@@ -1835,7 +1834,7 @@ void kvm_mmu_vendor_module_exit(void); · 409 unmodified lines
18351834
18361835 void kvm_mmu_destroy(struct kvm_vcpu *vcpu);
18371836 int kvm_mmu_create(struct kvm_vcpu *vcpu);
1838−int kvm_mmu_init_vm(struct kvm *kvm);
1837+void kvm_mmu_init_vm(struct kvm *kvm);
18391838 void kvm_mmu_uninit_vm(struct kvm *kvm);
18401839
18411840 void kvm_mmu_after_set_cpuid(struct kvm_vcpu *vcpu);
arch/x86/include/asm/linkage.h+15−0
@@ -8,6 +8,14 @@ · 7 unmodified lines
88 #undef notrace
99 #define notrace __attribute__((no_instrument_function))
1010
11+#ifdef CONFIG_64BIT
12+/*
13+ * The generic version tends to create spurious ENDBR instructions under
14+ * certain conditions.
15+ */
16+#define _THIS_IP_ ({ unsigned long __here; asm ("lea 0(%%rip), %0" : "=r" (__here)); __here; })
17+#endif
18+
1119 #ifdef CONFIG_X86_32
1220 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
1321 #endif /* CONFIG_X86_32 */
@@ -97,6 +105,13 @@ · 83 unmodified lines
97105 CFI_POST_PADDING \
98106 SYM_FUNC_END(__cfi_##name)
99107
108+/* UML needs to be able to override memcpy() and friends for KASAN. */
109+#ifdef CONFIG_UML
110+# define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS_WEAK
111+#else
112+# define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS
113+#endif
114+
100115 /* SYM_TYPED_FUNC_START -- use for indirectly called globals, w/ CFI type */
101116 #define SYM_TYPED_FUNC_START(name) \
102117 SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \
arch/x86/include/asm/mmu_context.h+1−2
@@ -186,8 +186,7 @@ do { \ · 185 unmodified lines
186186 #else
187187 #define deactivate_mm(tsk, mm) \
188188 do { \
189− if (!tsk->vfork_done) \
190− shstk_free(tsk); \
189+ shstk_free(tsk); \
191190 load_gs_index(0); \
192191 loadsegment(fs, 0); \
193192 } while (0)
arch/x86/include/asm/paravirt_types.h+0−15
@@ -9,13 +9,6 @@ struct paravirt_patch_site { · 8 unmodified lines
99 u8 type; /* type of this instruction */
1010 u8 len; /* length of original instruction */
1111 };
12−
13−/* Lazy mode for batching updates / context switch */
14−enum paravirt_lazy_mode {
15− PARAVIRT_LAZY_NONE,
16− PARAVIRT_LAZY_MMU,
17− PARAVIRT_LAZY_CPU,
18−};
1912 #endif
2013
2114 #ifdef CONFIG_PARAVIRT
@@ -549,14 +542,6 @@ int paravirt_disable_iospace(void); · 527 unmodified lines
549542 __PVOP_VCALL(op, PVOP_CALL_ARG1(arg1), PVOP_CALL_ARG2(arg2), \
550543 PVOP_CALL_ARG3(arg3), PVOP_CALL_ARG4(arg4))
551544
552−enum paravirt_lazy_mode paravirt_get_lazy_mode(void);
553−void paravirt_start_context_switch(struct task_struct *prev);
554−void paravirt_end_context_switch(struct task_struct *next);
555−
556−void paravirt_enter_lazy_mmu(void);
557−void paravirt_leave_lazy_mmu(void);
558−void paravirt_flush_lazy_mmu(void);
559−
560545 void _paravirt_nop(void);
561546 void paravirt_BUG(void);
562547 unsigned long paravirt_ret0(void);
arch/x86/include/asm/pgtable.h+8−0
@@ -955,6 +955,14 @@ static inline int pte_same(pte_t a, pte_t b) · 954 unmodified lines
955955 return a.pte == b.pte;
956956 }
957957
958+static inline pte_t pte_next_pfn(pte_t pte)
959+{
960+ if (__pte_needs_invert(pte_val(pte)))
961+ return __pte(pte_val(pte) - (1UL << PFN_PTE_SHIFT));
962+ return __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT));
963+}
964+#define pte_next_pfn pte_next_pfn
965+
958966 static inline int pte_present(pte_t a)
959967 {
960968 return pte_flags(a) & (_PAGE_PRESENT | _PAGE_PROTNONE);
arch/x86/include/asm/processor.h+0−2
@@ -683,13 +683,11 @@ extern u16 get_llc_id(unsigned int cpu); · 682 unmodified lines
683683 #ifdef CONFIG_CPU_SUP_AMD
684684 extern u32 amd_get_nodes_per_socket(void);
685685 extern u32 amd_get_highest_perf(void);
686−extern bool cpu_has_ibpb_brtype_microcode(void);
687686 extern void amd_clear_divider(void);
688687 extern void amd_check_microcode(void);
689688 #else
690689 static inline u32 amd_get_nodes_per_socket(void) { return 0; }
691690 static inline u32 amd_get_highest_perf(void) { return 0; }
692−static inline bool cpu_has_ibpb_brtype_microcode(void) { return false; }
693691 static inline void amd_clear_divider(void) { }
694692 static inline void amd_check_microcode(void) { }
695693 #endif
arch/x86/include/asm/xen/hypervisor.h+37−0
@@ -36,6 +36,7 @@ · 35 unmodified lines
3636 extern struct shared_info *HYPERVISOR_shared_info;
3737 extern struct start_info *xen_start_info;
3838
39+#include <asm/bug.h>
3940 #include <asm/processor.h>
4041
4142 #define XEN_SIGNATURE "XenVMMXenVMM"
@@ -63,4 +64,40 @@ void __init xen_pvh_init(struct boot_params *boot_params); · 21 unmodified lines
6364 void __init mem_map_via_hcall(struct boot_params *boot_params_p);
6465 #endif
6566
67+/* Lazy mode for batching updates / context switch */
68+enum xen_lazy_mode {
69+ XEN_LAZY_NONE,
70+ XEN_LAZY_MMU,
71+ XEN_LAZY_CPU,
72+};
73+
74+DECLARE_PER_CPU(enum xen_lazy_mode, xen_lazy_mode);
75+DECLARE_PER_CPU(unsigned int, xen_lazy_nesting);
76+
77+static inline void enter_lazy(enum xen_lazy_mode mode)
78+{
79+ enum xen_lazy_mode old_mode = this_cpu_read(xen_lazy_mode);
80+
81+ if (mode == old_mode) {
82+ this_cpu_inc(xen_lazy_nesting);
83+ return;
84+ }
85+
86+ BUG_ON(old_mode != XEN_LAZY_NONE);
87+
88+ this_cpu_write(xen_lazy_mode, mode);
89+}
90+
91+static inline void leave_lazy(enum xen_lazy_mode mode)
92+{
93+ BUG_ON(this_cpu_read(xen_lazy_mode) != mode);
94+
95+ if (this_cpu_read(xen_lazy_nesting) == 0)
96+ this_cpu_write(xen_lazy_mode, XEN_LAZY_NONE);
97+ else
98+ this_cpu_dec(xen_lazy_nesting);
99+}
100+
101+enum xen_lazy_mode xen_get_lazy_mode(void);
102+
66103 #endif /* _ASM_X86_XEN_HYPERVISOR_H */
arch/x86/kernel/alternative.c+2−7
@@ -720,13 +720,8 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end) · 719 unmodified lines
720720 {
721721 s32 *s;
722722
723− /*
724− * Do not patch out the default return thunks if those needed are the
725− * ones generated by the compiler.
726− */
727− if (cpu_feature_enabled(X86_FEATURE_RETHUNK) &&
728− (x86_return_thunk == __x86_return_thunk))
729− return;
723+ if (cpu_feature_enabled(X86_FEATURE_RETHUNK))
724+ static_call_force_reinit();
730725
731726 for (s = start; s < end; s++) {
732727 void *dest = NULL, *addr = (void *)s + *s;
arch/x86/kernel/apic/x2apic_uv_x.c+5−6
@@ -1533,7 +1533,7 @@ static void __init build_socket_tables(void) · 1532 unmodified lines
15331533 {
15341534 struct uv_gam_range_entry *gre = uv_gre_table;
15351535 int nums, numn, nump;
1536− int cpu, i, lnid;
1536+ int i, lnid, apicid;
15371537 int minsock = _min_socket;
15381538 int maxsock = _max_socket;
15391539 int minpnode = _min_pnode;
@@ -1584,15 +1584,14 @@ static void __init build_socket_tables(void) · 44 unmodified lines
15841584
15851585 /* Set socket -> node values: */
15861586 lnid = NUMA_NO_NODE;
1587− for_each_possible_cpu(cpu) {
1588− int nid = cpu_to_node(cpu);
1589− int apicid, sockid;
1587+ for (apicid = 0; apicid < ARRAY_SIZE(__apicid_to_node); apicid++) {
1588+ int nid = __apicid_to_node[apicid];
1589+ int sockid;
15901590
1591− if (lnid == nid)
1591+ if ((nid == NUMA_NO_NODE) || (lnid == nid))
15921592 continue;
15931593 lnid = nid;
15941594
1595− apicid = per_cpu(x86_cpu_to_apicid, cpu);
15961595 sockid = apicid >> uv_cpuid.socketid_shift;
15971596
15981597 if (_socket_to_node[sockid - minsock] == SOCK_EMPTY)
arch/x86/kernel/callthunks.c+0−1
@@ -272,7 +272,6 @@ void __init callthunks_patch_builtin_calls(void) · 271 unmodified lines
272272 pr_info("Setting up call depth tracking\n");
273273 mutex_lock(&text_mutex);
274274 callthunks_setup(&cs, &builtin_coretext);
275− static_call_force_reinit();
276275 thunks_initialized = true;
277276 mutex_unlock(&text_mutex);
278277 }
arch/x86/kernel/cpu/amd.c+9−19
@@ -766,6 +766,15 @@ static void early_init_amd(struct cpuinfo_x86 *c) · 765 unmodified lines
766766
767767 if (cpu_has(c, X86_FEATURE_TOPOEXT))
768768 smp_num_siblings = ((cpuid_ebx(0x8000001e) >> 8) & 0xff) + 1;
769+
770+ if (!cpu_has(c, X86_FEATURE_HYPERVISOR) && !cpu_has(c, X86_FEATURE_IBPB_BRTYPE)) {
771+ if (c->x86 == 0x17 && boot_cpu_has(X86_FEATURE_AMD_IBPB))
772+ setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
773+ else if (c->x86 >= 0x19 && !wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB)) {
774+ setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
775+ setup_force_cpu_cap(X86_FEATURE_SBPB);
776+ }
777+ }
769778 }
770779
771780 static void init_amd_k8(struct cpuinfo_x86 *c)
@@ -1301,25 +1310,6 @@ void amd_check_microcode(void) · 529 unmodified lines
13011310 on_each_cpu(zenbleed_check_cpu, NULL, 1);
13021311 }
13031312
1304−bool cpu_has_ibpb_brtype_microcode(void)
1305−{
1306− switch (boot_cpu_data.x86) {
1307− /* Zen1/2 IBPB flushes branch type predictions too. */
1308− case 0x17:
1309− return boot_cpu_has(X86_FEATURE_AMD_IBPB);
1310− case 0x19:
1311− /* Poke the MSR bit on Zen3/4 to check its presence. */
1312− if (!wrmsrl_safe(MSR_IA32_PRED_CMD, PRED_CMD_SBPB)) {
1313− setup_force_cpu_cap(X86_FEATURE_SBPB);
1314− return true;
1315− } else {
1316− return false;
1317− }
1318− default:
1319− return false;
1320− }
1321−}
1322−
13231313 /*
13241314 * Issue a DIV 0/1 insn to clear any division data from previous DIV
13251315 * operations.
arch/x86/kernel/cpu/bugs.c+3−14
@@ -2404,26 +2404,15 @@ early_param("spec_rstack_overflow", srso_parse_cmdline); · 2403 unmodified lines
24042404
24052405 static void __init srso_select_mitigation(void)
24062406 {
2407− bool has_microcode;
2407+ bool has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE);
24082408
24092409 if (!boot_cpu_has_bug(X86_BUG_SRSO) || cpu_mitigations_off())
24102410 goto pred_cmd;
24112411
2412− /*
2413− * The first check is for the kernel running as a guest in order
2414− * for guests to verify whether IBPB is a viable mitigation.
2415− */
2416− has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE) || cpu_has_ibpb_brtype_microcode();
24172412 if (!has_microcode) {
24182413 pr_warn("IBPB-extending microcode not applied!\n");
24192414 pr_warn(SRSO_NOTICE);
24202415 } else {
2421− /*
2422− * Enable the synthetic (even if in a real CPUID leaf)
2423− * flags for guests.
2424− */
2425− setup_force_cpu_cap(X86_FEATURE_IBPB_BRTYPE);
2426−
24272416 /*
24282417 * Zen1/2 with SMT off aren't vulnerable after the right
24292418 * IBPB microcode has been applied.
@@ -2444,7 +2433,7 @@ static void __init srso_select_mitigation(void) · 14 unmodified lines
24442433
24452434 switch (srso_cmd) {
24462435 case SRSO_CMD_OFF:
2447− return;
2436+ goto pred_cmd;
24482437
24492438 case SRSO_CMD_MICROCODE:
24502439 if (has_microcode) {
@@ -2717,7 +2706,7 @@ static ssize_t srso_show_state(char *buf) · 266 unmodified lines
27172706
27182707 return sysfs_emit(buf, "%s%s\n",
27192708 srso_strings[srso_mitigation],
2720− (cpu_has_ibpb_brtype_microcode() ? "" : ", no microcode"));
2709+ boot_cpu_has(X86_FEATURE_IBPB_BRTYPE) ? "" : ", no microcode");
27212710 }
27222711
27232712 static ssize_t gds_show_state(char *buf)
arch/x86/kernel/cpu/common.c+1−1
@@ -1303,7 +1303,7 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = { · 1302 unmodified lines
13031303 VULNBL_AMD(0x15, RETBLEED),
13041304 VULNBL_AMD(0x16, RETBLEED),
13051305 VULNBL_AMD(0x17, RETBLEED | SMT_RSB | SRSO),
1306− VULNBL_HYGON(0x18, RETBLEED | SMT_RSB),
1306+ VULNBL_HYGON(0x18, RETBLEED | SMT_RSB | SRSO),
13071307 VULNBL_AMD(0x19, SRSO),
13081308 {}
13091309 };
arch/x86/kernel/cpu/sgx/encl.c+25−5
@@ -235,6 +235,21 @@ static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page, · 234 unmodified lines
235235 return epc_page;
236236 }
237237
238+/*
239+ * Ensure the SECS page is not swapped out. Must be called with encl->lock
240+ * to protect the enclave states including SECS and ensure the SECS page is
241+ * not swapped out again while being used.
242+ */
243+static struct sgx_epc_page *sgx_encl_load_secs(struct sgx_encl *encl)
244+{
245+ struct sgx_epc_page *epc_page = encl->secs.epc_page;
246+
247+ if (!epc_page)
248+ epc_page = sgx_encl_eldu(&encl->secs, NULL);
249+
250+ return epc_page;
251+}
252+
238253 static struct sgx_encl_page *__sgx_encl_load_page(struct sgx_encl *encl,
239254 struct sgx_encl_page *entry)
240255 {
@@ -248,11 +263,9 @@ static struct sgx_encl_page *__sgx_encl_load_page(struct sgx_encl *encl, · 7 unmodified lines
248263 return entry;
249264 }
250265
251− if (!(encl->secs.epc_page)) {
252− epc_page = sgx_encl_eldu(&encl->secs, NULL);
253− if (IS_ERR(epc_page))
254− return ERR_CAST(epc_page);
255− }
266+ epc_page = sgx_encl_load_secs(encl);
267+ if (IS_ERR(epc_page))
268+ return ERR_CAST(epc_page);
256269
257270 epc_page = sgx_encl_eldu(entry, encl->secs.epc_page);
258271 if (IS_ERR(epc_page))
@@ -339,6 +352,13 @@ static vm_fault_t sgx_encl_eaug_page(struct vm_area_struct *vma, · 80 unmodified lines
339352
340353 mutex_lock(&encl->lock);
341354
355+ epc_page = sgx_encl_load_secs(encl);
356+ if (IS_ERR(epc_page)) {
357+ if (PTR_ERR(epc_page) == -EBUSY)
358+ vmret = VM_FAULT_NOPAGE;
359+ goto err_out_unlock;
360+ }
361+
342362 epc_page = sgx_alloc_epc_page(encl_page, false);
343363 if (IS_ERR(epc_page)) {
344364 if (PTR_ERR(epc_page) == -EBUSY)
arch/x86/kernel/kgdb.c+0−1
@@ -695,7 +695,6 @@ void kgdb_arch_exit(void) · 694 unmodified lines
695695 }
696696
697697 /**
698− *
699698 * kgdb_skipexception - Bail out of KGDB when we've been triggered.
700699 * @exception: Exception vector number
701700 * @regs: Current &struct pt_regs.
arch/x86/kernel/paravirt.c+0−67
@@ -143,66 +143,7 @@ int paravirt_disable_iospace(void) · 142 unmodified lines
143143 return request_resource(&ioport_resource, &reserve_ioports);
144144 }
145145
146−static DEFINE_PER_CPU(enum paravirt_lazy_mode, paravirt_lazy_mode) = PARAVIRT_LAZY_NONE;
147−
148−static inline void enter_lazy(enum paravirt_lazy_mode mode)
149−{
150− BUG_ON(this_cpu_read(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
151−
152− this_cpu_write(paravirt_lazy_mode, mode);
153−}
154−
155−static void leave_lazy(enum paravirt_lazy_mode mode)
156−{
157− BUG_ON(this_cpu_read(paravirt_lazy_mode) != mode);
158−
159− this_cpu_write(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
160−}
161−
162−void paravirt_enter_lazy_mmu(void)
163−{
164− enter_lazy(PARAVIRT_LAZY_MMU);
165−}
166−
167−void paravirt_leave_lazy_mmu(void)
168−{
169− leave_lazy(PARAVIRT_LAZY_MMU);
170−}
171−
172−void paravirt_flush_lazy_mmu(void)
173−{
174− preempt_disable();
175−
176− if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
177− arch_leave_lazy_mmu_mode();
178− arch_enter_lazy_mmu_mode();
179− }
180−
181− preempt_enable();
182−}
183−
184146 #ifdef CONFIG_PARAVIRT_XXL
185−void paravirt_start_context_switch(struct task_struct *prev)
186−{
187− BUG_ON(preemptible());
188−
189− if (this_cpu_read(paravirt_lazy_mode) == PARAVIRT_LAZY_MMU) {
190− arch_leave_lazy_mmu_mode();
191− set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
192− }
193− enter_lazy(PARAVIRT_LAZY_CPU);
194−}
195−
196−void paravirt_end_context_switch(struct task_struct *next)
197−{
198− BUG_ON(preemptible());
199−
200− leave_lazy(PARAVIRT_LAZY_CPU);
201−
202− if (test_and_clear_ti_thread_flag(task_thread_info(next), TIF_LAZY_MMU_UPDATES))
203− arch_enter_lazy_mmu_mode();
204−}
205−
206147 static noinstr void pv_native_write_cr2(unsigned long val)
207148 {
208149 native_write_cr2(val);
@@ -229,14 +170,6 @@ static noinstr void pv_native_safe_halt(void) · 20 unmodified lines
229170 }
230171 #endif
231172
232−enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
233−{
234− if (in_interrupt())
235− return PARAVIRT_LAZY_NONE;
236−
237− return this_cpu_read(paravirt_lazy_mode);
238−}
239−
240173 struct pv_info pv_info = {
241174 .name = "bare hardware",
242175 #ifdef CONFIG_PARAVIRT_XXL
arch/x86/kernel/process.c+0−7
@@ -257,13 +257,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args) · 256 unmodified lines
257257 if (!ret && unlikely(test_tsk_thread_flag(current, TIF_IO_BITMAP)))
258258 io_bitmap_share(p);
259259
260− /*
261− * If copy_thread() if failing, don't leak the shadow stack possibly
262− * allocated in shstk_alloc_thread_stack() above.
263− */
264− if (ret)
265− shstk_free(p);
266−
267260 return ret;
268261 }
269262
arch/x86/kernel/setup.c+2−6
@@ -358,15 +358,11 @@ static void __init add_early_ima_buffer(u64 phys_addr) · 357 unmodified lines
358358 #if defined(CONFIG_HAVE_IMA_KEXEC) && !defined(CONFIG_OF_FLATTREE)
359359 int __init ima_free_kexec_buffer(void)
360360 {
361− int rc;
362−
363361 if (!ima_kexec_buffer_size)
364362 return -ENOENT;
365363
366− rc = memblock_phys_free(ima_kexec_buffer_phys,
367− ima_kexec_buffer_size);
368− if (rc)
369− return rc;
364+ memblock_free_late(ima_kexec_buffer_phys,
365+ ima_kexec_buffer_size);
370366
371367 ima_kexec_buffer_phys = 0;
372368 ima_kexec_buffer_size = 0;
arch/x86/kernel/shstk.c+31−2
@@ -205,10 +205,21 @@ unsigned long shstk_alloc_thread_stack(struct task_struct *tsk, unsigned long cl · 204 unmodified lines
205205 return 0;
206206
207207 /*
208− * For CLONE_VM, except vfork, the child needs a separate shadow
208+ * For CLONE_VFORK the child will share the parents shadow stack.
209+ * Make sure to clear the internal tracking of the thread shadow
210+ * stack so the freeing logic run for child knows to leave it alone.
211+ */
212+ if (clone_flags & CLONE_VFORK) {
213+ shstk->base = 0;
214+ shstk->size = 0;
215+ return 0;
216+ }
217+
218+ /*
219+ * For !CLONE_VM the child will use a copy of the parents shadow
209220 * stack.
210221 */
211− if ((clone_flags & (CLONE_VFORK | CLONE_VM)) != CLONE_VM)
222+ if (!(clone_flags & CLONE_VM))
212223 return 0;
213224
214225 size = adjust_shstk_size(stack_size);
@@ -408,7 +419,25 @@ void shstk_free(struct task_struct *tsk) · 193 unmodified lines
408419 if (!tsk->mm || tsk->mm != current->mm)
409420 return;
410421
422+ /*
423+ * If shstk->base is NULL, then this task is not managing its
424+ * own shadow stack (CLONE_VFORK). So skip freeing it.
425+ */
426+ if (!shstk->base)
427+ return;
428+
429+ /*
430+ * shstk->base is NULL for CLONE_VFORK child tasks, and so is
431+ * normal. But size = 0 on a shstk->base is not normal and
432+ * indicated an attempt to free the thread shadow stack twice.
433+ * Warn about it.
434+ */
435+ if (WARN_ON(!shstk->size))
436+ return;
437+
411438 unmap_shadow_stack(shstk->base, shstk->size);
439+
440+ shstk->size = 0;
412441 }
413442
414443 static int wrss_control(bool enable)
arch/x86/kernel/smpboot.c+9−3
@@ -579,7 +579,6 @@ static bool match_llc(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o) · 578 unmodified lines
579579 }
580580
581581
582−#if defined(CONFIG_SCHED_SMT) || defined(CONFIG_SCHED_CLUSTER) || defined(CONFIG_SCHED_MC)
583582 static inline int x86_sched_itmt_flags(void)
584583 {
585584 return sysctl_sched_itmt_enabled ? SD_ASYM_PACKING : 0;
@@ -603,7 +602,14 @@ static int x86_cluster_flags(void) · 17 unmodified lines
603602 return cpu_cluster_flags() | x86_sched_itmt_flags();
604603 }
605604 #endif
606−#endif
605+
606+static int x86_die_flags(void)
607+{
608+ if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU))
609+ return x86_sched_itmt_flags();
610+
611+ return 0;
612+}
607613
608614 /*
609615 * Set if a package/die has multiple NUMA nodes inside.
@@ -640,7 +646,7 @@ static void __init build_sched_topology(void) · 30 unmodified lines
640646 */
641647 if (!x86_has_numa_in_package) {
642648 x86_topology[i++] = (struct sched_domain_topology_level){
643− cpu_cpu_mask, SD_INIT_NAME(DIE)
649+ cpu_cpu_mask, x86_die_flags, SD_INIT_NAME(DIE)
644650 };
645651 }
646652
arch/x86/kvm/mmu/mmu.c+5−16
@@ -6167,20 +6167,15 @@ static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm) · 6166 unmodified lines
61676167 return unlikely(!list_empty_careful(&kvm->arch.zapped_obsolete_pages));
61686168 }
61696169
6170−int kvm_mmu_init_vm(struct kvm *kvm)
6170+void kvm_mmu_init_vm(struct kvm *kvm)
61716171 {
6172− int r;
6173−
61746172 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
61756173 INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages);
61766174 INIT_LIST_HEAD(&kvm->arch.possible_nx_huge_pages);
61776175 spin_lock_init(&kvm->arch.mmu_unsync_pages_lock);
61786176
6179− if (tdp_mmu_enabled) {
6180− r = kvm_mmu_init_tdp_mmu(kvm);
6181− if (r < 0)
6182− return r;
6183− }
6177+ if (tdp_mmu_enabled)
6178+ kvm_mmu_init_tdp_mmu(kvm);
61846179
61856180 kvm->arch.split_page_header_cache.kmem_cache = mmu_page_header_cache;
61866181 kvm->arch.split_page_header_cache.gfp_zero = __GFP_ZERO;
@@ -6189,8 +6184,6 @@ int kvm_mmu_init_vm(struct kvm *kvm) · 2 unmodified lines
61896184
61906185 kvm->arch.split_desc_cache.kmem_cache = pte_list_desc_cache;
61916186 kvm->arch.split_desc_cache.gfp_zero = __GFP_ZERO;
6192−
6193− return 0;
61946187 }
61956188
61966189 static void mmu_free_vm_memory_caches(struct kvm *kvm)
@@ -6246,7 +6239,6 @@ static bool kvm_rmap_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_e · 49 unmodified lines
62466239 void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end)
62476240 {
62486241 bool flush;
6249− int i;
62506242
62516243 if (WARN_ON_ONCE(gfn_end <= gfn_start))
62526244 return;
@@ -6257,11 +6249,8 @@ void kvm_zap_gfn_range(struct kvm *kvm, gfn_t gfn_start, gfn_t gfn_end) · 4 unmodified lines
62576249
62586250 flush = kvm_rmap_zap_gfn_range(kvm, gfn_start, gfn_end);
62596251
6260− if (tdp_mmu_enabled) {
6261− for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++)
6262− flush = kvm_tdp_mmu_zap_leafs(kvm, i, gfn_start,
6263− gfn_end, true, flush);
6264− }
6252+ if (tdp_mmu_enabled)
6253+ flush = kvm_tdp_mmu_zap_leafs(kvm, gfn_start, gfn_end, flush);
62656254
62666255 if (flush)
62676256 kvm_flush_remote_tlbs_range(kvm, gfn_start, gfn_end - gfn_start);
arch/x86/kvm/mmu/mmu_internal.h+7−8
@@ -58,7 +58,12 @@ struct kvm_mmu_page { · 57 unmodified lines
5858
5959 bool tdp_mmu_page;
6060 bool unsync;
61− u8 mmu_valid_gen;
61+ union {
62+ u8 mmu_valid_gen;
63+
64+ /* Only accessed under slots_lock. */
65+ bool tdp_mmu_scheduled_root_to_zap;
66+ };
6267
6368 /*
6469 * The shadow page can't be replaced by an equivalent huge page
@@ -100,13 +105,7 @@ struct kvm_mmu_page { · 35 unmodified lines
100105 struct kvm_rmap_head parent_ptes; /* rmap pointers to parent sptes */
101106 tdp_ptep_t ptep;
102107 };
103− union {
104− DECLARE_BITMAP(unsync_child_bitmap, 512);
105− struct {
106− struct work_struct tdp_mmu_async_work;
107− void *tdp_mmu_async_data;
108− };
109− };
108+ DECLARE_BITMAP(unsync_child_bitmap, 512);
110109
111110 /*
112111 * Tracks shadow pages that, if zapped, would allow KVM to create an NX
arch/x86/kvm/mmu/tdp_mmu.c+67−85
@@ -12,18 +12,10 @@ · 11 unmodified lines
1212 #include <trace/events/kvm.h>
1313
1414 /* Initializes the TDP MMU for the VM, if enabled. */
15−int kvm_mmu_init_tdp_mmu(struct kvm *kvm)
15+void kvm_mmu_init_tdp_mmu(struct kvm *kvm)
1616 {
17− struct workqueue_struct *wq;
18−
19− wq = alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0);
20− if (!wq)
21− return -ENOMEM;
22−
2317 INIT_LIST_HEAD(&kvm->arch.tdp_mmu_roots);
2418 spin_lock_init(&kvm->arch.tdp_mmu_pages_lock);
25− kvm->arch.tdp_mmu_zap_wq = wq;
26− return 1;
2719 }
2820
2921 /* Arbitrarily returns true so that this may be used in if statements. */
@@ -46,20 +38,15 @@ void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm) · 16 unmodified lines
4638 * ultimately frees all roots.
4739 */
4840 kvm_tdp_mmu_invalidate_all_roots(kvm);
49−
50− /*
51− * Destroying a workqueue also first flushes the workqueue, i.e. no
52− * need to invoke kvm_tdp_mmu_zap_invalidated_roots().
53− */
54− destroy_workqueue(kvm->arch.tdp_mmu_zap_wq);
41+ kvm_tdp_mmu_zap_invalidated_roots(kvm);
5542
5643 WARN_ON(atomic64_read(&kvm->arch.tdp_mmu_pages));
5744 WARN_ON(!list_empty(&kvm->arch.tdp_mmu_roots));
5845
5946 /*
6047 * Ensure that all the outstanding RCU callbacks to free shadow pages
61− * can run before the VM is torn down. Work items on tdp_mmu_zap_wq
62− * can call kvm_tdp_mmu_put_root and create new callbacks.
48+ * can run before the VM is torn down. Putting the last reference to
49+ * zapped roots will create new callbacks.
6350 */
6451 rcu_barrier();
6552 }
@@ -86,46 +73,6 @@ static void tdp_mmu_free_sp_rcu_callback(struct rcu_head *head) · 20 unmodified lines
8673 tdp_mmu_free_sp(sp);
8774 }
8875
89−static void tdp_mmu_zap_root(struct kvm *kvm, struct kvm_mmu_page *root,
90− bool shared);
91−
92−static void tdp_mmu_zap_root_work(struct work_struct *work)
93−{
94− struct kvm_mmu_page *root = container_of(work, struct kvm_mmu_page,
95− tdp_mmu_async_work);
96− struct kvm *kvm = root->tdp_mmu_async_data;
97−
98− read_lock(&kvm->mmu_lock);
99−
100− /*
101− * A TLB flush is not necessary as KVM performs a local TLB flush when
102− * allocating a new root (see kvm_mmu_load()), and when migrating vCPU
103− * to a different pCPU. Note, the local TLB flush on reuse also
104− * invalidates any paging-structure-cache entries, i.e. TLB entries for
105− * intermediate paging structures, that may be zapped, as such entries
106− * are associated with the ASID on both VMX and SVM.
107− */
108− tdp_mmu_zap_root(kvm, root, true);
109−
110− /*
111− * Drop the refcount using kvm_tdp_mmu_put_root() to test its logic for
112− * avoiding an infinite loop. By design, the root is reachable while
113− * it's being asynchronously zapped, thus a different task can put its
114− * last reference, i.e. flowing through kvm_tdp_mmu_put_root() for an
115− * asynchronously zapped root is unavoidable.
116− */
117− kvm_tdp_mmu_put_root(kvm, root, true);
118−
119− read_unlock(&kvm->mmu_lock);
120−}
121−
122−static void tdp_mmu_schedule_zap_root(struct kvm *kvm, struct kvm_mmu_page *root)
123−{
124− root->tdp_mmu_async_data = kvm;
125− INIT_WORK(&root->tdp_mmu_async_work, tdp_mmu_zap_root_work);
126− queue_work(kvm->arch.tdp_mmu_zap_wq, &root->tdp_mmu_async_work);
127−}
128−
12976 void kvm_tdp_mmu_put_root(struct kvm *kvm, struct kvm_mmu_page *root,
13077 bool shared)
13178 {
@@ -211,8 +158,12 @@ static struct kvm_mmu_page *tdp_mmu_next_root(struct kvm *kvm, · 79 unmodified lines
211158 #define for_each_valid_tdp_mmu_root_yield_safe(_kvm, _root, _as_id, _shared) \
212159 __for_each_tdp_mmu_root_yield_safe(_kvm, _root, _as_id, _shared, true)
213160
214−#define for_each_tdp_mmu_root_yield_safe(_kvm, _root, _as_id) \
215− __for_each_tdp_mmu_root_yield_safe(_kvm, _root, _as_id, false, false)
161+#define for_each_tdp_mmu_root_yield_safe(_kvm, _root, _shared) \
162+ for (_root = tdp_mmu_next_root(_kvm, NULL, _shared, false); \
163+ _root; \
164+ _root = tdp_mmu_next_root(_kvm, _root, _shared, false)) \
165+ if (!kvm_lockdep_assert_mmu_lock_held(_kvm, _shared)) { \
166+ } else
216167
217168 /*
218169 * Iterate over all TDP MMU roots. Requires that mmu_lock be held for write,
@@ -292,7 +243,7 @@ hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu) · 73 unmodified lines
292243 * by a memslot update or by the destruction of the VM. Initialize the
293244 * refcount to two; one reference for the vCPU, and one reference for
294245 * the TDP MMU itself, which is held until the root is invalidated and
295− * is ultimately put by tdp_mmu_zap_root_work().
246+ * is ultimately put by kvm_tdp_mmu_zap_invalidated_roots().
296247 */
297248 refcount_set(&root->tdp_mmu_root_count, 2);
298249
@@ -877,13 +828,12 @@ static bool tdp_mmu_zap_leafs(struct kvm *kvm, struct kvm_mmu_page *root, · 578 unmodified lines
877828 * true if a TLB flush is needed before releasing the MMU lock, i.e. if one or
878829 * more SPTEs were zapped since the MMU lock was last acquired.
879830 */
880−bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start, gfn_t end,
881− bool can_yield, bool flush)
831+bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, gfn_t start, gfn_t end, bool flush)
882832 {
883833 struct kvm_mmu_page *root;
884834
885− for_each_tdp_mmu_root_yield_safe(kvm, root, as_id)
886− flush = tdp_mmu_zap_leafs(kvm, root, start, end, can_yield, flush);
835+ for_each_tdp_mmu_root_yield_safe(kvm, root, false)
836+ flush = tdp_mmu_zap_leafs(kvm, root, start, end, true, flush);
887837
888838 return flush;
889839 }
@@ -891,7 +841,6 @@ bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start, gfn_t end, · 1 unmodified line
891841 void kvm_tdp_mmu_zap_all(struct kvm *kvm)
892842 {
893843 struct kvm_mmu_page *root;
894− int i;
895844
896845 /*
897846 * Zap all roots, including invalid roots, as all SPTEs must be dropped
@@ -905,10 +854,8 @@ void kvm_tdp_mmu_zap_all(struct kvm *kvm) · 7 unmodified lines
905854 * is being destroyed or the userspace VMM has exited. In both cases,
906855 * KVM_RUN is unreachable, i.e. no vCPUs will ever service the request.
907856 */
908− for (i = 0; i < KVM_ADDRESS_SPACE_NUM; i++) {
909− for_each_tdp_mmu_root_yield_safe(kvm, root, i)
910− tdp_mmu_zap_root(kvm, root, false);
911− }
857+ for_each_tdp_mmu_root_yield_safe(kvm, root, false)
858+ tdp_mmu_zap_root(kvm, root, false);
912859 }
913860
914861 /*
@@ -917,18 +864,47 @@ void kvm_tdp_mmu_zap_all(struct kvm *kvm) · 2 unmodified lines
917864 */
918865 void kvm_tdp_mmu_zap_invalidated_roots(struct kvm *kvm)
919866 {
920− flush_workqueue(kvm->arch.tdp_mmu_zap_wq);
867+ struct kvm_mmu_page *root;
868+
869+ read_lock(&kvm->mmu_lock);
870+
871+ for_each_tdp_mmu_root_yield_safe(kvm, root, true) {
872+ if (!root->tdp_mmu_scheduled_root_to_zap)
873+ continue;
874+
875+ root->tdp_mmu_scheduled_root_to_zap = false;
876+ KVM_BUG_ON(!root->role.invalid, kvm);
877+
878+ /*
879+ * A TLB flush is not necessary as KVM performs a local TLB
880+ * flush when allocating a new root (see kvm_mmu_load()), and
881+ * when migrating a vCPU to a different pCPU. Note, the local
882+ * TLB flush on reuse also invalidates paging-structure-cache
883+ * entries, i.e. TLB entries for intermediate paging structures,
884+ * that may be zapped, as such entries are associated with the
885+ * ASID on both VMX and SVM.
886+ */
887+ tdp_mmu_zap_root(kvm, root, true);
888+
889+ /*
890+ * The referenced needs to be put *after* zapping the root, as
891+ * the root must be reachable by mmu_notifiers while it's being
892+ * zapped
893+ */
894+ kvm_tdp_mmu_put_root(kvm, root, true);
895+ }
896+
897+ read_unlock(&kvm->mmu_lock);
921898 }
922899
923900 /*
924901 * Mark each TDP MMU root as invalid to prevent vCPUs from reusing a root that
925902 * is about to be zapped, e.g. in response to a memslots update. The actual
926− * zapping is performed asynchronously. Using a separate workqueue makes it
927− * easy to ensure that the destruction is performed before the "fast zap"
928− * completes, without keeping a separate list of invalidated roots; the list is
929− * effectively the list of work items in the workqueue.
903+ * zapping is done separately so that it happens with mmu_lock with read,
904+ * whereas invalidating roots must be done with mmu_lock held for write (unless
905+ * the VM is being destroyed).
930906 *
931− * Note, the asynchronous worker is gifted the TDP MMU's reference.
907+ * Note, kvm_tdp_mmu_zap_invalidated_roots() is gifted the TDP MMU's reference.
932908 * See kvm_tdp_mmu_get_vcpu_root_hpa().
933909 */
934910 void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm)
@@ -953,19 +929,20 @@ void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm) · 18 unmodified lines
953929 /*
954930 * As above, mmu_lock isn't held when destroying the VM! There can't
955931 * be other references to @kvm, i.e. nothing else can invalidate roots
956− * or be consuming roots, but walking the list of roots does need to be
957− * guarded against roots being deleted by the asynchronous zap worker.
932+ * or get/put references to roots.
958933 */
959− rcu_read_lock();
960−
961− list_for_each_entry_rcu(root, &kvm->arch.tdp_mmu_roots, link) {
934+ list_for_each_entry(root, &kvm->arch.tdp_mmu_roots, link) {
935+ /*
936+ * Note, invalid roots can outlive a memslot update! Invalid
937+ * roots must be *zapped* before the memslot update completes,
938+ * but a different task can acquire a reference and keep the
939+ * root alive after its been zapped.
940+ */
962941 if (!root->role.invalid) {
942+ root->tdp_mmu_scheduled_root_to_zap = true;
963943 root->role.invalid = true;
964− tdp_mmu_schedule_zap_root(kvm, root);
965944 }
966945 }
967−
968− rcu_read_unlock();
969946 }
970947
971948 /*
@@ -1146,8 +1123,13 @@ retry: · 174 unmodified lines
11461123 bool kvm_tdp_mmu_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range,
11471124 bool flush)
11481125 {
1149− return kvm_tdp_mmu_zap_leafs(kvm, range->slot->as_id, range->start,
1150− range->end, range->may_block, flush);
1126+ struct kvm_mmu_page *root;
1127+
1128+ __for_each_tdp_mmu_root_yield_safe(kvm, root, range->slot->as_id, false, false)
1129+ flush = tdp_mmu_zap_leafs(kvm, root, range->start, range->end,
1130+ range->may_block, flush);
1131+
1132+ return flush;
11511133 }
11521134
11531135 typedef bool (*tdp_handler_t)(struct kvm *kvm, struct tdp_iter *iter,
arch/x86/kvm/mmu/tdp_mmu.h+2−3
@@ -7,7 +7,7 @@ · 6 unmodified lines
77
88 #include "spte.h"
99
10−int kvm_mmu_init_tdp_mmu(struct kvm *kvm);
10+void kvm_mmu_init_tdp_mmu(struct kvm *kvm);
1111 void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm);
1212
1313 hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu);
@@ -20,8 +20,7 @@ __must_check static inline bool kvm_tdp_mmu_get_root(struct kvm_mmu_page *root) · 6 unmodified lines
2020 void kvm_tdp_mmu_put_root(struct kvm *kvm, struct kvm_mmu_page *root,
2121 bool shared);
2222
23−bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, int as_id, gfn_t start,
24− gfn_t end, bool can_yield, bool flush);
23+bool kvm_tdp_mmu_zap_leafs(struct kvm *kvm, gfn_t start, gfn_t end, bool flush);
2524 bool kvm_tdp_mmu_zap_sp(struct kvm *kvm, struct kvm_mmu_page *sp);
2625 void kvm_tdp_mmu_zap_all(struct kvm *kvm);
2726 void kvm_tdp_mmu_invalidate_all_roots(struct kvm *kvm);
arch/x86/kvm/svm/sev.c+26−8
@@ -2962,6 +2962,32 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in) · 2961 unmodified lines
29622962 count, in);
29632963 }
29642964
2965+static void sev_es_vcpu_after_set_cpuid(struct vcpu_svm *svm)
2966+{
2967+ struct kvm_vcpu *vcpu = &svm->vcpu;
2968+
2969+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
2970+ bool v_tsc_aux = guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP) ||
2971+ guest_cpuid_has(vcpu, X86_FEATURE_RDPID);
2972+
2973+ set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, v_tsc_aux, v_tsc_aux);
2974+ }
2975+}
2976+
2977+void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm)
2978+{
2979+ struct kvm_vcpu *vcpu = &svm->vcpu;
2980+ struct kvm_cpuid_entry2 *best;
2981+
2982+ /* For sev guests, the memory encryption bit is not reserved in CR3. */
2983+ best = kvm_find_cpuid_entry(vcpu, 0x8000001F);
2984+ if (best)
2985+ vcpu->arch.reserved_gpa_bits &= ~(1UL << (best->ebx & 0x3f));
2986+
2987+ if (sev_es_guest(svm->vcpu.kvm))
2988+ sev_es_vcpu_after_set_cpuid(svm);
2989+}
2990+
29652991 static void sev_es_init_vmcb(struct vcpu_svm *svm)
29662992 {
29672993 struct vmcb *vmcb = svm->vmcb01.ptr;
@@ -3024,14 +3050,6 @@ static void sev_es_init_vmcb(struct vcpu_svm *svm) · 56 unmodified lines
30243050 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTBRANCHTOIP, 1, 1);
30253051 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTFROMIP, 1, 1);
30263052 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_LASTINTTOIP, 1, 1);
3027−
3028− if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) &&
3029− (guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDTSCP) ||
3030− guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDPID))) {
3031− set_msr_interception(vcpu, svm->msrpm, MSR_TSC_AUX, 1, 1);
3032− if (guest_cpuid_has(&svm->vcpu, X86_FEATURE_RDTSCP))
3033− svm_clr_intercept(svm, INTERCEPT_RDTSCP);
3034− }
30353053 }
30363054
30373055 void sev_init_vmcb(struct vcpu_svm *svm)
arch/x86/kvm/svm/svm.c+35−8
@@ -683,6 +683,21 @@ static int svm_hardware_enable(void) · 682 unmodified lines
683683
684684 amd_pmu_enable_virt();
685685
686+ /*
687+ * If TSC_AUX virtualization is supported, TSC_AUX becomes a swap type
688+ * "B" field (see sev_es_prepare_switch_to_guest()) for SEV-ES guests.
689+ * Since Linux does not change the value of TSC_AUX once set, prime the
690+ * TSC_AUX field now to avoid a RDMSR on every vCPU run.
691+ */
692+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
693+ struct sev_es_save_area *hostsa;
694+ u32 msr_hi;
695+
696+ hostsa = (struct sev_es_save_area *)(page_address(sd->save_area) + 0x400);
697+
698+ rdmsr(MSR_TSC_AUX, hostsa->tsc_aux, msr_hi);
699+ }
700+
686701 return 0;
687702 }
688703
@@ -1532,7 +1547,14 @@ static void svm_prepare_switch_to_guest(struct kvm_vcpu *vcpu) · 843 unmodified lines
15321547 if (tsc_scaling)
15331548 __svm_write_tsc_multiplier(vcpu->arch.tsc_scaling_ratio);
15341549
1535− if (likely(tsc_aux_uret_slot >= 0))
1550+ /*
1551+ * TSC_AUX is always virtualized for SEV-ES guests when the feature is
1552+ * available. The user return MSR support is not required in this case
1553+ * because TSC_AUX is restored on #VMEXIT from the host save area
1554+ * (which has been initialized in svm_hardware_enable()).
1555+ */
1556+ if (likely(tsc_aux_uret_slot >= 0) &&
1557+ (!boot_cpu_has(X86_FEATURE_V_TSC_AUX) || !sev_es_guest(vcpu->kvm)))
15361558 kvm_set_user_return_msr(tsc_aux_uret_slot, svm->tsc_aux, -1ull);
15371559
15381560 svm->guest_state_loaded = true;
@@ -3086,6 +3108,16 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) · 1547 unmodified lines
30863108 svm->sysenter_esp_hi = guest_cpuid_is_intel(vcpu) ? (data >> 32) : 0;
30873109 break;
30883110 case MSR_TSC_AUX:
3111+ /*
3112+ * TSC_AUX is always virtualized for SEV-ES guests when the
3113+ * feature is available. The user return MSR support is not
3114+ * required in this case because TSC_AUX is restored on #VMEXIT
3115+ * from the host save area (which has been initialized in
3116+ * svm_hardware_enable()).
3117+ */
3118+ if (boot_cpu_has(X86_FEATURE_V_TSC_AUX) && sev_es_guest(vcpu->kvm))
3119+ break;
3120+
30893121 /*
30903122 * TSC_AUX is usually changed only during boot and never read
30913123 * directly. Intercept TSC_AUX instead of exposing it to the
@@ -4284,7 +4316,6 @@ static bool svm_has_emulated_msr(struct kvm *kvm, u32 index) · 1192 unmodified lines
42844316 static void svm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
42854317 {
42864318 struct vcpu_svm *svm = to_svm(vcpu);
4287− struct kvm_cpuid_entry2 *best;
42884319
42894320 /*
42904321 * SVM doesn't provide a way to disable just XSAVES in the guest, KVM
@@ -4328,12 +4359,8 @@ static void svm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu) · 37 unmodified lines
43284359 set_msr_interception(vcpu, svm->msrpm, MSR_IA32_FLUSH_CMD, 0,
43294360 !!guest_cpuid_has(vcpu, X86_FEATURE_FLUSH_L1D));
43304361
4331− /* For sev guests, the memory encryption bit is not reserved in CR3. */
4332− if (sev_guest(vcpu->kvm)) {
4333− best = kvm_find_cpuid_entry(vcpu, 0x8000001F);
4334− if (best)
4335− vcpu->arch.reserved_gpa_bits &= ~(1UL << (best->ebx & 0x3f));
4336− }
4362+ if (sev_guest(vcpu->kvm))
4363+ sev_vcpu_after_set_cpuid(svm);
43374364
43384365 init_vmcb_after_set_cpuid(vcpu);
43394366 }
arch/x86/kvm/svm/svm.h+1−0
@@ -684,6 +684,7 @@ void __init sev_hardware_setup(void); · 683 unmodified lines
684684 void sev_hardware_unsetup(void);
685685 int sev_cpu_init(struct svm_cpu_data *sd);
686686 void sev_init_vmcb(struct vcpu_svm *svm);
687+void sev_vcpu_after_set_cpuid(struct vcpu_svm *svm);
687688 void sev_free_vcpu(struct kvm_vcpu *vcpu);
688689 int sev_handle_vmgexit(struct kvm_vcpu *vcpu);
689690 int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in);
arch/x86/kvm/x86.c+1−4
@@ -12308,9 +12308,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 12307 unmodified lines
1230812308 if (ret)
1230912309 goto out;
1231012310
12311− ret = kvm_mmu_init_vm(kvm);
12312− if (ret)
12313− goto out_page_track;
12311+ kvm_mmu_init_vm(kvm);
1231412312
1231512313 ret = static_call(kvm_x86_vm_init)(kvm);
1231612314 if (ret)
@@ -12355,7 +12353,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) · 38 unmodified lines
1235512353
1235612354 out_uninit_mmu:
1235712355 kvm_mmu_uninit_vm(kvm);
12358−out_page_track:
1235912356 kvm_page_track_cleanup(kvm);
1236012357 out:
1236112358 return ret;
arch/x86/lib/memcpy_64.S+1−1
@@ -40,7 +40,7 @@ SYM_TYPED_FUNC_START(__memcpy) · 39 unmodified lines
4040 SYM_FUNC_END(__memcpy)
4141 EXPORT_SYMBOL(__memcpy)
4242
43−SYM_FUNC_ALIAS(memcpy, __memcpy)
43+SYM_FUNC_ALIAS_MEMFUNC(memcpy, __memcpy)
4444 EXPORT_SYMBOL(memcpy)
4545
4646 SYM_FUNC_START_LOCAL(memcpy_orig)
arch/x86/lib/memmove_64.S+1−1
@@ -212,5 +212,5 @@ SYM_FUNC_START(__memmove) · 211 unmodified lines
212212 SYM_FUNC_END(__memmove)
213213 EXPORT_SYMBOL(__memmove)
214214
215−SYM_FUNC_ALIAS(memmove, __memmove)
215+SYM_FUNC_ALIAS_MEMFUNC(memmove, __memmove)
216216 EXPORT_SYMBOL(memmove)
arch/x86/lib/memset_64.S+1−1
@@ -40,7 +40,7 @@ SYM_FUNC_START(__memset) · 39 unmodified lines
4040 SYM_FUNC_END(__memset)
4141 EXPORT_SYMBOL(__memset)
4242
43−SYM_FUNC_ALIAS(memset, __memset)
43+SYM_FUNC_ALIAS_MEMFUNC(memset, __memset)
4444 EXPORT_SYMBOL(memset)
4545
4646 SYM_FUNC_START_LOCAL(memset_orig)
arch/x86/lib/putuser.S+0−4
@@ -56,7 +56,6 @@ SYM_FUNC_END(__put_user_1) · 55 unmodified lines
5656 EXPORT_SYMBOL(__put_user_1)
5757
5858 SYM_FUNC_START(__put_user_nocheck_1)
59− ENDBR
6059 ASM_STAC
6160 2: movb %al,(%_ASM_CX)
6261 xor %ecx,%ecx
@@ -76,7 +75,6 @@ SYM_FUNC_END(__put_user_2) · 13 unmodified lines
7675 EXPORT_SYMBOL(__put_user_2)
7776
7877 SYM_FUNC_START(__put_user_nocheck_2)
79− ENDBR
8078 ASM_STAC
8179 4: movw %ax,(%_ASM_CX)
8280 xor %ecx,%ecx
@@ -96,7 +94,6 @@ SYM_FUNC_END(__put_user_4) · 13 unmodified lines
9694 EXPORT_SYMBOL(__put_user_4)
9795
9896 SYM_FUNC_START(__put_user_nocheck_4)
99− ENDBR
10097 ASM_STAC
10198 6: movl %eax,(%_ASM_CX)
10299 xor %ecx,%ecx
@@ -119,7 +116,6 @@ SYM_FUNC_END(__put_user_8) · 16 unmodified lines
119116 EXPORT_SYMBOL(__put_user_8)
120117
121118 SYM_FUNC_START(__put_user_nocheck_8)
122− ENDBR
123119 ASM_STAC
124120 9: mov %_ASM_AX,(%_ASM_CX)
125121 #ifdef CONFIG_X86_32
arch/x86/platform/efi/efi_32.c+12−0
@@ -140,3 +140,15 @@ void __init efi_runtime_update_mappings(void) · 139 unmodified lines
140140 }
141141 }
142142 }
143+
144+void arch_efi_call_virt_setup(void)
145+{
146+ efi_fpu_begin();
147+ firmware_restrict_branch_speculation_start();
148+}
149+
150+void arch_efi_call_virt_teardown(void)
151+{
152+ firmware_restrict_branch_speculation_end();
153+ efi_fpu_end();
154+}
arch/x86/platform/efi/efi_64.c+17−2
@@ -474,19 +474,34 @@ void __init efi_dump_pagetable(void) · 473 unmodified lines
474474 * can not change under us.
475475 * It should be ensured that there are no concurrent calls to this function.
476476 */
477−void efi_enter_mm(void)
477+static void efi_enter_mm(void)
478478 {
479479 efi_prev_mm = current->active_mm;
480480 current->active_mm = &efi_mm;
481481 switch_mm(efi_prev_mm, &efi_mm, NULL);
482482 }
483483
484−void efi_leave_mm(void)
484+static void efi_leave_mm(void)
485485 {
486486 current->active_mm = efi_prev_mm;
487487 switch_mm(&efi_mm, efi_prev_mm, NULL);
488488 }
489489
490+void arch_efi_call_virt_setup(void)
491+{
492+ efi_sync_low_kernel_mappings();
493+ efi_fpu_begin();
494+ firmware_restrict_branch_speculation_start();
495+ efi_enter_mm();
496+}
497+
498+void arch_efi_call_virt_teardown(void)
499+{
500+ efi_leave_mm();
501+ firmware_restrict_branch_speculation_end();
502+ efi_fpu_end();
503+}
504+
490505 static DEFINE_SPINLOCK(efi_runtime_lock);
491506
492507 /*
arch/x86/purgatory/Makefile+4−0
@@ -19,6 +19,10 @@ CFLAGS_sha256.o := -D__DISABLE_EXPORTS -D__NO_FORTIFY · 18 unmodified lines
1919 # optimization flags.
2020 KBUILD_CFLAGS := $(filter-out -fprofile-sample-use=% -fprofile-use=%,$(KBUILD_CFLAGS))
2121
22+# When LTO is enabled, llvm emits many text sections, which is not supported
23+# by kexec. Remove -flto=* flags.
24+KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_LTO),$(KBUILD_CFLAGS))
25+
2226 # When linking purgatory.ro with -r unresolved symbols are not checked,
2327 # also link a purgatory.chk binary without -r to check for unresolved symbols.
2428 PURGATORY_LDFLAGS := -e purgatory_start -z nodefaultlib
arch/x86/xen/efi.c+1−1
@@ -138,7 +138,7 @@ void __init xen_efi_init(struct boot_params *boot_params) · 137 unmodified lines
138138 if (efi_systab_xen == NULL)
139139 return;
140140
141− strncpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen",
141+ strscpy((char *)&boot_params->efi_info.efi_loader_signature, "Xen",
142142 sizeof(boot_params->efi_info.efi_loader_signature));
143143 boot_params->efi_info.efi_systab = (__u32)__pa(efi_systab_xen);
144144 boot_params->efi_info.efi_systab_hi = (__u32)(__pa(efi_systab_xen) >> 32);
arch/x86/xen/enlighten.c+1−1
@@ -32,7 +32,7 @@ EXPORT_SYMBOL_GPL(hypercall_page); · 31 unmodified lines
3232 * &HYPERVISOR_shared_info->vcpu_info[cpu]. See xen_hvm_init_shared_info
3333 * and xen_vcpu_setup for details. By default it points to share_info->vcpu_info
3434 * but during boot it is switched to point to xen_vcpu_info.
35− * The pointer is used in __xen_evtchn_do_upcall to acknowledge pending events.
35+ * The pointer is used in xen_evtchn_do_upcall to acknowledge pending events.
3636 */
3737 DEFINE_PER_CPU(struct vcpu_info *, xen_vcpu);
3838 DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
arch/x86/xen/enlighten_hvm.c+1−1
@@ -136,7 +136,7 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_xen_hvm_callback) · 135 unmodified lines
136136
137137 inc_irq_stat(irq_hv_callback_count);
138138
139− xen_hvm_evtchn_do_upcall();
139+ xen_evtchn_do_upcall();
140140
141141 set_irq_regs(old_regs);
142142 }
arch/x86/xen/enlighten_pv.c+33−7
@@ -101,6 +101,17 @@ struct tls_descs { · 100 unmodified lines
101101 struct desc_struct desc[3];
102102 };
103103
104+DEFINE_PER_CPU(enum xen_lazy_mode, xen_lazy_mode) = XEN_LAZY_NONE;
105+DEFINE_PER_CPU(unsigned int, xen_lazy_nesting);
106+
107+enum xen_lazy_mode xen_get_lazy_mode(void)
108+{
109+ if (in_interrupt())
110+ return XEN_LAZY_NONE;
111+
112+ return this_cpu_read(xen_lazy_mode);
113+}
114+
104115 /*
105116 * Updating the 3 TLS descriptors in the GDT on every task switch is
106117 * surprisingly expensive so we avoid updating them if they haven't
@@ -362,10 +373,25 @@ static noinstr unsigned long xen_get_debugreg(int reg) · 255 unmodified lines
362373 return HYPERVISOR_get_debugreg(reg);
363374 }
364375
376+static void xen_start_context_switch(struct task_struct *prev)
377+{
378+ BUG_ON(preemptible());
379+
380+ if (this_cpu_read(xen_lazy_mode) == XEN_LAZY_MMU) {
381+ arch_leave_lazy_mmu_mode();
382+ set_ti_thread_flag(task_thread_info(prev), TIF_LAZY_MMU_UPDATES);
383+ }
384+ enter_lazy(XEN_LAZY_CPU);
385+}
386+
365387 static void xen_end_context_switch(struct task_struct *next)
366388 {
389+ BUG_ON(preemptible());
390+
367391 xen_mc_flush();
368− paravirt_end_context_switch(next);
392+ leave_lazy(XEN_LAZY_CPU);
393+ if (test_and_clear_ti_thread_flag(task_thread_info(next), TIF_LAZY_MMU_UPDATES))
394+ arch_enter_lazy_mmu_mode();
369395 }
370396
371397 static unsigned long xen_store_tr(void)
@@ -472,7 +498,7 @@ static void xen_set_ldt(const void *addr, unsigned entries) · 100 unmodified lines
472498
473499 MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
474500
475− xen_mc_issue(PARAVIRT_LAZY_CPU);
501+ xen_mc_issue(XEN_LAZY_CPU);
476502 }
477503
478504 static void xen_load_gdt(const struct desc_ptr *dtr)
@@ -568,7 +594,7 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu) · 89 unmodified lines
568594 * exception between the new %fs descriptor being loaded and
569595 * %fs being effectively cleared at __switch_to().
570596 */
571− if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)
597+ if (xen_get_lazy_mode() == XEN_LAZY_CPU)
572598 loadsegment(fs, 0);
573599
574600 xen_mc_batch();
@@ -577,7 +603,7 @@ static void xen_load_tls(struct thread_struct *t, unsigned int cpu) · 2 unmodified lines
577603 load_TLS_descriptor(t, cpu, 1);
578604 load_TLS_descriptor(t, cpu, 2);
579605
580− xen_mc_issue(PARAVIRT_LAZY_CPU);
606+ xen_mc_issue(XEN_LAZY_CPU);
581607 }
582608
583609 static void xen_load_gs_index(unsigned int idx)
@@ -909,7 +935,7 @@ static void xen_load_sp0(unsigned long sp0) · 325 unmodified lines
909935
910936 mcs = xen_mc_entry(0);
911937 MULTI_stack_switch(mcs.mc, __KERNEL_DS, sp0);
912− xen_mc_issue(PARAVIRT_LAZY_CPU);
938+ xen_mc_issue(XEN_LAZY_CPU);
913939 this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0);
914940 }
915941
@@ -973,7 +999,7 @@ static void xen_write_cr0(unsigned long cr0) · 57 unmodified lines
973999
9741000 MULTI_fpu_taskswitch(mcs.mc, (cr0 & X86_CR0_TS) != 0);
9751001
976− xen_mc_issue(PARAVIRT_LAZY_CPU);
1002+ xen_mc_issue(XEN_LAZY_CPU);
9771003 }
9781004
9791005 static void xen_write_cr4(unsigned long cr4)
@@ -1156,7 +1182,7 @@ static const typeof(pv_ops) xen_cpu_ops __initconst = { · 176 unmodified lines
11561182 #endif
11571183 .io_delay = xen_io_delay,
11581184
1159− .start_context_switch = paravirt_start_context_switch,
1185+ .start_context_switch = xen_start_context_switch,
11601186 .end_context_switch = xen_end_context_switch,
11611187 },
11621188 };
arch/x86/xen/mmu_pv.c+36−19
@@ -236,7 +236,7 @@ static void xen_set_pmd_hyper(pmd_t *ptr, pmd_t val) · 235 unmodified lines
236236 u.val = pmd_val_ma(val);
237237 xen_extend_mmu_update(&u);
238238
239− xen_mc_issue(PARAVIRT_LAZY_MMU);
239+ xen_mc_issue(XEN_LAZY_MMU);
240240
241241 preempt_enable();
242242 }
@@ -270,7 +270,7 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval) · 27 unmodified lines
270270 {
271271 struct mmu_update u;
272272
273− if (paravirt_get_lazy_mode() != PARAVIRT_LAZY_MMU)
273+ if (xen_get_lazy_mode() != XEN_LAZY_MMU)
274274 return false;
275275
276276 xen_mc_batch();
@@ -279,7 +279,7 @@ static bool xen_batched_set_pte(pte_t *ptep, pte_t pteval) · 2 unmodified lines
279279 u.val = pte_val_ma(pteval);
280280 xen_extend_mmu_update(&u);
281281
282− xen_mc_issue(PARAVIRT_LAZY_MMU);
282+ xen_mc_issue(XEN_LAZY_MMU);
283283
284284 return true;
285285 }
@@ -325,7 +325,7 @@ void xen_ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, · 39 unmodified lines
325325 u.val = pte_val_ma(pte);
326326 xen_extend_mmu_update(&u);
327327
328− xen_mc_issue(PARAVIRT_LAZY_MMU);
328+ xen_mc_issue(XEN_LAZY_MMU);
329329 }
330330
331331 /* Assume pteval_t is equivalent to all the other *val_t types. */
@@ -419,7 +419,7 @@ static void xen_set_pud_hyper(pud_t *ptr, pud_t val) · 87 unmodified lines
419419 u.val = pud_val_ma(val);
420420 xen_extend_mmu_update(&u);
421421
422− xen_mc_issue(PARAVIRT_LAZY_MMU);
422+ xen_mc_issue(XEN_LAZY_MMU);
423423
424424 preempt_enable();
425425 }
@@ -499,7 +499,7 @@ static void __init xen_set_p4d_hyper(p4d_t *ptr, p4d_t val) · 73 unmodified lines
499499
500500 __xen_set_p4d_hyper(ptr, val);
501501
502− xen_mc_issue(PARAVIRT_LAZY_MMU);
502+ xen_mc_issue(XEN_LAZY_MMU);
503503
504504 preempt_enable();
505505 }
@@ -531,7 +531,7 @@ static void xen_set_p4d(p4d_t *ptr, p4d_t val) · 25 unmodified lines
531531 if (user_ptr)
532532 __xen_set_p4d_hyper((p4d_t *)user_ptr, val);
533533
534− xen_mc_issue(PARAVIRT_LAZY_MMU);
534+ xen_mc_issue(XEN_LAZY_MMU);
535535 }
536536
537537 #if CONFIG_PGTABLE_LEVELS >= 5
@@ -1245,7 +1245,7 @@ static noinline void xen_flush_tlb(void) · 707 unmodified lines
12451245 op->cmd = MMUEXT_TLB_FLUSH_LOCAL;
12461246 MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
12471247
1248− xen_mc_issue(PARAVIRT_LAZY_MMU);
1248+ xen_mc_issue(XEN_LAZY_MMU);
12491249
12501250 preempt_enable();
12511251 }
@@ -1265,7 +1265,7 @@ static void xen_flush_tlb_one_user(unsigned long addr) · 13 unmodified lines
12651265 op->arg1.linear_addr = addr & PAGE_MASK;
12661266 MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
12671267
1268− xen_mc_issue(PARAVIRT_LAZY_MMU);
1268+ xen_mc_issue(XEN_LAZY_MMU);
12691269
12701270 preempt_enable();
12711271 }
@@ -1302,7 +1302,7 @@ static void xen_flush_tlb_multi(const struct cpumask *cpus, · 30 unmodified lines
13021302
13031303 MULTI_mmuext_op(mcs.mc, &args->op, 1, NULL, DOMID_SELF);
13041304
1305− xen_mc_issue(PARAVIRT_LAZY_MMU);
1305+ xen_mc_issue(XEN_LAZY_MMU);
13061306 }
13071307
13081308 static unsigned long xen_read_cr3(void)
@@ -1361,7 +1361,7 @@ static void xen_write_cr3(unsigned long cr3) · 52 unmodified lines
13611361 else
13621362 __xen_write_cr3(false, 0);
13631363
1364− xen_mc_issue(PARAVIRT_LAZY_CPU); /* interrupts restored */
1364+ xen_mc_issue(XEN_LAZY_CPU); /* interrupts restored */
13651365 }
13661366
13671367 /*
@@ -1396,7 +1396,7 @@ static void __init xen_write_cr3_init(unsigned long cr3) · 28 unmodified lines
13961396
13971397 __xen_write_cr3(true, cr3);
13981398
1399− xen_mc_issue(PARAVIRT_LAZY_CPU); /* interrupts restored */
1399+ xen_mc_issue(XEN_LAZY_CPU); /* interrupts restored */
14001400 }
14011401
14021402 static int xen_pgd_alloc(struct mm_struct *mm)
@@ -1557,7 +1557,7 @@ static inline void xen_alloc_ptpage(struct mm_struct *mm, unsigned long pfn, · 154 unmodified lines
15571557 if (level == PT_PTE && USE_SPLIT_PTE_PTLOCKS && !pinned)
15581558 __pin_pagetable_pfn(MMUEXT_PIN_L1_TABLE, pfn);
15591559
1560− xen_mc_issue(PARAVIRT_LAZY_MMU);
1560+ xen_mc_issue(XEN_LAZY_MMU);
15611561 }
15621562 }
15631563
@@ -1587,7 +1587,7 @@ static inline void xen_release_ptpage(unsigned long pfn, unsigned level) · 23 unmodified lines
15871587
15881588 __set_pfn_prot(pfn, PAGE_KERNEL);
15891589
1590− xen_mc_issue(PARAVIRT_LAZY_MMU);
1590+ xen_mc_issue(XEN_LAZY_MMU);
15911591
15921592 ClearPagePinned(page);
15931593 }
@@ -1804,7 +1804,7 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn) · 210 unmodified lines
18041804 */
18051805 xen_mc_batch();
18061806 __xen_write_cr3(true, __pa(init_top_pgt));
1807− xen_mc_issue(PARAVIRT_LAZY_CPU);
1807+ xen_mc_issue(XEN_LAZY_CPU);
18081808
18091809 /* We can't that easily rip out L3 and L2, as the Xen pagetables are
18101810 * set out this way: [L4], [L1], [L2], [L3], [L1], [L1] ... for
@@ -2083,6 +2083,23 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) · 272 unmodified lines
20832083 #endif
20842084 }
20852085
2086+static void xen_enter_lazy_mmu(void)
2087+{
2088+ enter_lazy(XEN_LAZY_MMU);
2089+}
2090+
2091+static void xen_flush_lazy_mmu(void)
2092+{
2093+ preempt_disable();
2094+
2095+ if (xen_get_lazy_mode() == XEN_LAZY_MMU) {
2096+ arch_leave_lazy_mmu_mode();
2097+ arch_enter_lazy_mmu_mode();
2098+ }
2099+
2100+ preempt_enable();
2101+}
2102+
20862103 static void __init xen_post_allocator_init(void)
20872104 {
20882105 pv_ops.mmu.set_pte = xen_set_pte;
@@ -2107,7 +2124,7 @@ static void xen_leave_lazy_mmu(void) · 18 unmodified lines
21072124 {
21082125 preempt_disable();
21092126 xen_mc_flush();
2110− paravirt_leave_lazy_mmu();
2127+ leave_lazy(XEN_LAZY_MMU);
21112128 preempt_enable();
21122129 }
21132130
@@ -2166,9 +2183,9 @@ static const typeof(pv_ops) xen_mmu_ops __initconst = { · 52 unmodified lines
21662183 .exit_mmap = xen_exit_mmap,
21672184
21682185 .lazy_mode = {
2169− .enter = paravirt_enter_lazy_mmu,
2186+ .enter = xen_enter_lazy_mmu,
21702187 .leave = xen_leave_lazy_mmu,
2171− .flush = paravirt_flush_lazy_mmu,
2188+ .flush = xen_flush_lazy_mmu,
21722189 },
21732190
21742191 .set_fixmap = xen_set_fixmap,
@@ -2385,7 +2402,7 @@ static noinline void xen_flush_tlb_all(void) · 210 unmodified lines
23852402 op->cmd = MMUEXT_TLB_FLUSH_ALL;
23862403 MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
23872404
2388− xen_mc_issue(PARAVIRT_LAZY_MMU);
2405+ xen_mc_issue(XEN_LAZY_MMU);
23892406
23902407 preempt_enable();
23912408 }
arch/x86/xen/multicalls.h+2−2
@@ -26,7 +26,7 @@ static inline void xen_mc_batch(void) · 25 unmodified lines
2626
2727 /* need to disable interrupts until this entry is complete */
2828 local_irq_save(flags);
29− trace_xen_mc_batch(paravirt_get_lazy_mode());
29+ trace_xen_mc_batch(xen_get_lazy_mode());
3030 __this_cpu_write(xen_mc_irq_flags, flags);
3131 }
3232
@@ -44,7 +44,7 @@ static inline void xen_mc_issue(unsigned mode) · 11 unmodified lines
4444 {
4545 trace_xen_mc_issue(mode);
4646
47− if ((paravirt_get_lazy_mode() & mode) == 0)
47+ if ((xen_get_lazy_mode() & mode) == 0)
4848 xen_mc_flush();
4949
5050 /* restore flags saved in xen_mc_batch */
arch/xtensa/boot/Makefile+1−2
@@ -9,8 +9,7 @@ · 8 unmodified lines
99
1010
1111 # KBUILD_CFLAGS used when building rest of boot (takes effect recursively)
12−KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
13−HOSTFLAGS += -Iarch/$(ARCH)/boot/include
12+KBUILD_CFLAGS += -fno-builtin
1413
1514 subdir-y := lib
1615 targets += vmlinux.bin vmlinux.bin.gz
arch/xtensa/boot/lib/zmem.c+3−2
@@ -4,13 +4,14 @@ · 3 unmodified lines
44 /* bits taken from ppc */
55
66 extern void *avail_ram, *end_avail;
7+void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp);
78
8−void exit (void)
9+static void exit(void)
910 {
1011 for (;;);
1112 }
1213
13−void *zalloc(unsigned size)
14+static void *zalloc(unsigned int size)
1415 {
1516 void *p = avail_ram;
1617
arch/xtensa/include/asm/core.h+4−0
@@ -6,6 +6,10 @@ · 5 unmodified lines
66
77 #include <variant/core.h>
88
9+#ifndef XCHAL_HAVE_DIV32
10+#define XCHAL_HAVE_DIV32 0
11+#endif
12+
913 #ifndef XCHAL_HAVE_EXCLUSIVE
1014 #define XCHAL_HAVE_EXCLUSIVE 0
1115 #endif
arch/xtensa/include/asm/hw_breakpoint.h+1−0
@@ -48,6 +48,7 @@ void arch_uninstall_hw_breakpoint(struct perf_event *bp); · 47 unmodified lines
4848 void hw_breakpoint_pmu_read(struct perf_event *bp);
4949 int check_hw_breakpoint(struct pt_regs *regs);
5050 void clear_ptrace_hw_breakpoint(struct task_struct *tsk);
51+void restore_dbreak(void);
5152
5253 #else
5354
arch/xtensa/include/asm/processor.h+5−0
@@ -14,6 +14,8 @@ · 13 unmodified lines
1414
1515 #include <linux/compiler.h>
1616 #include <linux/stringify.h>
17+
18+#include <asm/bootparam.h>
1719 #include <asm/ptrace.h>
1820 #include <asm/types.h>
1921 #include <asm/regs.h>
@@ -217,6 +219,9 @@ struct mm_struct; · 197 unmodified lines
217219
218220 extern unsigned long __get_wchan(struct task_struct *p);
219221
222+void init_arch(bp_tag_t *bp_start);
223+void do_notify_resume(struct pt_regs *regs);
224+
220225 #define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc)
221226 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1])
222227
arch/xtensa/include/asm/ptrace.h+3−0
@@ -106,6 +106,9 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) · 105 unmodified lines
106106 return regs->areg[2];
107107 }
108108
109+int do_syscall_trace_enter(struct pt_regs *regs);
110+void do_syscall_trace_leave(struct pt_regs *regs);
111+
109112 #else /* __ASSEMBLY__ */
110113
111114 # include <asm/asm-offsets.h>
arch/xtensa/include/asm/smp.h+1−0
@@ -23,6 +23,7 @@ struct cpumask; · 22 unmodified lines
2323 void arch_send_call_function_ipi_mask(const struct cpumask *mask);
2424 void arch_send_call_function_single_ipi(int cpu);
2525
26+void secondary_start_kernel(void);
2627 void smp_init_cpus(void);
2728 void secondary_init_irq(void);
2829 void ipi_init(void);
arch/xtensa/include/asm/tlb.h+2−0
@@ -18,4 +18,6 @@ · 17 unmodified lines
1818
1919 #define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
2020
21+void check_tlb_sanity(void);
22+
2123 #endif /* _XTENSA_TLB_H */
arch/xtensa/kernel/hw_breakpoint.c+1−0
@@ -13,6 +13,7 @@ · 12 unmodified lines
1313 #include <linux/percpu.h>
1414 #include <linux/perf_event.h>
1515 #include <asm/core.h>
16+#include <asm/hw_breakpoint.h>
1617
1718 /* Breakpoint currently in use for each IBREAKA. */
1819 static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[XCHAL_NUM_IBREAK]);
arch/xtensa/kernel/irq.c+1−0
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <asm/mxregs.h>
2929 #include <linux/uaccess.h>
3030 #include <asm/platform.h>
31+#include <asm/traps.h>
3132
3233 DECLARE_PER_CPU(unsigned long, nmi_count);
3334
arch/xtensa/kernel/ptrace.c+0−1
@@ -541,7 +541,6 @@ long arch_ptrace(struct task_struct *child, long request, · 540 unmodified lines
541541 return ret;
542542 }
543543
544−void do_syscall_trace_leave(struct pt_regs *regs);
545544 int do_syscall_trace_enter(struct pt_regs *regs)
546545 {
547546 if (regs->syscall == NO_SYSCALL)
arch/xtensa/kernel/signal.c+2−0
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626 #include <linux/uaccess.h>
2727 #include <asm/cacheflush.h>
2828 #include <asm/coprocessor.h>
29+#include <asm/processor.h>
30+#include <asm/syscall.h>
2931 #include <asm/unistd.h>
3032
3133 extern struct task_struct *coproc_owners[];
arch/xtensa/kernel/smp.c+1−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/irq.h>
2222 #include <linux/kdebug.h>
2323 #include <linux/module.h>
24+#include <linux/profile.h>
2425 #include <linux/sched/mm.h>
2526 #include <linux/sched/hotplug.h>
2627 #include <linux/sched/task_stack.h>
arch/xtensa/kernel/stacktrace.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/sched.h>
1313 #include <linux/stacktrace.h>
1414
15+#include <asm/ftrace.h>
1516 #include <asm/stacktrace.h>
1617 #include <asm/traps.h>
1718 #include <linux/uaccess.h>
arch/xtensa/kernel/traps.c+1−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 * for more details.
2424 */
2525
26+#include <linux/cpu.h>
2627 #include <linux/kernel.h>
2728 #include <linux/sched/signal.h>
2829 #include <linux/sched/debug.h>
arch/xtensa/lib/umulsidi3.S+3−1
@@ -3,7 +3,9 @@ · 2 unmodified lines
33 #include <asm/asmmacro.h>
44 #include <asm/core.h>
55
6−#if !XCHAL_HAVE_MUL16 && !XCHAL_HAVE_MUL32 && !XCHAL_HAVE_MAC16
6+#if XCHAL_HAVE_MUL16 || XCHAL_HAVE_MUL32 || XCHAL_HAVE_MAC16
7+#define XCHAL_NO_MUL 0
8+#else
79 #define XCHAL_NO_MUL 1
810 #endif
911
arch/xtensa/mm/fault.c+1−0
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <asm/mmu_context.h>
2121 #include <asm/cacheflush.h>
2222 #include <asm/hardirq.h>
23+#include <asm/traps.h>
2324
2425 void bad_page_fault(struct pt_regs*, unsigned long, int);
2526
arch/xtensa/mm/tlb.c+1−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <linux/mm.h>
1818 #include <asm/processor.h>
1919 #include <asm/mmu_context.h>
20+#include <asm/tlb.h>
2021 #include <asm/tlbflush.h>
2122 #include <asm/cacheflush.h>
2223
arch/xtensa/platforms/iss/network.c+2−2
@@ -201,7 +201,7 @@ static int tuntap_write(struct iss_net_private *lp, struct sk_buff **skb) · 200 unmodified lines
201201 return simc_write(lp->tp.info.tuntap.fd, (*skb)->data, (*skb)->len);
202202 }
203203
204−unsigned short tuntap_protocol(struct sk_buff *skb)
204+static unsigned short tuntap_protocol(struct sk_buff *skb)
205205 {
206206 return eth_type_trans(skb, skb->dev);
207207 }
@@ -441,7 +441,7 @@ static int iss_net_change_mtu(struct net_device *dev, int new_mtu) · 233 unmodified lines
441441 return -EINVAL;
442442 }
443443
444−void iss_net_user_timer_expire(struct timer_list *unused)
444+static void iss_net_user_timer_expire(struct timer_list *unused)
445445 {
446446 }
447447
block/blk-mq.c+7−6
@@ -4405,11 +4405,8 @@ static int blk_mq_realloc_tag_set_tags(struct blk_mq_tag_set *set, · 4404 unmodified lines
44054405 struct blk_mq_tags **new_tags;
44064406 int i;
44074407
4408− if (set->nr_hw_queues >= new_nr_hw_queues) {
4409− for (i = new_nr_hw_queues; i < set->nr_hw_queues; i++)
4410− __blk_mq_free_map_and_rqs(set, i);
4408+ if (set->nr_hw_queues >= new_nr_hw_queues)
44114409 goto done;
4412− }
44134410
44144411 new_tags = kcalloc_node(new_nr_hw_queues, sizeof(struct blk_mq_tags *),
44154412 GFP_KERNEL, set->numa_node);
@@ -4719,7 +4716,8 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, · 303 unmodified lines
47194716 {
47204717 struct request_queue *q;
47214718 LIST_HEAD(head);
4722− int prev_nr_hw_queues;
4719+ int prev_nr_hw_queues = set->nr_hw_queues;
4720+ int i;
47234721
47244722 lockdep_assert_held(&set->tag_list_lock);
47254723
@@ -4746,7 +4744,6 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, · 20 unmodified lines
47464744 blk_mq_sysfs_unregister_hctxs(q);
47474745 }
47484746
4749− prev_nr_hw_queues = set->nr_hw_queues;
47504747 if (blk_mq_realloc_tag_set_tags(set, nr_hw_queues) < 0)
47514748 goto reregister;
47524749
@@ -4781,6 +4778,10 @@ switch_back: · 28 unmodified lines
47814778
47824779 list_for_each_entry(q, &set->tag_list, tag_set_list)
47834780 blk_mq_unfreeze_queue(q);
4781+
4782+ /* Free the excess tags when nr_hw_queues shrink. */
4783+ for (i = set->nr_hw_queues; i < prev_nr_hw_queues; i++)
4784+ __blk_mq_free_map_and_rqs(set, i);
47844785 }
47854786
47864787 void blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set, int nr_hw_queues)
block/blk-rq-qos.c+1−1
@@ -270,7 +270,7 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data, · 269 unmodified lines
270270 finish_wait(&rqw->wait, &data.wq);
271271
272272 /*
273− * We raced with wbt_wake_function() getting a token,
273+ * We raced with rq_qos_wake_function() getting a token,
274274 * which means we now have two. Put our local token
275275 * and wake anyone else potentially waiting for one.
276276 */
block/disk-events.c+0−1
@@ -290,7 +290,6 @@ EXPORT_SYMBOL(disk_check_media_change); · 289 unmodified lines
290290 /**
291291 * disk_force_media_change - force a media change event
292292 * @disk: the disk which will raise the event
293− * @events: the events to raise
294293 *
295294 * Should be called when the media changes for @disk. Generates a uevent
296295 * and attempts to free all dentries and inodes and invalidates all block
crypto/sm2.c+5−1
@@ -278,10 +278,14 @@ int sm2_compute_z_digest(struct shash_desc *desc, · 277 unmodified lines
278278 if (!ec)
279279 return -ENOMEM;
280280
281− err = __sm2_set_pub_key(ec, key, keylen);
281+ err = sm2_ec_ctx_init(ec);
282282 if (err)
283283 goto out_free_ec;
284284
285+ err = __sm2_set_pub_key(ec, key, keylen);
286+ if (err)
287+ goto out_deinit_ec;
288+
285289 bits_len = SM2_DEFAULT_USERID_LEN * 8;
286290 entl[0] = bits_len >> 8;
287291 entl[1] = bits_len & 0xff;
drivers/Makefile+1−1
@@ -46,7 +46,7 @@ obj-$(CONFIG_DMADEVICES) += dma/ · 45 unmodified lines
4646
4747 # SOC specific infrastructure drivers.
4848 obj-y += soc/
49−obj-$(CONFIG_PM_GENERIC_DOMAINS) += genpd/
49+obj-$(CONFIG_PM_GENERIC_DOMAINS) += pmdomain/
5050
5151 obj-y += virtio/
5252 obj-$(CONFIG_VDPA) += vdpa/
drivers/accel/ivpu/ivpu_drv.c+2−1
@@ -327,7 +327,7 @@ static int ivpu_wait_for_ready(struct ivpu_device *vdev) · 326 unmodified lines
327327 }
328328
329329 if (!ret)
330− ivpu_info(vdev, "VPU ready message received successfully\n");
330+ ivpu_dbg(vdev, PM, "VPU ready message received successfully\n");
331331 else
332332 ivpu_hw_diagnose_failure(vdev);
333333
@@ -634,6 +634,7 @@ static void ivpu_dev_fini(struct ivpu_device *vdev) · 300 unmodified lines
634634
635635 static struct pci_device_id ivpu_pci_ids[] = {
636636 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_MTL) },
637+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_ARL) },
637638 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_LNL) },
638639 { }
639640 };
drivers/accel/ivpu/ivpu_drv.h+2−0
@@ -23,6 +23,7 @@ · 22 unmodified lines
2323 #define DRIVER_DATE "20230117"
2424
2525 #define PCI_DEVICE_ID_MTL 0x7d1d
26+#define PCI_DEVICE_ID_ARL 0xad1d
2627 #define PCI_DEVICE_ID_LNL 0x643e
2728
2829 #define IVPU_HW_37XX 37
@@ -165,6 +166,7 @@ static inline int ivpu_hw_gen(struct ivpu_device *vdev) · 136 unmodified lines
165166 {
166167 switch (ivpu_device_id(vdev)) {
167168 case PCI_DEVICE_ID_MTL:
169+ case PCI_DEVICE_ID_ARL:
168170 return IVPU_HW_37XX;
169171 case PCI_DEVICE_ID_LNL:
170172 return IVPU_HW_40XX;
drivers/accel/ivpu/ivpu_fw.c+5−3
@@ -220,7 +220,8 @@ static int ivpu_fw_mem_init(struct ivpu_device *vdev) · 219 unmodified lines
220220 if (ret)
221221 return ret;
222222
223− fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size, DRM_IVPU_BO_WC);
223+ fw->mem = ivpu_bo_alloc_internal(vdev, fw->runtime_addr, fw->runtime_size,
224+ DRM_IVPU_BO_CACHED | DRM_IVPU_BO_NOSNOOP);
224225 if (!fw->mem) {
225226 ivpu_err(vdev, "Failed to allocate firmware runtime memory\n");
226227 return -ENOMEM;
@@ -330,7 +331,7 @@ int ivpu_fw_load(struct ivpu_device *vdev) · 103 unmodified lines
330331 memset(start, 0, size);
331332 }
332333
333− wmb(); /* Flush WC buffers after writing fw->mem */
334+ clflush_cache_range(fw->mem->kvaddr, fw->mem->base.size);
334335
335336 return 0;
336337 }
@@ -432,6 +433,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params · 95 unmodified lines
432433 if (!ivpu_fw_is_cold_boot(vdev)) {
433434 boot_params->save_restore_ret_address = 0;
434435 vdev->pm->is_warmboot = true;
436+ clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K);
435437 return;
436438 }
437439
@@ -493,7 +495,7 @@ void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params · 55 unmodified lines
493495 boot_params->punit_telemetry_sram_size = ivpu_hw_reg_telemetry_size_get(vdev);
494496 boot_params->vpu_telemetry_enable = ivpu_hw_reg_telemetry_enable_get(vdev);
495497
496− wmb(); /* Flush WC buffers after writing bootparams */
498+ clflush_cache_range(vdev->fw->mem->kvaddr, SZ_4K);
497499
498500 ivpu_fw_boot_params_print(vdev, boot_params);
499501 }
drivers/accel/ivpu/ivpu_gem.h+5−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #include <drm/drm_gem.h>
99 #include <drm/drm_mm.h>
1010
11+#define DRM_IVPU_BO_NOSNOOP 0x10000000
12+
1113 struct dma_buf;
1214 struct ivpu_bo_ops;
1315 struct ivpu_file_priv;
@@ -83,6 +85,9 @@ static inline u32 ivpu_bo_cache_mode(struct ivpu_bo *bo) · 69 unmodified lines
8385
8486 static inline bool ivpu_bo_is_snooped(struct ivpu_bo *bo)
8587 {
88+ if (bo->flags & DRM_IVPU_BO_NOSNOOP)
89+ return false;
90+
8691 return ivpu_bo_cache_mode(bo) == DRM_IVPU_BO_CACHED;
8792 }
8893
drivers/accel/ivpu/ivpu_hw_40xx.c+23−4
@@ -57,8 +57,7 @@ · 56 unmodified lines
5757
5858 #define ICB_0_1_IRQ_MASK ((((u64)ICB_1_IRQ_MASK) << 32) | ICB_0_IRQ_MASK)
5959
60−#define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE)) | \
61− (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \
60+#define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \
6261 (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, CFI0_ERR)) | \
6362 (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, CFI1_ERR)) | \
6463 (REG_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, IMR0_ERR)) | \
@@ -196,6 +195,14 @@ static int ivpu_pll_wait_for_status_ready(struct ivpu_device *vdev) · 131 unmodified lines
196195 return REGB_POLL_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, READY, 1, PLL_TIMEOUT_US);
197196 }
198197
198+static int ivpu_wait_for_clock_own_resource_ack(struct ivpu_device *vdev)
199+{
200+ if (ivpu_is_simics(vdev))
201+ return 0;
202+
203+ return REGB_POLL_FLD(VPU_40XX_BUTTRESS_VPU_STATUS, CLOCK_RESOURCE_OWN_ACK, 1, TIMEOUT_US);
204+}
205+
199206 static void ivpu_pll_init_frequency_ratios(struct ivpu_device *vdev)
200207 {
201208 struct ivpu_hw_info *hw = vdev->hw;
@@ -556,6 +563,12 @@ static int ivpu_boot_pwr_domain_enable(struct ivpu_device *vdev) · 354 unmodified lines
556563 {
557564 int ret;
558565
566+ ret = ivpu_wait_for_clock_own_resource_ack(vdev);
567+ if (ret) {
568+ ivpu_err(vdev, "Timed out waiting for clock own resource ACK\n");
569+ return ret;
570+ }
571+
559572 ivpu_boot_pwr_island_trickle_drive(vdev, true);
560573 ivpu_boot_pwr_island_drive(vdev, true);
561574
@@ -1046,8 +1059,6 @@ static irqreturn_t ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq) · 484 unmodified lines
10461059 if (status == 0)
10471060 return IRQ_NONE;
10481061
1049− REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
1050−
10511062 if (REG_TEST_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE, status))
10521063 ivpu_dbg(vdev, IRQ, "FREQ_CHANGE");
10531064
@@ -1092,6 +1103,9 @@ static irqreturn_t ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq) · 38 unmodified lines
10921103 schedule_recovery = true;
10931104 }
10941105
1106+ /* This must be done after interrupts are cleared at the source. */
1107+ REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
1108+
10951109 if (schedule_recovery)
10961110 ivpu_pm_schedule_recovery(vdev);
10971111
@@ -1103,9 +1117,14 @@ static irqreturn_t ivpu_hw_40xx_irq_handler(int irq, void *ptr) · 5 unmodified lines
11031117 struct ivpu_device *vdev = ptr;
11041118 irqreturn_t ret = IRQ_NONE;
11051119
1120+ REGB_WR32(VPU_40XX_BUTTRESS_GLOBAL_INT_MASK, 0x1);
1121+
11061122 ret |= ivpu_hw_40xx_irqv_handler(vdev, irq);
11071123 ret |= ivpu_hw_40xx_irqb_handler(vdev, irq);
11081124
1125+ /* Re-enable global interrupts to re-trigger MSI for pending interrupts */
1126+ REGB_WR32(VPU_40XX_BUTTRESS_GLOBAL_INT_MASK, 0x0);
1127+
11091128 if (ret & IRQ_WAKE_THREAD)
11101129 return IRQ_WAKE_THREAD;
11111130
drivers/accel/ivpu/ivpu_hw_40xx_reg.h+2−0
@@ -70,6 +70,8 @@ · 69 unmodified lines
7070 #define VPU_40XX_BUTTRESS_VPU_STATUS_READY_MASK BIT_MASK(0)
7171 #define VPU_40XX_BUTTRESS_VPU_STATUS_IDLE_MASK BIT_MASK(1)
7272 #define VPU_40XX_BUTTRESS_VPU_STATUS_DUP_IDLE_MASK BIT_MASK(2)
73+#define VPU_40XX_BUTTRESS_VPU_STATUS_CLOCK_RESOURCE_OWN_ACK_MASK BIT_MASK(6)
74+#define VPU_40XX_BUTTRESS_VPU_STATUS_POWER_RESOURCE_OWN_ACK_MASK BIT_MASK(7)
7375 #define VPU_40XX_BUTTRESS_VPU_STATUS_PERF_CLK_MASK BIT_MASK(11)
7476 #define VPU_40XX_BUTTRESS_VPU_STATUS_DISABLE_CLK_RELINQUISH_MASK BIT_MASK(12)
7577
drivers/accel/ivpu/ivpu_ipc.c+4−7
@@ -209,10 +209,10 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, · 208 unmodified lines
209209 struct ivpu_ipc_rx_msg *rx_msg;
210210 int wait_ret, ret = 0;
211211
212− wait_ret = wait_event_interruptible_timeout(cons->rx_msg_wq,
213− (IS_KTHREAD() && kthread_should_stop()) ||
214− !list_empty(&cons->rx_msg_list),
215− msecs_to_jiffies(timeout_ms));
212+ wait_ret = wait_event_timeout(cons->rx_msg_wq,
213+ (IS_KTHREAD() && kthread_should_stop()) ||
214+ !list_empty(&cons->rx_msg_list),
215+ msecs_to_jiffies(timeout_ms));
216216
217217 if (IS_KTHREAD() && kthread_should_stop())
218218 return -EINTR;
@@ -220,9 +220,6 @@ int ivpu_ipc_receive(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, · 1 unmodified line
220220 if (wait_ret == 0)
221221 return -ETIMEDOUT;
222222
223− if (wait_ret < 0)
224− return -ERESTARTSYS;
225−
226223 spin_lock_irq(&cons->rx_msg_lock);
227224 rx_msg = list_first_entry_or_null(&cons->rx_msg_list, struct ivpu_ipc_rx_msg, link);
228225 if (!rx_msg) {
drivers/acpi/acpi_video.c+5−2
@@ -2057,7 +2057,9 @@ static int acpi_video_bus_add(struct acpi_device *device) · 2056 unmodified lines
20572057 !auto_detect)
20582058 acpi_video_bus_register_backlight(video);
20592059
2060− acpi_video_bus_add_notify_handler(video);
2060+ error = acpi_video_bus_add_notify_handler(video);
2061+ if (error)
2062+ goto err_del;
20612063
20622064 error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
20632065 acpi_video_bus_notify);
@@ -2067,10 +2069,11 @@ static int acpi_video_bus_add(struct acpi_device *device) · 3 unmodified lines
20672069 return 0;
20682070
20692071 err_remove:
2072+ acpi_video_bus_remove_notify_handler(video);
2073+err_del:
20702074 mutex_lock(&video_list_lock);
20712075 list_del(&video->entry);
20722076 mutex_unlock(&video_list_lock);
2073− acpi_video_bus_remove_notify_handler(video);
20742077 acpi_video_bus_unregister_backlight(video);
20752078 err_put_video:
20762079 acpi_video_bus_put_devices(video);
drivers/acpi/processor_pdc.c+1−0
@@ -19,6 +19,7 @@ static void acpi_set_pdc_bits(u32 *buf) · 18 unmodified lines
1919 {
2020 buf[0] = ACPI_PDC_REVISION_ID;
2121 buf[1] = 1;
22+ buf[2] = 0;
2223
2324 /* Twiddle arch-specific bits needed for _PDC */
2425 arch_acpi_set_proc_cap_bits(&buf[2]);
drivers/acpi/thermal.c+1−1
@@ -492,7 +492,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal, int *temp) · 491 unmodified lines
492492 }
493493
494494 static int thermal_get_trend(struct thermal_zone_device *thermal,
495− struct thermal_trip *trip,
495+ const struct thermal_trip *trip,
496496 enum thermal_trend *trend)
497497 {
498498 struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
drivers/ata/ahci.c+9−0
@@ -1883,6 +1883,15 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) · 1882 unmodified lines
18831883 else
18841884 dev_info(&pdev->dev, "SSS flag set, parallel bus scan disabled\n");
18851885
1886+ if (!(hpriv->cap & HOST_CAP_PART))
1887+ host->flags |= ATA_HOST_NO_PART;
1888+
1889+ if (!(hpriv->cap & HOST_CAP_SSC))
1890+ host->flags |= ATA_HOST_NO_SSC;
1891+
1892+ if (!(hpriv->cap2 & HOST_CAP2_SDS))
1893+ host->flags |= ATA_HOST_NO_DEVSLP;
1894+
18861895 if (pi.flags & ATA_FLAG_EM)
18871896 ahci_reset_em(host);
18881897
drivers/ata/libahci.c+23−12
@@ -1256,6 +1256,26 @@ static ssize_t ahci_activity_show(struct ata_device *dev, char *buf) · 1255 unmodified lines
12561256 return sprintf(buf, "%d\n", emp->blink_policy);
12571257 }
12581258
1259+static void ahci_port_clear_pending_irq(struct ata_port *ap)
1260+{
1261+ struct ahci_host_priv *hpriv = ap->host->private_data;
1262+ void __iomem *port_mmio = ahci_port_base(ap);
1263+ u32 tmp;
1264+
1265+ /* clear SError */
1266+ tmp = readl(port_mmio + PORT_SCR_ERR);
1267+ dev_dbg(ap->host->dev, "PORT_SCR_ERR 0x%x\n", tmp);
1268+ writel(tmp, port_mmio + PORT_SCR_ERR);
1269+
1270+ /* clear port IRQ */
1271+ tmp = readl(port_mmio + PORT_IRQ_STAT);
1272+ dev_dbg(ap->host->dev, "PORT_IRQ_STAT 0x%x\n", tmp);
1273+ if (tmp)
1274+ writel(tmp, port_mmio + PORT_IRQ_STAT);
1275+
1276+ writel(1 << ap->port_no, hpriv->mmio + HOST_IRQ_STAT);
1277+}
1278+
12591279 static void ahci_port_init(struct device *dev, struct ata_port *ap,
12601280 int port_no, void __iomem *mmio,
12611281 void __iomem *port_mmio)
@@ -1270,18 +1290,7 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, · 8 unmodified lines
12701290 if (rc)
12711291 dev_warn(dev, "%s (%d)\n", emsg, rc);
12721292
1273− /* clear SError */
1274− tmp = readl(port_mmio + PORT_SCR_ERR);
1275− dev_dbg(dev, "PORT_SCR_ERR 0x%x\n", tmp);
1276− writel(tmp, port_mmio + PORT_SCR_ERR);
1277−
1278− /* clear port IRQ */
1279− tmp = readl(port_mmio + PORT_IRQ_STAT);
1280− dev_dbg(dev, "PORT_IRQ_STAT 0x%x\n", tmp);
1281− if (tmp)
1282− writel(tmp, port_mmio + PORT_IRQ_STAT);
1283−
1284− writel(1 << port_no, mmio + HOST_IRQ_STAT);
1293+ ahci_port_clear_pending_irq(ap);
12851294
12861295 /* mark esata ports */
12871296 tmp = readl(port_mmio + PORT_CMD);
@@ -1603,6 +1612,8 @@ int ahci_do_hardreset(struct ata_link *link, unsigned int *class, · 315 unmodified lines
16031612 tf.status = ATA_BUSY;
16041613 ata_tf_to_fis(&tf, 0, 0, d2h_fis);
16051614
1615+ ahci_port_clear_pending_irq(ap);
1616+
16061617 rc = sata_link_hardreset(link, timing, deadline, online,
16071618 ahci_check_ready);
16081619
drivers/ata/libata-core.c+139−17
@@ -1972,6 +1972,96 @@ retry: · 1971 unmodified lines
19721972 return rc;
19731973 }
19741974
1975+/**
1976+ * ata_dev_power_set_standby - Set a device power mode to standby
1977+ * @dev: target device
1978+ *
1979+ * Issue a STANDBY IMMEDIATE command to set a device power mode to standby.
1980+ * For an HDD device, this spins down the disks.
1981+ *
1982+ * LOCKING:
1983+ * Kernel thread context (may sleep).
1984+ */
1985+void ata_dev_power_set_standby(struct ata_device *dev)
1986+{
1987+ unsigned long ap_flags = dev->link->ap->flags;
1988+ struct ata_taskfile tf;
1989+ unsigned int err_mask;
1990+
1991+ /* Issue STANDBY IMMEDIATE command only if supported by the device */
1992+ if (dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC)
1993+ return;
1994+
1995+ /*
1996+ * Some odd clown BIOSes issue spindown on power off (ACPI S4 or S5)
1997+ * causing some drives to spin up and down again. For these, do nothing
1998+ * if we are being called on shutdown.
1999+ */
2000+ if ((ap_flags & ATA_FLAG_NO_POWEROFF_SPINDOWN) &&
2001+ system_state == SYSTEM_POWER_OFF)
2002+ return;
2003+
2004+ if ((ap_flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) &&
2005+ system_entering_hibernation())
2006+ return;
2007+
2008+ ata_tf_init(dev, &tf);
2009+ tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2010+ tf.protocol = ATA_PROT_NODATA;
2011+ tf.command = ATA_CMD_STANDBYNOW1;
2012+
2013+ ata_dev_notice(dev, "Entering standby power mode\n");
2014+
2015+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2016+ if (err_mask)
2017+ ata_dev_err(dev, "STANDBY IMMEDIATE failed (err_mask=0x%x)\n",
2018+ err_mask);
2019+}
2020+
2021+/**
2022+ * ata_dev_power_set_active - Set a device power mode to active
2023+ * @dev: target device
2024+ *
2025+ * Issue a VERIFY command to enter to ensure that the device is in the
2026+ * active power mode. For a spun-down HDD (standby or idle power mode),
2027+ * the VERIFY command will complete after the disk spins up.
2028+ *
2029+ * LOCKING:
2030+ * Kernel thread context (may sleep).
2031+ */
2032+void ata_dev_power_set_active(struct ata_device *dev)
2033+{
2034+ struct ata_taskfile tf;
2035+ unsigned int err_mask;
2036+
2037+ /*
2038+ * Issue READ VERIFY SECTORS command for 1 sector at lba=0 only
2039+ * if supported by the device.
2040+ */
2041+ if (dev->class != ATA_DEV_ATA && dev->class != ATA_DEV_ZAC)
2042+ return;
2043+
2044+ ata_tf_init(dev, &tf);
2045+ tf.flags |= ATA_TFLAG_DEVICE | ATA_TFLAG_ISADDR;
2046+ tf.protocol = ATA_PROT_NODATA;
2047+ tf.command = ATA_CMD_VERIFY;
2048+ tf.nsect = 1;
2049+ if (dev->flags & ATA_DFLAG_LBA) {
2050+ tf.flags |= ATA_TFLAG_LBA;
2051+ tf.device |= ATA_LBA;
2052+ } else {
2053+ /* CHS */
2054+ tf.lbal = 0x1; /* sect */
2055+ }
2056+
2057+ ata_dev_notice(dev, "Entering active power mode\n");
2058+
2059+ err_mask = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0, 0);
2060+ if (err_mask)
2061+ ata_dev_err(dev, "VERIFY failed (err_mask=0x%x)\n",
2062+ err_mask);
2063+}
2064+
19752065 /**
19762066 * ata_read_log_page - read a specific log page
19772067 * @dev: target device
@@ -2529,7 +2619,7 @@ static int ata_dev_config_lba(struct ata_device *dev) · 551 unmodified lines
25292619 {
25302620 const u16 *id = dev->id;
25312621 const char *lba_desc;
2532− char ncq_desc[24];
2622+ char ncq_desc[32];
25332623 int ret;
25342624
25352625 dev->flags |= ATA_DFLAG_LBA;
@@ -4783,11 +4873,8 @@ void ata_qc_complete(struct ata_queued_cmd *qc) · 2247 unmodified lines
47834873 * been aborted by the device due to a limit timeout using the policy
47844874 * 0xD. For these commands, invoke EH to get the command sense data.
47854875 */
4786− if (qc->result_tf.status & ATA_SENSE &&
4787− ((ata_is_ncq(qc->tf.protocol) &&
4788− dev->flags & ATA_DFLAG_CDL_ENABLED) ||
4789− (!ata_is_ncq(qc->tf.protocol) &&
4790− ata_id_sense_reporting_enabled(dev->id)))) {
4876+ if (qc->flags & ATA_QCFLAG_HAS_CDL &&
4877+ qc->result_tf.status & ATA_SENSE) {
47914878 /*
47924879 * Tell SCSI EH to not overwrite scmd->result even if this
47934880 * command is finished with result SAM_STAT_GOOD.
@@ -5040,17 +5127,19 @@ static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, · 246 unmodified lines
50405127 struct ata_link *link;
50415128 unsigned long flags;
50425129
5043− /* Previous resume operation might still be in
5044− * progress. Wait for PM_PENDING to clear.
5130+ spin_lock_irqsave(ap->lock, flags);
5131+
5132+ /*
5133+ * A previous PM operation might still be in progress. Wait for
5134+ * ATA_PFLAG_PM_PENDING to clear.
50455135 */
50465136 if (ap->pflags & ATA_PFLAG_PM_PENDING) {
5137+ spin_unlock_irqrestore(ap->lock, flags);
50475138 ata_port_wait_eh(ap);
5048− WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5139+ spin_lock_irqsave(ap->lock, flags);
50495140 }
50505141
5051− /* request PM ops to EH */
5052− spin_lock_irqsave(ap->lock, flags);
5053−
5142+ /* Request PM operation to EH */
50545143 ap->pm_mesg = mesg;
50555144 ap->pflags |= ATA_PFLAG_PM_PENDING;
50565145 ata_for_each_link(link, ap, HOST_FIRST) {
@@ -5062,10 +5151,8 @@ static void ata_port_request_pm(struct ata_port *ap, pm_message_t mesg, · 5 unmodified lines
50625151
50635152 spin_unlock_irqrestore(ap->lock, flags);
50645153
5065− if (!async) {
5154+ if (!async)
50665155 ata_port_wait_eh(ap);
5067− WARN_ON(ap->pflags & ATA_PFLAG_PM_PENDING);
5068− }
50695156 }
50705157
50715158 /*
@@ -5081,11 +5168,27 @@ static const unsigned int ata_port_suspend_ehi = ATA_EHI_QUIET · 9 unmodified lines
50815168
50825169 static void ata_port_suspend(struct ata_port *ap, pm_message_t mesg)
50835170 {
5171+ /*
5172+ * We are about to suspend the port, so we do not care about
5173+ * scsi_rescan_device() calls scheduled by previous resume operations.
5174+ * The next resume will schedule the rescan again. So cancel any rescan
5175+ * that is not done yet.
5176+ */
5177+ cancel_delayed_work_sync(&ap->scsi_rescan_task);
5178+
50845179 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, false);
50855180 }
50865181
50875182 static void ata_port_suspend_async(struct ata_port *ap, pm_message_t mesg)
50885183 {
5184+ /*
5185+ * We are about to suspend the port, so we do not care about
5186+ * scsi_rescan_device() calls scheduled by previous resume operations.
5187+ * The next resume will schedule the rescan again. So cancel any rescan
5188+ * that is not done yet.
5189+ */
5190+ cancel_delayed_work_sync(&ap->scsi_rescan_task);
5191+
50895192 ata_port_request_pm(ap, mesg, 0, ata_port_suspend_ehi, true);
50905193 }
50915194
@@ -5232,7 +5335,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume); · 140 unmodified lines
52325335 #endif
52335336
52345337 const struct device_type ata_port_type = {
5235− .name = "ata_port",
5338+ .name = ATA_PORT_TYPE_NAME,
52365339 #ifdef CONFIG_PM
52375340 .pm = &ata_port_pm_ops,
52385341 #endif
@@ -5951,11 +6054,30 @@ static void ata_port_detach(struct ata_port *ap) · 712 unmodified lines
59516054 struct ata_link *link;
59526055 struct ata_device *dev;
59536056
5954− /* tell EH we're leaving & flush EH */
6057+ /* Wait for any ongoing EH */
6058+ ata_port_wait_eh(ap);
6059+
6060+ mutex_lock(&ap->scsi_scan_mutex);
59556061 spin_lock_irqsave(ap->lock, flags);
6062+
6063+ /* Remove scsi devices */
6064+ ata_for_each_link(link, ap, HOST_FIRST) {
6065+ ata_for_each_dev(dev, link, ALL) {
6066+ if (dev->sdev) {
6067+ spin_unlock_irqrestore(ap->lock, flags);
6068+ scsi_remove_device(dev->sdev);
6069+ spin_lock_irqsave(ap->lock, flags);
6070+ dev->sdev = NULL;
6071+ }
6072+ }
6073+ }
6074+
6075+ /* Tell EH to disable all devices */
59566076 ap->pflags |= ATA_PFLAG_UNLOADING;
59576077 ata_port_schedule_eh(ap);
6078+
59586079 spin_unlock_irqrestore(ap->lock, flags);
6080+ mutex_unlock(&ap->scsi_scan_mutex);
59596081
59606082 /* wait till EH commits suicide */
59616083 ata_port_wait_eh(ap);
drivers/ata/libata-eh.c+49−15
@@ -147,6 +147,8 @@ ata_eh_cmd_timeout_table[ATA_EH_CMD_TIMEOUT_TABLE_SIZE] = { · 146 unmodified lines
147147 .timeouts = ata_eh_other_timeouts, },
148148 { .commands = CMDS(ATA_CMD_FLUSH, ATA_CMD_FLUSH_EXT),
149149 .timeouts = ata_eh_flush_timeouts },
150+ { .commands = CMDS(ATA_CMD_VERIFY),
151+ .timeouts = ata_eh_reset_timeouts },
150152 };
151153 #undef CMDS
152154
@@ -498,7 +500,19 @@ static void ata_eh_unload(struct ata_port *ap) · 345 unmodified lines
498500 struct ata_device *dev;
499501 unsigned long flags;
500502
501− /* Restore SControl IPM and SPD for the next driver and
503+ /*
504+ * Unless we are restarting, transition all enabled devices to
505+ * standby power mode.
506+ */
507+ if (system_state != SYSTEM_RESTART) {
508+ ata_for_each_link(link, ap, PMP_FIRST) {
509+ ata_for_each_dev(dev, link, ENABLED)
510+ ata_dev_power_set_standby(dev);
511+ }
512+ }
513+
514+ /*
515+ * Restore SControl IPM and SPD for the next driver and
502516 * disable attached devices.
503517 */
504518 ata_for_each_link(link, ap, PMP_FIRST) {
@@ -684,6 +698,10 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) · 179 unmodified lines
684698 ehc->saved_xfer_mode[devno] = dev->xfer_mode;
685699 if (ata_ncq_enabled(dev))
686700 ehc->saved_ncq_enabled |= 1 << devno;
701+
702+ /* If we are resuming, wake up the device */
703+ if (ap->pflags & ATA_PFLAG_RESUMING)
704+ ehc->i.dev_action[devno] |= ATA_EH_SET_ACTIVE;
687705 }
688706 }
689707
@@ -743,6 +761,8 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) · 53 unmodified lines
743761 /* clean up */
744762 spin_lock_irqsave(ap->lock, flags);
745763
764+ ap->pflags &= ~ATA_PFLAG_RESUMING;
765+
746766 if (ap->pflags & ATA_PFLAG_LOADING)
747767 ap->pflags &= ~ATA_PFLAG_LOADING;
748768 else if ((ap->pflags & ATA_PFLAG_SCSI_HOTPLUG) &&
@@ -1218,6 +1238,13 @@ void ata_eh_detach_dev(struct ata_device *dev) · 469 unmodified lines
12181238 struct ata_eh_context *ehc = &link->eh_context;
12191239 unsigned long flags;
12201240
1241+ /*
1242+ * If the device is still enabled, transition it to standby power mode
1243+ * (i.e. spin down HDDs).
1244+ */
1245+ if (ata_dev_enabled(dev))
1246+ ata_dev_power_set_standby(dev);
1247+
12211248 ata_dev_disable(dev);
12221249
12231250 spin_lock_irqsave(ap->lock, flags);
@@ -2305,7 +2332,7 @@ static void ata_eh_link_report(struct ata_link *link) · 1081 unmodified lines
23052332 struct ata_eh_context *ehc = &link->eh_context;
23062333 struct ata_queued_cmd *qc;
23072334 const char *frozen, *desc;
2308− char tries_buf[6] = "";
2335+ char tries_buf[16] = "";
23092336 int tag, nr_failed = 0;
23102337
23112338 if (ehc->i.flags & ATA_EHI_QUIET)
@@ -2796,23 +2823,13 @@ int ata_eh_reset(struct ata_link *link, int classify, · 484 unmodified lines
27962823 }
27972824 }
27982825
2799− /*
2800− * Some controllers can't be frozen very well and may set spurious
2801− * error conditions during reset. Clear accumulated error
2802− * information and re-thaw the port if frozen. As reset is the
2803− * final recovery action and we cross check link onlineness against
2804− * device classification later, no hotplug event is lost by this.
2805− */
2826+ /* clear cached SError */
28062827 spin_lock_irqsave(link->ap->lock, flags);
2807− memset(&link->eh_info, 0, sizeof(link->eh_info));
2828+ link->eh_info.serror = 0;
28082829 if (slave)
2809− memset(&slave->eh_info, 0, sizeof(link->eh_info));
2810− ap->pflags &= ~ATA_PFLAG_EH_PENDING;
2830+ slave->eh_info.serror = 0;
28112831 spin_unlock_irqrestore(link->ap->lock, flags);
28122832
2813− if (ata_port_is_frozen(ap))
2814− ata_eh_thaw_port(ap);
2815−
28162833 /*
28172834 * Make sure onlineness and classification result correspond.
28182835 * Hotplug could have happened during reset and some
@@ -3026,6 +3043,15 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link, · 207 unmodified lines
30263043 if (ehc->i.flags & ATA_EHI_DID_RESET)
30273044 readid_flags |= ATA_READID_POSTRESET;
30283045
3046+ /*
3047+ * When resuming, before executing any command, make sure to
3048+ * transition the device to the active power mode.
3049+ */
3050+ if ((action & ATA_EH_SET_ACTIVE) && ata_dev_enabled(dev)) {
3051+ ata_dev_power_set_active(dev);
3052+ ata_eh_done(link, dev, ATA_EH_SET_ACTIVE);
3053+ }
3054+
30293055 if ((action & ATA_EH_REVALIDATE) && ata_dev_enabled(dev)) {
30303056 WARN_ON(dev->class == ATA_DEV_PMP);
30313057
@@ -3999,6 +4025,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap) · 967 unmodified lines
39994025 unsigned long flags;
40004026 int rc = 0;
40014027 struct ata_device *dev;
4028+ struct ata_link *link;
40024029
40034030 /* are we suspending? */
40044031 spin_lock_irqsave(ap->lock, flags);
@@ -4011,6 +4038,12 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap) · 6 unmodified lines
40114038
40124039 WARN_ON(ap->pflags & ATA_PFLAG_SUSPENDED);
40134040
4041+ /* Set all devices attached to the port in standby mode */
4042+ ata_for_each_link(link, ap, HOST_FIRST) {
4043+ ata_for_each_dev(dev, link, ENABLED)
4044+ ata_dev_power_set_standby(dev);
4045+ }
4046+
40144047 /*
40154048 * If we have a ZPODD attached, check its zero
40164049 * power ready status before the port is frozen.
@@ -4093,6 +4126,7 @@ static void ata_eh_handle_port_resume(struct ata_port *ap) · 76 unmodified lines
40934126 /* update the flags */
40944127 spin_lock_irqsave(ap->lock, flags);
40954128 ap->pflags &= ~(ATA_PFLAG_PM_PENDING | ATA_PFLAG_SUSPENDED);
4129+ ap->pflags |= ATA_PFLAG_RESUMING;
40964130 spin_unlock_irqrestore(ap->lock, flags);
40974131 }
40984132 #endif /* CONFIG_PM */
drivers/ata/libata-sata.c+16−3
@@ -396,10 +396,23 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, · 395 unmodified lines
396396 case ATA_LPM_MED_POWER_WITH_DIPM:
397397 case ATA_LPM_MIN_POWER_WITH_PARTIAL:
398398 case ATA_LPM_MIN_POWER:
399− if (ata_link_nr_enabled(link) > 0)
400− /* no restrictions on LPM transitions */
399+ if (ata_link_nr_enabled(link) > 0) {
400+ /* assume no restrictions on LPM transitions */
401401 scontrol &= ~(0x7 << 8);
402− else {
402+
403+ /*
404+ * If the controller does not support partial, slumber,
405+ * or devsleep, then disallow these transitions.
406+ */
407+ if (link->ap->host->flags & ATA_HOST_NO_PART)
408+ scontrol |= (0x1 << 8);
409+
410+ if (link->ap->host->flags & ATA_HOST_NO_SSC)
411+ scontrol |= (0x2 << 8);
412+
413+ if (link->ap->host->flags & ATA_HOST_NO_DEVSLP)
414+ scontrol |= (0x4 << 8);
415+ } else {
403416 /* empty port, power off */
404417 scontrol &= ~0xf;
405418 scontrol |= (0x1 << 2);
drivers/ata/libata-scsi.c+67−33
@@ -1050,14 +1050,13 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) · 1049 unmodified lines
10501050 }
10511051 } else {
10521052 sdev->sector_size = ata_id_logical_sector_size(dev->id);
1053+
10531054 /*
1054− * Stop the drive on suspend but do not issue START STOP UNIT
1055− * on resume as this is not necessary and may fail: the device
1056− * will be woken up by ata_port_pm_resume() with a port reset
1057− * and device revalidation.
1055+ * Ask the sd driver to issue START STOP UNIT on runtime suspend
1056+ * and resume only. For system level suspend/resume, devices
1057+ * power state is handled directly by libata EH.
10581058 */
1059− sdev->manage_start_stop = 1;
1060− sdev->no_start_on_resume = 1;
1059+ sdev->manage_runtime_start_stop = true;
10611060 }
10621061
10631062 /*
@@ -1089,6 +1088,42 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) · 25 unmodified lines
10891088 return 0;
10901089 }
10911090
1091+/**
1092+ * ata_scsi_slave_alloc - Early setup of SCSI device
1093+ * @sdev: SCSI device to examine
1094+ *
1095+ * This is called from scsi_alloc_sdev() when the scsi device
1096+ * associated with an ATA device is scanned on a port.
1097+ *
1098+ * LOCKING:
1099+ * Defined by SCSI layer. We don't really care.
1100+ */
1101+
1102+int ata_scsi_slave_alloc(struct scsi_device *sdev)
1103+{
1104+ struct ata_port *ap = ata_shost_to_port(sdev->host);
1105+ struct device_link *link;
1106+
1107+ ata_scsi_sdev_config(sdev);
1108+
1109+ /*
1110+ * Create a link from the ata_port device to the scsi device to ensure
1111+ * that PM does suspend/resume in the correct order: the scsi device is
1112+ * consumer (child) and the ata port the supplier (parent).
1113+ */
1114+ link = device_link_add(&sdev->sdev_gendev, &ap->tdev,
1115+ DL_FLAG_STATELESS |
1116+ DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE);
1117+ if (!link) {
1118+ ata_port_err(ap, "Failed to create link to scsi device %s\n",
1119+ dev_name(&sdev->sdev_gendev));
1120+ return -ENODEV;
1121+ }
1122+
1123+ return 0;
1124+}
1125+EXPORT_SYMBOL_GPL(ata_scsi_slave_alloc);
1126+
10921127 /**
10931128 * ata_scsi_slave_config - Set SCSI device attributes
10941129 * @sdev: SCSI device to examine
@@ -1105,14 +1140,11 @@ int ata_scsi_slave_config(struct scsi_device *sdev) · 10 unmodified lines
11051140 {
11061141 struct ata_port *ap = ata_shost_to_port(sdev->host);
11071142 struct ata_device *dev = __ata_scsi_find_dev(ap, sdev);
1108− int rc = 0;
1109−
1110− ata_scsi_sdev_config(sdev);
11111143
11121144 if (dev)
1113− rc = ata_scsi_dev_config(sdev, dev);
1145+ return ata_scsi_dev_config(sdev, dev);
11141146
1115− return rc;
1147+ return 0;
11161148 }
11171149 EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
11181150
@@ -1136,6 +1168,8 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev) · 17 unmodified lines
11361168 unsigned long flags;
11371169 struct ata_device *dev;
11381170
1171+ device_link_remove(&sdev->sdev_gendev, &ap->tdev);
1172+
11391173 spin_lock_irqsave(ap->lock, flags);
11401174 dev = __ata_scsi_find_dev(ap, sdev);
11411175 if (dev && dev->sdev) {
@@ -1195,7 +1229,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) · 53 unmodified lines
11951229 }
11961230
11971231 if (cdb[4] & 0x1) {
1198− tf->nsect = 1; /* 1 sector, lba=0 */
1232+ tf->nsect = 1; /* 1 sector, lba=0 */
11991233
12001234 if (qc->dev->flags & ATA_DFLAG_LBA) {
12011235 tf->flags |= ATA_TFLAG_LBA;
@@ -1211,7 +1245,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) · 9 unmodified lines
12111245 tf->lbah = 0x0; /* cyl high */
12121246 }
12131247
1214− tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
1248+ tf->command = ATA_CMD_VERIFY; /* READ VERIFY */
12151249 } else {
12161250 /* Some odd clown BIOSen issue spindown on power off (ACPI S4
12171251 * or S5) causing some drives to spin up and down again.
@@ -1221,7 +1255,7 @@ static unsigned int ata_scsi_start_stop_xlat(struct ata_queued_cmd *qc) · 3 unmodified lines
12211255 goto skip;
12221256
12231257 if ((qc->ap->flags & ATA_FLAG_NO_HIBERNATE_SPINDOWN) &&
1224− system_entering_hibernation())
1258+ system_entering_hibernation())
12251259 goto skip;
12261260
12271261 /* Issue ATA STANDBY IMMEDIATE command */
@@ -1835,6 +1869,9 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) · 607 unmodified lines
18351869 hdr[2] = 0x7; /* claim SPC-5 version compatibility */
18361870 }
18371871
1872+ if (args->dev->flags & ATA_DFLAG_CDL)
1873+ hdr[2] = 0xd; /* claim SPC-6 version compatibility */
1874+
18381875 memcpy(rbuf, hdr, sizeof(hdr));
18391876 memcpy(&rbuf[8], "ATA ", 8);
18401877 ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
@@ -4312,7 +4349,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) · 2471 unmodified lines
43124349 break;
43134350
43144351 case MAINTENANCE_IN:
4315− if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
4352+ if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES)
43164353 ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
43174354 else
43184355 ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
@@ -4722,7 +4759,7 @@ void ata_scsi_dev_rescan(struct work_struct *work) · 403 unmodified lines
47224759 struct ata_link *link;
47234760 struct ata_device *dev;
47244761 unsigned long flags;
4725− bool delay_rescan = false;
4762+ int ret = 0;
47264763
47274764 mutex_lock(&ap->scsi_scan_mutex);
47284765 spin_lock_irqsave(ap->lock, flags);
@@ -4731,37 +4768,34 @@ void ata_scsi_dev_rescan(struct work_struct *work) · 2 unmodified lines
47314768 ata_for_each_dev(dev, link, ENABLED) {
47324769 struct scsi_device *sdev = dev->sdev;
47334770
4771+ /*
4772+ * If the port was suspended before this was scheduled,
4773+ * bail out.
4774+ */
4775+ if (ap->pflags & ATA_PFLAG_SUSPENDED)
4776+ goto unlock;
4777+
47344778 if (!sdev)
47354779 continue;
47364780 if (scsi_device_get(sdev))
47374781 continue;
47384782
4739− /*
4740− * If the rescan work was scheduled because of a resume
4741− * event, the port is already fully resumed, but the
4742− * SCSI device may not yet be fully resumed. In such
4743− * case, executing scsi_rescan_device() may cause a
4744− * deadlock with the PM code on device_lock(). Prevent
4745− * this by giving up and retrying rescan after a short
4746− * delay.
4747− */
4748− delay_rescan = sdev->sdev_gendev.power.is_suspended;
4749− if (delay_rescan) {
4750− scsi_device_put(sdev);
4751− break;
4752− }
4753−
47544783 spin_unlock_irqrestore(ap->lock, flags);
4755− scsi_rescan_device(sdev);
4784+ ret = scsi_rescan_device(sdev);
47564785 scsi_device_put(sdev);
47574786 spin_lock_irqsave(ap->lock, flags);
4787+
4788+ if (ret)
4789+ goto unlock;
47584790 }
47594791 }
47604792
4793+unlock:
47614794 spin_unlock_irqrestore(ap->lock, flags);
47624795 mutex_unlock(&ap->scsi_scan_mutex);
47634796
4764− if (delay_rescan)
4797+ /* Reschedule with a delay if scsi_rescan_device() returned an error */
4798+ if (ret)
47654799 schedule_delayed_work(&ap->scsi_rescan_task,
47664800 msecs_to_jiffies(5));
47674801 }
drivers/ata/libata-transport.c+8−1
@@ -266,6 +266,10 @@ void ata_tport_delete(struct ata_port *ap) · 265 unmodified lines
266266 put_device(dev);
267267 }
268268
269+static const struct device_type ata_port_sas_type = {
270+ .name = ATA_PORT_TYPE_NAME,
271+};
272+
269273 /** ata_tport_add - initialize a transport ATA port structure
270274 *
271275 * @parent: parent device
@@ -283,7 +287,10 @@ int ata_tport_add(struct device *parent, · 11 unmodified lines
283287 struct device *dev = &ap->tdev;
284288
285289 device_initialize(dev);
286− dev->type = &ata_port_type;
290+ if (ap->flags & ATA_FLAG_SAS_HOST)
291+ dev->type = &ata_port_sas_type;
292+ else
293+ dev->type = &ata_port_type;
287294
288295 dev->parent = parent;
289296 ata_host_get(ap->host);
drivers/ata/libata.h+4−0
@@ -30,6 +30,8 @@ enum { · 29 unmodified lines
3030 ATA_DNXFER_QUIET = (1 << 31),
3131 };
3232
33+#define ATA_PORT_TYPE_NAME "ata_port"
34+
3335 extern atomic_t ata_print_id;
3436 extern int atapi_passthru16;
3537 extern int libata_fua;
@@ -60,6 +62,8 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags); · 24 unmodified lines
6062 extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
6163 unsigned int readid_flags);
6264 extern int ata_dev_configure(struct ata_device *dev);
65+extern void ata_dev_power_set_standby(struct ata_device *dev);
66+extern void ata_dev_power_set_active(struct ata_device *dev);
6367 extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit);
6468 extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
6569 extern unsigned int ata_dev_set_feature(struct ata_device *dev,
drivers/ata/pata_parport/comm.c+4−5
@@ -37,7 +37,7 @@ static int comm_read_regr(struct pi_adapter *pi, int cont, int regr) · 36 unmodified lines
3737 {
3838 int l, h, r;
3939
40− r = regr + cont_map[cont];
40+ r = regr + cont_map[cont];
4141
4242 switch (pi->mode) {
4343 case 0:
@@ -90,7 +90,6 @@ static void comm_connect(struct pi_adapter *pi) · 46 unmodified lines
9090 }
9191
9292 static void comm_disconnect(struct pi_adapter *pi)
93−
9493 {
9594 w2(0); w2(0); w2(0); w2(4);
9695 w0(pi->saved_r0);
@@ -172,12 +171,12 @@ static void comm_write_block(struct pi_adapter *pi, char *buf, int count) · 75 unmodified lines
172171 w4l(swab16(((u16 *)buf)[2 * k]) |
173172 swab16(((u16 *)buf)[2 * k + 1]) << 16);
174173 break;
175− }
174+ }
176175 }
177176
178177 static void comm_log_adapter(struct pi_adapter *pi)
179−
180−{ char *mode_string[5] = { "4-bit", "8-bit", "EPP-8", "EPP-16", "EPP-32" };
178+{
179+ char *mode_string[5] = { "4-bit", "8-bit", "EPP-8", "EPP-16", "EPP-32" };
181180
182181 dev_info(&pi->dev,
183182 "DataStor Commuter at 0x%x, mode %d (%s), delay %d\n",
drivers/ata/sata_mv.c+2−2
@@ -1255,8 +1255,8 @@ static void mv_dump_mem(struct device *dev, void __iomem *start, unsigned bytes) · 1254 unmodified lines
12551255
12561256 for (b = 0; b < bytes; ) {
12571257 for (w = 0, o = 0; b < bytes && w < 4; w++) {
1258− o += snprintf(linebuf + o, sizeof(linebuf) - o,
1259− "%08x ", readl(start + b));
1258+ o += scnprintf(linebuf + o, sizeof(linebuf) - o,
1259+ "%08x ", readl(start + b));
12601260 b += sizeof(u32);
12611261 }
12621262 dev_dbg(dev, "%s: %p: %s\n",
drivers/base/core.c+2−0
@@ -3537,6 +3537,8 @@ int device_add(struct device *dev) · 3536 unmodified lines
35373537 /* subsystems can specify simple device enumeration */
35383538 else if (dev->bus && dev->bus->dev_name)
35393539 error = dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id);
3540+ else
3541+ error = -EINVAL;
35403542 if (error)
35413543 goto name_error;
35423544
drivers/block/rbd.c+225−187
@@ -632,9 +632,8 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...) · 631 unmodified lines
632632 static void rbd_dev_remove_parent(struct rbd_device *rbd_dev);
633633
634634 static int rbd_dev_refresh(struct rbd_device *rbd_dev);
635−static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev);
636−static int rbd_dev_header_info(struct rbd_device *rbd_dev);
637−static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev);
635+static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev,
636+ struct rbd_image_header *header);
638637 static const char *rbd_dev_v2_snap_name(struct rbd_device *rbd_dev,
639638 u64 snap_id);
640639 static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id,
@@ -995,15 +994,24 @@ static void rbd_init_layout(struct rbd_device *rbd_dev) · 354 unmodified lines
995994 RCU_INIT_POINTER(rbd_dev->layout.pool_ns, NULL);
996995 }
997996
997+static void rbd_image_header_cleanup(struct rbd_image_header *header)
998+{
999+ kfree(header->object_prefix);
1000+ ceph_put_snap_context(header->snapc);
1001+ kfree(header->snap_sizes);
1002+ kfree(header->snap_names);
1003+
1004+ memset(header, 0, sizeof(*header));
1005+}
1006+
9981007 /*
9991008 * Fill an rbd image header with information from the given format 1
10001009 * on-disk header.
10011010 */
1002−static int rbd_header_from_disk(struct rbd_device *rbd_dev,
1003− struct rbd_image_header_ondisk *ondisk)
1011+static int rbd_header_from_disk(struct rbd_image_header *header,
1012+ struct rbd_image_header_ondisk *ondisk,
1013+ bool first_time)
10041014 {
1005− struct rbd_image_header *header = &rbd_dev->header;
1006− bool first_time = header->object_prefix == NULL;
10071015 struct ceph_snap_context *snapc;
10081016 char *object_prefix = NULL;
10091017 char *snap_names = NULL;
@@ -1070,11 +1078,6 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev, · 60 unmodified lines
10701078 if (first_time) {
10711079 header->object_prefix = object_prefix;
10721080 header->obj_order = ondisk->options.order;
1073− rbd_init_layout(rbd_dev);
1074− } else {
1075− ceph_put_snap_context(header->snapc);
1076− kfree(header->snap_names);
1077− kfree(header->snap_sizes);
10781081 }
10791082
10801083 /* The remaining fields always get updated (when we refresh) */
@@ -4859,7 +4862,9 @@ out_req: · 3778 unmodified lines
48594862 * return, the rbd_dev->header field will contain up-to-date
48604863 * information about the image.
48614864 */
4862−static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev)
4865+static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev,
4866+ struct rbd_image_header *header,
4867+ bool first_time)
48634868 {
48644869 struct rbd_image_header_ondisk *ondisk = NULL;
48654870 u32 snap_count = 0;
@@ -4907,7 +4912,7 @@ static int rbd_dev_v1_header_info(struct rbd_device *rbd_dev) · 41 unmodified lines
49074912 snap_count = le32_to_cpu(ondisk->snap_count);
49084913 } while (snap_count != want_count);
49094914
4910− ret = rbd_header_from_disk(rbd_dev, ondisk);
4915+ ret = rbd_header_from_disk(header, ondisk, first_time);
49114916 out:
49124917 kfree(ondisk);
49134918
@@ -4931,39 +4936,6 @@ static void rbd_dev_update_size(struct rbd_device *rbd_dev) · 17 unmodified lines
49314936 }
49324937 }
49334938
4934−static int rbd_dev_refresh(struct rbd_device *rbd_dev)
4935−{
4936− u64 mapping_size;
4937− int ret;
4938−
4939− down_write(&rbd_dev->header_rwsem);
4940− mapping_size = rbd_dev->mapping.size;
4941−
4942− ret = rbd_dev_header_info(rbd_dev);
4943− if (ret)
4944− goto out;
4945−
4946− /*
4947− * If there is a parent, see if it has disappeared due to the
4948− * mapped image getting flattened.
4949− */
4950− if (rbd_dev->parent) {
4951− ret = rbd_dev_v2_parent_info(rbd_dev);
4952− if (ret)
4953− goto out;
4954− }
4955−
4956− rbd_assert(!rbd_is_snap(rbd_dev));
4957− rbd_dev->mapping.size = rbd_dev->header.image_size;
4958−
4959−out:
4960− up_write(&rbd_dev->header_rwsem);
4961− if (!ret && mapping_size != rbd_dev->mapping.size)
4962− rbd_dev_update_size(rbd_dev);
4963−
4964− return ret;
4965−}
4966−
49674939 static const struct blk_mq_ops rbd_mq_ops = {
49684940 .queue_rq = rbd_queue_rq,
49694941 };
@@ -5503,17 +5475,12 @@ static int _rbd_dev_v2_snap_size(struct rbd_device *rbd_dev, u64 snap_id, · 533 unmodified lines
55035475 return 0;
55045476 }
55055477
5506−static int rbd_dev_v2_image_size(struct rbd_device *rbd_dev)
5507−{
5508− return _rbd_dev_v2_snap_size(rbd_dev, CEPH_NOSNAP,
5509− &rbd_dev->header.obj_order,
5510− &rbd_dev->header.image_size);
5511−}
5512−
5513−static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev)
5478+static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev,
5479+ char **pobject_prefix)
55145480 {
55155481 size_t size;
55165482 void *reply_buf;
5483+ char *object_prefix;
55175484 int ret;
55185485 void *p;
55195486
@@ -5531,16 +5498,16 @@ static int rbd_dev_v2_object_prefix(struct rbd_device *rbd_dev) · 11 unmodified lines
55315498 goto out;
55325499
55335500 p = reply_buf;
5534− rbd_dev->header.object_prefix = ceph_extract_encoded_string(&p,
5535− p + ret, NULL, GFP_NOIO);
5501+ object_prefix = ceph_extract_encoded_string(&p, p + ret, NULL,
5502+ GFP_NOIO);
5503+ if (IS_ERR(object_prefix)) {
5504+ ret = PTR_ERR(object_prefix);
5505+ goto out;
5506+ }
55365507 ret = 0;
55375508
5538− if (IS_ERR(rbd_dev->header.object_prefix)) {
5539− ret = PTR_ERR(rbd_dev->header.object_prefix);
5540− rbd_dev->header.object_prefix = NULL;
5541− } else {
5542− dout(" object_prefix = %s\n", rbd_dev->header.object_prefix);
5543− }
5509+ *pobject_prefix = object_prefix;
5510+ dout(" object_prefix = %s\n", object_prefix);
55445511 out:
55455512 kfree(reply_buf);
55465513
@@ -5591,13 +5558,6 @@ static int _rbd_dev_v2_snap_features(struct rbd_device *rbd_dev, u64 snap_id, · 44 unmodified lines
55915558 return 0;
55925559 }
55935560
5594−static int rbd_dev_v2_features(struct rbd_device *rbd_dev)
5595−{
5596− return _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP,
5597− rbd_is_ro(rbd_dev),
5598− &rbd_dev->header.features);
5599−}
5600−
56015561 /*
56025562 * These are generic image flags, but since they are used only for
56035563 * object map, store them in rbd_dev->object_map_flags.
@@ -5634,6 +5594,14 @@ struct parent_image_info { · 30 unmodified lines
56345594 u64 overlap;
56355595 };
56365596
5597+static void rbd_parent_info_cleanup(struct parent_image_info *pii)
5598+{
5599+ kfree(pii->pool_ns);
5600+ kfree(pii->image_id);
5601+
5602+ memset(pii, 0, sizeof(*pii));
5603+}
5604+
56375605 /*
56385606 * The caller is responsible for @pii.
56395607 */
@@ -5703,6 +5671,9 @@ static int __get_parent_info(struct rbd_device *rbd_dev, · 63 unmodified lines
57035671 if (pii->has_overlap)
57045672 ceph_decode_64_safe(&p, end, pii->overlap, e_inval);
57055673
5674+ dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
5675+ __func__, pii->pool_id, pii->pool_ns, pii->image_id, pii->snap_id,
5676+ pii->has_overlap, pii->overlap);
57065677 return 0;
57075678
57085679 e_inval:
@@ -5741,14 +5712,17 @@ static int __get_parent_info_legacy(struct rbd_device *rbd_dev, · 32 unmodified lines
57415712 pii->has_overlap = true;
57425713 ceph_decode_64_safe(&p, end, pii->overlap, e_inval);
57435714
5715+ dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
5716+ __func__, pii->pool_id, pii->pool_ns, pii->image_id, pii->snap_id,
5717+ pii->has_overlap, pii->overlap);
57445718 return 0;
57455719
57465720 e_inval:
57475721 return -EINVAL;
57485722 }
57495723
5750−static int get_parent_info(struct rbd_device *rbd_dev,
5751− struct parent_image_info *pii)
5724+static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev,
5725+ struct parent_image_info *pii)
57525726 {
57535727 struct page *req_page, *reply_page;
57545728 void *p;
@@ -5776,7 +5750,7 @@ static int get_parent_info(struct rbd_device *rbd_dev, · 21 unmodified lines
57765750 return ret;
57775751 }
57785752
5779−static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev)
5753+static int rbd_dev_setup_parent(struct rbd_device *rbd_dev)
57805754 {
57815755 struct rbd_spec *parent_spec;
57825756 struct parent_image_info pii = { 0 };
@@ -5786,37 +5760,12 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 3 unmodified lines
57865760 if (!parent_spec)
57875761 return -ENOMEM;
57885762
5789− ret = get_parent_info(rbd_dev, &pii);
5763+ ret = rbd_dev_v2_parent_info(rbd_dev, &pii);
57905764 if (ret)
57915765 goto out_err;
57925766
5793− dout("%s pool_id %llu pool_ns %s image_id %s snap_id %llu has_overlap %d overlap %llu\n",
5794− __func__, pii.pool_id, pii.pool_ns, pii.image_id, pii.snap_id,
5795− pii.has_overlap, pii.overlap);
5796−
5797− if (pii.pool_id == CEPH_NOPOOL || !pii.has_overlap) {
5798− /*
5799− * Either the parent never existed, or we have
5800− * record of it but the image got flattened so it no
5801− * longer has a parent. When the parent of a
5802− * layered image disappears we immediately set the
5803− * overlap to 0. The effect of this is that all new
5804− * requests will be treated as if the image had no
5805− * parent.
5806− *
5807− * If !pii.has_overlap, the parent image spec is not
5808− * applicable. It's there to avoid duplication in each
5809− * snapshot record.
5810− */
5811− if (rbd_dev->parent_overlap) {
5812− rbd_dev->parent_overlap = 0;
5813− rbd_dev_parent_put(rbd_dev);
5814− pr_info("%s: clone image has been flattened\n",
5815− rbd_dev->disk->disk_name);
5816− }
5817−
5767+ if (pii.pool_id == CEPH_NOPOOL || !pii.has_overlap)
58185768 goto out; /* No parent? No problem. */
5819− }
58205769
58215770 /* The ceph file layout needs to fit pool id in 32 bits */
58225771
@@ -5828,58 +5777,46 @@ static int rbd_dev_v2_parent_info(struct rbd_device *rbd_dev) · 5 unmodified lines
58285777 }
58295778
58305779 /*
5831− * The parent won't change (except when the clone is
5832− * flattened, already handled that). So we only need to
5833− * record the parent spec we have not already done so.
5780+ * The parent won't change except when the clone is flattened,
5781+ * so we only need to record the parent image spec once.
58345782 */
5835− if (!rbd_dev->parent_spec) {
5836− parent_spec->pool_id = pii.pool_id;
5837− if (pii.pool_ns && *pii.pool_ns) {
5838− parent_spec->pool_ns = pii.pool_ns;
5839− pii.pool_ns = NULL;
5840− }
5841− parent_spec->image_id = pii.image_id;
5842− pii.image_id = NULL;
5843− parent_spec->snap_id = pii.snap_id;
5844−
5845− rbd_dev->parent_spec = parent_spec;
5846− parent_spec = NULL; /* rbd_dev now owns this */
5783+ parent_spec->pool_id = pii.pool_id;
5784+ if (pii.pool_ns && *pii.pool_ns) {
5785+ parent_spec->pool_ns = pii.pool_ns;
5786+ pii.pool_ns = NULL;
58475787 }
5788+ parent_spec->image_id = pii.image_id;
5789+ pii.image_id = NULL;
5790+ parent_spec->snap_id = pii.snap_id;
5791+
5792+ rbd_assert(!rbd_dev->parent_spec);
5793+ rbd_dev->parent_spec = parent_spec;
5794+ parent_spec = NULL; /* rbd_dev now owns this */
58485795
58495796 /*
5850− * We always update the parent overlap. If it's zero we issue
5851− * a warning, as we will proceed as if there was no parent.
5797+ * Record the parent overlap. If it's zero, issue a warning as
5798+ * we will proceed as if there is no parent.
58525799 */
5853− if (!pii.overlap) {
5854− if (parent_spec) {
5855− /* refresh, careful to warn just once */
5856− if (rbd_dev->parent_overlap)
5857− rbd_warn(rbd_dev,
5858− "clone now standalone (overlap became 0)");
5859− } else {
5860− /* initial probe */
5861− rbd_warn(rbd_dev, "clone is standalone (overlap 0)");
5862− }
5863− }
5800+ if (!pii.overlap)
5801+ rbd_warn(rbd_dev, "clone is standalone (overlap 0)");
58645802 rbd_dev->parent_overlap = pii.overlap;
58655803
58665804 out:
58675805 ret = 0;
58685806 out_err:
5869− kfree(pii.pool_ns);
5870− kfree(pii.image_id);
5807+ rbd_parent_info_cleanup(&pii);
58715808 rbd_spec_put(parent_spec);
58725809 return ret;
58735810 }
58745811
5875−static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev)
5812+static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev,
5813+ u64 *stripe_unit, u64 *stripe_count)
58765814 {
58775815 struct {
58785816 __le64 stripe_unit;
58795817 __le64 stripe_count;
58805818 } __attribute__ ((packed)) striping_info_buf = { 0 };
58815819 size_t size = sizeof (striping_info_buf);
5882− void *p;
58835820 int ret;
58845821
58855822 ret = rbd_obj_method_sync(rbd_dev, &rbd_dev->header_oid,
@@ -5891,27 +5828,33 @@ static int rbd_dev_v2_striping_info(struct rbd_device *rbd_dev) · 5 unmodified lines
58915828 if (ret < size)
58925829 return -ERANGE;
58935830
5894− p = &striping_info_buf;
5895− rbd_dev->header.stripe_unit = ceph_decode_64(&p);
5896− rbd_dev->header.stripe_count = ceph_decode_64(&p);
5831+ *stripe_unit = le64_to_cpu(striping_info_buf.stripe_unit);
5832+ *stripe_count = le64_to_cpu(striping_info_buf.stripe_count);
5833+ dout(" stripe_unit = %llu stripe_count = %llu\n", *stripe_unit,
5834+ *stripe_count);
5835+
58975836 return 0;
58985837 }
58995838
5900−static int rbd_dev_v2_data_pool(struct rbd_device *rbd_dev)
5839+static int rbd_dev_v2_data_pool(struct rbd_device *rbd_dev, s64 *data_pool_id)
59015840 {
5902− __le64 data_pool_id;
5841+ __le64 data_pool_buf;
59035842 int ret;
59045843
59055844 ret = rbd_obj_method_sync(rbd_dev, &rbd_dev->header_oid,
59065845 &rbd_dev->header_oloc, "get_data_pool",
5907− NULL, 0, &data_pool_id, sizeof(data_pool_id));
5846+ NULL, 0, &data_pool_buf,
5847+ sizeof(data_pool_buf));
5848+ dout("%s: rbd_obj_method_sync returned %d\n", __func__, ret);
59085849 if (ret < 0)
59095850 return ret;
5910− if (ret < sizeof(data_pool_id))
5851+ if (ret < sizeof(data_pool_buf))
59115852 return -EBADMSG;
59125853
5913− rbd_dev->header.data_pool_id = le64_to_cpu(data_pool_id);
5914− WARN_ON(rbd_dev->header.data_pool_id == CEPH_NOPOOL);
5854+ *data_pool_id = le64_to_cpu(data_pool_buf);
5855+ dout(" data_pool_id = %lld\n", *data_pool_id);
5856+ WARN_ON(*data_pool_id == CEPH_NOPOOL);
5857+
59155858 return 0;
59165859 }
59175860
@@ -6103,7 +6046,8 @@ out_err: · 185 unmodified lines
61036046 return ret;
61046047 }
61056048
6106−static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev)
6049+static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev,
6050+ struct ceph_snap_context **psnapc)
61076051 {
61086052 size_t size;
61096053 int ret;
@@ -6164,9 +6108,7 @@ static int rbd_dev_v2_snap_context(struct rbd_device *rbd_dev) · 54 unmodified lines
61646108 for (i = 0; i < snap_count; i++)
61656109 snapc->snaps[i] = ceph_decode_64(&p);
61666110
6167− ceph_put_snap_context(rbd_dev->header.snapc);
6168− rbd_dev->header.snapc = snapc;
6169−
6111+ *psnapc = snapc;
61706112 dout(" snap context seq = %llu, snap_count = %u\n",
61716113 (unsigned long long)seq, (unsigned int)snap_count);
61726114 out:
@@ -6215,38 +6157,42 @@ out: · 42 unmodified lines
62156157 return snap_name;
62166158 }
62176159
6218−static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev)
6160+static int rbd_dev_v2_header_info(struct rbd_device *rbd_dev,
6161+ struct rbd_image_header *header,
6162+ bool first_time)
62196163 {
6220− bool first_time = rbd_dev->header.object_prefix == NULL;
62216164 int ret;
62226165
6223− ret = rbd_dev_v2_image_size(rbd_dev);
6166+ ret = _rbd_dev_v2_snap_size(rbd_dev, CEPH_NOSNAP,
6167+ first_time ? &header->obj_order : NULL,
6168+ &header->image_size);
62246169 if (ret)
62256170 return ret;
62266171
62276172 if (first_time) {
6228− ret = rbd_dev_v2_header_onetime(rbd_dev);
6173+ ret = rbd_dev_v2_header_onetime(rbd_dev, header);
62296174 if (ret)
62306175 return ret;
62316176 }
62326177
6233− ret = rbd_dev_v2_snap_context(rbd_dev);
6234− if (ret && first_time) {
6235− kfree(rbd_dev->header.object_prefix);
6236− rbd_dev->header.object_prefix = NULL;
6237− }
6178+ ret = rbd_dev_v2_snap_context(rbd_dev, &header->snapc);
6179+ if (ret)
6180+ return ret;
62386181
6239− return ret;
6182+ return 0;
62406183 }
62416184
6242−static int rbd_dev_header_info(struct rbd_device *rbd_dev)
6185+static int rbd_dev_header_info(struct rbd_device *rbd_dev,
6186+ struct rbd_image_header *header,
6187+ bool first_time)
62436188 {
62446189 rbd_assert(rbd_image_format_valid(rbd_dev->image_format));
6190+ rbd_assert(!header->object_prefix && !header->snapc);
62456191
62466192 if (rbd_dev->image_format == 1)
6247− return rbd_dev_v1_header_info(rbd_dev);
6193+ return rbd_dev_v1_header_info(rbd_dev, header, first_time);
62486194
6249− return rbd_dev_v2_header_info(rbd_dev);
6195+ return rbd_dev_v2_header_info(rbd_dev, header, first_time);
62506196 }
62516197
62526198 /*
@@ -6734,60 +6680,49 @@ out: · 481 unmodified lines
67346680 */
67356681 static void rbd_dev_unprobe(struct rbd_device *rbd_dev)
67366682 {
6737− struct rbd_image_header *header;
6738−
67396683 rbd_dev_parent_put(rbd_dev);
67406684 rbd_object_map_free(rbd_dev);
67416685 rbd_dev_mapping_clear(rbd_dev);
67426686
67436687 /* Free dynamic fields from the header, then zero it out */
67446688
6745− header = &rbd_dev->header;
6746− ceph_put_snap_context(header->snapc);
6747− kfree(header->snap_sizes);
6748− kfree(header->snap_names);
6749− kfree(header->object_prefix);
6750− memset(header, 0, sizeof (*header));
6689+ rbd_image_header_cleanup(&rbd_dev->header);
67516690 }
67526691
6753−static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev)
6692+static int rbd_dev_v2_header_onetime(struct rbd_device *rbd_dev,
6693+ struct rbd_image_header *header)
67546694 {
67556695 int ret;
67566696
6757− ret = rbd_dev_v2_object_prefix(rbd_dev);
6697+ ret = rbd_dev_v2_object_prefix(rbd_dev, &header->object_prefix);
67586698 if (ret)
6759− goto out_err;
6699+ return ret;
67606700
67616701 /*
67626702 * Get the and check features for the image. Currently the
67636703 * features are assumed to never change.
67646704 */
6765− ret = rbd_dev_v2_features(rbd_dev);
6705+ ret = _rbd_dev_v2_snap_features(rbd_dev, CEPH_NOSNAP,
6706+ rbd_is_ro(rbd_dev), &header->features);
67666707 if (ret)
6767− goto out_err;
6708+ return ret;
67686709
67696710 /* If the image supports fancy striping, get its parameters */
67706711
6771− if (rbd_dev->header.features & RBD_FEATURE_STRIPINGV2) {
6772− ret = rbd_dev_v2_striping_info(rbd_dev);
6773− if (ret < 0)
6774− goto out_err;
6712+ if (header->features & RBD_FEATURE_STRIPINGV2) {
6713+ ret = rbd_dev_v2_striping_info(rbd_dev, &header->stripe_unit,
6714+ &header->stripe_count);
6715+ if (ret)
6716+ return ret;
67756717 }
67766718
6777− if (rbd_dev->header.features & RBD_FEATURE_DATA_POOL) {
6778− ret = rbd_dev_v2_data_pool(rbd_dev);
6719+ if (header->features & RBD_FEATURE_DATA_POOL) {
6720+ ret = rbd_dev_v2_data_pool(rbd_dev, &header->data_pool_id);
67796721 if (ret)
6780− goto out_err;
6722+ return ret;
67816723 }
67826724
6783− rbd_init_layout(rbd_dev);
67846725 return 0;
6785−
6786−out_err:
6787− rbd_dev->header.features = 0;
6788− kfree(rbd_dev->header.object_prefix);
6789− rbd_dev->header.object_prefix = NULL;
6790− return ret;
67916726 }
67926727
67936728 /*
@@ -6982,13 +6917,15 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) · 188 unmodified lines
69826917 if (!depth)
69836918 down_write(&rbd_dev->header_rwsem);
69846919
6985− ret = rbd_dev_header_info(rbd_dev);
6920+ ret = rbd_dev_header_info(rbd_dev, &rbd_dev->header, true);
69866921 if (ret) {
69876922 if (ret == -ENOENT && !need_watch)
69886923 rbd_print_dne(rbd_dev, false);
69896924 goto err_out_probe;
69906925 }
69916926
6927+ rbd_init_layout(rbd_dev);
6928+
69926929 /*
69936930 * If this image is the one being mapped, we have pool name and
69946931 * id, image name and id, and snap name - need to fill snap id.
@@ -7017,7 +6954,7 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth) · 22 unmodified lines
70176954 }
70186955
70196956 if (rbd_dev->header.features & RBD_FEATURE_LAYERING) {
7020− ret = rbd_dev_v2_parent_info(rbd_dev);
6957+ ret = rbd_dev_setup_parent(rbd_dev);
70216958 if (ret)
70226959 goto err_out_probe;
70236960 }
@@ -7043,6 +6980,107 @@ err_out_format: · 19 unmodified lines
70436980 return ret;
70446981 }
70456982
6983+static void rbd_dev_update_header(struct rbd_device *rbd_dev,
6984+ struct rbd_image_header *header)
6985+{
6986+ rbd_assert(rbd_image_format_valid(rbd_dev->image_format));
6987+ rbd_assert(rbd_dev->header.object_prefix); /* !first_time */
6988+
6989+ if (rbd_dev->header.image_size != header->image_size) {
6990+ rbd_dev->header.image_size = header->image_size;
6991+
6992+ if (!rbd_is_snap(rbd_dev)) {
6993+ rbd_dev->mapping.size = header->image_size;
6994+ rbd_dev_update_size(rbd_dev);
6995+ }
6996+ }
6997+
6998+ ceph_put_snap_context(rbd_dev->header.snapc);
6999+ rbd_dev->header.snapc = header->snapc;
7000+ header->snapc = NULL;
7001+
7002+ if (rbd_dev->image_format == 1) {
7003+ kfree(rbd_dev->header.snap_names);
7004+ rbd_dev->header.snap_names = header->snap_names;
7005+ header->snap_names = NULL;
7006+
7007+ kfree(rbd_dev->header.snap_sizes);
7008+ rbd_dev->header.snap_sizes = header->snap_sizes;
7009+ header->snap_sizes = NULL;
7010+ }
7011+}
7012+
7013+static void rbd_dev_update_parent(struct rbd_device *rbd_dev,
7014+ struct parent_image_info *pii)
7015+{
7016+ if (pii->pool_id == CEPH_NOPOOL || !pii->has_overlap) {
7017+ /*
7018+ * Either the parent never existed, or we have
7019+ * record of it but the image got flattened so it no
7020+ * longer has a parent. When the parent of a
7021+ * layered image disappears we immediately set the
7022+ * overlap to 0. The effect of this is that all new
7023+ * requests will be treated as if the image had no
7024+ * parent.
7025+ *
7026+ * If !pii.has_overlap, the parent image spec is not
7027+ * applicable. It's there to avoid duplication in each
7028+ * snapshot record.
7029+ */
7030+ if (rbd_dev->parent_overlap) {
7031+ rbd_dev->parent_overlap = 0;
7032+ rbd_dev_parent_put(rbd_dev);
7033+ pr_info("%s: clone has been flattened\n",
7034+ rbd_dev->disk->disk_name);
7035+ }
7036+ } else {
7037+ rbd_assert(rbd_dev->parent_spec);
7038+
7039+ /*
7040+ * Update the parent overlap. If it became zero, issue
7041+ * a warning as we will proceed as if there is no parent.
7042+ */
7043+ if (!pii->overlap && rbd_dev->parent_overlap)
7044+ rbd_warn(rbd_dev,
7045+ "clone has become standalone (overlap 0)");
7046+ rbd_dev->parent_overlap = pii->overlap;
7047+ }
7048+}
7049+
7050+static int rbd_dev_refresh(struct rbd_device *rbd_dev)
7051+{
7052+ struct rbd_image_header header = { 0 };
7053+ struct parent_image_info pii = { 0 };
7054+ int ret;
7055+
7056+ dout("%s rbd_dev %p\n", __func__, rbd_dev);
7057+
7058+ ret = rbd_dev_header_info(rbd_dev, &header, false);
7059+ if (ret)
7060+ goto out;
7061+
7062+ /*
7063+ * If there is a parent, see if it has disappeared due to the
7064+ * mapped image getting flattened.
7065+ */
7066+ if (rbd_dev->parent) {
7067+ ret = rbd_dev_v2_parent_info(rbd_dev, &pii);
7068+ if (ret)
7069+ goto out;
7070+ }
7071+
7072+ down_write(&rbd_dev->header_rwsem);
7073+ rbd_dev_update_header(rbd_dev, &header);
7074+ if (rbd_dev->parent)
7075+ rbd_dev_update_parent(rbd_dev, &pii);
7076+ up_write(&rbd_dev->header_rwsem);
7077+
7078+out:
7079+ rbd_parent_info_cleanup(&pii);
7080+ rbd_image_header_cleanup(&header);
7081+ return ret;
7082+}
7083+
70467084 static ssize_t do_rbd_add(const char *buf, size_t count)
70477085 {
70487086 struct rbd_device *rbd_dev = NULL;
drivers/bus/ti-sysc.c+22−9
@@ -38,6 +38,7 @@ enum sysc_soc { · 37 unmodified lines
3838 SOC_2420,
3939 SOC_2430,
4040 SOC_3430,
41+ SOC_AM35,
4142 SOC_3630,
4243 SOC_4430,
4344 SOC_4460,
@@ -1097,6 +1098,11 @@ static int sysc_enable_module(struct device *dev) · 1053 unmodified lines
10971098 if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_SIDLE |
10981099 SYSC_QUIRK_SWSUP_SIDLE_ACT)) {
10991100 best_mode = SYSC_IDLE_NO;
1101+
1102+ /* Clear WAKEUP */
1103+ if (regbits->enwkup_shift >= 0 &&
1104+ ddata->cfg.sysc_val & BIT(regbits->enwkup_shift))
1105+ reg &= ~BIT(regbits->enwkup_shift);
11001106 } else {
11011107 best_mode = fls(ddata->cfg.sidlemodes) - 1;
11021108 if (best_mode > SYSC_IDLE_MASK) {
@@ -1224,6 +1230,13 @@ set_sidle: · 121 unmodified lines
12241230 }
12251231 }
12261232
1233+ if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_SIDLE_ACT) {
1234+ /* Set WAKEUP */
1235+ if (regbits->enwkup_shift >= 0 &&
1236+ ddata->cfg.sysc_val & BIT(regbits->enwkup_shift))
1237+ reg |= BIT(regbits->enwkup_shift);
1238+ }
1239+
12271240 reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift);
12281241 reg |= best_mode << regbits->sidle_shift;
12291242 if (regbits->autoidle_shift >= 0 &&
@@ -1518,16 +1531,16 @@ struct sysc_revision_quirk { · 288 unmodified lines
15181531 static const struct sysc_revision_quirk sysc_revision_quirks[] = {
15191532 /* These drivers need to be fixed to not use pm_runtime_irq_safe() */
15201533 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000046, 0xffffffff,
1521− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1534+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15221535 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
1523− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1536+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15241537 /* Uarts on omap4 and later */
15251538 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff,
1526− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1539+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15271540 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff,
1528− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1541+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15291542 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47424e03, 0xffffffff,
1530− SYSC_QUIRK_SWSUP_SIDLE | SYSC_QUIRK_LEGACY_IDLE),
1543+ SYSC_QUIRK_SWSUP_SIDLE_ACT | SYSC_QUIRK_LEGACY_IDLE),
15311544
15321545 /* Quirks that need to be set based on the module address */
15331546 SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff,
@@ -1862,7 +1875,7 @@ static void sysc_pre_reset_quirk_dss(struct sysc *ddata) · 328 unmodified lines
18621875 dev_warn(ddata->dev, "%s: timed out %08x !+ %08x\n",
18631876 __func__, val, irq_mask);
18641877
1865− if (sysc_soc->soc == SOC_3430) {
1878+ if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35) {
18661879 /* Clear DSS_SDI_CONTROL */
18671880 sysc_write(ddata, 0x44, 0);
18681881
@@ -2150,8 +2163,7 @@ static int sysc_reset(struct sysc *ddata) · 281 unmodified lines
21502163 }
21512164
21522165 if (ddata->cfg.srst_udelay)
2153− usleep_range(ddata->cfg.srst_udelay,
2154− ddata->cfg.srst_udelay * 2);
2166+ fsleep(ddata->cfg.srst_udelay);
21552167
21562168 if (ddata->post_reset_quirk)
21572169 ddata->post_reset_quirk(ddata);
@@ -3025,6 +3037,7 @@ static void ti_sysc_idle(struct work_struct *work) · 867 unmodified lines
30253037 static const struct soc_device_attribute sysc_soc_match[] = {
30263038 SOC_FLAG("OMAP242*", SOC_2420),
30273039 SOC_FLAG("OMAP243*", SOC_2430),
3040+ SOC_FLAG("AM35*", SOC_AM35),
30283041 SOC_FLAG("OMAP3[45]*", SOC_3430),
30293042 SOC_FLAG("OMAP3[67]*", SOC_3630),
30303043 SOC_FLAG("OMAP443*", SOC_4430),
@@ -3229,7 +3242,7 @@ static int sysc_check_active_timer(struct sysc *ddata) · 198 unmodified lines
32293242 * can be dropped if we stop supporting old beagleboard revisions
32303243 * A to B4 at some point.
32313244 */
3232− if (sysc_soc->soc == SOC_3430)
3245+ if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35)
32333246 error = -ENXIO;
32343247 else
32353248 error = -EBUSY;
drivers/char/agp/parisc-agp.c+0−2
@@ -394,8 +394,6 @@ find_quicksilver(struct device *dev, void *data) · 393 unmodified lines
394394 static int __init
395395 parisc_agp_init(void)
396396 {
397− extern struct sba_device *sba_list;
398−
399397 int err = -1;
400398 struct parisc_device *sba = NULL, *lba = NULL;
401399 struct lba_device *lbadev = NULL;
drivers/char/tpm/tpm-chip.c+1−1
@@ -33,7 +33,7 @@ const struct class tpm_class = { · 32 unmodified lines
3333 .shutdown_pre = tpm_class_shutdown,
3434 };
3535 const struct class tpmrm_class = {
36− .name = "tmprm",
36+ .name = "tpmrm",
3737 };
3838 dev_t tpm_devt;
3939
drivers/clk/clk-si521xx.c+5−4
@@ -96,7 +96,7 @@ static int si521xx_regmap_i2c_write(void *context, unsigned int reg, · 95 unmodified lines
9696 unsigned int val)
9797 {
9898 struct i2c_client *i2c = context;
99− const u8 data[3] = { reg, 1, val };
99+ const u8 data[2] = { reg, val };
100100 const int count = ARRAY_SIZE(data);
101101 int ret;
102102
@@ -146,7 +146,7 @@ static int si521xx_regmap_i2c_read(void *context, unsigned int reg, · 43 unmodified lines
146146 static const struct regmap_config si521xx_regmap_config = {
147147 .reg_bits = 8,
148148 .val_bits = 8,
149− .cache_type = REGCACHE_NONE,
149+ .cache_type = REGCACHE_FLAT,
150150 .max_register = SI521XX_REG_DA,
151151 .rd_table = &si521xx_readable_table,
152152 .wr_table = &si521xx_writeable_table,
@@ -281,9 +281,10 @@ static int si521xx_probe(struct i2c_client *client) · 128 unmodified lines
281281 {
282282 const u16 chip_info = (u16)(uintptr_t)device_get_match_data(&client->dev);
283283 const struct clk_parent_data clk_parent_data = { .index = 0 };
284− struct si521xx *si;
284+ const u8 data[3] = { SI521XX_REG_BC, 1, 1 };
285285 unsigned char name[6] = "DIFF0";
286286 struct clk_init_data init = {};
287+ struct si521xx *si;
287288 int i, ret;
288289
289290 if (!chip_info)
@@ -308,7 +309,7 @@ static int si521xx_probe(struct i2c_client *client) · 18 unmodified lines
308309 "Failed to allocate register map\n");
309310
310311 /* Always read back 1 Byte via I2C */
311− ret = regmap_write(si->regmap, SI521XX_REG_BC, 1);
312+ ret = i2c_master_send(client, data, ARRAY_SIZE(data));
312313 if (ret < 0)
313314 return ret;
314315
drivers/clk/clk-versaclock3.c+40−41
@@ -118,21 +118,21 @@ enum vc3_div { · 117 unmodified lines
118118 VC3_DIV5,
119119 };
120120
121−enum vc3_clk_mux {
122− VC3_DIFF2_MUX,
123− VC3_DIFF1_MUX,
124− VC3_SE3_MUX,
125− VC3_SE2_MUX,
126− VC3_SE1_MUX,
127−};
128−
129121 enum vc3_clk {
130− VC3_DIFF2,
131− VC3_DIFF1,
132− VC3_SE3,
133− VC3_SE2,
134− VC3_SE1,
135122 VC3_REF,
123+ VC3_SE1,
124+ VC3_SE2,
125+ VC3_SE3,
126+ VC3_DIFF1,
127+ VC3_DIFF2,
128+};
129+
130+enum vc3_clk_mux {
131+ VC3_SE1_MUX = VC3_SE1 - 1,
132+ VC3_SE2_MUX = VC3_SE2 - 1,
133+ VC3_SE3_MUX = VC3_SE3 - 1,
134+ VC3_DIFF1_MUX = VC3_DIFF1 - 1,
135+ VC3_DIFF2_MUX = VC3_DIFF2 - 1,
136136 };
137137
138138 struct vc3_clk_data {
@@ -401,11 +401,10 @@ static long vc3_pll_round_rate(struct clk_hw *hw, unsigned long rate, · 262 unmodified lines
401401 /* Determine best fractional part, which is 16 bit wide */
402402 div_frc = rate % *parent_rate;
403403 div_frc *= BIT(16) - 1;
404− do_div(div_frc, *parent_rate);
405404
406− vc3->div_frc = (u32)div_frc;
405+ vc3->div_frc = min_t(u64, div64_ul(div_frc, *parent_rate), U16_MAX);
407406 rate = (*parent_rate *
408− (vc3->div_int * VC3_2_POW_16 + div_frc) / VC3_2_POW_16);
407+ (vc3->div_int * VC3_2_POW_16 + vc3->div_frc) / VC3_2_POW_16);
409408 } else {
410409 rate = *parent_rate * vc3->div_int;
411410 }
@@ -897,33 +896,33 @@ static struct vc3_hw_data clk_div[] = { · 485 unmodified lines
897896 };
898897
899898 static struct vc3_hw_data clk_mux[] = {
900− [VC3_DIFF2_MUX] = {
899+ [VC3_SE1_MUX] = {
901900 .data = &(struct vc3_clk_data) {
902− .offs = VC3_DIFF2_CTRL_REG,
903− .bitmsk = VC3_DIFF2_CTRL_REG_DIFF2_CLK_SEL
901+ .offs = VC3_SE1_DIV4_CTRL,
902+ .bitmsk = VC3_SE1_DIV4_CTRL_SE1_CLK_SEL
904903 },
905904 .hw.init = &(struct clk_init_data){
906− .name = "diff2_mux",
905+ .name = "se1_mux",
907906 .ops = &vc3_clk_mux_ops,
908907 .parent_hws = (const struct clk_hw *[]) {
909− &clk_div[VC3_DIV1].hw,
910− &clk_div[VC3_DIV3].hw
908+ &clk_div[VC3_DIV5].hw,
909+ &clk_div[VC3_DIV4].hw
911910 },
912911 .num_parents = 2,
913912 .flags = CLK_SET_RATE_PARENT
914913 }
915914 },
916− [VC3_DIFF1_MUX] = {
915+ [VC3_SE2_MUX] = {
917916 .data = &(struct vc3_clk_data) {
918− .offs = VC3_DIFF1_CTRL_REG,
919− .bitmsk = VC3_DIFF1_CTRL_REG_DIFF1_CLK_SEL
917+ .offs = VC3_SE2_CTRL_REG0,
918+ .bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
920919 },
921920 .hw.init = &(struct clk_init_data){
922− .name = "diff1_mux",
921+ .name = "se2_mux",
923922 .ops = &vc3_clk_mux_ops,
924923 .parent_hws = (const struct clk_hw *[]) {
925− &clk_div[VC3_DIV1].hw,
926− &clk_div[VC3_DIV3].hw
924+ &clk_div[VC3_DIV5].hw,
925+ &clk_div[VC3_DIV4].hw
927926 },
928927 .num_parents = 2,
929928 .flags = CLK_SET_RATE_PARENT
@@ -945,33 +944,33 @@ static struct vc3_hw_data clk_mux[] = { · 15 unmodified lines
945944 .flags = CLK_SET_RATE_PARENT
946945 }
947946 },
948− [VC3_SE2_MUX] = {
947+ [VC3_DIFF1_MUX] = {
949948 .data = &(struct vc3_clk_data) {
950− .offs = VC3_SE2_CTRL_REG0,
951− .bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
949+ .offs = VC3_DIFF1_CTRL_REG,
950+ .bitmsk = VC3_DIFF1_CTRL_REG_DIFF1_CLK_SEL
952951 },
953952 .hw.init = &(struct clk_init_data){
954− .name = "se2_mux",
953+ .name = "diff1_mux",
955954 .ops = &vc3_clk_mux_ops,
956955 .parent_hws = (const struct clk_hw *[]) {
957− &clk_div[VC3_DIV5].hw,
958− &clk_div[VC3_DIV4].hw
956+ &clk_div[VC3_DIV1].hw,
957+ &clk_div[VC3_DIV3].hw
959958 },
960959 .num_parents = 2,
961960 .flags = CLK_SET_RATE_PARENT
962961 }
963962 },
964− [VC3_SE1_MUX] = {
963+ [VC3_DIFF2_MUX] = {
965964 .data = &(struct vc3_clk_data) {
966− .offs = VC3_SE1_DIV4_CTRL,
967− .bitmsk = VC3_SE1_DIV4_CTRL_SE1_CLK_SEL
965+ .offs = VC3_DIFF2_CTRL_REG,
966+ .bitmsk = VC3_DIFF2_CTRL_REG_DIFF2_CLK_SEL
968967 },
969968 .hw.init = &(struct clk_init_data){
970− .name = "se1_mux",
969+ .name = "diff2_mux",
971970 .ops = &vc3_clk_mux_ops,
972971 .parent_hws = (const struct clk_hw *[]) {
973− &clk_div[VC3_DIV5].hw,
974− &clk_div[VC3_DIV4].hw
972+ &clk_div[VC3_DIV1].hw,
973+ &clk_div[VC3_DIV3].hw
975974 },
976975 .num_parents = 2,
977976 .flags = CLK_SET_RATE_PARENT
@@ -1110,7 +1109,7 @@ static int vc3_probe(struct i2c_client *client) · 132 unmodified lines
11101109 name, 0, CLK_SET_RATE_PARENT, 1, 1);
11111110 else
11121111 clk_out[i] = devm_clk_hw_register_fixed_factor_parent_hw(dev,
1113− name, &clk_mux[i].hw, CLK_SET_RATE_PARENT, 1, 1);
1112+ name, &clk_mux[i - 1].hw, CLK_SET_RATE_PARENT, 1, 1);
11141113
11151114 if (IS_ERR(clk_out[i]))
11161115 return PTR_ERR(clk_out[i]);
drivers/clk/sprd/ums512-clk.c+1−1
@@ -800,7 +800,7 @@ static SPRD_MUX_CLK_DATA(uart1_clk, "uart1-clk", uart_parents, · 799 unmodified lines
800800 0x250, 0, 3, UMS512_MUX_FLAG);
801801
802802 static const struct clk_parent_data thm_parents[] = {
803− { .fw_name = "ext-32m" },
803+ { .fw_name = "ext-32k" },
804804 { .hw = &clk_250k.hw },
805805 };
806806 static SPRD_MUX_CLK_DATA(thm0_clk, "thm0-clk", thm_parents,
drivers/clk/tegra/clk-bpmp.c+1−1
@@ -159,7 +159,7 @@ static unsigned long tegra_bpmp_clk_recalc_rate(struct clk_hw *hw, · 158 unmodified lines
159159
160160 err = tegra_bpmp_clk_transfer(clk->bpmp, &msg);
161161 if (err < 0)
162− return err;
162+ return 0;
163163
164164 return response.rate;
165165 }
drivers/comedi/Kconfig+35−68
@@ -67,7 +67,6 @@ config COMEDI_TEST · 66 unmodified lines
6767
6868 config COMEDI_PARPORT
6969 tristate "Parallel port support"
70− depends on HAS_IOPORT
7170 help
7271 Enable support for the standard parallel port.
7372 A cheap and easy way to get a few more digital I/O lines. Steal
@@ -80,7 +79,6 @@ config COMEDI_PARPORT · 6 unmodified lines
8079 config COMEDI_SSV_DNP
8180 tristate "SSV Embedded Systems DIL/Net-PC support"
8281 depends on X86_32 || COMPILE_TEST
83− depends on HAS_IOPORT
8482 help
8583 Enable support for SSV Embedded Systems DIL/Net-PC
8684
@@ -91,7 +89,6 @@ endif # COMEDI_MISC_DRIVERS · 4 unmodified lines
9189
9290 menuconfig COMEDI_ISA_DRIVERS
9391 bool "Comedi ISA and PC/104 drivers"
94− depends on ISA
9592 help
9693 Enable comedi ISA and PC/104 drivers to be built
9794
@@ -103,8 +100,7 @@ if COMEDI_ISA_DRIVERS · 5 unmodified lines
103100
104101 config COMEDI_PCL711
105102 tristate "Advantech PCL-711/711b and ADlink ACL-8112 ISA card support"
106− depends on HAS_IOPORT
107− depends on COMEDI_8254
103+ select COMEDI_8254
108104 help
109105 Enable support for Advantech PCL-711 and 711b, ADlink ACL-8112
110106
@@ -165,9 +161,8 @@ config COMEDI_PCL730 · 54 unmodified lines
165161
166162 config COMEDI_PCL812
167163 tristate "Advantech PCL-812/813 and ADlink ACL-8112/8113/8113/8216"
168− depends on HAS_IOPORT
169164 select COMEDI_ISADMA if ISA_DMA_API
170− depends on COMEDI_8254
165+ select COMEDI_8254
171166 help
172167 Enable support for Advantech PCL-812/PG, PCL-813/B, ADLink
173168 ACL-8112DG/HG/PG, ACL-8113, ACL-8216, ICP DAS A-821PGH/PGL/PGL-NDA,
@@ -178,9 +173,8 @@ config COMEDI_PCL812 · 4 unmodified lines
178173
179174 config COMEDI_PCL816
180175 tristate "Advantech PCL-814 and PCL-816 ISA card support"
181− depends on HAS_IOPORT
182176 select COMEDI_ISADMA if ISA_DMA_API
183− depends on COMEDI_8254
177+ select COMEDI_8254
184178 help
185179 Enable support for Advantech PCL-814 and PCL-816 ISA cards
186180
@@ -189,9 +183,8 @@ config COMEDI_PCL816 · 2 unmodified lines
189183
190184 config COMEDI_PCL818
191185 tristate "Advantech PCL-718 and PCL-818 ISA card support"
192− depends on HAS_IOPORT
193186 select COMEDI_ISADMA if ISA_DMA_API
194− depends on COMEDI_8254
187+ select COMEDI_8254
195188 help
196189 Enable support for Advantech PCL-818 ISA cards
197190 PCL-818L, PCL-818H, PCL-818HD, PCL-818HG, PCL-818 and PCL-718
@@ -210,7 +203,7 @@ config COMEDI_PCM3724 · 12 unmodified lines
210203
211204 config COMEDI_AMPLC_DIO200_ISA
212205 tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E"
213− depends on COMEDI_AMPLC_DIO200
206+ select COMEDI_AMPLC_DIO200
214207 help
215208 Enable support for Amplicon PC212E, PC214E, PC215E, PC218E and
216209 PC272E ISA DIO boards
@@ -262,8 +255,7 @@ config COMEDI_DAC02 · 45 unmodified lines
262255
263256 config COMEDI_DAS16M1
264257 tristate "MeasurementComputing CIO-DAS16/M1DAS-16 ISA card support"
265− depends on HAS_IOPORT
266− depends on COMEDI_8254
258+ select COMEDI_8254
267259 select COMEDI_8255
268260 help
269261 Enable support for Measurement Computing CIO-DAS16/M1 ISA cards.
@@ -273,7 +265,7 @@ config COMEDI_DAS16M1 · 3 unmodified lines
273265
274266 config COMEDI_DAS08_ISA
275267 tristate "DAS-08 compatible ISA and PC/104 card support"
276− depends on COMEDI_DAS08
268+ select COMEDI_DAS08
277269 help
278270 Enable support for Keithley Metrabyte/ComputerBoards DAS08
279271 and compatible ISA and PC/104 cards:
@@ -286,9 +278,8 @@ config COMEDI_DAS08_ISA · 6 unmodified lines
286278
287279 config COMEDI_DAS16
288280 tristate "DAS-16 compatible ISA and PC/104 card support"
289− depends on HAS_IOPORT
290281 select COMEDI_ISADMA if ISA_DMA_API
291− depends on COMEDI_8254
282+ select COMEDI_8254
292283 select COMEDI_8255
293284 help
294285 Enable support for Keithley Metrabyte/ComputerBoards DAS16
@@ -305,8 +296,7 @@ config COMEDI_DAS16 · 10 unmodified lines
305296
306297 config COMEDI_DAS800
307298 tristate "DAS800 and compatible ISA card support"
308− depends on HAS_IOPORT
309− depends on COMEDI_8254
299+ select COMEDI_8254
310300 help
311301 Enable support for Keithley Metrabyte DAS800 and compatible ISA cards
312302 Keithley Metrabyte DAS-800, DAS-801, DAS-802
@@ -318,9 +308,8 @@ config COMEDI_DAS800 · 5 unmodified lines
318308
319309 config COMEDI_DAS1800
320310 tristate "DAS1800 and compatible ISA card support"
321− depends on HAS_IOPORT
322311 select COMEDI_ISADMA if ISA_DMA_API
323− depends on COMEDI_8254
312+ select COMEDI_8254
324313 help
325314 Enable support for DAS1800 and compatible ISA cards
326315 Keithley Metrabyte DAS-1701ST, DAS-1701ST-DA, DAS-1701/AO,
@@ -334,8 +323,7 @@ config COMEDI_DAS1800 · 7 unmodified lines
334323
335324 config COMEDI_DAS6402
336325 tristate "DAS6402 and compatible ISA card support"
337− depends on HAS_IOPORT
338− depends on COMEDI_8254
326+ select COMEDI_8254
339327 help
340328 Enable support for DAS6402 and compatible ISA cards
341329 Computerboards, Keithley Metrabyte DAS6402 and compatibles
@@ -414,8 +402,7 @@ config COMEDI_FL512 · 72 unmodified lines
414402
415403 config COMEDI_AIO_AIO12_8
416404 tristate "I/O Products PC/104 AIO12-8 Analog I/O Board support"
417− depends on HAS_IOPORT
418− depends on COMEDI_8254
405+ select COMEDI_8254
419406 select COMEDI_8255
420407 help
421408 Enable support for I/O Products PC/104 AIO12-8 Analog I/O Board
@@ -469,9 +456,8 @@ config COMEDI_ADQ12B · 47 unmodified lines
469456
470457 config COMEDI_NI_AT_A2150
471458 tristate "NI AT-A2150 ISA card support"
472− depends on HAS_IOPORT
473459 select COMEDI_ISADMA if ISA_DMA_API
474− depends on COMEDI_8254
460+ select COMEDI_8254
475461 help
476462 Enable support for National Instruments AT-A2150 cards
477463
@@ -480,8 +466,7 @@ config COMEDI_NI_AT_A2150 · 2 unmodified lines
480466
481467 config COMEDI_NI_AT_AO
482468 tristate "NI AT-AO-6/10 EISA card support"
483− depends on HAS_IOPORT
484− depends on COMEDI_8254
469+ select COMEDI_8254
485470 help
486471 Enable support for National Instruments AT-AO-6/10 cards
487472
@@ -512,7 +497,7 @@ config COMEDI_NI_ATMIO16D · 24 unmodified lines
512497
513498 config COMEDI_NI_LABPC_ISA
514499 tristate "NI Lab-PC and compatibles ISA support"
515− depends on COMEDI_NI_LABPC
500+ select COMEDI_NI_LABPC
516501 help
517502 Enable support for National Instruments Lab-PC and compatibles
518503 Lab-PC-1200, Lab-PC-1200AI, Lab-PC+.
@@ -576,7 +561,7 @@ endif # COMEDI_ISA_DRIVERS · 57 unmodified lines
576561
577562 menuconfig COMEDI_PCI_DRIVERS
578563 tristate "Comedi PCI drivers"
579− depends on PCI && HAS_IOPORT
564+ depends on PCI
580565 help
581566 Enable support for comedi PCI drivers.
582567
@@ -725,8 +710,7 @@ config COMEDI_ADL_PCI8164 · 142 unmodified lines
725710
726711 config COMEDI_ADL_PCI9111
727712 tristate "ADLink PCI-9111HR support"
728− depends on HAS_IOPORT
729− depends on COMEDI_8254
713+ select COMEDI_8254
730714 help
731715 Enable support for ADlink PCI9111 cards
732716
@@ -736,7 +720,7 @@ config COMEDI_ADL_PCI9111 · 3 unmodified lines
736720 config COMEDI_ADL_PCI9118
737721 tristate "ADLink PCI-9118DG, PCI-9118HG, PCI-9118HR support"
738722 depends on HAS_DMA
739− depends on COMEDI_8254
723+ select COMEDI_8254
740724 help
741725 Enable support for ADlink PCI-9118DG, PCI-9118HG, PCI-9118HR cards
742726
@@ -745,8 +729,7 @@ config COMEDI_ADL_PCI9118 · 2 unmodified lines
745729
746730 config COMEDI_ADV_PCI1710
747731 tristate "Advantech PCI-171x and PCI-1731 support"
748− depends on HAS_IOPORT
749− depends on COMEDI_8254
732+ select COMEDI_8254
750733 help
751734 Enable support for Advantech PCI-1710, PCI-1710HG, PCI-1711,
752735 PCI-1713 and PCI-1731
@@ -790,8 +773,7 @@ config COMEDI_ADV_PCI1760 · 37 unmodified lines
790773
791774 config COMEDI_ADV_PCI_DIO
792775 tristate "Advantech PCI DIO card support"
793− depends on HAS_IOPORT
794− depends on COMEDI_8254
776+ select COMEDI_8254
795777 select COMEDI_8255
796778 help
797779 Enable support for Advantech PCI DIO cards
@@ -804,7 +786,7 @@ config COMEDI_ADV_PCI_DIO · 6 unmodified lines
804786
805787 config COMEDI_AMPLC_DIO200_PCI
806788 tristate "Amplicon PCI215/PCI272/PCIe215/PCIe236/PCIe296 DIO support"
807− depends on COMEDI_AMPLC_DIO200
789+ select COMEDI_AMPLC_DIO200
808790 help
809791 Enable support for Amplicon PCI215, PCI272, PCIe215, PCIe236
810792 and PCIe296 DIO boards.
@@ -832,8 +814,7 @@ config COMEDI_AMPLC_PC263_PCI · 21 unmodified lines
832814
833815 config COMEDI_AMPLC_PCI224
834816 tristate "Amplicon PCI224 and PCI234 support"
835− depends on HAS_IOPORT
836− depends on COMEDI_8254
817+ select COMEDI_8254
837818 help
838819 Enable support for Amplicon PCI224 and PCI234 AO boards
839820
@@ -842,8 +823,7 @@ config COMEDI_AMPLC_PCI224 · 2 unmodified lines
842823
843824 config COMEDI_AMPLC_PCI230
844825 tristate "Amplicon PCI230 and PCI260 support"
845− depends on HAS_IOPORT
846− depends on COMEDI_8254
826+ select COMEDI_8254
847827 select COMEDI_8255
848828 help
849829 Enable support for Amplicon PCI230 and PCI260 Multifunction I/O
@@ -862,7 +842,7 @@ config COMEDI_CONTEC_PCI_DIO · 12 unmodified lines
862842
863843 config COMEDI_DAS08_PCI
864844 tristate "DAS-08 PCI support"
865− depends on COMEDI_DAS08
845+ select COMEDI_DAS08
866846 help
867847 Enable support for PCI DAS-08 cards.
868848
@@ -949,8 +929,7 @@ config COMEDI_CB_PCIDAS64 · 80 unmodified lines
949929
950930 config COMEDI_CB_PCIDAS
951931 tristate "MeasurementComputing PCI-DAS support"
952− depends on HAS_IOPORT
953− depends on COMEDI_8254
932+ select COMEDI_8254
954933 select COMEDI_8255
955934 help
956935 Enable support for ComputerBoards/MeasurementComputing PCI-DAS with
@@ -974,8 +953,7 @@ config COMEDI_CB_PCIDDA · 17 unmodified lines
974953
975954 config COMEDI_CB_PCIMDAS
976955 tristate "MeasurementComputing PCIM-DAS1602/16, PCIe-DAS1602/16 support"
977− depends on HAS_IOPORT
978− depends on COMEDI_8254
956+ select COMEDI_8254
979957 select COMEDI_8255
980958 help
981959 Enable support for ComputerBoards/MeasurementComputing PCI Migration
@@ -995,8 +973,7 @@ config COMEDI_CB_PCIMDDA · 13 unmodified lines
995973
996974 config COMEDI_ME4000
997975 tristate "Meilhaus ME-4000 support"
998− depends on HAS_IOPORT
999− depends on COMEDI_8254
976+ select COMEDI_8254
1000977 help
1001978 Enable support for Meilhaus PCI data acquisition cards
1002979 ME-4650, ME-4670i, ME-4680, ME-4680i and ME-4680is
@@ -1054,7 +1031,7 @@ config COMEDI_NI_670X · 51 unmodified lines
10541031
10551032 config COMEDI_NI_LABPC_PCI
10561033 tristate "NI Lab-PC PCI-1200 support"
1057− depends on COMEDI_NI_LABPC
1034+ select COMEDI_NI_LABPC
10581035 help
10591036 Enable support for National Instruments Lab-PC PCI-1200.
10601037
@@ -1076,7 +1053,6 @@ config COMEDI_NI_PCIDIO · 15 unmodified lines
10761053 config COMEDI_NI_PCIMIO
10771054 tristate "NI PCI-MIO-E series and M series support"
10781055 depends on HAS_DMA
1079− depends on HAS_IOPORT
10801056 select COMEDI_NI_TIOCMD
10811057 select COMEDI_8255
10821058 help
@@ -1098,8 +1074,7 @@ config COMEDI_NI_PCIMIO · 15 unmodified lines
10981074
10991075 config COMEDI_RTD520
11001076 tristate "Real Time Devices PCI4520/DM7520 support"
1101− depends on HAS_IOPORT
1102− depends on COMEDI_8254
1077+ select COMEDI_8254
11031078 help
11041079 Enable support for Real Time Devices PCI4520/DM7520
11051080
@@ -1139,8 +1114,7 @@ if COMEDI_PCMCIA_DRIVERS · 33 unmodified lines
11391114
11401115 config COMEDI_CB_DAS16_CS
11411116 tristate "CB DAS16 series PCMCIA support"
1142− depends on HAS_IOPORT
1143− depends on COMEDI_8254
1117+ select COMEDI_8254
11441118 help
11451119 Enable support for the ComputerBoards/MeasurementComputing PCMCIA
11461120 cards DAS16/16, PCM-DAS16D/12 and PCM-DAS16s/16
@@ -1150,7 +1124,7 @@ config COMEDI_CB_DAS16_CS · 3 unmodified lines
11501124
11511125 config COMEDI_DAS08_CS
11521126 tristate "CB DAS08 PCMCIA support"
1153− depends on COMEDI_DAS08
1127+ select COMEDI_DAS08
11541128 help
11551129 Enable support for the ComputerBoards/MeasurementComputing DAS-08
11561130 PCMCIA card
@@ -1160,7 +1134,6 @@ config COMEDI_DAS08_CS · 3 unmodified lines
11601134
11611135 config COMEDI_NI_DAQ_700_CS
11621136 tristate "NI DAQCard-700 PCMCIA support"
1163− depends on HAS_IOPORT
11641137 help
11651138 Enable support for the National Instruments PCMCIA DAQCard-700 DIO
11661139
@@ -1169,7 +1142,6 @@ config COMEDI_NI_DAQ_700_CS · 2 unmodified lines
11691142
11701143 config COMEDI_NI_DAQ_DIO24_CS
11711144 tristate "NI DAQ-Card DIO-24 PCMCIA support"
1172− depends on HAS_IOPORT
11731145 select COMEDI_8255
11741146 help
11751147 Enable support for the National Instruments PCMCIA DAQ-Card DIO-24
@@ -1179,7 +1151,7 @@ config COMEDI_NI_DAQ_DIO24_CS · 3 unmodified lines
11791151
11801152 config COMEDI_NI_LABPC_CS
11811153 tristate "NI DAQCard-1200 PCMCIA support"
1182− depends on COMEDI_NI_LABPC
1154+ select COMEDI_NI_LABPC
11831155 help
11841156 Enable support for the National Instruments PCMCIA DAQCard-1200
11851157
@@ -1188,7 +1160,6 @@ config COMEDI_NI_LABPC_CS · 2 unmodified lines
11881160
11891161 config COMEDI_NI_MIO_CS
11901162 tristate "NI DAQCard E series PCMCIA support"
1191− depends on HAS_IOPORT
11921163 select COMEDI_NI_TIO
11931164 select COMEDI_8255
11941165 help
@@ -1201,7 +1172,6 @@ config COMEDI_NI_MIO_CS · 6 unmodified lines
12011172
12021173 config COMEDI_QUATECH_DAQP_CS
12031174 tristate "Quatech DAQP PCMCIA data capture card support"
1204− depends on HAS_IOPORT
12051175 help
12061176 Enable support for the Quatech DAQP PCMCIA data capture cards
12071177 DAQP-208 and DAQP-308
@@ -1278,14 +1248,12 @@ endif # COMEDI_USB_DRIVERS · 70 unmodified lines
12781248
12791249 config COMEDI_8254
12801250 tristate
1281− depends on HAS_IOPORT
12821251
12831252 config COMEDI_8255
12841253 tristate
12851254
12861255 config COMEDI_8255_SA
12871256 tristate "Standalone 8255 support"
1288− depends on HAS_IOPORT
12891257 select COMEDI_8255
12901258 help
12911259 Enable support for 8255 digital I/O as a standalone driver.
@@ -1317,7 +1285,7 @@ config COMEDI_KCOMEDILIB · 25 unmodified lines
13171285 called kcomedilib.
13181286
13191287 config COMEDI_AMPLC_DIO200
1320− depends on COMEDI_8254
1288+ select COMEDI_8254
13211289 tristate
13221290
13231291 config COMEDI_AMPLC_PC236
@@ -1326,7 +1294,7 @@ config COMEDI_AMPLC_PC236 · 2 unmodified lines
13261294
13271295 config COMEDI_DAS08
13281296 tristate
1329− depends on COMEDI_8254
1297+ select COMEDI_8254
13301298 select COMEDI_8255
13311299
13321300 config COMEDI_ISADMA
@@ -1334,8 +1302,7 @@ config COMEDI_ISADMA · 1 unmodified line
13341302
13351303 config COMEDI_NI_LABPC
13361304 tristate
1337− depends on HAS_IOPORT
1338− depends on COMEDI_8254
1305+ select COMEDI_8254
13391306 select COMEDI_8255
13401307
13411308 config COMEDI_NI_LABPC_ISADMA
drivers/cxl/acpi.c+2−2
@@ -14,7 +14,7 @@ · 13 unmodified lines
1414
1515 struct cxl_cxims_data {
1616 int nr_maps;
17− u64 xormaps[];
17+ u64 xormaps[] __counted_by(nr_maps);
1818 };
1919
2020 /*
@@ -112,9 +112,9 @@ static int cxl_parse_cxims(union acpi_subtable_headers *header, void *arg, · 91 unmodified lines
112112 GFP_KERNEL);
113113 if (!cximsd)
114114 return -ENOMEM;
115+ cximsd->nr_maps = nr_maps;
115116 memcpy(cximsd->xormaps, cxims->xormap_list,
116117 nr_maps * sizeof(*cximsd->xormaps));
117− cximsd->nr_maps = nr_maps;
118118 cxlrd->platform_data = cximsd;
119119
120120 return 0;
drivers/cxl/core/mbox.c+12−11
@@ -715,24 +715,25 @@ static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel) · 714 unmodified lines
715715 for (i = 0; i < cel_entries; i++) {
716716 u16 opcode = le16_to_cpu(cel_entry[i].opcode);
717717 struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
718+ int enabled = 0;
718719
719− if (!cmd && (!cxl_is_poison_command(opcode) ||
720− !cxl_is_security_command(opcode))) {
721− dev_dbg(dev,
722− "Opcode 0x%04x unsupported by driver\n", opcode);
723− continue;
724− }
725−
726− if (cmd)
720+ if (cmd) {
727721 set_bit(cmd->info.id, mds->enabled_cmds);
722+ enabled++;
723+ }
728724
729− if (cxl_is_poison_command(opcode))
725+ if (cxl_is_poison_command(opcode)) {
730726 cxl_set_poison_cmd_enabled(&mds->poison, opcode);
727+ enabled++;
728+ }
731729
732− if (cxl_is_security_command(opcode))
730+ if (cxl_is_security_command(opcode)) {
733731 cxl_set_security_cmd_enabled(&mds->security, opcode);
732+ enabled++;
733+ }
734734
735− dev_dbg(dev, "Opcode 0x%04x enabled\n", opcode);
735+ dev_dbg(dev, "Opcode 0x%04x %s\n", opcode,
736+ enabled ? "enabled" : "unsupported by driver");
736737 }
737738 }
738739
drivers/cxl/core/port.c+9−4
@@ -1,5 +1,6 @@
11 // SPDX-License-Identifier: GPL-2.0-only
22 /* Copyright(c) 2020 Intel Corporation. All rights reserved. */
3+#include <linux/platform_device.h>
34 #include <linux/memregion.h>
45 #include <linux/workqueue.h>
56 #include <linux/debugfs.h>
@@ -706,16 +707,20 @@ static int cxl_setup_comp_regs(struct device *dev, struct cxl_register_map *map, · 700 unmodified lines
706707 return cxl_setup_regs(map);
707708 }
708709
709−static inline int cxl_port_setup_regs(struct cxl_port *port,
710− resource_size_t component_reg_phys)
710+static int cxl_port_setup_regs(struct cxl_port *port,
711+ resource_size_t component_reg_phys)
711712 {
713+ if (dev_is_platform(port->uport_dev))
714+ return 0;
712715 return cxl_setup_comp_regs(&port->dev, &port->comp_map,
713716 component_reg_phys);
714717 }
715718
716−static inline int cxl_dport_setup_regs(struct cxl_dport *dport,
717− resource_size_t component_reg_phys)
719+static int cxl_dport_setup_regs(struct cxl_dport *dport,
720+ resource_size_t component_reg_phys)
718721 {
722+ if (dev_is_platform(dport->dport_dev))
723+ return 0;
719724 return cxl_setup_comp_regs(dport->dport_dev, &dport->comp_map,
720725 component_reg_phys);
721726 }
drivers/cxl/core/region.c+31−10
@@ -717,13 +717,35 @@ static int match_free_decoder(struct device *dev, void *data) · 716 unmodified lines
717717 return 0;
718718 }
719719
720+static int match_auto_decoder(struct device *dev, void *data)
721+{
722+ struct cxl_region_params *p = data;
723+ struct cxl_decoder *cxld;
724+ struct range *r;
725+
726+ if (!is_switch_decoder(dev))
727+ return 0;
728+
729+ cxld = to_cxl_decoder(dev);
730+ r = &cxld->hpa_range;
731+
732+ if (p->res && p->res->start == r->start && p->res->end == r->end)
733+ return 1;
734+
735+ return 0;
736+}
737+
720738 static struct cxl_decoder *cxl_region_find_decoder(struct cxl_port *port,
721739 struct cxl_region *cxlr)
722740 {
723741 struct device *dev;
724742 int id = 0;
725743
726− dev = device_find_child(&port->dev, &id, match_free_decoder);
744+ if (test_bit(CXL_REGION_F_AUTO, &cxlr->flags))
745+ dev = device_find_child(&port->dev, &cxlr->params,
746+ match_auto_decoder);
747+ else
748+ dev = device_find_child(&port->dev, &id, match_free_decoder);
727749 if (!dev)
728750 return NULL;
729751 /*
@@ -1154,16 +1176,15 @@ static int cxl_port_setup_targets(struct cxl_port *port, · 424 unmodified lines
11541176 }
11551177
11561178 /*
1157− * If @parent_port is masking address bits, pick the next unused address
1158− * bit to route @port's targets.
1179+ * Interleave granularity is a multiple of @parent_port granularity.
1180+ * Multiplier is the parent port interleave ways.
11591181 */
1160− if (parent_iw > 1 && cxl_rr->nr_targets > 1) {
1161− u32 address_bit = max(peig + peiw, eiw + peig);
1162−
1163− eig = address_bit - eiw + 1;
1164− } else {
1165− eiw = peiw;
1166− eig = peig;
1182+ rc = granularity_to_eig(parent_ig * parent_iw, &eig);
1183+ if (rc) {
1184+ dev_dbg(&cxlr->dev,
1185+ "%s: invalid granularity calculation (%d * %d)\n",
1186+ dev_name(&parent_port->dev), parent_ig, parent_iw);
1187+ return rc;
11671188 }
11681189
11691190 rc = eig_to_granularity(eig, &ig);
drivers/cxl/pci.c+3−4
@@ -529,7 +529,6 @@ static int cxl_pci_setup_regs(struct pci_dev *pdev, enum cxl_regloc_type type, · 528 unmodified lines
529529
530530 static int cxl_pci_ras_unmask(struct pci_dev *pdev)
531531 {
532− struct pci_host_bridge *host_bridge = pci_find_host_bridge(pdev->bus);
533532 struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
534533 void __iomem *addr;
535534 u32 orig_val, val, mask;
@@ -541,9 +540,9 @@ static int cxl_pci_ras_unmask(struct pci_dev *pdev) · 5 unmodified lines
541540 return 0;
542541 }
543542
544− /* BIOS has CXL error control */
545− if (!host_bridge->native_cxl_error)
546− return -ENXIO;
543+ /* BIOS has PCIe AER error control */
544+ if (!pcie_aer_is_native(pdev))
545+ return 0;
547546
548547 rc = pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap);
549548 if (rc)
drivers/firewire/core-device.c+1−1
@@ -1211,7 +1211,7 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event) · 1210 unmodified lines
12111211 * without actually having a link.
12121212 */
12131213 create:
1214− device = kzalloc(sizeof(*device), GFP_KERNEL);
1214+ device = kzalloc(sizeof(*device), GFP_ATOMIC);
12151215 if (device == NULL)
12161216 break;
12171217
drivers/firewire/core-topology.c+1−1
@@ -101,7 +101,7 @@ static struct fw_node *fw_node_create(u32 sid, int port_count, int color) · 100 unmodified lines
101101 {
102102 struct fw_node *node;
103103
104− node = kzalloc(struct_size(node, ports, port_count), GFP_KERNEL);
104+ node = kzalloc(struct_size(node, ports, port_count), GFP_ATOMIC);
105105 if (node == NULL)
106106 return NULL;
107107
drivers/firewire/sbp2.c+6−3
@@ -81,7 +81,8 @@ MODULE_PARM_DESC(exclusive_login, "Exclusive login to sbp2 device " · 80 unmodified lines
8181 *
8282 * - power condition
8383 * Set the power condition field in the START STOP UNIT commands sent by
84− * sd_mod on suspend, resume, and shutdown (if manage_start_stop is on).
84+ * sd_mod on suspend, resume, and shutdown (if manage_system_start_stop or
85+ * manage_runtime_start_stop is on).
8586 * Some disks need this to spin down or to resume properly.
8687 *
8788 * - override internal blacklist
@@ -1517,8 +1518,10 @@ static int sbp2_scsi_slave_configure(struct scsi_device *sdev) · 1429 unmodified lines
15171518
15181519 sdev->use_10_for_rw = 1;
15191520
1520− if (sbp2_param_exclusive_login)
1521− sdev->manage_start_stop = 1;
1521+ if (sbp2_param_exclusive_login) {
1522+ sdev->manage_system_start_stop = true;
1523+ sdev->manage_runtime_start_stop = true;
1524+ }
15221525
15231526 if (sdev->type == TYPE_ROM)
15241527 sdev->use_10_for_ms = 1;
drivers/firmware/arm_ffa/driver.c+14−2
@@ -397,6 +397,19 @@ static u32 ffa_get_num_pages_sg(struct scatterlist *sg) · 396 unmodified lines
397397 return num_pages;
398398 }
399399
400+static u8 ffa_memory_attributes_get(u32 func_id)
401+{
402+ /*
403+ * For the memory lend or donate operation, if the receiver is a PE or
404+ * a proxy endpoint, the owner/sender must not specify the attributes
405+ */
406+ if (func_id == FFA_FN_NATIVE(MEM_LEND) ||
407+ func_id == FFA_MEM_LEND)
408+ return 0;
409+
410+ return FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | FFA_MEM_INNER_SHAREABLE;
411+}
412+
400413 static int
401414 ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
402415 struct ffa_mem_ops_args *args)
@@ -413,8 +426,7 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize, · 10 unmodified lines
413426 mem_region->tag = args->tag;
414427 mem_region->flags = args->flags;
415428 mem_region->sender_id = drv_info->vm_id;
416− mem_region->attributes = FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK |
417− FFA_MEM_INNER_SHAREABLE;
429+ mem_region->attributes = ffa_memory_attributes_get(func_id);
418430 ep_mem_access = &mem_region->ep_mem_access[0];
419431
420432 for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) {
drivers/firmware/arm_scmi/perf.c+2−2
@@ -1080,6 +1080,8 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) · 1079 unmodified lines
10801080 if (!pinfo)
10811081 return -ENOMEM;
10821082
1083+ pinfo->version = version;
1084+
10831085 ret = scmi_perf_attributes_get(ph, pinfo);
10841086 if (ret)
10851087 return ret;
@@ -1104,8 +1106,6 @@ static int scmi_perf_protocol_init(const struct scmi_protocol_handle *ph) · 18 unmodified lines
11041106 if (ret)
11051107 return ret;
11061108
1107− pinfo->version = version;
1108−
11091109 return ph->set_priv(ph, pinfo);
11101110 }
11111111
drivers/firmware/cirrus/cs_dsp.c+17−17
@@ -1863,15 +1863,15 @@ static int cs_dsp_adsp2_setup_algs(struct cs_dsp *dsp) · 1862 unmodified lines
18631863 return PTR_ERR(adsp2_alg);
18641864
18651865 for (i = 0; i < n_algs; i++) {
1866− cs_dsp_info(dsp,
1867− "%d: ID %x v%d.%d.%d XM@%x YM@%x ZM@%x\n",
1868− i, be32_to_cpu(adsp2_alg[i].alg.id),
1869− (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff0000) >> 16,
1870− (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff00) >> 8,
1871− be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff,
1872− be32_to_cpu(adsp2_alg[i].xm),
1873− be32_to_cpu(adsp2_alg[i].ym),
1874− be32_to_cpu(adsp2_alg[i].zm));
1866+ cs_dsp_dbg(dsp,
1867+ "%d: ID %x v%d.%d.%d XM@%x YM@%x ZM@%x\n",
1868+ i, be32_to_cpu(adsp2_alg[i].alg.id),
1869+ (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff0000) >> 16,
1870+ (be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff00) >> 8,
1871+ be32_to_cpu(adsp2_alg[i].alg.ver) & 0xff,
1872+ be32_to_cpu(adsp2_alg[i].xm),
1873+ be32_to_cpu(adsp2_alg[i].ym),
1874+ be32_to_cpu(adsp2_alg[i].zm));
18751875
18761876 alg_region = cs_dsp_create_region(dsp, WMFW_ADSP2_XM,
18771877 adsp2_alg[i].alg.id,
@@ -1996,14 +1996,14 @@ static int cs_dsp_halo_setup_algs(struct cs_dsp *dsp) · 118 unmodified lines
19961996 return PTR_ERR(halo_alg);
19971997
19981998 for (i = 0; i < n_algs; i++) {
1999− cs_dsp_info(dsp,
2000− "%d: ID %x v%d.%d.%d XM@%x YM@%x\n",
2001− i, be32_to_cpu(halo_alg[i].alg.id),
2002− (be32_to_cpu(halo_alg[i].alg.ver) & 0xff0000) >> 16,
2003− (be32_to_cpu(halo_alg[i].alg.ver) & 0xff00) >> 8,
2004− be32_to_cpu(halo_alg[i].alg.ver) & 0xff,
2005− be32_to_cpu(halo_alg[i].xm_base),
2006− be32_to_cpu(halo_alg[i].ym_base));
1999+ cs_dsp_dbg(dsp,
2000+ "%d: ID %x v%d.%d.%d XM@%x YM@%x\n",
2001+ i, be32_to_cpu(halo_alg[i].alg.id),
2002+ (be32_to_cpu(halo_alg[i].alg.ver) & 0xff0000) >> 16,
2003+ (be32_to_cpu(halo_alg[i].alg.ver) & 0xff00) >> 8,
2004+ be32_to_cpu(halo_alg[i].alg.ver) & 0xff,
2005+ be32_to_cpu(halo_alg[i].xm_base),
2006+ be32_to_cpu(halo_alg[i].ym_base));
20072007
20082008 ret = cs_dsp_halo_create_regions(dsp, halo_alg[i].alg.id,
20092009 halo_alg[i].alg.ver,
drivers/firmware/efi/efi.c+29−3
@@ -623,6 +623,34 @@ static __init int match_config_table(const efi_guid_t *guid, · 622 unmodified lines
623623 return 0;
624624 }
625625
626+/**
627+ * reserve_unaccepted - Map and reserve unaccepted configuration table
628+ * @unaccepted: Pointer to unaccepted memory table
629+ *
630+ * memblock_add() makes sure that the table is mapped in direct mapping. During
631+ * normal boot it happens automatically because the table is allocated from
632+ * usable memory. But during crashkernel boot only memory specifically reserved
633+ * for crash scenario is mapped. memblock_add() forces the table to be mapped
634+ * in crashkernel case.
635+ *
636+ * Align the range to the nearest page borders. Ranges smaller than page size
637+ * are not going to be mapped.
638+ *
639+ * memblock_reserve() makes sure that future allocations will not touch the
640+ * table.
641+ */
642+
643+static __init void reserve_unaccepted(struct efi_unaccepted_memory *unaccepted)
644+{
645+ phys_addr_t start, size;
646+
647+ start = PAGE_ALIGN_DOWN(efi.unaccepted);
648+ size = PAGE_ALIGN(sizeof(*unaccepted) + unaccepted->size);
649+
650+ memblock_add(start, size);
651+ memblock_reserve(start, size);
652+}
653+
626654 int __init efi_config_parse_tables(const efi_config_table_t *config_tables,
627655 int count,
628656 const efi_config_table_type_t *arch_tables)
@@ -751,11 +779,9 @@ int __init efi_config_parse_tables(const efi_config_table_t *config_tables, · 122 unmodified lines
751779
752780 unaccepted = early_memremap(efi.unaccepted, sizeof(*unaccepted));
753781 if (unaccepted) {
754− unsigned long size;
755782
756783 if (unaccepted->version == 1) {
757− size = sizeof(*unaccepted) + unaccepted->size;
758− memblock_reserve(efi.unaccepted, size);
784+ reserve_unaccepted(unaccepted);
759785 } else {
760786 efi.unaccepted = EFI_INVALID_TABLE_ADDR;
761787 }
drivers/firmware/efi/libstub/unaccepted_memory.c+1−1
@@ -62,7 +62,7 @@ efi_status_t allocate_unaccepted_bitmap(__u32 nr_desc, · 61 unmodified lines
6262 bitmap_size = DIV_ROUND_UP(unaccepted_end - unaccepted_start,
6363 EFI_UNACCEPTED_UNIT_SIZE * BITS_PER_BYTE);
6464
65− status = efi_bs_call(allocate_pool, EFI_LOADER_DATA,
65+ status = efi_bs_call(allocate_pool, EFI_ACPI_RECLAIM_MEMORY,
6666 sizeof(*unaccepted_table) + bitmap_size,
6767 (void **)&unaccepted_table);
6868 if (status != EFI_SUCCESS) {
drivers/firmware/imx/imx-dsp.c+1−0
@@ -114,6 +114,7 @@ static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc) · 113 unmodified lines
114114 dsp_chan->idx = i % 2;
115115 dsp_chan->ch = mbox_request_channel_byname(cl, chan_name);
116116 if (IS_ERR(dsp_chan->ch)) {
117+ kfree(dsp_chan->name);
117118 ret = PTR_ERR(dsp_chan->ch);
118119 if (ret != -EPROBE_DEFER)
119120 dev_err(dev, "Failed to request mbox chan %s ret %d\n",
drivers/gpio/gpio-pmic-eic-sprd.c+1−0
@@ -352,6 +352,7 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev) · 351 unmodified lines
352352 pmic_eic->chip.set_config = sprd_pmic_eic_set_config;
353353 pmic_eic->chip.set = sprd_pmic_eic_set;
354354 pmic_eic->chip.get = sprd_pmic_eic_get;
355+ pmic_eic->chip.can_sleep = true;
355356
356357 irq = &pmic_eic->chip.irq;
357358 gpio_irq_chip_set_chip(irq, &pmic_eic_irq_chip);
drivers/gpio/gpio-sim.c+23−37
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/irq.h>
2020 #include <linux/irq_sim.h>
2121 #include <linux/list.h>
22+#include <linux/minmax.h>
2223 #include <linux/mod_devicetable.h>
2324 #include <linux/module.h>
2425 #include <linux/mutex.h>
@@ -685,52 +686,32 @@ gpio_sim_device_config_live_show(struct config_item *item, char *page) · 660 unmodified lines
685686 return sprintf(page, "%c\n", live ? '1' : '0');
686687 }
687688
688−static char **gpio_sim_make_line_names(struct gpio_sim_bank *bank,
689− unsigned int *line_names_size)
689+static unsigned int gpio_sim_get_line_names_size(struct gpio_sim_bank *bank)
690690 {
691− unsigned int max_offset = 0;
692− bool has_line_names = false;
693691 struct gpio_sim_line *line;
694− char **line_names;
692+ unsigned int size = 0;
695693
696694 list_for_each_entry(line, &bank->line_list, siblings) {
697− if (line->offset >= bank->num_lines)
695+ if (!line->name || (line->offset >= bank->num_lines))
698696 continue;
699697
700− if (line->name) {
701− if (line->offset > max_offset)
702− max_offset = line->offset;
703−
704− /*
705− * max_offset can stay at 0 so it's not an indicator
706− * of whether line names were configured at all.
707− */
708− has_line_names = true;
709− }
698+ size = max(size, line->offset + 1);
710699 }
711700
712− if (!has_line_names)
713− /*
714− * This is not an error - NULL means, there are no line
715− * names configured.
716− */
717− return NULL;
718−
719− *line_names_size = max_offset + 1;
701+ return size;
702+}
720703
721− line_names = kcalloc(*line_names_size, sizeof(*line_names), GFP_KERNEL);
722− if (!line_names)
723− return ERR_PTR(-ENOMEM);
704+static void
705+gpio_sim_set_line_names(struct gpio_sim_bank *bank, char **line_names)
706+{
707+ struct gpio_sim_line *line;
724708
725709 list_for_each_entry(line, &bank->line_list, siblings) {
726− if (line->offset >= bank->num_lines)
710+ if (!line->name || (line->offset >= bank->num_lines))
727711 continue;
728712
729− if (line->name && (line->offset <= max_offset))
730− line_names[line->offset] = line->name;
713+ line_names[line->offset] = line->name;
731714 }
732−
733− return line_names;
734715 }
735716
736717 static void gpio_sim_remove_hogs(struct gpio_sim_device *dev)
@@ -834,7 +815,7 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 97 unmodified lines
834815 struct fwnode_handle *parent)
835816 {
836817 struct property_entry properties[GPIO_SIM_PROP_MAX];
837− unsigned int prop_idx = 0, line_names_size = 0;
818+ unsigned int prop_idx = 0, line_names_size;
838819 char **line_names __free(kfree) = NULL;
839820
840821 memset(properties, 0, sizeof(properties));
@@ -845,14 +826,19 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, · 4 unmodified lines
845826 properties[prop_idx++] = PROPERTY_ENTRY_STRING("gpio-sim,label",
846827 bank->label);
847828
848− line_names = gpio_sim_make_line_names(bank, &line_names_size);
849− if (IS_ERR(line_names))
850− return ERR_CAST(line_names);
829+ line_names_size = gpio_sim_get_line_names_size(bank);
830+ if (line_names_size) {
831+ line_names = kcalloc(line_names_size, sizeof(*line_names),
832+ GFP_KERNEL);
833+ if (!line_names)
834+ return ERR_PTR(-ENOMEM);
835+
836+ gpio_sim_set_line_names(bank, line_names);
851837
852− if (line_names)
853838 properties[prop_idx++] = PROPERTY_ENTRY_STRING_ARRAY_LEN(
854839 "gpio-line-names",
855840 line_names, line_names_size);
841+ }
856842
857843 return fwnode_create_software_node(properties, parent);
858844 }
drivers/gpio/gpio-tb10x.c+5−1
@@ -195,7 +195,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev) · 194 unmodified lines
195195 handle_edge_irq, IRQ_NOREQUEST, IRQ_NOPROBE,
196196 IRQ_GC_INIT_MASK_CACHE);
197197 if (ret)
198− return ret;
198+ goto err_remove_domain;
199199
200200 gc = tb10x_gpio->domain->gc->gc[0];
201201 gc->reg_base = tb10x_gpio->base;
@@ -209,6 +209,10 @@ static int tb10x_gpio_probe(struct platform_device *pdev) · 7 unmodified lines
209209 }
210210
211211 return 0;
212+
213+err_remove_domain:
214+ irq_domain_remove(tb10x_gpio->domain);
215+ return ret;
212216 }
213217
214218 static int tb10x_gpio_remove(struct platform_device *pdev)
drivers/gpio/gpio-timberdale.c+3−2
@@ -43,9 +43,10 @@ static int timbgpio_update_bit(struct gpio_chip *gpio, unsigned index, · 42 unmodified lines
4343 unsigned offset, bool enabled)
4444 {
4545 struct timbgpio *tgpio = gpiochip_get_data(gpio);
46+ unsigned long flags;
4647 u32 reg;
4748
48− spin_lock(&tgpio->lock);
49+ spin_lock_irqsave(&tgpio->lock, flags);
4950 reg = ioread32(tgpio->membase + offset);
5051
5152 if (enabled)
@@ -54,7 +55,7 @@ static int timbgpio_update_bit(struct gpio_chip *gpio, unsigned index, · 2 unmodified lines
5455 reg &= ~(1 << index);
5556
5657 iowrite32(reg, tgpio->membase + offset);
57− spin_unlock(&tgpio->lock);
58+ spin_unlock_irqrestore(&tgpio->lock, flags);
5859
5960 return 0;
6061 }
drivers/gpu/drm/Kconfig+1−1
@@ -136,7 +136,7 @@ config DRM_FBDEV_EMULATION · 135 unmodified lines
136136 bool "Enable legacy fbdev support for your modesetting driver"
137137 depends on DRM
138138 select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
139− default y
139+ default FB
140140 help
141141 Choose this option if you have a need for the legacy fbdev
142142 support. Note that this support also provides the linux console
drivers/gpu/drm/amd/amdgpu/amdgpu.h+0−1
@@ -1293,7 +1293,6 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · 1292 unmodified lines
12931293 void amdgpu_device_pci_config_reset(struct amdgpu_device *adev);
12941294 int amdgpu_device_pci_reset(struct amdgpu_device *adev);
12951295 bool amdgpu_device_need_post(struct amdgpu_device *adev);
1296−bool amdgpu_sg_display_supported(struct amdgpu_device *adev);
12971296 bool amdgpu_device_pcie_dynamic_switching_supported(void);
12981297 bool amdgpu_device_should_use_aspm(struct amdgpu_device *adev);
12991298 bool amdgpu_device_aspm_support_quirk(void);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c+1−1
@@ -478,7 +478,7 @@ void amdgpu_amdkfd_get_cu_info(struct amdgpu_device *adev, struct kfd_cu_info *c · 477 unmodified lines
478478 cu_info->cu_active_number = acu_info.number;
479479 cu_info->cu_ao_mask = acu_info.ao_cu_mask;
480480 memcpy(&cu_info->cu_bitmap[0], &acu_info.bitmap[0],
481− sizeof(acu_info.bitmap));
481+ sizeof(cu_info->cu_bitmap));
482482 cu_info->num_shader_engines = adev->gfx.config.max_shader_engines;
483483 cu_info->num_shader_arrays_per_engine = adev->gfx.config.max_sh_per_se;
484484 cu_info->num_cu_per_sh = adev->gfx.config.max_cu_per_sh;
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.c+1−2
@@ -980,8 +980,7 @@ void kgd_gfx_v10_build_grace_period_packet_info(struct amdgpu_device *adev, · 979 unmodified lines
980980 uint32_t wait_times,
981981 uint32_t grace_period,
982982 uint32_t *reg_offset,
983− uint32_t *reg_data,
984− uint32_t inst)
983+ uint32_t *reg_data)
985984 {
986985 *reg_data = wait_times;
987986
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v10.h+1−2
@@ -55,5 +55,4 @@ void kgd_gfx_v10_build_grace_period_packet_info(struct amdgpu_device *adev, · 54 unmodified lines
5555 uint32_t wait_times,
5656 uint32_t grace_period,
5757 uint32_t *reg_offset,
58− uint32_t *reg_data,
59− uint32_t inst);
58+ uint32_t *reg_data);
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c+2−4
@@ -1103,8 +1103,7 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev, · 1102 unmodified lines
11031103 uint32_t wait_times,
11041104 uint32_t grace_period,
11051105 uint32_t *reg_offset,
1106− uint32_t *reg_data,
1107− uint32_t inst)
1106+ uint32_t *reg_data)
11081107 {
11091108 *reg_data = wait_times;
11101109
@@ -1120,8 +1119,7 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev, · 9 unmodified lines
11201119 SCH_WAVE,
11211120 grace_period);
11221121
1123− *reg_offset = SOC15_REG_OFFSET(GC, GET_INST(GC, inst),
1124− mmCP_IQ_WAIT_TIME2);
1122+ *reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_IQ_WAIT_TIME2);
11251123 }
11261124
11271125 void kgd_gfx_v9_program_trap_handler_settings(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.h+1−2
@@ -100,5 +100,4 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev, · 99 unmodified lines
100100 uint32_t wait_times,
101101 uint32_t grace_period,
102102 uint32_t *reg_offset,
103− uint32_t *reg_data,
104− uint32_t inst);
103+ uint32_t *reg_data);
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c+1−1
@@ -1776,7 +1776,7 @@ static ssize_t amdgpu_atombios_get_vbios_version(struct device *dev, · 1775 unmodified lines
17761776 struct amdgpu_device *adev = drm_to_adev(ddev);
17771777 struct atom_context *ctx = adev->mode_info.atom_context;
17781778
1779− return sysfs_emit(buf, "%s\n", ctx->vbios_ver_str);
1779+ return sysfs_emit(buf, "%s\n", ctx->vbios_pn);
17801780 }
17811781
17821782 static DEVICE_ATTR(vbios_version, 0444, amdgpu_atombios_get_vbios_version,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c+0−26
@@ -1244,32 +1244,6 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) · 1243 unmodified lines
12441244 return true;
12451245 }
12461246
1247−/*
1248− * On APUs with >= 64GB white flickering has been observed w/ SG enabled.
1249− * Disable S/G on such systems until we have a proper fix.
1250− * https://gitlab.freedesktop.org/drm/amd/-/issues/2354
1251− * https://gitlab.freedesktop.org/drm/amd/-/issues/2735
1252− */
1253−bool amdgpu_sg_display_supported(struct amdgpu_device *adev)
1254−{
1255− switch (amdgpu_sg_display) {
1256− case -1:
1257− break;
1258− case 0:
1259− return false;
1260− case 1:
1261− return true;
1262− default:
1263− return false;
1264− }
1265− if ((totalram_pages() << (PAGE_SHIFT - 10)) +
1266− (adev->gmc.real_vram_size / 1024) >= 64000000) {
1267− DRM_WARN("Disabling S/G due to >=64GB RAM\n");
1268− return false;
1269− }
1270− return true;
1271−}
1272−
12731247 /*
12741248 * Intel hosts such as Raptor Lake and Sapphire Rapids don't support dynamic
12751249 * speed switching. Until we have confirmation from Intel that a specific host
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h+2−1
@@ -43,6 +43,7 @@ · 42 unmodified lines
4343 #define AMDGPU_GFX_LBPW_DISABLED_MODE 0x00000008L
4444
4545 #define AMDGPU_MAX_GC_INSTANCES 8
46+#define KGD_MAX_QUEUES 128
4647
4748 #define AMDGPU_MAX_GFX_QUEUES KGD_MAX_QUEUES
4849 #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
@@ -257,7 +258,7 @@ struct amdgpu_cu_info { · 208 unmodified lines
257258 uint32_t number;
258259 uint32_t ao_cu_mask;
259260 uint32_t ao_cu_bitmap[4][4];
260− uint32_t bitmap[4][4];
261+ uint32_t bitmap[AMDGPU_MAX_GC_INSTANCES][4][4];
261262 };
262263
263264 struct amdgpu_gfx_ras {
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c+12−7
@@ -839,7 +839,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 838 unmodified lines
839839 memcpy(&dev_info->cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
840840 sizeof(adev->gfx.cu_info.ao_cu_bitmap));
841841 memcpy(&dev_info->cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
842− sizeof(adev->gfx.cu_info.bitmap));
842+ sizeof(dev_info->cu_bitmap));
843843 dev_info->vram_type = adev->gmc.vram_type;
844844 dev_info->vram_bit_width = adev->gmc.vram_width;
845845 dev_info->vce_harvest_config = adev->vce.harvest_config;
@@ -940,12 +940,17 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · 94 unmodified lines
940940 struct atom_context *atom_context;
941941
942942 atom_context = adev->mode_info.atom_context;
943− memcpy(vbios_info.name, atom_context->name, sizeof(atom_context->name));
944− memcpy(vbios_info.vbios_pn, atom_context->vbios_pn, sizeof(atom_context->vbios_pn));
945− vbios_info.version = atom_context->version;
946− memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
947− sizeof(atom_context->vbios_ver_str));
948− memcpy(vbios_info.date, atom_context->date, sizeof(atom_context->date));
943+ if (atom_context) {
944+ memcpy(vbios_info.name, atom_context->name,
945+ sizeof(atom_context->name));
946+ memcpy(vbios_info.vbios_pn, atom_context->vbios_pn,
947+ sizeof(atom_context->vbios_pn));
948+ vbios_info.version = atom_context->version;
949+ memcpy(vbios_info.vbios_ver_str, atom_context->vbios_ver_str,
950+ sizeof(atom_context->vbios_ver_str));
951+ memcpy(vbios_info.date, atom_context->date,
952+ sizeof(atom_context->date));
953+ }
949954
950955 return copy_to_user(out, &vbios_info,
951956 min((size_t)size, sizeof(vbios_info))) ? -EFAULT : 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c+5−2
@@ -801,6 +801,7 @@ int amdgpu_ras_feature_enable(struct amdgpu_device *adev, · 800 unmodified lines
801801 enable ? "enable":"disable",
802802 get_ras_block_str(head),
803803 amdgpu_ras_is_poison_mode_supported(adev), ret);
804+ kfree(info);
804805 return ret;
805806 }
806807
@@ -1052,7 +1053,8 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev, · 245 unmodified lines
10521053 info->ce_count = obj->err_data.ce_count;
10531054
10541055 if (err_data.ce_count) {
1055− if (adev->smuio.funcs &&
1056+ if (!adev->aid_mask &&
1057+ adev->smuio.funcs &&
10561058 adev->smuio.funcs->get_socket_id &&
10571059 adev->smuio.funcs->get_die_id) {
10581060 dev_info(adev->dev, "socket: %d, die: %d "
@@ -1072,7 +1074,8 @@ int amdgpu_ras_query_error_status(struct amdgpu_device *adev, · 13 unmodified lines
10721074 }
10731075 }
10741076 if (err_data.ue_count) {
1075− if (adev->smuio.funcs &&
1077+ if (!adev->aid_mask &&
1078+ adev->smuio.funcs &&
10761079 adev->smuio.funcs->get_socket_id &&
10771080 adev->smuio.funcs->get_die_id) {
10781081 dev_info(adev->dev, "socket: %d, die: %d "
drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c+1−1
@@ -81,7 +81,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, · 80 unmodified lines
8181 unsigned int size)
8282 {
8383 struct drm_suballoc *sa = drm_suballoc_new(&sa_manager->base, size,
84− GFP_KERNEL, true, 0);
84+ GFP_KERNEL, false, 0);
8585
8686 if (IS_ERR(sa)) {
8787 *sa_bo = NULL;
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c+1−1
@@ -9449,7 +9449,7 @@ static int gfx_v10_0_get_cu_info(struct amdgpu_device *adev, · 9448 unmodified lines
94499449 gfx_v10_0_set_user_wgp_inactive_bitmap_per_sh(
94509450 adev, disable_masks[i * 2 + j]);
94519451 bitmap = gfx_v10_0_get_cu_active_bitmap_per_sh(adev);
9452− cu_info->bitmap[i][j] = bitmap;
9452+ cu_info->bitmap[0][i][j] = bitmap;
94539453
94549454 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
94559455 if (bitmap & mask) {
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c+1−1
@@ -6368,7 +6368,7 @@ static int gfx_v11_0_get_cu_info(struct amdgpu_device *adev, · 6367 unmodified lines
63686368 * SE6: {SH0,SH1} --> {bitmap[2][2], bitmap[2][3]}
63696369 * SE7: {SH0,SH1} --> {bitmap[3][2], bitmap[3][3]}
63706370 */
6371− cu_info->bitmap[i % 4][j + (i / 4) * 2] = bitmap;
6371+ cu_info->bitmap[0][i % 4][j + (i / 4) * 2] = bitmap;
63726372
63736373 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
63746374 if (bitmap & mask)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c+1−1
@@ -3577,7 +3577,7 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev) · 3576 unmodified lines
35773577 gfx_v6_0_set_user_cu_inactive_bitmap(
35783578 adev, disable_masks[i * 2 + j]);
35793579 bitmap = gfx_v6_0_get_cu_enabled(adev);
3580− cu_info->bitmap[i][j] = bitmap;
3580+ cu_info->bitmap[0][i][j] = bitmap;
35813581
35823582 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
35833583 if (bitmap & mask) {
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c+1−1
@@ -5119,7 +5119,7 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev) · 5118 unmodified lines
51195119 gfx_v7_0_set_user_cu_inactive_bitmap(
51205120 adev, disable_masks[i * 2 + j]);
51215121 bitmap = gfx_v7_0_get_cu_active_bitmap(adev);
5122− cu_info->bitmap[i][j] = bitmap;
5122+ cu_info->bitmap[0][i][j] = bitmap;
51235123
51245124 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
51255125 if (bitmap & mask) {
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c+1−1
@@ -7121,7 +7121,7 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev) · 7120 unmodified lines
71217121 gfx_v8_0_set_user_cu_inactive_bitmap(
71227122 adev, disable_masks[i * 2 + j]);
71237123 bitmap = gfx_v8_0_get_cu_active_bitmap(adev);
7124− cu_info->bitmap[i][j] = bitmap;
7124+ cu_info->bitmap[0][i][j] = bitmap;
71257125
71267126 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
71277127 if (bitmap & mask) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c+2−2
@@ -1499,7 +1499,7 @@ static void gfx_v9_0_init_always_on_cu_mask(struct amdgpu_device *adev) · 1498 unmodified lines
14991499 amdgpu_gfx_select_se_sh(adev, i, j, 0xffffffff, 0);
15001500
15011501 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
1502− if (cu_info->bitmap[i][j] & mask) {
1502+ if (cu_info->bitmap[0][i][j] & mask) {
15031503 if (counter == pg_always_on_cu_num)
15041504 WREG32_SOC15(GC, 0, mmRLC_PG_ALWAYS_ON_CU_MASK, cu_bitmap);
15051505 if (counter < always_on_cu_num)
@@ -7233,7 +7233,7 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev, · 5727 unmodified lines
72337233 * SE6,SH0 --> bitmap[2][1]
72347234 * SE7,SH0 --> bitmap[3][1]
72357235 */
7236− cu_info->bitmap[i % 4][j + i / 4] = bitmap;
7236+ cu_info->bitmap[0][i % 4][j + i / 4] = bitmap;
72377237
72387238 for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
72397239 if (bitmap & mask) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c+34−42
@@ -4259,7 +4259,7 @@ static void gfx_v9_4_3_set_gds_init(struct amdgpu_device *adev) · 4258 unmodified lines
42594259 }
42604260
42614261 static void gfx_v9_4_3_set_user_cu_inactive_bitmap(struct amdgpu_device *adev,
4262− u32 bitmap)
4262+ u32 bitmap, int xcc_id)
42634263 {
42644264 u32 data;
42654265
@@ -4269,15 +4269,15 @@ static void gfx_v9_4_3_set_user_cu_inactive_bitmap(struct amdgpu_device *adev, · 3 unmodified lines
42694269 data = bitmap << GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_CUS__SHIFT;
42704270 data &= GC_USER_SHADER_ARRAY_CONFIG__INACTIVE_CUS_MASK;
42714271
4272− WREG32_SOC15(GC, GET_INST(GC, 0), regGC_USER_SHADER_ARRAY_CONFIG, data);
4272+ WREG32_SOC15(GC, GET_INST(GC, xcc_id), regGC_USER_SHADER_ARRAY_CONFIG, data);
42734273 }
42744274
4275−static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev)
4275+static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev, int xcc_id)
42764276 {
42774277 u32 data, mask;
42784278
4279− data = RREG32_SOC15(GC, GET_INST(GC, 0), regCC_GC_SHADER_ARRAY_CONFIG);
4280− data |= RREG32_SOC15(GC, GET_INST(GC, 0), regGC_USER_SHADER_ARRAY_CONFIG);
4279+ data = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regCC_GC_SHADER_ARRAY_CONFIG);
4280+ data |= RREG32_SOC15(GC, GET_INST(GC, xcc_id), regGC_USER_SHADER_ARRAY_CONFIG);
42814281
42824282 data &= CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_CUS_MASK;
42834283 data >>= CC_GC_SHADER_ARRAY_CONFIG__INACTIVE_CUS__SHIFT;
@@ -4290,7 +4290,7 @@ static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev) · 6 unmodified lines
42904290 static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
42914291 struct amdgpu_cu_info *cu_info)
42924292 {
4293− int i, j, k, counter, active_cu_number = 0;
4293+ int i, j, k, counter, xcc_id, active_cu_number = 0;
42944294 u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
42954295 unsigned disable_masks[4 * 4];
42964296
@@ -4309,46 +4309,38 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev, · 12 unmodified lines
43094309 adev->gfx.config.max_sh_per_se);
43104310
43114311 mutex_lock(&adev->grbm_idx_mutex);
4312− for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
4313− for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
4314− mask = 1;
4315− ao_bitmap = 0;
4316− counter = 0;
4317− gfx_v9_4_3_xcc_select_se_sh(adev, i, j, 0xffffffff, 0);
4318− gfx_v9_4_3_set_user_cu_inactive_bitmap(
4319− adev, disable_masks[i * adev->gfx.config.max_sh_per_se + j]);
4320− bitmap = gfx_v9_4_3_get_cu_active_bitmap(adev);
4321−
4322− /*
4323− * The bitmap(and ao_cu_bitmap) in cu_info structure is
4324− * 4x4 size array, and it's usually suitable for Vega
4325− * ASICs which has 4*2 SE/SH layout.
4326− * But for Arcturus, SE/SH layout is changed to 8*1.
4327− * To mostly reduce the impact, we make it compatible
4328− * with current bitmap array as below:
4329− * SE4,SH0 --> bitmap[0][1]
4330− * SE5,SH0 --> bitmap[1][1]
4331− * SE6,SH0 --> bitmap[2][1]
4332− * SE7,SH0 --> bitmap[3][1]
4333− */
4334− cu_info->bitmap[i % 4][j + i / 4] = bitmap;
4335−
4336− for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
4337− if (bitmap & mask) {
4338− if (counter < adev->gfx.config.max_cu_per_sh)
4339− ao_bitmap |= mask;
4340− counter++;
4312+ for (xcc_id = 0; xcc_id < NUM_XCC(adev->gfx.xcc_mask); xcc_id++) {
4313+ for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
4314+ for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
4315+ mask = 1;
4316+ ao_bitmap = 0;
4317+ counter = 0;
4318+ gfx_v9_4_3_xcc_select_se_sh(adev, i, j, 0xffffffff, xcc_id);
4319+ gfx_v9_4_3_set_user_cu_inactive_bitmap(
4320+ adev,
4321+ disable_masks[i * adev->gfx.config.max_sh_per_se + j],
4322+ xcc_id);
4323+ bitmap = gfx_v9_4_3_get_cu_active_bitmap(adev, xcc_id);
4324+
4325+ cu_info->bitmap[xcc_id][i][j] = bitmap;
4326+
4327+ for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
4328+ if (bitmap & mask) {
4329+ if (counter < adev->gfx.config.max_cu_per_sh)
4330+ ao_bitmap |= mask;
4331+ counter++;
4332+ }
4333+ mask <<= 1;
43414334 }
4342− mask <<= 1;
4335+ active_cu_number += counter;
4336+ if (i < 2 && j < 2)
4337+ ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
4338+ cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
43434339 }
4344− active_cu_number += counter;
4345− if (i < 2 && j < 2)
4346− ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
4347− cu_info->ao_cu_bitmap[i % 4][j + i / 4] = ao_bitmap;
43484340 }
4341+ gfx_v9_4_3_xcc_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff,
4342+ xcc_id);
43494343 }
4350− gfx_v9_4_3_xcc_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff,
4351− 0);
43524344 mutex_unlock(&adev->grbm_idx_mutex);
43534345
43544346 cu_info->number = active_cu_number;
drivers/gpu/drm/amd/amdgpu/nbio_v4_3.c+3−0
@@ -345,6 +345,9 @@ static void nbio_v4_3_init_registers(struct amdgpu_device *adev) · 344 unmodified lines
345345 data &= ~RCC_DEV0_EPF2_STRAP2__STRAP_NO_SOFT_RESET_DEV0_F2_MASK;
346346 WREG32_SOC15(NBIO, 0, regRCC_DEV0_EPF2_STRAP2, data);
347347 }
348+ if (amdgpu_sriov_vf(adev))
349+ adev->rmmio_remap.reg_offset = SOC15_REG_OFFSET(NBIO, 0,
350+ regBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
348351 }
349352
350353 static u32 nbio_v4_3_get_rom_offset(struct amdgpu_device *adev)
drivers/gpu/drm/amd/amdgpu/soc21.c+1−1
@@ -766,7 +766,7 @@ static int soc21_common_hw_init(void *handle) · 765 unmodified lines
766766 * for the purpose of expose those registers
767767 * to process space
768768 */
769− if (adev->nbio.funcs->remap_hdp_registers)
769+ if (adev->nbio.funcs->remap_hdp_registers && !amdgpu_sriov_vf(adev))
770770 adev->nbio.funcs->remap_hdp_registers(adev);
771771 /* enable the doorbell aperture */
772772 adev->nbio.funcs->enable_doorbell_aperture(adev, true);
drivers/gpu/drm/amd/amdkfd/kfd_crat.c+2−1
@@ -2087,7 +2087,8 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image, · 2086 unmodified lines
20872087
20882088 amdgpu_amdkfd_get_cu_info(kdev->adev, &cu_info);
20892089 cu->num_simd_per_cu = cu_info.simd_per_cu;
2090− cu->num_simd_cores = cu_info.simd_per_cu * cu_info.cu_active_number;
2090+ cu->num_simd_cores = cu_info.simd_per_cu *
2091+ (cu_info.cu_active_number / kdev->kfd->num_nodes);
20912092 cu->max_waves_simd = cu_info.max_waves_per_simd;
20922093
20932094 cu->wave_front_size = cu_info.wave_front_size;
drivers/gpu/drm/amd/amdkfd/kfd_crat.h+4−0
@@ -79,6 +79,10 @@ struct crat_header { · 78 unmodified lines
7979 #define CRAT_SUBTYPE_IOLINK_AFFINITY 5
8080 #define CRAT_SUBTYPE_MAX 6
8181
82+/*
83+ * Do not change the value of CRAT_SIBLINGMAP_SIZE from 32
84+ * as it breaks the ABI.
85+ */
8286 #define CRAT_SIBLINGMAP_SIZE 32
8387
8488 /*
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c+2−3
@@ -216,7 +216,7 @@ static int add_queue_mes(struct device_queue_manager *dqm, struct queue *q, · 215 unmodified lines
216216
217217 if (q->wptr_bo) {
218218 wptr_addr_off = (uint64_t)q->properties.write_ptr & (PAGE_SIZE - 1);
219− queue_input.wptr_mc_addr = ((uint64_t)q->wptr_bo->tbo.resource->start << PAGE_SHIFT) + wptr_addr_off;
219+ queue_input.wptr_mc_addr = amdgpu_bo_gpu_offset(q->wptr_bo) + wptr_addr_off;
220220 }
221221
222222 queue_input.is_kfd_process = 1;
@@ -1677,8 +1677,7 @@ static int start_cpsch(struct device_queue_manager *dqm) · 1454 unmodified lines
16771677 dqm->dev->kfd2kgd->build_grace_period_packet_info(
16781678 dqm->dev->adev, dqm->wait_times,
16791679 grace_period, &reg_offset,
1680− &dqm->wait_times,
1681− ffs(dqm->dev->xcc_mask) - 1);
1680+ &dqm->wait_times);
16821681 }
16831682
16841683 dqm_unlock(dqm);
drivers/gpu/drm/amd/amdkfd/kfd_doorbell.c+2−0
@@ -162,6 +162,7 @@ void __iomem *kfd_get_kernel_doorbell(struct kfd_dev *kfd, · 161 unmodified lines
162162 return NULL;
163163
164164 *doorbell_off = amdgpu_doorbell_index_on_bar(kfd->adev, kfd->doorbells, inx);
165+ inx *= 2;
165166
166167 pr_debug("Get kernel queue doorbell\n"
167168 " doorbell offset == 0x%08X\n"
@@ -176,6 +177,7 @@ void kfd_release_kernel_doorbell(struct kfd_dev *kfd, u32 __iomem *db_addr) · 8 unmodified lines
176177 unsigned int inx;
177178
178179 inx = (unsigned int)(db_addr - kfd->doorbell_kernel_ptr);
180+ inx /= 2;
179181
180182 mutex_lock(&kfd->doorbell_mutex);
181183 __clear_bit(inx, kfd->doorbell_bitmap);
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.c+26−8
@@ -97,18 +97,22 @@ void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd, · 96 unmodified lines
9797
9898 void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
9999 const uint32_t *cu_mask, uint32_t cu_mask_count,
100− uint32_t *se_mask)
100+ uint32_t *se_mask, uint32_t inst)
101101 {
102102 struct kfd_cu_info cu_info;
103103 uint32_t cu_per_sh[KFD_MAX_NUM_SE][KFD_MAX_NUM_SH_PER_SE] = {0};
104104 bool wgp_mode_req = KFD_GC_VERSION(mm->dev) >= IP_VERSION(10, 0, 0);
105105 uint32_t en_mask = wgp_mode_req ? 0x3 : 0x1;
106− int i, se, sh, cu, cu_bitmap_sh_mul, inc = wgp_mode_req ? 2 : 1;
106+ int i, se, sh, cu, cu_bitmap_sh_mul, cu_inc = wgp_mode_req ? 2 : 1;
107+ uint32_t cu_active_per_node;
108+ int inc = cu_inc * NUM_XCC(mm->dev->xcc_mask);
109+ int xcc_inst = inst + ffs(mm->dev->xcc_mask) - 1;
107110
108111 amdgpu_amdkfd_get_cu_info(mm->dev->adev, &cu_info);
109112
110− if (cu_mask_count > cu_info.cu_active_number)
111− cu_mask_count = cu_info.cu_active_number;
113+ cu_active_per_node = cu_info.cu_active_number / mm->dev->kfd->num_nodes;
114+ if (cu_mask_count > cu_active_per_node)
115+ cu_mask_count = cu_active_per_node;
112116
113117 /* Exceeding these bounds corrupts the stack and indicates a coding error.
114118 * Returning with no CU's enabled will hang the queue, which should be
@@ -141,7 +145,8 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, · 26 unmodified lines
141145 for (se = 0; se < cu_info.num_shader_engines; se++)
142146 for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++)
143147 cu_per_sh[se][sh] = hweight32(
144− cu_info.cu_bitmap[se % 4][sh + (se / 4) * cu_bitmap_sh_mul]);
148+ cu_info.cu_bitmap[xcc_inst][se % 4][sh + (se / 4) *
149+ cu_bitmap_sh_mul]);
145150
146151 /* Symmetrically map cu_mask to all SEs & SHs:
147152 * se_mask programs up to 2 SH in the upper and lower 16 bits.
@@ -164,20 +169,33 @@ void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm, · 16 unmodified lines
164169 * cu_mask[0] bit8 -> se_mask[0] bit1 (SE0,SH0,CU1)
165170 * ...
166171 *
172+ * For GFX 9.4.3, the following code only looks at a
173+ * subset of the cu_mask corresponding to the inst parameter.
174+ * If we have n XCCs under one GPU node
175+ * cu_mask[0] bit0 -> XCC0 se_mask[0] bit0 (XCC0,SE0,SH0,CU0)
176+ * cu_mask[0] bit1 -> XCC1 se_mask[0] bit0 (XCC1,SE0,SH0,CU0)
177+ * ..
178+ * cu_mask[0] bitn -> XCCn se_mask[0] bit0 (XCCn,SE0,SH0,CU0)
179+ * cu_mask[0] bit n+1 -> XCC0 se_mask[1] bit0 (XCC0,SE1,SH0,CU0)
180+ *
181+ * For example, if there are 6 XCCs under 1 KFD node, this code
182+ * running for each inst, will look at the bits as:
183+ * inst, inst + 6, inst + 12...
184+ *
167185 * First ensure all CUs are disabled, then enable user specified CUs.
168186 */
169187 for (i = 0; i < cu_info.num_shader_engines; i++)
170188 se_mask[i] = 0;
171189
172− i = 0;
173− for (cu = 0; cu < 16; cu += inc) {
190+ i = inst;
191+ for (cu = 0; cu < 16; cu += cu_inc) {
174192 for (sh = 0; sh < cu_info.num_shader_arrays_per_engine; sh++) {
175193 for (se = 0; se < cu_info.num_shader_engines; se++) {
176194 if (cu_per_sh[se][sh] > cu) {
177195 if (cu_mask[i / 32] & (en_mask << (i % 32)))
178196 se_mask[se] |= en_mask << (cu + sh * 16);
179197 i += inc;
180− if (i == cu_mask_count)
198+ if (i >= cu_mask_count)
181199 return;
182200 }
183201 }
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager.h+1−1
@@ -138,7 +138,7 @@ void free_mqd_hiq_sdma(struct mqd_manager *mm, void *mqd, · 137 unmodified lines
138138
139139 void mqd_symmetrically_map_cu_mask(struct mqd_manager *mm,
140140 const uint32_t *cu_mask, uint32_t cu_mask_count,
141− uint32_t *se_mask);
141+ uint32_t *se_mask, uint32_t inst);
142142
143143 int kfd_hiq_load_mqd_kiq(struct mqd_manager *mm, void *mqd,
144144 uint32_t pipe_id, uint32_t queue_id,
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c+1−1
@@ -52,7 +52,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd, · 51 unmodified lines
5252 return;
5353
5454 mqd_symmetrically_map_cu_mask(mm,
55− minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
55+ minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
5656
5757 m = get_mqd(mqd);
5858 m->compute_static_thread_mgmt_se0 = se_mask[0];
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c+1−1
@@ -52,7 +52,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd, · 51 unmodified lines
5252 return;
5353
5454 mqd_symmetrically_map_cu_mask(mm,
55− minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
55+ minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
5656
5757 m = get_mqd(mqd);
5858 m->compute_static_thread_mgmt_se0 = se_mask[0];
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c+42−1
@@ -71,7 +71,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd, · 70 unmodified lines
7171 }
7272
7373 mqd_symmetrically_map_cu_mask(mm,
74− minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
74+ minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
7575
7676 m->compute_static_thread_mgmt_se0 = se_mask[0];
7777 m->compute_static_thread_mgmt_se1 = se_mask[1];
@@ -321,6 +321,43 @@ static int get_wave_state(struct mqd_manager *mm, void *mqd, · 243 unmodified lines
321321 return 0;
322322 }
323323
324+static void checkpoint_mqd(struct mqd_manager *mm, void *mqd, void *mqd_dst, void *ctl_stack_dst)
325+{
326+ struct v11_compute_mqd *m;
327+
328+ m = get_mqd(mqd);
329+
330+ memcpy(mqd_dst, m, sizeof(struct v11_compute_mqd));
331+}
332+
333+static void restore_mqd(struct mqd_manager *mm, void **mqd,
334+ struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
335+ struct queue_properties *qp,
336+ const void *mqd_src,
337+ const void *ctl_stack_src, const u32 ctl_stack_size)
338+{
339+ uint64_t addr;
340+ struct v11_compute_mqd *m;
341+
342+ m = (struct v11_compute_mqd *) mqd_mem_obj->cpu_ptr;
343+ addr = mqd_mem_obj->gpu_addr;
344+
345+ memcpy(m, mqd_src, sizeof(*m));
346+
347+ *mqd = m;
348+ if (gart_addr)
349+ *gart_addr = addr;
350+
351+ m->cp_hqd_pq_doorbell_control =
352+ qp->doorbell_off <<
353+ CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT;
354+ pr_debug("cp_hqd_pq_doorbell_control 0x%x\n",
355+ m->cp_hqd_pq_doorbell_control);
356+
357+ qp->is_active = 0;
358+}
359+
360+
324361 static void init_mqd_hiq(struct mqd_manager *mm, void **mqd,
325362 struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr,
326363 struct queue_properties *q)
@@ -458,6 +495,8 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type, · 131 unmodified lines
458495 mqd->mqd_size = sizeof(struct v11_compute_mqd);
459496 mqd->get_wave_state = get_wave_state;
460497 mqd->mqd_stride = kfd_mqd_stride;
498+ mqd->checkpoint_mqd = checkpoint_mqd;
499+ mqd->restore_mqd = restore_mqd;
461500 #if defined(CONFIG_DEBUG_FS)
462501 mqd->debugfs_show_mqd = debugfs_show_mqd;
463502 #endif
@@ -502,6 +541,8 @@ struct mqd_manager *mqd_manager_init_v11(enum KFD_MQD_TYPE type, · 38 unmodified lines
502541 mqd->update_mqd = update_mqd_sdma;
503542 mqd->destroy_mqd = kfd_destroy_mqd_sdma;
504543 mqd->is_occupied = kfd_is_occupied_sdma;
544+ mqd->checkpoint_mqd = checkpoint_mqd;
545+ mqd->restore_mqd = restore_mqd;
505546 mqd->mqd_size = sizeof(struct v11_sdma_mqd);
506547 mqd->mqd_stride = kfd_mqd_stride;
507548 #if defined(CONFIG_DEBUG_FS)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c+29−17
@@ -60,7 +60,7 @@ static inline struct v9_sdma_mqd *get_sdma_mqd(void *mqd) · 59 unmodified lines
6060 }
6161
6262 static void update_cu_mask(struct mqd_manager *mm, void *mqd,
63− struct mqd_update_info *minfo)
63+ struct mqd_update_info *minfo, uint32_t inst)
6464 {
6565 struct v9_mqd *m;
6666 uint32_t se_mask[KFD_MAX_NUM_SE] = {0};
@@ -69,27 +69,36 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd, · 2 unmodified lines
6969 return;
7070
7171 mqd_symmetrically_map_cu_mask(mm,
72− minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
72+ minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, inst);
7373
7474 m = get_mqd(mqd);
75+
7576 m->compute_static_thread_mgmt_se0 = se_mask[0];
7677 m->compute_static_thread_mgmt_se1 = se_mask[1];
7778 m->compute_static_thread_mgmt_se2 = se_mask[2];
7879 m->compute_static_thread_mgmt_se3 = se_mask[3];
79− m->compute_static_thread_mgmt_se4 = se_mask[4];
80− m->compute_static_thread_mgmt_se5 = se_mask[5];
81− m->compute_static_thread_mgmt_se6 = se_mask[6];
82− m->compute_static_thread_mgmt_se7 = se_mask[7];
83−
84− pr_debug("update cu mask to %#x %#x %#x %#x %#x %#x %#x %#x\n",
85− m->compute_static_thread_mgmt_se0,
86− m->compute_static_thread_mgmt_se1,
87− m->compute_static_thread_mgmt_se2,
88− m->compute_static_thread_mgmt_se3,
89− m->compute_static_thread_mgmt_se4,
90− m->compute_static_thread_mgmt_se5,
91− m->compute_static_thread_mgmt_se6,
92− m->compute_static_thread_mgmt_se7);
80+ if (KFD_GC_VERSION(mm->dev) != IP_VERSION(9, 4, 3)) {
81+ m->compute_static_thread_mgmt_se4 = se_mask[4];
82+ m->compute_static_thread_mgmt_se5 = se_mask[5];
83+ m->compute_static_thread_mgmt_se6 = se_mask[6];
84+ m->compute_static_thread_mgmt_se7 = se_mask[7];
85+
86+ pr_debug("update cu mask to %#x %#x %#x %#x %#x %#x %#x %#x\n",
87+ m->compute_static_thread_mgmt_se0,
88+ m->compute_static_thread_mgmt_se1,
89+ m->compute_static_thread_mgmt_se2,
90+ m->compute_static_thread_mgmt_se3,
91+ m->compute_static_thread_mgmt_se4,
92+ m->compute_static_thread_mgmt_se5,
93+ m->compute_static_thread_mgmt_se6,
94+ m->compute_static_thread_mgmt_se7);
95+ } else {
96+ pr_debug("inst: %u, update cu mask to %#x %#x %#x %#x\n",
97+ inst, m->compute_static_thread_mgmt_se0,
98+ m->compute_static_thread_mgmt_se1,
99+ m->compute_static_thread_mgmt_se2,
100+ m->compute_static_thread_mgmt_se3);
101+ }
93102 }
94103
95104 static void set_priority(struct v9_mqd *m, struct queue_properties *q)
@@ -290,7 +299,8 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, · 194 unmodified lines
290299 if (mm->dev->kfd->cwsr_enabled && q->ctx_save_restore_area_address)
291300 m->cp_hqd_ctx_save_control = 0;
292301
293− update_cu_mask(mm, mqd, minfo);
302+ if (KFD_GC_VERSION(mm->dev) != IP_VERSION(9, 4, 3))
303+ update_cu_mask(mm, mqd, minfo, 0);
294304 set_priority(m, q);
295305
296306 q->is_active = QUEUE_IS_ACTIVE(*q);
@@ -676,6 +686,8 @@ static void update_mqd_v9_4_3(struct mqd_manager *mm, void *mqd, · 379 unmodified lines
676686 m = get_mqd(mqd + size * xcc);
677687 update_mqd(mm, m, q, minfo);
678688
689+ update_cu_mask(mm, mqd, minfo, xcc);
690+
679691 if (q->format == KFD_QUEUE_FORMAT_AQL) {
680692 switch (xcc) {
681693 case 0:
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c+1−1
@@ -55,7 +55,7 @@ static void update_cu_mask(struct mqd_manager *mm, void *mqd, · 54 unmodified lines
5555 return;
5656
5757 mqd_symmetrically_map_cu_mask(mm,
58− minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask);
58+ minfo->cu_mask.ptr, minfo->cu_mask.count, se_mask, 0);
5959
6060 m = get_mqd(mqd);
6161 m->compute_static_thread_mgmt_se0 = se_mask[0];
drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c+1−2
@@ -299,8 +299,7 @@ static int pm_set_grace_period_v9(struct packet_manager *pm, · 298 unmodified lines
299299 pm->dqm->wait_times,
300300 grace_period,
301301 &reg_offset,
302− &reg_data,
303− 0);
302+ &reg_data);
304303
305304 if (grace_period == USE_DEFAULT_GRACE_PERIOD)
306305 reg_data = pm->dqm->wait_times;
drivers/gpu/drm/amd/amdkfd/kfd_priv.h+1−2
@@ -1466,8 +1466,7 @@ void kfd_flush_tlb(struct kfd_process_device *pdd, enum TLB_FLUSH_TYPE type); · 1465 unmodified lines
14661466
14671467 static inline bool kfd_flush_tlb_after_unmap(struct kfd_dev *dev)
14681468 {
1469− return KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) ||
1470− KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 2) ||
1469+ return KFD_GC_VERSION(dev) > IP_VERSION(9, 4, 2) ||
14711470 (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 1) && dev->sdma_fw_version >= 18) ||
14721471 KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 0);
14731472 }
drivers/gpu/drm/amd/amdkfd/kfd_topology.c+43−34
@@ -450,8 +450,7 @@ static ssize_t node_show(struct kobject *kobj, struct attribute *attr, · 449 unmodified lines
450450 sysfs_show_32bit_prop(buffer, offs, "cpu_cores_count",
451451 dev->node_props.cpu_cores_count);
452452 sysfs_show_32bit_prop(buffer, offs, "simd_count",
453− dev->gpu ? (dev->node_props.simd_count *
454− NUM_XCC(dev->gpu->xcc_mask)) : 0);
453+ dev->gpu ? dev->node_props.simd_count : 0);
455454 sysfs_show_32bit_prop(buffer, offs, "mem_banks_count",
456455 dev->node_props.mem_banks_count);
457456 sysfs_show_32bit_prop(buffer, offs, "caches_count",
@@ -1597,14 +1596,17 @@ static int fill_in_l1_pcache(struct kfd_cache_properties **props_ext, · 1139 unmodified lines
15971596 static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext,
15981597 struct kfd_gpu_cache_info *pcache_info,
15991598 struct kfd_cu_info *cu_info,
1600− int cache_type, unsigned int cu_processor_id)
1599+ int cache_type, unsigned int cu_processor_id,
1600+ struct kfd_node *knode)
16011601 {
16021602 unsigned int cu_sibling_map_mask;
16031603 int first_active_cu;
1604− int i, j, k;
1604+ int i, j, k, xcc, start, end;
16051605 struct kfd_cache_properties *pcache = NULL;
16061606
1607− cu_sibling_map_mask = cu_info->cu_bitmap[0][0];
1607+ start = ffs(knode->xcc_mask) - 1;
1608+ end = start + NUM_XCC(knode->xcc_mask);
1609+ cu_sibling_map_mask = cu_info->cu_bitmap[start][0][0];
16081610 cu_sibling_map_mask &=
16091611 ((1 << pcache_info[cache_type].num_cu_shared) - 1);
16101612 first_active_cu = ffs(cu_sibling_map_mask);
@@ -1639,16 +1641,18 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext, · 28 unmodified lines
16391641 cu_sibling_map_mask = cu_sibling_map_mask >> (first_active_cu - 1);
16401642 k = 0;
16411643
1642− for (i = 0; i < cu_info->num_shader_engines; i++) {
1643− for (j = 0; j < cu_info->num_shader_arrays_per_engine; j++) {
1644− pcache->sibling_map[k] = (uint8_t)(cu_sibling_map_mask & 0xFF);
1645− pcache->sibling_map[k+1] = (uint8_t)((cu_sibling_map_mask >> 8) & 0xFF);
1646− pcache->sibling_map[k+2] = (uint8_t)((cu_sibling_map_mask >> 16) & 0xFF);
1647− pcache->sibling_map[k+3] = (uint8_t)((cu_sibling_map_mask >> 24) & 0xFF);
1648− k += 4;
1649−
1650− cu_sibling_map_mask = cu_info->cu_bitmap[i % 4][j + i / 4];
1651− cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1);
1644+ for (xcc = start; xcc < end; xcc++) {
1645+ for (i = 0; i < cu_info->num_shader_engines; i++) {
1646+ for (j = 0; j < cu_info->num_shader_arrays_per_engine; j++) {
1647+ pcache->sibling_map[k] = (uint8_t)(cu_sibling_map_mask & 0xFF);
1648+ pcache->sibling_map[k+1] = (uint8_t)((cu_sibling_map_mask >> 8) & 0xFF);
1649+ pcache->sibling_map[k+2] = (uint8_t)((cu_sibling_map_mask >> 16) & 0xFF);
1650+ pcache->sibling_map[k+3] = (uint8_t)((cu_sibling_map_mask >> 24) & 0xFF);
1651+ k += 4;
1652+
1653+ cu_sibling_map_mask = cu_info->cu_bitmap[xcc][i % 4][j + i / 4];
1654+ cu_sibling_map_mask &= ((1 << pcache_info[cache_type].num_cu_shared) - 1);
1655+ }
16521656 }
16531657 }
16541658 pcache->sibling_map_size = k;
@@ -1666,7 +1670,7 @@ static int fill_in_l2_l3_pcache(struct kfd_cache_properties **props_ext, · 11 unmodified lines
16661670 static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct kfd_node *kdev)
16671671 {
16681672 struct kfd_gpu_cache_info *pcache_info = NULL;
1669− int i, j, k;
1673+ int i, j, k, xcc, start, end;
16701674 int ct = 0;
16711675 unsigned int cu_processor_id;
16721676 int ret;
@@ -1700,37 +1704,42 @@ static void kfd_fill_cache_non_crat_info(struct kfd_topology_device *dev, struct · 27 unmodified lines
17001704 * then it will consider only one CU from
17011705 * the shared unit
17021706 */
1707+ start = ffs(kdev->xcc_mask) - 1;
1708+ end = start + NUM_XCC(kdev->xcc_mask);
1709+
17031710 for (ct = 0; ct < num_of_cache_types; ct++) {
17041711 cu_processor_id = gpu_processor_id;
17051712 if (pcache_info[ct].cache_level == 1) {
1706− for (i = 0; i < pcu_info->num_shader_engines; i++) {
1707− for (j = 0; j < pcu_info->num_shader_arrays_per_engine; j++) {
1708− for (k = 0; k < pcu_info->num_cu_per_sh; k += pcache_info[ct].num_cu_shared) {
1713+ for (xcc = start; xcc < end; xcc++) {
1714+ for (i = 0; i < pcu_info->num_shader_engines; i++) {
1715+ for (j = 0; j < pcu_info->num_shader_arrays_per_engine; j++) {
1716+ for (k = 0; k < pcu_info->num_cu_per_sh; k += pcache_info[ct].num_cu_shared) {
17091717
1710− ret = fill_in_l1_pcache(&props_ext, pcache_info, pcu_info,
1711− pcu_info->cu_bitmap[i % 4][j + i / 4], ct,
1718+ ret = fill_in_l1_pcache(&props_ext, pcache_info, pcu_info,
1719+ pcu_info->cu_bitmap[xcc][i % 4][j + i / 4], ct,
17121720 cu_processor_id, k);
17131721
1714− if (ret < 0)
1715− break;
1722+ if (ret < 0)
1723+ break;
17161724
1717− if (!ret) {
1718− num_of_entries++;
1719− list_add_tail(&props_ext->list, &dev->cache_props);
1720− }
1725+ if (!ret) {
1726+ num_of_entries++;
1727+ list_add_tail(&props_ext->list, &dev->cache_props);
1728+ }
17211729
1722− /* Move to next CU block */
1723− num_cu_shared = ((k + pcache_info[ct].num_cu_shared) <=
1724− pcu_info->num_cu_per_sh) ?
1725− pcache_info[ct].num_cu_shared :
1726− (pcu_info->num_cu_per_sh - k);
1727− cu_processor_id += num_cu_shared;
1730+ /* Move to next CU block */
1731+ num_cu_shared = ((k + pcache_info[ct].num_cu_shared) <=
1732+ pcu_info->num_cu_per_sh) ?
1733+ pcache_info[ct].num_cu_shared :
1734+ (pcu_info->num_cu_per_sh - k);
1735+ cu_processor_id += num_cu_shared;
1736+ }
17281737 }
17291738 }
17301739 }
17311740 } else {
17321741 ret = fill_in_l2_l3_pcache(&props_ext, pcache_info,
1733− pcu_info, ct, cu_processor_id);
1742+ pcu_info, ct, cu_processor_id, kdev);
17341743
17351744 if (ret < 0)
17361745 break;
drivers/gpu/drm/amd/amdkfd/kfd_topology.h+1−1
@@ -89,7 +89,7 @@ struct kfd_mem_properties { · 88 unmodified lines
8989 struct attribute attr;
9090 };
9191
92−#define CACHE_SIBLINGMAP_SIZE 64
92+#define CACHE_SIBLINGMAP_SIZE 128
9393
9494 struct kfd_cache_properties {
9595 struct list_head list;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c+96−23
@@ -1274,11 +1274,15 @@ static void mmhub_read_system_context(struct amdgpu_device *adev, struct dc_phy_ · 1273 unmodified lines
12741274
12751275 pt_base = amdgpu_gmc_pd_addr(adev->gart.bo);
12761276
1277− page_table_start.high_part = (u32)(adev->gmc.gart_start >> 44) & 0xF;
1278− page_table_start.low_part = (u32)(adev->gmc.gart_start >> 12);
1279− page_table_end.high_part = (u32)(adev->gmc.gart_end >> 44) & 0xF;
1280− page_table_end.low_part = (u32)(adev->gmc.gart_end >> 12);
1281− page_table_base.high_part = upper_32_bits(pt_base) & 0xF;
1277+ page_table_start.high_part = upper_32_bits(adev->gmc.gart_start >>
1278+ AMDGPU_GPU_PAGE_SHIFT);
1279+ page_table_start.low_part = lower_32_bits(adev->gmc.gart_start >>
1280+ AMDGPU_GPU_PAGE_SHIFT);
1281+ page_table_end.high_part = upper_32_bits(adev->gmc.gart_end >>
1282+ AMDGPU_GPU_PAGE_SHIFT);
1283+ page_table_end.low_part = lower_32_bits(adev->gmc.gart_end >>
1284+ AMDGPU_GPU_PAGE_SHIFT);
1285+ page_table_base.high_part = upper_32_bits(pt_base);
12821286 page_table_base.low_part = lower_32_bits(pt_base);
12831287
12841288 pa_config->system_aperture.start_addr = (uint64_t)logical_addr_low << 18;
@@ -1640,8 +1644,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) · 355 unmodified lines
16401644 }
16411645 break;
16421646 }
1643− if (init_data.flags.gpu_vm_support)
1644− init_data.flags.gpu_vm_support = amdgpu_sg_display_supported(adev);
1647+ if (init_data.flags.gpu_vm_support &&
1648+ (amdgpu_sg_display == 0))
1649+ init_data.flags.gpu_vm_support = false;
16451650
16461651 if (init_data.flags.gpu_vm_support)
16471652 adev->mode_info.gpu_vm_support = true;
@@ -2335,14 +2340,62 @@ static int dm_late_init(void *handle) · 687 unmodified lines
23352340 return detect_mst_link_for_all_connectors(adev_to_drm(adev));
23362341 }
23372342
2343+static void resume_mst_branch_status(struct drm_dp_mst_topology_mgr *mgr)
2344+{
2345+ int ret;
2346+ u8 guid[16];
2347+ u64 tmp64;
2348+
2349+ mutex_lock(&mgr->lock);
2350+ if (!mgr->mst_primary)
2351+ goto out_fail;
2352+
2353+ if (drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd) < 0) {
2354+ drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n");
2355+ goto out_fail;
2356+ }
2357+
2358+ ret = drm_dp_dpcd_writeb(mgr->aux, DP_MSTM_CTRL,
2359+ DP_MST_EN |
2360+ DP_UP_REQ_EN |
2361+ DP_UPSTREAM_IS_SRC);
2362+ if (ret < 0) {
2363+ drm_dbg_kms(mgr->dev, "mst write failed - undocked during suspend?\n");
2364+ goto out_fail;
2365+ }
2366+
2367+ /* Some hubs forget their guids after they resume */
2368+ ret = drm_dp_dpcd_read(mgr->aux, DP_GUID, guid, 16);
2369+ if (ret != 16) {
2370+ drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n");
2371+ goto out_fail;
2372+ }
2373+
2374+ if (memchr_inv(guid, 0, 16) == NULL) {
2375+ tmp64 = get_jiffies_64();
2376+ memcpy(&guid[0], &tmp64, sizeof(u64));
2377+ memcpy(&guid[8], &tmp64, sizeof(u64));
2378+
2379+ ret = drm_dp_dpcd_write(mgr->aux, DP_GUID, guid, 16);
2380+
2381+ if (ret != 16) {
2382+ drm_dbg_kms(mgr->dev, "check mstb guid failed - undocked during suspend?\n");
2383+ goto out_fail;
2384+ }
2385+ }
2386+
2387+ memcpy(mgr->mst_primary->guid, guid, 16);
2388+
2389+out_fail:
2390+ mutex_unlock(&mgr->lock);
2391+}
2392+
23382393 static void s3_handle_mst(struct drm_device *dev, bool suspend)
23392394 {
23402395 struct amdgpu_dm_connector *aconnector;
23412396 struct drm_connector *connector;
23422397 struct drm_connector_list_iter iter;
23432398 struct drm_dp_mst_topology_mgr *mgr;
2344− int ret;
2345− bool need_hotplug = false;
23462399
23472400 drm_connector_list_iter_begin(dev, &iter);
23482401 drm_for_each_connector_iter(connector, &iter) {
@@ -2364,18 +2417,15 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend) · 15 unmodified lines
23642417 if (!dp_is_lttpr_present(aconnector->dc_link))
23652418 try_to_configure_aux_timeout(aconnector->dc_link->ddc, LINK_AUX_DEFAULT_TIMEOUT_PERIOD);
23662419
2367− ret = drm_dp_mst_topology_mgr_resume(mgr, true);
2368− if (ret < 0) {
2369− dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
2370− aconnector->dc_link);
2371− need_hotplug = true;
2372− }
2420+ /* TODO: move resume_mst_branch_status() into drm mst resume again
2421+ * once topology probing work is pulled out from mst resume into mst
2422+ * resume 2nd step. mst resume 2nd step should be called after old
2423+ * state getting restored (i.e. drm_atomic_helper_resume()).
2424+ */
2425+ resume_mst_branch_status(mgr);
23732426 }
23742427 }
23752428 drm_connector_list_iter_end(&iter);
2376−
2377− if (need_hotplug)
2378− drm_kms_helper_hotplug_event(dev);
23792429 }
23802430
23812431 static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev)
@@ -2769,7 +2819,8 @@ static int dm_resume(void *handle) · 387 unmodified lines
27692819 struct dm_atomic_state *dm_state = to_dm_atomic_state(dm->atomic_obj.state);
27702820 enum dc_connection_type new_connection_type = dc_connection_none;
27712821 struct dc_state *dc_state;
2772− int i, r, j;
2822+ int i, r, j, ret;
2823+ bool need_hotplug = false;
27732824
27742825 if (amdgpu_in_reset(adev)) {
27752826 dc_state = dm->cached_dc_state;
@@ -2867,7 +2918,7 @@ static int dm_resume(void *handle) · 91 unmodified lines
28672918 continue;
28682919
28692920 /*
2870− * this is the case when traversing through already created
2921+ * this is the case when traversing through already created end sink
28712922 * MST connectors, should be skipped
28722923 */
28732924 if (aconnector && aconnector->mst_root)
@@ -2927,6 +2978,27 @@ static int dm_resume(void *handle) · 53 unmodified lines
29272978
29282979 dm->cached_state = NULL;
29292980
2981+ /* Do mst topology probing after resuming cached state*/
2982+ drm_connector_list_iter_begin(ddev, &iter);
2983+ drm_for_each_connector_iter(connector, &iter) {
2984+ aconnector = to_amdgpu_dm_connector(connector);
2985+ if (aconnector->dc_link->type != dc_connection_mst_branch ||
2986+ aconnector->mst_root)
2987+ continue;
2988+
2989+ ret = drm_dp_mst_topology_mgr_resume(&aconnector->mst_mgr, true);
2990+
2991+ if (ret < 0) {
2992+ dm_helpers_dp_mst_stop_top_mgr(aconnector->dc_link->ctx,
2993+ aconnector->dc_link);
2994+ need_hotplug = true;
2995+ }
2996+ }
2997+ drm_connector_list_iter_end(&iter);
2998+
2999+ if (need_hotplug)
3000+ drm_kms_helper_hotplug_event(ddev);
3001+
29303002 amdgpu_dm_irq_resume_late(adev);
29313003
29323004 amdgpu_dm_smu_write_watermarks_table(adev);
@@ -6026,8 +6098,6 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, · 3093 unmodified lines
60266098
60276099 if (recalculate_timing)
60286100 drm_mode_set_crtcinfo(&saved_mode, 0);
6029− else if (!old_stream)
6030− drm_mode_set_crtcinfo(&mode, 0);
60316101
60326102 /*
60336103 * If scaling is enabled and refresh rate didn't change
@@ -6589,6 +6659,8 @@ enum drm_mode_status amdgpu_dm_connector_mode_valid(struct drm_connector *connec · 555 unmodified lines
65896659 goto fail;
65906660 }
65916661
6662+ drm_mode_set_crtcinfo(mode, 0);
6663+
65926664 stream = create_validate_stream_for_sink(aconnector, mode,
65936665 to_dm_connector_state(connector->state),
65946666 NULL);
@@ -8073,7 +8145,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, · 1478 unmodified lines
80738145 bundle->surface_updates[planes_count].plane_info =
80748146 &bundle->plane_infos[planes_count];
80758147
8076− if (acrtc_state->stream->link->psr_settings.psr_feature_enabled) {
8148+ if (acrtc_state->stream->link->psr_settings.psr_feature_enabled ||
8149+ acrtc_state->stream->link->replay_settings.replay_feature_enabled) {
80778150 fill_dc_dirty_rects(plane, old_plane_state,
80788151 new_plane_state, new_crtc_state,
80798152 &bundle->flip_addrs[planes_count],
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h+1−1
@@ -620,7 +620,7 @@ struct amdgpu_hdmi_vsdb_info { · 619 unmodified lines
620620 unsigned int max_refresh_rate_hz;
621621
622622 /**
623− * @replay mode: Replay supported
623+ * @replay_mode: Replay supported
624624 */
625625 bool replay_mode;
626626 };
drivers/gpu/drm/amd/display/dc/core/dc_link_enc_cfg.c+28−7
@@ -169,11 +169,23 @@ static void add_link_enc_assignment( · 168 unmodified lines
169169 /* Return first available DIG link encoder. */
170170 static enum engine_id find_first_avail_link_enc(
171171 const struct dc_context *ctx,
172− const struct dc_state *state)
172+ const struct dc_state *state,
173+ enum engine_id eng_id_requested)
173174 {
174175 enum engine_id eng_id = ENGINE_ID_UNKNOWN;
175176 int i;
176177
178+ if (eng_id_requested != ENGINE_ID_UNKNOWN) {
179+
180+ for (i = 0; i < ctx->dc->res_pool->res_cap->num_dig_link_enc; i++) {
181+ eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i];
182+ if (eng_id == eng_id_requested)
183+ return eng_id;
184+ }
185+ }
186+
187+ eng_id = ENGINE_ID_UNKNOWN;
188+
177189 for (i = 0; i < ctx->dc->res_pool->res_cap->num_dig_link_enc; i++) {
178190 eng_id = state->res_ctx.link_enc_cfg_ctx.link_enc_avail[i];
179191 if (eng_id != ENGINE_ID_UNKNOWN)
@@ -287,7 +299,7 @@ void link_enc_cfg_link_encs_assign( · 107 unmodified lines
287299 struct dc_stream_state *streams[],
288300 uint8_t stream_count)
289301 {
290− enum engine_id eng_id = ENGINE_ID_UNKNOWN;
302+ enum engine_id eng_id = ENGINE_ID_UNKNOWN, eng_id_req = ENGINE_ID_UNKNOWN;
291303 int i;
292304 int j;
293305
@@ -377,8 +389,14 @@ void link_enc_cfg_link_encs_assign( · 83 unmodified lines
377389 * assigned to that endpoint.
378390 */
379391 link_enc = get_link_enc_used_by_link(state, stream->link);
380− if (link_enc == NULL)
381− eng_id = find_first_avail_link_enc(stream->ctx, state);
392+ if (link_enc == NULL) {
393+
394+ if (stream->link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA &&
395+ stream->link->dpia_preferred_eng_id != ENGINE_ID_UNKNOWN)
396+ eng_id_req = stream->link->dpia_preferred_eng_id;
397+
398+ eng_id = find_first_avail_link_enc(stream->ctx, state, eng_id_req);
399+ }
382400 else
383401 eng_id = link_enc->preferred_engine;
384402
@@ -402,7 +420,9 @@ void link_enc_cfg_link_encs_assign( · 17 unmodified lines
402420 DC_LOG_DEBUG("%s: CUR %s(%d) - enc_id(%d)\n",
403421 __func__,
404422 assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ? "PHY" : "DPIA",
405− assignment.ep_id.link_id.enum_id - 1,
423+ assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ?
424+ assignment.ep_id.link_id.enum_id :
425+ assignment.ep_id.link_id.enum_id - 1,
406426 assignment.eng_id);
407427 }
408428 for (i = 0; i < MAX_PIPES; i++) {
@@ -413,7 +433,9 @@ void link_enc_cfg_link_encs_assign( · 4 unmodified lines
413433 DC_LOG_DEBUG("%s: NEW %s(%d) - enc_id(%d)\n",
414434 __func__,
415435 assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ? "PHY" : "DPIA",
416− assignment.ep_id.link_id.enum_id - 1,
436+ assignment.ep_id.ep_type == DISPLAY_ENDPOINT_PHY ?
437+ assignment.ep_id.link_id.enum_id :
438+ assignment.ep_id.link_id.enum_id - 1,
417439 assignment.eng_id);
418440 }
419441
@@ -478,7 +500,6 @@ struct dc_link *link_enc_cfg_get_link_using_link_enc( · 58 unmodified lines
478500 if (stream)
479501 link = stream->link;
480502
481− // dm_output_to_console("%s: No link using DIG(%d).\n", __func__, eng_id);
482503 return link;
483504 }
484505
drivers/gpu/drm/amd/display/dc/dc.h+1−0
@@ -1496,6 +1496,7 @@ struct dc_link { · 1495 unmodified lines
14961496 * object creation.
14971497 */
14981498 enum engine_id eng_id;
1499+ enum engine_id dpia_preferred_eng_id;
14991500
15001501 bool test_pattern_enabled;
15011502 enum dp_test_pattern current_test_pattern;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c+20−14
@@ -964,7 +964,9 @@ void dce110_edp_backlight_control( · 963 unmodified lines
964964 return;
965965 }
966966
967− if (link->panel_cntl) {
967+ if (link->panel_cntl && !(link->dpcd_sink_ext_caps.bits.oled ||
968+ link->dpcd_sink_ext_caps.bits.hdr_aux_backlight_control == 1 ||
969+ link->dpcd_sink_ext_caps.bits.sdr_aux_backlight_control == 1)) {
968970 bool is_backlight_on = link->panel_cntl->funcs->is_panel_backlight_on(link->panel_cntl);
969971
970972 if ((enable && is_backlight_on) || (!enable && !is_backlight_on)) {
@@ -1176,12 +1178,15 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) · 205 unmodified lines
11761178 dto_params.otg_inst = tg->inst;
11771179 dto_params.timing = &pipe_ctx->stream->timing;
11781180 dp_hpo_inst = pipe_ctx->stream_res.hpo_dp_stream_enc->inst;
1179− dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
1180− dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst);
1181− dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst);
1182− } else if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST && dccg->funcs->disable_symclk_se)
1181+ if (dccg) {
1182+ dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
1183+ dccg->funcs->disable_symclk32_se(dccg, dp_hpo_inst);
1184+ dccg->funcs->set_dpstreamclk(dccg, REFCLK, tg->inst, dp_hpo_inst);
1185+ }
1186+ } else if (dccg && dccg->funcs->disable_symclk_se) {
11831187 dccg->funcs->disable_symclk_se(dccg, stream_enc->stream_enc_inst,
11841188 link_enc->transmitter - TRANSMITTER_UNIPHY_A);
1189+ }
11851190
11861191 if (dc->link_srv->dp_is_128b_132b_signal(pipe_ctx)) {
11871192 /* TODO: This looks like a bug to me as we are disabling HPO IO when
@@ -2656,11 +2661,11 @@ void dce110_prepare_bandwidth( · 1468 unmodified lines
26562661 struct clk_mgr *dccg = dc->clk_mgr;
26572662
26582663 dce110_set_safe_displaymarks(&context->res_ctx, dc->res_pool);
2659−
2660− dccg->funcs->update_clocks(
2661− dccg,
2662− context,
2663− false);
2664+ if (dccg)
2665+ dccg->funcs->update_clocks(
2666+ dccg,
2667+ context,
2668+ false);
26642669 }
26652670
26662671 void dce110_optimize_bandwidth(
@@ -2671,10 +2676,11 @@ void dce110_optimize_bandwidth( · 4 unmodified lines
26712676
26722677 dce110_set_displaymarks(dc, context);
26732678
2674− dccg->funcs->update_clocks(
2675− dccg,
2676− context,
2677− true);
2679+ if (dccg)
2680+ dccg->funcs->update_clocks(
2681+ dccg,
2682+ context,
2683+ true);
26782684 }
26792685
26802686 static void dce110_program_front_end_for_pipe(
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c+2−6
@@ -2692,8 +2692,6 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) · 2691 unmodified lines
26922692 struct dce_hwseq *hws = dc->hwseq;
26932693 unsigned int k1_div = PIXEL_RATE_DIV_NA;
26942694 unsigned int k2_div = PIXEL_RATE_DIV_NA;
2695− struct link_encoder *link_enc = link_enc_cfg_get_link_enc(pipe_ctx->stream->link);
2696− struct stream_encoder *stream_enc = pipe_ctx->stream_res.stream_enc;
26972695
26982696 if (dc->link_srv->dp_is_128b_132b_signal(pipe_ctx)) {
26992697 if (dc->hwseq->funcs.setup_hpo_hw_control)
@@ -2713,10 +2711,8 @@ void dcn20_enable_stream(struct pipe_ctx *pipe_ctx) · 13 unmodified lines
27132711 dto_params.timing = &pipe_ctx->stream->timing;
27142712 dto_params.ref_dtbclk_khz = dc->clk_mgr->funcs->get_dtb_ref_clk_frequency(dc->clk_mgr);
27152713 dccg->funcs->set_dtbclk_dto(dccg, &dto_params);
2716− } else if (pipe_ctx->stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST && dccg->funcs->enable_symclk_se)
2717− dccg->funcs->enable_symclk_se(dccg,
2718− stream_enc->stream_enc_inst, link_enc->transmitter - TRANSMITTER_UNIPHY_A);
2719−
2714+ } else {
2715+ }
27202716 if (hws->funcs.calculate_dccg_k1_k2_values && dc->res_pool->dccg->funcs->set_pixel_rate_div) {
27212717 hws->funcs.calculate_dccg_k1_k2_values(pipe_ctx, &k1_div, &k2_div);
27222718
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c+23−0
@@ -1032,6 +1032,28 @@ static const struct dce_i2c_mask i2c_masks = { · 1031 unmodified lines
10321032 I2C_COMMON_MASK_SH_LIST_DCN30(_MASK)
10331033 };
10341034
1035+/* ========================================================== */
1036+
1037+/*
1038+ * DPIA index | Preferred Encoder | Host Router
1039+ * 0 | C | 0
1040+ * 1 | First Available | 0
1041+ * 2 | D | 1
1042+ * 3 | First Available | 1
1043+ */
1044+/* ========================================================== */
1045+static const enum engine_id dpia_to_preferred_enc_id_table[] = {
1046+ ENGINE_ID_DIGC,
1047+ ENGINE_ID_DIGC,
1048+ ENGINE_ID_DIGD,
1049+ ENGINE_ID_DIGD
1050+};
1051+
1052+static enum engine_id dcn314_get_preferred_eng_id_dpia(unsigned int dpia_index)
1053+{
1054+ return dpia_to_preferred_enc_id_table[dpia_index];
1055+}
1056+
10351057 static struct dce_i2c_hw *dcn31_i2c_hw_create(
10361058 struct dc_context *ctx,
10371059 uint32_t inst)
@@ -1785,6 +1807,7 @@ static struct resource_funcs dcn314_res_pool_funcs = { · 747 unmodified lines
17851807 .update_bw_bounding_box = dcn314_update_bw_bounding_box,
17861808 .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
17871809 .get_panel_config_defaults = dcn314_get_panel_config_defaults,
1810+ .get_preferred_eng_id_dpia = dcn314_get_preferred_eng_id_dpia,
17881811 };
17891812
17901813 static struct clock_source *dcn30_clock_source_create(
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_mpc.c+1−1
@@ -75,7 +75,7 @@ void mpc32_power_on_blnd_lut( · 74 unmodified lines
7575 if (power_on) {
7676 REG_UPDATE(MPCC_MCM_MEM_PWR_CTRL[mpcc_id], MPCC_MCM_1DLUT_MEM_PWR_FORCE, 0);
7777 REG_WAIT(MPCC_MCM_MEM_PWR_CTRL[mpcc_id], MPCC_MCM_1DLUT_MEM_PWR_STATE, 0, 1, 5);
78− } else {
78+ } else if (!mpc->ctx->dc->debug.disable_mem_low_power) {
7979 ASSERT(false);
8080 /* TODO: change to mpc
8181 * dpp_base->ctx->dc->optimized_required = true;
drivers/gpu/drm/amd/display/dc/inc/core_types.h+1−0
@@ -65,6 +65,7 @@ struct resource_context; · 64 unmodified lines
6565 struct clk_bw_params;
6666
6767 struct resource_funcs {
68+ enum engine_id (*get_preferred_eng_id_dpia)(unsigned int dpia_index);
6869 void (*destroy)(struct resource_pool **pool);
6970 void (*link_init)(struct dc_link *link);
7071 struct panel_cntl*(*panel_cntl_create)(
drivers/gpu/drm/amd/display/dc/link/link_factory.c+4−0
@@ -791,6 +791,10 @@ static bool construct_dpia(struct dc_link *link, · 790 unmodified lines
791791 /* Set dpia port index : 0 to number of dpia ports */
792792 link->ddc_hw_inst = init_params->connector_index;
793793
794+ // Assign Dpia preferred eng_id
795+ if (link->dc->res_pool->funcs->get_preferred_eng_id_dpia)
796+ link->dpia_preferred_eng_id = link->dc->res_pool->funcs->get_preferred_eng_id_dpia(link->ddc_hw_inst);
797+
794798 /* TODO: Create link encoder */
795799
796800 link->psr_settings.psr_version = DC_PSR_VERSION_UNSUPPORTED;
drivers/gpu/drm/amd/include/kgd_kfd_interface.h+4−5
@@ -31,12 +31,12 @@ · 30 unmodified lines
3131 #include <linux/types.h>
3232 #include <linux/bitmap.h>
3333 #include <linux/dma-fence.h>
34+#include "amdgpu_irq.h"
35+#include "amdgpu_gfx.h"
3436
3537 struct pci_dev;
3638 struct amdgpu_device;
3739
38−#define KGD_MAX_QUEUES 128
39−
4040 struct kfd_dev;
4141 struct kgd_mem;
4242
@@ -68,7 +68,7 @@ struct kfd_cu_info { · 25 unmodified lines
6868 uint32_t wave_front_size;
6969 uint32_t max_scratch_slots_per_cu;
7070 uint32_t lds_size;
71− uint32_t cu_bitmap[4][4];
71+ uint32_t cu_bitmap[AMDGPU_MAX_GC_INSTANCES][4][4];
7272 };
7373
7474 /* For getting GPU local memory information from KGD */
@@ -326,8 +326,7 @@ struct kfd2kgd_calls { · 251 unmodified lines
326326 uint32_t wait_times,
327327 uint32_t grace_period,
328328 uint32_t *reg_offset,
329− uint32_t *reg_data,
330− uint32_t inst);
329+ uint32_t *reg_data);
331330 void (*get_cu_occupancy)(struct amdgpu_device *adev, int pasid,
332331 int *wave_cnt, int *max_waves_per_cu, uint32_t inst);
333332 void (*program_trap_handler_settings)(struct amdgpu_device *adev,
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c+1−1
@@ -336,7 +336,7 @@ static int smu_v13_0_6_setup_driver_pptable(struct smu_context *smu) · 335 unmodified lines
336336
337337 /* Store one-time values in driver PPTable */
338338 if (!pptable->Init) {
339− while (retry--) {
339+ while (--retry) {
340340 ret = smu_v13_0_6_get_metrics_table(smu, NULL, true);
341341 if (ret)
342342 return ret;
drivers/gpu/drm/drm_connector.c+2−0
@@ -2203,6 +2203,7 @@ static int drm_mode_create_colorspace_property(struct drm_connector *connector, · 2202 unmodified lines
22032203 /**
22042204 * drm_mode_create_hdmi_colorspace_property - create hdmi colorspace property
22052205 * @connector: connector to create the Colorspace property on.
2206+ * @supported_colorspaces: bitmap of supported color spaces
22062207 *
22072208 * Called by a driver the first time it's needed, must be attached to desired
22082209 * HDMI connectors.
@@ -2227,6 +2228,7 @@ EXPORT_SYMBOL(drm_mode_create_hdmi_colorspace_property); · 18 unmodified lines
22272228 /**
22282229 * drm_mode_create_dp_colorspace_property - create dp colorspace property
22292230 * @connector: connector to create the Colorspace property on.
2231+ * @supported_colorspaces: bitmap of supported color spaces
22302232 *
22312233 * Called by a driver the first time it's needed, must be attached to desired
22322234 * DP connectors.
drivers/gpu/drm/drm_exec.c+1−1
@@ -56,7 +56,7 @@ static void drm_exec_unlock_all(struct drm_exec *exec) · 55 unmodified lines
5656 struct drm_gem_object *obj;
5757 unsigned long index;
5858
59− drm_exec_for_each_locked_object(exec, index, obj) {
59+ drm_exec_for_each_locked_object_reverse(exec, index, obj) {
6060 dma_resv_unlock(obj->resv);
6161 drm_gem_object_put(obj);
6262 }
drivers/gpu/drm/i915/display/intel_bios.c+21−0
@@ -3540,6 +3540,27 @@ enum aux_ch intel_bios_dp_aux_ch(const struct intel_bios_encoder_data *devdata) · 3539 unmodified lines
35403540 return map_aux_ch(devdata->i915, devdata->child.aux_channel);
35413541 }
35423542
3543+bool intel_bios_dp_has_shared_aux_ch(const struct intel_bios_encoder_data *devdata)
3544+{
3545+ struct drm_i915_private *i915;
3546+ u8 aux_channel;
3547+ int count = 0;
3548+
3549+ if (!devdata || !devdata->child.aux_channel)
3550+ return false;
3551+
3552+ i915 = devdata->i915;
3553+ aux_channel = devdata->child.aux_channel;
3554+
3555+ list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) {
3556+ if (intel_bios_encoder_supports_dp(devdata) &&
3557+ aux_channel == devdata->child.aux_channel)
3558+ count++;
3559+ }
3560+
3561+ return count > 1;
3562+}
3563+
35433564 int intel_bios_dp_boost_level(const struct intel_bios_encoder_data *devdata)
35443565 {
35453566 if (!devdata || devdata->i915->display.vbt.version < 196 || !devdata->child.iboost)
drivers/gpu/drm/i915/display/intel_bios.h+1−0
@@ -273,6 +273,7 @@ enum aux_ch intel_bios_dp_aux_ch(const struct intel_bios_encoder_data *devdata); · 272 unmodified lines
273273 int intel_bios_dp_boost_level(const struct intel_bios_encoder_data *devdata);
274274 int intel_bios_dp_max_lane_count(const struct intel_bios_encoder_data *devdata);
275275 int intel_bios_dp_max_link_rate(const struct intel_bios_encoder_data *devdata);
276+bool intel_bios_dp_has_shared_aux_ch(const struct intel_bios_encoder_data *devdata);
276277 int intel_bios_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
277278 int intel_bios_hdmi_ddc_pin(const struct intel_bios_encoder_data *devdata);
278279 int intel_bios_hdmi_level_shift(const struct intel_bios_encoder_data *devdata);
drivers/gpu/drm/i915/display/intel_dp.c+6−1
@@ -5512,8 +5512,13 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp, · 5511 unmodified lines
55125512 /*
55135513 * VBT and straps are liars. Also check HPD as that seems
55145514 * to be the most reliable piece of information available.
5515+ *
5516+ * ... expect on devices that forgot to hook HPD up for eDP
5517+ * (eg. Acer Chromebook C710), so we'll check it only if multiple
5518+ * ports are attempting to use the same AUX CH, according to VBT.
55155519 */
5516− if (!intel_digital_port_connected(encoder)) {
5520+ if (intel_bios_dp_has_shared_aux_ch(encoder->devdata) &&
5521+ !intel_digital_port_connected(encoder)) {
55175522 /*
55185523 * If this fails, presume the DPCD answer came
55195524 * from some other port using the same AUX CH.
drivers/gpu/drm/i915/gem/i915_gem_shmem.c+7−4
@@ -100,6 +100,7 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, · 99 unmodified lines
100100 st->nents = 0;
101101 for (i = 0; i < page_count; i++) {
102102 struct folio *folio;
103+ unsigned long nr_pages;
103104 const unsigned int shrink[] = {
104105 I915_SHRINK_BOUND | I915_SHRINK_UNBOUND,
105106 0,
@@ -150,6 +151,8 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, · 44 unmodified lines
150151 }
151152 } while (1);
152153
154+ nr_pages = min_t(unsigned long,
155+ folio_nr_pages(folio), page_count - i);
153156 if (!i ||
154157 sg->length >= max_segment ||
155158 folio_pfn(folio) != next_pfn) {
@@ -157,13 +160,13 @@ int shmem_sg_alloc_table(struct drm_i915_private *i915, struct sg_table *st, · 1 unmodified line
157160 sg = sg_next(sg);
158161
159162 st->nents++;
160− sg_set_folio(sg, folio, folio_size(folio), 0);
163+ sg_set_folio(sg, folio, nr_pages * PAGE_SIZE, 0);
161164 } else {
162165 /* XXX: could overflow? */
163− sg->length += folio_size(folio);
166+ sg->length += nr_pages * PAGE_SIZE;
164167 }
165− next_pfn = folio_pfn(folio) + folio_nr_pages(folio);
166− i += folio_nr_pages(folio) - 1;
168+ next_pfn = folio_pfn(folio) + nr_pages;
169+ i += nr_pages - 1;
167170
168171 /* Check that the i965g/gm workaround works. */
169172 GEM_BUG_ON(gfp & __GFP_DMA32 && next_pfn >= 0x00100000UL);
drivers/gpu/drm/i915/gt/intel_engine_cs.c+0−1
@@ -558,7 +558,6 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id, · 557 unmodified lines
558558 DRIVER_CAPS(i915)->has_logical_contexts = true;
559559
560560 ewma__engine_latency_init(&engine->latency);
561− seqcount_init(&engine->stats.execlists.lock);
562561
563562 ATOMIC_INIT_NOTIFIER_HEAD(&engine->context_status_notifier);
564563
drivers/gpu/drm/i915/gt/intel_execlists_submission.c+2−0
@@ -3550,6 +3550,8 @@ int intel_execlists_submission_setup(struct intel_engine_cs *engine) · 3549 unmodified lines
35503550 logical_ring_default_vfuncs(engine);
35513551 logical_ring_default_irqs(engine);
35523552
3553+ seqcount_init(&engine->stats.execlists.lock);
3554+
35533555 if (engine->flags & I915_ENGINE_HAS_RCS_REG_STATE)
35543556 rcs_submission_override(engine);
35553557
drivers/gpu/drm/i915/gt/intel_ggtt.c+17−6
@@ -511,20 +511,31 @@ void intel_ggtt_unbind_vma(struct i915_address_space *vm, · 510 unmodified lines
511511 vm->clear_range(vm, vma_res->start, vma_res->vma_size);
512512 }
513513
514+/*
515+ * Reserve the top of the GuC address space for firmware images. Addresses
516+ * beyond GUC_GGTT_TOP in the GuC address space are inaccessible by GuC,
517+ * which makes for a suitable range to hold GuC/HuC firmware images if the
518+ * size of the GGTT is 4G. However, on a 32-bit platform the size of the GGTT
519+ * is limited to 2G, which is less than GUC_GGTT_TOP, but we reserve a chunk
520+ * of the same size anyway, which is far more than needed, to keep the logic
521+ * in uc_fw_ggtt_offset() simple.
522+ */
523+#define GUC_TOP_RESERVE_SIZE (SZ_4G - GUC_GGTT_TOP)
524+
514525 static int ggtt_reserve_guc_top(struct i915_ggtt *ggtt)
515526 {
516− u64 size;
527+ u64 offset;
517528 int ret;
518529
519530 if (!intel_uc_uses_guc(&ggtt->vm.gt->uc))
520531 return 0;
521532
522− GEM_BUG_ON(ggtt->vm.total <= GUC_GGTT_TOP);
523− size = ggtt->vm.total - GUC_GGTT_TOP;
533+ GEM_BUG_ON(ggtt->vm.total <= GUC_TOP_RESERVE_SIZE);
534+ offset = ggtt->vm.total - GUC_TOP_RESERVE_SIZE;
524535
525− ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &ggtt->uc_fw, size,
526− GUC_GGTT_TOP, I915_COLOR_UNEVICTABLE,
527− PIN_NOEVICT);
536+ ret = i915_gem_gtt_reserve(&ggtt->vm, NULL, &ggtt->uc_fw,
537+ GUC_TOP_RESERVE_SIZE, offset,
538+ I915_COLOR_UNEVICTABLE, PIN_NOEVICT);
528539 if (ret)
529540 drm_dbg(&ggtt->vm.i915->drm,
530541 "Failed to reserve top of GGTT for GuC\n");
drivers/gpu/drm/i915/gt/intel_lrc.c+3−2
@@ -1094,6 +1094,9 @@ __lrc_alloc_state(struct intel_context *ce, struct intel_engine_cs *engine) · 1093 unmodified lines
10941094 I915_BO_ALLOC_PM_VOLATILE);
10951095 if (IS_ERR(obj)) {
10961096 obj = i915_gem_object_create_shmem(engine->i915, context_size);
1097+ if (IS_ERR(obj))
1098+ return ERR_CAST(obj);
1099+
10971100 /*
10981101 * Wa_22016122933: For Media version 13.0, all Media GT shared
10991102 * memory needs to be mapped as WC on CPU side and UC (PAT
@@ -1102,8 +1105,6 @@ __lrc_alloc_state(struct intel_context *ce, struct intel_engine_cs *engine) · 2 unmodified lines
11021105 if (intel_gt_needs_wa_22016122933(engine->gt))
11031106 i915_gem_object_set_cache_coherency(obj, I915_CACHE_NONE);
11041107 }
1105− if (IS_ERR(obj))
1106− return ERR_CAST(obj);
11071108
11081109 vma = i915_vma_instance(obj, &engine->gt->ggtt->vm, NULL);
11091110 if (IS_ERR(vma)) {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c+35−3
@@ -1432,6 +1432,36 @@ static void guc_timestamp_ping(struct work_struct *wrk) · 1431 unmodified lines
14321432 unsigned long index;
14331433 int srcu, ret;
14341434
1435+ /*
1436+ * Ideally the busyness worker should take a gt pm wakeref because the
1437+ * worker only needs to be active while gt is awake. However, the
1438+ * gt_park path cancels the worker synchronously and this complicates
1439+ * the flow if the worker is also running at the same time. The cancel
1440+ * waits for the worker and when the worker releases the wakeref, that
1441+ * would call gt_park and would lead to a deadlock.
1442+ *
1443+ * The resolution is to take the global pm wakeref if runtime pm is
1444+ * already active. If not, we don't need to update the busyness stats as
1445+ * the stats would already be updated when the gt was parked.
1446+ *
1447+ * Note:
1448+ * - We do not requeue the worker if we cannot take a reference to runtime
1449+ * pm since intel_guc_busyness_unpark would requeue the worker in the
1450+ * resume path.
1451+ *
1452+ * - If the gt was parked longer than time taken for GT timestamp to roll
1453+ * over, we ignore those rollovers since we don't care about tracking
1454+ * the exact GT time. We only care about roll overs when the gt is
1455+ * active and running workloads.
1456+ *
1457+ * - There is a window of time between gt_park and runtime suspend,
1458+ * where the worker may run. This is acceptable since the worker will
1459+ * not find any new data to update busyness.
1460+ */
1461+ wakeref = intel_runtime_pm_get_if_active(&gt->i915->runtime_pm);
1462+ if (!wakeref)
1463+ return;
1464+
14351465 /*
14361466 * Synchronize with gt reset to make sure the worker does not
14371467 * corrupt the engine/guc stats. NB: can't actually block waiting
@@ -1440,10 +1470,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) · 2 unmodified lines
14401470 */
14411471 ret = intel_gt_reset_trylock(gt, &srcu);
14421472 if (ret)
1443− return;
1473+ goto err_trylock;
14441474
1445− with_intel_runtime_pm(&gt->i915->runtime_pm, wakeref)
1446− __update_guc_busyness_stats(guc);
1475+ __update_guc_busyness_stats(guc);
14471476
14481477 /* adjust context stats for overflow */
14491478 xa_for_each(&guc->context_lookup, index, ce)
@@ -1452,6 +1481,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) · 2 unmodified lines
14521481 intel_gt_reset_unlock(gt, srcu);
14531482
14541483 guc_enable_busyness_worker(guc);
1484+
1485+err_trylock:
1486+ intel_runtime_pm_put(&gt->i915->runtime_pm, wakeref);
14551487 }
14561488
14571489 static int guc_action_enable_usage_stats(struct intel_guc *guc)
drivers/gpu/drm/meson/meson_encoder_hdmi.c+2−0
@@ -334,6 +334,8 @@ static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, · 333 unmodified lines
334334 return;
335335
336336 cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid);
337+
338+ kfree(edid);
337339 } else
338340 cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier);
339341 }
drivers/gpu/drm/nouveau/nouveau_drv.h+5−14
@@ -189,21 +189,12 @@ u_free(void *addr) · 188 unmodified lines
189189 static inline void *
190190 u_memcpya(uint64_t user, unsigned int nmemb, unsigned int size)
191191 {
192− void *mem;
193− void __user *userptr = (void __force __user *)(uintptr_t)user;
192+ void __user *userptr = u64_to_user_ptr(user);
193+ size_t bytes;
194194
195− size *= nmemb;
196−
197− mem = kvmalloc(size, GFP_KERNEL);
198− if (!mem)
199− return ERR_PTR(-ENOMEM);
200−
201− if (copy_from_user(mem, userptr, size)) {
202− u_free(mem);
203− return ERR_PTR(-EFAULT);
204− }
205−
206− return mem;
195+ if (unlikely(check_mul_overflow(nmemb, size, &bytes)))
196+ return ERR_PTR(-EOVERFLOW);
197+ return vmemdup_user(userptr, bytes);
207198 }
208199
209200 #include <nvif/object.h>
drivers/gpu/drm/nouveau/nouveau_exec.c+1−1
@@ -213,7 +213,7 @@ nouveau_exec_job_timeout(struct nouveau_job *job) · 212 unmodified lines
213213
214214 nouveau_sched_entity_fini(job->entity);
215215
216− return DRM_GPU_SCHED_STAT_ENODEV;
216+ return DRM_GPU_SCHED_STAT_NOMINAL;
217217 }
218218
219219 static struct nouveau_job_ops nouveau_exec_job_ops = {
drivers/gpu/drm/nouveau/nouveau_fence.c+1−1
@@ -207,7 +207,7 @@ nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_cha · 206 unmodified lines
207207 int
208208 nouveau_fence_emit(struct nouveau_fence *fence)
209209 {
210− struct nouveau_channel *chan = fence->channel;
210+ struct nouveau_channel *chan = unrcu_pointer(fence->channel);
211211 struct nouveau_fence_chan *fctx = chan->fence;
212212 struct nouveau_fence_priv *priv = (void*)chan->drm->fence;
213213 int ret;
drivers/gpu/drm/nouveau/nouveau_sched.c+9−3
@@ -375,14 +375,20 @@ nouveau_sched_run_job(struct drm_sched_job *sched_job) · 374 unmodified lines
375375 static enum drm_gpu_sched_stat
376376 nouveau_sched_timedout_job(struct drm_sched_job *sched_job)
377377 {
378+ struct drm_gpu_scheduler *sched = sched_job->sched;
378379 struct nouveau_job *job = to_nouveau_job(sched_job);
380+ enum drm_gpu_sched_stat stat = DRM_GPU_SCHED_STAT_NOMINAL;
379381
380− NV_PRINTK(warn, job->cli, "Job timed out.\n");
382+ drm_sched_stop(sched, sched_job);
381383
382384 if (job->ops->timeout)
383− return job->ops->timeout(job);
385+ stat = job->ops->timeout(job);
386+ else
387+ NV_PRINTK(warn, job->cli, "Generic job timeout.\n");
388+
389+ drm_sched_start(sched, true);
384390
385− return DRM_GPU_SCHED_STAT_ENODEV;
391+ return stat;
386392 }
387393
388394 static void
drivers/gpu/drm/radeon/radeon_sa.c+1−1
@@ -123,7 +123,7 @@ int radeon_sa_bo_new(struct radeon_sa_manager *sa_manager, · 122 unmodified lines
123123 unsigned int size, unsigned int align)
124124 {
125125 struct drm_suballoc *sa = drm_suballoc_new(&sa_manager->base, size,
126− GFP_KERNEL, true, align);
126+ GFP_KERNEL, false, align);
127127
128128 if (IS_ERR(sa)) {
129129 *sa_bo = NULL;
drivers/gpu/drm/tests/drm_mm_test.c+1−1
@@ -939,7 +939,7 @@ static void drm_test_mm_insert_range(struct kunit *test) · 938 unmodified lines
939939 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max - 1));
940940 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size, 0, max / 2));
941941 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
942− max / 2, max / 2));
942+ max / 2, max));
943943 KUNIT_ASSERT_FALSE(test, __drm_test_mm_insert_range(test, count, size,
944944 max / 4 + 1, 3 * max / 4 - 1));
945945
drivers/gpu/drm/tiny/gm12u320.c+5−5
@@ -70,10 +70,10 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)"); · 69 unmodified lines
7070 #define READ_STATUS_SIZE 13
7171 #define MISC_VALUE_SIZE 4
7272
73−#define CMD_TIMEOUT msecs_to_jiffies(200)
74−#define DATA_TIMEOUT msecs_to_jiffies(1000)
75−#define IDLE_TIMEOUT msecs_to_jiffies(2000)
76−#define FIRST_FRAME_TIMEOUT msecs_to_jiffies(2000)
73+#define CMD_TIMEOUT 200
74+#define DATA_TIMEOUT 1000
75+#define IDLE_TIMEOUT 2000
76+#define FIRST_FRAME_TIMEOUT 2000
7777
7878 #define MISC_REQ_GET_SET_ECO_A 0xff
7979 #define MISC_REQ_GET_SET_ECO_B 0x35
@@ -389,7 +389,7 @@ static void gm12u320_fb_update_work(struct work_struct *work) · 309 unmodified lines
389389 * switches back to showing its logo.
390390 */
391391 queue_delayed_work(system_long_wq, &gm12u320->fb_update.work,
392− IDLE_TIMEOUT);
392+ msecs_to_jiffies(IDLE_TIMEOUT));
393393
394394 return;
395395 err:
drivers/gpu/drm/virtio/virtgpu_submit.c+0−1
@@ -361,7 +361,6 @@ static void virtio_gpu_complete_submit(struct virtio_gpu_submit *submit) · 360 unmodified lines
361361 submit->buf = NULL;
362362 submit->buflist = NULL;
363363 submit->sync_file = NULL;
364− submit->out_fence = NULL;
365364 submit->out_fence_fd = -1;
366365 }
367366
drivers/gpu/drm/vkms/vkms_composer.c+2−7
@@ -408,15 +408,10 @@ void vkms_set_composer(struct vkms_output *out, bool enabled) · 407 unmodified lines
408408 if (enabled)
409409 drm_crtc_vblank_get(&out->crtc);
410410
411− mutex_lock(&out->enabled_lock);
411+ spin_lock_irq(&out->lock);
412412 old_enabled = out->composer_enabled;
413413 out->composer_enabled = enabled;
414−
415− /* the composition wasn't enabled, so unlock the lock to make sure the lock
416− * will be balanced even if we have a failed commit
417− */
418− if (!out->composer_enabled)
419− mutex_unlock(&out->enabled_lock);
414+ spin_unlock_irq(&out->lock);
420415
421416 if (old_enabled)
422417 drm_crtc_vblank_put(&out->crtc);
drivers/gpu/drm/vkms/vkms_crtc.c+4−5
@@ -16,7 +16,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) · 15 unmodified lines
1616 struct drm_crtc *crtc = &output->crtc;
1717 struct vkms_crtc_state *state;
1818 u64 ret_overrun;
19− bool ret, fence_cookie, composer_enabled;
19+ bool ret, fence_cookie;
2020
2121 fence_cookie = dma_fence_begin_signalling();
2222
@@ -25,15 +25,15 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) · 2 unmodified lines
2525 if (ret_overrun != 1)
2626 pr_warn("%s: vblank timer overrun\n", __func__);
2727
28+ spin_lock(&output->lock);
2829 ret = drm_crtc_handle_vblank(crtc);
2930 if (!ret)
3031 DRM_ERROR("vkms failure on handling vblank");
3132
3233 state = output->composer_state;
33− composer_enabled = output->composer_enabled;
34− mutex_unlock(&output->enabled_lock);
34+ spin_unlock(&output->lock);
3535
36− if (state && composer_enabled) {
36+ if (state && output->composer_enabled) {
3737 u64 frame = drm_crtc_accurate_vblank_count(crtc);
3838
3939 /* update frame_start only if a queued vkms_composer_worker()
@@ -295,7 +295,6 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, · 255 unmodified lines
295295
296296 spin_lock_init(&vkms_out->lock);
297297 spin_lock_init(&vkms_out->composer_lock);
298− mutex_init(&vkms_out->enabled_lock);
299298
300299 vkms_out->composer_workq = alloc_ordered_workqueue("vkms_composer", 0);
301300 if (!vkms_out->composer_workq)
drivers/gpu/drm/vkms/vkms_drv.h+1−3
@@ -108,10 +108,8 @@ struct vkms_output { · 107 unmodified lines
108108 struct workqueue_struct *composer_workq;
109109 /* protects concurrent access to composer */
110110 spinlock_t lock;
111− /* guarantees that if the composer is enabled, a job will be queued */
112− struct mutex enabled_lock;
113111
114− /* protected by @enabled_lock */
112+ /* protected by @lock */
115113 bool composer_enabled;
116114 struct vkms_crtc_state *composer_state;
117115
drivers/hwmon/nct6775-core.c+4−0
@@ -1910,6 +1910,10 @@ static umode_t nct6775_in_is_visible(struct kobject *kobj, · 1909 unmodified lines
19101910 struct device *dev = kobj_to_dev(kobj);
19111911 struct nct6775_data *data = dev_get_drvdata(dev);
19121912 int in = index / 5; /* voltage index */
1913+ int nr = index % 5; /* attribute index */
1914+
1915+ if (nr == 1 && data->ALARM_BITS[in] == -1)
1916+ return 0;
19131917
19141918 if (!(data->have_in & BIT(in)))
19151919 return 0;
drivers/i2c/Kconfig+1−1
@@ -72,7 +72,7 @@ config I2C_MUX · 71 unmodified lines
7272 source "drivers/i2c/muxes/Kconfig"
7373
7474 config I2C_ATR
75− tristate "I2C Address Translator (ATR) support"
75+ tristate "I2C Address Translator (ATR) support" if COMPILE_TEST
7676 help
7777 Enable support for I2C Address Translator (ATR) chips.
7878
drivers/i2c/busses/Kconfig+2−2
@@ -1384,10 +1384,10 @@ config I2C_ICY · 1383 unmodified lines
13841384
13851385 config I2C_MLXCPLD
13861386 tristate "Mellanox I2C driver"
1387− depends on X86_64 || ARM64 || COMPILE_TEST
1387+ depends on X86_64 || (ARM64 && ACPI) || COMPILE_TEST
13881388 help
13891389 This exposes the Mellanox platform I2C busses to the linux I2C layer
1390− for X86 based systems.
1390+ for X86 and ARM64/ACPI based systems.
13911391 Controller is implemented as CPLD logic.
13921392
13931393 This driver can also be built as a module. If so, the module will be
drivers/i2c/busses/i2c-aspeed.c+5−2
@@ -698,13 +698,16 @@ static int aspeed_i2c_master_xfer(struct i2c_adapter *adap, · 697 unmodified lines
698698
699699 if (time_left == 0) {
700700 /*
701− * If timed out and bus is still busy in a multi master
702− * environment, attempt recovery at here.
701+ * In a multi-master setup, if a timeout occurs, attempt
702+ * recovery. But if the bus is idle, we still need to reset the
703+ * i2c controller to clear the remaining interrupts.
703704 */
704705 if (bus->multi_master &&
705706 (readl(bus->base + ASPEED_I2C_CMD_REG) &
706707 ASPEED_I2CD_BUS_BUSY_STS))
707708 aspeed_i2c_recover_bus(bus);
709+ else
710+ aspeed_i2c_reset(bus);
708711
709712 /*
710713 * If timed out and the state is still pending, drop the pending
drivers/i2c/busses/i2c-cadence.c+1−0
@@ -182,6 +182,7 @@ enum cdns_i2c_slave_state { · 181 unmodified lines
182182 * @reset: Reset control for the device
183183 * @quirks: flag for broken hold bit usage in r1p10
184184 * @ctrl_reg: Cached value of the control register.
185+ * @rinfo: I2C GPIO recovery information
185186 * @ctrl_reg_diva_divb: value of fields DIV_A and DIV_B from CR register
186187 * @slave: Registered slave instance.
187188 * @dev_mode: I2C operating role(master/slave).
drivers/i2c/busses/i2c-designware-common.c+17−0
@@ -441,8 +441,25 @@ err_release_lock: · 440 unmodified lines
441441
442442 void __i2c_dw_disable(struct dw_i2c_dev *dev)
443443 {
444+ unsigned int raw_intr_stats;
445+ unsigned int enable;
444446 int timeout = 100;
447+ bool abort_needed;
445448 unsigned int status;
449+ int ret;
450+
451+ regmap_read(dev->map, DW_IC_RAW_INTR_STAT, &raw_intr_stats);
452+ regmap_read(dev->map, DW_IC_ENABLE, &enable);
453+
454+ abort_needed = raw_intr_stats & DW_IC_INTR_MST_ON_HOLD;
455+ if (abort_needed) {
456+ regmap_write(dev->map, DW_IC_ENABLE, enable | DW_IC_ENABLE_ABORT);
457+ ret = regmap_read_poll_timeout(dev->map, DW_IC_ENABLE, enable,
458+ !(enable & DW_IC_ENABLE_ABORT), 10,
459+ 100);
460+ if (ret)
461+ dev_err(dev->dev, "timeout while trying to abort current transfer\n");
462+ }
446463
447464 do {
448465 __i2c_dw_disable_nowait(dev);
drivers/i2c/busses/i2c-designware-core.h+3−0
@@ -98,6 +98,7 @@ · 97 unmodified lines
9898 #define DW_IC_INTR_START_DET BIT(10)
9999 #define DW_IC_INTR_GEN_CALL BIT(11)
100100 #define DW_IC_INTR_RESTART_DET BIT(12)
101+#define DW_IC_INTR_MST_ON_HOLD BIT(13)
101102
102103 #define DW_IC_INTR_DEFAULT_MASK (DW_IC_INTR_RX_FULL | \
103104 DW_IC_INTR_TX_ABRT | \
@@ -108,6 +109,8 @@ · 4 unmodified lines
108109 DW_IC_INTR_RX_UNDER | \
109110 DW_IC_INTR_RD_REQ)
110111
112+#define DW_IC_ENABLE_ABORT BIT(1)
113+
111114 #define DW_IC_STATUS_ACTIVITY BIT(0)
112115 #define DW_IC_STATUS_TFE BIT(2)
113116 #define DW_IC_STATUS_RFNE BIT(3)
drivers/i2c/busses/i2c-i801.c+1−0
@@ -1754,6 +1754,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 1753 unmodified lines
17541754 "SMBus I801 adapter at %04lx", priv->smba);
17551755 err = i2c_add_adapter(&priv->adapter);
17561756 if (err) {
1757+ platform_device_unregister(priv->tco_pdev);
17571758 i801_acpi_remove(priv);
17581759 return err;
17591760 }
drivers/i2c/busses/i2c-npcm7xx.c+7−10
@@ -694,6 +694,7 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, · 693 unmodified lines
694694 {
695695 struct i2c_msg *msgs;
696696 int msgs_num;
697+ bool do_complete = false;
697698
698699 msgs = bus->msgs;
699700 msgs_num = bus->msgs_num;
@@ -722,23 +723,17 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, · 22 unmodified lines
722723 msgs[1].flags & I2C_M_RD)
723724 msgs[1].len = info;
724725 }
725− if (completion_done(&bus->cmd_complete) == false)
726− complete(&bus->cmd_complete);
727− break;
728−
726+ do_complete = true;
727+ break;
729728 case I2C_NACK_IND:
730729 /* MASTER transmit got a NACK before tx all bytes */
731730 bus->cmd_err = -ENXIO;
732− if (bus->master_or_slave == I2C_MASTER)
733− complete(&bus->cmd_complete);
734−
731+ do_complete = true;
735732 break;
736733 case I2C_BUS_ERR_IND:
737734 /* Bus error */
738735 bus->cmd_err = -EAGAIN;
739− if (bus->master_or_slave == I2C_MASTER)
740− complete(&bus->cmd_complete);
741−
736+ do_complete = true;
742737 break;
743738 case I2C_WAKE_UP_IND:
744739 /* I2C wake up */
@@ -752,6 +747,8 @@ static void npcm_i2c_callback(struct npcm_i2c *bus, · 7 unmodified lines
752747 if (bus->slave)
753748 bus->master_or_slave = I2C_SLAVE;
754749 #endif
750+ if (do_complete)
751+ complete(&bus->cmd_complete);
755752 }
756753
757754 static u8 npcm_i2c_fifo_usage(struct npcm_i2c *bus)
drivers/i2c/busses/i2c-xiic.c+1−1
@@ -710,7 +710,7 @@ static irqreturn_t xiic_process(int irq, void *dev_id) · 709 unmodified lines
710710 * reset the IP instead of just flush fifos
711711 */
712712 ret = xiic_reinit(i2c);
713− if (!ret)
713+ if (ret < 0)
714714 dev_dbg(i2c->adap.dev.parent, "reinit failed\n");
715715
716716 if (i2c->rx_msg) {
drivers/i2c/i2c-mux.c+1−1
@@ -341,7 +341,7 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc, · 340 unmodified lines
341341 priv->adap.lock_ops = &i2c_parent_lock_ops;
342342
343343 /* Sanity check on class */
344− if (i2c_mux_parent_classes(parent) & class)
344+ if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
345345 dev_err(&parent->dev,
346346 "Segment %d behind mux can't share classes with ancestors\n",
347347 chan_id);
drivers/i2c/muxes/i2c-demux-pinctrl.c+4−0
@@ -243,6 +243,10 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) · 242 unmodified lines
243243
244244 props[i].name = devm_kstrdup(&pdev->dev, "status", GFP_KERNEL);
245245 props[i].value = devm_kstrdup(&pdev->dev, "ok", GFP_KERNEL);
246+ if (!props[i].name || !props[i].value) {
247+ err = -ENOMEM;
248+ goto err_rollback;
249+ }
246250 props[i].length = 3;
247251
248252 of_changeset_init(&priv->chan[i].chgset);
drivers/i2c/muxes/i2c-mux-gpio.c+3−1
@@ -105,8 +105,10 @@ static int i2c_mux_gpio_probe_fw(struct gpiomux *mux, · 104 unmodified lines
105105
106106 } else if (is_acpi_node(child)) {
107107 rc = acpi_get_local_address(ACPI_HANDLE_FWNODE(child), values + i);
108− if (rc)
108+ if (rc) {
109+ fwnode_handle_put(child);
109110 return dev_err_probe(dev, rc, "Cannot get address\n");
111+ }
110112 }
111113
112114 i++;
drivers/irqchip/irq-xtensa-mx.c+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
1212 #include <linux/irqdomain.h>
1313 #include <linux/irq.h>
1414 #include <linux/irqchip.h>
15+#include <linux/irqchip/xtensa-mx.h>
1516 #include <linux/of.h>
1617
1718 #include <asm/mxregs.h>
drivers/md/dm-core.h+1−0
@@ -214,6 +214,7 @@ struct dm_table { · 213 unmodified lines
214214
215215 /* a list of devices used by this table */
216216 struct list_head devices;
217+ struct rw_semaphore devices_lock;
217218
218219 /* events get handed up using this callback */
219220 void (*event_fn)(void *data);
drivers/md/dm-ioctl.c+6−1
@@ -1630,6 +1630,8 @@ static void retrieve_deps(struct dm_table *table, · 1629 unmodified lines
16301630 struct dm_dev_internal *dd;
16311631 struct dm_target_deps *deps;
16321632
1633+ down_read(&table->devices_lock);
1634+
16331635 deps = get_result_buffer(param, param_size, &len);
16341636
16351637 /*
@@ -1644,7 +1646,7 @@ static void retrieve_deps(struct dm_table *table, · 8 unmodified lines
16441646 needed = struct_size(deps, dev, count);
16451647 if (len < needed) {
16461648 param->flags |= DM_BUFFER_FULL_FLAG;
1647− return;
1649+ goto out;
16481650 }
16491651
16501652 /*
@@ -1656,6 +1658,9 @@ static void retrieve_deps(struct dm_table *table, · 5 unmodified lines
16561658 deps->dev[count++] = huge_encode_dev(dd->dm_dev->bdev->bd_dev);
16571659
16581660 param->data_size = param->data_start + needed;
1661+
1662+out:
1663+ up_read(&table->devices_lock);
16591664 }
16601665
16611666 static int table_deps(struct file *filp, struct dm_ioctl *param, size_t param_size)
drivers/md/dm-table.c+24−8
@@ -135,6 +135,7 @@ int dm_table_create(struct dm_table **result, blk_mode_t mode, · 134 unmodified lines
135135 return -ENOMEM;
136136
137137 INIT_LIST_HEAD(&t->devices);
138+ init_rwsem(&t->devices_lock);
138139
139140 if (!num_targets)
140141 num_targets = KEYS_PER_NODE;
@@ -359,16 +360,20 @@ int __ref dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode, · 218 unmodified lines
359360 if (dev == disk_devt(t->md->disk))
360361 return -EINVAL;
361362
363+ down_write(&t->devices_lock);
364+
362365 dd = find_device(&t->devices, dev);
363366 if (!dd) {
364367 dd = kmalloc(sizeof(*dd), GFP_KERNEL);
365− if (!dd)
366− return -ENOMEM;
368+ if (!dd) {
369+ r = -ENOMEM;
370+ goto unlock_ret_r;
371+ }
367372
368373 r = dm_get_table_device(t->md, dev, mode, &dd->dm_dev);
369374 if (r) {
370375 kfree(dd);
371− return r;
376+ goto unlock_ret_r;
372377 }
373378
374379 refcount_set(&dd->count, 1);
@@ -378,12 +383,17 @@ int __ref dm_get_device(struct dm_target *ti, const char *path, blk_mode_t mode, · 3 unmodified lines
378383 } else if (dd->dm_dev->mode != (mode | dd->dm_dev->mode)) {
379384 r = upgrade_mode(dd, mode, t->md);
380385 if (r)
381− return r;
386+ goto unlock_ret_r;
382387 }
383388 refcount_inc(&dd->count);
384389 out:
390+ up_write(&t->devices_lock);
385391 *result = dd->dm_dev;
386392 return 0;
393+
394+unlock_ret_r:
395+ up_write(&t->devices_lock);
396+ return r;
387397 }
388398 EXPORT_SYMBOL(dm_get_device);
389399
@@ -419,9 +429,12 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, · 29 unmodified lines
419429 void dm_put_device(struct dm_target *ti, struct dm_dev *d)
420430 {
421431 int found = 0;
422− struct list_head *devices = &ti->table->devices;
432+ struct dm_table *t = ti->table;
433+ struct list_head *devices = &t->devices;
423434 struct dm_dev_internal *dd;
424435
436+ down_write(&t->devices_lock);
437+
425438 list_for_each_entry(dd, devices, list) {
426439 if (dd->dm_dev == d) {
427440 found = 1;
@@ -430,14 +443,17 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d) · 2 unmodified lines
430443 }
431444 if (!found) {
432445 DMERR("%s: device %s not in table devices list",
433− dm_device_name(ti->table->md), d->name);
434− return;
446+ dm_device_name(t->md), d->name);
447+ goto unlock_ret;
435448 }
436449 if (refcount_dec_and_test(&dd->count)) {
437− dm_put_table_device(ti->table->md, d);
450+ dm_put_table_device(t->md, d);
438451 list_del(&dd->list);
439452 kfree(dd);
440453 }
454+
455+unlock_ret:
456+ up_write(&t->devices_lock);
441457 }
442458 EXPORT_SYMBOL(dm_put_device);
443459
drivers/md/dm.c+2−21
@@ -715,24 +715,6 @@ static void dm_put_live_table_fast(struct mapped_device *md) __releases(RCU) · 714 unmodified lines
715715 rcu_read_unlock();
716716 }
717717
718−static inline struct dm_table *dm_get_live_table_bio(struct mapped_device *md,
719− int *srcu_idx, blk_opf_t bio_opf)
720−{
721− if (bio_opf & REQ_NOWAIT)
722− return dm_get_live_table_fast(md);
723− else
724− return dm_get_live_table(md, srcu_idx);
725−}
726−
727−static inline void dm_put_live_table_bio(struct mapped_device *md, int srcu_idx,
728− blk_opf_t bio_opf)
729−{
730− if (bio_opf & REQ_NOWAIT)
731− dm_put_live_table_fast(md);
732− else
733− dm_put_live_table(md, srcu_idx);
734−}
735−
736718 static char *_dm_claim_ptr = "I belong to device-mapper";
737719
738720 /*
@@ -1833,9 +1815,8 @@ static void dm_submit_bio(struct bio *bio) · 1094 unmodified lines
18331815 struct mapped_device *md = bio->bi_bdev->bd_disk->private_data;
18341816 int srcu_idx;
18351817 struct dm_table *map;
1836− blk_opf_t bio_opf = bio->bi_opf;
18371818
1838− map = dm_get_live_table_bio(md, &srcu_idx, bio_opf);
1819+ map = dm_get_live_table(md, &srcu_idx);
18391820
18401821 /* If suspended, or map not yet available, queue this IO for later */
18411822 if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags)) ||
@@ -1851,7 +1832,7 @@ static void dm_submit_bio(struct bio *bio) · 9 unmodified lines
18511832
18521833 dm_split_and_process_bio(md, map, bio);
18531834 out:
1854− dm_put_live_table_bio(md, srcu_idx, bio_opf);
1835+ dm_put_live_table(md, srcu_idx);
18551836 }
18561837
18571838 static bool dm_poll_dm_io(struct dm_io *io, struct io_comp_batch *iob,
drivers/md/md.c+16−7
@@ -798,14 +798,14 @@ void mddev_unlock(struct mddev *mddev) · 797 unmodified lines
798798 } else
799799 mutex_unlock(&mddev->reconfig_mutex);
800800
801+ md_wakeup_thread(mddev->thread);
802+ wake_up(&mddev->sb_wait);
803+
801804 list_for_each_entry_safe(rdev, tmp, &delete, same_set) {
802805 list_del_init(&rdev->same_set);
803806 kobject_del(&rdev->kobj);
804807 export_rdev(rdev, mddev);
805808 }
806−
807− md_wakeup_thread(mddev->thread);
808− wake_up(&mddev->sb_wait);
809809 }
810810 EXPORT_SYMBOL_GPL(mddev_unlock);
811811
@@ -2452,7 +2452,8 @@ static void export_rdev(struct md_rdev *rdev, struct mddev *mddev) · 1640 unmodified lines
24522452 if (test_bit(AutoDetected, &rdev->flags))
24532453 md_autodetect_dev(rdev->bdev->bd_dev);
24542454 #endif
2455− blkdev_put(rdev->bdev, mddev->external ? &claim_rdev : rdev);
2455+ blkdev_put(rdev->bdev,
2456+ test_bit(Holder, &rdev->flags) ? rdev : &claim_rdev);
24562457 rdev->bdev = NULL;
24572458 kobject_put(&rdev->kobj);
24582459 }
@@ -3632,6 +3633,7 @@ EXPORT_SYMBOL_GPL(md_rdev_init); · 1173 unmodified lines
36323633 static struct md_rdev *md_import_device(dev_t newdev, int super_format, int super_minor)
36333634 {
36343635 struct md_rdev *rdev;
3636+ struct md_rdev *holder;
36353637 sector_t size;
36363638 int err;
36373639
@@ -3646,8 +3648,15 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe · 8 unmodified lines
36463648 if (err)
36473649 goto out_clear_rdev;
36483650
3651+ if (super_format == -2) {
3652+ holder = &claim_rdev;
3653+ } else {
3654+ holder = rdev;
3655+ set_bit(Holder, &rdev->flags);
3656+ }
3657+
36493658 rdev->bdev = blkdev_get_by_dev(newdev, BLK_OPEN_READ | BLK_OPEN_WRITE,
3650− super_format == -2 ? &claim_rdev : rdev, NULL);
3659+ holder, NULL);
36513660 if (IS_ERR(rdev->bdev)) {
36523661 pr_warn("md: could not open device unknown-block(%u,%u).\n",
36533662 MAJOR(newdev), MINOR(newdev));
@@ -3684,7 +3693,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe · 30 unmodified lines
36843693 return rdev;
36853694
36863695 out_blkdev_put:
3687− blkdev_put(rdev->bdev, super_format == -2 ? &claim_rdev : rdev);
3696+ blkdev_put(rdev->bdev, holder);
36883697 out_clear_rdev:
36893698 md_rdev_clear(rdev);
36903699 out_free_rdev:
@@ -8256,7 +8265,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) · 4565 unmodified lines
82568265 spin_unlock(&all_mddevs_lock);
82578266
82588267 if (to_put)
8259− mddev_put(mddev);
8268+ mddev_put(to_put);
82608269 return next_mddev;
82618270
82628271 }
drivers/md/md.h+3−0
@@ -211,6 +211,9 @@ enum flag_bits { · 210 unmodified lines
211211 * check if there is collision between raid1
212212 * serial bios.
213213 */
214+ Holder, /* rdev is used as holder while opening
215+ * underlying disk exclusively.
216+ */
214217 };
215218
216219 static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
drivers/md/raid1.c+1−2
@@ -1837,12 +1837,11 @@ static int raid1_remove_disk(struct mddev *mddev, struct md_rdev *rdev) · 1836 unmodified lines
18371837 struct r1conf *conf = mddev->private;
18381838 int err = 0;
18391839 int number = rdev->raid_disk;
1840+ struct raid1_info *p = conf->mirrors + number;
18401841
18411842 if (unlikely(number >= conf->raid_disks))
18421843 goto abort;
18431844
1844− struct raid1_info *p = conf->mirrors + number;
1845−
18461845 if (rdev != p->rdev)
18471846 p = conf->mirrors + conf->raid_disks + number;
18481847
drivers/media/common/videobuf2/frame_vector.c+4−2
@@ -31,6 +31,10 @@ · 30 unmodified lines
3131 * different type underlying the specified range of virtual addresses.
3232 * When the function isn't able to map a single page, it returns error.
3333 *
34+ * Note that get_vaddr_frames() cannot follow VM_IO mappings. It used
35+ * to be able to do that, but that could (racily) return non-refcounted
36+ * pfns.
37+ *
3438 * This function takes care of grabbing mmap_lock as necessary.
3539 */
3640 int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write,
@@ -59,8 +63,6 @@ int get_vaddr_frames(unsigned long start, unsigned int nr_frames, bool write, · 22 unmodified lines
5963 if (likely(ret > 0))
6064 return ret;
6165
62− /* This used to (racily) return non-refcounted pfns. Let people know */
63− WARN_ONCE(1, "get_vaddr_frames() cannot follow VM_IO mapping");
6466 vec->nr_frames = 0;
6567 return ret ? ret : -EFAULT;
6668 }
drivers/media/i2c/imx219.c+7−6
@@ -691,12 +691,12 @@ static int imx219_init_cfg(struct v4l2_subdev *sd, · 690 unmodified lines
691691 struct v4l2_mbus_framefmt *format;
692692 struct v4l2_rect *crop;
693693
694− /* Initialize try_fmt */
694+ /* Initialize the format. */
695695 format = v4l2_subdev_get_pad_format(sd, state, 0);
696696 imx219_update_pad_format(imx219, &supported_modes[0], format,
697697 MEDIA_BUS_FMT_SRGGB10_1X10);
698698
699− /* Initialize crop rectangle. */
699+ /* Initialize the crop rectangle. */
700700 crop = v4l2_subdev_get_pad_crop(sd, state, 0);
701701 crop->top = IMX219_PIXEL_ARRAY_TOP;
702702 crop->left = IMX219_PIXEL_ARRAY_LEFT;
@@ -750,6 +750,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, · 47 unmodified lines
750750 const struct imx219_mode *mode;
751751 int exposure_max, exposure_def, hblank;
752752 struct v4l2_mbus_framefmt *format;
753+ struct v4l2_rect *crop;
753754
754755 mode = v4l2_find_nearest_size(supported_modes,
755756 ARRAY_SIZE(supported_modes),
@@ -757,10 +758,12 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, · 1 unmodified line
757758 fmt->format.width, fmt->format.height);
758759
759760 imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code);
761+
760762 format = v4l2_subdev_get_pad_format(sd, sd_state, 0);
763+ crop = v4l2_subdev_get_pad_crop(sd, sd_state, 0);
761764
762− if (imx219->mode == mode && format->code == fmt->format.code)
763− return 0;
765+ *format = fmt->format;
766+ *crop = mode->crop;
764767
765768 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
766769 imx219->mode = mode;
@@ -788,8 +791,6 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd, · 21 unmodified lines
788791 hblank);
789792 }
790793
791− *format = fmt->format;
792−
793794 return 0;
794795 }
795796
drivers/media/i2c/max9286.c+0−1
@@ -1110,7 +1110,6 @@ err_async: · 1109 unmodified lines
11101110
11111111 static void max9286_v4l2_unregister(struct max9286_priv *priv)
11121112 {
1113− fwnode_handle_put(priv->sd.fwnode);
11141113 v4l2_ctrl_handler_free(&priv->ctrls);
11151114 v4l2_async_unregister_subdev(&priv->sd);
11161115 max9286_v4l2_notifier_unregister(priv);
drivers/media/i2c/rdacm21.c+0−1
@@ -608,7 +608,6 @@ static void rdacm21_remove(struct i2c_client *client) · 607 unmodified lines
608608 v4l2_async_unregister_subdev(&dev->sd);
609609 v4l2_ctrl_handler_free(&dev->ctrls);
610610 i2c_unregister_device(dev->isp);
611− fwnode_handle_put(dev->sd.fwnode);
612611 }
613612
614613 static const struct of_device_id rdacm21_of_ids[] = {
drivers/media/pci/bt8xx/bttv-risc.c+1−3
@@ -68,9 +68,7 @@ bttv_risc_packed(struct bttv *btv, struct btcx_riscmem *risc, · 67 unmodified lines
6868 sg = sglist;
6969 for (line = 0; line < store_lines; line++) {
7070 if ((line >= (store_lines - VCR_HACK_LINES)) &&
71− (btv->opt_vcr_hack ||
72− (V4L2_FIELD_HAS_BOTH(btv->field) ||
73− btv->field == V4L2_FIELD_ALTERNATE)))
71+ btv->opt_vcr_hack)
7472 continue;
7573 while (offset && offset >= sg_dma_len(sg)) {
7674 offset -= sg_dma_len(sg);
drivers/media/pci/intel/ivsc/Kconfig+4−1
@@ -3,7 +3,10 @@ · 2 unmodified lines
33
44 config INTEL_VSC
55 tristate "Intel Visual Sensing Controller"
6− depends on INTEL_MEI && ACPI
6+ depends on INTEL_MEI && ACPI && VIDEO_DEV
7+ select MEDIA_CONTROLLER
8+ select VIDEO_V4L2_SUBDEV_API
9+ select V4L2_ASYNC
710 help
811 This adds support for Intel Visual Sensing Controller (IVSC).
912
drivers/media/platform/marvell/Kconfig+2−2
@@ -7,7 +7,7 @@ config VIDEO_CAFE_CCIC · 6 unmodified lines
77 depends on V4L_PLATFORM_DRIVERS
88 depends on PCI && I2C && VIDEO_DEV
99 depends on COMMON_CLK
10− select VIDEO_OV7670
10+ select VIDEO_OV7670 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
1111 select VIDEOBUF2_VMALLOC
1212 select VIDEOBUF2_DMA_CONTIG
1313 select VIDEOBUF2_DMA_SG
@@ -22,7 +22,7 @@ config VIDEO_MMP_CAMERA · 8 unmodified lines
2222 depends on I2C && VIDEO_DEV
2323 depends on ARCH_MMP || COMPILE_TEST
2424 depends on COMMON_CLK
25− select VIDEO_OV7670
25+ select VIDEO_OV7670 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
2626 select I2C_GPIO
2727 select VIDEOBUF2_VMALLOC
2828 select VIDEOBUF2_DMA_CONTIG
drivers/media/platform/nxp/imx-mipi-csis.c+0−2
@@ -1490,7 +1490,6 @@ err_cleanup: · 1489 unmodified lines
14901490 v4l2_async_unregister_subdev(&csis->sd);
14911491 err_disable_clock:
14921492 mipi_csis_clk_disable(csis);
1493− fwnode_handle_put(csis->sd.fwnode);
14941493
14951494 return ret;
14961495 }
@@ -1510,7 +1509,6 @@ static void mipi_csis_remove(struct platform_device *pdev) · 13 unmodified lines
15101509 mipi_csis_clk_disable(csis);
15111510 v4l2_subdev_cleanup(&csis->sd);
15121511 media_entity_cleanup(&csis->sd.entity);
1513− fwnode_handle_put(csis->sd.fwnode);
15141512 pm_runtime_set_suspended(&pdev->dev);
15151513 }
15161514
drivers/media/platform/via/Kconfig+1−1
@@ -7,7 +7,7 @@ config VIDEO_VIA_CAMERA · 6 unmodified lines
77 depends on V4L_PLATFORM_DRIVERS
88 depends on FB_VIA && VIDEO_DEV
99 select VIDEOBUF2_DMA_SG
10− select VIDEO_OV7670
10+ select VIDEO_OV7670 if VIDEO_CAMERA_SENSOR
1111 help
1212 Driver support for the integrated camera controller in VIA
1313 Chrome9 chipsets. Currently only tested on OLPC xo-1.5 systems
drivers/media/usb/em28xx/Kconfig+2−2
@@ -12,8 +12,8 @@ config VIDEO_EM28XX_V4L2 · 11 unmodified lines
1212 select VIDEO_SAA711X if MEDIA_SUBDRV_AUTOSELECT
1313 select VIDEO_TVP5150 if MEDIA_SUBDRV_AUTOSELECT
1414 select VIDEO_MSP3400 if MEDIA_SUBDRV_AUTOSELECT
15− select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
16− select VIDEO_OV2640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
15+ select VIDEO_MT9V011 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
16+ select VIDEO_OV2640 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
1717 help
1818 This is a video4linux driver for Empia 28xx based TV cards.
1919
drivers/media/usb/go7007/Kconfig+1−1
@@ -12,8 +12,8 @@ config VIDEO_GO7007 · 11 unmodified lines
1212 select VIDEO_TW2804 if MEDIA_SUBDRV_AUTOSELECT
1313 select VIDEO_TW9903 if MEDIA_SUBDRV_AUTOSELECT
1414 select VIDEO_TW9906 if MEDIA_SUBDRV_AUTOSELECT
15− select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && MEDIA_CAMERA_SUPPORT
1615 select VIDEO_UDA1342 if MEDIA_SUBDRV_AUTOSELECT
16+ select VIDEO_OV7640 if MEDIA_SUBDRV_AUTOSELECT && VIDEO_CAMERA_SENSOR
1717 help
1818 This is a video4linux driver for the WIS GO7007 MPEG
1919 encoder chip.
drivers/media/usb/uvc/uvc_ctrl.c+3−0
@@ -1402,6 +1402,9 @@ int uvc_query_v4l2_menu(struct uvc_video_chain *chain, · 1401 unmodified lines
14021402 query_menu->id = id;
14031403 query_menu->index = index;
14041404
1405+ if (index >= BITS_PER_TYPE(mapping->menu_mask))
1406+ return -EINVAL;
1407+
14051408 ret = mutex_lock_interruptible(&chain->ctrl_mutex);
14061409 if (ret < 0)
14071410 return -ERESTARTSYS;
drivers/mfd/cs42l43.c+2−2
@@ -1178,8 +1178,8 @@ err: · 1177 unmodified lines
11781178 }
11791179
11801180 EXPORT_NS_GPL_DEV_PM_OPS(cs42l43_pm_ops, MFD_CS42L43) = {
1181− SET_SYSTEM_SLEEP_PM_OPS(cs42l43_suspend, cs42l43_resume)
1182− SET_RUNTIME_PM_OPS(cs42l43_runtime_suspend, cs42l43_runtime_resume, NULL)
1181+ SYSTEM_SLEEP_PM_OPS(cs42l43_suspend, cs42l43_resume)
1182+ RUNTIME_PM_OPS(cs42l43_runtime_suspend, cs42l43_runtime_resume, NULL)
11831183 };
11841184
11851185 MODULE_DESCRIPTION("CS42L43 Core Driver");
drivers/misc/cardreader/rts5227.c+6−49
@@ -83,63 +83,20 @@ static void rts5227_fetch_vendor_settings(struct rtsx_pcr *pcr) · 82 unmodified lines
8383
8484 static void rts5227_init_from_cfg(struct rtsx_pcr *pcr)
8585 {
86− struct pci_dev *pdev = pcr->pci;
87− int l1ss;
88− u32 lval;
8986 struct rtsx_cr_option *option = &pcr->option;
9087
91− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
92− if (!l1ss)
93− return;
94−
95− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
96−
9788 if (CHK_PCI_PID(pcr, 0x522A)) {
98− if (0 == (lval & 0x0F))
99− rtsx_pci_enable_oobs_polling(pcr);
100− else
89+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
90+ | PM_L1_1_EN | PM_L1_2_EN))
10191 rtsx_pci_disable_oobs_polling(pcr);
92+ else
93+ rtsx_pci_enable_oobs_polling(pcr);
10294 }
10395
104− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
105− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
106− else
107− rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
108−
109− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
110− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
111− else
112− rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
113−
114− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
115− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
116− else
117− rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
118−
119− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
120− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
121− else
122− rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
123−
12496 if (option->ltr_en) {
125− u16 val;
126−
127− pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &val);
128− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
129− option->ltr_enabled = true;
130− option->ltr_active = true;
97+ if (option->ltr_enabled)
13198 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
132− } else {
133− option->ltr_enabled = false;
134− }
13599 }
136−
137− if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
138− | PM_L1_1_EN | PM_L1_2_EN))
139− option->force_clkreq_0 = false;
140− else
141− option->force_clkreq_0 = true;
142−
143100 }
144101
145102 static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
@@ -195,7 +152,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr) · 49 unmodified lines
195152 }
196153 }
197154
198− if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
155+ if (option->force_clkreq_0)
199156 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG,
200157 FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
201158 else
drivers/misc/cardreader/rts5228.c+17−40
@@ -386,59 +386,25 @@ static void rts5228_process_ocp(struct rtsx_pcr *pcr) · 385 unmodified lines
386386
387387 static void rts5228_init_from_cfg(struct rtsx_pcr *pcr)
388388 {
389− struct pci_dev *pdev = pcr->pci;
390− int l1ss;
391− u32 lval;
392389 struct rtsx_cr_option *option = &pcr->option;
393390
394− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
395− if (!l1ss)
396− return;
397−
398− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
399−
400− if (0 == (lval & 0x0F))
401− rtsx_pci_enable_oobs_polling(pcr);
402− else
391+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
392+ | PM_L1_1_EN | PM_L1_2_EN))
403393 rtsx_pci_disable_oobs_polling(pcr);
404−
405− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
406− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
407− else
408− rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
409−
410− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
411− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
412− else
413− rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
414−
415− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
416− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
417394 else
418− rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
419−
420− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
421− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
422− else
423− rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
395+ rtsx_pci_enable_oobs_polling(pcr);
424396
425397 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0);
426− if (option->ltr_en) {
427− u16 val;
428398
429− pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &val);
430− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
431− option->ltr_enabled = true;
432− option->ltr_active = true;
399+ if (option->ltr_en) {
400+ if (option->ltr_enabled)
433401 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
434− } else {
435− option->ltr_enabled = false;
436− }
437402 }
438403 }
439404
440405 static int rts5228_extra_init_hw(struct rtsx_pcr *pcr)
441406 {
407+ struct rtsx_cr_option *option = &pcr->option;
442408
443409 rtsx_pci_write_register(pcr, RTS5228_AUTOLOAD_CFG1,
444410 CD_RESUME_EN_MASK, CD_RESUME_EN_MASK);
@@ -469,6 +435,17 @@ static int rts5228_extra_init_hw(struct rtsx_pcr *pcr) · 24 unmodified lines
469435 else
470436 rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
471437
438+ /*
439+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
440+ * to drive low, and we forcibly request clock.
441+ */
442+ if (option->force_clkreq_0)
443+ rtsx_pci_write_register(pcr, PETXCFG,
444+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
445+ else
446+ rtsx_pci_write_register(pcr, PETXCFG,
447+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
448+
472449 rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
473450
474451 if (pcr->rtd3_en) {
drivers/misc/cardreader/rts5249.c+7−49
@@ -86,64 +86,22 @@ static void rtsx_base_fetch_vendor_settings(struct rtsx_pcr *pcr) · 85 unmodified lines
8686
8787 static void rts5249_init_from_cfg(struct rtsx_pcr *pcr)
8888 {
89− struct pci_dev *pdev = pcr->pci;
90− int l1ss;
9189 struct rtsx_cr_option *option = &(pcr->option);
92− u32 lval;
93−
94− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
95− if (!l1ss)
96− return;
97−
98− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
9990
10091 if (CHK_PCI_PID(pcr, PID_524A) || CHK_PCI_PID(pcr, PID_525A)) {
101− if (0 == (lval & 0x0F))
102− rtsx_pci_enable_oobs_polling(pcr);
103− else
92+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
93+ | PM_L1_1_EN | PM_L1_2_EN))
10494 rtsx_pci_disable_oobs_polling(pcr);
95+ else
96+ rtsx_pci_enable_oobs_polling(pcr);
10597 }
10698
107−
108− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
109− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
110−
111− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
112− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
113−
114− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
115− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
116−
117− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
118− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
119−
12099 if (option->ltr_en) {
121− u16 val;
122−
123− pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &val);
124− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
125− option->ltr_enabled = true;
126− option->ltr_active = true;
100+ if (option->ltr_enabled)
127101 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
128− } else {
129− option->ltr_enabled = false;
130− }
131102 }
132103 }
133104
134−static int rts5249_init_from_hw(struct rtsx_pcr *pcr)
135−{
136− struct rtsx_cr_option *option = &(pcr->option);
137−
138− if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
139− | PM_L1_1_EN | PM_L1_2_EN))
140− option->force_clkreq_0 = false;
141− else
142− option->force_clkreq_0 = true;
143−
144− return 0;
145−}
146−
147105 static void rts52xa_force_power_down(struct rtsx_pcr *pcr, u8 pm_state, bool runtime)
148106 {
149107 /* Set relink_time to 0 */
@@ -276,7 +234,6 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) · 126 unmodified lines
276234 struct rtsx_cr_option *option = &(pcr->option);
277235
278236 rts5249_init_from_cfg(pcr);
279− rts5249_init_from_hw(pcr);
280237
281238 rtsx_pci_init_cmd(pcr);
282239
@@ -327,11 +284,12 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr) · 44 unmodified lines
327284 }
328285 }
329286
287+
330288 /*
331289 * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
332290 * to drive low, and we forcibly request clock.
333291 */
334− if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
292+ if (option->force_clkreq_0)
335293 rtsx_pci_write_register(pcr, PETXCFG,
336294 FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
337295 else
drivers/misc/cardreader/rts5260.c+13−30
@@ -480,47 +480,19 @@ static void rts5260_pwr_saving_setting(struct rtsx_pcr *pcr) · 479 unmodified lines
480480
481481 static void rts5260_init_from_cfg(struct rtsx_pcr *pcr)
482482 {
483− struct pci_dev *pdev = pcr->pci;
484− int l1ss;
485483 struct rtsx_cr_option *option = &pcr->option;
486− u32 lval;
487−
488− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
489− if (!l1ss)
490− return;
491−
492− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
493−
494− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
495− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
496−
497− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
498− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
499−
500− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
501− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
502−
503− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
504− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
505484
506485 rts5260_pwr_saving_setting(pcr);
507486
508487 if (option->ltr_en) {
509− u16 val;
510−
511− pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &val);
512− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
513− option->ltr_enabled = true;
514− option->ltr_active = true;
488+ if (option->ltr_enabled)
515489 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
516− } else {
517− option->ltr_enabled = false;
518− }
519490 }
520491 }
521492
522493 static int rts5260_extra_init_hw(struct rtsx_pcr *pcr)
523494 {
495+ struct rtsx_cr_option *option = &pcr->option;
524496
525497 /* Set mcu_cnt to 7 to ensure data can be sampled properly */
526498 rtsx_pci_write_register(pcr, 0xFC03, 0x7F, 0x07);
@@ -539,6 +511,17 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr) · 12 unmodified lines
539511
540512 rts5260_init_hw(pcr);
541513
514+ /*
515+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
516+ * to drive low, and we forcibly request clock.
517+ */
518+ if (option->force_clkreq_0)
519+ rtsx_pci_write_register(pcr, PETXCFG,
520+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
521+ else
522+ rtsx_pci_write_register(pcr, PETXCFG,
523+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
524+
542525 rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00);
543526
544527 return 0;
drivers/misc/cardreader/rts5261.c+13−39
@@ -454,54 +454,17 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr) · 453 unmodified lines
454454
455455 static void rts5261_init_from_cfg(struct rtsx_pcr *pcr)
456456 {
457− struct pci_dev *pdev = pcr->pci;
458− int l1ss;
459− u32 lval;
460457 struct rtsx_cr_option *option = &pcr->option;
461458
462− l1ss = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_L1SS);
463− if (!l1ss)
464− return;
465−
466− pci_read_config_dword(pdev, l1ss + PCI_L1SS_CTL1, &lval);
467−
468− if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
469− rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
470− else
471− rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
472−
473− if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
474− rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
475− else
476− rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
477−
478− if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
479− rtsx_set_dev_flag(pcr, PM_L1_1_EN);
480− else
481− rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
482−
483− if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
484− rtsx_set_dev_flag(pcr, PM_L1_2_EN);
485− else
486− rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
487−
488− rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0xFF, 0);
489459 if (option->ltr_en) {
490− u16 val;
491−
492− pcie_capability_read_word(pdev, PCI_EXP_DEVCTL2, &val);
493− if (val & PCI_EXP_DEVCTL2_LTR_EN) {
494− option->ltr_enabled = true;
495− option->ltr_active = true;
460+ if (option->ltr_enabled)
496461 rtsx_set_ltr_latency(pcr, option->ltr_active_latency);
497− } else {
498− option->ltr_enabled = false;
499− }
500462 }
501463 }
502464
503465 static int rts5261_extra_init_hw(struct rtsx_pcr *pcr)
504466 {
467+ struct rtsx_cr_option *option = &pcr->option;
505468 u32 val;
506469
507470 rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1,
@@ -547,6 +510,17 @@ static int rts5261_extra_init_hw(struct rtsx_pcr *pcr) · 39 unmodified lines
547510 else
548511 rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
549512
513+ /*
514+ * If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
515+ * to drive low, and we forcibly request clock.
516+ */
517+ if (option->force_clkreq_0)
518+ rtsx_pci_write_register(pcr, PETXCFG,
519+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
520+ else
521+ rtsx_pci_write_register(pcr, PETXCFG,
522+ FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
523+
550524 rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
551525
552526 if (pcr->rtd3_en) {
drivers/misc/cardreader/rtsx_pcr.c+46−5
@@ -1326,11 +1326,8 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 1325 unmodified lines
13261326 return err;
13271327 }
13281328
1329− if (pcr->aspm_mode == ASPM_MODE_REG) {
1329+ if (pcr->aspm_mode == ASPM_MODE_REG)
13301330 rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30);
1331− rtsx_pci_write_register(pcr, PETXCFG,
1332− FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
1333− }
13341331
13351332 /* No CD interrupt if probing driver with card inserted.
13361333 * So we need to initialize pcr->card_exist here.
@@ -1345,7 +1342,9 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) · 8 unmodified lines
13451342
13461343 static int rtsx_pci_init_chip(struct rtsx_pcr *pcr)
13471344 {
1348− int err;
1345+ struct rtsx_cr_option *option = &(pcr->option);
1346+ int err, l1ss;
1347+ u32 lval;
13491348 u16 cfg_val;
13501349 u8 val;
13511350
@@ -1430,6 +1429,48 @@ static int rtsx_pci_init_chip(struct rtsx_pcr *pcr) · 78 unmodified lines
14301429 pcr->aspm_enabled = true;
14311430 }
14321431
1432+ l1ss = pci_find_ext_capability(pcr->pci, PCI_EXT_CAP_ID_L1SS);
1433+ if (l1ss) {
1434+ pci_read_config_dword(pcr->pci, l1ss + PCI_L1SS_CTL1, &lval);
1435+
1436+ if (lval & PCI_L1SS_CTL1_ASPM_L1_1)
1437+ rtsx_set_dev_flag(pcr, ASPM_L1_1_EN);
1438+ else
1439+ rtsx_clear_dev_flag(pcr, ASPM_L1_1_EN);
1440+
1441+ if (lval & PCI_L1SS_CTL1_ASPM_L1_2)
1442+ rtsx_set_dev_flag(pcr, ASPM_L1_2_EN);
1443+ else
1444+ rtsx_clear_dev_flag(pcr, ASPM_L1_2_EN);
1445+
1446+ if (lval & PCI_L1SS_CTL1_PCIPM_L1_1)
1447+ rtsx_set_dev_flag(pcr, PM_L1_1_EN);
1448+ else
1449+ rtsx_clear_dev_flag(pcr, PM_L1_1_EN);
1450+
1451+ if (lval & PCI_L1SS_CTL1_PCIPM_L1_2)
1452+ rtsx_set_dev_flag(pcr, PM_L1_2_EN);
1453+ else
1454+ rtsx_clear_dev_flag(pcr, PM_L1_2_EN);
1455+
1456+ pcie_capability_read_word(pcr->pci, PCI_EXP_DEVCTL2, &cfg_val);
1457+ if (cfg_val & PCI_EXP_DEVCTL2_LTR_EN) {
1458+ option->ltr_enabled = true;
1459+ option->ltr_active = true;
1460+ } else {
1461+ option->ltr_enabled = false;
1462+ }
1463+
1464+ if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
1465+ | PM_L1_1_EN | PM_L1_2_EN))
1466+ option->force_clkreq_0 = false;
1467+ else
1468+ option->force_clkreq_0 = true;
1469+ } else {
1470+ option->ltr_enabled = false;
1471+ option->force_clkreq_0 = true;
1472+ }
1473+
14331474 if (pcr->ops->fetch_vendor_settings)
14341475 pcr->ops->fetch_vendor_settings(pcr);
14351476
drivers/net/dsa/sja1105/sja1105.h+2−0
@@ -266,6 +266,8 @@ struct sja1105_private { · 265 unmodified lines
266266 * the switch doesn't confuse them with one another.
267267 */
268268 struct mutex mgmt_lock;
269+ /* Serializes accesses to the FDB */
270+ struct mutex fdb_lock;
269271 /* PTP two-step TX timestamp ID, and its serialization lock */
270272 spinlock_t ts_id_lock;
271273 u8 ts_id;
drivers/net/dsa/sja1105/sja1105_dynamic_config.c+44−49
@@ -1175,18 +1175,15 @@ const struct sja1105_dynamic_table_ops sja1110_dyn_ops[BLK_IDX_MAX_DYN] = { · 1174 unmodified lines
11751175
11761176 static int
11771177 sja1105_dynamic_config_poll_valid(struct sja1105_private *priv,
1178− struct sja1105_dyn_cmd *cmd,
1179− const struct sja1105_dynamic_table_ops *ops)
1178+ const struct sja1105_dynamic_table_ops *ops,
1179+ void *entry, bool check_valident,
1180+ bool check_errors)
11801181 {
11811182 u8 packed_buf[SJA1105_MAX_DYN_CMD_SIZE] = {};
1183+ struct sja1105_dyn_cmd cmd = {};
11821184 int rc;
11831185
1184− /* We don't _need_ to read the full entry, just the command area which
1185− * is a fixed SJA1105_SIZE_DYN_CMD. But our cmd_packing() API expects a
1186− * buffer that contains the full entry too. Additionally, our API
1187− * doesn't really know how many bytes into the buffer does the command
1188− * area really begin. So just read back the whole entry.
1189− */
1186+ /* Read back the whole entry + command structure. */
11901187 rc = sja1105_xfer_buf(priv, SPI_READ, ops->addr, packed_buf,
11911188 ops->packed_size);
11921189 if (rc)
@@ -1195,11 +1192,25 @@ sja1105_dynamic_config_poll_valid(struct sja1105_private *priv, · 2 unmodified lines
11951192 /* Unpack the command structure, and return it to the caller in case it
11961193 * needs to perform further checks on it (VALIDENT).
11971194 */
1198− memset(cmd, 0, sizeof(*cmd));
1199− ops->cmd_packing(packed_buf, cmd, UNPACK);
1195+ ops->cmd_packing(packed_buf, &cmd, UNPACK);
12001196
12011197 /* Hardware hasn't cleared VALID => still working on it */
1202− return cmd->valid ? -EAGAIN : 0;
1198+ if (cmd.valid)
1199+ return -EAGAIN;
1200+
1201+ if (check_valident && !cmd.valident && !(ops->access & OP_VALID_ANYWAY))
1202+ return -ENOENT;
1203+
1204+ if (check_errors && cmd.errors)
1205+ return -EINVAL;
1206+
1207+ /* Don't dereference possibly NULL pointer - maybe caller
1208+ * only wanted to see whether the entry existed or not.
1209+ */
1210+ if (entry)
1211+ ops->entry_packing(packed_buf, entry, UNPACK);
1212+
1213+ return 0;
12031214 }
12041215
12051216 /* Poll the dynamic config entry's control area until the hardware has
@@ -1208,16 +1219,19 @@ sja1105_dynamic_config_poll_valid(struct sja1105_private *priv, · 2 unmodified lines
12081219 */
12091220 static int
12101221 sja1105_dynamic_config_wait_complete(struct sja1105_private *priv,
1211− struct sja1105_dyn_cmd *cmd,
1212− const struct sja1105_dynamic_table_ops *ops)
1222+ const struct sja1105_dynamic_table_ops *ops,
1223+ void *entry, bool check_valident,
1224+ bool check_errors)
12131225 {
1214− int rc;
1215−
1216− return read_poll_timeout(sja1105_dynamic_config_poll_valid,
1217− rc, rc != -EAGAIN,
1218− SJA1105_DYNAMIC_CONFIG_SLEEP_US,
1219− SJA1105_DYNAMIC_CONFIG_TIMEOUT_US,
1220− false, priv, cmd, ops);
1226+ int err, rc;
1227+
1228+ err = read_poll_timeout(sja1105_dynamic_config_poll_valid,
1229+ rc, rc != -EAGAIN,
1230+ SJA1105_DYNAMIC_CONFIG_SLEEP_US,
1231+ SJA1105_DYNAMIC_CONFIG_TIMEOUT_US,
1232+ false, priv, ops, entry, check_valident,
1233+ check_errors);
1234+ return err < 0 ? err : rc;
12211235 }
12221236
12231237 /* Provides read access to the settings through the dynamic interface
@@ -1286,25 +1300,14 @@ int sja1105_dynamic_config_read(struct sja1105_private *priv, · 62 unmodified lines
12861300 mutex_lock(&priv->dynamic_config_lock);
12871301 rc = sja1105_xfer_buf(priv, SPI_WRITE, ops->addr, packed_buf,
12881302 ops->packed_size);
1289− if (rc < 0) {
1290− mutex_unlock(&priv->dynamic_config_lock);
1291− return rc;
1292− }
1293−
1294− rc = sja1105_dynamic_config_wait_complete(priv, &cmd, ops);
1295− mutex_unlock(&priv->dynamic_config_lock);
12961303 if (rc < 0)
1297− return rc;
1304+ goto out;
12981305
1299− if (!cmd.valident && !(ops->access & OP_VALID_ANYWAY))
1300− return -ENOENT;
1306+ rc = sja1105_dynamic_config_wait_complete(priv, ops, entry, true, false);
1307+out:
1308+ mutex_unlock(&priv->dynamic_config_lock);
13011309
1302− /* Don't dereference possibly NULL pointer - maybe caller
1303− * only wanted to see whether the entry existed or not.
1304− */
1305− if (entry)
1306− ops->entry_packing(packed_buf, entry, UNPACK);
1307− return 0;
1310+ return rc;
13081311 }
13091312
13101313 int sja1105_dynamic_config_write(struct sja1105_private *priv,
@@ -1356,22 +1359,14 @@ int sja1105_dynamic_config_write(struct sja1105_private *priv, · 45 unmodified lines
13561359 mutex_lock(&priv->dynamic_config_lock);
13571360 rc = sja1105_xfer_buf(priv, SPI_WRITE, ops->addr, packed_buf,
13581361 ops->packed_size);
1359− if (rc < 0) {
1360− mutex_unlock(&priv->dynamic_config_lock);
1361− return rc;
1362− }
1363−
1364− rc = sja1105_dynamic_config_wait_complete(priv, &cmd, ops);
1365− mutex_unlock(&priv->dynamic_config_lock);
13661362 if (rc < 0)
1367− return rc;
1363+ goto out;
13681364
1369− cmd = (struct sja1105_dyn_cmd) {0};
1370− ops->cmd_packing(packed_buf, &cmd, UNPACK);
1371− if (cmd.errors)
1372− return -EINVAL;
1365+ rc = sja1105_dynamic_config_wait_complete(priv, ops, NULL, false, true);
1366+out:
1367+ mutex_unlock(&priv->dynamic_config_lock);
13731368
1374− return 0;
1369+ return rc;
13751370 }
13761371
13771372 static u8 sja1105_crc8_add(u8 crc, u8 byte, u8 poly)
drivers/net/dsa/sja1105/sja1105_main.c+51−18
@@ -1798,6 +1798,7 @@ static int sja1105_fdb_add(struct dsa_switch *ds, int port, · 1797 unmodified lines
17981798 struct dsa_db db)
17991799 {
18001800 struct sja1105_private *priv = ds->priv;
1801+ int rc;
18011802
18021803 if (!vid) {
18031804 switch (db.type) {
@@ -1812,12 +1813,16 @@ static int sja1105_fdb_add(struct dsa_switch *ds, int port, · 8 unmodified lines
18121813 }
18131814 }
18141815
1815− return priv->info->fdb_add_cmd(ds, port, addr, vid);
1816+ mutex_lock(&priv->fdb_lock);
1817+ rc = priv->info->fdb_add_cmd(ds, port, addr, vid);
1818+ mutex_unlock(&priv->fdb_lock);
1819+
1820+ return rc;
18161821 }
18171822
1818−static int sja1105_fdb_del(struct dsa_switch *ds, int port,
1819− const unsigned char *addr, u16 vid,
1820− struct dsa_db db)
1823+static int __sja1105_fdb_del(struct dsa_switch *ds, int port,
1824+ const unsigned char *addr, u16 vid,
1825+ struct dsa_db db)
18211826 {
18221827 struct sja1105_private *priv = ds->priv;
18231828
@@ -1837,6 +1842,20 @@ static int sja1105_fdb_del(struct dsa_switch *ds, int port, · 13 unmodified lines
18371842 return priv->info->fdb_del_cmd(ds, port, addr, vid);
18381843 }
18391844
1845+static int sja1105_fdb_del(struct dsa_switch *ds, int port,
1846+ const unsigned char *addr, u16 vid,
1847+ struct dsa_db db)
1848+{
1849+ struct sja1105_private *priv = ds->priv;
1850+ int rc;
1851+
1852+ mutex_lock(&priv->fdb_lock);
1853+ rc = __sja1105_fdb_del(ds, port, addr, vid, db);
1854+ mutex_unlock(&priv->fdb_lock);
1855+
1856+ return rc;
1857+}
1858+
18401859 static int sja1105_fdb_dump(struct dsa_switch *ds, int port,
18411860 dsa_fdb_dump_cb_t *cb, void *data)
18421861 {
@@ -1868,13 +1887,14 @@ static int sja1105_fdb_dump(struct dsa_switch *ds, int port, · 25 unmodified lines
18681887 if (!(l2_lookup.destports & BIT(port)))
18691888 continue;
18701889
1871− /* We need to hide the FDB entry for unknown multicast */
1872− if (l2_lookup.macaddr == SJA1105_UNKNOWN_MULTICAST &&
1873− l2_lookup.mask_macaddr == SJA1105_UNKNOWN_MULTICAST)
1874− continue;
1875−
18761890 u64_to_ether_addr(l2_lookup.macaddr, macaddr);
18771891
1892+ /* Hardware FDB is shared for fdb and mdb, "bridge fdb show"
1893+ * only wants to see unicast
1894+ */
1895+ if (is_multicast_ether_addr(macaddr))
1896+ continue;
1897+
18781898 /* We need to hide the dsa_8021q VLANs from the user. */
18791899 if (vid_is_dsa_8021q(l2_lookup.vlanid))
18801900 l2_lookup.vlanid = 0;
@@ -1898,6 +1918,8 @@ static void sja1105_fast_age(struct dsa_switch *ds, int port) · 17 unmodified lines
18981918 };
18991919 int i;
19001920
1921+ mutex_lock(&priv->fdb_lock);
1922+
19011923 for (i = 0; i < SJA1105_MAX_L2_LOOKUP_COUNT; i++) {
19021924 struct sja1105_l2_lookup_entry l2_lookup = {0};
19031925 u8 macaddr[ETH_ALEN];
@@ -1911,7 +1933,7 @@ static void sja1105_fast_age(struct dsa_switch *ds, int port) · 7 unmodified lines
19111933 if (rc) {
19121934 dev_err(ds->dev, "Failed to read FDB: %pe\n",
19131935 ERR_PTR(rc));
1914− return;
1936+ break;
19151937 }
19161938
19171939 if (!(l2_lookup.destports & BIT(port)))
@@ -1923,14 +1945,16 @@ static void sja1105_fast_age(struct dsa_switch *ds, int port) · 5 unmodified lines
19231945
19241946 u64_to_ether_addr(l2_lookup.macaddr, macaddr);
19251947
1926− rc = sja1105_fdb_del(ds, port, macaddr, l2_lookup.vlanid, db);
1948+ rc = __sja1105_fdb_del(ds, port, macaddr, l2_lookup.vlanid, db);
19271949 if (rc) {
19281950 dev_err(ds->dev,
19291951 "Failed to delete FDB entry %pM vid %lld: %pe\n",
19301952 macaddr, l2_lookup.vlanid, ERR_PTR(rc));
1931− return;
1953+ break;
19321954 }
19331955 }
1956+
1957+ mutex_unlock(&priv->fdb_lock);
19341958 }
19351959
19361960 static int sja1105_mdb_add(struct dsa_switch *ds, int port,
@@ -2273,6 +2297,7 @@ int sja1105_static_config_reload(struct sja1105_private *priv, · 336 unmodified lines
22732297 int rc, i;
22742298 s64 now;
22752299
2300+ mutex_lock(&priv->fdb_lock);
22762301 mutex_lock(&priv->mgmt_lock);
22772302
22782303 mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries;
@@ -2385,6 +2410,7 @@ int sja1105_static_config_reload(struct sja1105_private *priv, · 106 unmodified lines
23852410 goto out;
23862411 out:
23872412 mutex_unlock(&priv->mgmt_lock);
2413+ mutex_unlock(&priv->fdb_lock);
23882414
23892415 return rc;
23902416 }
@@ -2954,7 +2980,9 @@ static int sja1105_port_mcast_flood(struct sja1105_private *priv, int to, · 563 unmodified lines
29542980 {
29552981 struct sja1105_l2_lookup_entry *l2_lookup;
29562982 struct sja1105_table *table;
2957− int match;
2983+ int match, rc;
2984+
2985+ mutex_lock(&priv->fdb_lock);
29582986
29592987 table = &priv->static_config.tables[BLK_IDX_L2_LOOKUP];
29602988 l2_lookup = table->entries;
@@ -2967,7 +2995,8 @@ static int sja1105_port_mcast_flood(struct sja1105_private *priv, int to, · 6 unmodified lines
29672995 if (match == table->entry_count) {
29682996 NL_SET_ERR_MSG_MOD(extack,
29692997 "Could not find FDB entry for unknown multicast");
2970− return -ENOSPC;
2998+ rc = -ENOSPC;
2999+ goto out;
29713000 }
29723001
29733002 if (flags.val & BR_MCAST_FLOOD)
@@ -2975,10 +3004,13 @@ static int sja1105_port_mcast_flood(struct sja1105_private *priv, int to, · 1 unmodified line
29753004 else
29763005 l2_lookup[match].destports &= ~BIT(to);
29773006
2978− return sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP,
2979− l2_lookup[match].index,
2980− &l2_lookup[match],
2981− true);
3007+ rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP,
3008+ l2_lookup[match].index,
3009+ &l2_lookup[match], true);
3010+out:
3011+ mutex_unlock(&priv->fdb_lock);
3012+
3013+ return rc;
29823014 }
29833015
29843016 static int sja1105_port_pre_bridge_flags(struct dsa_switch *ds, int port,
@@ -3348,6 +3380,7 @@ static int sja1105_probe(struct spi_device *spi) · 363 unmodified lines
33483380 mutex_init(&priv->ptp_data.lock);
33493381 mutex_init(&priv->dynamic_config_lock);
33503382 mutex_init(&priv->mgmt_lock);
3383+ mutex_init(&priv->fdb_lock);
33513384 spin_lock_init(&priv->ts_id_lock);
33523385
33533386 rc = sja1105_parse_dt(priv);
drivers/net/ethernet/adi/adin1110.c+1−1
@@ -1385,7 +1385,7 @@ static int adin1110_fdb_add(struct adin1110_port_priv *port_priv, · 1384 unmodified lines
13851385 return -ENOMEM;
13861386
13871387 other_port = priv->ports[!port_priv->nr];
1388− port_rules = adin1110_port_rules(port_priv, false, true);
1388+ port_rules = adin1110_port_rules(other_port, false, true);
13891389 eth_broadcast_addr(mask);
13901390
13911391 return adin1110_write_mac_address(other_port, mac_nr, (u8 *)fdb->addr,
drivers/net/ethernet/amazon/ena/ena_netdev.c+3−0
@@ -1833,6 +1833,9 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi, · 1832 unmodified lines
18331833 return work_done;
18341834
18351835 error:
1836+ if (xdp_flags & ENA_XDP_REDIRECT)
1837+ xdp_do_flush();
1838+
18361839 adapter = netdev_priv(rx_ring->netdev);
18371840
18381841 if (rc == -ENOSPC) {
drivers/net/ethernet/broadcom/asp2/bcmasp.c+8−2
@@ -528,13 +528,16 @@ void bcmasp_netfilt_suspend(struct bcmasp_intf *intf) · 527 unmodified lines
528528 ASP_RX_FILTER_BLK_CTRL);
529529 }
530530
531−void bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
532− u32 *rule_cnt)
531+int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
532+ u32 *rule_cnt)
533533 {
534534 struct bcmasp_priv *priv = intf->parent;
535535 int j = 0, i;
536536
537537 for (i = 0; i < NUM_NET_FILTERS; i++) {
538+ if (j == *rule_cnt)
539+ return -EMSGSIZE;
540+
538541 if (!priv->net_filters[i].claimed ||
539542 priv->net_filters[i].port != intf->port)
540543 continue;
@@ -548,6 +551,8 @@ void bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs, · 7 unmodified lines
548551 }
549552
550553 *rule_cnt = j;
554+
555+ return 0;
551556 }
552557
553558 int bcmasp_netfilt_get_active(struct bcmasp_intf *intf)
@@ -1300,6 +1305,7 @@ static int bcmasp_probe(struct platform_device *pdev) · 746 unmodified lines
13001305 if (!intf) {
13011306 dev_err(dev, "Cannot create eth interface %d\n", i);
13021307 bcmasp_remove_intfs(priv);
1308+ of_node_put(intf_node);
13031309 goto of_put_exit;
13041310 }
13051311 list_add_tail(&intf->list, &priv->intfs);
drivers/net/ethernet/broadcom/asp2/bcmasp.h+2−2
@@ -577,8 +577,8 @@ void bcmasp_netfilt_release(struct bcmasp_intf *intf, · 576 unmodified lines
577577
578578 int bcmasp_netfilt_get_active(struct bcmasp_intf *intf);
579579
580−void bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
581− u32 *rule_cnt);
580+int bcmasp_netfilt_get_all_active(struct bcmasp_intf *intf, u32 *rule_locs,
581+ u32 *rule_cnt);
582582
583583 void bcmasp_netfilt_suspend(struct bcmasp_intf *intf);
584584
drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c+1−1
@@ -335,7 +335,7 @@ static int bcmasp_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, · 334 unmodified lines
335335 err = bcmasp_flow_get(intf, cmd);
336336 break;
337337 case ETHTOOL_GRXCLSRLALL:
338− bcmasp_netfilt_get_all_active(intf, rule_locs, &cmd->rule_cnt);
338+ err = bcmasp_netfilt_get_all_active(intf, rule_locs, &cmd->rule_cnt);
339339 cmd->data = NUM_NET_FILTERS;
340340 break;
341341 default:
drivers/net/ethernet/broadcom/bnxt/bnxt.c+5−0
@@ -2614,6 +2614,7 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget) · 2613 unmodified lines
26142614 struct rx_cmp_ext *rxcmp1;
26152615 u32 cp_cons, tmp_raw_cons;
26162616 u32 raw_cons = cpr->cp_raw_cons;
2617+ bool flush_xdp = false;
26172618 u32 rx_pkts = 0;
26182619 u8 event = 0;
26192620
@@ -2648,6 +2649,8 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget) · 28 unmodified lines
26482649 rx_pkts++;
26492650 else if (rc == -EBUSY) /* partial completion */
26502651 break;
2652+ if (event & BNXT_REDIRECT_EVENT)
2653+ flush_xdp = true;
26512654 } else if (unlikely(TX_CMP_TYPE(txcmp) ==
26522655 CMPL_BASE_TYPE_HWRM_DONE)) {
26532656 bnxt_hwrm_handler(bp, txcmp);
@@ -2667,6 +2670,8 @@ static int bnxt_poll_nitroa0(struct napi_struct *napi, int budget) · 13 unmodified lines
26672670
26682671 if (event & BNXT_AGG_EVENT)
26692672 bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod);
2673+ if (flush_xdp)
2674+ xdp_do_flush();
26702675
26712676 if (!bnxt_has_work(bp, cpr) && rx_pkts < budget) {
26722677 napi_complete_done(napi, rx_pkts);
drivers/net/ethernet/cadence/macb_main.c+3−2
@@ -756,8 +756,6 @@ static void macb_mac_link_up(struct phylink_config *config, · 755 unmodified lines
756756 if (rx_pause)
757757 ctrl |= MACB_BIT(PAE);
758758
759− macb_set_tx_clk(bp, speed);
760−
761759 /* Initialize rings & buffers as clearing MACB_BIT(TE) in link down
762760 * cleared the pipeline and control registers.
763761 */
@@ -777,6 +775,9 @@ static void macb_mac_link_up(struct phylink_config *config, · 13 unmodified lines
777775
778776 spin_unlock_irqrestore(&bp->lock, flags);
779777
778+ if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC))
779+ macb_set_tx_clk(bp, speed);
780+
780781 /* Enable Rx and Tx; Enable PTP unicast */
781782 ctrl = macb_readl(bp, NCR);
782783 if (gem_has_ptp(bp))
drivers/net/ethernet/engleder/tsnep_ethtool.c+2−4
@@ -300,10 +300,8 @@ static void tsnep_ethtool_get_channels(struct net_device *netdev, · 299 unmodified lines
300300 {
301301 struct tsnep_adapter *adapter = netdev_priv(netdev);
302302
303− ch->max_rx = adapter->num_rx_queues;
304− ch->max_tx = adapter->num_tx_queues;
305− ch->rx_count = adapter->num_rx_queues;
306− ch->tx_count = adapter->num_tx_queues;
303+ ch->max_combined = adapter->num_queues;
304+ ch->combined_count = adapter->num_queues;
307305 }
308306
309307 static int tsnep_ethtool_get_ts_info(struct net_device *netdev,
drivers/net/ethernet/engleder/tsnep_main.c+14−4
@@ -87,8 +87,11 @@ static irqreturn_t tsnep_irq(int irq, void *arg) · 86 unmodified lines
8787
8888 /* handle TX/RX queue 0 interrupt */
8989 if ((active & adapter->queue[0].irq_mask) != 0) {
90− tsnep_disable_irq(adapter, adapter->queue[0].irq_mask);
91− napi_schedule(&adapter->queue[0].napi);
90+ if (napi_schedule_prep(&adapter->queue[0].napi)) {
91+ tsnep_disable_irq(adapter, adapter->queue[0].irq_mask);
92+ /* schedule after masking to avoid races */
93+ __napi_schedule(&adapter->queue[0].napi);
94+ }
9295 }
9396
9497 return IRQ_HANDLED;
@@ -99,8 +102,11 @@ static irqreturn_t tsnep_irq_txrx(int irq, void *arg) · 4 unmodified lines
99102 struct tsnep_queue *queue = arg;
100103
101104 /* handle TX/RX queue interrupt */
102− tsnep_disable_irq(queue->adapter, queue->irq_mask);
103− napi_schedule(&queue->napi);
105+ if (napi_schedule_prep(&queue->napi)) {
106+ tsnep_disable_irq(queue->adapter, queue->irq_mask);
107+ /* schedule after masking to avoid races */
108+ __napi_schedule(&queue->napi);
109+ }
104110
105111 return IRQ_HANDLED;
106112 }
@@ -1728,6 +1734,10 @@ static int tsnep_poll(struct napi_struct *napi, int budget) · 1621 unmodified lines
17281734 if (queue->tx)
17291735 complete = tsnep_tx_poll(queue->tx, budget);
17301736
1737+ /* handle case where we are called by netpoll with a budget of 0 */
1738+ if (unlikely(budget <= 0))
1739+ return budget;
1740+
17311741 if (queue->rx) {
17321742 done = queue->rx->xsk_pool ?
17331743 tsnep_rx_poll_zc(queue->rx, napi, budget) :
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c+9−0
@@ -3353,6 +3353,15 @@ static void hns3_set_default_feature(struct net_device *netdev) · 3352 unmodified lines
33533353 NETIF_F_HW_TC);
33543354
33553355 netdev->hw_enc_features |= netdev->vlan_features | NETIF_F_TSO_MANGLEID;
3356+
3357+ /* The device_version V3 hardware can't offload the checksum for IP in
3358+ * GRE packets, but can do it for NvGRE. So default to disable the
3359+ * checksum and GSO offload for GRE.
3360+ */
3361+ if (ae_dev->dev_version > HNAE3_DEVICE_VERSION_V2) {
3362+ netdev->features &= ~NETIF_F_GSO_GRE;
3363+ netdev->features &= ~NETIF_F_GSO_GRE_CSUM;
3364+ }
33563365 }
33573366
33583367 static int hns3_alloc_buffer(struct hns3_enet_ring *ring,
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c+12−1
@@ -3564,9 +3564,14 @@ static u32 hclge_check_event_cause(struct hclge_dev *hdev, u32 *clearval) · 3563 unmodified lines
35643564 static void hclge_clear_event_cause(struct hclge_dev *hdev, u32 event_type,
35653565 u32 regclr)
35663566 {
3567+#define HCLGE_IMP_RESET_DELAY 5
3568+
35673569 switch (event_type) {
35683570 case HCLGE_VECTOR0_EVENT_PTP:
35693571 case HCLGE_VECTOR0_EVENT_RST:
3572+ if (regclr == BIT(HCLGE_VECTOR0_IMPRESET_INT_B))
3573+ mdelay(HCLGE_IMP_RESET_DELAY);
3574+
35703575 hclge_write_dev(&hdev->hw, HCLGE_MISC_RESET_STS_REG, regclr);
35713576 break;
35723577 case HCLGE_VECTOR0_EVENT_MBX:
@@ -7348,6 +7353,12 @@ static int hclge_del_cls_flower(struct hnae3_handle *handle, · 3775 unmodified lines
73487353 ret = hclge_fd_tcam_config(hdev, HCLGE_FD_STAGE_1, true, rule->location,
73497354 NULL, false);
73507355 if (ret) {
7356+ /* if tcam config fail, set rule state to TO_DEL,
7357+ * so the rule will be deleted when periodic
7358+ * task being scheduled.
7359+ */
7360+ hclge_update_fd_list(hdev, HCLGE_FD_TO_DEL, rule->location, NULL);
7361+ set_bit(HCLGE_STATE_FD_TBL_CHANGED, &hdev->state);
73517362 spin_unlock_bh(&hdev->fd_rule_lock);
73527363 return ret;
73537364 }
@@ -8824,7 +8835,7 @@ static void hclge_update_overflow_flags(struct hclge_vport *vport, · 1470 unmodified lines
88248835 if (mac_type == HCLGE_MAC_ADDR_UC) {
88258836 if (is_all_added)
88268837 vport->overflow_promisc_flags &= ~HNAE3_OVERFLOW_UPE;
8827− else
8838+ else if (hclge_is_umv_space_full(vport, true))
88288839 vport->overflow_promisc_flags |= HNAE3_OVERFLOW_UPE;
88298840 } else {
88308841 if (is_all_added)
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c+2−1
@@ -1855,7 +1855,8 @@ static void hclgevf_periodic_service_task(struct hclgevf_dev *hdev) · 1854 unmodified lines
18551855 unsigned long delta = round_jiffies_relative(HZ);
18561856 struct hnae3_handle *handle = &hdev->nic;
18571857
1858− if (test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state))
1858+ if (test_bit(HCLGEVF_STATE_RST_FAIL, &hdev->state) ||
1859+ test_bit(HCLGE_COMM_STATE_CMD_DISABLE, &hdev->hw.hw.comm_state))
18591860 return;
18601861
18611862 if (time_is_after_jiffies(hdev->last_serv_processed + HZ)) {
drivers/net/ethernet/huawei/hinic/hinic_port.c+0−3
@@ -456,9 +456,6 @@ int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en) · 455 unmodified lines
456456 u16 out_size = sizeof(vlan_filter);
457457 int err;
458458
459− if (!hwdev)
460− return -EINVAL;
461−
462459 vlan_filter.func_idx = HINIC_HWIF_FUNC_IDX(hwif);
463460 vlan_filter.enable = en;
464461
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c+5−3
@@ -4475,9 +4475,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 4474 unmodified lines
44754475 goto error_pvid;
44764476
44774477 i40e_vlan_stripping_enable(vsi);
4478− i40e_vc_reset_vf(vf, true);
4479− /* During reset the VF got a new VSI, so refresh a pointer. */
4480− vsi = pf->vsi[vf->lan_vsi_idx];
4478+
44814479 /* Locked once because multiple functions below iterate list */
44824480 spin_lock_bh(&vsi->mac_filter_hash_lock);
44834481
@@ -4563,6 +4561,10 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int vf_id, · 79 unmodified lines
45634561 */
45644562 vf->port_vlan_id = le16_to_cpu(vsi->info.pvid);
45654563
4564+ i40e_vc_reset_vf(vf, true);
4565+ /* During reset the VF got a new VSI, so refresh a pointer. */
4566+ vsi = pf->vsi[vf->lan_vsi_idx];
4567+
45664568 ret = i40e_config_vf_promiscuous_mode(vf, vsi->id, allmulti, alluni);
45674569 if (ret) {
45684570 dev_err(&pf->pdev->dev, "Unable to config vf promiscuous mode\n");
drivers/net/ethernet/intel/iavf/iavf.h+1−1
@@ -521,7 +521,7 @@ void iavf_down(struct iavf_adapter *adapter); · 520 unmodified lines
521521 int iavf_process_config(struct iavf_adapter *adapter);
522522 int iavf_parse_vf_resource_msg(struct iavf_adapter *adapter);
523523 void iavf_schedule_reset(struct iavf_adapter *adapter, u64 flags);
524−void iavf_schedule_request_stats(struct iavf_adapter *adapter);
524+void iavf_schedule_aq_request(struct iavf_adapter *adapter, u64 flags);
525525 void iavf_schedule_finish_config(struct iavf_adapter *adapter);
526526 void iavf_reset(struct iavf_adapter *adapter);
527527 void iavf_set_ethtool_ops(struct net_device *netdev);
drivers/net/ethernet/intel/iavf/iavf_ethtool.c+1−1
@@ -362,7 +362,7 @@ static void iavf_get_ethtool_stats(struct net_device *netdev, · 361 unmodified lines
362362 unsigned int i;
363363
364364 /* Explicitly request stats refresh */
365− iavf_schedule_request_stats(adapter);
365+ iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_REQUEST_STATS);
366366
367367 iavf_add_ethtool_stats(&data, adapter, iavf_gstrings_stats);
368368
drivers/net/ethernet/intel/iavf/iavf_main.c+8−9
@@ -314,15 +314,13 @@ void iavf_schedule_reset(struct iavf_adapter *adapter, u64 flags) · 313 unmodified lines
314314 }
315315
316316 /**
317− * iavf_schedule_request_stats - Set the flags and schedule statistics request
317+ * iavf_schedule_aq_request - Set the flags and schedule aq request
318318 * @adapter: board private structure
319− *
320− * Sets IAVF_FLAG_AQ_REQUEST_STATS flag so iavf_watchdog_task() will explicitly
321− * request and refresh ethtool stats
319+ * @flags: requested aq flags
322320 **/
323−void iavf_schedule_request_stats(struct iavf_adapter *adapter)
321+void iavf_schedule_aq_request(struct iavf_adapter *adapter, u64 flags)
324322 {
325− adapter->aq_required |= IAVF_FLAG_AQ_REQUEST_STATS;
323+ adapter->aq_required |= flags;
326324 mod_delayed_work(adapter->wq, &adapter->watchdog_task, 0);
327325 }
328326
@@ -823,7 +821,7 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter, · 494 unmodified lines
823821 list_add_tail(&f->list, &adapter->vlan_filter_list);
824822 f->state = IAVF_VLAN_ADD;
825823 adapter->num_vlan_filters++;
826− adapter->aq_required |= IAVF_FLAG_AQ_ADD_VLAN_FILTER;
824+ iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_VLAN_FILTER);
827825 }
828826
829827 clearout:
@@ -845,7 +843,7 @@ static void iavf_del_vlan(struct iavf_adapter *adapter, struct iavf_vlan vlan) · 15 unmodified lines
845843 f = iavf_find_vlan(adapter, vlan);
846844 if (f) {
847845 f->state = IAVF_VLAN_REMOVE;
848− adapter->aq_required |= IAVF_FLAG_AQ_DEL_VLAN_FILTER;
846+ iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_DEL_VLAN_FILTER);
849847 }
850848
851849 spin_unlock_bh(&adapter->mac_vlan_list_lock);
@@ -1421,7 +1419,8 @@ void iavf_down(struct iavf_adapter *adapter) · 569 unmodified lines
14211419 iavf_clear_fdir_filters(adapter);
14221420 iavf_clear_adv_rss_conf(adapter);
14231421
1424− if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)) {
1422+ if (!(adapter->flags & IAVF_FLAG_PF_COMMS_FAILED) &&
1423+ !(test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section))) {
14251424 /* cancel any current operation */
14261425 adapter->current_op = VIRTCHNL_OP_UNKNOWN;
14271426 /* Schedule operations to close down the HW. Don't wait
drivers/net/ethernet/intel/igb/igb_main.c+4−1
@@ -3827,8 +3827,11 @@ static int igb_enable_sriov(struct pci_dev *pdev, int num_vfs, bool reinit) · 3826 unmodified lines
38273827 }
38283828
38293829 /* only call pci_enable_sriov() if no VFs are allocated already */
3830− if (!old_vfs)
3830+ if (!old_vfs) {
38313831 err = pci_enable_sriov(pdev, adapter->vfs_allocated_count);
3832+ if (err)
3833+ goto err_out;
3834+ }
38323835
38333836 goto out;
38343837
drivers/net/ethernet/intel/igc/igc_ethtool.c+19−12
@@ -868,6 +868,18 @@ static void igc_ethtool_get_stats(struct net_device *netdev, · 867 unmodified lines
868868 spin_unlock(&adapter->stats64_lock);
869869 }
870870
871+static int igc_ethtool_get_previous_rx_coalesce(struct igc_adapter *adapter)
872+{
873+ return (adapter->rx_itr_setting <= 3) ?
874+ adapter->rx_itr_setting : adapter->rx_itr_setting >> 2;
875+}
876+
877+static int igc_ethtool_get_previous_tx_coalesce(struct igc_adapter *adapter)
878+{
879+ return (adapter->tx_itr_setting <= 3) ?
880+ adapter->tx_itr_setting : adapter->tx_itr_setting >> 2;
881+}
882+
871883 static int igc_ethtool_get_coalesce(struct net_device *netdev,
872884 struct ethtool_coalesce *ec,
873885 struct kernel_ethtool_coalesce *kernel_coal,
@@ -875,17 +887,8 @@ static int igc_ethtool_get_coalesce(struct net_device *netdev, · 1 unmodified line
875887 {
876888 struct igc_adapter *adapter = netdev_priv(netdev);
877889
878− if (adapter->rx_itr_setting <= 3)
879− ec->rx_coalesce_usecs = adapter->rx_itr_setting;
880− else
881− ec->rx_coalesce_usecs = adapter->rx_itr_setting >> 2;
882−
883− if (!(adapter->flags & IGC_FLAG_QUEUE_PAIRS)) {
884− if (adapter->tx_itr_setting <= 3)
885− ec->tx_coalesce_usecs = adapter->tx_itr_setting;
886− else
887− ec->tx_coalesce_usecs = adapter->tx_itr_setting >> 2;
888− }
890+ ec->rx_coalesce_usecs = igc_ethtool_get_previous_rx_coalesce(adapter);
891+ ec->tx_coalesce_usecs = igc_ethtool_get_previous_tx_coalesce(adapter);
889892
890893 return 0;
891894 }
@@ -910,8 +913,12 @@ static int igc_ethtool_set_coalesce(struct net_device *netdev, · 18 unmodified lines
910913 ec->tx_coalesce_usecs == 2)
911914 return -EINVAL;
912915
913− if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) && ec->tx_coalesce_usecs)
916+ if ((adapter->flags & IGC_FLAG_QUEUE_PAIRS) &&
917+ ec->tx_coalesce_usecs != igc_ethtool_get_previous_tx_coalesce(adapter)) {
918+ NL_SET_ERR_MSG_MOD(extack,
919+ "Queue Pair mode enabled, both Rx and Tx coalescing controlled by rx-usecs");
914920 return -EINVAL;
921+ }
915922
916923 /* If ITR is disabled, disable DMAC */
917924 if (ec->rx_coalesce_usecs == 0) {
drivers/net/ethernet/intel/igc/igc_main.c+1−1
@@ -6491,7 +6491,7 @@ static int igc_xdp_xmit(struct net_device *dev, int num_frames, · 6490 unmodified lines
64916491 struct igc_ring *ring;
64926492 int i, drops;
64936493
6494− if (unlikely(test_bit(__IGC_DOWN, &adapter->state)))
6494+ if (unlikely(!netif_carrier_ok(dev)))
64956495 return -ENETDOWN;
64966496
64976497 if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c+15−13
@@ -979,6 +979,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 978 unmodified lines
979979 u32 tsync_tx_ctl = IXGBE_TSYNCTXCTL_ENABLED;
980980 u32 tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED;
981981 u32 tsync_rx_mtrl = PTP_EV_PORT << 16;
982+ u32 aflags = adapter->flags;
982983 bool is_l2 = false;
983984 u32 regval;
984985
@@ -996,20 +997,20 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 11 unmodified lines
996997 case HWTSTAMP_FILTER_NONE:
997998 tsync_rx_ctl = 0;
998999 tsync_rx_mtrl = 0;
999− adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1000− IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
1000+ aflags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1001+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
10011002 break;
10021003 case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
10031004 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
10041005 tsync_rx_mtrl |= IXGBE_RXMTRL_V1_SYNC_MSG;
1005− adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1006− IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
1006+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1007+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
10071008 break;
10081009 case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
10091010 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_L4_V1;
10101011 tsync_rx_mtrl |= IXGBE_RXMTRL_V1_DELAY_REQ_MSG;
1011− adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1012− IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
1012+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1013+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
10131014 break;
10141015 case HWTSTAMP_FILTER_PTP_V2_EVENT:
10151016 case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
@@ -1023,8 +1024,8 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 7 unmodified lines
10231024 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_EVENT_V2;
10241025 is_l2 = true;
10251026 config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
1026− adapter->flags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1027− IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
1027+ aflags |= (IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1028+ IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
10281029 break;
10291030 case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
10301031 case HWTSTAMP_FILTER_NTP_ALL:
@@ -1035,7 +1036,7 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 4 unmodified lines
10351036 if (hw->mac.type >= ixgbe_mac_X550) {
10361037 tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_ALL;
10371038 config->rx_filter = HWTSTAMP_FILTER_ALL;
1038− adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
1039+ aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
10391040 break;
10401041 }
10411042 fallthrough;
@@ -1046,8 +1047,6 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 4 unmodified lines
10461047 * Delay_Req messages and hardware does not support
10471048 * timestamping all packets => return error
10481049 */
1049− adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
1050− IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
10511050 config->rx_filter = HWTSTAMP_FILTER_NONE;
10521051 return -ERANGE;
10531052 }
@@ -1079,8 +1078,8 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 25 unmodified lines
10791078 IXGBE_TSYNCRXCTL_TYPE_ALL |
10801079 IXGBE_TSYNCRXCTL_TSIP_UT_EN;
10811080 config->rx_filter = HWTSTAMP_FILTER_ALL;
1082− adapter->flags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
1083− adapter->flags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
1081+ aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
1082+ aflags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
10841083 is_l2 = true;
10851084 break;
10861085 default:
@@ -1113,6 +1112,9 @@ static int ixgbe_ptp_set_timestamp_mode(struct ixgbe_adapter *adapter, · 26 unmodified lines
11131112
11141113 IXGBE_WRITE_FLUSH(hw);
11151114
1115+ /* configure adapter flags only when HW is actually configured */
1116+ adapter->flags = aflags;
1117+
11161118 /* clear TX/RX time stamp registers, just to be sure */
11171119 ixgbe_ptp_clear_tx_timestamp(adapter);
11181120 IXGBE_READ_REG(hw, IXGBE_RXSTMPH);
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c+5−0
@@ -5586,6 +5586,11 @@ static int mvpp2_ethtool_get_rxnfc(struct net_device *dev, · 5585 unmodified lines
55865586 break;
55875587 case ETHTOOL_GRXCLSRLALL:
55885588 for (i = 0; i < MVPP2_N_RFS_ENTRIES_PER_FLOW; i++) {
5589+ if (loc == info->rule_cnt) {
5590+ ret = -EMSGSIZE;
5591+ break;
5592+ }
5593+
55895594 if (port->rfs_rules[i])
55905595 rules[loc++] = i;
55915596 }
drivers/net/ethernet/marvell/octeon_ep/octep_main.c+4−4
@@ -734,13 +734,13 @@ static netdev_tx_t octep_start_xmit(struct sk_buff *skb, · 733 unmodified lines
734734 dma_map_sg_err:
735735 if (si > 0) {
736736 dma_unmap_single(iq->dev, sglist[0].dma_ptr[0],
737− sglist[0].len[0], DMA_TO_DEVICE);
738− sglist[0].len[0] = 0;
737+ sglist[0].len[3], DMA_TO_DEVICE);
738+ sglist[0].len[3] = 0;
739739 }
740740 while (si > 1) {
741741 dma_unmap_page(iq->dev, sglist[si >> 2].dma_ptr[si & 3],
742− sglist[si >> 2].len[si & 3], DMA_TO_DEVICE);
743− sglist[si >> 2].len[si & 3] = 0;
742+ sglist[si >> 2].len[3 - (si & 3)], DMA_TO_DEVICE);
743+ sglist[si >> 2].len[3 - (si & 3)] = 0;
744744 si--;
745745 }
746746 tx_buffer->gather = 0;
drivers/net/ethernet/marvell/octeon_ep/octep_tx.c+4−4
@@ -69,12 +69,12 @@ int octep_iq_process_completions(struct octep_iq *iq, u16 budget) · 68 unmodified lines
6969 compl_sg++;
7070
7171 dma_unmap_single(iq->dev, tx_buffer->sglist[0].dma_ptr[0],
72− tx_buffer->sglist[0].len[0], DMA_TO_DEVICE);
72+ tx_buffer->sglist[0].len[3], DMA_TO_DEVICE);
7373
7474 i = 1; /* entry 0 is main skb, unmapped above */
7575 while (frags--) {
7676 dma_unmap_page(iq->dev, tx_buffer->sglist[i >> 2].dma_ptr[i & 3],
77− tx_buffer->sglist[i >> 2].len[i & 3], DMA_TO_DEVICE);
77+ tx_buffer->sglist[i >> 2].len[3 - (i & 3)], DMA_TO_DEVICE);
7878 i++;
7979 }
8080
@@ -131,13 +131,13 @@ static void octep_iq_free_pending(struct octep_iq *iq) · 50 unmodified lines
131131
132132 dma_unmap_single(iq->dev,
133133 tx_buffer->sglist[0].dma_ptr[0],
134− tx_buffer->sglist[0].len[0],
134+ tx_buffer->sglist[0].len[3],
135135 DMA_TO_DEVICE);
136136
137137 i = 1; /* entry 0 is main skb, unmapped above */
138138 while (frags--) {
139139 dma_unmap_page(iq->dev, tx_buffer->sglist[i >> 2].dma_ptr[i & 3],
140− tx_buffer->sglist[i >> 2].len[i & 3], DMA_TO_DEVICE);
140+ tx_buffer->sglist[i >> 2].len[3 - (i & 3)], DMA_TO_DEVICE);
141141 i++;
142142 }
143143
drivers/net/ethernet/marvell/octeon_ep/octep_tx.h+15−1
@@ -17,7 +17,21 @@ · 16 unmodified lines
1717 #define TX_BUFTYPE_NET_SG 2
1818 #define NUM_TX_BUFTYPES 3
1919
20−/* Hardware format for Scatter/Gather list */
20+/* Hardware format for Scatter/Gather list
21+ *
22+ * 63 48|47 32|31 16|15 0
23+ * -----------------------------------------
24+ * | Len 0 | Len 1 | Len 2 | Len 3 |
25+ * -----------------------------------------
26+ * | Ptr 0 |
27+ * -----------------------------------------
28+ * | Ptr 1 |
29+ * -----------------------------------------
30+ * | Ptr 2 |
31+ * -----------------------------------------
32+ * | Ptr 3 |
33+ * -----------------------------------------
34+ */
2135 struct octep_tx_sglist_desc {
2236 u16 len[4];
2337 dma_addr_t dma_ptr[4];
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c+4−2
@@ -107,12 +107,13 @@ int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura) · 106 unmodified lines
107107 }
108108
109109 #define NPA_MAX_BURST 16
110−void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq)
110+int cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq)
111111 {
112112 struct otx2_nic *pfvf = dev;
113+ int cnt = cq->pool_ptrs;
113114 u64 ptrs[NPA_MAX_BURST];
114− int num_ptrs = 1;
115115 dma_addr_t bufptr;
116+ int num_ptrs = 1;
116117
117118 /* Refill pool with new buffers */
118119 while (cq->pool_ptrs) {
@@ -131,6 +132,7 @@ void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq) · 12 unmodified lines
131132 num_ptrs = 1;
132133 }
133134 }
135+ return cnt - cq->pool_ptrs;
134136 }
135137
136138 void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, int size, int qidx)
drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h+1−1
@@ -24,7 +24,7 @@ static inline int mtu_to_dwrr_weight(struct otx2_nic *pfvf, int mtu) · 23 unmodified lines
2424 return weight;
2525 }
2626
27−void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
27+int cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
2828 void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, int size, int qidx);
2929 int cn10k_sq_aq_init(void *dev, u16 qidx, u16 sqb_aura);
3030 int cn10k_lmtst_init(struct otx2_nic *pfvf);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c+6−37
@@ -574,20 +574,8 @@ int otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool, · 573 unmodified lines
574574 int otx2_alloc_buffer(struct otx2_nic *pfvf, struct otx2_cq_queue *cq,
575575 dma_addr_t *dma)
576576 {
577− if (unlikely(__otx2_alloc_rbuf(pfvf, cq->rbpool, dma))) {
578− struct refill_work *work;
579− struct delayed_work *dwork;
580−
581− work = &pfvf->refill_wrk[cq->cq_idx];
582− dwork = &work->pool_refill_work;
583− /* Schedule a task if no other task is running */
584− if (!cq->refill_task_sched) {
585− cq->refill_task_sched = true;
586− schedule_delayed_work(dwork,
587− msecs_to_jiffies(100));
588− }
577+ if (unlikely(__otx2_alloc_rbuf(pfvf, cq->rbpool, dma)))
589578 return -ENOMEM;
590− }
591579 return 0;
592580 }
593581
@@ -1082,39 +1070,20 @@ static int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx) · 488 unmodified lines
10821070 static void otx2_pool_refill_task(struct work_struct *work)
10831071 {
10841072 struct otx2_cq_queue *cq;
1085− struct otx2_pool *rbpool;
10861073 struct refill_work *wrk;
1087− int qidx, free_ptrs = 0;
10881074 struct otx2_nic *pfvf;
1089− dma_addr_t bufptr;
1075+ int qidx;
10901076
10911077 wrk = container_of(work, struct refill_work, pool_refill_work.work);
10921078 pfvf = wrk->pf;
10931079 qidx = wrk - pfvf->refill_wrk;
10941080 cq = &pfvf->qset.cq[qidx];
1095− rbpool = cq->rbpool;
1096− free_ptrs = cq->pool_ptrs;
10971081
1098− while (cq->pool_ptrs) {
1099− if (otx2_alloc_rbuf(pfvf, rbpool, &bufptr)) {
1100− /* Schedule a WQ if we fails to free atleast half of the
1101− * pointers else enable napi for this RQ.
1102− */
1103− if (!((free_ptrs - cq->pool_ptrs) > free_ptrs / 2)) {
1104− struct delayed_work *dwork;
1105−
1106− dwork = &wrk->pool_refill_work;
1107− schedule_delayed_work(dwork,
1108− msecs_to_jiffies(100));
1109− } else {
1110− cq->refill_task_sched = false;
1111− }
1112− return;
1113− }
1114− pfvf->hw_ops->aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM);
1115− cq->pool_ptrs--;
1116− }
11171082 cq->refill_task_sched = false;
1083+
1084+ local_bh_disable();
1085+ napi_schedule(wrk->napi);
1086+ local_bh_enable();
11181087 }
11191088
11201089 int otx2_config_nix_queues(struct otx2_nic *pfvf)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h+2−1
@@ -302,6 +302,7 @@ struct flr_work { · 301 unmodified lines
302302 struct refill_work {
303303 struct delayed_work pool_refill_work;
304304 struct otx2_nic *pf;
305+ struct napi_struct *napi;
305306 };
306307
307308 /* PTPv2 originTimestamp structure */
@@ -370,7 +371,7 @@ struct dev_hw_ops { · 62 unmodified lines
370371 int (*sq_aq_init)(void *dev, u16 qidx, u16 sqb_aura);
371372 void (*sqe_flush)(void *dev, struct otx2_snd_queue *sq,
372373 int size, int qidx);
373− void (*refill_pool_ptrs)(void *dev, struct otx2_cq_queue *cq);
374+ int (*refill_pool_ptrs)(void *dev, struct otx2_cq_queue *cq);
374375 void (*aura_freeptr)(void *dev, int aura, u64 buf);
375376 };
376377
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c+4−3
@@ -1943,6 +1943,10 @@ int otx2_stop(struct net_device *netdev) · 1942 unmodified lines
19431943
19441944 netif_tx_disable(netdev);
19451945
1946+ for (wrk = 0; wrk < pf->qset.cq_cnt; wrk++)
1947+ cancel_delayed_work_sync(&pf->refill_wrk[wrk].pool_refill_work);
1948+ devm_kfree(pf->dev, pf->refill_wrk);
1949+
19461950 otx2_free_hw_resources(pf);
19471951 otx2_free_cints(pf, pf->hw.cint_cnt);
19481952 otx2_disable_napi(pf);
@@ -1950,9 +1954,6 @@ int otx2_stop(struct net_device *netdev) · 1 unmodified line
19501954 for (qidx = 0; qidx < netdev->num_tx_queues; qidx++)
19511955 netdev_tx_reset_queue(netdev_get_tx_queue(netdev, qidx));
19521956
1953− for (wrk = 0; wrk < pf->qset.cq_cnt; wrk++)
1954− cancel_delayed_work_sync(&pf->refill_wrk[wrk].pool_refill_work);
1955− devm_kfree(pf->dev, pf->refill_wrk);
19561957
19571958 kfree(qset->sq);
19581959 kfree(qset->cq);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c+38−11
@@ -29,7 +29,8 @@ · 28 unmodified lines
2929 static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
3030 struct bpf_prog *prog,
3131 struct nix_cqe_rx_s *cqe,
32− struct otx2_cq_queue *cq);
32+ struct otx2_cq_queue *cq,
33+ bool *need_xdp_flush);
3334
3435 static int otx2_nix_cq_op_status(struct otx2_nic *pfvf,
3536 struct otx2_cq_queue *cq)
@@ -337,7 +338,7 @@ static bool otx2_check_rcv_errors(struct otx2_nic *pfvf, · 301 unmodified lines
337338 static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf,
338339 struct napi_struct *napi,
339340 struct otx2_cq_queue *cq,
340− struct nix_cqe_rx_s *cqe)
341+ struct nix_cqe_rx_s *cqe, bool *need_xdp_flush)
341342 {
342343 struct nix_rx_parse_s *parse = &cqe->parse;
343344 struct nix_rx_sg_s *sg = &cqe->sg;
@@ -353,7 +354,7 @@ static void otx2_rcv_pkt_handler(struct otx2_nic *pfvf, · 9 unmodified lines
353354 }
354355
355356 if (pfvf->xdp_prog)
356− if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq))
357+ if (otx2_xdp_rcv_pkt_handler(pfvf, pfvf->xdp_prog, cqe, cq, need_xdp_flush))
357358 return;
358359
359360 skb = napi_get_frags(napi);
@@ -388,6 +389,7 @@ static int otx2_rx_napi_handler(struct otx2_nic *pfvf, · 28 unmodified lines
388389 struct napi_struct *napi,
389390 struct otx2_cq_queue *cq, int budget)
390391 {
392+ bool need_xdp_flush = false;
391393 struct nix_cqe_rx_s *cqe;
392394 int processed_cqe = 0;
393395
@@ -409,13 +411,15 @@ process_cqe: · 15 unmodified lines
409411 cq->cq_head++;
410412 cq->cq_head &= (cq->cqe_cnt - 1);
411413
412− otx2_rcv_pkt_handler(pfvf, napi, cq, cqe);
414+ otx2_rcv_pkt_handler(pfvf, napi, cq, cqe, &need_xdp_flush);
413415
414416 cqe->hdr.cqe_type = NIX_XQE_TYPE_INVALID;
415417 cqe->sg.seg_addr = 0x00;
416418 processed_cqe++;
417419 cq->pend_cqe--;
418420 }
421+ if (need_xdp_flush)
422+ xdp_do_flush();
419423
420424 /* Free CQEs to HW */
421425 otx2_write64(pfvf, NIX_LF_CQ_OP_DOOR,
@@ -424,9 +428,10 @@ process_cqe: · 2 unmodified lines
424428 return processed_cqe;
425429 }
426430
427−void otx2_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq)
431+int otx2_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq)
428432 {
429433 struct otx2_nic *pfvf = dev;
434+ int cnt = cq->pool_ptrs;
430435 dma_addr_t bufptr;
431436
432437 while (cq->pool_ptrs) {
@@ -435,6 +440,8 @@ void otx2_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq) · 2 unmodified lines
435440 otx2_aura_freeptr(pfvf, cq->cq_idx, bufptr + OTX2_HEAD_ROOM);
436441 cq->pool_ptrs--;
437442 }
443+
444+ return cnt - cq->pool_ptrs;
438445 }
439446
440447 static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
@@ -521,6 +528,7 @@ int otx2_napi_handler(struct napi_struct *napi, int budget) · 80 unmodified lines
521528 struct otx2_cq_queue *cq;
522529 struct otx2_qset *qset;
523530 struct otx2_nic *pfvf;
531+ int filled_cnt = -1;
524532
525533 cq_poll = container_of(napi, struct otx2_cq_poll, napi);
526534 pfvf = (struct otx2_nic *)cq_poll->dev;
@@ -541,7 +549,7 @@ int otx2_napi_handler(struct napi_struct *napi, int budget) · 14 unmodified lines
541549 }
542550
543551 if (rx_cq && rx_cq->pool_ptrs)
544− pfvf->hw_ops->refill_pool_ptrs(pfvf, rx_cq);
552+ filled_cnt = pfvf->hw_ops->refill_pool_ptrs(pfvf, rx_cq);
545553 /* Clear the IRQ */
546554 otx2_write64(pfvf, NIX_LF_CINTX_INT(cq_poll->cint_idx), BIT_ULL(0));
547555
@@ -561,9 +569,25 @@ int otx2_napi_handler(struct napi_struct *napi, int budget) · 13 unmodified lines
561569 otx2_config_irq_coalescing(pfvf, i);
562570 }
563571
564− /* Re-enable interrupts */
565− otx2_write64(pfvf, NIX_LF_CINTX_ENA_W1S(cq_poll->cint_idx),
566− BIT_ULL(0));
572+ if (unlikely(!filled_cnt)) {
573+ struct refill_work *work;
574+ struct delayed_work *dwork;
575+
576+ work = &pfvf->refill_wrk[cq->cq_idx];
577+ dwork = &work->pool_refill_work;
578+ /* Schedule a task if no other task is running */
579+ if (!cq->refill_task_sched) {
580+ work->napi = napi;
581+ cq->refill_task_sched = true;
582+ schedule_delayed_work(dwork,
583+ msecs_to_jiffies(100));
584+ }
585+ } else {
586+ /* Re-enable interrupts */
587+ otx2_write64(pfvf,
588+ NIX_LF_CINTX_ENA_W1S(cq_poll->cint_idx),
589+ BIT_ULL(0));
590+ }
567591 }
568592 return workdone;
569593 }
@@ -1334,7 +1358,8 @@ bool otx2_xdp_sq_append_pkt(struct otx2_nic *pfvf, u64 iova, int len, u16 qidx) · 764 unmodified lines
13341358 static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf,
13351359 struct bpf_prog *prog,
13361360 struct nix_cqe_rx_s *cqe,
1337− struct otx2_cq_queue *cq)
1361+ struct otx2_cq_queue *cq,
1362+ bool *need_xdp_flush)
13381363 {
13391364 unsigned char *hard_start, *data;
13401365 int qidx = cq->cq_idx;
@@ -1371,8 +1396,10 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, · 30 unmodified lines
13711396
13721397 otx2_dma_unmap_page(pfvf, iova, pfvf->rbsize,
13731398 DMA_FROM_DEVICE);
1374− if (!err)
1399+ if (!err) {
1400+ *need_xdp_flush = true;
13751401 return true;
1402+ }
13761403 put_page(page);
13771404 break;
13781405 default:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h+2−2
@@ -170,6 +170,6 @@ void cn10k_sqe_flush(void *dev, struct otx2_snd_queue *sq, · 169 unmodified lines
170170 int size, int qidx);
171171 void otx2_sqe_flush(void *dev, struct otx2_snd_queue *sq,
172172 int size, int qidx);
173−void otx2_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
174−void cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
173+int otx2_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
174+int cn10k_refill_pool_ptrs(void *dev, struct otx2_cq_queue *cq);
175175 #endif /* OTX2_TXRX_H */
drivers/net/ethernet/mediatek/mtk_eth_soc.c+6−2
@@ -2005,11 +2005,11 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, · 2004 unmodified lines
20052005 u8 *data, *new_data;
20062006 struct mtk_rx_dma_v2 *rxd, trxd;
20072007 int done = 0, bytes = 0;
2008+ dma_addr_t dma_addr = DMA_MAPPING_ERROR;
20082009
20092010 while (done < budget) {
20102011 unsigned int pktlen, *rxdcsum;
20112012 struct net_device *netdev;
2012− dma_addr_t dma_addr;
20132013 u32 hash, reason;
20142014 int mac = 0;
20152015
@@ -2186,7 +2186,8 @@ release_desc: · 170 unmodified lines
21862186 else
21872187 rxd->rxd2 = RX_DMA_PREP_PLEN0(ring->buf_size);
21882188
2189− if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA))
2189+ if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA) &&
2190+ likely(dma_addr != DMA_MAPPING_ERROR))
21902191 rxd->rxd2 |= RX_DMA_PREP_ADDR64(dma_addr);
21912192
21922193 ring->calc_idx = idx;
@@ -2994,6 +2995,9 @@ static int mtk_hwlro_get_fdir_all(struct net_device *dev, · 801 unmodified lines
29942995 int i;
29952996
29962997 for (i = 0; i < MTK_MAX_LRO_IP_CNT; i++) {
2998+ if (cnt == cmd->rule_cnt)
2999+ return -EMSGSIZE;
3000+
29973001 if (mac->hwlro_ip[i]) {
29983002 rule_locs[cnt] = i;
29993003 cnt++;
drivers/net/ethernet/mediatek/mtk_ppe_offload.c+4−2
@@ -214,9 +214,11 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe, · 213 unmodified lines
214214 dsa_port = mtk_flow_get_dsa_port(&dev);
215215
216216 if (dev == eth->netdev[0])
217− pse_port = 1;
217+ pse_port = PSE_GDM1_PORT;
218218 else if (dev == eth->netdev[1])
219− pse_port = 2;
219+ pse_port = PSE_GDM2_PORT;
220+ else if (dev == eth->netdev[2])
221+ pse_port = PSE_GDM3_PORT;
220222 else
221223 return -EOPNOTSUPP;
222224
drivers/net/ethernet/microchip/vcap/vcap_api.c+16−2
@@ -1021,18 +1021,32 @@ static struct vcap_rule_internal *vcap_dup_rule(struct vcap_rule_internal *ri, · 1020 unmodified lines
10211021 list_for_each_entry(ckf, &ri->data.keyfields, ctrl.list) {
10221022 newckf = kmemdup(ckf, sizeof(*newckf), GFP_KERNEL);
10231023 if (!newckf)
1024− return ERR_PTR(-ENOMEM);
1024+ goto err;
10251025 list_add_tail(&newckf->ctrl.list, &duprule->data.keyfields);
10261026 }
10271027
10281028 list_for_each_entry(caf, &ri->data.actionfields, ctrl.list) {
10291029 newcaf = kmemdup(caf, sizeof(*newcaf), GFP_KERNEL);
10301030 if (!newcaf)
1031− return ERR_PTR(-ENOMEM);
1031+ goto err;
10321032 list_add_tail(&newcaf->ctrl.list, &duprule->data.actionfields);
10331033 }
10341034
10351035 return duprule;
1036+
1037+err:
1038+ list_for_each_entry_safe(ckf, newckf, &duprule->data.keyfields, ctrl.list) {
1039+ list_del(&ckf->ctrl.list);
1040+ kfree(ckf);
1041+ }
1042+
1043+ list_for_each_entry_safe(caf, newcaf, &duprule->data.actionfields, ctrl.list) {
1044+ list_del(&caf->ctrl.list);
1045+ kfree(caf);
1046+ }
1047+
1048+ kfree(duprule);
1049+ return ERR_PTR(-ENOMEM);
10361050 }
10371051
10381052 static void vcap_apply_width(u8 *dst, int width, int bytes)
drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c+54−5
@@ -243,10 +243,9 @@ static void vcap_test_api_init(struct vcap_admin *admin) · 242 unmodified lines
243243 }
244244
245245 /* Helper function to create a rule of a specific size */
246−static struct vcap_rule *
247−test_vcap_xn_rule_creator(struct kunit *test, int cid, enum vcap_user user,
248− u16 priority,
249− int id, int size, int expected_addr)
246+static void test_vcap_xn_rule_creator(struct kunit *test, int cid,
247+ enum vcap_user user, u16 priority,
248+ int id, int size, int expected_addr)
250249 {
251250 struct vcap_rule *rule;
252251 struct vcap_rule_internal *ri;
@@ -311,7 +310,7 @@ test_vcap_xn_rule_creator(struct kunit *test, int cid, enum vcap_user user, · 58 unmodified lines
311310 ret = vcap_add_rule(rule);
312311 KUNIT_EXPECT_EQ(test, 0, ret);
313312 KUNIT_EXPECT_EQ(test, expected_addr, ri->addr);
314− return rule;
313+ vcap_free_rule(rule);
315314 }
316315
317316 /* Prepare testing rule deletion */
@@ -995,6 +994,16 @@ static void vcap_api_encode_rule_actionset_test(struct kunit *test) · 677 unmodified lines
995994 KUNIT_EXPECT_EQ(test, (u32)0x00000000, actwords[11]);
996995 }
997996
997+static void vcap_free_ckf(struct vcap_rule *rule)
998+{
999+ struct vcap_client_keyfield *ckf, *next_ckf;
1000+
1001+ list_for_each_entry_safe(ckf, next_ckf, &rule->keyfields, ctrl.list) {
1002+ list_del(&ckf->ctrl.list);
1003+ kfree(ckf);
1004+ }
1005+}
1006+
9981007 static void vcap_api_rule_add_keyvalue_test(struct kunit *test)
9991008 {
10001009 struct vcap_admin admin = {
@@ -1027,6 +1036,7 @@ static void vcap_api_rule_add_keyvalue_test(struct kunit *test) · 26 unmodified lines
10271036 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, kf->ctrl.type);
10281037 KUNIT_EXPECT_EQ(test, 0x0, kf->data.u1.value);
10291038 KUNIT_EXPECT_EQ(test, 0x1, kf->data.u1.mask);
1039+ vcap_free_ckf(rule);
10301040
10311041 INIT_LIST_HEAD(&rule->keyfields);
10321042 ret = vcap_rule_add_key_bit(rule, VCAP_KF_LOOKUP_FIRST_IS, VCAP_BIT_1);
@@ -1039,6 +1049,7 @@ static void vcap_api_rule_add_keyvalue_test(struct kunit *test) · 6 unmodified lines
10391049 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, kf->ctrl.type);
10401050 KUNIT_EXPECT_EQ(test, 0x1, kf->data.u1.value);
10411051 KUNIT_EXPECT_EQ(test, 0x1, kf->data.u1.mask);
1052+ vcap_free_ckf(rule);
10421053
10431054 INIT_LIST_HEAD(&rule->keyfields);
10441055 ret = vcap_rule_add_key_bit(rule, VCAP_KF_LOOKUP_FIRST_IS,
@@ -1052,6 +1063,7 @@ static void vcap_api_rule_add_keyvalue_test(struct kunit *test) · 7 unmodified lines
10521063 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, kf->ctrl.type);
10531064 KUNIT_EXPECT_EQ(test, 0x0, kf->data.u1.value);
10541065 KUNIT_EXPECT_EQ(test, 0x0, kf->data.u1.mask);
1066+ vcap_free_ckf(rule);
10551067
10561068 INIT_LIST_HEAD(&rule->keyfields);
10571069 ret = vcap_rule_add_key_u32(rule, VCAP_KF_TYPE, 0x98765432, 0xff00ffab);
@@ -1064,6 +1076,7 @@ static void vcap_api_rule_add_keyvalue_test(struct kunit *test) · 6 unmodified lines
10641076 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U32, kf->ctrl.type);
10651077 KUNIT_EXPECT_EQ(test, 0x98765432, kf->data.u32.value);
10661078 KUNIT_EXPECT_EQ(test, 0xff00ffab, kf->data.u32.mask);
1079+ vcap_free_ckf(rule);
10671080
10681081 INIT_LIST_HEAD(&rule->keyfields);
10691082 ret = vcap_rule_add_key_u128(rule, VCAP_KF_L3_IP6_SIP, &dip);
@@ -1078,6 +1091,18 @@ static void vcap_api_rule_add_keyvalue_test(struct kunit *test) · 8 unmodified lines
10781091 KUNIT_EXPECT_EQ(test, dip.value[idx], kf->data.u128.value[idx]);
10791092 for (idx = 0; idx < ARRAY_SIZE(dip.mask); ++idx)
10801093 KUNIT_EXPECT_EQ(test, dip.mask[idx], kf->data.u128.mask[idx]);
1094+ vcap_free_ckf(rule);
1095+}
1096+
1097+static void vcap_free_caf(struct vcap_rule *rule)
1098+{
1099+ struct vcap_client_actionfield *caf, *next_caf;
1100+
1101+ list_for_each_entry_safe(caf, next_caf,
1102+ &rule->actionfields, ctrl.list) {
1103+ list_del(&caf->ctrl.list);
1104+ kfree(caf);
1105+ }
10811106 }
10821107
10831108 static void vcap_api_rule_add_actionvalue_test(struct kunit *test)
@@ -1105,6 +1130,7 @@ static void vcap_api_rule_add_actionvalue_test(struct kunit *test) · 21 unmodified lines
11051130 KUNIT_EXPECT_EQ(test, VCAP_AF_POLICE_ENA, af->ctrl.action);
11061131 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, af->ctrl.type);
11071132 KUNIT_EXPECT_EQ(test, 0x0, af->data.u1.value);
1133+ vcap_free_caf(rule);
11081134
11091135 INIT_LIST_HEAD(&rule->actionfields);
11101136 ret = vcap_rule_add_action_bit(rule, VCAP_AF_POLICE_ENA, VCAP_BIT_1);
@@ -1116,6 +1142,7 @@ static void vcap_api_rule_add_actionvalue_test(struct kunit *test) · 5 unmodified lines
11161142 KUNIT_EXPECT_EQ(test, VCAP_AF_POLICE_ENA, af->ctrl.action);
11171143 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, af->ctrl.type);
11181144 KUNIT_EXPECT_EQ(test, 0x1, af->data.u1.value);
1145+ vcap_free_caf(rule);
11191146
11201147 INIT_LIST_HEAD(&rule->actionfields);
11211148 ret = vcap_rule_add_action_bit(rule, VCAP_AF_POLICE_ENA, VCAP_BIT_ANY);
@@ -1127,6 +1154,7 @@ static void vcap_api_rule_add_actionvalue_test(struct kunit *test) · 5 unmodified lines
11271154 KUNIT_EXPECT_EQ(test, VCAP_AF_POLICE_ENA, af->ctrl.action);
11281155 KUNIT_EXPECT_EQ(test, VCAP_FIELD_BIT, af->ctrl.type);
11291156 KUNIT_EXPECT_EQ(test, 0x0, af->data.u1.value);
1157+ vcap_free_caf(rule);
11301158
11311159 INIT_LIST_HEAD(&rule->actionfields);
11321160 ret = vcap_rule_add_action_u32(rule, VCAP_AF_TYPE, 0x98765432);
@@ -1138,6 +1166,7 @@ static void vcap_api_rule_add_actionvalue_test(struct kunit *test) · 5 unmodified lines
11381166 KUNIT_EXPECT_EQ(test, VCAP_AF_TYPE, af->ctrl.action);
11391167 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U32, af->ctrl.type);
11401168 KUNIT_EXPECT_EQ(test, 0x98765432, af->data.u32.value);
1169+ vcap_free_caf(rule);
11411170
11421171 INIT_LIST_HEAD(&rule->actionfields);
11431172 ret = vcap_rule_add_action_u32(rule, VCAP_AF_MASK_MODE, 0xaabbccdd);
@@ -1149,6 +1178,7 @@ static void vcap_api_rule_add_actionvalue_test(struct kunit *test) · 5 unmodified lines
11491178 KUNIT_EXPECT_EQ(test, VCAP_AF_MASK_MODE, af->ctrl.action);
11501179 KUNIT_EXPECT_EQ(test, VCAP_FIELD_U32, af->ctrl.type);
11511180 KUNIT_EXPECT_EQ(test, 0xaabbccdd, af->data.u32.value);
1181+ vcap_free_caf(rule);
11521182 }
11531183
11541184 static void vcap_api_rule_find_keyset_basic_test(struct kunit *test)
@@ -1408,6 +1438,10 @@ static void vcap_api_encode_rule_test(struct kunit *test) · 253 unmodified lines
14081438 ret = list_empty(&is2_admin.rules);
14091439 KUNIT_EXPECT_EQ(test, false, ret);
14101440 KUNIT_EXPECT_EQ(test, 0, ret);
1441+
1442+ vcap_enable_lookups(&test_vctrl, &test_netdev, 0, 0,
1443+ rule->cookie, false);
1444+
14111445 vcap_free_rule(rule);
14121446
14131447 /* Check that the rule has been freed: tricky to access since this
@@ -1418,6 +1452,8 @@ static void vcap_api_encode_rule_test(struct kunit *test) · 4 unmodified lines
14181452 KUNIT_EXPECT_EQ(test, true, ret);
14191453 ret = list_empty(&rule->actionfields);
14201454 KUNIT_EXPECT_EQ(test, true, ret);
1455+
1456+ vcap_del_rule(&test_vctrl, &test_netdev, id);
14211457 }
14221458
14231459 static void vcap_api_set_rule_counter_test(struct kunit *test)
@@ -1561,6 +1597,11 @@ static void vcap_api_rule_insert_in_order_test(struct kunit *test) · 137 unmodified lines
15611597 test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 20, 400, 6, 774);
15621598 test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 30, 300, 3, 771);
15631599 test_vcap_xn_rule_creator(test, 10000, VCAP_USER_QOS, 40, 200, 2, 768);
1600+
1601+ vcap_del_rule(&test_vctrl, &test_netdev, 200);
1602+ vcap_del_rule(&test_vctrl, &test_netdev, 300);
1603+ vcap_del_rule(&test_vctrl, &test_netdev, 400);
1604+ vcap_del_rule(&test_vctrl, &test_netdev, 500);
15641605 }
15651606
15661607 static void vcap_api_rule_insert_reverse_order_test(struct kunit *test)
@@ -1619,6 +1660,11 @@ static void vcap_api_rule_insert_reverse_order_test(struct kunit *test) · 52 unmodified lines
16191660 ++idx;
16201661 }
16211662 KUNIT_EXPECT_EQ(test, 768, admin.last_used_addr);
1663+
1664+ vcap_del_rule(&test_vctrl, &test_netdev, 500);
1665+ vcap_del_rule(&test_vctrl, &test_netdev, 400);
1666+ vcap_del_rule(&test_vctrl, &test_netdev, 300);
1667+ vcap_del_rule(&test_vctrl, &test_netdev, 200);
16221668 }
16231669
16241670 static void vcap_api_rule_remove_at_end_test(struct kunit *test)
@@ -1819,6 +1865,9 @@ static void vcap_api_rule_remove_in_front_test(struct kunit *test) · 194 unmodified lines
18191865 KUNIT_EXPECT_EQ(test, 786, test_init_start);
18201866 KUNIT_EXPECT_EQ(test, 8, test_init_count);
18211867 KUNIT_EXPECT_EQ(test, 794, admin.last_used_addr);
1868+
1869+ vcap_del_rule(&test_vctrl, &test_netdev, 200);
1870+ vcap_del_rule(&test_vctrl, &test_netdev, 300);
18221871 }
18231872
18241873 static struct kunit_case vcap_api_rule_remove_test_cases[] = {
drivers/net/ethernet/pensando/ionic/ionic_dev.h+1−0
@@ -187,6 +187,7 @@ typedef void (*ionic_desc_cb)(struct ionic_queue *q, · 186 unmodified lines
187187 struct ionic_desc_info *desc_info,
188188 struct ionic_cq_info *cq_info, void *cb_arg);
189189
190+#define IONIC_MAX_BUF_LEN ((u16)-1)
190191 #define IONIC_PAGE_SIZE PAGE_SIZE
191192 #define IONIC_PAGE_SPLIT_SZ (PAGE_SIZE / 2)
192193 #define IONIC_PAGE_GFP_MASK (GFP_ATOMIC | __GFP_NOWARN |\
drivers/net/ethernet/pensando/ionic/ionic_txrx.c+7−3
@@ -207,7 +207,8 @@ static struct sk_buff *ionic_rx_frags(struct ionic_queue *q, · 206 unmodified lines
207207 return NULL;
208208 }
209209
210− frag_len = min_t(u16, len, IONIC_PAGE_SIZE - buf_info->page_offset);
210+ frag_len = min_t(u16, len, min_t(u32, IONIC_MAX_BUF_LEN,
211+ IONIC_PAGE_SIZE - buf_info->page_offset));
211212 len -= frag_len;
212213
213214 dma_sync_single_for_cpu(dev,
@@ -452,7 +453,8 @@ void ionic_rx_fill(struct ionic_queue *q) · 238 unmodified lines
452453
453454 /* fill main descriptor - buf[0] */
454455 desc->addr = cpu_to_le64(buf_info->dma_addr + buf_info->page_offset);
455− frag_len = min_t(u16, len, IONIC_PAGE_SIZE - buf_info->page_offset);
456+ frag_len = min_t(u16, len, min_t(u32, IONIC_MAX_BUF_LEN,
457+ IONIC_PAGE_SIZE - buf_info->page_offset));
456458 desc->len = cpu_to_le16(frag_len);
457459 remain_len -= frag_len;
458460 buf_info++;
@@ -471,7 +473,9 @@ void ionic_rx_fill(struct ionic_queue *q) · 12 unmodified lines
471473 }
472474
473475 sg_elem->addr = cpu_to_le64(buf_info->dma_addr + buf_info->page_offset);
474− frag_len = min_t(u16, remain_len, IONIC_PAGE_SIZE - buf_info->page_offset);
476+ frag_len = min_t(u16, remain_len, min_t(u32, IONIC_MAX_BUF_LEN,
477+ IONIC_PAGE_SIZE -
478+ buf_info->page_offset));
475479 sg_elem->len = cpu_to_le16(frag_len);
476480 remain_len -= frag_len;
477481 buf_info++;
drivers/net/ethernet/renesas/rswitch.c+16−4
@@ -799,6 +799,7 @@ static int rswitch_poll(struct napi_struct *napi, int budget) · 798 unmodified lines
799799 struct net_device *ndev = napi->dev;
800800 struct rswitch_private *priv;
801801 struct rswitch_device *rdev;
802+ unsigned long flags;
802803 int quota = budget;
803804
804805 rdev = netdev_priv(ndev);
@@ -816,10 +817,12 @@ retry: · 11 unmodified lines
816817
817818 netif_wake_subqueue(ndev, 0);
818819
819− napi_complete(napi);
820−
821− rswitch_enadis_data_irq(priv, rdev->tx_queue->index, true);
822− rswitch_enadis_data_irq(priv, rdev->rx_queue->index, true);
820+ if (napi_complete_done(napi, budget - quota)) {
821+ spin_lock_irqsave(&priv->lock, flags);
822+ rswitch_enadis_data_irq(priv, rdev->tx_queue->index, true);
823+ rswitch_enadis_data_irq(priv, rdev->rx_queue->index, true);
824+ spin_unlock_irqrestore(&priv->lock, flags);
825+ }
823826
824827 out:
825828 return budget - quota;
@@ -835,8 +838,10 @@ static void rswitch_queue_interrupt(struct net_device *ndev) · 9 unmodified lines
835838 struct rswitch_device *rdev = netdev_priv(ndev);
836839
837840 if (napi_schedule_prep(&rdev->napi)) {
841+ spin_lock(&rdev->priv->lock);
838842 rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, false);
839843 rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, false);
844+ spin_unlock(&rdev->priv->lock);
840845 __napi_schedule(&rdev->napi);
841846 }
842847 }
@@ -1440,14 +1445,17 @@ static void rswitch_ether_port_deinit_all(struct rswitch_private *priv) · 597 unmodified lines
14401445 static int rswitch_open(struct net_device *ndev)
14411446 {
14421447 struct rswitch_device *rdev = netdev_priv(ndev);
1448+ unsigned long flags;
14431449
14441450 phy_start(ndev->phydev);
14451451
14461452 napi_enable(&rdev->napi);
14471453 netif_start_queue(ndev);
14481454
1455+ spin_lock_irqsave(&rdev->priv->lock, flags);
14491456 rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, true);
14501457 rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, true);
1458+ spin_unlock_irqrestore(&rdev->priv->lock, flags);
14511459
14521460 if (bitmap_empty(rdev->priv->opened_ports, RSWITCH_NUM_PORTS))
14531461 iowrite32(GWCA_TS_IRQ_BIT, rdev->priv->addr + GWTSDIE);
@@ -1461,6 +1469,7 @@ static int rswitch_stop(struct net_device *ndev) · 7 unmodified lines
14611469 {
14621470 struct rswitch_device *rdev = netdev_priv(ndev);
14631471 struct rswitch_gwca_ts_info *ts_info, *ts_info2;
1472+ unsigned long flags;
14641473
14651474 netif_tx_stop_all_queues(ndev);
14661475 bitmap_clear(rdev->priv->opened_ports, rdev->port, 1);
@@ -1476,8 +1485,10 @@ static int rswitch_stop(struct net_device *ndev) · 9 unmodified lines
14761485 kfree(ts_info);
14771486 }
14781487
1488+ spin_lock_irqsave(&rdev->priv->lock, flags);
14791489 rswitch_enadis_data_irq(rdev->priv, rdev->tx_queue->index, false);
14801490 rswitch_enadis_data_irq(rdev->priv, rdev->rx_queue->index, false);
1491+ spin_unlock_irqrestore(&rdev->priv->lock, flags);
14811492
14821493 phy_stop(ndev->phydev);
14831494 napi_disable(&rdev->napi);
@@ -1887,6 +1898,7 @@ static int renesas_eth_sw_probe(struct platform_device *pdev) · 403 unmodified lines
18871898 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
18881899 if (!priv)
18891900 return -ENOMEM;
1901+ spin_lock_init(&priv->lock);
18901902
18911903 attr = soc_device_match(rswitch_soc_no_speed_change);
18921904 if (attr)
drivers/net/ethernet/renesas/rswitch.h+2−0
@@ -1011,6 +1011,8 @@ struct rswitch_private { · 1010 unmodified lines
10111011 struct rswitch_etha etha[RSWITCH_NUM_PORTS];
10121012 struct rswitch_mfwd mfwd;
10131013
1014+ spinlock_t lock; /* lock interrupt registers' control */
1015+
10141016 bool etha_no_runtime_change;
10151017 bool gwca_halt;
10161018 };
drivers/net/ethernet/sfc/tc.c+18−3
@@ -136,6 +136,8 @@ static struct efx_tc_mac_pedit_action *efx_tc_flower_get_mac(struct efx_nic *efx · 135 unmodified lines
136136 if (old) {
137137 /* don't need our new entry */
138138 kfree(ped);
139+ if (IS_ERR(old)) /* oh dear, it's actually an error */
140+ return ERR_CAST(old);
139141 if (!refcount_inc_not_zero(&old->ref))
140142 return ERR_PTR(-EAGAIN);
141143 /* existing entry found, ref taken */
@@ -602,6 +604,8 @@ static int efx_tc_flower_record_encap_match(struct efx_nic *efx, · 460 unmodified lines
602604 kfree(encap);
603605 if (pseudo) /* don't need our new pseudo either */
604606 efx_tc_flower_release_encap_match(efx, pseudo);
607+ if (IS_ERR(old)) /* oh dear, it's actually an error */
608+ return PTR_ERR(old);
605609 /* check old and new em_types are compatible */
606610 switch (old->type) {
607611 case EFX_TC_EM_DIRECT:
@@ -700,6 +704,8 @@ static struct efx_tc_recirc_id *efx_tc_get_recirc_id(struct efx_nic *efx, · 92 unmodified lines
700704 if (old) {
701705 /* don't need our new entry */
702706 kfree(rid);
707+ if (IS_ERR(old)) /* oh dear, it's actually an error */
708+ return ERR_CAST(old);
703709 if (!refcount_inc_not_zero(&old->ref))
704710 return ERR_PTR(-EAGAIN);
705711 /* existing entry found */
@@ -1482,7 +1488,10 @@ static int efx_tc_flower_replace_foreign(struct efx_nic *efx, · 776 unmodified lines
14821488 old = rhashtable_lookup_get_insert_fast(&efx->tc->match_action_ht,
14831489 &rule->linkage,
14841490 efx_tc_match_action_ht_params);
1485− if (old) {
1491+ if (IS_ERR(old)) {
1492+ rc = PTR_ERR(old);
1493+ goto release;
1494+ } else if (old) {
14861495 netif_dbg(efx, drv, efx->net_dev,
14871496 "Ignoring already-offloaded rule (cookie %lx)\n",
14881497 tc->cookie);
@@ -1697,7 +1706,10 @@ static int efx_tc_flower_replace_lhs(struct efx_nic *efx, · 208 unmodified lines
16971706 old = rhashtable_lookup_get_insert_fast(&efx->tc->lhs_rule_ht,
16981707 &rule->linkage,
16991708 efx_tc_lhs_rule_ht_params);
1700− if (old) {
1709+ if (IS_ERR(old)) {
1710+ rc = PTR_ERR(old);
1711+ goto release;
1712+ } else if (old) {
17011713 netif_dbg(efx, drv, efx->net_dev,
17021714 "Already offloaded rule (cookie %lx)\n", tc->cookie);
17031715 rc = -EEXIST;
@@ -1858,7 +1870,10 @@ static int efx_tc_flower_replace(struct efx_nic *efx, · 154 unmodified lines
18581870 old = rhashtable_lookup_get_insert_fast(&efx->tc->match_action_ht,
18591871 &rule->linkage,
18601872 efx_tc_match_action_ht_params);
1861− if (old) {
1873+ if (IS_ERR(old)) {
1874+ rc = PTR_ERR(old);
1875+ goto release;
1876+ } else if (old) {
18621877 netif_dbg(efx, drv, efx->net_dev,
18631878 "Already offloaded rule (cookie %lx)\n", tc->cookie);
18641879 NL_SET_ERR_MSG_MOD(extack, "Rule already offloaded");
drivers/net/ethernet/sfc/tc_conntrack.c+6−1
@@ -298,7 +298,10 @@ static int efx_tc_ct_replace(struct efx_tc_ct_zone *ct_zone, · 297 unmodified lines
298298 old = rhashtable_lookup_get_insert_fast(&efx->tc->ct_ht,
299299 &conn->linkage,
300300 efx_tc_ct_ht_params);
301− if (old) {
301+ if (IS_ERR(old)) {
302+ rc = PTR_ERR(old);
303+ goto release;
304+ } else if (old) {
302305 netif_dbg(efx, drv, efx->net_dev,
303306 "Already offloaded conntrack (cookie %lx)\n", tc->cookie);
304307 rc = -EEXIST;
@@ -482,6 +485,8 @@ struct efx_tc_ct_zone *efx_tc_ct_register_zone(struct efx_nic *efx, u16 zone, · 177 unmodified lines
482485 if (old) {
483486 /* don't need our new entry */
484487 kfree(ct_zone);
488+ if (IS_ERR(old)) /* oh dear, it's actually an error */
489+ return ERR_CAST(old);
485490 if (!refcount_inc_not_zero(&old->ref))
486491 return ERR_PTR(-EAGAIN);
487492 /* existing entry found */
drivers/net/ethernet/sfc/tc_counters.c+2−0
@@ -236,6 +236,8 @@ struct efx_tc_counter_index *efx_tc_flower_get_counter_index( · 235 unmodified lines
236236 if (old) {
237237 /* don't need our new entry */
238238 kfree(ctr);
239+ if (IS_ERR(old)) /* oh dear, it's actually an error */
240+ return ERR_CAST(old);
239241 if (!refcount_inc_not_zero(&old->ref))
240242 return ERR_PTR(-EAGAIN);
241243 /* existing entry found */
drivers/net/ethernet/sfc/tc_encap_actions.c+4−0
@@ -132,6 +132,8 @@ static int efx_bind_neigh(struct efx_nic *efx, · 131 unmodified lines
132132 /* don't need our new entry */
133133 put_net_track(neigh->net, &neigh->ns_tracker);
134134 kfree(neigh);
135+ if (IS_ERR(old)) /* oh dear, it's actually an error */
136+ return PTR_ERR(old);
135137 if (!refcount_inc_not_zero(&old->ref))
136138 return -EAGAIN;
137139 /* existing entry found, ref taken */
@@ -640,6 +642,8 @@ struct efx_tc_encap_action *efx_tc_flower_create_encap_md( · 502 unmodified lines
640642 if (old) {
641643 /* don't need our new entry */
642644 kfree(encap);
645+ if (IS_ERR(old)) /* oh dear, it's actually an error */
646+ return ERR_CAST(old);
643647 if (!refcount_inc_not_zero(&old->ref))
644648 return ERR_PTR(-EAGAIN);
645649 /* existing entry found, ref taken */
drivers/net/ethernet/stmicro/stmmac/common.h+5−2
@@ -70,7 +70,7 @@ struct stmmac_txq_stats { · 69 unmodified lines
7070 u64 tx_tso_frames;
7171 u64 tx_tso_nfrags;
7272 struct u64_stats_sync syncp;
73−};
73+} ____cacheline_aligned_in_smp;
7474
7575 struct stmmac_rxq_stats {
7676 u64 rx_bytes;
@@ -79,7 +79,7 @@ struct stmmac_rxq_stats { · 2 unmodified lines
7979 u64 rx_normal_irq_n;
8080 u64 napi_poll;
8181 struct u64_stats_sync syncp;
82−};
82+} ____cacheline_aligned_in_smp;
8383
8484 /* Extra statistic and debug information exposed by ethtool */
8585 struct stmmac_extra_stats {
@@ -202,6 +202,9 @@ struct stmmac_extra_stats { · 116 unmodified lines
202202 unsigned long mtl_est_hlbf;
203203 unsigned long mtl_est_btre;
204204 unsigned long mtl_est_btrlm;
205+ /* per queue statistics */
206+ struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES];
207+ struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES];
205208 unsigned long rx_dropped;
206209 unsigned long rx_errors;
207210 unsigned long tx_dropped;
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+8−8
@@ -441,8 +441,8 @@ static int sun8i_dwmac_dma_interrupt(struct stmmac_priv *priv, · 440 unmodified lines
441441 struct stmmac_extra_stats *x, u32 chan,
442442 u32 dir)
443443 {
444− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[chan];
445− struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
444+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
445+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
446446 int ret = 0;
447447 u32 v;
448448
@@ -455,9 +455,9 @@ static int sun8i_dwmac_dma_interrupt(struct stmmac_priv *priv, · 6 unmodified lines
455455
456456 if (v & EMAC_TX_INT) {
457457 ret |= handle_tx;
458− u64_stats_update_begin(&tx_q->txq_stats.syncp);
459− tx_q->txq_stats.tx_normal_irq_n++;
460− u64_stats_update_end(&tx_q->txq_stats.syncp);
458+ u64_stats_update_begin(&txq_stats->syncp);
459+ txq_stats->tx_normal_irq_n++;
460+ u64_stats_update_end(&txq_stats->syncp);
461461 }
462462
463463 if (v & EMAC_TX_DMA_STOP_INT)
@@ -479,9 +479,9 @@ static int sun8i_dwmac_dma_interrupt(struct stmmac_priv *priv, · 15 unmodified lines
479479
480480 if (v & EMAC_RX_INT) {
481481 ret |= handle_rx;
482− u64_stats_update_begin(&rx_q->rxq_stats.syncp);
483− rx_q->rxq_stats.rx_normal_irq_n++;
484− u64_stats_update_end(&rx_q->rxq_stats.syncp);
482+ u64_stats_update_begin(&rxq_stats->syncp);
483+ rxq_stats->rx_normal_irq_n++;
484+ u64_stats_update_end(&rxq_stats->syncp);
485485 }
486486
487487 if (v & EMAC_RX_BUF_UA_INT)
drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c+8−8
@@ -171,8 +171,8 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, · 170 unmodified lines
171171 const struct dwmac4_addrs *dwmac4_addrs = priv->plat->dwmac4_addrs;
172172 u32 intr_status = readl(ioaddr + DMA_CHAN_STATUS(dwmac4_addrs, chan));
173173 u32 intr_en = readl(ioaddr + DMA_CHAN_INTR_ENA(dwmac4_addrs, chan));
174− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[chan];
175− struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
174+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
175+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
176176 int ret = 0;
177177
178178 if (dir == DMA_DIR_RX)
@@ -201,15 +201,15 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, · 22 unmodified lines
201201 }
202202 /* TX/RX NORMAL interrupts */
203203 if (likely(intr_status & DMA_CHAN_STATUS_RI)) {
204− u64_stats_update_begin(&rx_q->rxq_stats.syncp);
205− rx_q->rxq_stats.rx_normal_irq_n++;
206− u64_stats_update_end(&rx_q->rxq_stats.syncp);
204+ u64_stats_update_begin(&rxq_stats->syncp);
205+ rxq_stats->rx_normal_irq_n++;
206+ u64_stats_update_end(&rxq_stats->syncp);
207207 ret |= handle_rx;
208208 }
209209 if (likely(intr_status & DMA_CHAN_STATUS_TI)) {
210− u64_stats_update_begin(&tx_q->txq_stats.syncp);
211− tx_q->txq_stats.tx_normal_irq_n++;
212− u64_stats_update_end(&tx_q->txq_stats.syncp);
210+ u64_stats_update_begin(&txq_stats->syncp);
211+ txq_stats->tx_normal_irq_n++;
212+ u64_stats_update_end(&txq_stats->syncp);
213213 ret |= handle_tx;
214214 }
215215
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c+8−8
@@ -162,8 +162,8 @@ static void show_rx_process_state(unsigned int status) · 161 unmodified lines
162162 int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
163163 struct stmmac_extra_stats *x, u32 chan, u32 dir)
164164 {
165− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[chan];
166− struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
165+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
166+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
167167 int ret = 0;
168168 /* read the status register (CSR5) */
169169 u32 intr_status = readl(ioaddr + DMA_STATUS);
@@ -215,16 +215,16 @@ int dwmac_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr, · 45 unmodified lines
215215 u32 value = readl(ioaddr + DMA_INTR_ENA);
216216 /* to schedule NAPI on real RIE event. */
217217 if (likely(value & DMA_INTR_ENA_RIE)) {
218− u64_stats_update_begin(&rx_q->rxq_stats.syncp);
219− rx_q->rxq_stats.rx_normal_irq_n++;
220− u64_stats_update_end(&rx_q->rxq_stats.syncp);
218+ u64_stats_update_begin(&rxq_stats->syncp);
219+ rxq_stats->rx_normal_irq_n++;
220+ u64_stats_update_end(&rxq_stats->syncp);
221221 ret |= handle_rx;
222222 }
223223 }
224224 if (likely(intr_status & DMA_STATUS_TI)) {
225− u64_stats_update_begin(&tx_q->txq_stats.syncp);
226− tx_q->txq_stats.tx_normal_irq_n++;
227− u64_stats_update_end(&tx_q->txq_stats.syncp);
225+ u64_stats_update_begin(&txq_stats->syncp);
226+ txq_stats->tx_normal_irq_n++;
227+ u64_stats_update_end(&txq_stats->syncp);
228228 ret |= handle_tx;
229229 }
230230 if (unlikely(intr_status & DMA_STATUS_ERI))
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c+8−8
@@ -337,8 +337,8 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, · 336 unmodified lines
337337 struct stmmac_extra_stats *x, u32 chan,
338338 u32 dir)
339339 {
340− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[chan];
341− struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
340+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[chan];
341+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[chan];
342342 u32 intr_status = readl(ioaddr + XGMAC_DMA_CH_STATUS(chan));
343343 u32 intr_en = readl(ioaddr + XGMAC_DMA_CH_INT_EN(chan));
344344 int ret = 0;
@@ -367,15 +367,15 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, · 22 unmodified lines
367367 /* TX/RX NORMAL interrupts */
368368 if (likely(intr_status & XGMAC_NIS)) {
369369 if (likely(intr_status & XGMAC_RI)) {
370− u64_stats_update_begin(&rx_q->rxq_stats.syncp);
371− rx_q->rxq_stats.rx_normal_irq_n++;
372− u64_stats_update_end(&rx_q->rxq_stats.syncp);
370+ u64_stats_update_begin(&rxq_stats->syncp);
371+ rxq_stats->rx_normal_irq_n++;
372+ u64_stats_update_end(&rxq_stats->syncp);
373373 ret |= handle_rx;
374374 }
375375 if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) {
376− u64_stats_update_begin(&tx_q->txq_stats.syncp);
377− tx_q->txq_stats.tx_normal_irq_n++;
378− u64_stats_update_end(&tx_q->txq_stats.syncp);
376+ u64_stats_update_begin(&txq_stats->syncp);
377+ txq_stats->tx_normal_irq_n++;
378+ u64_stats_update_end(&txq_stats->syncp);
379379 ret |= handle_tx;
380380 }
381381 }
drivers/net/ethernet/stmicro/stmmac/stmmac.h+0−2
@@ -78,7 +78,6 @@ struct stmmac_tx_queue { · 77 unmodified lines
7878 dma_addr_t dma_tx_phy;
7979 dma_addr_t tx_tail_addr;
8080 u32 mss;
81− struct stmmac_txq_stats txq_stats;
8281 };
8382
8483 struct stmmac_rx_buffer {
@@ -123,7 +122,6 @@ struct stmmac_rx_queue { · 38 unmodified lines
123122 unsigned int len;
124123 unsigned int error;
125124 } state;
126− struct stmmac_rxq_stats rxq_stats;
127125 };
128126
129127 struct stmmac_channel {
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c+16−16
@@ -548,14 +548,14 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data) · 547 unmodified lines
548548
549549 pos = data;
550550 for (q = 0; q < tx_cnt; q++) {
551− struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[q];
551+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[q];
552552 struct stmmac_txq_stats snapshot;
553553
554554 data = pos;
555555 do {
556− start = u64_stats_fetch_begin(&tx_q->txq_stats.syncp);
557− snapshot = tx_q->txq_stats;
558− } while (u64_stats_fetch_retry(&tx_q->txq_stats.syncp, start));
556+ start = u64_stats_fetch_begin(&txq_stats->syncp);
557+ snapshot = *txq_stats;
558+ } while (u64_stats_fetch_retry(&txq_stats->syncp, start));
559559
560560 p = (char *)&snapshot + offsetof(struct stmmac_txq_stats, tx_pkt_n);
561561 for (stat = 0; stat < STMMAC_TXQ_STATS; stat++) {
@@ -566,14 +566,14 @@ static void stmmac_get_per_qstats(struct stmmac_priv *priv, u64 *data) · 4 unmodified lines
566566
567567 pos = data;
568568 for (q = 0; q < rx_cnt; q++) {
569− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[q];
569+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[q];
570570 struct stmmac_rxq_stats snapshot;
571571
572572 data = pos;
573573 do {
574− start = u64_stats_fetch_begin(&rx_q->rxq_stats.syncp);
575− snapshot = rx_q->rxq_stats;
576− } while (u64_stats_fetch_retry(&rx_q->rxq_stats.syncp, start));
574+ start = u64_stats_fetch_begin(&rxq_stats->syncp);
575+ snapshot = *rxq_stats;
576+ } while (u64_stats_fetch_retry(&rxq_stats->syncp, start));
577577
578578 p = (char *)&snapshot + offsetof(struct stmmac_rxq_stats, rx_pkt_n);
579579 for (stat = 0; stat < STMMAC_RXQ_STATS; stat++) {
@@ -637,14 +637,14 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, · 57 unmodified lines
637637
638638 pos = j;
639639 for (i = 0; i < rx_queues_count; i++) {
640− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[i];
640+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[i];
641641 struct stmmac_rxq_stats snapshot;
642642
643643 j = pos;
644644 do {
645− start = u64_stats_fetch_begin(&rx_q->rxq_stats.syncp);
646− snapshot = rx_q->rxq_stats;
647− } while (u64_stats_fetch_retry(&rx_q->rxq_stats.syncp, start));
645+ start = u64_stats_fetch_begin(&rxq_stats->syncp);
646+ snapshot = *rxq_stats;
647+ } while (u64_stats_fetch_retry(&rxq_stats->syncp, start));
648648
649649 data[j++] += snapshot.rx_pkt_n;
650650 data[j++] += snapshot.rx_normal_irq_n;
@@ -654,14 +654,14 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, · 3 unmodified lines
654654
655655 pos = j;
656656 for (i = 0; i < tx_queues_count; i++) {
657− struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[i];
657+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[i];
658658 struct stmmac_txq_stats snapshot;
659659
660660 j = pos;
661661 do {
662− start = u64_stats_fetch_begin(&tx_q->txq_stats.syncp);
663− snapshot = tx_q->txq_stats;
664− } while (u64_stats_fetch_retry(&tx_q->txq_stats.syncp, start));
662+ start = u64_stats_fetch_begin(&txq_stats->syncp);
663+ snapshot = *txq_stats;
664+ } while (u64_stats_fetch_retry(&txq_stats->syncp, start));
665665
666666 data[j++] += snapshot.tx_pkt_n;
667667 data[j++] += snapshot.tx_normal_irq_n;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+73−62
@@ -2426,6 +2426,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) · 2425 unmodified lines
24262426 {
24272427 struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue);
24282428 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
2429+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
24292430 struct xsk_buff_pool *pool = tx_q->xsk_pool;
24302431 unsigned int entry = tx_q->cur_tx;
24312432 struct dma_desc *tx_desc = NULL;
@@ -2505,9 +2506,9 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget) · 73 unmodified lines
25052506 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size);
25062507 entry = tx_q->cur_tx;
25072508 }
2508− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
2509− tx_q->txq_stats.tx_set_ic_bit += tx_set_ic_bit;
2510− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
2509+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
2510+ txq_stats->tx_set_ic_bit += tx_set_ic_bit;
2511+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
25112512
25122513 if (tx_desc) {
25132514 stmmac_flush_tx_descriptors(priv, queue);
@@ -2547,6 +2548,7 @@ static void stmmac_bump_dma_threshold(struct stmmac_priv *priv, u32 chan) · 33 unmodified lines
25472548 static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
25482549 {
25492550 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
2551+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
25502552 unsigned int bytes_compl = 0, pkts_compl = 0;
25512553 unsigned int entry, xmits = 0, count = 0;
25522554 u32 tx_packets = 0, tx_errors = 0;
@@ -2704,15 +2706,13 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue) · 151 unmodified lines
27042706
27052707 /* We still have pending packets, let's call for a new scheduling */
27062708 if (tx_q->dirty_tx != tx_q->cur_tx)
2707− hrtimer_start(&tx_q->txtimer,
2708− STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]),
2709− HRTIMER_MODE_REL);
2709+ stmmac_tx_timer_arm(priv, queue);
27102710
2711− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
2712− tx_q->txq_stats.tx_packets += tx_packets;
2713− tx_q->txq_stats.tx_pkt_n += tx_packets;
2714− tx_q->txq_stats.tx_clean++;
2715− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
2711+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
2712+ txq_stats->tx_packets += tx_packets;
2713+ txq_stats->tx_pkt_n += tx_packets;
2714+ txq_stats->tx_clean++;
2715+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
27162716
27172717 priv->xstats.tx_errors += tx_errors;
27182718
@@ -2995,9 +2995,13 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv) · 276 unmodified lines
29952995 static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue)
29962996 {
29972997 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
2998+ u32 tx_coal_timer = priv->tx_coal_timer[queue];
2999+
3000+ if (!tx_coal_timer)
3001+ return;
29983002
29993003 hrtimer_start(&tx_q->txtimer,
3000− STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]),
3004+ STMMAC_COAL_TIMER(tx_coal_timer),
30013005 HRTIMER_MODE_REL);
30023006 }
30033007
@@ -4112,6 +4116,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 1108 unmodified lines
41124116 int nfrags = skb_shinfo(skb)->nr_frags;
41134117 u32 queue = skb_get_queue_mapping(skb);
41144118 unsigned int first_entry, tx_packets;
4119+ struct stmmac_txq_stats *txq_stats;
41154120 int tmp_pay_len = 0, first_tx;
41164121 struct stmmac_tx_queue *tx_q;
41174122 bool has_vlan, set_ic;
@@ -4122,6 +4127,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 4 unmodified lines
41224127 int i;
41234128
41244129 tx_q = &priv->dma_conf.tx_queue[queue];
4130+ txq_stats = &priv->xstats.txq_stats[queue];
41254131 first_tx = tx_q->cur_tx;
41264132
41274133 /* Compute header lengths */
@@ -4280,13 +4286,13 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 152 unmodified lines
42804286 netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, queue));
42814287 }
42824288
4283− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
4284− tx_q->txq_stats.tx_bytes += skb->len;
4285− tx_q->txq_stats.tx_tso_frames++;
4286− tx_q->txq_stats.tx_tso_nfrags += nfrags;
4289+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
4290+ txq_stats->tx_bytes += skb->len;
4291+ txq_stats->tx_tso_frames++;
4292+ txq_stats->tx_tso_nfrags += nfrags;
42874293 if (set_ic)
4288− tx_q->txq_stats.tx_set_ic_bit++;
4289− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
4294+ txq_stats->tx_set_ic_bit++;
4295+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
42904296
42914297 if (priv->sarc_type)
42924298 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
@@ -4357,6 +4363,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 64 unmodified lines
43574363 u32 queue = skb_get_queue_mapping(skb);
43584364 int nfrags = skb_shinfo(skb)->nr_frags;
43594365 int gso = skb_shinfo(skb)->gso_type;
4366+ struct stmmac_txq_stats *txq_stats;
43604367 struct dma_edesc *tbs_desc = NULL;
43614368 struct dma_desc *desc, *first;
43624369 struct stmmac_tx_queue *tx_q;
@@ -4366,6 +4373,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 3 unmodified lines
43664373 dma_addr_t des;
43674374
43684375 tx_q = &priv->dma_conf.tx_queue[queue];
4376+ txq_stats = &priv->xstats.txq_stats[queue];
43694377 first_tx = tx_q->cur_tx;
43704378
43714379 if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)
@@ -4517,11 +4525,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 145 unmodified lines
45174525 netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, queue));
45184526 }
45194527
4520− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
4521− tx_q->txq_stats.tx_bytes += skb->len;
4528+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
4529+ txq_stats->tx_bytes += skb->len;
45224530 if (set_ic)
4523− tx_q->txq_stats.tx_set_ic_bit++;
4524− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
4531+ txq_stats->tx_set_ic_bit++;
4532+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
45254533
45264534 if (priv->sarc_type)
45274535 stmmac_set_desc_sarc(priv, first, priv->sarc_type);
@@ -4728,6 +4736,7 @@ static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, · 200 unmodified lines
47284736 static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
47294737 struct xdp_frame *xdpf, bool dma_map)
47304738 {
4739+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[queue];
47314740 struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
47324741 unsigned int entry = tx_q->cur_tx;
47334742 struct dma_desc *tx_desc;
@@ -4787,9 +4796,9 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, · 53 unmodified lines
47874796 unsigned long flags;
47884797 tx_q->tx_count_frames = 0;
47894798 stmmac_set_tx_ic(priv, tx_desc);
4790− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
4791− tx_q->txq_stats.tx_set_ic_bit++;
4792− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
4799+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
4800+ txq_stats->tx_set_ic_bit++;
4801+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
47934802 }
47944803
47954804 stmmac_enable_dma_transmission(priv, priv->ioaddr);
@@ -4934,7 +4943,7 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue, · 138 unmodified lines
49344943 struct dma_desc *p, struct dma_desc *np,
49354944 struct xdp_buff *xdp)
49364945 {
4937− struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
4946+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[queue];
49384947 struct stmmac_channel *ch = &priv->channel[queue];
49394948 unsigned int len = xdp->data_end - xdp->data;
49404949 enum pkt_hash_types hash_type;
@@ -4964,10 +4973,10 @@ static void stmmac_dispatch_skb_zc(struct stmmac_priv *priv, u32 queue, · 23 unmodified lines
49644973 skb_record_rx_queue(skb, queue);
49654974 napi_gro_receive(&ch->rxtx_napi, skb);
49664975
4967− flags = u64_stats_update_begin_irqsave(&rx_q->rxq_stats.syncp);
4968− rx_q->rxq_stats.rx_pkt_n++;
4969− rx_q->rxq_stats.rx_bytes += len;
4970− u64_stats_update_end_irqrestore(&rx_q->rxq_stats.syncp, flags);
4976+ flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
4977+ rxq_stats->rx_pkt_n++;
4978+ rxq_stats->rx_bytes += len;
4979+ u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
49714980 }
49724981
49734982 static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
@@ -5040,6 +5049,7 @@ static struct stmmac_xdp_buff *xsk_buff_to_stmmac_ctx(struct xdp_buff *xdp) · 66 unmodified lines
50405049
50415050 static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
50425051 {
5052+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[queue];
50435053 struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
50445054 unsigned int count = 0, error = 0, len = 0;
50455055 int dirty = stmmac_rx_dirty(priv, queue);
@@ -5203,9 +5213,9 @@ read_again: · 157 unmodified lines
52035213
52045214 stmmac_finalize_xdp_rx(priv, xdp_status);
52055215
5206− flags = u64_stats_update_begin_irqsave(&rx_q->rxq_stats.syncp);
5207− rx_q->rxq_stats.rx_pkt_n += count;
5208− u64_stats_update_end_irqrestore(&rx_q->rxq_stats.syncp, flags);
5216+ flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5217+ rxq_stats->rx_pkt_n += count;
5218+ u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
52095219
52105220 priv->xstats.rx_dropped += rx_dropped;
52115221 priv->xstats.rx_errors += rx_errors;
@@ -5233,6 +5243,7 @@ read_again: · 21 unmodified lines
52335243 static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
52345244 {
52355245 u32 rx_errors = 0, rx_dropped = 0, rx_bytes = 0, rx_packets = 0;
5246+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[queue];
52365247 struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
52375248 struct stmmac_channel *ch = &priv->channel[queue];
52385249 unsigned int count = 0, error = 0, len = 0;
@@ -5494,11 +5505,11 @@ drain_data: · 255 unmodified lines
54945505
54955506 stmmac_rx_refill(priv, queue);
54965507
5497− flags = u64_stats_update_begin_irqsave(&rx_q->rxq_stats.syncp);
5498− rx_q->rxq_stats.rx_packets += rx_packets;
5499− rx_q->rxq_stats.rx_bytes += rx_bytes;
5500− rx_q->rxq_stats.rx_pkt_n += count;
5501− u64_stats_update_end_irqrestore(&rx_q->rxq_stats.syncp, flags);
5508+ flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5509+ rxq_stats->rx_packets += rx_packets;
5510+ rxq_stats->rx_bytes += rx_bytes;
5511+ rxq_stats->rx_pkt_n += count;
5512+ u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
55025513
55035514 priv->xstats.rx_dropped += rx_dropped;
55045515 priv->xstats.rx_errors += rx_errors;
@@ -5511,15 +5522,15 @@ static int stmmac_napi_poll_rx(struct napi_struct *napi, int budget) · 6 unmodified lines
55115522 struct stmmac_channel *ch =
55125523 container_of(napi, struct stmmac_channel, rx_napi);
55135524 struct stmmac_priv *priv = ch->priv_data;
5514− struct stmmac_rx_queue *rx_q;
5525+ struct stmmac_rxq_stats *rxq_stats;
55155526 u32 chan = ch->index;
55165527 unsigned long flags;
55175528 int work_done;
55185529
5519− rx_q = &priv->dma_conf.rx_queue[chan];
5520− flags = u64_stats_update_begin_irqsave(&rx_q->rxq_stats.syncp);
5521− rx_q->rxq_stats.napi_poll++;
5522− u64_stats_update_end_irqrestore(&rx_q->rxq_stats.syncp, flags);
5530+ rxq_stats = &priv->xstats.rxq_stats[chan];
5531+ flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5532+ rxq_stats->napi_poll++;
5533+ u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
55235534
55245535 work_done = stmmac_rx(priv, budget, chan);
55255536 if (work_done < budget && napi_complete_done(napi, work_done)) {
@@ -5538,15 +5549,15 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) · 12 unmodified lines
55385549 struct stmmac_channel *ch =
55395550 container_of(napi, struct stmmac_channel, tx_napi);
55405551 struct stmmac_priv *priv = ch->priv_data;
5541− struct stmmac_tx_queue *tx_q;
5552+ struct stmmac_txq_stats *txq_stats;
55425553 u32 chan = ch->index;
55435554 unsigned long flags;
55445555 int work_done;
55455556
5546− tx_q = &priv->dma_conf.tx_queue[chan];
5547− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
5548− tx_q->txq_stats.napi_poll++;
5549− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
5557+ txq_stats = &priv->xstats.txq_stats[chan];
5558+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
5559+ txq_stats->napi_poll++;
5560+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
55505561
55515562 work_done = stmmac_tx_clean(priv, budget, chan);
55525563 work_done = min(work_done, budget);
@@ -5568,20 +5579,20 @@ static int stmmac_napi_poll_rxtx(struct napi_struct *napi, int budget) · 15 unmodified lines
55685579 container_of(napi, struct stmmac_channel, rxtx_napi);
55695580 struct stmmac_priv *priv = ch->priv_data;
55705581 int rx_done, tx_done, rxtx_done;
5571− struct stmmac_rx_queue *rx_q;
5572− struct stmmac_tx_queue *tx_q;
5582+ struct stmmac_rxq_stats *rxq_stats;
5583+ struct stmmac_txq_stats *txq_stats;
55735584 u32 chan = ch->index;
55745585 unsigned long flags;
55755586
5576− rx_q = &priv->dma_conf.rx_queue[chan];
5577− flags = u64_stats_update_begin_irqsave(&rx_q->rxq_stats.syncp);
5578− rx_q->rxq_stats.napi_poll++;
5579− u64_stats_update_end_irqrestore(&rx_q->rxq_stats.syncp, flags);
5587+ rxq_stats = &priv->xstats.rxq_stats[chan];
5588+ flags = u64_stats_update_begin_irqsave(&rxq_stats->syncp);
5589+ rxq_stats->napi_poll++;
5590+ u64_stats_update_end_irqrestore(&rxq_stats->syncp, flags);
55805591
5581− tx_q = &priv->dma_conf.tx_queue[chan];
5582− flags = u64_stats_update_begin_irqsave(&tx_q->txq_stats.syncp);
5583− tx_q->txq_stats.napi_poll++;
5584− u64_stats_update_end_irqrestore(&tx_q->txq_stats.syncp, flags);
5592+ txq_stats = &priv->xstats.txq_stats[chan];
5593+ flags = u64_stats_update_begin_irqsave(&txq_stats->syncp);
5594+ txq_stats->napi_poll++;
5595+ u64_stats_update_end_irqrestore(&txq_stats->syncp, flags);
55855596
55865597 tx_done = stmmac_tx_clean(priv, budget, chan);
55875598 tx_done = min(tx_done, budget);
@@ -6924,7 +6935,7 @@ static void stmmac_get_stats64(struct net_device *dev, struct rtnl_link_stats64 · 1336 unmodified lines
69246935 int q;
69256936
69266937 for (q = 0; q < tx_cnt; q++) {
6927− struct stmmac_txq_stats *txq_stats = &priv->dma_conf.tx_queue[q].txq_stats;
6938+ struct stmmac_txq_stats *txq_stats = &priv->xstats.txq_stats[q];
69286939 u64 tx_packets;
69296940 u64 tx_bytes;
69306941
@@ -6939,7 +6950,7 @@ static void stmmac_get_stats64(struct net_device *dev, struct rtnl_link_stats64 · 8 unmodified lines
69396950 }
69406951
69416952 for (q = 0; q < rx_cnt; q++) {
6942− struct stmmac_rxq_stats *rxq_stats = &priv->dma_conf.rx_queue[q].rxq_stats;
6953+ struct stmmac_rxq_stats *rxq_stats = &priv->xstats.rxq_stats[q];
69436954 u64 rx_packets;
69446955 u64 rx_bytes;
69456956
@@ -7340,9 +7351,9 @@ int stmmac_dvr_probe(struct device *device, · 394 unmodified lines
73407351 priv->dev = ndev;
73417352
73427353 for (i = 0; i < MTL_MAX_RX_QUEUES; i++)
7343− u64_stats_init(&priv->dma_conf.rx_queue[i].rxq_stats.syncp);
7354+ u64_stats_init(&priv->xstats.rxq_stats[i].syncp);
73447355 for (i = 0; i < MTL_MAX_TX_QUEUES; i++)
7345− u64_stats_init(&priv->dma_conf.tx_queue[i].txq_stats.syncp);
7356+ u64_stats_init(&priv->xstats.txq_stats[i].syncp);
73467357
73477358 stmmac_set_ethtool_ops(ndev);
73487359 priv->pause = pause;
drivers/net/ethernet/ti/Kconfig+1−0
@@ -199,6 +199,7 @@ config TI_ICSSG_PRUETH · 198 unmodified lines
199199
200200 config TI_ICSS_IEP
201201 tristate "TI PRU ICSS IEP driver"
202+ depends on PTP_1588_CLOCK_OPTIONAL
202203 depends on TI_PRUSS
203204 default TI_PRUSS
204205 help
drivers/net/team/team.c+9−1
@@ -2115,7 +2115,12 @@ static const struct ethtool_ops team_ethtool_ops = { · 2114 unmodified lines
21152115 static void team_setup_by_port(struct net_device *dev,
21162116 struct net_device *port_dev)
21172117 {
2118− dev->header_ops = port_dev->header_ops;
2118+ struct team *team = netdev_priv(dev);
2119+
2120+ if (port_dev->type == ARPHRD_ETHER)
2121+ dev->header_ops = team->header_ops_cache;
2122+ else
2123+ dev->header_ops = port_dev->header_ops;
21192124 dev->type = port_dev->type;
21202125 dev->hard_header_len = port_dev->hard_header_len;
21212126 dev->needed_headroom = port_dev->needed_headroom;
@@ -2162,8 +2167,11 @@ static int team_dev_type_check_change(struct net_device *dev, · 40 unmodified lines
21622167
21632168 static void team_setup(struct net_device *dev)
21642169 {
2170+ struct team *team = netdev_priv(dev);
2171+
21652172 ether_setup(dev);
21662173 dev->max_mtu = ETH_MAX_MTU;
2174+ team->header_ops_cache = dev->header_ops;
21672175
21682176 dev->netdev_ops = &team_netdev_ops;
21692177 dev->ethtool_ops = &team_ethtool_ops;
drivers/net/thunderbolt/main.c+1−2
@@ -1049,12 +1049,11 @@ static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb, · 1048 unmodified lines
10491049 *tucso = ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
10501050 ip_hdr(skb)->daddr, 0,
10511051 ip_hdr(skb)->protocol, 0);
1052− } else if (skb_is_gso_v6(skb)) {
1052+ } else if (skb_is_gso(skb) && skb_is_gso_v6(skb)) {
10531053 tucso = dest + ((void *)&(tcp_hdr(skb)->check) - data);
10541054 *tucso = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
10551055 &ipv6_hdr(skb)->daddr, 0,
10561056 IPPROTO_TCP, 0);
1057− return false;
10581057 } else if (protocol == htons(ETH_P_IPV6)) {
10591058 tucso = dest + skb_checksum_start_offset(skb) + skb->csum_offset;
10601059 *tucso = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
drivers/net/usb/r8152.c+3−0
@@ -2636,6 +2636,9 @@ static int r8152_poll(struct napi_struct *napi, int budget) · 2635 unmodified lines
26362636 struct r8152 *tp = container_of(napi, struct r8152, napi);
26372637 int work_done;
26382638
2639+ if (!budget)
2640+ return 0;
2641+
26392642 work_done = rx_bottom(tp, budget);
26402643
26412644 if (work_done < budget) {
drivers/net/veth.c+2−0
@@ -1446,6 +1446,8 @@ static int veth_open(struct net_device *dev) · 1445 unmodified lines
14461446 netif_carrier_on(peer);
14471447 }
14481448
1449+ veth_set_xdp_features(dev);
1450+
14491451 return 0;
14501452 }
14511453
drivers/net/vxlan/vxlan_core.c+4−0
@@ -4331,6 +4331,10 @@ static size_t vxlan_get_size(const struct net_device *dev) · 4330 unmodified lines
43314331 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_REMCSUM_TX */
43324332 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_REMCSUM_RX */
43334333 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LOCALBYPASS */
4334+ nla_total_size(0) + /* IFLA_VXLAN_GBP */
4335+ nla_total_size(0) + /* IFLA_VXLAN_GPE */
4336+ nla_total_size(0) + /* IFLA_VXLAN_REMCSUM_NOPARTIAL */
4337+ nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_VNIFILTER */
43344338 0;
43354339 }
43364340
drivers/nvme/host/core.c+35−19
@@ -2245,25 +2245,8 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl) · 2244 unmodified lines
22452245 else
22462246 ctrl->ctrl_config = NVME_CC_CSS_NVM;
22472247
2248− if (ctrl->cap & NVME_CAP_CRMS_CRWMS) {
2249− u32 crto;
2250−
2251− ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CRTO, &crto);
2252− if (ret) {
2253− dev_err(ctrl->device, "Reading CRTO failed (%d)\n",
2254− ret);
2255− return ret;
2256− }
2257−
2258− if (ctrl->cap & NVME_CAP_CRMS_CRIMS) {
2259− ctrl->ctrl_config |= NVME_CC_CRIME;
2260− timeout = NVME_CRTO_CRIMT(crto);
2261− } else {
2262− timeout = NVME_CRTO_CRWMT(crto);
2263− }
2264− } else {
2265− timeout = NVME_CAP_TIMEOUT(ctrl->cap);
2266− }
2248+ if (ctrl->cap & NVME_CAP_CRMS_CRWMS && ctrl->cap & NVME_CAP_CRMS_CRIMS)
2249+ ctrl->ctrl_config |= NVME_CC_CRIME;
22672250
22682251 ctrl->ctrl_config |= (NVME_CTRL_PAGE_SHIFT - 12) << NVME_CC_MPS_SHIFT;
22692252 ctrl->ctrl_config |= NVME_CC_AMS_RR | NVME_CC_SHN_NONE;
@@ -2277,6 +2260,39 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl) · 7 unmodified lines
22772260 if (ret)
22782261 return ret;
22792262
2263+ /* CAP value may change after initial CC write */
2264+ ret = ctrl->ops->reg_read64(ctrl, NVME_REG_CAP, &ctrl->cap);
2265+ if (ret)
2266+ return ret;
2267+
2268+ timeout = NVME_CAP_TIMEOUT(ctrl->cap);
2269+ if (ctrl->cap & NVME_CAP_CRMS_CRWMS) {
2270+ u32 crto, ready_timeout;
2271+
2272+ ret = ctrl->ops->reg_read32(ctrl, NVME_REG_CRTO, &crto);
2273+ if (ret) {
2274+ dev_err(ctrl->device, "Reading CRTO failed (%d)\n",
2275+ ret);
2276+ return ret;
2277+ }
2278+
2279+ /*
2280+ * CRTO should always be greater or equal to CAP.TO, but some
2281+ * devices are known to get this wrong. Use the larger of the
2282+ * two values.
2283+ */
2284+ if (ctrl->ctrl_config & NVME_CC_CRIME)
2285+ ready_timeout = NVME_CRTO_CRIMT(crto);
2286+ else
2287+ ready_timeout = NVME_CRTO_CRWMT(crto);
2288+
2289+ if (ready_timeout < timeout)
2290+ dev_warn_once(ctrl->device, "bad crto:%x cap:%llx\n",
2291+ crto, ctrl->cap);
2292+ else
2293+ timeout = ready_timeout;
2294+ }
2295+
22802296 ctrl->ctrl_config |= NVME_CC_ENABLE;
22812297 ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC, ctrl->ctrl_config);
22822298 if (ret)
drivers/nvme/host/fc.c+1−1
@@ -1924,7 +1924,7 @@ char *nvme_fc_io_getuuid(struct nvmefc_fcp_req *req) · 1923 unmodified lines
19241924 struct nvme_fc_fcp_op *op = fcp_req_to_fcp_op(req);
19251925 struct request *rq = op->rq;
19261926
1927− if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq->bio)
1927+ if (!IS_ENABLED(CONFIG_BLK_CGROUP_FC_APPID) || !rq || !rq->bio)
19281928 return NULL;
19291929 return blkcg_get_fc_appid(rq->bio);
19301930 }
drivers/nvme/host/hwmon.c+1−1
@@ -187,7 +187,7 @@ static umode_t nvme_hwmon_is_visible(const void *_data, · 186 unmodified lines
187187 return 0;
188188 }
189189
190−static const struct hwmon_channel_info *nvme_hwmon_info[] = {
190+static const struct hwmon_channel_info *const nvme_hwmon_info[] = {
191191 HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ),
192192 HWMON_CHANNEL_INFO(temp,
193193 HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN |
drivers/nvme/host/pci.c+0−3
@@ -2916,9 +2916,6 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev, · 2915 unmodified lines
29162916 struct nvme_dev *dev;
29172917 int ret = -ENOMEM;
29182918
2919− if (node == NUMA_NO_NODE)
2920− set_dev_node(&pdev->dev, first_memory_node);
2921−
29222919 dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node);
29232920 if (!dev)
29242921 return ERR_PTR(-ENOMEM);
drivers/nvme/target/tcp.c+1−1
@@ -348,7 +348,7 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) · 347 unmodified lines
348348 while (length) {
349349 u32 iov_len = min_t(u32, length, sg->length - sg_offset);
350350
351− bvec_set_page(iov, sg_page(sg), sg->length,
351+ bvec_set_page(iov, sg_page(sg), iov_len,
352352 sg->offset + sg_offset);
353353
354354 length -= iov_len;
drivers/parisc/ccio-dma.c+9−9
@@ -214,7 +214,7 @@ struct ioa_registers { · 213 unmodified lines
214214 struct ioc {
215215 struct ioa_registers __iomem *ioc_regs; /* I/O MMU base address */
216216 u8 *res_map; /* resource map, bit == pdir entry */
217− u64 *pdir_base; /* physical base address */
217+ __le64 *pdir_base; /* physical base address */
218218 u32 pdir_size; /* bytes, function of IOV Space size */
219219 u32 res_hint; /* next available IOVP -
220220 circular search */
@@ -339,7 +339,7 @@ ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size) · 118 unmodified lines
339339 BUG_ON(pages_needed == 0);
340340 BUG_ON((pages_needed * IOVP_SIZE) > DMA_CHUNK_SIZE);
341341
342− DBG_RES("%s() size: %d pages_needed %d\n",
342+ DBG_RES("%s() size: %zu pages_needed %d\n",
343343 __func__, size, pages_needed);
344344
345345 /*
@@ -427,7 +427,7 @@ ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped) · 81 unmodified lines
427427 BUG_ON((pages_mapped * IOVP_SIZE) > DMA_CHUNK_SIZE);
428428 BUG_ON(pages_mapped > BITS_PER_LONG);
429429
430− DBG_RES("%s(): res_idx: %d pages_mapped %d\n",
430+ DBG_RES("%s(): res_idx: %d pages_mapped %lu\n",
431431 __func__, res_idx, pages_mapped);
432432
433433 #ifdef CCIO_COLLECT_STATS
@@ -543,7 +543,7 @@ static u32 hint_lookup[] = { · 109 unmodified lines
543543 * index are bits 12:19 of the value returned by LCI.
544544 */
545545 static void
546−ccio_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
546+ccio_io_pdir_entry(__le64 *pdir_ptr, space_t sid, unsigned long vba,
547547 unsigned long hints)
548548 {
549549 register unsigned long pa;
@@ -719,7 +719,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size, · 169 unmodified lines
719719 unsigned long flags;
720720 dma_addr_t iovp;
721721 dma_addr_t offset;
722− u64 *pdir_start;
722+ __le64 *pdir_start;
723723 unsigned long hint = hint_lookup[(int)direction];
724724
725725 BUG_ON(!dev);
@@ -746,8 +746,8 @@ ccio_map_single(struct device *dev, void *addr, size_t size, · 20 unmodified lines
746746
747747 pdir_start = &(ioc->pdir_base[idx]);
748748
749− DBG_RUN("%s() 0x%p -> 0x%lx size: %0x%x\n",
750− __func__, addr, (long)iovp | offset, size);
749+ DBG_RUN("%s() %px -> %#lx size: %zu\n",
750+ __func__, addr, (long)(iovp | offset), size);
751751
752752 /* If not cacheline aligned, force SAFE_DMA on the whole mess */
753753 if((size % L1_CACHE_BYTES) || ((unsigned long)addr % L1_CACHE_BYTES))
@@ -805,7 +805,7 @@ ccio_unmap_page(struct device *dev, dma_addr_t iova, size_t size, · 51 unmodified lines
805805 return;
806806 }
807807
808− DBG_RUN("%s() iovp 0x%lx/%x\n",
808+ DBG_RUN("%s() iovp %#lx/%zx\n",
809809 __func__, (long)iova, size);
810810
811811 iova ^= offset; /* clear offset bits */
@@ -1283,7 +1283,7 @@ ccio_ioc_init(struct ioc *ioc) · 471 unmodified lines
12831283 iova_space_size>>20,
12841284 iov_order + PAGE_SHIFT);
12851285
1286− ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
1286+ ioc->pdir_base = (__le64 *)__get_free_pages(GFP_KERNEL,
12871287 get_order(ioc->pdir_size));
12881288 if(NULL == ioc->pdir_base) {
12891289 panic("%s() could not allocate I/O Page Table\n", __func__);
drivers/parisc/iommu-helpers.h+4−4
@@ -14,13 +14,13 @@ · 13 unmodified lines
1414 static inline unsigned int
1515 iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents,
1616 unsigned long hint,
17− void (*iommu_io_pdir_entry)(u64 *, space_t, unsigned long,
17+ void (*iommu_io_pdir_entry)(__le64 *, space_t, unsigned long,
1818 unsigned long))
1919 {
2020 struct scatterlist *dma_sg = startsg; /* pointer to current DMA */
2121 unsigned int n_mappings = 0;
2222 unsigned long dma_offset = 0, dma_len = 0;
23− u64 *pdirp = NULL;
23+ __le64 *pdirp = NULL;
2424
2525 /* Horrible hack. For efficiency's sake, dma_sg starts one
2626 * entry below the true start (it is immediately incremented
@@ -31,8 +31,8 @@ iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents, · 4 unmodified lines
3131 unsigned long vaddr;
3232 long size;
3333
34− DBG_RUN_SG(" %d : %08lx/%05x %p/%05x\n", nents,
35− (unsigned long)sg_dma_address(startsg), cnt,
34+ DBG_RUN_SG(" %d : %08lx %p/%05x\n", nents,
35+ (unsigned long)sg_dma_address(startsg),
3636 sg_virt(startsg), startsg->length
3737 );
3838
drivers/parisc/iosapic.c+2−2
@@ -202,9 +202,9 @@ static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 va · 201 unmodified lines
202202
203203 static DEFINE_SPINLOCK(iosapic_lock);
204204
205−static inline void iosapic_eoi(void __iomem *addr, unsigned int data)
205+static inline void iosapic_eoi(__le32 __iomem *addr, __le32 data)
206206 {
207− __raw_writel(data, addr);
207+ __raw_writel((__force u32)data, addr);
208208 }
209209
210210 /*
drivers/parisc/iosapic_private.h+2−2
@@ -118,8 +118,8 @@ struct iosapic_irt { · 117 unmodified lines
118118 struct vector_info {
119119 struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */
120120 struct irt_entry *irte; /* IRT entry */
121− u32 __iomem *eoi_addr; /* precalculate EOI reg address */
122− u32 eoi_data; /* IA64: ? PA: swapped txn_data */
121+ __le32 __iomem *eoi_addr; /* precalculate EOI reg address */
122+ __le32 eoi_data; /* IA64: ? PA: swapped txn_data */
123123 int txn_irq; /* virtual IRQ number for processor */
124124 ulong txn_addr; /* IA64: id_eid PA: partial HPA */
125125 u32 txn_data; /* CPU interrupt bit */
drivers/parisc/sba_iommu.c+16−22
@@ -46,8 +46,6 @@ · 45 unmodified lines
4646 #include <linux/module.h>
4747
4848 #include <asm/ropes.h>
49−#include <asm/mckinley.h> /* for proc_mckinley_root */
50−#include <asm/runway.h> /* for proc_runway_root */
5149 #include <asm/page.h> /* for PAGE0 */
5250 #include <asm/pdc.h> /* for PDC_MODEL_* */
5351 #include <asm/pdcpat.h> /* for is_pdc_pat() */
@@ -122,7 +120,7 @@ MODULE_PARM_DESC(sba_reserve_agpgart, "Reserve half of IO pdir as AGPGART"); · 68 unmodified lines
122120 #endif
123121
124122 static struct proc_dir_entry *proc_runway_root __ro_after_init;
125−struct proc_dir_entry *proc_mckinley_root __ro_after_init;
123+static struct proc_dir_entry *proc_mckinley_root __ro_after_init;
126124
127125 /************************************
128126 ** SBA register read and write support
@@ -204,7 +202,7 @@ static void · 75 unmodified lines
204202 sba_dump_pdir_entry(struct ioc *ioc, char *msg, uint pide)
205203 {
206204 /* start printing from lowest pde in rval */
207− u64 *ptr = &(ioc->pdir_base[pide & (~0U * BITS_PER_LONG)]);
205+ __le64 *ptr = &(ioc->pdir_base[pide & (~0U * BITS_PER_LONG)]);
208206 unsigned long *rptr = (unsigned long *) &(ioc->res_map[(pide >>3) & ~(sizeof(unsigned long) - 1)]);
209207 uint rcnt;
210208
@@ -571,7 +569,7 @@ typedef unsigned long space_t; · 360 unmodified lines
571569 */
572570
573571 static void
574−sba_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
572+sba_io_pdir_entry(__le64 *pdir_ptr, space_t sid, unsigned long vba,
575573 unsigned long hint)
576574 {
577575 u64 pa; /* physical address */
@@ -615,7 +613,7 @@ static void · 37 unmodified lines
615613 sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
616614 {
617615 u32 iovp = (u32) SBA_IOVP(ioc,iova);
618− u64 *pdir_ptr = &ioc->pdir_base[PDIR_INDEX(iovp)];
616+ __le64 *pdir_ptr = &ioc->pdir_base[PDIR_INDEX(iovp)];
619617
620618 #ifdef ASSERT_PDIR_SANITY
621619 /* Assert first pdir entry is set.
@@ -716,7 +714,7 @@ sba_map_single(struct device *dev, void *addr, size_t size, · 94 unmodified lines
716714 unsigned long flags;
717715 dma_addr_t iovp;
718716 dma_addr_t offset;
719− u64 *pdir_start;
717+ __le64 *pdir_start;
720718 int pide;
721719
722720 ioc = GET_IOC(dev);
@@ -1434,7 +1432,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) · 711 unmodified lines
14341432
14351433 ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64);
14361434
1437− DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",
1435+ DBG_INIT("%s() hpa %px mem %ldMB IOV %dMB (%d bits)\n",
14381436 __func__,
14391437 ioc->ioc_hpa,
14401438 (unsigned long) totalram_pages() >> (20 - PAGE_SHIFT),
@@ -1471,7 +1469,7 @@ sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num) · 30 unmodified lines
14711469 ioc->iovp_mask = ~(iova_space_mask + PAGE_SIZE - 1);
14721470 #endif
14731471
1474− DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n",
1472+ DBG_INIT("%s() IOV base %#lx mask %#0lx\n",
14751473 __func__, ioc->ibase, ioc->imask);
14761474
14771475 /*
@@ -1583,7 +1581,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, · 105 unmodified lines
15831581
15841582 if (!IS_PLUTO(sba_dev->dev)) {
15851583 ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL);
1586− DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->",
1584+ DBG_INIT("%s() hpa %px ioc_ctl 0x%Lx ->",
15871585 __func__, sba_dev->sba_hpa, ioc_ctl);
15881586 ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE);
15891587 ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC;
@@ -1668,14 +1666,14 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, · 78 unmodified lines
16681666 /* flush out the last writes */
16691667 READ_REG(sba_dev->ioc[i].ioc_hpa + ROPE7_CTL);
16701668
1671− DBG_INIT(" ioc[%d] ROPE_CFG 0x%Lx ROPE_DBG 0x%Lx\n",
1669+ DBG_INIT(" ioc[%d] ROPE_CFG %#lx ROPE_DBG %lx\n",
16721670 i,
1673− READ_REG(sba_dev->ioc[i].ioc_hpa + 0x40),
1674− READ_REG(sba_dev->ioc[i].ioc_hpa + 0x50)
1671+ (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x40),
1672+ (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x50)
16751673 );
1676− DBG_INIT(" STATUS_CONTROL 0x%Lx FLUSH_CTRL 0x%Lx\n",
1677− READ_REG(sba_dev->ioc[i].ioc_hpa + 0x108),
1678− READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400)
1674+ DBG_INIT(" STATUS_CONTROL %#lx FLUSH_CTRL %#lx\n",
1675+ (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x108),
1676+ (unsigned long) READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400)
16791677 );
16801678
16811679 if (IS_PLUTO(sba_dev->dev)) {
@@ -1739,7 +1737,7 @@ sba_common_init(struct sba_device *sba_dev) · 57 unmodified lines
17391737 #ifdef ASSERT_PDIR_SANITY
17401738 /* Mark first bit busy - ie no IOVA 0 */
17411739 sba_dev->ioc[i].res_map[0] = 0x80;
1742− sba_dev->ioc[i].pdir_base[0] = 0xeeffc0addbba0080ULL;
1740+ sba_dev->ioc[i].pdir_base[0] = (__force __le64) 0xeeffc0addbba0080ULL;
17431741 #endif
17441742
17451743 /* Third (and last) part of PIRANHA BUG */
@@ -1899,9 +1897,7 @@ static int __init sba_driver_callback(struct parisc_device *dev) · 153 unmodified lines
18991897 int i;
19001898 char *version;
19011899 void __iomem *sba_addr = ioremap(dev->hpa.start, SBA_FUNC_SIZE);
1902−#ifdef CONFIG_PROC_FS
1903− struct proc_dir_entry *root;
1904−#endif
1900+ struct proc_dir_entry *root __maybe_unused;
19051901
19061902 sba_dump_ranges(sba_addr);
19071903
@@ -1967,7 +1963,6 @@ static int __init sba_driver_callback(struct parisc_device *dev) · 59 unmodified lines
19671963
19681964 hppa_dma_ops = &sba_ops;
19691965
1970−#ifdef CONFIG_PROC_FS
19711966 switch (dev->id.hversion) {
19721967 case PLUTO_MCKINLEY_PORT:
19731968 if (!proc_mckinley_root)
@@ -1985,7 +1980,6 @@ static int __init sba_driver_callback(struct parisc_device *dev) · 11 unmodified lines
19851980
19861981 proc_create_single("sba_iommu", 0, root, sba_proc_info);
19871982 proc_create_single("sba_iommu-bitmap", 0, root, sba_proc_bitmap_info);
1988−#endif
19891983 return 0;
19901984 }
19911985
drivers/pci/pcie/aer.c+1−0
@@ -229,6 +229,7 @@ int pcie_aer_is_native(struct pci_dev *dev) · 228 unmodified lines
229229
230230 return pcie_ports_native || host->native_aer;
231231 }
232+EXPORT_SYMBOL_NS_GPL(pcie_aer_is_native, CXL);
232233
233234 static int pci_enable_pcie_error_reporting(struct pci_dev *dev)
234235 {
drivers/pci/pcie/portdrv.h+0−2
@@ -29,10 +29,8 @@ extern bool pcie_ports_dpc_native; · 28 unmodified lines
2929
3030 #ifdef CONFIG_PCIEAER
3131 int pcie_aer_init(void);
32−int pcie_aer_is_native(struct pci_dev *dev);
3332 #else
3433 static inline int pcie_aer_init(void) { return 0; }
35−static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
3634 #endif
3735
3836 #ifdef CONFIG_HOTPLUG_PCI_PCIE
drivers/platform/mellanox/Kconfig+3−2
@@ -60,6 +60,7 @@ config MLXBF_BOOTCTL · 59 unmodified lines
6060 tristate "Mellanox BlueField Firmware Boot Control driver"
6161 depends on ARM64
6262 depends on ACPI
63+ depends on NET
6364 help
6465 The Mellanox BlueField firmware implements functionality to
6566 request swapping the primary and alternate eMMC boot partition,
@@ -80,8 +81,8 @@ config MLXBF_PMC · 14 unmodified lines
8081
8182 config NVSW_SN2201
8283 tristate "Nvidia SN2201 platform driver support"
83− depends on HWMON
84− depends on I2C
84+ depends on HWMON && I2C
85+ depends on ACPI || COMPILE_TEST
8586 select REGMAP_I2C
8687 help
8788 This driver provides support for the Nvidia SN2201 platform.
drivers/platform/mellanox/mlxbf-pmc.c+14−27
@@ -191,6 +191,7 @@ static const struct mlxbf_pmc_events mlxbf_pmc_smgen_events[] = { · 190 unmodified lines
191191 };
192192
193193 static const struct mlxbf_pmc_events mlxbf_pmc_trio_events_1[] = {
194+ { 0x0, "DISABLE" },
194195 { 0xa0, "TPIO_DATA_BEAT" },
195196 { 0xa1, "TDMA_DATA_BEAT" },
196197 { 0xa2, "MAP_DATA_BEAT" },
@@ -214,6 +215,7 @@ static const struct mlxbf_pmc_events mlxbf_pmc_trio_events_1[] = { · 17 unmodified lines
214215 };
215216
216217 static const struct mlxbf_pmc_events mlxbf_pmc_trio_events_2[] = {
218+ { 0x0, "DISABLE" },
217219 { 0xa0, "TPIO_DATA_BEAT" },
218220 { 0xa1, "TDMA_DATA_BEAT" },
219221 { 0xa2, "MAP_DATA_BEAT" },
@@ -246,6 +248,7 @@ static const struct mlxbf_pmc_events mlxbf_pmc_trio_events_2[] = { · 26 unmodified lines
246248 };
247249
248250 static const struct mlxbf_pmc_events mlxbf_pmc_ecc_events[] = {
251+ { 0x0, "DISABLE" },
249252 { 0x100, "ECC_SINGLE_ERROR_CNT" },
250253 { 0x104, "ECC_DOUBLE_ERROR_CNT" },
251254 { 0x114, "SERR_INJ" },
@@ -258,6 +261,7 @@ static const struct mlxbf_pmc_events mlxbf_pmc_ecc_events[] = { · 6 unmodified lines
258261 };
259262
260263 static const struct mlxbf_pmc_events mlxbf_pmc_mss_events[] = {
264+ { 0x0, "DISABLE" },
261265 { 0xc0, "RXREQ_MSS" },
262266 { 0xc1, "RXDAT_MSS" },
263267 { 0xc2, "TXRSP_MSS" },
@@ -265,6 +269,7 @@ static const struct mlxbf_pmc_events mlxbf_pmc_mss_events[] = { · 1 unmodified line
265269 };
266270
267271 static const struct mlxbf_pmc_events mlxbf_pmc_hnf_events[] = {
272+ { 0x0, "DISABLE" },
268273 { 0x45, "HNF_REQUESTS" },
269274 { 0x46, "HNF_REJECTS" },
270275 { 0x47, "ALL_BUSY" },
@@ -323,6 +328,7 @@ static const struct mlxbf_pmc_events mlxbf_pmc_hnf_events[] = { · 52 unmodified lines
323328 };
324329
325330 static const struct mlxbf_pmc_events mlxbf_pmc_hnfnet_events[] = {
331+ { 0x0, "DISABLE" },
326332 { 0x12, "CDN_REQ" },
327333 { 0x13, "DDN_REQ" },
328334 { 0x14, "NDN_REQ" },
@@ -892,7 +898,7 @@ static int mlxbf_pmc_read_event(int blk_num, uint32_t cnt_num, bool is_l3, · 563 unmodified lines
892898 uint64_t *result)
893899 {
894900 uint32_t perfcfg_offset, perfval_offset;
895− uint64_t perfmon_cfg, perfevt, perfctl;
901+ uint64_t perfmon_cfg, perfevt;
896902
897903 if (cnt_num >= pmc->block[blk_num].counters)
898904 return -EINVAL;
@@ -904,25 +910,6 @@ static int mlxbf_pmc_read_event(int blk_num, uint32_t cnt_num, bool is_l3, · 5 unmodified lines
904910 perfval_offset = perfcfg_offset +
905911 pmc->block[blk_num].counters * MLXBF_PMC_REG_SIZE;
906912
907− /* Set counter in "read" mode */
908− perfmon_cfg = FIELD_PREP(MLXBF_PMC_PERFMON_CONFIG_ADDR,
909− MLXBF_PMC_PERFCTL);
910− perfmon_cfg |= FIELD_PREP(MLXBF_PMC_PERFMON_CONFIG_STROBE, 1);
911− perfmon_cfg |= FIELD_PREP(MLXBF_PMC_PERFMON_CONFIG_WR_R_B, 0);
912−
913− if (mlxbf_pmc_write(pmc->block[blk_num].mmio_base + perfcfg_offset,
914− MLXBF_PMC_WRITE_REG_64, perfmon_cfg))
915− return -EFAULT;
916−
917− /* Check if the counter is enabled */
918−
919− if (mlxbf_pmc_read(pmc->block[blk_num].mmio_base + perfval_offset,
920− MLXBF_PMC_READ_REG_64, &perfctl))
921− return -EFAULT;
922−
923− if (!FIELD_GET(MLXBF_PMC_PERFCTL_EN0, perfctl))
924− return -EINVAL;
925−
926913 /* Set counter in "read" mode */
927914 perfmon_cfg = FIELD_PREP(MLXBF_PMC_PERFMON_CONFIG_ADDR,
928915 MLXBF_PMC_PERFEVT);
@@ -1008,7 +995,7 @@ static ssize_t mlxbf_pmc_counter_show(struct device *dev, · 79 unmodified lines
1008995 } else
1009996 return -EINVAL;
1010997
1011− return sprintf(buf, "0x%llx\n", value);
998+ return sysfs_emit(buf, "0x%llx\n", value);
1012999 }
10131000
10141001 /* Store function for "counter" sysfs files */
@@ -1078,13 +1065,13 @@ static ssize_t mlxbf_pmc_event_show(struct device *dev, · 63 unmodified lines
10781065
10791066 err = mlxbf_pmc_read_event(blk_num, cnt_num, is_l3, &evt_num);
10801067 if (err)
1081− return sprintf(buf, "No event being monitored\n");
1068+ return sysfs_emit(buf, "No event being monitored\n");
10821069
10831070 evt_name = mlxbf_pmc_get_event_name(pmc->block_name[blk_num], evt_num);
10841071 if (!evt_name)
10851072 return -EINVAL;
10861073
1087− return sprintf(buf, "0x%llx: %s\n", evt_num, evt_name);
1074+ return sysfs_emit(buf, "0x%llx: %s\n", evt_num, evt_name);
10881075 }
10891076
10901077 /* Store function for "event" sysfs files */
@@ -1139,9 +1126,9 @@ static ssize_t mlxbf_pmc_event_list_show(struct device *dev, · 48 unmodified lines
11391126 return -EINVAL;
11401127
11411128 for (i = 0, buf[0] = '\0'; i < size; ++i) {
1142− len += sprintf(e_info, "0x%x: %s\n", events[i].evt_num,
1143− events[i].evt_name);
1144− if (len > PAGE_SIZE)
1129+ len += snprintf(e_info, sizeof(e_info), "0x%x: %s\n",
1130+ events[i].evt_num, events[i].evt_name);
1131+ if (len >= PAGE_SIZE)
11451132 break;
11461133 strcat(buf, e_info);
11471134 ret = len;
@@ -1168,7 +1155,7 @@ static ssize_t mlxbf_pmc_enable_show(struct device *dev, · 20 unmodified lines
11681155
11691156 value = FIELD_GET(MLXBF_PMC_L3C_PERF_CNT_CFG_EN, perfcnt_cfg);
11701157
1171− return sprintf(buf, "%d\n", value);
1158+ return sysfs_emit(buf, "%d\n", value);
11721159 }
11731160
11741161 /* Store function for "enable" sysfs files - only for l3cache */
drivers/platform/mellanox/mlxbf-tmfifo.c+66−24
@@ -59,6 +59,7 @@ struct mlxbf_tmfifo; · 58 unmodified lines
5959 * @vq: pointer to the virtio virtqueue
6060 * @desc: current descriptor of the pending packet
6161 * @desc_head: head descriptor of the pending packet
62+ * @drop_desc: dummy desc for packet dropping
6263 * @cur_len: processed length of the current descriptor
6364 * @rem_len: remaining length of the pending packet
6465 * @pkt_len: total length of the pending packet
@@ -75,6 +76,7 @@ struct mlxbf_tmfifo_vring { · 10 unmodified lines
7576 struct virtqueue *vq;
7677 struct vring_desc *desc;
7778 struct vring_desc *desc_head;
79+ struct vring_desc drop_desc;
7880 int cur_len;
7981 int rem_len;
8082 u32 pkt_len;
@@ -86,6 +88,14 @@ struct mlxbf_tmfifo_vring { · 5 unmodified lines
8688 struct mlxbf_tmfifo *fifo;
8789 };
8890
91+/* Check whether vring is in drop mode. */
92+#define IS_VRING_DROP(_r) ({ \
93+ typeof(_r) (r) = (_r); \
94+ (r->desc_head == &r->drop_desc ? true : false); })
95+
96+/* A stub length to drop maximum length packet. */
97+#define VRING_DROP_DESC_MAX_LEN GENMASK(15, 0)
98+
8999 /* Interrupt types. */
90100 enum {
91101 MLXBF_TM_RX_LWM_IRQ,
@@ -214,7 +224,7 @@ static u8 mlxbf_tmfifo_net_default_mac[ETH_ALEN] = { · 122 unmodified lines
214224 static efi_char16_t mlxbf_tmfifo_efi_name[] = L"RshimMacAddr";
215225
216226 /* Maximum L2 header length. */
217−#define MLXBF_TMFIFO_NET_L2_OVERHEAD 36
227+#define MLXBF_TMFIFO_NET_L2_OVERHEAD (ETH_HLEN + VLAN_HLEN)
218228
219229 /* Supported virtio-net features. */
220230 #define MLXBF_TMFIFO_NET_FEATURES \
@@ -262,6 +272,7 @@ static int mlxbf_tmfifo_alloc_vrings(struct mlxbf_tmfifo *fifo, · 41 unmodified lines
262272 vring->align = SMP_CACHE_BYTES;
263273 vring->index = i;
264274 vring->vdev_id = tm_vdev->vdev.id.device;
275+ vring->drop_desc.len = VRING_DROP_DESC_MAX_LEN;
265276 dev = &tm_vdev->vdev.dev;
266277
267278 size = vring_size(vring->num, vring->align);
@@ -367,7 +378,7 @@ static u32 mlxbf_tmfifo_get_pkt_len(struct mlxbf_tmfifo_vring *vring, · 99 unmodified lines
367378 return len;
368379 }
369380
370−static void mlxbf_tmfifo_release_pending_pkt(struct mlxbf_tmfifo_vring *vring)
381+static void mlxbf_tmfifo_release_pkt(struct mlxbf_tmfifo_vring *vring)
371382 {
372383 struct vring_desc *desc_head;
373384 u32 len = 0;
@@ -596,19 +607,25 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring, · 222 unmodified lines
596607
597608 if (vring->cur_len + sizeof(u64) <= len) {
598609 /* The whole word. */
599− if (is_rx)
600− memcpy(addr + vring->cur_len, &data, sizeof(u64));
601− else
602− memcpy(&data, addr + vring->cur_len, sizeof(u64));
610+ if (!IS_VRING_DROP(vring)) {
611+ if (is_rx)
612+ memcpy(addr + vring->cur_len, &data,
613+ sizeof(u64));
614+ else
615+ memcpy(&data, addr + vring->cur_len,
616+ sizeof(u64));
617+ }
603618 vring->cur_len += sizeof(u64);
604619 } else {
605620 /* Leftover bytes. */
606− if (is_rx)
607− memcpy(addr + vring->cur_len, &data,
608− len - vring->cur_len);
609− else
610− memcpy(&data, addr + vring->cur_len,
611− len - vring->cur_len);
621+ if (!IS_VRING_DROP(vring)) {
622+ if (is_rx)
623+ memcpy(addr + vring->cur_len, &data,
624+ len - vring->cur_len);
625+ else
626+ memcpy(&data, addr + vring->cur_len,
627+ len - vring->cur_len);
628+ }
612629 vring->cur_len = len;
613630 }
614631
@@ -625,13 +642,14 @@ static void mlxbf_tmfifo_rxtx_word(struct mlxbf_tmfifo_vring *vring, · 10 unmodified lines
625642 * flag is set.
626643 */
627644 static void mlxbf_tmfifo_rxtx_header(struct mlxbf_tmfifo_vring *vring,
628− struct vring_desc *desc,
645+ struct vring_desc **desc,
629646 bool is_rx, bool *vring_change)
630647 {
631648 struct mlxbf_tmfifo *fifo = vring->fifo;
632649 struct virtio_net_config *config;
633650 struct mlxbf_tmfifo_msg_hdr hdr;
634651 int vdev_id, hdr_len;
652+ bool drop_rx = false;
635653
636654 /* Read/Write packet header. */
637655 if (is_rx) {
@@ -651,8 +669,8 @@ static void mlxbf_tmfifo_rxtx_header(struct mlxbf_tmfifo_vring *vring, · 13 unmodified lines
651669 if (ntohs(hdr.len) >
652670 __virtio16_to_cpu(virtio_legacy_is_little_endian(),
653671 config->mtu) +
654− MLXBF_TMFIFO_NET_L2_OVERHEAD)
655− return;
672+ MLXBF_TMFIFO_NET_L2_OVERHEAD)
673+ drop_rx = true;
656674 } else {
657675 vdev_id = VIRTIO_ID_CONSOLE;
658676 hdr_len = 0;
@@ -667,16 +685,25 @@ static void mlxbf_tmfifo_rxtx_header(struct mlxbf_tmfifo_vring *vring, · 8 unmodified lines
667685
668686 if (!tm_dev2)
669687 return;
670− vring->desc = desc;
688+ vring->desc = *desc;
671689 vring = &tm_dev2->vrings[MLXBF_TMFIFO_VRING_RX];
672690 *vring_change = true;
673691 }
692+
693+ if (drop_rx && !IS_VRING_DROP(vring)) {
694+ if (vring->desc_head)
695+ mlxbf_tmfifo_release_pkt(vring);
696+ *desc = &vring->drop_desc;
697+ vring->desc_head = *desc;
698+ vring->desc = *desc;
699+ }
700+
674701 vring->pkt_len = ntohs(hdr.len) + hdr_len;
675702 } else {
676703 /* Network virtio has an extra header. */
677704 hdr_len = (vring->vdev_id == VIRTIO_ID_NET) ?
678705 sizeof(struct virtio_net_hdr) : 0;
679− vring->pkt_len = mlxbf_tmfifo_get_pkt_len(vring, desc);
706+ vring->pkt_len = mlxbf_tmfifo_get_pkt_len(vring, *desc);
680707 hdr.type = (vring->vdev_id == VIRTIO_ID_NET) ?
681708 VIRTIO_ID_NET : VIRTIO_ID_CONSOLE;
682709 hdr.len = htons(vring->pkt_len - hdr_len);
@@ -709,15 +736,23 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring, · 26 unmodified lines
709736 /* Get the descriptor of the next packet. */
710737 if (!vring->desc) {
711738 desc = mlxbf_tmfifo_get_next_pkt(vring, is_rx);
712− if (!desc)
713− return false;
739+ if (!desc) {
740+ /* Drop next Rx packet to avoid stuck. */
741+ if (is_rx) {
742+ desc = &vring->drop_desc;
743+ vring->desc_head = desc;
744+ vring->desc = desc;
745+ } else {
746+ return false;
747+ }
748+ }
714749 } else {
715750 desc = vring->desc;
716751 }
717752
718753 /* Beginning of a packet. Start to Rx/Tx packet header. */
719754 if (vring->pkt_len == 0) {
720− mlxbf_tmfifo_rxtx_header(vring, desc, is_rx, &vring_change);
755+ mlxbf_tmfifo_rxtx_header(vring, &desc, is_rx, &vring_change);
721756 (*avail)--;
722757
723758 /* Return if new packet is for another ring. */
@@ -743,17 +778,24 @@ static bool mlxbf_tmfifo_rxtx_one_desc(struct mlxbf_tmfifo_vring *vring, · 19 unmodified lines
743778 vring->rem_len -= len;
744779
745780 /* Get the next desc on the chain. */
746− if (vring->rem_len > 0 &&
781+ if (!IS_VRING_DROP(vring) && vring->rem_len > 0 &&
747782 (virtio16_to_cpu(vdev, desc->flags) & VRING_DESC_F_NEXT)) {
748783 idx = virtio16_to_cpu(vdev, desc->next);
749784 desc = &vr->desc[idx];
750785 goto mlxbf_tmfifo_desc_done;
751786 }
752787
753− /* Done and release the pending packet. */
754− mlxbf_tmfifo_release_pending_pkt(vring);
788+ /* Done and release the packet. */
755789 desc = NULL;
756790 fifo->vring[is_rx] = NULL;
791+ if (!IS_VRING_DROP(vring)) {
792+ mlxbf_tmfifo_release_pkt(vring);
793+ } else {
794+ vring->pkt_len = 0;
795+ vring->desc_head = NULL;
796+ vring->desc = NULL;
797+ return false;
798+ }
757799
758800 /*
759801 * Make sure the load/store are in order before
@@ -933,7 +975,7 @@ static void mlxbf_tmfifo_virtio_del_vqs(struct virtio_device *vdev) · 173 unmodified lines
933975
934976 /* Release the pending packet. */
935977 if (vring->desc)
936− mlxbf_tmfifo_release_pending_pkt(vring);
978+ mlxbf_tmfifo_release_pkt(vring);
937979 vq = vring->vq;
938980 if (vq) {
939981 vring->vq = NULL;
drivers/platform/x86/asus-nb-wmi.c+9−0
@@ -478,6 +478,15 @@ static const struct dmi_system_id asus_quirks[] = { · 477 unmodified lines
478478 },
479479 .driver_data = &quirk_asus_tablet_mode,
480480 },
481+ {
482+ .callback = dmi_matched,
483+ .ident = "ASUS ROG FLOW X16",
484+ .matches = {
485+ DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
486+ DMI_MATCH(DMI_PRODUCT_NAME, "GV601V"),
487+ },
488+ .driver_data = &quirk_asus_tablet_mode,
489+ },
481490 {
482491 .callback = dmi_matched,
483492 .ident = "ASUS VivoBook E410MA",
drivers/platform/x86/intel_scu_ipc.c+40−26
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/init.h>
2020 #include <linux/interrupt.h>
2121 #include <linux/io.h>
22+#include <linux/iopoll.h>
2223 #include <linux/module.h>
2324 #include <linux/slab.h>
2425
@@ -231,19 +232,15 @@ static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset) · 206 unmodified lines
231232 /* Wait till scu status is busy */
232233 static inline int busy_loop(struct intel_scu_ipc_dev *scu)
233234 {
234− unsigned long end = jiffies + IPC_TIMEOUT;
235−
236− do {
237− u32 status;
238−
239− status = ipc_read_status(scu);
240− if (!(status & IPC_STATUS_BUSY))
241− return (status & IPC_STATUS_ERR) ? -EIO : 0;
235+ u8 status;
236+ int err;
242237
243− usleep_range(50, 100);
244− } while (time_before(jiffies, end));
238+ err = readx_poll_timeout(ipc_read_status, scu, status, !(status & IPC_STATUS_BUSY),
239+ 100, jiffies_to_usecs(IPC_TIMEOUT));
240+ if (err)
241+ return err;
245242
246− return -ETIMEDOUT;
243+ return (status & IPC_STATUS_ERR) ? -EIO : 0;
247244 }
248245
249246 /* Wait till ipc ioc interrupt is received or timeout in 10 HZ */
@@ -251,10 +248,12 @@ static inline int ipc_wait_for_interrupt(struct intel_scu_ipc_dev *scu) · 1 unmodified line
251248 {
252249 int status;
253250
254− if (!wait_for_completion_timeout(&scu->cmd_complete, IPC_TIMEOUT))
255− return -ETIMEDOUT;
251+ wait_for_completion_timeout(&scu->cmd_complete, IPC_TIMEOUT);
256252
257253 status = ipc_read_status(scu);
254+ if (status & IPC_STATUS_BUSY)
255+ return -ETIMEDOUT;
256+
258257 if (status & IPC_STATUS_ERR)
259258 return -EIO;
260259
@@ -266,6 +265,24 @@ static int intel_scu_ipc_check_status(struct intel_scu_ipc_dev *scu) · 5 unmodified lines
266265 return scu->irq > 0 ? ipc_wait_for_interrupt(scu) : busy_loop(scu);
267266 }
268267
268+static struct intel_scu_ipc_dev *intel_scu_ipc_get(struct intel_scu_ipc_dev *scu)
269+{
270+ u8 status;
271+
272+ if (!scu)
273+ scu = ipcdev;
274+ if (!scu)
275+ return ERR_PTR(-ENODEV);
276+
277+ status = ipc_read_status(scu);
278+ if (status & IPC_STATUS_BUSY) {
279+ dev_dbg(&scu->dev, "device is busy\n");
280+ return ERR_PTR(-EBUSY);
281+ }
282+
283+ return scu;
284+}
285+
269286 /* Read/Write power control(PMIC in Langwell, MSIC in PenWell) registers */
270287 static int pwr_reg_rdwr(struct intel_scu_ipc_dev *scu, u16 *addr, u8 *data,
271288 u32 count, u32 op, u32 id)
@@ -279,11 +296,10 @@ static int pwr_reg_rdwr(struct intel_scu_ipc_dev *scu, u16 *addr, u8 *data, · 7 unmodified lines
279296 memset(cbuf, 0, sizeof(cbuf));
280297
281298 mutex_lock(&ipclock);
282− if (!scu)
283− scu = ipcdev;
284− if (!scu) {
299+ scu = intel_scu_ipc_get(scu);
300+ if (IS_ERR(scu)) {
285301 mutex_unlock(&ipclock);
286− return -ENODEV;
302+ return PTR_ERR(scu);
287303 }
288304
289305 for (nc = 0; nc < count; nc++, offset += 2) {
@@ -438,13 +454,12 @@ int intel_scu_ipc_dev_simple_command(struct intel_scu_ipc_dev *scu, int cmd, · 148 unmodified lines
438454 int err;
439455
440456 mutex_lock(&ipclock);
441− if (!scu)
442− scu = ipcdev;
443− if (!scu) {
457+ scu = intel_scu_ipc_get(scu);
458+ if (IS_ERR(scu)) {
444459 mutex_unlock(&ipclock);
445− return -ENODEV;
460+ return PTR_ERR(scu);
446461 }
447− scu = ipcdev;
462+
448463 cmdval = sub << 12 | cmd;
449464 ipc_command(scu, cmdval);
450465 err = intel_scu_ipc_check_status(scu);
@@ -484,11 +499,10 @@ int intel_scu_ipc_dev_command_with_size(struct intel_scu_ipc_dev *scu, int cmd, · 33 unmodified lines
484499 return -EINVAL;
485500
486501 mutex_lock(&ipclock);
487− if (!scu)
488− scu = ipcdev;
489− if (!scu) {
502+ scu = intel_scu_ipc_get(scu);
503+ if (IS_ERR(scu)) {
490504 mutex_unlock(&ipclock);
491− return -ENODEV;
505+ return PTR_ERR(scu);
492506 }
493507
494508 memcpy(inbuf, in, inlen);
drivers/platform/x86/thinkpad_acpi.c+2−0
@@ -4116,9 +4116,11 @@ static void hotkey_resume(void) · 4115 unmodified lines
41164116 {
41174117 tpacpi_disable_brightness_delay();
41184118
4119+ mutex_lock(&hotkey_mutex);
41194120 if (hotkey_status_set(true) < 0 ||
41204121 hotkey_mask_set(hotkey_acpi_mask) < 0)
41214122 pr_err("error while attempting to reset the event firmware interface\n");
4123+ mutex_unlock(&hotkey_mutex);
41224124
41234125 tpacpi_send_radiosw_update();
41244126 tpacpi_input_send_tabletsw();
drivers/pmdomain/Makefilerenamed from drivers/genpd/Makefile+0−0

File renamed without changes.

drivers/pmdomain/actions/Makefilerenamed from drivers/genpd/actions/Makefile+0−0

File renamed without changes.

drivers/pmdomain/actions/owl-sps-helper.crenamed from drivers/genpd/actions/owl-sps-helper.c+0−0

File renamed without changes.

drivers/pmdomain/actions/owl-sps.crenamed from drivers/genpd/actions/owl-sps.c+0−0

File renamed without changes.

drivers/pmdomain/amlogic/Makefilerenamed from drivers/genpd/amlogic/Makefile+0−0

File renamed without changes.

drivers/pmdomain/amlogic/meson-ee-pwrc.crenamed from drivers/genpd/amlogic/meson-ee-pwrc.c+0−0

File renamed without changes.

drivers/pmdomain/amlogic/meson-gx-pwrc-vpu.crenamed from drivers/genpd/amlogic/meson-gx-pwrc-vpu.c+0−0

File renamed without changes.

drivers/pmdomain/amlogic/meson-secure-pwrc.crenamed from drivers/genpd/amlogic/meson-secure-pwrc.c+0−0

File renamed without changes.

drivers/pmdomain/apple/Makefilerenamed from drivers/genpd/apple/Makefile+0−0

File renamed without changes.

drivers/pmdomain/apple/pmgr-pwrstate.crenamed from drivers/genpd/apple/pmgr-pwrstate.c+0−0

File renamed without changes.

drivers/pmdomain/bcm/Makefilerenamed from drivers/genpd/bcm/Makefile+0−0

File renamed without changes.

drivers/pmdomain/bcm/bcm-pmb.crenamed from drivers/genpd/bcm/bcm-pmb.c+0−0

File renamed without changes.

drivers/pmdomain/bcm/bcm2835-power.crenamed from drivers/genpd/bcm/bcm2835-power.c+0−0

File renamed without changes.

drivers/pmdomain/bcm/bcm63xx-power.crenamed from drivers/genpd/bcm/bcm63xx-power.c+0−0

File renamed without changes.

drivers/pmdomain/bcm/raspberrypi-power.crenamed from drivers/genpd/bcm/raspberrypi-power.c+0−0

File renamed without changes.

drivers/pmdomain/imx/Makefilerenamed from drivers/genpd/imx/Makefile+0−0

File renamed without changes.

drivers/pmdomain/imx/gpc.crenamed from drivers/genpd/imx/gpc.c+0−0

File renamed without changes.

drivers/pmdomain/imx/gpcv2.crenamed from drivers/genpd/imx/gpcv2.c+0−0

File renamed without changes.

drivers/pmdomain/imx/imx8m-blk-ctrl.crenamed from drivers/genpd/imx/imx8m-blk-ctrl.c+0−0

File renamed without changes.

drivers/pmdomain/imx/imx8mp-blk-ctrl.crenamed from drivers/genpd/imx/imx8mp-blk-ctrl.c+0−0

File renamed without changes.

drivers/pmdomain/imx/imx93-blk-ctrl.crenamed from drivers/genpd/imx/imx93-blk-ctrl.c+0−0

File renamed without changes.

drivers/pmdomain/imx/imx93-pd.crenamed from drivers/genpd/imx/imx93-pd.c+0−0

File renamed without changes.

drivers/pmdomain/imx/scu-pd.crenamed from drivers/genpd/imx/scu-pd.c+0−0

File renamed without changes.

drivers/pmdomain/mediatek/Makefilerenamed from drivers/genpd/mediatek/Makefile+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt6795-pm-domains.hrenamed from drivers/genpd/mediatek/mt6795-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8167-pm-domains.hrenamed from drivers/genpd/mediatek/mt8167-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8173-pm-domains.hrenamed from drivers/genpd/mediatek/mt8173-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8183-pm-domains.hrenamed from drivers/genpd/mediatek/mt8183-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8186-pm-domains.hrenamed from drivers/genpd/mediatek/mt8186-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8188-pm-domains.hrenamed from drivers/genpd/mediatek/mt8188-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8192-pm-domains.hrenamed from drivers/genpd/mediatek/mt8192-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mt8195-pm-domains.hrenamed from drivers/genpd/mediatek/mt8195-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mtk-pm-domains.crenamed from drivers/genpd/mediatek/mtk-pm-domains.c+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mtk-pm-domains.hrenamed from drivers/genpd/mediatek/mtk-pm-domains.h+0−0

File renamed without changes.

drivers/pmdomain/mediatek/mtk-scpsys.crenamed from drivers/genpd/mediatek/mtk-scpsys.c+0−0

File renamed without changes.

drivers/pmdomain/qcom/Makefilerenamed from drivers/genpd/qcom/Makefile+0−0

File renamed without changes.

drivers/pmdomain/qcom/cpr.crenamed from drivers/genpd/qcom/cpr.c+0−0

File renamed without changes.

drivers/pmdomain/qcom/rpmhpd.crenamed from drivers/genpd/qcom/rpmhpd.c+0−0

File renamed without changes.

drivers/pmdomain/qcom/rpmpd.crenamed from drivers/genpd/qcom/rpmpd.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/Makefilerenamed from drivers/genpd/renesas/Makefile+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7742-sysc.crenamed from drivers/genpd/renesas/r8a7742-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7743-sysc.crenamed from drivers/genpd/renesas/r8a7743-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7745-sysc.crenamed from drivers/genpd/renesas/r8a7745-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a77470-sysc.crenamed from drivers/genpd/renesas/r8a77470-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a774a1-sysc.crenamed from drivers/genpd/renesas/r8a774a1-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a774b1-sysc.crenamed from drivers/genpd/renesas/r8a774b1-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a774c0-sysc.crenamed from drivers/genpd/renesas/r8a774c0-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a774e1-sysc.crenamed from drivers/genpd/renesas/r8a774e1-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7779-sysc.crenamed from drivers/genpd/renesas/r8a7779-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7790-sysc.crenamed from drivers/genpd/renesas/r8a7790-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7791-sysc.crenamed from drivers/genpd/renesas/r8a7791-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7792-sysc.crenamed from drivers/genpd/renesas/r8a7792-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7794-sysc.crenamed from drivers/genpd/renesas/r8a7794-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7795-sysc.crenamed from drivers/genpd/renesas/r8a7795-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a7796-sysc.crenamed from drivers/genpd/renesas/r8a7796-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a77965-sysc.crenamed from drivers/genpd/renesas/r8a77965-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a77970-sysc.crenamed from drivers/genpd/renesas/r8a77970-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a77980-sysc.crenamed from drivers/genpd/renesas/r8a77980-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a77990-sysc.crenamed from drivers/genpd/renesas/r8a77990-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a77995-sysc.crenamed from drivers/genpd/renesas/r8a77995-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a779a0-sysc.crenamed from drivers/genpd/renesas/r8a779a0-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a779f0-sysc.crenamed from drivers/genpd/renesas/r8a779f0-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/r8a779g0-sysc.crenamed from drivers/genpd/renesas/r8a779g0-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/rcar-gen4-sysc.crenamed from drivers/genpd/renesas/rcar-gen4-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/rcar-gen4-sysc.hrenamed from drivers/genpd/renesas/rcar-gen4-sysc.h+0−0

File renamed without changes.

drivers/pmdomain/renesas/rcar-sysc.crenamed from drivers/genpd/renesas/rcar-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/renesas/rcar-sysc.hrenamed from drivers/genpd/renesas/rcar-sysc.h+0−0

File renamed without changes.

drivers/pmdomain/renesas/rmobile-sysc.crenamed from drivers/genpd/renesas/rmobile-sysc.c+0−0

File renamed without changes.

drivers/pmdomain/rockchip/Makefilerenamed from drivers/genpd/rockchip/Makefile+0−0

File renamed without changes.

drivers/pmdomain/rockchip/pm-domains.crenamed from drivers/genpd/rockchip/pm-domains.c+0−0

File renamed without changes.

drivers/pmdomain/samsung/Makefilerenamed from drivers/genpd/samsung/Makefile+0−0

File renamed without changes.

drivers/pmdomain/samsung/exynos-pm-domains.crenamed from drivers/genpd/samsung/exynos-pm-domains.c+0−0

File renamed without changes.

drivers/pmdomain/st/Makefilerenamed from drivers/genpd/st/Makefile+0−0

File renamed without changes.

drivers/pmdomain/st/ste-ux500-pm-domain.crenamed from drivers/genpd/st/ste-ux500-pm-domain.c+0−0

File renamed without changes.

drivers/pmdomain/starfive/Makefilerenamed from drivers/genpd/starfive/Makefile+0−0

File renamed without changes.

drivers/pmdomain/starfive/jh71xx-pmu.crenamed from drivers/genpd/starfive/jh71xx-pmu.c+0−0

File renamed without changes.

drivers/pmdomain/sunxi/Makefilerenamed from drivers/genpd/sunxi/Makefile+0−0

File renamed without changes.

drivers/pmdomain/sunxi/sun20i-ppu.crenamed from drivers/genpd/sunxi/sun20i-ppu.c+0−0

File renamed without changes.

drivers/pmdomain/tegra/Makefilerenamed from drivers/genpd/tegra/Makefile+0−0

File renamed without changes.

drivers/pmdomain/tegra/powergate-bpmp.crenamed from drivers/genpd/tegra/powergate-bpmp.c+0−0

File renamed without changes.

drivers/pmdomain/ti/Makefilerenamed from drivers/genpd/ti/Makefile+0−0

File renamed without changes.

drivers/pmdomain/ti/omap_prm.crenamed from drivers/genpd/ti/omap_prm.c+0−0

File renamed without changes.

drivers/pmdomain/ti/ti_sci_pm_domains.crenamed from drivers/genpd/ti/ti_sci_pm_domains.c+0−0

File renamed without changes.

drivers/pmdomain/xilinx/Makefilerenamed from drivers/genpd/xilinx/Makefile+0−0

File renamed without changes.

drivers/pmdomain/xilinx/zynqmp-pm-domains.crenamed from drivers/genpd/xilinx/zynqmp-pm-domains.c+0−0

File renamed without changes.

drivers/power/reset/Kconfig+1−1
@@ -300,7 +300,7 @@ config NVMEM_REBOOT_MODE · 299 unmodified lines
300300
301301 config POWER_MLXBF
302302 tristate "Mellanox BlueField power handling driver"
303− depends on (GPIO_MLXBF2 && ACPI)
303+ depends on (GPIO_MLXBF2 || GPIO_MLXBF3) && ACPI
304304 help
305305 This driver supports reset or low power mode handling for Mellanox BlueField.
306306
drivers/power/reset/pwr-mlxbf.c+1−1
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0-only or BSD-3-Clause
1+// SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause
22
33 /*
44 * Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES.
drivers/power/reset/vexpress-poweroff.c+1−1
@@ -121,7 +121,7 @@ static int vexpress_reset_probe(struct platform_device *pdev) · 120 unmodified lines
121121 return PTR_ERR(regmap);
122122 dev_set_drvdata(&pdev->dev, regmap);
123123
124− switch ((enum vexpress_reset_func)match->data) {
124+ switch ((uintptr_t)match->data) {
125125 case FUNC_SHUTDOWN:
126126 vexpress_power_off_device = &pdev->dev;
127127 pm_power_off = vexpress_power_off;
drivers/power/supply/Kconfig+1−0
@@ -769,6 +769,7 @@ config BATTERY_RT5033 · 768 unmodified lines
769769 config CHARGER_RT5033
770770 tristate "RT5033 battery charger support"
771771 depends on MFD_RT5033
772+ depends on EXTCON || !EXTCON
772773 help
773774 This adds support for battery charger in Richtek RT5033 PMIC.
774775 The device supports pre-charge mode, fast charge mode and
drivers/power/supply/ab8500_btemp.c+1−8
@@ -115,7 +115,6 @@ struct ab8500_btemp { · 114 unmodified lines
115115 static enum power_supply_property ab8500_btemp_props[] = {
116116 POWER_SUPPLY_PROP_PRESENT,
117117 POWER_SUPPLY_PROP_ONLINE,
118− POWER_SUPPLY_PROP_TECHNOLOGY,
119118 POWER_SUPPLY_PROP_TEMP,
120119 };
121120
@@ -532,12 +531,6 @@ static int ab8500_btemp_get_property(struct power_supply *psy, · 410 unmodified lines
532531 else
533532 val->intval = 1;
534533 break;
535− case POWER_SUPPLY_PROP_TECHNOLOGY:
536− if (di->bm->bi)
537− val->intval = di->bm->bi->technology;
538− else
539− val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
540− break;
541534 case POWER_SUPPLY_PROP_TEMP:
542535 val->intval = ab8500_btemp_get_temp(di);
543536 break;
@@ -662,7 +655,7 @@ static char *supply_interface[] = { · 118 unmodified lines
662655
663656 static const struct power_supply_desc ab8500_btemp_desc = {
664657 .name = "ab8500_btemp",
665− .type = POWER_SUPPLY_TYPE_BATTERY,
658+ .type = POWER_SUPPLY_TYPE_UNKNOWN,
666659 .properties = ab8500_btemp_props,
667660 .num_properties = ARRAY_SIZE(ab8500_btemp_props),
668661 .get_property = ab8500_btemp_get_property,
drivers/power/supply/ab8500_chargalg.c+1−1
@@ -1720,7 +1720,7 @@ static char *supply_interface[] = { · 1719 unmodified lines
17201720
17211721 static const struct power_supply_desc ab8500_chargalg_desc = {
17221722 .name = "ab8500_chargalg",
1723− .type = POWER_SUPPLY_TYPE_BATTERY,
1723+ .type = POWER_SUPPLY_TYPE_UNKNOWN,
17241724 .properties = ab8500_chargalg_props,
17251725 .num_properties = ARRAY_SIZE(ab8500_chargalg_props),
17261726 .get_property = ab8500_chargalg_get_property,
drivers/power/supply/mt6370-charger.c+1−1
@@ -324,7 +324,7 @@ static int mt6370_chg_toggle_cfo(struct mt6370_priv *priv) · 323 unmodified lines
324324
325325 if (fl_strobe) {
326326 dev_err(priv->dev, "Flash led is still in strobe mode\n");
327− return ret;
327+ return -EINVAL;
328328 }
329329
330330 /* cfo off */
drivers/power/supply/power_supply_sysfs.c+7−0
@@ -482,6 +482,13 @@ int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env) · 481 unmodified lines
482482 if (ret)
483483 return ret;
484484
485+ /*
486+ * Kernel generates KOBJ_REMOVE uevent in device removal path, after
487+ * resources have been freed. Exit early to avoid use-after-free.
488+ */
489+ if (psy->removing)
490+ return 0;
491+
485492 prop_buf = (char *)get_zeroed_page(GFP_KERNEL);
486493 if (!prop_buf)
487494 return -ENOMEM;
drivers/power/supply/rk817_charger.c+13−3
@@ -1045,6 +1045,13 @@ static void rk817_charging_monitor(struct work_struct *work) · 1044 unmodified lines
10451045 queue_delayed_work(system_wq, &charger->work, msecs_to_jiffies(8000));
10461046 }
10471047
1048+static void rk817_cleanup_node(void *data)
1049+{
1050+ struct device_node *node = data;
1051+
1052+ of_node_put(node);
1053+}
1054+
10481055 static int rk817_charger_probe(struct platform_device *pdev)
10491056 {
10501057 struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
@@ -1061,11 +1068,13 @@ static int rk817_charger_probe(struct platform_device *pdev) · 10 unmodified lines
10611068 if (!node)
10621069 return -ENODEV;
10631070
1071+ ret = devm_add_action_or_reset(&pdev->dev, rk817_cleanup_node, node);
1072+ if (ret)
1073+ return ret;
1074+
10641075 charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL);
1065− if (!charger) {
1066− of_node_put(node);
1076+ if (!charger)
10671077 return -ENOMEM;
1068− }
10691078
10701079 charger->rk808 = rk808;
10711080
@@ -1211,3 +1220,4 @@ MODULE_DESCRIPTION("Battery power supply driver for RK817 PMIC"); · 139 unmodified lines
12111220 MODULE_AUTHOR("Maya Matuszczyk <maccraft123mc@gmail.com>");
12121221 MODULE_AUTHOR("Chris Morgan <macromorgan@hotmail.com>");
12131222 MODULE_LICENSE("GPL");
1223+MODULE_ALIAS("platform:rk817-charger");
drivers/power/supply/rt9467-charger.c+2−2
@@ -598,8 +598,8 @@ static int rt9467_run_aicl(struct rt9467_chg_data *data) · 597 unmodified lines
598598
599599 reinit_completion(&data->aicl_done);
600600 ret = wait_for_completion_timeout(&data->aicl_done, msecs_to_jiffies(3500));
601− if (ret)
602− return ret;
601+ if (ret == 0)
602+ return -ETIMEDOUT;
603603
604604 ret = rt9467_get_value_from_ranges(data, F_IAICR, RT9467_RANGE_IAICR, &aicr_get);
605605 if (ret) {
drivers/power/supply/ucs1002_power.c+2−1
@@ -384,7 +384,8 @@ static int ucs1002_get_property(struct power_supply *psy, · 383 unmodified lines
384384 case POWER_SUPPLY_PROP_USB_TYPE:
385385 return ucs1002_get_usb_type(info, val);
386386 case POWER_SUPPLY_PROP_HEALTH:
387− return val->intval = info->health;
387+ val->intval = info->health;
388+ return 0;
388389 case POWER_SUPPLY_PROP_PRESENT:
389390 val->intval = info->present;
390391 return 0;
drivers/regulator/helpers.c+1−1
@@ -197,7 +197,7 @@ int regulator_set_voltage_sel_pickable_regmap(struct regulator_dev *rdev, · 196 unmodified lines
197197 sel += rdev->desc->linear_ranges[i].min_sel;
198198
199199 range = rdev->desc->linear_range_selectors_bitfield[i];
200− range <<= ffs(rdev->desc->vsel_mask) - 1;
200+ range <<= ffs(rdev->desc->vsel_range_mask) - 1;
201201
202202 if (rdev->desc->vsel_reg == rdev->desc->vsel_range_reg) {
203203 ret = regmap_update_bits(rdev->regmap,
drivers/scsi/iscsi_tcp.c+4−0
@@ -724,6 +724,10 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session, · 723 unmodified lines
724724 return -EEXIST;
725725 }
726726
727+ err = -EINVAL;
728+ if (!sk_is_tcp(sock->sk))
729+ goto free_socket;
730+
727731 err = iscsi_conn_bind(cls_session, cls_conn, is_leading);
728732 if (err)
729733 goto free_socket;
drivers/scsi/lpfc/lpfc_debugfs.c+7−7
@@ -6073,7 +6073,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) · 6072 unmodified lines
60736073 phba->hba_debugfs_root,
60746074 phba,
60756075 &lpfc_debugfs_op_multixripools);
6076− if (!phba->debug_multixri_pools) {
6076+ if (IS_ERR(phba->debug_multixri_pools)) {
60776077 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
60786078 "0527 Cannot create debugfs multixripools\n");
60796079 goto debug_failed;
@@ -6085,7 +6085,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) · 5 unmodified lines
60856085 debugfs_create_file(name, S_IFREG | 0644,
60866086 phba->hba_debugfs_root,
60876087 phba, &lpfc_cgn_buffer_op);
6088− if (!phba->debug_cgn_buffer) {
6088+ if (IS_ERR(phba->debug_cgn_buffer)) {
60896089 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
60906090 "6527 Cannot create debugfs "
60916091 "cgn_buffer\n");
@@ -6098,7 +6098,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) · 6 unmodified lines
60986098 debugfs_create_file(name, S_IFREG | 0644,
60996099 phba->hba_debugfs_root,
61006100 phba, &lpfc_rx_monitor_op);
6101− if (!phba->debug_rx_monitor) {
6101+ if (IS_ERR(phba->debug_rx_monitor)) {
61026102 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
61036103 "6528 Cannot create debugfs "
61046104 "rx_monitor\n");
@@ -6111,7 +6111,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) · 6 unmodified lines
61116111 debugfs_create_file(name, 0644,
61126112 phba->hba_debugfs_root,
61136113 phba, &lpfc_debugfs_ras_log);
6114− if (!phba->debug_ras_log) {
6114+ if (IS_ERR(phba->debug_ras_log)) {
61156115 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
61166116 "6148 Cannot create debugfs"
61176117 " ras_log\n");
@@ -6132,7 +6132,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) · 14 unmodified lines
61326132 debugfs_create_file(name, S_IFREG | 0644,
61336133 phba->hba_debugfs_root,
61346134 phba, &lpfc_debugfs_op_lockstat);
6135− if (!phba->debug_lockstat) {
6135+ if (IS_ERR(phba->debug_lockstat)) {
61366136 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
61376137 "4610 Can't create debugfs lockstat\n");
61386138 goto debug_failed;
@@ -6358,7 +6358,7 @@ nvmeio_off: · 219 unmodified lines
63586358 debugfs_create_file(name, 0644,
63596359 vport->vport_debugfs_root,
63606360 vport, &lpfc_debugfs_op_scsistat);
6361− if (!vport->debug_scsistat) {
6361+ if (IS_ERR(vport->debug_scsistat)) {
63626362 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
63636363 "4611 Cannot create debugfs scsistat\n");
63646364 goto debug_failed;
@@ -6369,7 +6369,7 @@ nvmeio_off: · 4 unmodified lines
63696369 debugfs_create_file(name, 0644,
63706370 vport->vport_debugfs_root,
63716371 vport, &lpfc_debugfs_op_ioktime);
6372− if (!vport->debug_ioktime) {
6372+ if (IS_ERR(vport->debug_ioktime)) {
63736373 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
63746374 "0815 Cannot create debugfs ioktime\n");
63756375 goto debug_failed;
drivers/scsi/lpfc/lpfc_hbadisc.c+3−2
@@ -199,11 +199,12 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport) · 198 unmodified lines
199199 /* Only 1 thread can drop the initial node reference. If
200200 * another thread has set NLP_DROPPED, this thread is done.
201201 */
202− if (!(ndlp->nlp_flag & NLP_DROPPED)) {
202+ if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD) &&
203+ !(ndlp->nlp_flag & NLP_DROPPED)) {
203204 ndlp->nlp_flag |= NLP_DROPPED;
204205 spin_unlock_irqrestore(&ndlp->lock, iflags);
205206 lpfc_nlp_put(ndlp);
206− spin_lock_irqsave(&ndlp->lock, iflags);
207+ return;
207208 }
208209
209210 spin_unlock_irqrestore(&ndlp->lock, iflags);
drivers/scsi/lpfc/lpfc_nvme.c+17−7
@@ -228,8 +228,7 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport) · 227 unmodified lines
228228 spin_unlock_irq(&ndlp->lock);
229229
230230 /* On a devloss timeout event, one more put is executed provided the
231− * NVME and SCSI rport unregister requests are complete. If the vport
232− * is unloading, this extra put is executed by lpfc_drop_node.
231+ * NVME and SCSI rport unregister requests are complete.
233232 */
234233 if (!(ndlp->fc4_xpt_flags & fc4_xpt_flags))
235234 lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
@@ -2567,11 +2566,7 @@ lpfc_nvme_rescan_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 2331 unmodified lines
25672566 * nvme_transport perspective. Loss of an rport just means IO cannot
25682567 * be sent and recovery is completely up to the initator.
25692568 * For now, the driver just unbinds the DID and port_role so that
2570− * no further IO can be issued. Changes are planned for later.
2571− *
2572− * Notes - the ndlp reference count is not decremented here since
2573− * since there is no nvme_transport api for devloss. Node ref count
2574− * is only adjusted in driver unload.
2569+ * no further IO can be issued.
25752570 */
25762571 void
25772572 lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
@@ -2646,6 +2641,21 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) · 68 unmodified lines
26462641 "6167 NVME unregister failed %d "
26472642 "port_state x%x\n",
26482643 ret, remoteport->port_state);
2644+
2645+ if (vport->load_flag & FC_UNLOADING) {
2646+ /* Only 1 thread can drop the initial node
2647+ * reference. Check if another thread has set
2648+ * NLP_DROPPED.
2649+ */
2650+ spin_lock_irq(&ndlp->lock);
2651+ if (!(ndlp->nlp_flag & NLP_DROPPED)) {
2652+ ndlp->nlp_flag |= NLP_DROPPED;
2653+ spin_unlock_irq(&ndlp->lock);
2654+ lpfc_nlp_put(ndlp);
2655+ return;
2656+ }
2657+ spin_unlock_irq(&ndlp->lock);
2658+ }
26492659 }
26502660 }
26512661 return;
drivers/scsi/megaraid/megaraid_sas.h+1−1
@@ -2332,7 +2332,7 @@ struct megasas_instance { · 2331 unmodified lines
23322332 u32 support_morethan256jbod; /* FW support for more than 256 PD/JBOD */
23332333 bool use_seqnum_jbod_fp; /* Added for PD sequence */
23342334 bool smp_affinity_enable;
2335− spinlock_t crashdump_lock;
2335+ struct mutex crashdump_lock;
23362336
23372337 struct megasas_register_set __iomem *reg_set;
23382338 u32 __iomem *reply_post_host_index_addr[MR_MAX_MSIX_REG_ARRAY];
drivers/scsi/megaraid/megaraid_sas_base.c+9−12
@@ -3271,14 +3271,13 @@ fw_crash_buffer_store(struct device *cdev, · 3270 unmodified lines
32713271 struct megasas_instance *instance =
32723272 (struct megasas_instance *) shost->hostdata;
32733273 int val = 0;
3274− unsigned long flags;
32753274
32763275 if (kstrtoint(buf, 0, &val) != 0)
32773276 return -EINVAL;
32783277
3279− spin_lock_irqsave(&instance->crashdump_lock, flags);
3278+ mutex_lock(&instance->crashdump_lock);
32803279 instance->fw_crash_buffer_offset = val;
3281− spin_unlock_irqrestore(&instance->crashdump_lock, flags);
3280+ mutex_unlock(&instance->crashdump_lock);
32823281 return strlen(buf);
32833282 }
32843283
@@ -3293,24 +3292,23 @@ fw_crash_buffer_show(struct device *cdev, · 8 unmodified lines
32933292 unsigned long dmachunk = CRASH_DMA_BUF_SIZE;
32943293 unsigned long chunk_left_bytes;
32953294 unsigned long src_addr;
3296− unsigned long flags;
32973295 u32 buff_offset;
32983296
3299− spin_lock_irqsave(&instance->crashdump_lock, flags);
3297+ mutex_lock(&instance->crashdump_lock);
33003298 buff_offset = instance->fw_crash_buffer_offset;
33013299 if (!instance->crash_dump_buf ||
33023300 !((instance->fw_crash_state == AVAILABLE) ||
33033301 (instance->fw_crash_state == COPYING))) {
33043302 dev_err(&instance->pdev->dev,
33053303 "Firmware crash dump is not available\n");
3306− spin_unlock_irqrestore(&instance->crashdump_lock, flags);
3304+ mutex_unlock(&instance->crashdump_lock);
33073305 return -EINVAL;
33083306 }
33093307
33103308 if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) {
33113309 dev_err(&instance->pdev->dev,
33123310 "Firmware crash dump offset is out of range\n");
3313− spin_unlock_irqrestore(&instance->crashdump_lock, flags);
3311+ mutex_unlock(&instance->crashdump_lock);
33143312 return 0;
33153313 }
33163314
@@ -3322,7 +3320,7 @@ fw_crash_buffer_show(struct device *cdev, · 5 unmodified lines
33223320 src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk] +
33233321 (buff_offset % dmachunk);
33243322 memcpy(buf, (void *)src_addr, size);
3325− spin_unlock_irqrestore(&instance->crashdump_lock, flags);
3323+ mutex_unlock(&instance->crashdump_lock);
33263324
33273325 return size;
33283326 }
@@ -3347,7 +3345,6 @@ fw_crash_state_store(struct device *cdev, · 18 unmodified lines
33473345 struct megasas_instance *instance =
33483346 (struct megasas_instance *) shost->hostdata;
33493347 int val = 0;
3350− unsigned long flags;
33513348
33523349 if (kstrtoint(buf, 0, &val) != 0)
33533350 return -EINVAL;
@@ -3361,9 +3358,9 @@ fw_crash_state_store(struct device *cdev, · 7 unmodified lines
33613358 instance->fw_crash_state = val;
33623359
33633360 if ((val == COPIED) || (val == COPY_ERROR)) {
3364− spin_lock_irqsave(&instance->crashdump_lock, flags);
3361+ mutex_lock(&instance->crashdump_lock);
33653362 megasas_free_host_crash_buffer(instance);
3366− spin_unlock_irqrestore(&instance->crashdump_lock, flags);
3363+ mutex_unlock(&instance->crashdump_lock);
33673364 if (val == COPY_ERROR)
33683365 dev_info(&instance->pdev->dev, "application failed to "
33693366 "copy Firmware crash dump\n");
@@ -7422,7 +7419,7 @@ static inline void megasas_init_ctrl_params(struct megasas_instance *instance) · 4052 unmodified lines
74227419 init_waitqueue_head(&instance->int_cmd_wait_q);
74237420 init_waitqueue_head(&instance->abort_cmd_wait_q);
74247421
7425− spin_lock_init(&instance->crashdump_lock);
7422+ mutex_init(&instance->crashdump_lock);
74267423 spin_lock_init(&instance->mfi_pool_lock);
74277424 spin_lock_init(&instance->hba_lock);
74287425 spin_lock_init(&instance->stream_lock);
drivers/scsi/pm8001/pm8001_hwi.c+1−1
@@ -4180,7 +4180,7 @@ pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) · 4179 unmodified lines
41804180 payload.sas_identify.dev_type = SAS_END_DEVICE;
41814181 payload.sas_identify.initiator_bits = SAS_PROTOCOL_ALL;
41824182 memcpy(payload.sas_identify.sas_addr,
4183− pm8001_ha->sas_addr, SAS_ADDR_SIZE);
4183+ &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
41844184 payload.sas_identify.phy_id = phy_id;
41854185
41864186 return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
drivers/scsi/pm8001/pm8001_init.c+17−34
@@ -273,7 +273,6 @@ static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id) · 272 unmodified lines
273273 return ret;
274274 }
275275
276−static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha);
277276 static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha);
278277
279278 /**
@@ -294,13 +293,6 @@ static int pm8001_alloc(struct pm8001_hba_info *pm8001_ha, · 14 unmodified lines
294293 pm8001_dbg(pm8001_ha, INIT, "pm8001_alloc: PHY:%x\n",
295294 pm8001_ha->chip->n_phy);
296295
297− /* Setup Interrupt */
298− rc = pm8001_setup_irq(pm8001_ha);
299− if (rc) {
300− pm8001_dbg(pm8001_ha, FAIL,
301− "pm8001_setup_irq failed [ret: %d]\n", rc);
302− goto err_out;
303− }
304296 /* Request Interrupt */
305297 rc = pm8001_request_irq(pm8001_ha);
306298 if (rc)
@@ -1031,47 +1023,38 @@ static u32 pm8001_request_msix(struct pm8001_hba_info *pm8001_ha) · 724 unmodified lines
10311023 }
10321024 #endif
10331025
1034−static u32 pm8001_setup_irq(struct pm8001_hba_info *pm8001_ha)
1035−{
1036− struct pci_dev *pdev;
1037−
1038− pdev = pm8001_ha->pdev;
1039−
1040−#ifdef PM8001_USE_MSIX
1041− if (pci_find_capability(pdev, PCI_CAP_ID_MSIX))
1042− return pm8001_setup_msix(pm8001_ha);
1043− pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
1044−#endif
1045− return 0;
1046−}
1047−
10481026 /**
10491027 * pm8001_request_irq - register interrupt
10501028 * @pm8001_ha: our ha struct.
10511029 */
10521030 static u32 pm8001_request_irq(struct pm8001_hba_info *pm8001_ha)
10531031 {
1054− struct pci_dev *pdev;
1032+ struct pci_dev *pdev = pm8001_ha->pdev;
1033+#ifdef PM8001_USE_MSIX
10551034 int rc;
10561035
1057− pdev = pm8001_ha->pdev;
1036+ if (pci_find_capability(pdev, PCI_CAP_ID_MSIX)) {
1037+ rc = pm8001_setup_msix(pm8001_ha);
1038+ if (rc) {
1039+ pm8001_dbg(pm8001_ha, FAIL,
1040+ "pm8001_setup_irq failed [ret: %d]\n", rc);
1041+ return rc;
1042+ }
10581043
1059−#ifdef PM8001_USE_MSIX
1060− if (pdev->msix_cap && pci_msi_enabled())
1061− return pm8001_request_msix(pm8001_ha);
1062− else {
1063− pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
1064− goto intx;
1044+ if (pdev->msix_cap && pci_msi_enabled())
1045+ return pm8001_request_msix(pm8001_ha);
10651046 }
1047+
1048+ pm8001_dbg(pm8001_ha, INIT, "MSIX not supported!!!\n");
10661049 #endif
10671050
1068−intx:
10691051 /* initialize the INT-X interrupt */
10701052 pm8001_ha->irq_vector[0].irq_id = 0;
10711053 pm8001_ha->irq_vector[0].drv_inst = pm8001_ha;
1072− rc = request_irq(pdev->irq, pm8001_interrupt_handler_intx, IRQF_SHARED,
1073− pm8001_ha->name, SHOST_TO_SAS_HA(pm8001_ha->shost));
1074− return rc;
1054+
1055+ return request_irq(pdev->irq, pm8001_interrupt_handler_intx,
1056+ IRQF_SHARED, pm8001_ha->name,
1057+ SHOST_TO_SAS_HA(pm8001_ha->shost));
10751058 }
10761059
10771060 /**
drivers/scsi/pm8001/pm80xx_hwi.c+3−1
@@ -3671,10 +3671,12 @@ static int mpi_set_controller_config_resp(struct pm8001_hba_info *pm8001_ha, · 3670 unmodified lines
36713671 (struct set_ctrl_cfg_resp *)(piomb + 4);
36723672 u32 status = le32_to_cpu(pPayload->status);
36733673 u32 err_qlfr_pgcd = le32_to_cpu(pPayload->err_qlfr_pgcd);
3674+ u32 tag = le32_to_cpu(pPayload->tag);
36743675
36753676 pm8001_dbg(pm8001_ha, MSG,
36763677 "SET CONTROLLER RESP: status 0x%x qlfr_pgcd 0x%x\n",
36773678 status, err_qlfr_pgcd);
3679+ pm8001_tag_free(pm8001_ha, tag);
36783680
36793681 return 0;
36803682 }
@@ -4671,7 +4673,7 @@ pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) · 990 unmodified lines
46714673 payload.sas_identify.dev_type = SAS_END_DEVICE;
46724674 payload.sas_identify.initiator_bits = SAS_PROTOCOL_ALL;
46734675 memcpy(payload.sas_identify.sas_addr,
4674− &pm8001_ha->sas_addr, SAS_ADDR_SIZE);
4676+ &pm8001_ha->phy[phy_id].dev_sas_addr, SAS_ADDR_SIZE);
46754677 payload.sas_identify.phy_id = phy_id;
46764678
46774679 return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload,
drivers/scsi/ppa.c+2−2
@@ -307,9 +307,9 @@ static int ppa_out(ppa_struct *dev, char *buffer, int len) · 306 unmodified lines
307307 case PPA_EPP_8:
308308 epp_reset(ppb);
309309 w_ctr(ppb, 0x4);
310− if (dev->mode == PPA_EPP_32 && !(((long) buffer | len) & 0x01))
310+ if (dev->mode == PPA_EPP_32 && !(((long) buffer | len) & 0x03))
311311 outsl(ppb + 4, buffer, len >> 2);
312− else if (dev->mode == PPA_EPP_16 && !(((long) buffer | len) & 0x03))
312+ else if (dev->mode == PPA_EPP_16 && !(((long) buffer | len) & 0x01))
313313 outsw(ppb + 4, buffer, len >> 1);
314314 else
315315 outsb(ppb + 4, buffer, len);
drivers/scsi/qedf/qedf_io.c+8−2
@@ -1904,6 +1904,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) · 1903 unmodified lines
19041904 goto drop_rdata_kref;
19051905 }
19061906
1907+ spin_lock_irqsave(&fcport->rport_lock, flags);
19071908 if (!test_bit(QEDF_CMD_OUTSTANDING, &io_req->flags) ||
19081909 test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags) ||
19091910 test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) {
@@ -1911,17 +1912,20 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts) · 1 unmodified line
19111912 "io_req xid=0x%x sc_cmd=%p already in cleanup or abort processing or already completed.\n",
19121913 io_req->xid, io_req->sc_cmd);
19131914 rc = 1;
1915+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
19141916 goto drop_rdata_kref;
19151917 }
19161918
1919+ /* Set the command type to abort */
1920+ io_req->cmd_type = QEDF_ABTS;
1921+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
1922+
19171923 kref_get(&io_req->refcount);
19181924
19191925 xid = io_req->xid;
19201926 qedf->control_requests++;
19211927 qedf->packet_aborts++;
19221928
1923− /* Set the command type to abort */
1924− io_req->cmd_type = QEDF_ABTS;
19251929 io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;
19261930
19271931 set_bit(QEDF_CMD_IN_ABORT, &io_req->flags);
@@ -2210,7 +2214,9 @@ process_els: · 282 unmodified lines
22102214 refcount, fcport, fcport->rdata->ids.port_id);
22112215
22122216 /* Cleanup cmds re-use the same TID as the original I/O */
2217+ spin_lock_irqsave(&fcport->rport_lock, flags);
22132218 io_req->cmd_type = QEDF_CLEANUP;
2219+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
22142220 io_req->return_scsi_cmd_on_abts = return_scsi_cmd_on_abts;
22152221
22162222 init_completion(&io_req->cleanup_done);
drivers/scsi/qedf/qedf_main.c+6−1
@@ -2805,6 +2805,8 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe) · 2804 unmodified lines
28052805 struct qedf_ioreq *io_req;
28062806 struct qedf_rport *fcport;
28072807 u32 comp_type;
2808+ u8 io_comp_type;
2809+ unsigned long flags;
28082810
28092811 comp_type = (cqe->cqe_data >> FCOE_CQE_CQE_TYPE_SHIFT) &
28102812 FCOE_CQE_CQE_TYPE_MASK;
@@ -2838,11 +2840,14 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe) · 27 unmodified lines
28382840 return;
28392841 }
28402842
2843+ spin_lock_irqsave(&fcport->rport_lock, flags);
2844+ io_comp_type = io_req->cmd_type;
2845+ spin_unlock_irqrestore(&fcport->rport_lock, flags);
28412846
28422847 switch (comp_type) {
28432848 case FCOE_GOOD_COMPLETION_CQE_TYPE:
28442849 atomic_inc(&fcport->free_sqes);
2845− switch (io_req->cmd_type) {
2850+ switch (io_comp_type) {
28462851 case QEDF_SCSI_CMD:
28472852 qedf_scsi_completion(qedf, cqe, io_req);
28482853 break;
drivers/scsi/qla2xxx/qla_dfs.c+3−3
@@ -116,7 +116,7 @@ qla2x00_dfs_create_rport(scsi_qla_host_t *vha, struct fc_port *fp) · 115 unmodified lines
116116
117117 sprintf(wwn, "pn-%016llx", wwn_to_u64(fp->port_name));
118118 fp->dfs_rport_dir = debugfs_create_dir(wwn, vha->dfs_rport_root);
119− if (!fp->dfs_rport_dir)
119+ if (IS_ERR(fp->dfs_rport_dir))
120120 return;
121121 if (NVME_TARGET(vha->hw, fp))
122122 debugfs_create_file("dev_loss_tmo", 0600, fp->dfs_rport_dir,
@@ -708,14 +708,14 @@ create_nodes: · 585 unmodified lines
708708 if (IS_QLA27XX(ha) || IS_QLA83XX(ha) || IS_QLA28XX(ha)) {
709709 ha->tgt.dfs_naqp = debugfs_create_file("naqp",
710710 0400, ha->dfs_dir, vha, &dfs_naqp_ops);
711− if (!ha->tgt.dfs_naqp) {
711+ if (IS_ERR(ha->tgt.dfs_naqp)) {
712712 ql_log(ql_log_warn, vha, 0xd011,
713713 "Unable to create debugFS naqp node.\n");
714714 goto out;
715715 }
716716 }
717717 vha->dfs_rport_root = debugfs_create_dir("rports", ha->dfs_dir);
718− if (!vha->dfs_rport_root) {
718+ if (IS_ERR(vha->dfs_rport_root)) {
719719 ql_log(ql_log_warn, vha, 0xd012,
720720 "Unable to create debugFS rports node.\n");
721721 goto out;
drivers/scsi/qla2xxx/qla_inline.h+1−1
@@ -577,7 +577,7 @@ fcport_is_bigger(fc_port_t *fcport) · 576 unmodified lines
577577 static inline struct qla_qpair *
578578 qla_mapq_nvme_select_qpair(struct qla_hw_data *ha, struct qla_qpair *qpair)
579579 {
580− int cpuid = smp_processor_id();
580+ int cpuid = raw_smp_processor_id();
581581
582582 if (qpair->cpuid != cpuid &&
583583 ha->qp_cpu_map[cpuid]) {
drivers/scsi/qla2xxx/qla_isr.c+3−3
@@ -3965,7 +3965,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha, · 3964 unmodified lines
39653965 if (!ha->flags.fw_started)
39663966 return;
39673967
3968− if (rsp->qpair->cpuid != smp_processor_id() || !rsp->qpair->rcv_intr) {
3968+ if (rsp->qpair->cpuid != raw_smp_processor_id() || !rsp->qpair->rcv_intr) {
39693969 rsp->qpair->rcv_intr = 1;
39703970
39713971 if (!rsp->qpair->cpu_mapped)
@@ -4468,7 +4468,7 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id) · 496 unmodified lines
44684468 }
44694469 ha = qpair->hw;
44704470
4471− queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
4471+ queue_work(ha->wq, &qpair->q_work);
44724472
44734473 return IRQ_HANDLED;
44744474 }
@@ -4494,7 +4494,7 @@ qla2xxx_msix_rsp_q_hs(int irq, void *dev_id) · 19 unmodified lines
44944494 wrt_reg_dword(&reg->hccr, HCCRX_CLR_RISC_INT);
44954495 spin_unlock_irqrestore(&ha->hardware_lock, flags);
44964496
4497− queue_work_on(smp_processor_id(), ha->wq, &qpair->q_work);
4497+ queue_work(ha->wq, &qpair->q_work);
44984498
44994499 return IRQ_HANDLED;
45004500 }
drivers/scsi/qla2xxx/qla_nvme.c+5−5
@@ -399,14 +399,14 @@ static int qla_nvme_xmt_ls_rsp(struct nvme_fc_local_port *lport, · 398 unmodified lines
399399 nvme->u.nvme.dl = 0;
400400 nvme->u.nvme.timeout_sec = 0;
401401 nvme->u.nvme.cmd_dma = fd_resp->rspdma;
402− nvme->u.nvme.cmd_len = fd_resp->rsplen;
402+ nvme->u.nvme.cmd_len = cpu_to_le32(fd_resp->rsplen);
403403 nvme->u.nvme.rsp_len = 0;
404404 nvme->u.nvme.rsp_dma = 0;
405405 nvme->u.nvme.exchange_address = uctx->exchange_address;
406406 nvme->u.nvme.nport_handle = uctx->nport_handle;
407407 nvme->u.nvme.ox_id = uctx->ox_id;
408408 dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
409− le32_to_cpu(fd_resp->rsplen), DMA_TO_DEVICE);
409+ fd_resp->rsplen, DMA_TO_DEVICE);
410410
411411 ql_dbg(ql_dbg_unsol, vha, 0x2122,
412412 "Unsol lsreq portid=%06x %8phC exchange_address 0x%x ox_id 0x%x hdl 0x%x\n",
@@ -504,13 +504,13 @@ static int qla_nvme_ls_req(struct nvme_fc_local_port *lport, · 91 unmodified lines
504504 nvme->u.nvme.desc = fd;
505505 nvme->u.nvme.dir = 0;
506506 nvme->u.nvme.dl = 0;
507− nvme->u.nvme.cmd_len = fd->rqstlen;
508− nvme->u.nvme.rsp_len = fd->rsplen;
507+ nvme->u.nvme.cmd_len = cpu_to_le32(fd->rqstlen);
508+ nvme->u.nvme.rsp_len = cpu_to_le32(fd->rsplen);
509509 nvme->u.nvme.rsp_dma = fd->rspdma;
510510 nvme->u.nvme.timeout_sec = fd->timeout;
511511 nvme->u.nvme.cmd_dma = fd->rqstdma;
512512 dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma,
513− le32_to_cpu(fd->rqstlen), DMA_TO_DEVICE);
513+ fd->rqstlen, DMA_TO_DEVICE);
514514
515515 rval = qla2x00_start_sp(sp);
516516 if (rval != QLA_SUCCESS) {
drivers/scsi/qla2xxx/qla_target.c+1−2
@@ -4425,8 +4425,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, · 4424 unmodified lines
44254425 queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq, &cmd->work);
44264426 } else if (ha->msix_count) {
44274427 if (cmd->atio.u.isp24.fcp_cmnd.rddata)
4428− queue_work_on(smp_processor_id(), qla_tgt_wq,
4429− &cmd->work);
4428+ queue_work(qla_tgt_wq, &cmd->work);
44304429 else
44314430 queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq,
44324431 &cmd->work);
drivers/scsi/qla2xxx/tcm_qla2xxx.c+2−2
@@ -310,7 +310,7 @@ static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd) · 309 unmodified lines
310310 cmd->trc_flags |= TRC_CMD_DONE;
311311
312312 INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free);
313− queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
313+ queue_work(tcm_qla2xxx_free_wq, &cmd->work);
314314 }
315315
316316 /*
@@ -547,7 +547,7 @@ static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd) · 230 unmodified lines
547547 cmd->trc_flags |= TRC_DATA_IN;
548548 cmd->cmd_in_wq = 1;
549549 INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
550− queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
550+ queue_work(tcm_qla2xxx_free_wq, &cmd->work);
551551 }
552552
553553 static int tcm_qla2xxx_chk_dif_tags(uint32_t tag)
drivers/scsi/scsi.c+11−0
@@ -613,6 +613,17 @@ void scsi_cdl_check(struct scsi_device *sdev) · 612 unmodified lines
613613 bool cdl_supported;
614614 unsigned char *buf;
615615
616+ /*
617+ * Support for CDL was defined in SPC-5. Ignore devices reporting an
618+ * lower SPC version. This also avoids problems with old drives choking
619+ * on MAINTENANCE_IN / MI_REPORT_SUPPORTED_OPERATION_CODES with a
620+ * service action specified, as done in scsi_cdl_check_cmd().
621+ */
622+ if (sdev->scsi_level < SCSI_SPC_5) {
623+ sdev->cdl_supported = 0;
624+ return;
625+ }
626+
616627 buf = kmalloc(SCSI_CDL_CHECK_BUF_LEN, GFP_KERNEL);
617628 if (!buf) {
618629 sdev->cdl_supported = 0;
drivers/scsi/scsi_scan.c+18−2
@@ -822,7 +822,7 @@ static int scsi_probe_lun(struct scsi_device *sdev, unsigned char *inq_result, · 821 unmodified lines
822822 * device is attached at LUN 0 (SCSI_SCAN_TARGET_PRESENT) so
823823 * non-zero LUNs can be scanned.
824824 */
825− sdev->scsi_level = inq_result[2] & 0x07;
825+ sdev->scsi_level = inq_result[2] & 0x0f;
826826 if (sdev->scsi_level >= 2 ||
827827 (sdev->scsi_level == 1 && (inq_result[3] & 0x0f) == 1))
828828 sdev->scsi_level++;
@@ -1619,12 +1619,24 @@ int scsi_add_device(struct Scsi_Host *host, uint channel, · 790 unmodified lines
16191619 }
16201620 EXPORT_SYMBOL(scsi_add_device);
16211621
1622−void scsi_rescan_device(struct scsi_device *sdev)
1622+int scsi_rescan_device(struct scsi_device *sdev)
16231623 {
16241624 struct device *dev = &sdev->sdev_gendev;
1625+ int ret = 0;
16251626
16261627 device_lock(dev);
16271628
1629+ /*
1630+ * Bail out if the device is not running. Otherwise, the rescan may
1631+ * block waiting for commands to be executed, with us holding the
1632+ * device lock. This can result in a potential deadlock in the power
1633+ * management core code when system resume is on-going.
1634+ */
1635+ if (sdev->sdev_state != SDEV_RUNNING) {
1636+ ret = -EWOULDBLOCK;
1637+ goto unlock;
1638+ }
1639+
16281640 scsi_attach_vpd(sdev);
16291641 scsi_cdl_check(sdev);
16301642
@@ -1638,7 +1650,11 @@ void scsi_rescan_device(struct scsi_device *sdev) · 7 unmodified lines
16381650 drv->rescan(dev);
16391651 module_put(dev->driver->owner);
16401652 }
1653+
1654+unlock:
16411655 device_unlock(dev);
1656+
1657+ return ret;
16421658 }
16431659 EXPORT_SYMBOL(scsi_rescan_device);
16441660
drivers/scsi/sd.c+82−19
@@ -201,18 +201,32 @@ cache_type_store(struct device *dev, struct device_attribute *attr, · 200 unmodified lines
201201 }
202202
203203 static ssize_t
204−manage_start_stop_show(struct device *dev, struct device_attribute *attr,
205− char *buf)
204+manage_start_stop_show(struct device *dev,
205+ struct device_attribute *attr, char *buf)
206206 {
207207 struct scsi_disk *sdkp = to_scsi_disk(dev);
208208 struct scsi_device *sdp = sdkp->device;
209209
210− return sprintf(buf, "%u\n", sdp->manage_start_stop);
210+ return sysfs_emit(buf, "%u\n",
211+ sdp->manage_system_start_stop &&
212+ sdp->manage_runtime_start_stop);
211213 }
214+static DEVICE_ATTR_RO(manage_start_stop);
212215
213216 static ssize_t
214−manage_start_stop_store(struct device *dev, struct device_attribute *attr,
215− const char *buf, size_t count)
217+manage_system_start_stop_show(struct device *dev,
218+ struct device_attribute *attr, char *buf)
219+{
220+ struct scsi_disk *sdkp = to_scsi_disk(dev);
221+ struct scsi_device *sdp = sdkp->device;
222+
223+ return sysfs_emit(buf, "%u\n", sdp->manage_system_start_stop);
224+}
225+
226+static ssize_t
227+manage_system_start_stop_store(struct device *dev,
228+ struct device_attribute *attr,
229+ const char *buf, size_t count)
216230 {
217231 struct scsi_disk *sdkp = to_scsi_disk(dev);
218232 struct scsi_device *sdp = sdkp->device;
@@ -224,11 +238,42 @@ manage_start_stop_store(struct device *dev, struct device_attribute *attr, · 5 unmodified lines
224238 if (kstrtobool(buf, &v))
225239 return -EINVAL;
226240
227− sdp->manage_start_stop = v;
241+ sdp->manage_system_start_stop = v;
228242
229243 return count;
230244 }
231−static DEVICE_ATTR_RW(manage_start_stop);
245+static DEVICE_ATTR_RW(manage_system_start_stop);
246+
247+static ssize_t
248+manage_runtime_start_stop_show(struct device *dev,
249+ struct device_attribute *attr, char *buf)
250+{
251+ struct scsi_disk *sdkp = to_scsi_disk(dev);
252+ struct scsi_device *sdp = sdkp->device;
253+
254+ return sysfs_emit(buf, "%u\n", sdp->manage_runtime_start_stop);
255+}
256+
257+static ssize_t
258+manage_runtime_start_stop_store(struct device *dev,
259+ struct device_attribute *attr,
260+ const char *buf, size_t count)
261+{
262+ struct scsi_disk *sdkp = to_scsi_disk(dev);
263+ struct scsi_device *sdp = sdkp->device;
264+ bool v;
265+
266+ if (!capable(CAP_SYS_ADMIN))
267+ return -EACCES;
268+
269+ if (kstrtobool(buf, &v))
270+ return -EINVAL;
271+
272+ sdp->manage_runtime_start_stop = v;
273+
274+ return count;
275+}
276+static DEVICE_ATTR_RW(manage_runtime_start_stop);
232277
233278 static ssize_t
234279 allow_restart_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -560,6 +605,8 @@ static struct attribute *sd_disk_attrs[] = { · 325 unmodified lines
560605 &dev_attr_FUA.attr,
561606 &dev_attr_allow_restart.attr,
562607 &dev_attr_manage_start_stop.attr,
608+ &dev_attr_manage_system_start_stop.attr,
609+ &dev_attr_manage_runtime_start_stop.attr,
563610 &dev_attr_protection_type.attr,
564611 &dev_attr_protection_mode.attr,
565612 &dev_attr_app_tag_own.attr,
@@ -3694,7 +3741,8 @@ static int sd_remove(struct device *dev) · 3128 unmodified lines
36943741
36953742 device_del(&sdkp->disk_dev);
36963743 del_gendisk(sdkp->disk);
3697− sd_shutdown(dev);
3744+ if (!sdkp->suspended)
3745+ sd_shutdown(dev);
36983746
36993747 put_disk(sdkp->disk);
37003748 return 0;
@@ -3771,13 +3819,20 @@ static void sd_shutdown(struct device *dev) · 70 unmodified lines
37713819 sd_sync_cache(sdkp, NULL);
37723820 }
37733821
3774− if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
3822+ if (system_state != SYSTEM_RESTART &&
3823+ sdkp->device->manage_system_start_stop) {
37753824 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
37763825 sd_start_stop_device(sdkp, 0);
37773826 }
37783827 }
37793828
3780−static int sd_suspend_common(struct device *dev, bool ignore_stop_errors)
3829+static inline bool sd_do_start_stop(struct scsi_device *sdev, bool runtime)
3830+{
3831+ return (sdev->manage_system_start_stop && !runtime) ||
3832+ (sdev->manage_runtime_start_stop && runtime);
3833+}
3834+
3835+static int sd_suspend_common(struct device *dev, bool runtime)
37813836 {
37823837 struct scsi_disk *sdkp = dev_get_drvdata(dev);
37833838 struct scsi_sense_hdr sshdr;
@@ -3809,15 +3864,18 @@ static int sd_suspend_common(struct device *dev, bool ignore_stop_errors) · 25 unmodified lines
38093864 }
38103865 }
38113866
3812− if (sdkp->device->manage_start_stop) {
3867+ if (sd_do_start_stop(sdkp->device, runtime)) {
38133868 if (!sdkp->device->silence_suspend)
38143869 sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
38153870 /* an error is not worth aborting a system sleep */
38163871 ret = sd_start_stop_device(sdkp, 0);
3817− if (ignore_stop_errors)
3872+ if (!runtime)
38183873 ret = 0;
38193874 }
38203875
3876+ if (!ret)
3877+ sdkp->suspended = true;
3878+
38213879 return ret;
38223880 }
38233881
@@ -3826,15 +3884,15 @@ static int sd_suspend_system(struct device *dev) · 2 unmodified lines
38263884 if (pm_runtime_suspended(dev))
38273885 return 0;
38283886
3829− return sd_suspend_common(dev, true);
3887+ return sd_suspend_common(dev, false);
38303888 }
38313889
38323890 static int sd_suspend_runtime(struct device *dev)
38333891 {
3834− return sd_suspend_common(dev, false);
3892+ return sd_suspend_common(dev, true);
38353893 }
38363894
3837−static int sd_resume(struct device *dev)
3895+static int sd_resume(struct device *dev, bool runtime)
38383896 {
38393897 struct scsi_disk *sdkp = dev_get_drvdata(dev);
38403898 int ret = 0;
@@ -3842,16 +3900,21 @@ static int sd_resume(struct device *dev) · 1 unmodified line
38423900 if (!sdkp) /* E.g.: runtime resume at the start of sd_probe() */
38433901 return 0;
38443902
3845− if (!sdkp->device->manage_start_stop)
3903+ if (!sd_do_start_stop(sdkp->device, runtime)) {
3904+ sdkp->suspended = false;
38463905 return 0;
3906+ }
38473907
38483908 if (!sdkp->device->no_start_on_resume) {
38493909 sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
38503910 ret = sd_start_stop_device(sdkp, 1);
38513911 }
38523912
3853− if (!ret)
3913+ if (!ret) {
38543914 opal_unlock_from_suspend(sdkp->opal_dev);
3915+ sdkp->suspended = false;
3916+ }
3917+
38553918 return ret;
38563919 }
38573920
@@ -3860,7 +3923,7 @@ static int sd_resume_system(struct device *dev) · 2 unmodified lines
38603923 if (pm_runtime_suspended(dev))
38613924 return 0;
38623925
3863− return sd_resume(dev);
3926+ return sd_resume(dev, false);
38643927 }
38653928
38663929 static int sd_resume_runtime(struct device *dev)
@@ -3887,7 +3950,7 @@ static int sd_resume_runtime(struct device *dev) · 20 unmodified lines
38873950 "Failed to clear sense data\n");
38883951 }
38893952
3890− return sd_resume(dev);
3953+ return sd_resume(dev, true);
38913954 }
38923955
38933956 static const struct dev_pm_ops sd_pm_ops = {
drivers/scsi/sd.h+1−0
@@ -131,6 +131,7 @@ struct scsi_disk { · 130 unmodified lines
131131 u8 provisioning_mode;
132132 u8 zeroing_mode;
133133 u8 nr_actuators; /* Number of actuators */
134+ bool suspended; /* Disk is suspended (stopped) */
134135 unsigned ATO : 1; /* state of disk ATO bit */
135136 unsigned cache_override : 1; /* temp override of WCE,RCD */
136137 unsigned WCE : 1; /* state of disk WCE bit */
drivers/soc/imx/soc-imx8m.c+10−0
@@ -100,6 +100,7 @@ static void __init imx8mm_soc_uid(void) · 99 unmodified lines
100100 {
101101 void __iomem *ocotp_base;
102102 struct device_node *np;
103+ struct clk *clk;
103104 u32 offset = of_machine_is_compatible("fsl,imx8mp") ?
104105 IMX8MP_OCOTP_UID_OFFSET : 0;
105106
@@ -109,11 +110,20 @@ static void __init imx8mm_soc_uid(void) · 3 unmodified lines
109110
110111 ocotp_base = of_iomap(np, 0);
111112 WARN_ON(!ocotp_base);
113+ clk = of_clk_get_by_name(np, NULL);
114+ if (IS_ERR(clk)) {
115+ WARN_ON(IS_ERR(clk));
116+ return;
117+ }
118+
119+ clk_prepare_enable(clk);
112120
113121 soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH + offset);
114122 soc_uid <<= 32;
115123 soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW + offset);
116124
125+ clk_disable_unprepare(clk);
126+ clk_put(clk);
117127 iounmap(ocotp_base);
118128 of_node_put(np);
119129 }
drivers/soc/loongson/Kconfig+1−0
@@ -20,6 +20,7 @@ config LOONGSON2_GUTS · 19 unmodified lines
2020 config LOONGSON2_PM
2121 bool "Loongson-2 SoC Power Management Controller Driver"
2222 depends on LOONGARCH && OF
23+ depends on INPUT=y
2324 help
2425 The Loongson-2's power management controller was ACPI, supports ACPI
2526 S2Idle (Suspend To Idle), ACPI S3 (Suspend To RAM), ACPI S4 (Suspend To
drivers/soc/loongson/loongson2_guts.c+2−4
@@ -70,7 +70,7 @@ static const struct loongson2_soc_die_attr *loongson2_soc_die_match( · 69 unmodified lines
7070 if (matches->svr == (svr & matches->mask))
7171 return matches;
7272 matches++;
73− };
73+ }
7474
7575 return NULL;
7676 }
@@ -94,7 +94,6 @@ static int loongson2_guts_probe(struct platform_device *pdev) · 17 unmodified lines
9494 {
9595 struct device_node *root, *np = pdev->dev.of_node;
9696 struct device *dev = &pdev->dev;
97− struct resource *res;
9897 const struct loongson2_soc_die_attr *soc_die;
9998 const char *machine;
10099 u32 svr;
@@ -106,8 +105,7 @@ static int loongson2_guts_probe(struct platform_device *pdev) · 5 unmodified lines
106105
107106 guts->little_endian = of_property_read_bool(np, "little-endian");
108107
109− res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
110− guts->regs = ioremap(res->start, res->end - res->start + 1);
108+ guts->regs = devm_platform_ioremap_resource(pdev, 0);
111109 if (IS_ERR(guts->regs))
112110 return PTR_ERR(guts->regs);
113111
drivers/soc/loongson/loongson2_pm.c+6−1
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 #include <linux/input.h>
1212 #include <linux/suspend.h>
1313 #include <linux/interrupt.h>
14+#include <linux/of_platform.h>
1415 #include <linux/pm_wakeirq.h>
1516 #include <linux/platform_device.h>
1617 #include <asm/bootinfo.h>
@@ -192,12 +193,16 @@ static int loongson2_pm_probe(struct platform_device *pdev) · 175 unmodified lines
192193 if (loongson_sysconf.suspend_addr)
193194 suspend_set_ops(&loongson2_suspend_ops);
194195
196+ /* Populate children */
197+ retval = devm_of_platform_populate(dev);
198+ if (retval)
199+ dev_err(dev, "Error populating children, reboot and poweroff might not work properly\n");
200+
195201 return 0;
196202 }
197203
198204 static const struct of_device_id loongson2_pm_match[] = {
199205 { .compatible = "loongson,ls2k0500-pmc", },
200− { .compatible = "loongson,ls2k1000-pmc", },
201206 {},
202207 };
203208
drivers/spi/spi-cs42l43.c+0−1
@@ -256,7 +256,6 @@ static int cs42l43_spi_probe(struct platform_device *pdev) · 255 unmodified lines
256256
257257 ret = devm_spi_register_controller(priv->dev, priv->ctlr);
258258 if (ret) {
259− pm_runtime_disable(priv->dev);
260259 dev_err(priv->dev, "Failed to register SPI controller: %d\n", ret);
261260 }
262261
drivers/spi/spi-gxp.c+1−1
@@ -194,7 +194,7 @@ static ssize_t gxp_spi_write(struct gxp_spi_chip *chip, const struct spi_mem_op · 193 unmodified lines
194194 return ret;
195195 }
196196
197− return write_len;
197+ return 0;
198198 }
199199
200200 static int do_gxp_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op *op)
drivers/spi/spi-imx.c+1−1
@@ -662,7 +662,7 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx, · 661 unmodified lines
662662 if (spi_imx->count >= 512)
663663 ctrl |= 0xFFF << MX51_ECSPI_CTRL_BL_OFFSET;
664664 else
665− ctrl |= (spi_imx->count*8 - 1)
665+ ctrl |= (spi_imx->count * spi_imx->bits_per_word - 1)
666666 << MX51_ECSPI_CTRL_BL_OFFSET;
667667 }
668668
drivers/spi/spi-intel-pci.c+1−0
@@ -72,6 +72,7 @@ static const struct pci_device_id intel_spi_pci_ids[] = { · 71 unmodified lines
7272 { PCI_VDEVICE(INTEL, 0x4da4), (unsigned long)&bxt_info },
7373 { PCI_VDEVICE(INTEL, 0x51a4), (unsigned long)&cnl_info },
7474 { PCI_VDEVICE(INTEL, 0x54a4), (unsigned long)&cnl_info },
75+ { PCI_VDEVICE(INTEL, 0x5794), (unsigned long)&cnl_info },
7576 { PCI_VDEVICE(INTEL, 0x7a24), (unsigned long)&cnl_info },
7677 { PCI_VDEVICE(INTEL, 0x7aa4), (unsigned long)&cnl_info },
7778 { PCI_VDEVICE(INTEL, 0x7e23), (unsigned long)&cnl_info },
drivers/spi/spi-nxp-fspi.c+7−0
@@ -1084,6 +1084,13 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f) · 1083 unmodified lines
10841084 fspi_writel(f, FSPI_AHBCR_PREF_EN | FSPI_AHBCR_RDADDROPT,
10851085 base + FSPI_AHBCR);
10861086
1087+ /* Reset the FLSHxCR1 registers. */
1088+ reg = FSPI_FLSHXCR1_TCSH(0x3) | FSPI_FLSHXCR1_TCSS(0x3);
1089+ fspi_writel(f, reg, base + FSPI_FLSHA1CR1);
1090+ fspi_writel(f, reg, base + FSPI_FLSHA2CR1);
1091+ fspi_writel(f, reg, base + FSPI_FLSHB1CR1);
1092+ fspi_writel(f, reg, base + FSPI_FLSHB2CR1);
1093+
10871094 /* AHB Read - Set lut sequence ID for all CS. */
10881095 fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA1CR2);
10891096 fspi_writel(f, SEQID_LUT, base + FSPI_FLSHA2CR2);
drivers/spi/spi-stm32.c+8−0
@@ -277,6 +277,7 @@ struct stm32_spi_cfg { · 276 unmodified lines
277277 * @fifo_size: size of the embedded fifo in bytes
278278 * @cur_midi: master inter-data idleness in ns
279279 * @cur_speed: speed configured in Hz
280+ * @cur_half_period: time of a half bit in us
280281 * @cur_bpw: number of bits in a single SPI data frame
281282 * @cur_fthlv: fifo threshold level (data frames in a single data packet)
282283 * @cur_comm: SPI communication mode
@@ -304,6 +305,7 @@ struct stm32_spi { · 21 unmodified lines
304305
305306 unsigned int cur_midi;
306307 unsigned int cur_speed;
308+ unsigned int cur_half_period;
307309 unsigned int cur_bpw;
308310 unsigned int cur_fthlv;
309311 unsigned int cur_comm;
@@ -468,6 +470,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz, · 158 unmodified lines
468470
469471 spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
470472
473+ spi->cur_half_period = DIV_ROUND_CLOSEST(USEC_PER_SEC, 2 * spi->cur_speed);
474+
471475 return mbrdiv - 1;
472476 }
473477
@@ -709,6 +713,10 @@ static void stm32h7_spi_disable(struct stm32_spi *spi) · 235 unmodified lines
709713 return;
710714 }
711715
716+ /* Add a delay to make sure that transmission is ended. */
717+ if (spi->cur_half_period)
718+ udelay(spi->cur_half_period);
719+
712720 if (spi->cur_usedma && spi->dma_tx)
713721 dmaengine_terminate_async(spi->dma_tx);
714722 if (spi->cur_usedma && spi->dma_rx)
drivers/spi/spi-zynqmp-gqspi.c+8−4
@@ -1340,9 +1340,9 @@ static int zynqmp_qspi_probe(struct platform_device *pdev) · 1339 unmodified lines
13401340 return 0;
13411341
13421342 clk_dis_all:
1343− pm_runtime_put_sync(&pdev->dev);
1344− pm_runtime_set_suspended(&pdev->dev);
13451343 pm_runtime_disable(&pdev->dev);
1344+ pm_runtime_put_noidle(&pdev->dev);
1345+ pm_runtime_set_suspended(&pdev->dev);
13461346 clk_disable_unprepare(xqspi->refclk);
13471347 clk_dis_pclk:
13481348 clk_disable_unprepare(xqspi->pclk);
@@ -1366,11 +1366,15 @@ static void zynqmp_qspi_remove(struct platform_device *pdev) · 17 unmodified lines
13661366 {
13671367 struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev);
13681368
1369+ pm_runtime_get_sync(&pdev->dev);
1370+
13691371 zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0);
1372+
1373+ pm_runtime_disable(&pdev->dev);
1374+ pm_runtime_put_noidle(&pdev->dev);
1375+ pm_runtime_set_suspended(&pdev->dev);
13701376 clk_disable_unprepare(xqspi->refclk);
13711377 clk_disable_unprepare(xqspi->pclk);
1372− pm_runtime_set_suspended(&pdev->dev);
1373− pm_runtime_disable(&pdev->dev);
13741378 }
13751379
13761380 MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match);
drivers/target/target_core_configfs.c+12−12
@@ -1392,16 +1392,16 @@ static ssize_t target_wwn_vendor_id_store(struct config_item *item, · 1391 unmodified lines
13921392 /* +2 to allow for a trailing (stripped) '\n' and null-terminator */
13931393 unsigned char buf[INQUIRY_VENDOR_LEN + 2];
13941394 char *stripped = NULL;
1395− size_t len;
1395+ ssize_t len;
13961396 ssize_t ret;
13971397
1398− len = strlcpy(buf, page, sizeof(buf));
1399− if (len < sizeof(buf)) {
1398+ len = strscpy(buf, page, sizeof(buf));
1399+ if (len > 0) {
14001400 /* Strip any newline added from userspace. */
14011401 stripped = strstrip(buf);
14021402 len = strlen(stripped);
14031403 }
1404− if (len > INQUIRY_VENDOR_LEN) {
1404+ if (len < 0 || len > INQUIRY_VENDOR_LEN) {
14051405 pr_err("Emulated T10 Vendor Identification exceeds"
14061406 " INQUIRY_VENDOR_LEN: " __stringify(INQUIRY_VENDOR_LEN)
14071407 "\n");
@@ -1448,16 +1448,16 @@ static ssize_t target_wwn_product_id_store(struct config_item *item, · 40 unmodified lines
14481448 /* +2 to allow for a trailing (stripped) '\n' and null-terminator */
14491449 unsigned char buf[INQUIRY_MODEL_LEN + 2];
14501450 char *stripped = NULL;
1451− size_t len;
1451+ ssize_t len;
14521452 ssize_t ret;
14531453
1454− len = strlcpy(buf, page, sizeof(buf));
1455− if (len < sizeof(buf)) {
1454+ len = strscpy(buf, page, sizeof(buf));
1455+ if (len > 0) {
14561456 /* Strip any newline added from userspace. */
14571457 stripped = strstrip(buf);
14581458 len = strlen(stripped);
14591459 }
1460− if (len > INQUIRY_MODEL_LEN) {
1460+ if (len < 0 || len > INQUIRY_MODEL_LEN) {
14611461 pr_err("Emulated T10 Vendor exceeds INQUIRY_MODEL_LEN: "
14621462 __stringify(INQUIRY_MODEL_LEN)
14631463 "\n");
@@ -1504,16 +1504,16 @@ static ssize_t target_wwn_revision_store(struct config_item *item, · 40 unmodified lines
15041504 /* +2 to allow for a trailing (stripped) '\n' and null-terminator */
15051505 unsigned char buf[INQUIRY_REVISION_LEN + 2];
15061506 char *stripped = NULL;
1507− size_t len;
1507+ ssize_t len;
15081508 ssize_t ret;
15091509
1510− len = strlcpy(buf, page, sizeof(buf));
1511− if (len < sizeof(buf)) {
1510+ len = strscpy(buf, page, sizeof(buf));
1511+ if (len > 0) {
15121512 /* Strip any newline added from userspace. */
15131513 stripped = strstrip(buf);
15141514 len = strlen(stripped);
15151515 }
1516− if (len > INQUIRY_REVISION_LEN) {
1516+ if (len < 0 || len > INQUIRY_REVISION_LEN) {
15171517 pr_err("Emulated T10 Revision exceeds INQUIRY_REVISION_LEN: "
15181518 __stringify(INQUIRY_REVISION_LEN)
15191519 "\n");
drivers/target/target_core_transport.c+1−0
@@ -264,6 +264,7 @@ void target_free_cmd_counter(struct target_cmd_counter *cmd_cnt) · 263 unmodified lines
264264 percpu_ref_put(&cmd_cnt->refcnt);
265265
266266 percpu_ref_exit(&cmd_cnt->refcnt);
267+ kfree(cmd_cnt);
267268 }
268269 EXPORT_SYMBOL_GPL(target_free_cmd_counter);
269270
drivers/tee/optee/optee_private.h+0−2
@@ -238,8 +238,6 @@ int optee_notif_send(struct optee *optee, u_int key); · 237 unmodified lines
238238 u32 optee_supp_thrd_req(struct tee_context *ctx, u32 func, size_t num_params,
239239 struct tee_param *param);
240240
241−int optee_supp_read(struct tee_context *ctx, void __user *buf, size_t len);
242−int optee_supp_write(struct tee_context *ctx, void __user *buf, size_t len);
243241 void optee_supp_init(struct optee_supp *supp);
244242 void optee_supp_uninit(struct optee_supp *supp);
245243 void optee_supp_release(struct optee_supp *supp);
drivers/tee/tee_private.h+0−2
@@ -47,8 +47,6 @@ struct tee_device { · 46 unmodified lines
4747 struct tee_shm_pool *pool;
4848 };
4949
50−int tee_shm_init(void);
51−
5250 int tee_shm_get_fd(struct tee_shm *shm);
5351
5452 bool tee_device_get(struct tee_device *teedev);
drivers/thermal/thermal_core.c+4−2
@@ -348,12 +348,14 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id) · 347 unmodified lines
348348 struct thermal_trip trip;
349349
350350 /* Ignore disabled trip points */
351− if (test_bit(trip_id, &tz->trips_disabled) ||
352− trip.temperature == THERMAL_TEMP_INVALID)
351+ if (test_bit(trip_id, &tz->trips_disabled))
353352 return;
354353
355354 __thermal_zone_get_trip(tz, trip_id, &trip);
356355
356+ if (trip.temperature == THERMAL_TEMP_INVALID)
357+ return;
358+
357359 if (tz->last_temperature != THERMAL_TEMP_INVALID) {
358360 if (tz->last_temperature < trip.temperature &&
359361 tz->temperature >= trip.temperature)
drivers/thermal/thermal_of.c+6−2
@@ -37,8 +37,10 @@ static int of_find_trip_id(struct device_node *np, struct device_node *trip) · 36 unmodified lines
3737 */
3838 for_each_child_of_node(trips, t) {
3939
40− if (t == trip)
40+ if (t == trip) {
41+ of_node_put(t);
4142 goto out;
43+ }
4244 i++;
4345 }
4446
@@ -401,8 +403,10 @@ static int thermal_of_for_each_cooling_maps(struct thermal_zone_device *tz, · 356 unmodified lines
401403
402404 for_each_child_of_node(cm_np, child) {
403405 ret = thermal_of_for_each_cooling_device(tz_np, child, tz, cdev, action);
404− if (ret)
406+ if (ret) {
407+ of_node_put(child);
405408 break;
409+ }
406410 }
407411
408412 of_node_put(cm_np);
drivers/thermal/thermal_sysfs.c+5−4
@@ -185,9 +185,6 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, · 184 unmodified lines
185185 if (sscanf(attr->attr.name, "trip_point_%d_hyst", &trip_id) != 1)
186186 return -EINVAL;
187187
188− if (kstrtoint(buf, 10, &trip.hysteresis))
189− return -EINVAL;
190−
191188 mutex_lock(&tz->lock);
192189
193190 if (!device_is_registered(dev)) {
@@ -198,7 +195,11 @@ trip_point_hyst_store(struct device *dev, struct device_attribute *attr, · 4 unmodified lines
198195 ret = __thermal_zone_get_trip(tz, trip_id, &trip);
199196 if (ret)
200197 goto unlock;
201−
198+
199+ ret = kstrtoint(buf, 10, &trip.hysteresis);
200+ if (ret)
201+ goto unlock;
202+
202203 ret = thermal_zone_set_trip(tz, trip_id, &trip);
203204 unlock:
204205 mutex_unlock(&tz->lock);
drivers/thermal/ti-soc-thermal/ti-thermal-common.c+2−1
@@ -110,7 +110,8 @@ static inline int __ti_thermal_get_temp(struct thermal_zone_device *tz, int *tem · 109 unmodified lines
110110 }
111111
112112 static int __ti_thermal_get_trend(struct thermal_zone_device *tz,
113− struct thermal_trip *trip, enum thermal_trend *trend)
113+ const struct thermal_trip *trip,
114+ enum thermal_trend *trend)
114115 {
115116 struct ti_thermal_data *data = thermal_zone_device_priv(tz);
116117 struct ti_bandgap *bgp;
drivers/tty/n_gsm.c+1−3
@@ -3097,10 +3097,8 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc) · 3096 unmodified lines
30973097 gsm->has_devices = false;
30983098 }
30993099 for (i = NUM_DLCI - 1; i >= 0; i--)
3100− if (gsm->dlci[i]) {
3100+ if (gsm->dlci[i])
31013101 gsm_dlci_release(gsm->dlci[i]);
3102− gsm->dlci[i] = NULL;
3103− }
31043102 mutex_unlock(&gsm->mutex);
31053103 /* Now wipe the queues */
31063104 tty_ldisc_flush(gsm->tty);
drivers/tty/serial/8250/8250_port.c+4−1
@@ -1936,7 +1936,10 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir) · 1935 unmodified lines
19361936 skip_rx = true;
19371937
19381938 if (status & (UART_LSR_DR | UART_LSR_BI) && !skip_rx) {
1939− if (irqd_is_wakeup_set(irq_get_irq_data(port->irq)))
1939+ struct irq_data *d;
1940+
1941+ d = irq_get_irq_data(port->irq);
1942+ if (d && irqd_is_wakeup_set(d))
19401943 pm_wakeup_event(tport->tty->dev, 0);
19411944 if (!up->dma || handle_rx_dma(up, iir))
19421945 status = serial8250_rx_chars(up, status);
drivers/ufs/core/ufshcd.c+7−6
@@ -22,6 +22,7 @@ · 21 unmodified lines
2222 #include <linux/module.h>
2323 #include <linux/regulator/consumer.h>
2424 #include <linux/sched/clock.h>
25+#include <linux/iopoll.h>
2526 #include <scsi/scsi_cmnd.h>
2627 #include <scsi/scsi_dbg.h>
2728 #include <scsi/scsi_driver.h>
@@ -2299,7 +2300,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) · 2271 unmodified lines
22992300 */
23002301 static inline bool ufshcd_ready_for_uic_cmd(struct ufs_hba *hba)
23012302 {
2302− return ufshcd_readl(hba, REG_CONTROLLER_STATUS) & UIC_COMMAND_READY;
2303+ u32 val;
2304+ int ret = read_poll_timeout(ufshcd_readl, val, val & UIC_COMMAND_READY,
2305+ 500, UIC_CMD_TIMEOUT * 1000, false, hba,
2306+ REG_CONTROLLER_STATUS);
2307+ return ret == 0 ? true : false;
23032308 }
23042309
23052310 /**
@@ -2392,7 +2397,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, · 86 unmodified lines
23922397 bool completion)
23932398 {
23942399 lockdep_assert_held(&hba->uic_cmd_mutex);
2395− lockdep_assert_held(hba->host->host_lock);
23962400
23972401 if (!ufshcd_ready_for_uic_cmd(hba)) {
23982402 dev_err(hba->dev,
@@ -2419,7 +2423,6 @@ __ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd, · 20 unmodified lines
24192423 int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd)
24202424 {
24212425 int ret;
2422− unsigned long flags;
24232426
24242427 if (hba->quirks & UFSHCD_QUIRK_BROKEN_UIC_CMD)
24252428 return 0;
@@ -2428,9 +2431,7 @@ int ufshcd_send_uic_cmd(struct ufs_hba *hba, struct uic_command *uic_cmd) · 2 unmodified lines
24282431 mutex_lock(&hba->uic_cmd_mutex);
24292432 ufshcd_add_delay_before_dme_cmd(hba);
24302433
2431− spin_lock_irqsave(hba->host->host_lock, flags);
24322434 ret = __ufshcd_send_uic_cmd(hba, uic_cmd, true);
2433− spin_unlock_irqrestore(hba->host->host_lock, flags);
24342435 if (!ret)
24352436 ret = ufshcd_wait_for_uic_cmd(hba, uic_cmd);
24362437
@@ -4133,8 +4134,8 @@ static int ufshcd_uic_pwr_ctrl(struct ufs_hba *hba, struct uic_command *cmd) · 1696 unmodified lines
41334134 wmb();
41344135 reenable_intr = true;
41354136 }
4136− ret = __ufshcd_send_uic_cmd(hba, cmd, false);
41374137 spin_unlock_irqrestore(hba->host->host_lock, flags);
4138+ ret = __ufshcd_send_uic_cmd(hba, cmd, false);
41384139 if (ret) {
41394140 dev_err(hba->dev,
41404141 "pwr ctrl cmd 0x%x with mode 0x%x uic error %d\n",
drivers/usb/typec/ucsi/debugfs.c+3−0
@@ -84,6 +84,9 @@ void ucsi_debugfs_register(struct ucsi *ucsi) · 83 unmodified lines
8484
8585 void ucsi_debugfs_unregister(struct ucsi *ucsi)
8686 {
87+ if (IS_ERR_OR_NULL(ucsi) || !ucsi->debugfs)
88+ return;
89+
8790 debugfs_remove_recursive(ucsi->debugfs->dentry);
8891 kfree(ucsi->debugfs);
8992 }
drivers/vfio/mdev/mdev_sysfs.c+2−1
@@ -233,7 +233,8 @@ int parent_create_sysfs_files(struct mdev_parent *parent) · 232 unmodified lines
233233 out_err:
234234 while (--i >= 0)
235235 mdev_type_remove(parent->types[i]);
236− return 0;
236+ kset_unregister(parent->mdev_types_kset);
237+ return ret;
237238 }
238239
239240 static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
drivers/vfio/pci/pds/Kconfig+1−1
@@ -3,7 +3,7 @@ · 2 unmodified lines
33
44 config PDS_VFIO_PCI
55 tristate "VFIO support for PDS PCI devices"
6− depends on PDS_CORE
6+ depends on PDS_CORE && PCI_IOV
77 select VFIO_PCI_CORE
88 help
99 This provides generic PCI support for PDS devices using the VFIO
drivers/vfio/pci/pds/vfio_dev.c+1−1
@@ -162,7 +162,7 @@ static int pds_vfio_init_device(struct vfio_device *vdev) · 161 unmodified lines
162162 pci_id = PCI_DEVID(pdev->bus->number, pdev->devfn);
163163 dev_dbg(&pdev->dev,
164164 "%s: PF %#04x VF %#04x vf_id %d domain %d pds_vfio %p\n",
165− __func__, pci_dev_id(pdev->physfn), pci_id, vf_id,
165+ __func__, pci_dev_id(pci_physfn(pdev)), pci_id, vf_id,
166166 pci_domain_nr(pdev->bus), pds_vfio);
167167
168168 return 0;
drivers/video/console/Kconfig+1−0
@@ -73,6 +73,7 @@ config DUMMY_CONSOLE_ROWS · 72 unmodified lines
7373 config FRAMEBUFFER_CONSOLE
7474 bool "Framebuffer Console support"
7575 depends on FB_CORE && !UML
76+ default DRM_FBDEV_EMULATION
7677 select VT_HW_CONSOLE_BINDING
7778 select CRC32
7879 select FONT_SUPPORT
drivers/video/fbdev/Kconfig+1−1
@@ -1762,7 +1762,7 @@ config FB_COBALT · 1761 unmodified lines
17621762
17631763 config FB_SH7760
17641764 bool "SH7760/SH7763/SH7720/SH7721 LCDC support"
1765− depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \
1765+ depends on FB=y && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \
17661766 || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721)
17671767 select FB_IOMEM_HELPERS
17681768 help
drivers/video/fbdev/core/Kconfig+1−1
@@ -28,7 +28,7 @@ config FIRMWARE_EDID · 27 unmodified lines
2828 config FB_DEVICE
2929 bool "Provide legacy /dev/fb* device"
3030 depends on FB_CORE
31− default y
31+ default FB
3232 help
3333 Say Y here if you want the legacy /dev/fb* device file and
3434 interfaces within sysfs anc procfs. It is only required if you
drivers/w1/masters/ds2482.c+1−1
@@ -551,7 +551,7 @@ static struct i2c_driver ds2482_driver = { · 550 unmodified lines
551551 .driver = {
552552 .name = "ds2482",
553553 },
554− .probe_new = ds2482_probe,
554+ .probe = ds2482_probe,
555555 .remove = ds2482_remove,
556556 .id_table = ds2482_id,
557557 };
drivers/xen/events/events_base.c+2−19
@@ -1704,7 +1704,7 @@ void handle_irq_for_port(evtchn_port_t port, struct evtchn_loop_ctrl *ctrl) · 1703 unmodified lines
17041704 generic_handle_irq(irq);
17051705 }
17061706
1707−static int __xen_evtchn_do_upcall(void)
1707+int xen_evtchn_do_upcall(void)
17081708 {
17091709 struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
17101710 int ret = vcpu_info->evtchn_upcall_pending ? IRQ_HANDLED : IRQ_NONE;
@@ -1735,24 +1735,7 @@ static int __xen_evtchn_do_upcall(void) · 24 unmodified lines
17351735
17361736 return ret;
17371737 }
1738−
1739−void xen_evtchn_do_upcall(struct pt_regs *regs)
1740−{
1741− struct pt_regs *old_regs = set_irq_regs(regs);
1742−
1743− irq_enter();
1744−
1745− __xen_evtchn_do_upcall();
1746−
1747− irq_exit();
1748− set_irq_regs(old_regs);
1749−}
1750−
1751−int xen_hvm_evtchn_do_upcall(void)
1752−{
1753− return __xen_evtchn_do_upcall();
1754−}
1755−EXPORT_SYMBOL_GPL(xen_hvm_evtchn_do_upcall);
1738+EXPORT_SYMBOL_GPL(xen_evtchn_do_upcall);
17561739
17571740 /* Rebind a new event channel to an existing irq. */
17581741 void rebind_evtchn_irq(evtchn_port_t evtchn, int irq)
drivers/xen/platform-pci.c+1−1
@@ -64,7 +64,7 @@ static uint64_t get_callback_via(struct pci_dev *pdev) · 63 unmodified lines
6464
6565 static irqreturn_t do_hvm_evtchn_intr(int irq, void *dev_id)
6666 {
67− return xen_hvm_evtchn_do_upcall();
67+ return xen_evtchn_do_upcall();
6868 }
6969
7070 static int xen_allocate_irq(struct pci_dev *pdev)
fs/aio.c+1−1
@@ -80,7 +80,7 @@ struct aio_ring { · 79 unmodified lines
8080 struct kioctx_table {
8181 struct rcu_head rcu;
8282 unsigned nr;
83− struct kioctx __rcu *table[];
83+ struct kioctx __rcu *table[] __counted_by(nr);
8484 };
8585
8686 struct kioctx_cpu {
fs/binfmt_elf_fdpic.c+2−3
@@ -345,10 +345,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm) · 344 unmodified lines
345345 /* there's now no turning back... the old userspace image is dead,
346346 * defunct, deceased, etc.
347347 */
348+ SET_PERSONALITY(exec_params.hdr);
348349 if (elf_check_fdpic(&exec_params.hdr))
349− set_personality(PER_LINUX_FDPIC);
350− else
351− set_personality(PER_LINUX);
350+ current->personality |= PER_LINUX_FDPIC;
352351 if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
353352 current->personality |= READ_IMPLIES_EXEC;
354353
fs/btrfs/Kconfig+1−1
@@ -31,7 +31,7 @@ config BTRFS_FS · 30 unmodified lines
3131 continue to be mountable and usable by newer kernels.
3232
3333 For more information, please see the web pages at
34− http://btrfs.wiki.kernel.org.
34+ https://btrfs.readthedocs.io
3535
3636 To compile this file system support as a module, choose M here. The
3737 module will be called btrfs.
fs/btrfs/block-group.c+10−2
@@ -3028,8 +3028,16 @@ static int update_block_group_item(struct btrfs_trans_handle *trans, · 3027 unmodified lines
30283028 btrfs_mark_buffer_dirty(leaf);
30293029 fail:
30303030 btrfs_release_path(path);
3031− /* We didn't update the block group item, need to revert @commit_used. */
3032− if (ret < 0) {
3031+ /*
3032+ * We didn't update the block group item, need to revert commit_used
3033+ * unless the block group item didn't exist yet - this is to prevent a
3034+ * race with a concurrent insertion of the block group item, with
3035+ * insert_block_group_item(), that happened just after we attempted to
3036+ * update. In that case we would reset commit_used to 0 just after the
3037+ * insertion set it to a value greater than 0 - if the block group later
3038+ * becomes with 0 used bytes, we would incorrectly skip its update.
3039+ */
3040+ if (ret < 0 && ret != -ENOENT) {
30333041 spin_lock(&cache->lock);
30343042 cache->commit_used = old_commit_used;
30353043 spin_unlock(&cache->lock);
fs/btrfs/delayed-inode.c+71−33
@@ -412,6 +412,7 @@ static void finish_one_item(struct btrfs_delayed_root *delayed_root) · 411 unmodified lines
412412
413413 static void __btrfs_remove_delayed_item(struct btrfs_delayed_item *delayed_item)
414414 {
415+ struct btrfs_delayed_node *delayed_node = delayed_item->delayed_node;
415416 struct rb_root_cached *root;
416417 struct btrfs_delayed_root *delayed_root;
417418
@@ -419,18 +420,21 @@ static void __btrfs_remove_delayed_item(struct btrfs_delayed_item *delayed_item) · 1 unmodified line
419420 if (RB_EMPTY_NODE(&delayed_item->rb_node))
420421 return;
421422
422− delayed_root = delayed_item->delayed_node->root->fs_info->delayed_root;
423+ /* If it's in a rbtree, then we need to have delayed node locked. */
424+ lockdep_assert_held(&delayed_node->mutex);
425+
426+ delayed_root = delayed_node->root->fs_info->delayed_root;
423427
424428 BUG_ON(!delayed_root);
425429
426430 if (delayed_item->type == BTRFS_DELAYED_INSERTION_ITEM)
427− root = &delayed_item->delayed_node->ins_root;
431+ root = &delayed_node->ins_root;
428432 else
429− root = &delayed_item->delayed_node->del_root;
433+ root = &delayed_node->del_root;
430434
431435 rb_erase_cached(&delayed_item->rb_node, root);
432436 RB_CLEAR_NODE(&delayed_item->rb_node);
433− delayed_item->delayed_node->count--;
437+ delayed_node->count--;
434438
435439 finish_one_item(delayed_root);
436440 }
@@ -1153,20 +1157,33 @@ static int __btrfs_run_delayed_items(struct btrfs_trans_handle *trans, int nr) · 716 unmodified lines
11531157 ret = __btrfs_commit_inode_delayed_items(trans, path,
11541158 curr_node);
11551159 if (ret) {
1156− btrfs_release_delayed_node(curr_node);
1157− curr_node = NULL;
11581160 btrfs_abort_transaction(trans, ret);
11591161 break;
11601162 }
11611163
11621164 prev_node = curr_node;
11631165 curr_node = btrfs_next_delayed_node(curr_node);
1166+ /*
1167+ * See the comment below about releasing path before releasing
1168+ * node. If the commit of delayed items was successful the path
1169+ * should always be released, but in case of an error, it may
1170+ * point to locked extent buffers (a leaf at the very least).
1171+ */
1172+ ASSERT(path->nodes[0] == NULL);
11641173 btrfs_release_delayed_node(prev_node);
11651174 }
11661175
1176+ /*
1177+ * Release the path to avoid a potential deadlock and lockdep splat when
1178+ * releasing the delayed node, as that requires taking the delayed node's
1179+ * mutex. If another task starts running delayed items before we take
1180+ * the mutex, it will first lock the mutex and then it may try to lock
1181+ * the same btree path (leaf).
1182+ */
1183+ btrfs_free_path(path);
1184+
11671185 if (curr_node)
11681186 btrfs_release_delayed_node(curr_node);
1169− btrfs_free_path(path);
11701187 trans->block_rsv = block_rsv;
11711188
11721189 return ret;
@@ -1413,7 +1430,29 @@ void btrfs_balance_delayed_items(struct btrfs_fs_info *fs_info) · 240 unmodified lines
14131430 btrfs_wq_run_delayed_node(delayed_root, fs_info, BTRFS_DELAYED_BATCH);
14141431 }
14151432
1416−/* Will return 0 or -ENOMEM */
1433+static void btrfs_release_dir_index_item_space(struct btrfs_trans_handle *trans)
1434+{
1435+ struct btrfs_fs_info *fs_info = trans->fs_info;
1436+ const u64 bytes = btrfs_calc_insert_metadata_size(fs_info, 1);
1437+
1438+ if (test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags))
1439+ return;
1440+
1441+ /*
1442+ * Adding the new dir index item does not require touching another
1443+ * leaf, so we can release 1 unit of metadata that was previously
1444+ * reserved when starting the transaction. This applies only to
1445+ * the case where we had a transaction start and excludes the
1446+ * transaction join case (when replaying log trees).
1447+ */
1448+ trace_btrfs_space_reservation(fs_info, "transaction",
1449+ trans->transid, bytes, 0);
1450+ btrfs_block_rsv_release(fs_info, trans->block_rsv, bytes, NULL);
1451+ ASSERT(trans->bytes_reserved >= bytes);
1452+ trans->bytes_reserved -= bytes;
1453+}
1454+
1455+/* Will return 0, -ENOMEM or -EEXIST (index number collision, unexpected). */
14171456 int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans,
14181457 const char *name, int name_len,
14191458 struct btrfs_inode *dir,
@@ -1455,6 +1494,27 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, · 35 unmodified lines
14551494
14561495 mutex_lock(&delayed_node->mutex);
14571496
1497+ /*
1498+ * First attempt to insert the delayed item. This is to make the error
1499+ * handling path simpler in case we fail (-EEXIST). There's no risk of
1500+ * any other task coming in and running the delayed item before we do
1501+ * the metadata space reservation below, because we are holding the
1502+ * delayed node's mutex and that mutex must also be locked before the
1503+ * node's delayed items can be run.
1504+ */
1505+ ret = __btrfs_add_delayed_item(delayed_node, delayed_item);
1506+ if (unlikely(ret)) {
1507+ btrfs_err(trans->fs_info,
1508+"error adding delayed dir index item, name: %.*s, index: %llu, root: %llu, dir: %llu, dir->index_cnt: %llu, delayed_node->index_cnt: %llu, error: %d",
1509+ name_len, name, index, btrfs_root_id(delayed_node->root),
1510+ delayed_node->inode_id, dir->index_cnt,
1511+ delayed_node->index_cnt, ret);
1512+ btrfs_release_delayed_item(delayed_item);
1513+ btrfs_release_dir_index_item_space(trans);
1514+ mutex_unlock(&delayed_node->mutex);
1515+ goto release_node;
1516+ }
1517+
14581518 if (delayed_node->index_item_leaves == 0 ||
14591519 delayed_node->curr_index_batch_size + data_len > leaf_data_size) {
14601520 delayed_node->curr_index_batch_size = data_len;
@@ -1472,36 +1532,14 @@ int btrfs_insert_delayed_dir_index(struct btrfs_trans_handle *trans, · 11 unmodified lines
14721532 * impossible.
14731533 */
14741534 if (WARN_ON(ret)) {
1475− mutex_unlock(&delayed_node->mutex);
14761535 btrfs_release_delayed_item(delayed_item);
1536+ mutex_unlock(&delayed_node->mutex);
14771537 goto release_node;
14781538 }
14791539
14801540 delayed_node->index_item_leaves++;
1481− } else if (!test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags)) {
1482− const u64 bytes = btrfs_calc_insert_metadata_size(fs_info, 1);
1483−
1484− /*
1485− * Adding the new dir index item does not require touching another
1486− * leaf, so we can release 1 unit of metadata that was previously
1487− * reserved when starting the transaction. This applies only to
1488− * the case where we had a transaction start and excludes the
1489− * transaction join case (when replaying log trees).
1490− */
1491− trace_btrfs_space_reservation(fs_info, "transaction",
1492− trans->transid, bytes, 0);
1493− btrfs_block_rsv_release(fs_info, trans->block_rsv, bytes, NULL);
1494− ASSERT(trans->bytes_reserved >= bytes);
1495− trans->bytes_reserved -= bytes;
1496− }
1497−
1498− ret = __btrfs_add_delayed_item(delayed_node, delayed_item);
1499− if (unlikely(ret)) {
1500− btrfs_err(trans->fs_info,
1501− "err add delayed dir index item(name: %.*s) into the insertion tree of the delayed node(root id: %llu, inode id: %llu, errno: %d)",
1502− name_len, name, delayed_node->root->root_key.objectid,
1503− delayed_node->inode_id, ret);
1504− BUG();
1541+ } else {
1542+ btrfs_release_dir_index_item_space(trans);
15051543 }
15061544 mutex_unlock(&delayed_node->mutex);
15071545
fs/btrfs/delayed-ref.c+35−11
@@ -103,24 +103,17 @@ void btrfs_update_delayed_refs_rsv(struct btrfs_trans_handle *trans) · 102 unmodified lines
103103 * Transfer bytes to our delayed refs rsv.
104104 *
105105 * @fs_info: the filesystem
106− * @src: source block rsv to transfer from
107106 * @num_bytes: number of bytes to transfer
108107 *
109− * This transfers up to the num_bytes amount from the src rsv to the
108+ * This transfers up to the num_bytes amount, previously reserved, to the
110109 * delayed_refs_rsv. Any extra bytes are returned to the space info.
111110 */
112111 void btrfs_migrate_to_delayed_refs_rsv(struct btrfs_fs_info *fs_info,
113− struct btrfs_block_rsv *src,
114112 u64 num_bytes)
115113 {
116114 struct btrfs_block_rsv *delayed_refs_rsv = &fs_info->delayed_refs_rsv;
117115 u64 to_free = 0;
118116
119− spin_lock(&src->lock);
120− src->reserved -= num_bytes;
121− src->size -= num_bytes;
122− spin_unlock(&src->lock);
123−
124117 spin_lock(&delayed_refs_rsv->lock);
125118 if (delayed_refs_rsv->size > delayed_refs_rsv->reserved) {
126119 u64 delta = delayed_refs_rsv->size -
@@ -163,6 +156,8 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, · 36 unmodified lines
163156 struct btrfs_block_rsv *block_rsv = &fs_info->delayed_refs_rsv;
164157 u64 limit = btrfs_calc_delayed_ref_bytes(fs_info, 1);
165158 u64 num_bytes = 0;
159+ u64 refilled_bytes;
160+ u64 to_free;
166161 int ret = -ENOSPC;
167162
168163 spin_lock(&block_rsv->lock);
@@ -178,9 +173,38 @@ int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info, · 9 unmodified lines
178173 ret = btrfs_reserve_metadata_bytes(fs_info, block_rsv, num_bytes, flush);
179174 if (ret)
180175 return ret;
181− btrfs_block_rsv_add_bytes(block_rsv, num_bytes, false);
182− trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv",
183− 0, num_bytes, 1);
176+
177+ /*
178+ * We may have raced with someone else, so check again if we the block
179+ * reserve is still not full and release any excess space.
180+ */
181+ spin_lock(&block_rsv->lock);
182+ if (block_rsv->reserved < block_rsv->size) {
183+ u64 needed = block_rsv->size - block_rsv->reserved;
184+
185+ if (num_bytes >= needed) {
186+ block_rsv->reserved += needed;
187+ block_rsv->full = true;
188+ to_free = num_bytes - needed;
189+ refilled_bytes = needed;
190+ } else {
191+ block_rsv->reserved += num_bytes;
192+ to_free = 0;
193+ refilled_bytes = num_bytes;
194+ }
195+ } else {
196+ to_free = num_bytes;
197+ refilled_bytes = 0;
198+ }
199+ spin_unlock(&block_rsv->lock);
200+
201+ if (to_free > 0)
202+ btrfs_space_info_free_bytes_may_use(fs_info, block_rsv->space_info,
203+ to_free);
204+
205+ if (refilled_bytes > 0)
206+ trace_btrfs_space_reservation(fs_info, "delayed_refs_rsv", 0,
207+ refilled_bytes, 1);
184208 return 0;
185209 }
186210
fs/btrfs/delayed-ref.h+0−1
@@ -407,7 +407,6 @@ void btrfs_update_delayed_refs_rsv(struct btrfs_trans_handle *trans); · 406 unmodified lines
407407 int btrfs_delayed_refs_rsv_refill(struct btrfs_fs_info *fs_info,
408408 enum btrfs_reserve_flush_enum flush);
409409 void btrfs_migrate_to_delayed_refs_rsv(struct btrfs_fs_info *fs_info,
410− struct btrfs_block_rsv *src,
411410 u64 num_bytes);
412411 bool btrfs_check_space_for_delayed_refs(struct btrfs_fs_info *fs_info);
413412
fs/btrfs/disk-io.c+12−10
@@ -520,6 +520,7 @@ static bool btree_dirty_folio(struct address_space *mapping, · 519 unmodified lines
520520 struct folio *folio)
521521 {
522522 struct btrfs_fs_info *fs_info = btrfs_sb(mapping->host->i_sb);
523+ struct btrfs_subpage_info *spi = fs_info->subpage_info;
523524 struct btrfs_subpage *subpage;
524525 struct extent_buffer *eb;
525526 int cur_bit = 0;
@@ -533,18 +534,19 @@ static bool btree_dirty_folio(struct address_space *mapping, · 7 unmodified lines
533534 btrfs_assert_tree_write_locked(eb);
534535 return filemap_dirty_folio(mapping, folio);
535536 }
537+
538+ ASSERT(spi);
536539 subpage = folio_get_private(folio);
537540
538− ASSERT(subpage->dirty_bitmap);
539− while (cur_bit < BTRFS_SUBPAGE_BITMAP_SIZE) {
541+ for (cur_bit = spi->dirty_offset;
542+ cur_bit < spi->dirty_offset + spi->bitmap_nr_bits;
543+ cur_bit++) {
540544 unsigned long flags;
541545 u64 cur;
542− u16 tmp = (1 << cur_bit);
543546
544547 spin_lock_irqsave(&subpage->lock, flags);
545− if (!(tmp & subpage->dirty_bitmap)) {
548+ if (!test_bit(cur_bit, subpage->bitmaps)) {
546549 spin_unlock_irqrestore(&subpage->lock, flags);
547− cur_bit++;
548550 continue;
549551 }
550552 spin_unlock_irqrestore(&subpage->lock, flags);
@@ -557,7 +559,7 @@ static bool btree_dirty_folio(struct address_space *mapping, · 6 unmodified lines
557559 btrfs_assert_tree_write_locked(eb);
558560 free_extent_buffer(eb);
559561
560− cur_bit += (fs_info->nodesize >> fs_info->sectorsize_bits);
562+ cur_bit += (fs_info->nodesize >> fs_info->sectorsize_bits) - 1;
561563 }
562564 return filemap_dirty_folio(mapping, folio);
563565 }
@@ -1547,7 +1549,7 @@ static int transaction_kthread(void *arg) · 983 unmodified lines
15471549
15481550 delta = ktime_get_seconds() - cur->start_time;
15491551 if (!test_and_clear_bit(BTRFS_FS_COMMIT_TRANS, &fs_info->flags) &&
1550− cur->state < TRANS_STATE_COMMIT_START &&
1552+ cur->state < TRANS_STATE_COMMIT_PREP &&
15511553 delta < fs_info->commit_interval) {
15521554 spin_unlock(&fs_info->trans_lock);
15531555 delay -= msecs_to_jiffies((delta - 1) * 1000);
@@ -2682,8 +2684,8 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info) · 1128 unmodified lines
26822684 btrfs_lockdep_init_map(fs_info, btrfs_trans_num_extwriters);
26832685 btrfs_lockdep_init_map(fs_info, btrfs_trans_pending_ordered);
26842686 btrfs_lockdep_init_map(fs_info, btrfs_ordered_extent);
2685− btrfs_state_lockdep_init_map(fs_info, btrfs_trans_commit_start,
2686− BTRFS_LOCKDEP_TRANS_COMMIT_START);
2687+ btrfs_state_lockdep_init_map(fs_info, btrfs_trans_commit_prep,
2688+ BTRFS_LOCKDEP_TRANS_COMMIT_PREP);
26872689 btrfs_state_lockdep_init_map(fs_info, btrfs_trans_unblocked,
26882690 BTRFS_LOCKDEP_TRANS_UNBLOCKED);
26892691 btrfs_state_lockdep_init_map(fs_info, btrfs_trans_super_committed,
@@ -4870,7 +4872,7 @@ static int btrfs_cleanup_transaction(struct btrfs_fs_info *fs_info) · 2180 unmodified lines
48704872 while (!list_empty(&fs_info->trans_list)) {
48714873 t = list_first_entry(&fs_info->trans_list,
48724874 struct btrfs_transaction, list);
4873− if (t->state >= TRANS_STATE_COMMIT_START) {
4875+ if (t->state >= TRANS_STATE_COMMIT_PREP) {
48744876 refcount_inc(&t->use_count);
48754877 spin_unlock(&fs_info->trans_lock);
48764878 btrfs_wait_for_commit(fs_info, t->transid);
fs/btrfs/extent-tree.c+10−8
@@ -1514,15 +1514,14 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, · 1513 unmodified lines
15141514 btrfs_release_path(path);
15151515
15161516 /* now insert the actual backref */
1517− if (owner < BTRFS_FIRST_FREE_OBJECTID) {
1518− BUG_ON(refs_to_add != 1);
1517+ if (owner < BTRFS_FIRST_FREE_OBJECTID)
15191518 ret = insert_tree_block_ref(trans, path, bytenr, parent,
15201519 root_objectid);
1521− } else {
1520+ else
15221521 ret = insert_extent_data_ref(trans, path, bytenr, parent,
15231522 root_objectid, owner, offset,
15241523 refs_to_add);
1525− }
1524+
15261525 if (ret)
15271526 btrfs_abort_transaction(trans, ret);
15281527 out:
@@ -1656,7 +1655,10 @@ again: · 127 unmodified lines
16561655 goto again;
16571656 }
16581657 } else {
1659− err = -EIO;
1658+ err = -EUCLEAN;
1659+ btrfs_err(fs_info,
1660+ "missing extent item for extent %llu num_bytes %llu level %d",
1661+ head->bytenr, head->num_bytes, extent_op->level);
16601662 goto out;
16611663 }
16621664 }
@@ -1699,12 +1701,12 @@ static int run_delayed_tree_ref(struct btrfs_trans_handle *trans, · 36 unmodified lines
16991701 parent = ref->parent;
17001702 ref_root = ref->root;
17011703
1702− if (node->ref_mod != 1) {
1704+ if (unlikely(node->ref_mod != 1)) {
17031705 btrfs_err(trans->fs_info,
1704− "btree block(%llu) has %d references rather than 1: action %d ref_root %llu parent %llu",
1706+ "btree block %llu has %d references rather than 1: action %d ref_root %llu parent %llu",
17051707 node->bytenr, node->ref_mod, node->action, ref_root,
17061708 parent);
1707− return -EIO;
1709+ return -EUCLEAN;
17081710 }
17091711 if (node->action == BTRFS_ADD_DELAYED_REF && insert_reserved) {
17101712 BUG_ON(!extent_op || !extent_op->update_flags);
fs/btrfs/extent_io.c+8−9
@@ -484,10 +484,8 @@ static void end_bio_extent_writepage(struct btrfs_bio *bbio) · 483 unmodified lines
484484 bvec->bv_offset, bvec->bv_len);
485485
486486 btrfs_finish_ordered_extent(bbio->ordered, page, start, len, !error);
487− if (error) {
488− btrfs_page_clear_uptodate(fs_info, page, start, len);
487+ if (error)
489488 mapping_set_error(page->mapping, error);
490− }
491489 btrfs_page_clear_writeback(fs_info, page, start, len);
492490 }
493491
@@ -1456,8 +1454,6 @@ done: · 962 unmodified lines
14561454 if (ret) {
14571455 btrfs_mark_ordered_io_finished(BTRFS_I(inode), page, page_start,
14581456 PAGE_SIZE, !ret);
1459− btrfs_page_clear_uptodate(btrfs_sb(inode->i_sb), page,
1460− page_start, PAGE_SIZE);
14611457 mapping_set_error(page->mapping, ret);
14621458 }
14631459 unlock_page(page);
@@ -1624,8 +1620,6 @@ static void extent_buffer_write_end_io(struct btrfs_bio *bbio) · 160 unmodified lines
16241620 struct page *page = bvec->bv_page;
16251621 u32 len = bvec->bv_len;
16261622
1627− if (!uptodate)
1628− btrfs_page_clear_uptodate(fs_info, page, start, len);
16291623 btrfs_page_clear_writeback(fs_info, page, start, len);
16301624 bio_offset += len;
16311625 }
@@ -2201,7 +2195,6 @@ void extent_write_locked_range(struct inode *inode, struct page *locked_page, · 569 unmodified lines
22012195 if (ret) {
22022196 btrfs_mark_ordered_io_finished(BTRFS_I(inode), page,
22032197 cur, cur_len, !ret);
2204− btrfs_page_clear_uptodate(fs_info, page, cur, cur_len);
22052198 mapping_set_error(page->mapping, ret);
22062199 }
22072200 btrfs_page_unlock_writer(fs_info, page, cur, cur_len);
@@ -4002,8 +3995,14 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv, · 1794 unmodified lines
40023995 char *dst = (char *)dstv;
40033996 unsigned long i = get_eb_page_index(start);
40043997
4005− if (check_eb_range(eb, start, len))
3998+ if (check_eb_range(eb, start, len)) {
3999+ /*
4000+ * Invalid range hit, reset the memory, so callers won't get
4001+ * some random garbage for their uninitialzed memory.
4002+ */
4003+ memset(dstv, 0, len);
40064004 return;
4005+ }
40074006
40084007 offset = get_eb_offset_in_page(eb, start);
40094008
fs/btrfs/file.c+34−6
@@ -1106,6 +1106,25 @@ void btrfs_check_nocow_unlock(struct btrfs_inode *inode) · 1105 unmodified lines
11061106 btrfs_drew_write_unlock(&inode->root->snapshot_lock);
11071107 }
11081108
1109+static void update_time_for_write(struct inode *inode)
1110+{
1111+ struct timespec64 now, ctime;
1112+
1113+ if (IS_NOCMTIME(inode))
1114+ return;
1115+
1116+ now = current_time(inode);
1117+ if (!timespec64_equal(&inode->i_mtime, &now))
1118+ inode->i_mtime = now;
1119+
1120+ ctime = inode_get_ctime(inode);
1121+ if (!timespec64_equal(&ctime, &now))
1122+ inode_set_ctime_to_ts(inode, now);
1123+
1124+ if (IS_I_VERSION(inode))
1125+ inode_inc_iversion(inode);
1126+}
1127+
11091128 static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from,
11101129 size_t count)
11111130 {
@@ -1137,10 +1156,7 @@ static int btrfs_write_check(struct kiocb *iocb, struct iov_iter *from, · 25 unmodified lines
11371156 * need to start yet another transaction to update the inode as we will
11381157 * update the inode when we finish writing whatever data we write.
11391158 */
1140− if (!IS_NOCMTIME(inode)) {
1141− inode->i_mtime = inode_set_ctime_current(inode);
1142− inode_inc_iversion(inode);
1143− }
1159+ update_time_for_write(inode);
11441160
11451161 start_pos = round_down(pos, fs_info->sectorsize);
11461162 oldsize = i_size_read(inode);
@@ -1451,8 +1467,13 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from) · 304 unmodified lines
14511467 if (iocb->ki_flags & IOCB_NOWAIT)
14521468 ilock_flags |= BTRFS_ILOCK_TRY;
14531469
1454− /* If the write DIO is within EOF, use a shared lock */
1455− if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode))
1470+ /*
1471+ * If the write DIO is within EOF, use a shared lock and also only if
1472+ * security bits will likely not be dropped by file_remove_privs() called
1473+ * from btrfs_write_check(). Either will need to be rechecked after the
1474+ * lock was acquired.
1475+ */
1476+ if (iocb->ki_pos + iov_iter_count(from) <= i_size_read(inode) && IS_NOSEC(inode))
14561477 ilock_flags |= BTRFS_ILOCK_SHARED;
14571478
14581479 relock:
@@ -1460,6 +1481,13 @@ relock: · 1 unmodified line
14601481 if (err < 0)
14611482 return err;
14621483
1484+ /* Shared lock cannot be used with security bits set. */
1485+ if ((ilock_flags & BTRFS_ILOCK_SHARED) && !IS_NOSEC(inode)) {
1486+ btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
1487+ ilock_flags &= ~BTRFS_ILOCK_SHARED;
1488+ goto relock;
1489+ }
1490+
14631491 err = generic_write_checks(iocb, from);
14641492 if (err <= 0) {
14651493 btrfs_inode_unlock(BTRFS_I(inode), ilock_flags);
fs/btrfs/inode.c+23−10
@@ -1085,9 +1085,6 @@ static void submit_uncompressed_range(struct btrfs_inode *inode, · 1084 unmodified lines
10851085 btrfs_mark_ordered_io_finished(inode, locked_page,
10861086 page_start, PAGE_SIZE,
10871087 !ret);
1088− btrfs_page_clear_uptodate(inode->root->fs_info,
1089− locked_page, page_start,
1090− PAGE_SIZE);
10911088 mapping_set_error(locked_page->mapping, ret);
10921089 unlock_page(locked_page);
10931090 }
@@ -2791,7 +2788,6 @@ out_page: · 1697 unmodified lines
27912788 mapping_set_error(page->mapping, ret);
27922789 btrfs_mark_ordered_io_finished(inode, page, page_start,
27932790 PAGE_SIZE, !ret);
2794− btrfs_page_clear_uptodate(fs_info, page, page_start, PAGE_SIZE);
27952791 clear_page_dirty_for_io(page);
27962792 }
27972793 btrfs_page_clear_checked(fs_info, page, page_start, PAGE_SIZE);
@@ -5769,20 +5765,24 @@ out: · 2971 unmodified lines
57695765
57705766 static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index)
57715767 {
5772− if (dir->index_cnt == (u64)-1) {
5773− int ret;
5768+ int ret = 0;
57745769
5770+ btrfs_inode_lock(dir, 0);
5771+ if (dir->index_cnt == (u64)-1) {
57755772 ret = btrfs_inode_delayed_dir_index_count(dir);
57765773 if (ret) {
57775774 ret = btrfs_set_inode_index_count(dir);
57785775 if (ret)
5779− return ret;
5776+ goto out;
57805777 }
57815778 }
57825779
5783− *index = dir->index_cnt;
5780+ /* index_cnt is the index number of next new entry, so decrement it. */
5781+ *index = dir->index_cnt - 1;
5782+out:
5783+ btrfs_inode_unlock(dir, 0);
57845784
5785− return 0;
5785+ return ret;
57865786 }
57875787
57885788 /*
@@ -5817,6 +5817,19 @@ static int btrfs_opendir(struct inode *inode, struct file *file) · 28 unmodified lines
58175817 return 0;
58185818 }
58195819
5820+static loff_t btrfs_dir_llseek(struct file *file, loff_t offset, int whence)
5821+{
5822+ struct btrfs_file_private *private = file->private_data;
5823+ int ret;
5824+
5825+ ret = btrfs_get_dir_last_index(BTRFS_I(file_inode(file)),
5826+ &private->last_index);
5827+ if (ret)
5828+ return ret;
5829+
5830+ return generic_file_llseek(file, offset, whence);
5831+}
5832+
58205833 struct dir_entry {
58215834 u64 ino;
58225835 u64 offset;
@@ -10868,7 +10881,7 @@ static const struct inode_operations btrfs_dir_inode_operations = { · 5045 unmodified lines
1086810881 };
1086910882
1087010883 static const struct file_operations btrfs_dir_file_operations = {
10871− .llseek = generic_file_llseek,
10884+ .llseek = btrfs_dir_llseek,
1087210885 .read = generic_read_dir,
1087310886 .iterate_shared = btrfs_real_readdir,
1087410887 .open = btrfs_opendir,
fs/btrfs/ioctl.c+7−1
@@ -1958,6 +1958,13 @@ static int btrfs_search_path_in_tree_user(struct mnt_idmap *idmap, · 1957 unmodified lines
19581958 goto out_put;
19591959 }
19601960
1961+ /*
1962+ * We don't need the path anymore, so release it and
1963+ * avoid deadlocks and lockdep warnings in case
1964+ * btrfs_iget() needs to lookup the inode from its root
1965+ * btree and lock the same leaf.
1966+ */
1967+ btrfs_release_path(path);
19611968 temp_inode = btrfs_iget(sb, key2.objectid, root);
19621969 if (IS_ERR(temp_inode)) {
19631970 ret = PTR_ERR(temp_inode);
@@ -1978,7 +1985,6 @@ static int btrfs_search_path_in_tree_user(struct mnt_idmap *idmap, · 14 unmodified lines
19781985 goto out_put;
19791986 }
19801987
1981− btrfs_release_path(path);
19821988 key.objectid = key.offset;
19831989 key.offset = (u64)-1;
19841990 dirid = key.objectid;
fs/btrfs/locking.h+1−1
@@ -79,7 +79,7 @@ enum btrfs_lock_nesting { · 78 unmodified lines
7979 };
8080
8181 enum btrfs_lockdep_trans_states {
82− BTRFS_LOCKDEP_TRANS_COMMIT_START,
82+ BTRFS_LOCKDEP_TRANS_COMMIT_PREP,
8383 BTRFS_LOCKDEP_TRANS_UNBLOCKED,
8484 BTRFS_LOCKDEP_TRANS_SUPER_COMMITTED,
8585 BTRFS_LOCKDEP_TRANS_COMPLETED,
fs/btrfs/ordered-data.c+1−1
@@ -639,7 +639,7 @@ void btrfs_remove_ordered_extent(struct btrfs_inode *btrfs_inode, · 638 unmodified lines
639639 refcount_inc(&trans->use_count);
640640 spin_unlock(&fs_info->trans_lock);
641641
642− ASSERT(trans);
642+ ASSERT(trans || BTRFS_FS_ERROR(fs_info));
643643 if (trans) {
644644 if (atomic_dec_and_test(&trans->pending_ordered))
645645 wake_up(&trans->pending_wait);
fs/btrfs/super.c+3−4
@@ -2117,7 +2117,7 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) · 2116 unmodified lines
21172117 * calculated f_bavail.
21182118 */
21192119 if (!mixed && block_rsv->space_info->full &&
2120− total_free_meta - thresh < block_rsv->size)
2120+ (total_free_meta < thresh || total_free_meta - thresh < block_rsv->size))
21212121 buf->f_bavail = 0;
21222122
21232123 buf->f_type = BTRFS_SUPER_MAGIC;
@@ -2150,7 +2150,7 @@ static struct file_system_type btrfs_fs_type = { · 26 unmodified lines
21502150 .name = "btrfs",
21512151 .mount = btrfs_mount,
21522152 .kill_sb = btrfs_kill_super,
2153− .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_MGTIME,
2153+ .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA,
21542154 };
21552155
21562156 static struct file_system_type btrfs_root_fs_type = {
@@ -2158,8 +2158,7 @@ static struct file_system_type btrfs_root_fs_type = { · 1 unmodified line
21582158 .name = "btrfs",
21592159 .mount = btrfs_mount_root,
21602160 .kill_sb = btrfs_kill_super,
2161− .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA |
2162− FS_ALLOW_IDMAP | FS_MGTIME,
2161+ .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | FS_ALLOW_IDMAP,
21632162 };
21642163
21652164 MODULE_ALIAS_FS("btrfs");
fs/btrfs/transaction.c+27−18
@@ -56,12 +56,17 @@ static struct kmem_cache *btrfs_trans_handle_cachep; · 55 unmodified lines
5656 * | Call btrfs_commit_transaction() on any trans handle attached to
5757 * | transaction N
5858 * V
59− * Transaction N [[TRANS_STATE_COMMIT_START]]
59+ * Transaction N [[TRANS_STATE_COMMIT_PREP]]
60+ * |
61+ * | If there are simultaneous calls to btrfs_commit_transaction() one will win
62+ * | the race and the rest will wait for the winner to commit the transaction.
63+ * |
64+ * | The winner will wait for previous running transaction to completely finish
65+ * | if there is one.
6066 * |
61− * | Will wait for previous running transaction to completely finish if there
62− * | is one
67+ * Transaction N [[TRANS_STATE_COMMIT_START]]
6368 * |
64− * | Then one of the following happes:
69+ * | Then one of the following happens:
6570 * | - Wait for all other trans handle holders to release.
6671 * | The btrfs_commit_transaction() caller will do the commit work.
6772 * | - Wait for current transaction to be committed by others.
@@ -112,6 +117,7 @@ static struct kmem_cache *btrfs_trans_handle_cachep; · 44 unmodified lines
112117 */
113118 static const unsigned int btrfs_blocked_trans_types[TRANS_STATE_MAX] = {
114119 [TRANS_STATE_RUNNING] = 0U,
120+ [TRANS_STATE_COMMIT_PREP] = 0U,
115121 [TRANS_STATE_COMMIT_START] = (__TRANS_START | __TRANS_ATTACH),
116122 [TRANS_STATE_COMMIT_DOING] = (__TRANS_START |
117123 __TRANS_ATTACH |
@@ -625,14 +631,14 @@ start_transaction(struct btrfs_root *root, unsigned int num_items, · 507 unmodified lines
625631 reloc_reserved = true;
626632 }
627633
628− ret = btrfs_block_rsv_add(fs_info, rsv, num_bytes, flush);
634+ ret = btrfs_reserve_metadata_bytes(fs_info, rsv, num_bytes, flush);
629635 if (ret)
630636 goto reserve_fail;
631637 if (delayed_refs_bytes) {
632− btrfs_migrate_to_delayed_refs_rsv(fs_info, rsv,
633− delayed_refs_bytes);
638+ btrfs_migrate_to_delayed_refs_rsv(fs_info, delayed_refs_bytes);
634639 num_bytes -= delayed_refs_bytes;
635640 }
641+ btrfs_block_rsv_add_bytes(rsv, num_bytes, true);
636642
637643 if (rsv->space_info->force_alloc)
638644 do_chunk_alloc = true;
@@ -1982,7 +1988,7 @@ void btrfs_commit_transaction_async(struct btrfs_trans_handle *trans) · 1343 unmodified lines
19821988 * Wait for the current transaction commit to start and block
19831989 * subsequent transaction joins
19841990 */
1985− btrfs_might_wait_for_state(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START);
1991+ btrfs_might_wait_for_state(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_PREP);
19861992 wait_event(fs_info->transaction_blocked_wait,
19871993 cur_trans->state >= TRANS_STATE_COMMIT_START ||
19881994 TRANS_ABORTED(cur_trans));
@@ -2129,7 +2135,7 @@ static void add_pending_snapshot(struct btrfs_trans_handle *trans) · 140 unmodified lines
21292135 return;
21302136
21312137 lockdep_assert_held(&trans->fs_info->trans_lock);
2132− ASSERT(cur_trans->state >= TRANS_STATE_COMMIT_START);
2138+ ASSERT(cur_trans->state >= TRANS_STATE_COMMIT_PREP);
21332139
21342140 list_add(&trans->pending_snapshot->list, &cur_trans->pending_snapshots);
21352141 }
@@ -2153,7 +2159,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 17 unmodified lines
21532159 ktime_t interval;
21542160
21552161 ASSERT(refcount_read(&trans->use_count) == 1);
2156− btrfs_trans_state_lockdep_acquire(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START);
2162+ btrfs_trans_state_lockdep_acquire(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_PREP);
21572163
21582164 clear_bit(BTRFS_FS_NEED_TRANS_COMMIT, &fs_info->flags);
21592165
@@ -2213,7 +2219,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 53 unmodified lines
22132219 }
22142220
22152221 spin_lock(&fs_info->trans_lock);
2216− if (cur_trans->state >= TRANS_STATE_COMMIT_START) {
2222+ if (cur_trans->state >= TRANS_STATE_COMMIT_PREP) {
22172223 enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED;
22182224
22192225 add_pending_snapshot(trans);
@@ -2225,7 +2231,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 5 unmodified lines
22252231 want_state = TRANS_STATE_SUPER_COMMITTED;
22262232
22272233 btrfs_trans_state_lockdep_release(fs_info,
2228− BTRFS_LOCKDEP_TRANS_COMMIT_START);
2234+ BTRFS_LOCKDEP_TRANS_COMMIT_PREP);
22292235 ret = btrfs_end_transaction(trans);
22302236 wait_for_commit(cur_trans, want_state);
22312237
@@ -2237,9 +2243,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 5 unmodified lines
22372243 return ret;
22382244 }
22392245
2240− cur_trans->state = TRANS_STATE_COMMIT_START;
2246+ cur_trans->state = TRANS_STATE_COMMIT_PREP;
22412247 wake_up(&fs_info->transaction_blocked_wait);
2242− btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START);
2248+ btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_PREP);
22432249
22442250 if (cur_trans->list.prev != &fs_info->trans_list) {
22452251 enum btrfs_trans_state want_state = TRANS_STATE_COMPLETED;
@@ -2260,11 +2266,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 14 unmodified lines
22602266 btrfs_put_transaction(prev_trans);
22612267 if (ret)
22622268 goto lockdep_release;
2263− } else {
2264− spin_unlock(&fs_info->trans_lock);
2269+ spin_lock(&fs_info->trans_lock);
22652270 }
22662271 } else {
2267− spin_unlock(&fs_info->trans_lock);
22682272 /*
22692273 * The previous transaction was aborted and was already removed
22702274 * from the list of transactions at fs_info->trans_list. So we
@@ -2272,11 +2276,16 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans) · 1 unmodified line
22722276 * corrupt state (pointing to trees with unwritten nodes/leafs).
22732277 */
22742278 if (BTRFS_FS_ERROR(fs_info)) {
2279+ spin_unlock(&fs_info->trans_lock);
22752280 ret = -EROFS;
22762281 goto lockdep_release;
22772282 }
22782283 }
22792284
2285+ cur_trans->state = TRANS_STATE_COMMIT_START;
2286+ wake_up(&fs_info->transaction_blocked_wait);
2287+ spin_unlock(&fs_info->trans_lock);
2288+
22802289 /*
22812290 * Get the time spent on the work done by the commit thread and not
22822291 * the time spent waiting on a previous commit
@@ -2586,7 +2595,7 @@ lockdep_release: · 303 unmodified lines
25862595 goto cleanup_transaction;
25872596
25882597 lockdep_trans_commit_start_release:
2589− btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_START);
2598+ btrfs_trans_state_lockdep_release(fs_info, BTRFS_LOCKDEP_TRANS_COMMIT_PREP);
25902599 btrfs_end_transaction(trans);
25912600 return ret;
25922601 }
fs/btrfs/transaction.h+1−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414
1515 enum btrfs_trans_state {
1616 TRANS_STATE_RUNNING,
17+ TRANS_STATE_COMMIT_PREP,
1718 TRANS_STATE_COMMIT_START,
1819 TRANS_STATE_COMMIT_DOING,
1920 TRANS_STATE_UNBLOCKED,
fs/btrfs/tree-log.c+1−1
@@ -4722,7 +4722,7 @@ static int btrfs_log_prealloc_extents(struct btrfs_trans_handle *trans, · 4721 unmodified lines
47224722 struct extent_buffer *leaf;
47234723 int slot;
47244724 int ins_nr = 0;
4725− int start_slot;
4725+ int start_slot = 0;
47264726 int ret;
47274727
47284728 if (!(inode->flags & BTRFS_INODE_PREALLOC))
fs/btrfs/verity.c+31−33
@@ -715,7 +715,7 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode, · 714 unmodified lines
715715 pgoff_t index,
716716 unsigned long num_ra_pages)
717717 {
718− struct page *page;
718+ struct folio *folio;
719719 u64 off = (u64)index << PAGE_SHIFT;
720720 loff_t merkle_pos = merkle_file_pos(inode);
721721 int ret;
@@ -726,29 +726,36 @@ static struct page *btrfs_read_merkle_tree_page(struct inode *inode, · 4 unmodified lines
726726 return ERR_PTR(-EFBIG);
727727 index += merkle_pos >> PAGE_SHIFT;
728728 again:
729− page = find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED);
730− if (page) {
731− if (PageUptodate(page))
732− return page;
729+ folio = __filemap_get_folio(inode->i_mapping, index, FGP_ACCESSED, 0);
730+ if (!IS_ERR(folio)) {
731+ if (folio_test_uptodate(folio))
732+ goto out;
733733
734− lock_page(page);
735− /*
736− * We only insert uptodate pages, so !Uptodate has to be
737− * an error
738− */
739− if (!PageUptodate(page)) {
740− unlock_page(page);
741− put_page(page);
734+ folio_lock(folio);
735+ /* If it's not uptodate after we have the lock, we got a read error. */
736+ if (!folio_test_uptodate(folio)) {
737+ folio_unlock(folio);
738+ folio_put(folio);
742739 return ERR_PTR(-EIO);
743740 }
744− unlock_page(page);
745− return page;
741+ folio_unlock(folio);
742+ goto out;
746743 }
747744
748− page = __page_cache_alloc(mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS));
749− if (!page)
745+ folio = filemap_alloc_folio(mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS),
746+ 0);
747+ if (!folio)
750748 return ERR_PTR(-ENOMEM);
751749
750+ ret = filemap_add_folio(inode->i_mapping, folio, index, GFP_NOFS);
751+ if (ret) {
752+ folio_put(folio);
753+ /* Did someone else insert a folio here? */
754+ if (ret == -EEXIST)
755+ goto again;
756+ return ERR_PTR(ret);
757+ }
758+
752759 /*
753760 * Merkle item keys are indexed from byte 0 in the merkle tree.
754761 * They have the form:
@@ -756,28 +763,19 @@ again: · 1 unmodified line
756763 * [ inode objectid, BTRFS_MERKLE_ITEM_KEY, offset in bytes ]
757764 */
758765 ret = read_key_bytes(BTRFS_I(inode), BTRFS_VERITY_MERKLE_ITEM_KEY, off,
759− page_address(page), PAGE_SIZE, page);
766+ folio_address(folio), PAGE_SIZE, &folio->page);
760767 if (ret < 0) {
761− put_page(page);
768+ folio_put(folio);
762769 return ERR_PTR(ret);
763770 }
764771 if (ret < PAGE_SIZE)
765− memzero_page(page, ret, PAGE_SIZE - ret);
772+ folio_zero_segment(folio, ret, PAGE_SIZE);
766773
767− SetPageUptodate(page);
768− ret = add_to_page_cache_lru(page, inode->i_mapping, index, GFP_NOFS);
774+ folio_mark_uptodate(folio);
775+ folio_unlock(folio);
769776
770− if (!ret) {
771− /* Inserted and ready for fsverity */
772− unlock_page(page);
773− } else {
774− put_page(page);
775− /* Did someone race us into inserting this page? */
776− if (ret == -EEXIST)
777− goto again;
778− page = ERR_PTR(ret);
779− }
780− return page;
777+out:
778+ return folio_file_page(folio, index);
781779 }
782780
783781 /*
fs/btrfs/volumes.c+6−7
@@ -1594,7 +1594,7 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, · 1593 unmodified lines
15941594 u64 search_start;
15951595 u64 hole_size;
15961596 u64 max_hole_start;
1597− u64 max_hole_size;
1597+ u64 max_hole_size = 0;
15981598 u64 extent_end;
15991599 u64 search_end = device->total_bytes;
16001600 int ret;
@@ -1602,17 +1602,16 @@ static int find_free_dev_extent(struct btrfs_device *device, u64 num_bytes, · 1 unmodified line
16021602 struct extent_buffer *l;
16031603
16041604 search_start = dev_extent_search_start(device);
1605+ max_hole_start = search_start;
16051606
16061607 WARN_ON(device->zone_info &&
16071608 !IS_ALIGNED(num_bytes, device->zone_info->zone_size));
16081609
16091610 path = btrfs_alloc_path();
1610− if (!path)
1611− return -ENOMEM;
1612−
1613− max_hole_start = search_start;
1614− max_hole_size = 0;
1615−
1611+ if (!path) {
1612+ ret = -ENOMEM;
1613+ goto out;
1614+ }
16161615 again:
16171616 if (search_start >= search_end ||
16181617 test_bit(BTRFS_DEV_STATE_REPLACE_TGT, &device->dev_state)) {
fs/buffer.c+24−12
@@ -2011,7 +2011,7 @@ void folio_zero_new_buffers(struct folio *folio, size_t from, size_t to) · 2010 unmodified lines
20112011 }
20122012 EXPORT_SYMBOL(folio_zero_new_buffers);
20132013
2014−static void
2014+static int
20152015 iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh,
20162016 const struct iomap *iomap)
20172017 {
@@ -2025,7 +2025,8 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 7 unmodified lines
20252025 * current block, then do not map the buffer and let the caller
20262026 * handle it.
20272027 */
2028− BUG_ON(offset >= iomap->offset + iomap->length);
2028+ if (offset >= iomap->offset + iomap->length)
2029+ return -EIO;
20292030
20302031 switch (iomap->type) {
20312032 case IOMAP_HOLE:
@@ -2037,7 +2038,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 5 unmodified lines
20372038 if (!buffer_uptodate(bh) ||
20382039 (offset >= i_size_read(inode)))
20392040 set_buffer_new(bh);
2040− break;
2041+ return 0;
20412042 case IOMAP_DELALLOC:
20422043 if (!buffer_uptodate(bh) ||
20432044 (offset >= i_size_read(inode)))
@@ -2045,7 +2046,7 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 1 unmodified line
20452046 set_buffer_uptodate(bh);
20462047 set_buffer_mapped(bh);
20472048 set_buffer_delay(bh);
2048− break;
2049+ return 0;
20492050 case IOMAP_UNWRITTEN:
20502051 /*
20512052 * For unwritten regions, we always need to ensure that regions
@@ -2057,12 +2058,24 @@ iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, · 5 unmodified lines
20572058 fallthrough;
20582059 case IOMAP_MAPPED:
20592060 if ((iomap->flags & IOMAP_F_NEW) ||
2060− offset >= i_size_read(inode))
2061+ offset >= i_size_read(inode)) {
2062+ /*
2063+ * This can happen if truncating the block device races
2064+ * with the check in the caller as i_size updates on
2065+ * block devices aren't synchronized by i_rwsem for
2066+ * block devices.
2067+ */
2068+ if (S_ISBLK(inode->i_mode))
2069+ return -EIO;
20612070 set_buffer_new(bh);
2071+ }
20622072 bh->b_blocknr = (iomap->addr + offset - iomap->offset) >>
20632073 inode->i_blkbits;
20642074 set_buffer_mapped(bh);
2065− break;
2075+ return 0;
2076+ default:
2077+ WARN_ON_ONCE(1);
2078+ return -EIO;
20662079 }
20672080 }
20682081
@@ -2103,13 +2116,12 @@ int __block_write_begin_int(struct folio *folio, loff_t pos, unsigned len, · 34 unmodified lines
21032116 clear_buffer_new(bh);
21042117 if (!buffer_mapped(bh)) {
21052118 WARN_ON(bh->b_size != blocksize);
2106− if (get_block) {
2119+ if (get_block)
21072120 err = get_block(inode, block, bh, 1);
2108− if (err)
2109− break;
2110− } else {
2111− iomap_to_bh(inode, block, bh, iomap);
2112− }
2121+ else
2122+ err = iomap_to_bh(inode, block, bh, iomap);
2123+ if (err)
2124+ break;
21132125
21142126 if (buffer_new(bh)) {
21152127 clean_bdev_bh_alias(bh);
fs/ceph/crypto.c+2−4
@@ -249,11 +249,9 @@ static struct inode *parse_longname(const struct inode *parent, · 248 unmodified lines
249249 if (!dir) {
250250 /* This can happen if we're not mounting cephfs on the root */
251251 dir = ceph_get_inode(parent->i_sb, vino, NULL);
252− if (!dir)
253− dir = ERR_PTR(-ENOENT);
252+ if (IS_ERR(dir))
253+ dout("Can't find inode %s (%s)\n", inode_number, name);
254254 }
255− if (IS_ERR(dir))
256− dout("Can't find inode %s (%s)\n", inode_number, name);
257255
258256 out:
259257 kfree(inode_number);
fs/efivarfs/super.c+10−4
@@ -32,10 +32,16 @@ static int efivarfs_statfs(struct dentry *dentry, struct kstatfs *buf) · 31 unmodified lines
3232 u64 storage_space, remaining_space, max_variable_size;
3333 efi_status_t status;
3434
35− status = efivar_query_variable_info(attr, &storage_space, &remaining_space,
36− &max_variable_size);
37− if (status != EFI_SUCCESS)
38− return efi_status_to_err(status);
35+ /* Some UEFI firmware does not implement QueryVariableInfo() */
36+ storage_space = remaining_space = 0;
37+ if (efi_rt_services_supported(EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO)) {
38+ status = efivar_query_variable_info(attr, &storage_space,
39+ &remaining_space,
40+ &max_variable_size);
41+ if (status != EFI_SUCCESS && status != EFI_UNSUPPORTED)
42+ pr_warn_ratelimited("query_variable_info() failed: 0x%lx\n",
43+ status);
44+ }
3945
4046 /*
4147 * This is not a normal filesystem, so no point in pretending it has a block
fs/ext4/mballoc.c+33−21
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616 #include <linux/slab.h>
1717 #include <linux/nospec.h>
1818 #include <linux/backing-dev.h>
19+#include <linux/freezer.h>
1920 #include <trace/events/ext4.h>
2021
2122 /*
@@ -6906,6 +6907,21 @@ __acquires(bitlock) · 6884 unmodified lines
69066907 return ret;
69076908 }
69086909
6910+static ext4_grpblk_t ext4_last_grp_cluster(struct super_block *sb,
6911+ ext4_group_t grp)
6912+{
6913+ if (grp < ext4_get_groups_count(sb))
6914+ return EXT4_CLUSTERS_PER_GROUP(sb) - 1;
6915+ return (ext4_blocks_count(EXT4_SB(sb)->s_es) -
6916+ ext4_group_first_block_no(sb, grp) - 1) >>
6917+ EXT4_CLUSTER_BITS(sb);
6918+}
6919+
6920+static bool ext4_trim_interrupted(void)
6921+{
6922+ return fatal_signal_pending(current) || freezing(current);
6923+}
6924+
69096925 static int ext4_try_to_trim_range(struct super_block *sb,
69106926 struct ext4_buddy *e4b, ext4_grpblk_t start,
69116927 ext4_grpblk_t max, ext4_grpblk_t minblocks)
@@ -6913,9 +6929,12 @@ __acquires(ext4_group_lock_ptr(sb, e4b->bd_group)) · 1 unmodified line
69136929 __releases(ext4_group_lock_ptr(sb, e4b->bd_group))
69146930 {
69156931 ext4_grpblk_t next, count, free_count;
6932+ bool set_trimmed = false;
69166933 void *bitmap;
69176934
69186935 bitmap = e4b->bd_bitmap;
6936+ if (start == 0 && max >= ext4_last_grp_cluster(sb, e4b->bd_group))
6937+ set_trimmed = true;
69196938 start = max(e4b->bd_info->bb_first_free, start);
69206939 count = 0;
69216940 free_count = 0;
@@ -6930,16 +6949,14 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) · 8 unmodified lines
69306949 int ret = ext4_trim_extent(sb, start, next - start, e4b);
69316950
69326951 if (ret && ret != -EOPNOTSUPP)
6933− break;
6952+ return count;
69346953 count += next - start;
69356954 }
69366955 free_count += next - start;
69376956 start = next + 1;
69386957
6939− if (fatal_signal_pending(current)) {
6940− count = -ERESTARTSYS;
6941− break;
6942− }
6958+ if (ext4_trim_interrupted())
6959+ return count;
69436960
69446961 if (need_resched()) {
69456962 ext4_unlock_group(sb, e4b->bd_group);
@@ -6951,6 +6968,9 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) · 5 unmodified lines
69516968 break;
69526969 }
69536970
6971+ if (set_trimmed)
6972+ EXT4_MB_GRP_SET_TRIMMED(e4b->bd_info);
6973+
69546974 return count;
69556975 }
69566976
@@ -6961,7 +6981,6 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) · 4 unmodified lines
69616981 * @start: first group block to examine
69626982 * @max: last group block to examine
69636983 * @minblocks: minimum extent block count
6964− * @set_trimmed: set the trimmed flag if at least one block is trimmed
69656984 *
69666985 * ext4_trim_all_free walks through group's block bitmap searching for free
69676986 * extents. When the free extent is found, mark it as used in group buddy
@@ -6971,7 +6990,7 @@ __releases(ext4_group_lock_ptr(sb, e4b->bd_group)) · 3 unmodified lines
69716990 static ext4_grpblk_t
69726991 ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
69736992 ext4_grpblk_t start, ext4_grpblk_t max,
6974− ext4_grpblk_t minblocks, bool set_trimmed)
6993+ ext4_grpblk_t minblocks)
69756994 {
69766995 struct ext4_buddy e4b;
69776996 int ret;
@@ -6988,13 +7007,10 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group, · 10 unmodified lines
69887007 ext4_lock_group(sb, group);
69897008
69907009 if (!EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) ||
6991− minblocks < EXT4_SB(sb)->s_last_trim_minblks) {
7010+ minblocks < EXT4_SB(sb)->s_last_trim_minblks)
69927011 ret = ext4_try_to_trim_range(sb, &e4b, start, max, minblocks);
6993− if (ret >= 0 && set_trimmed)
6994− EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info);
6995− } else {
7012+ else
69967013 ret = 0;
6997− }
69987014
69997015 ext4_unlock_group(sb, group);
70007016 ext4_mb_unload_buddy(&e4b);
@@ -7027,7 +7043,6 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) · 26 unmodified lines
70277043 ext4_fsblk_t first_data_blk =
70287044 le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
70297045 ext4_fsblk_t max_blks = ext4_blocks_count(EXT4_SB(sb)->s_es);
7030− bool whole_group, eof = false;
70317046 int ret = 0;
70327047
70337048 start = range->start >> sb->s_blocksize_bits;
@@ -7046,10 +7061,8 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) · 12 unmodified lines
70467061 if (minlen > EXT4_CLUSTERS_PER_GROUP(sb))
70477062 goto out;
70487063 }
7049− if (end >= max_blks - 1) {
7064+ if (end >= max_blks - 1)
70507065 end = max_blks - 1;
7051− eof = true;
7052− }
70537066 if (end <= first_data_blk)
70547067 goto out;
70557068 if (start < first_data_blk)
@@ -7063,9 +7076,10 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) · 7 unmodified lines
70637076
70647077 /* end now represents the last cluster to discard in this group */
70657078 end = EXT4_CLUSTERS_PER_GROUP(sb) - 1;
7066− whole_group = true;
70677079
70687080 for (group = first_group; group <= last_group; group++) {
7081+ if (ext4_trim_interrupted())
7082+ break;
70697083 grp = ext4_get_group_info(sb, group);
70707084 if (!grp)
70717085 continue;
@@ -7082,13 +7096,11 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) · 10 unmodified lines
70827096 * change it for the last group, note that last_cluster is
70837097 * already computed earlier by ext4_get_group_no_and_offset()
70847098 */
7085− if (group == last_group) {
7099+ if (group == last_group)
70867100 end = last_cluster;
7087− whole_group = eof ? true : end == EXT4_CLUSTERS_PER_GROUP(sb) - 1;
7088− }
70897101 if (grp->bb_free >= minlen) {
70907102 cnt = ext4_trim_all_free(sb, group, first_cluster,
7091− end, minlen, whole_group);
7103+ end, minlen);
70927104 if (cnt < 0) {
70937105 ret = cnt;
70947106 break;
fs/ext4/namei.c+15−11
@@ -343,17 +343,17 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode, · 342 unmodified lines
343343 struct buffer_head *bh)
344344 {
345345 struct ext4_dir_entry_tail *t;
346+ int blocksize = EXT4_BLOCK_SIZE(inode->i_sb);
346347
347348 #ifdef PARANOID
348349 struct ext4_dir_entry *d, *top;
349350
350351 d = (struct ext4_dir_entry *)bh->b_data;
351352 top = (struct ext4_dir_entry *)(bh->b_data +
352− (EXT4_BLOCK_SIZE(inode->i_sb) -
353− sizeof(struct ext4_dir_entry_tail)));
354− while (d < top && d->rec_len)
353+ (blocksize - sizeof(struct ext4_dir_entry_tail)));
354+ while (d < top && ext4_rec_len_from_disk(d->rec_len, blocksize))
355355 d = (struct ext4_dir_entry *)(((void *)d) +
356− le16_to_cpu(d->rec_len));
356+ ext4_rec_len_from_disk(d->rec_len, blocksize));
357357
358358 if (d != top)
359359 return NULL;
@@ -364,7 +364,8 @@ static struct ext4_dir_entry_tail *get_dirent_tail(struct inode *inode, · 4 unmodified lines
364364 #endif
365365
366366 if (t->det_reserved_zero1 ||
367− le16_to_cpu(t->det_rec_len) != sizeof(struct ext4_dir_entry_tail) ||
367+ (ext4_rec_len_from_disk(t->det_rec_len, blocksize) !=
368+ sizeof(struct ext4_dir_entry_tail)) ||
368369 t->det_reserved_zero2 ||
369370 t->det_reserved_ft != EXT4_FT_DIR_CSUM)
370371 return NULL;
@@ -445,13 +446,14 @@ static struct dx_countlimit *get_dx_countlimit(struct inode *inode, · 74 unmodified lines
445446 struct ext4_dir_entry *dp;
446447 struct dx_root_info *root;
447448 int count_offset;
449+ int blocksize = EXT4_BLOCK_SIZE(inode->i_sb);
450+ unsigned int rlen = ext4_rec_len_from_disk(dirent->rec_len, blocksize);
448451
449− if (le16_to_cpu(dirent->rec_len) == EXT4_BLOCK_SIZE(inode->i_sb))
452+ if (rlen == blocksize)
450453 count_offset = 8;
451− else if (le16_to_cpu(dirent->rec_len) == 12) {
454+ else if (rlen == 12) {
452455 dp = (struct ext4_dir_entry *)(((void *)dirent) + 12);
453− if (le16_to_cpu(dp->rec_len) !=
454− EXT4_BLOCK_SIZE(inode->i_sb) - 12)
456+ if (ext4_rec_len_from_disk(dp->rec_len, blocksize) != blocksize - 12)
455457 return NULL;
456458 root = (struct dx_root_info *)(((void *)dp + 12));
457459 if (root->reserved_zero ||
@@ -1315,6 +1317,7 @@ static int dx_make_map(struct inode *dir, struct buffer_head *bh, · 857 unmodified lines
13151317 unsigned int buflen = bh->b_size;
13161318 char *base = bh->b_data;
13171319 struct dx_hash_info h = *hinfo;
1320+ int blocksize = EXT4_BLOCK_SIZE(dir->i_sb);
13181321
13191322 if (ext4_has_metadata_csum(dir->i_sb))
13201323 buflen -= sizeof(struct ext4_dir_entry_tail);
@@ -1335,11 +1338,12 @@ static int dx_make_map(struct inode *dir, struct buffer_head *bh, · 14 unmodified lines
13351338 map_tail--;
13361339 map_tail->hash = h.hash;
13371340 map_tail->offs = ((char *) de - base)>>2;
1338− map_tail->size = le16_to_cpu(de->rec_len);
1341+ map_tail->size = ext4_rec_len_from_disk(de->rec_len,
1342+ blocksize);
13391343 count++;
13401344 cond_resched();
13411345 }
1342− de = ext4_next_entry(de, dir->i_sb->s_blocksize);
1346+ de = ext4_next_entry(de, blocksize);
13431347 }
13441348 return count;
13451349 }
fs/ext4/super.c+1−1
@@ -7314,7 +7314,7 @@ static struct file_system_type ext4_fs_type = { · 7313 unmodified lines
73147314 .init_fs_context = ext4_init_fs_context,
73157315 .parameters = ext4_param_specs,
73167316 .kill_sb = ext4_kill_sb,
7317− .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP | FS_MGTIME,
7317+ .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
73187318 };
73197319 MODULE_ALIAS_FS("ext4");
73207320
fs/fs-writeback.c+8−3
@@ -1535,10 +1535,15 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb, · 1534 unmodified lines
15351535
15361536 if (wbc->pages_skipped) {
15371537 /*
1538− * writeback is not making progress due to locked
1539− * buffers. Skip this inode for now.
1538+ * Writeback is not making progress due to locked buffers.
1539+ * Skip this inode for now. Although having skipped pages
1540+ * is odd for clean inodes, it can happen for some
1541+ * filesystems so handle that gracefully.
15401542 */
1541− redirty_tail_locked(inode, wb);
1543+ if (inode->i_state & I_DIRTY_ALL)
1544+ redirty_tail_locked(inode, wb);
1545+ else
1546+ inode_cgwb_move_to_attached(inode, wb);
15421547 return;
15431548 }
15441549
fs/gfs2/glock.c+3−1
@@ -2010,7 +2010,9 @@ static long gfs2_scan_glock_lru(int nr) · 2009 unmodified lines
20102010 if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
20112011 if (!spin_trylock(&gl->gl_lockref.lock))
20122012 continue;
2013− if (!gl->gl_lockref.count) {
2013+ if (gl->gl_lockref.count <= 1 &&
2014+ (gl->gl_state == LM_ST_UNLOCKED ||
2015+ demote_ok(gl))) {
20142016 list_move(&gl->gl_lru, &dispose);
20152017 atomic_dec(&lru_count);
20162018 freed++;
fs/gfs2/glops.c+5−4
@@ -567,15 +567,16 @@ static void freeze_go_callback(struct gfs2_glock *gl, bool remote) · 566 unmodified lines
567567 struct super_block *sb = sdp->sd_vfs;
568568
569569 if (!remote ||
570− gl->gl_state != LM_ST_SHARED ||
570+ (gl->gl_state != LM_ST_SHARED &&
571+ gl->gl_state != LM_ST_UNLOCKED) ||
571572 gl->gl_demote_state != LM_ST_UNLOCKED)
572573 return;
573574
574575 /*
575576 * Try to get an active super block reference to prevent racing with
576− * unmount (see trylock_super()). But note that unmount isn't the only
577− * place where a write lock on s_umount is taken, and we can fail here
578− * because of things like remount as well.
577+ * unmount (see super_trylock_shared()). But note that unmount isn't
578+ * the only place where a write lock on s_umount is taken, and we can
579+ * fail here because of things like remount as well.
579580 */
580581 if (down_read_trylock(&sb->s_umount)) {
581582 atomic_inc(&sb->s_active);
fs/gfs2/quota.h+2−1
@@ -50,7 +50,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip, · 49 unmodified lines
5050 ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
5151 if (ret)
5252 return ret;
53− if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
53+ if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON &&
54+ sdp->sd_args.ar_quota != GFS2_QUOTA_QUIET)
5455 return 0;
5556 ret = gfs2_quota_check(ip, ip->i_inode.i_uid, ip->i_inode.i_gid, ap);
5657 if (ret)
fs/inode.c+3−79
@@ -2102,52 +2102,10 @@ int file_remove_privs(struct file *file) · 2101 unmodified lines
21022102 }
21032103 EXPORT_SYMBOL(file_remove_privs);
21042104
2105−/**
2106− * current_mgtime - Return FS time (possibly fine-grained)
2107− * @inode: inode.
2108− *
2109− * Return the current time truncated to the time granularity supported by
2110− * the fs, as suitable for a ctime/mtime change. If the ctime is flagged
2111− * as having been QUERIED, get a fine-grained timestamp.
2112− */
2113−struct timespec64 current_mgtime(struct inode *inode)
2114−{
2115− struct timespec64 now, ctime;
2116− atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
2117− long nsec = atomic_long_read(pnsec);
2118−
2119− if (nsec & I_CTIME_QUERIED) {
2120− ktime_get_real_ts64(&now);
2121− return timestamp_truncate(now, inode);
2122− }
2123−
2124− ktime_get_coarse_real_ts64(&now);
2125− now = timestamp_truncate(now, inode);
2126−
2127− /*
2128− * If we've recently fetched a fine-grained timestamp
2129− * then the coarse-grained one may still be earlier than the
2130− * existing ctime. Just keep the existing value if so.
2131− */
2132− ctime = inode_get_ctime(inode);
2133− if (timespec64_compare(&ctime, &now) > 0)
2134− now = ctime;
2135−
2136− return now;
2137−}
2138−EXPORT_SYMBOL(current_mgtime);
2139−
2140−static struct timespec64 current_ctime(struct inode *inode)
2141−{
2142− if (is_mgtime(inode))
2143− return current_mgtime(inode);
2144− return current_time(inode);
2145−}
2146−
21472105 static int inode_needs_update_time(struct inode *inode)
21482106 {
21492107 int sync_it = 0;
2150− struct timespec64 now = current_ctime(inode);
2108+ struct timespec64 now = current_time(inode);
21512109 struct timespec64 ctime;
21522110
21532111 /* First try to exhaust all avenues to not sync */
@@ -2578,43 +2536,9 @@ EXPORT_SYMBOL(current_time); · 424 unmodified lines
25782536 */
25792537 struct timespec64 inode_set_ctime_current(struct inode *inode)
25802538 {
2581− struct timespec64 now;
2582− struct timespec64 ctime;
2583−
2584− ctime.tv_nsec = READ_ONCE(inode->__i_ctime.tv_nsec);
2585− if (!(ctime.tv_nsec & I_CTIME_QUERIED)) {
2586− now = current_time(inode);
2539+ struct timespec64 now = current_time(inode);
25872540
2588− /* Just copy it into place if it's not multigrain */
2589− if (!is_mgtime(inode)) {
2590− inode_set_ctime_to_ts(inode, now);
2591− return now;
2592− }
2593−
2594− /*
2595− * If we've recently updated with a fine-grained timestamp,
2596− * then the coarse-grained one may still be earlier than the
2597− * existing ctime. Just keep the existing value if so.
2598− */
2599− ctime.tv_sec = inode->__i_ctime.tv_sec;
2600− if (timespec64_compare(&ctime, &now) > 0)
2601− return ctime;
2602−
2603− /*
2604− * Ctime updates are usually protected by the inode_lock, but
2605− * we can still race with someone setting the QUERIED flag.
2606− * Try to swap the new nsec value into place. If it's changed
2607− * in the interim, then just go with a fine-grained timestamp.
2608− */
2609− if (cmpxchg(&inode->__i_ctime.tv_nsec, ctime.tv_nsec,
2610− now.tv_nsec) != ctime.tv_nsec)
2611− goto fine_grained;
2612− inode->__i_ctime.tv_sec = now.tv_sec;
2613− return now;
2614− }
2615−fine_grained:
2616− ktime_get_real_ts64(&now);
2617− inode_set_ctime_to_ts(inode, timestamp_truncate(now, inode));
2541+ inode_set_ctime(inode, now.tv_sec, now.tv_nsec);
26182542 return now;
26192543 }
26202544 EXPORT_SYMBOL(inode_set_ctime_current);
fs/iomap/buffered-io.c+19−13
@@ -640,11 +640,13 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, · 639 unmodified lines
640640 size_t poff, plen;
641641
642642 /*
643− * If the write completely overlaps the current folio, then
643+ * If the write or zeroing completely overlaps the current folio, then
644644 * entire folio will be dirtied so there is no need for
645645 * per-block state tracking structures to be attached to this folio.
646+ * For the unshare case, we must read in the ondisk contents because we
647+ * are not changing pagecache contents.
646648 */
647− if (pos <= folio_pos(folio) &&
649+ if (!(iter->flags & IOMAP_UNSHARE) && pos <= folio_pos(folio) &&
648650 pos + len >= folio_pos(folio) + folio_size(folio))
649651 return 0;
650652
@@ -1047,7 +1049,7 @@ static int iomap_write_delalloc_punch(struct inode *inode, struct folio *folio, · 396 unmodified lines
10471049
10481050 /*
10491051 * Scan the data range passed to us for dirty page cache folios. If we find a
1050− * dirty folio, punch out the preceeding range and update the offset from which
1052+ * dirty folio, punch out the preceding range and update the offset from which
10511053 * the next punch will start from.
10521054 *
10531055 * We can punch out storage reservations under clean pages because they either
@@ -1261,7 +1263,6 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter) · 207 unmodified lines
12611263 const struct iomap *srcmap = iomap_iter_srcmap(iter);
12621264 loff_t pos = iter->pos;
12631265 loff_t length = iomap_length(iter);
1264− long status = 0;
12651266 loff_t written = 0;
12661267
12671268 /* don't bother with blocks that are not shared to start with */
@@ -1272,28 +1273,33 @@ static loff_t iomap_unshare_iter(struct iomap_iter *iter) · 4 unmodified lines
12721273 return length;
12731274
12741275 do {
1275− unsigned long offset = offset_in_page(pos);
1276− unsigned long bytes = min_t(loff_t, PAGE_SIZE - offset, length);
12771276 struct folio *folio;
1277+ int status;
1278+ size_t offset;
1279+ size_t bytes = min_t(u64, SIZE_MAX, length);
12781280
12791281 status = iomap_write_begin(iter, pos, bytes, &folio);
12801282 if (unlikely(status))
12811283 return status;
1282− if (iter->iomap.flags & IOMAP_F_STALE)
1284+ if (iomap->flags & IOMAP_F_STALE)
12831285 break;
12841286
1285− status = iomap_write_end(iter, pos, bytes, bytes, folio);
1286− if (WARN_ON_ONCE(status == 0))
1287+ offset = offset_in_folio(folio, pos);
1288+ if (bytes > folio_size(folio) - offset)
1289+ bytes = folio_size(folio) - offset;
1290+
1291+ bytes = iomap_write_end(iter, pos, bytes, bytes, folio);
1292+ if (WARN_ON_ONCE(bytes == 0))
12871293 return -EIO;
12881294
12891295 cond_resched();
12901296
1291− pos += status;
1292− written += status;
1293− length -= status;
1297+ pos += bytes;
1298+ written += bytes;
1299+ length -= bytes;
12941300
12951301 balance_dirty_pages_ratelimited(iter->inode->i_mapping);
1296− } while (length);
1302+ } while (length > 0);
12971303
12981304 return written;
12991305 }
fs/jbd2/commit.c+6−10
@@ -298,14 +298,12 @@ static int journal_finish_inode_data_buffers(journal_t *journal, · 297 unmodified lines
298298
299299 static __u32 jbd2_checksum_data(__u32 crc32_sum, struct buffer_head *bh)
300300 {
301− struct page *page = bh->b_page;
302301 char *addr;
303302 __u32 checksum;
304303
305− addr = kmap_atomic(page);
306− checksum = crc32_be(crc32_sum,
307− (void *)(addr + offset_in_page(bh->b_data)), bh->b_size);
308− kunmap_atomic(addr);
304+ addr = kmap_local_folio(bh->b_folio, bh_offset(bh));
305+ checksum = crc32_be(crc32_sum, addr, bh->b_size);
306+ kunmap_local(addr);
309307
310308 return checksum;
311309 }
@@ -322,7 +320,6 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, · 10 unmodified lines
322320 struct buffer_head *bh, __u32 sequence)
323321 {
324322 journal_block_tag3_t *tag3 = (journal_block_tag3_t *)tag;
325− struct page *page = bh->b_page;
326323 __u8 *addr;
327324 __u32 csum32;
328325 __be32 seq;
@@ -331,11 +328,10 @@ static void jbd2_block_tag_csum_set(journal_t *j, journal_block_tag_t *tag, · 2 unmodified lines
331328 return;
332329
333330 seq = cpu_to_be32(sequence);
334− addr = kmap_atomic(page);
331+ addr = kmap_local_folio(bh->b_folio, bh_offset(bh));
335332 csum32 = jbd2_chksum(j, j->j_csum_seed, (__u8 *)&seq, sizeof(seq));
336− csum32 = jbd2_chksum(j, csum32, addr + offset_in_page(bh->b_data),
337− bh->b_size);
338− kunmap_atomic(addr);
333+ csum32 = jbd2_chksum(j, csum32, addr, bh->b_size);
334+ kunmap_local(addr);
339335
340336 if (jbd2_has_feature_csum3(j))
341337 tag3->t_checksum = cpu_to_be32(csum32);
fs/jbd2/journal.c+2−0
@@ -1601,6 +1601,8 @@ static journal_t *journal_init_common(struct block_device *bdev, · 1600 unmodified lines
16011601
16021602 err_cleanup:
16031603 percpu_counter_destroy(&journal->j_checkpoint_jh_count);
1604+ if (journal->j_chksum_driver)
1605+ crypto_free_shash(journal->j_chksum_driver);
16041606 kfree(journal->j_wbuf);
16051607 jbd2_journal_destroy_revoke(journal);
16061608 journal_fail_superblock(journal);
fs/jbd2/transaction.c+4−8
@@ -935,19 +935,15 @@ static void warn_dirty_buffer(struct buffer_head *bh) · 934 unmodified lines
935935 /* Call t_frozen trigger and copy buffer data into jh->b_frozen_data. */
936936 static void jbd2_freeze_jh_data(struct journal_head *jh)
937937 {
938− struct page *page;
939− int offset;
940938 char *source;
941939 struct buffer_head *bh = jh2bh(jh);
942940
943941 J_EXPECT_JH(jh, buffer_uptodate(bh), "Possible IO failure.\n");
944− page = bh->b_page;
945− offset = offset_in_page(bh->b_data);
946− source = kmap_atomic(page);
942+ source = kmap_local_folio(bh->b_folio, bh_offset(bh));
947943 /* Fire data frozen trigger just before we copy the data */
948− jbd2_buffer_frozen_trigger(jh, source + offset, jh->b_triggers);
949− memcpy(jh->b_frozen_data, source + offset, bh->b_size);
950− kunmap_atomic(source);
944+ jbd2_buffer_frozen_trigger(jh, source, jh->b_triggers);
945+ memcpy(jh->b_frozen_data, source, bh->b_size);
946+ kunmap_local(source);
951947
952948 /*
953949 * Now that the frozen data is saved off, we need to store any matching
fs/libfs.c+1−0
@@ -1903,6 +1903,7 @@ ssize_t direct_write_fallback(struct kiocb *iocb, struct iov_iter *iter, · 1902 unmodified lines
19031903 * We don't know how much we wrote, so just return the number of
19041904 * bytes which were direct-written
19051905 */
1906+ iocb->ki_pos -= buffered_written;
19061907 if (direct_written)
19071908 return direct_written;
19081909 return err;
fs/netfs/buffered_read.c+5−1
@@ -47,12 +47,14 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq) · 46 unmodified lines
4747 xas_for_each(&xas, folio, last_page) {
4848 loff_t pg_end;
4949 bool pg_failed = false;
50+ bool folio_started;
5051
5152 if (xas_retry(&xas, folio))
5253 continue;
5354
5455 pg_end = folio_pos(folio) + folio_size(folio) - 1;
5556
57+ folio_started = false;
5658 for (;;) {
5759 loff_t sreq_end;
5860
@@ -60,8 +62,10 @@ void netfs_rreq_unlock_folios(struct netfs_io_request *rreq) · 1 unmodified line
6062 pg_failed = true;
6163 break;
6264 }
63− if (test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags))
65+ if (!folio_started && test_bit(NETFS_SREQ_COPY_TO_CACHE, &subreq->flags)) {
6466 folio_start_fscache(folio);
67+ folio_started = true;
68+ }
6569 pg_failed |= subreq_failed;
6670 sreq_end = subreq->start + subreq->len - 1;
6771 if (pg_end < sreq_end)
fs/nfs/direct.c+93−41
@@ -93,12 +93,10 @@ nfs_direct_handle_truncated(struct nfs_direct_req *dreq, · 92 unmodified lines
9393 dreq->max_count = dreq_len;
9494 if (dreq->count > dreq_len)
9595 dreq->count = dreq_len;
96−
97− if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
98− dreq->error = hdr->error;
99− else /* Clear outstanding error if this is EOF */
100− dreq->error = 0;
10196 }
97+
98+ if (test_bit(NFS_IOHDR_ERROR, &hdr->flags) && !dreq->error)
99+ dreq->error = hdr->error;
102100 }
103101
104102 static void
@@ -120,6 +118,18 @@ nfs_direct_count_bytes(struct nfs_direct_req *dreq, · 15 unmodified lines
120118 dreq->count = dreq_len;
121119 }
122120
121+static void nfs_direct_truncate_request(struct nfs_direct_req *dreq,
122+ struct nfs_page *req)
123+{
124+ loff_t offs = req_offset(req);
125+ size_t req_start = (size_t)(offs - dreq->io_start);
126+
127+ if (req_start < dreq->max_count)
128+ dreq->max_count = req_start;
129+ if (req_start < dreq->count)
130+ dreq->count = req_start;
131+}
132+
123133 /**
124134 * nfs_swap_rw - NFS address space operation for swap I/O
125135 * @iocb: target I/O control block
@@ -488,7 +498,9 @@ static void nfs_direct_add_page_head(struct list_head *list, · 362 unmodified lines
488498 kref_get(&head->wb_kref);
489499 }
490500
491−static void nfs_direct_join_group(struct list_head *list, struct inode *inode)
501+static void nfs_direct_join_group(struct list_head *list,
502+ struct nfs_commit_info *cinfo,
503+ struct inode *inode)
492504 {
493505 struct nfs_page *req, *subreq;
494506
@@ -510,7 +522,7 @@ static void nfs_direct_join_group(struct list_head *list, struct inode *inode) · 15 unmodified lines
510522 nfs_release_request(subreq);
511523 }
512524 } while ((subreq = subreq->wb_this_page) != req);
513− nfs_join_page_group(req, inode);
525+ nfs_join_page_group(req, cinfo, inode);
514526 }
515527 }
516528
@@ -528,20 +540,15 @@ nfs_direct_write_scan_commit_list(struct inode *inode, · 11 unmodified lines
528540 static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq)
529541 {
530542 struct nfs_pageio_descriptor desc;
531− struct nfs_page *req, *tmp;
543+ struct nfs_page *req;
532544 LIST_HEAD(reqs);
533545 struct nfs_commit_info cinfo;
534− LIST_HEAD(failed);
535546
536547 nfs_init_cinfo_from_dreq(&cinfo, dreq);
537548 nfs_direct_write_scan_commit_list(dreq->inode, &reqs, &cinfo);
538549
539− nfs_direct_join_group(&reqs, dreq->inode);
550+ nfs_direct_join_group(&reqs, &cinfo, dreq->inode);
540551
541− dreq->count = 0;
542− dreq->max_count = 0;
543− list_for_each_entry(req, &reqs, wb_list)
544− dreq->max_count += req->wb_bytes;
545552 nfs_clear_pnfs_ds_commit_verifiers(&dreq->ds_cinfo);
546553 get_dreq(dreq);
547554
@@ -549,27 +556,40 @@ static void nfs_direct_write_reschedule(struct nfs_direct_req *dreq) · 1 unmodified line
549556 &nfs_direct_write_completion_ops);
550557 desc.pg_dreq = dreq;
551558
552− list_for_each_entry_safe(req, tmp, &reqs, wb_list) {
559+ while (!list_empty(&reqs)) {
560+ req = nfs_list_entry(reqs.next);
553561 /* Bump the transmission count */
554562 req->wb_nio++;
555563 if (!nfs_pageio_add_request(&desc, req)) {
556− nfs_list_move_request(req, &failed);
557− spin_lock(&cinfo.inode->i_lock);
558− dreq->flags = 0;
559− if (desc.pg_error < 0)
564+ spin_lock(&dreq->lock);
565+ if (dreq->error < 0) {
566+ desc.pg_error = dreq->error;
567+ } else if (desc.pg_error != -EAGAIN) {
568+ dreq->flags = 0;
569+ if (!desc.pg_error)
570+ desc.pg_error = -EIO;
560571 dreq->error = desc.pg_error;
561− else
562− dreq->error = -EIO;
563− spin_unlock(&cinfo.inode->i_lock);
572+ } else
573+ dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
574+ spin_unlock(&dreq->lock);
575+ break;
564576 }
565577 nfs_release_request(req);
566578 }
567579 nfs_pageio_complete(&desc);
568580
569− while (!list_empty(&failed)) {
570− req = nfs_list_entry(failed.next);
581+ while (!list_empty(&reqs)) {
582+ req = nfs_list_entry(reqs.next);
571583 nfs_list_remove_request(req);
572584 nfs_unlock_and_release_request(req);
585+ if (desc.pg_error == -EAGAIN) {
586+ nfs_mark_request_commit(req, NULL, &cinfo, 0);
587+ } else {
588+ spin_lock(&dreq->lock);
589+ nfs_direct_truncate_request(dreq, req);
590+ spin_unlock(&dreq->lock);
591+ nfs_release_request(req);
592+ }
573593 }
574594
575595 if (put_dreq(dreq))
@@ -589,8 +609,6 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data) · 13 unmodified lines
589609 if (status < 0) {
590610 /* Errors in commit are fatal */
591611 dreq->error = status;
592− dreq->max_count = 0;
593− dreq->count = 0;
594612 dreq->flags = NFS_ODIRECT_DONE;
595613 } else {
596614 status = dreq->error;
@@ -601,7 +619,12 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data) · 4 unmodified lines
601619 while (!list_empty(&data->pages)) {
602620 req = nfs_list_entry(data->pages.next);
603621 nfs_list_remove_request(req);
604− if (status >= 0 && !nfs_write_match_verf(verf, req)) {
622+ if (status < 0) {
623+ spin_lock(&dreq->lock);
624+ nfs_direct_truncate_request(dreq, req);
625+ spin_unlock(&dreq->lock);
626+ nfs_release_request(req);
627+ } else if (!nfs_write_match_verf(verf, req)) {
605628 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
606629 /*
607630 * Despite the reboot, the write was successful,
@@ -609,7 +632,7 @@ static void nfs_direct_commit_complete(struct nfs_commit_data *data) · 1 unmodified line
609632 */
610633 req->wb_nio = 0;
611634 nfs_mark_request_commit(req, NULL, &cinfo, 0);
612− } else /* Error or match */
635+ } else
613636 nfs_release_request(req);
614637 nfs_unlock_and_release_request(req);
615638 }
@@ -662,6 +685,7 @@ static void nfs_direct_write_clear_reqs(struct nfs_direct_req *dreq) · 46 unmodified lines
662685 while (!list_empty(&reqs)) {
663686 req = nfs_list_entry(reqs.next);
664687 nfs_list_remove_request(req);
688+ nfs_direct_truncate_request(dreq, req);
665689 nfs_release_request(req);
666690 nfs_unlock_and_release_request(req);
667691 }
@@ -711,7 +735,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr) · 43 unmodified lines
711735 }
712736
713737 nfs_direct_count_bytes(dreq, hdr);
714− if (test_bit(NFS_IOHDR_UNSTABLE_WRITES, &hdr->flags)) {
738+ if (test_bit(NFS_IOHDR_UNSTABLE_WRITES, &hdr->flags) &&
739+ !test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
715740 if (!dreq->flags)
716741 dreq->flags = NFS_ODIRECT_DO_COMMIT;
717742 flags = dreq->flags;
@@ -755,18 +780,23 @@ static void nfs_write_sync_pgio_error(struct list_head *head, int error) · 37 unmodified lines
755780 static void nfs_direct_write_reschedule_io(struct nfs_pgio_header *hdr)
756781 {
757782 struct nfs_direct_req *dreq = hdr->dreq;
783+ struct nfs_page *req;
784+ struct nfs_commit_info cinfo;
758785
759786 trace_nfs_direct_write_reschedule_io(dreq);
760787
788+ nfs_init_cinfo_from_dreq(&cinfo, dreq);
761789 spin_lock(&dreq->lock);
762− if (dreq->error == 0) {
790+ if (dreq->error == 0)
763791 dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
764− /* fake unstable write to let common nfs resend pages */
765− hdr->verf.committed = NFS_UNSTABLE;
766− hdr->good_bytes = hdr->args.offset + hdr->args.count -
767− hdr->io_start;
768− }
792+ set_bit(NFS_IOHDR_REDO, &hdr->flags);
769793 spin_unlock(&dreq->lock);
794+ while (!list_empty(&hdr->pages)) {
795+ req = nfs_list_entry(hdr->pages.next);
796+ nfs_list_remove_request(req);
797+ nfs_unlock_request(req);
798+ nfs_mark_request_commit(req, NULL, &cinfo, 0);
799+ }
770800 }
771801
772802 static const struct nfs_pgio_completion_ops nfs_direct_write_completion_ops = {
@@ -794,9 +824,11 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, · 21 unmodified lines
794824 {
795825 struct nfs_pageio_descriptor desc;
796826 struct inode *inode = dreq->inode;
827+ struct nfs_commit_info cinfo;
797828 ssize_t result = 0;
798829 size_t requested_bytes = 0;
799830 size_t wsize = max_t(size_t, NFS_SERVER(inode)->wsize, PAGE_SIZE);
831+ bool defer = false;
800832
801833 trace_nfs_direct_write_schedule_iovec(dreq);
802834
@@ -837,17 +869,37 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, · 34 unmodified lines
837869 break;
838870 }
839871
840− nfs_lock_request(req);
841− if (!nfs_pageio_add_request(&desc, req)) {
842− result = desc.pg_error;
843− nfs_unlock_and_release_request(req);
844− break;
845− }
846872 pgbase = 0;
847873 bytes -= req_len;
848874 requested_bytes += req_len;
849875 pos += req_len;
850876 dreq->bytes_left -= req_len;
877+
878+ if (defer) {
879+ nfs_mark_request_commit(req, NULL, &cinfo, 0);
880+ continue;
881+ }
882+
883+ nfs_lock_request(req);
884+ if (nfs_pageio_add_request(&desc, req))
885+ continue;
886+
887+ /* Exit on hard errors */
888+ if (desc.pg_error < 0 && desc.pg_error != -EAGAIN) {
889+ result = desc.pg_error;
890+ nfs_unlock_and_release_request(req);
891+ break;
892+ }
893+
894+ /* If the error is soft, defer remaining requests */
895+ nfs_init_cinfo_from_dreq(&cinfo, dreq);
896+ spin_lock(&dreq->lock);
897+ dreq->flags = NFS_ODIRECT_RESCHED_WRITES;
898+ spin_unlock(&dreq->lock);
899+ nfs_unlock_request(req);
900+ nfs_mark_request_commit(req, NULL, &cinfo, 0);
901+ desc.pg_error = 0;
902+ defer = true;
851903 }
852904 nfs_direct_release_pages(pagevec, npages);
853905 kvfree(pagevec);
fs/nfs/flexfilelayout/flexfilelayout.c+1−0
@@ -1235,6 +1235,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, · 1234 unmodified lines
12351235 case -EPFNOSUPPORT:
12361236 case -EPROTONOSUPPORT:
12371237 case -EOPNOTSUPP:
1238+ case -EINVAL:
12381239 case -ECONNREFUSED:
12391240 case -ECONNRESET:
12401241 case -EHOSTDOWN:
fs/nfs/nfs4client.c+5−1
@@ -417,6 +417,8 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old) · 416 unmodified lines
417417 .net = old->cl_net,
418418 .servername = old->cl_hostname,
419419 };
420+ int max_connect = test_bit(NFS_CS_PNFS, &clp->cl_flags) ?
421+ clp->cl_max_connect : old->cl_max_connect;
420422
421423 if (clp->cl_proto != old->cl_proto)
422424 return;
@@ -430,7 +432,7 @@ static void nfs4_add_trunk(struct nfs_client *clp, struct nfs_client *old) · 7 unmodified lines
430432 xprt_args.addrlen = clp_salen;
431433
432434 rpc_clnt_add_xprt(old->cl_rpcclient, &xprt_args,
433− rpc_clnt_test_and_add_xprt, NULL);
435+ rpc_clnt_test_and_add_xprt, &max_connect);
434436 }
435437
436438 /**
@@ -1010,6 +1012,8 @@ struct nfs_client *nfs4_set_ds_client(struct nfs_server *mds_srv, · 573 unmodified lines
10101012 __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags);
10111013
10121014 __set_bit(NFS_CS_DS, &cl_init.init_flags);
1015+ __set_bit(NFS_CS_PNFS, &cl_init.init_flags);
1016+ cl_init.max_connect = NFS_MAX_TRANSPORTS;
10131017 /*
10141018 * Set an authflavor equual to the MDS value. Use the MDS nfs_client
10151019 * cl_ipaddr so as to use the same EXCHANGE_ID co_ownerid as the MDS
fs/nfs/nfs4proc.c+5−1
@@ -2703,8 +2703,12 @@ static int _nfs4_proc_open(struct nfs4_opendata *data, · 2702 unmodified lines
27032703 return status;
27042704 }
27052705 if (!(o_res->f_attr->valid & NFS_ATTR_FATTR)) {
2706+ struct nfs_fh *fh = &o_res->fh;
2707+
27062708 nfs4_sequence_free_slot(&o_res->seq_res);
2707− nfs4_proc_getattr(server, &o_res->fh, o_res->f_attr, NULL);
2709+ if (o_arg->claim == NFS4_OPEN_CLAIM_FH)
2710+ fh = NFS_FH(d_inode(data->dentry));
2711+ nfs4_proc_getattr(server, fh, o_res->f_attr, NULL);
27082712 }
27092713 return 0;
27102714 }
fs/nfs/write.c+12−11
@@ -59,7 +59,8 @@ static const struct nfs_pgio_completion_ops nfs_async_write_completion_ops; · 58 unmodified lines
5959 static const struct nfs_commit_completion_ops nfs_commit_completion_ops;
6060 static const struct nfs_rw_ops nfs_rw_write_ops;
6161 static void nfs_inode_remove_request(struct nfs_page *req);
62−static void nfs_clear_request_commit(struct nfs_page *req);
62+static void nfs_clear_request_commit(struct nfs_commit_info *cinfo,
63+ struct nfs_page *req);
6364 static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo,
6465 struct inode *inode);
6566 static struct nfs_page *
@@ -502,8 +503,8 @@ nfs_destroy_unlinked_subrequests(struct nfs_page *destroy_list, · 436 unmodified lines
502503 * the (former) group. All subrequests are removed from any write or commit
503504 * lists, unlinked from the group and destroyed.
504505 */
505−void
506−nfs_join_page_group(struct nfs_page *head, struct inode *inode)
506+void nfs_join_page_group(struct nfs_page *head, struct nfs_commit_info *cinfo,
507+ struct inode *inode)
507508 {
508509 struct nfs_page *subreq;
509510 struct nfs_page *destroy_list = NULL;
@@ -533,7 +534,7 @@ nfs_join_page_group(struct nfs_page *head, struct inode *inode) · 23 unmodified lines
533534 * Commit list removal accounting is done after locks are dropped */
534535 subreq = head;
535536 do {
536− nfs_clear_request_commit(subreq);
537+ nfs_clear_request_commit(cinfo, subreq);
537538 subreq = subreq->wb_this_page;
538539 } while (subreq != head);
539540
@@ -566,8 +567,10 @@ static struct nfs_page *nfs_lock_and_join_requests(struct folio *folio) · 26 unmodified lines
566567 {
567568 struct inode *inode = folio_file_mapping(folio)->host;
568569 struct nfs_page *head;
570+ struct nfs_commit_info cinfo;
569571 int ret;
570572
573+ nfs_init_cinfo_from_inode(&cinfo, inode);
571574 /*
572575 * A reference is taken only on the head request which acts as a
573576 * reference to the whole page group - the group will not be destroyed
@@ -584,7 +587,7 @@ static struct nfs_page *nfs_lock_and_join_requests(struct folio *folio) · 10 unmodified lines
584587 return ERR_PTR(ret);
585588 }
586589
587− nfs_join_page_group(head, inode);
590+ nfs_join_page_group(head, &cinfo, inode);
588591
589592 return head;
590593 }
@@ -955,18 +958,16 @@ static void nfs_folio_clear_commit(struct folio *folio) · 364 unmodified lines
955958 }
956959
957960 /* Called holding the request lock on @req */
958−static void
959−nfs_clear_request_commit(struct nfs_page *req)
961+static void nfs_clear_request_commit(struct nfs_commit_info *cinfo,
962+ struct nfs_page *req)
960963 {
961964 if (test_bit(PG_CLEAN, &req->wb_flags)) {
962965 struct nfs_open_context *ctx = nfs_req_openctx(req);
963966 struct inode *inode = d_inode(ctx->dentry);
964− struct nfs_commit_info cinfo;
965967
966− nfs_init_cinfo_from_inode(&cinfo, inode);
967968 mutex_lock(&NFS_I(inode)->commit_mutex);
968− if (!pnfs_clear_request_commit(req, &cinfo)) {
969− nfs_request_remove_commit_list(req, &cinfo);
969+ if (!pnfs_clear_request_commit(req, cinfo)) {
970+ nfs_request_remove_commit_list(req, cinfo);
970971 }
971972 mutex_unlock(&NFS_I(inode)->commit_mutex);
972973 nfs_folio_clear_commit(nfs_page_to_folio(req));
fs/nfsd/nfs4proc.c+2−2
@@ -1058,8 +1058,8 @@ nfsd4_rename(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, · 1057 unmodified lines
10581058 rename->rn_tname, rename->rn_tnamelen);
10591059 if (status)
10601060 return status;
1061− set_change_info(&rename->rn_sinfo, &cstate->current_fh);
1062− set_change_info(&rename->rn_tinfo, &cstate->save_fh);
1061+ set_change_info(&rename->rn_sinfo, &cstate->save_fh);
1062+ set_change_info(&rename->rn_tinfo, &cstate->current_fh);
10631063 return nfs_ok;
10641064 }
10651065
fs/nfsd/nfs4xdr.c+2−2
@@ -4113,6 +4113,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, · 4112 unmodified lines
41134113 struct file *file, unsigned long maxcount)
41144114 {
41154115 struct xdr_stream *xdr = resp->xdr;
4116+ unsigned int base = xdr->buf->page_len & ~PAGE_MASK;
41164117 unsigned int starting_len = xdr->buf->len;
41174118 __be32 zero = xdr_zero;
41184119 __be32 nfserr;
@@ -4121,8 +4122,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, · 2 unmodified lines
41214122 return nfserr_resource;
41224123
41234124 nfserr = nfsd_iter_read(resp->rqstp, read->rd_fhp, file,
4124− read->rd_offset, &maxcount,
4125− xdr->buf->page_len & ~PAGE_MASK,
4125+ read->rd_offset, &maxcount, base,
41264126 &read->rd_eof);
41274127 read->rd_length = maxcount;
41284128 if (nfserr)
fs/nfsd/nfssvc.c+3−2
@@ -1082,11 +1082,12 @@ int nfsd_pool_stats_open(struct inode *inode, struct file *file) · 1081 unmodified lines
10821082
10831083 int nfsd_pool_stats_release(struct inode *inode, struct file *file)
10841084 {
1085+ struct seq_file *seq = file->private_data;
1086+ struct svc_serv *serv = seq->private;
10851087 int ret = seq_release(inode, file);
1086− struct net *net = inode->i_sb->s_fs_info;
10871088
10881089 mutex_lock(&nfsd_mutex);
1089− nfsd_put(net);
1090+ svc_put(serv);
10901091 mutex_unlock(&nfsd_mutex);
10911092 return ret;
10921093 }
fs/nilfs2/gcinode.c+3−3
@@ -73,10 +73,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff, · 72 unmodified lines
7373 struct the_nilfs *nilfs = inode->i_sb->s_fs_info;
7474
7575 err = nilfs_dat_translate(nilfs->ns_dat, vbn, &pbn);
76− if (unlikely(err)) { /* -EIO, -ENOMEM, -ENOENT */
77− brelse(bh);
76+ if (unlikely(err)) /* -EIO, -ENOMEM, -ENOENT */
7877 goto failed;
79− }
8078 }
8179
8280 lock_buffer(bh);
@@ -102,6 +100,8 @@ int nilfs_gccache_submit_read_data(struct inode *inode, sector_t blkoff, · 19 unmodified lines
102100 failed:
103101 unlock_page(bh->b_page);
104102 put_page(bh->b_page);
103+ if (unlikely(err))
104+ brelse(bh);
105105 return err;
106106 }
107107
fs/ntfs3/super.c+1−0
@@ -1562,6 +1562,7 @@ load_root: · 1561 unmodified lines
15621562 put_inode_out:
15631563 iput(inode);
15641564 out:
1565+ ntfs3_put_sbi(sbi);
15651566 kfree(boot2);
15661567 return err;
15671568 }
fs/overlayfs/copy_up.c+3−2
@@ -337,7 +337,7 @@ static int ovl_set_timestamps(struct ovl_fs *ofs, struct dentry *upperdentry, · 336 unmodified lines
337337 {
338338 struct iattr attr = {
339339 .ia_valid =
340− ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET,
340+ ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET | ATTR_CTIME,
341341 .ia_atime = stat->atime,
342342 .ia_mtime = stat->mtime,
343343 };
@@ -618,7 +618,8 @@ static int ovl_copy_up_metadata(struct ovl_copy_up_ctx *c, struct dentry *temp) · 274 unmodified lines
618618 if (err)
619619 return err;
620620
621− if (inode->i_flags & OVL_COPY_I_FLAGS_MASK) {
621+ if (inode->i_flags & OVL_COPY_I_FLAGS_MASK &&
622+ (S_ISREG(c->stat.mode) || S_ISDIR(c->stat.mode))) {
622623 /*
623624 * Copy the fileattr inode flags that are the source of already
624625 * copied i_flags
fs/overlayfs/file.c+9−6
@@ -19,7 +19,6 @@ struct ovl_aio_req { · 18 unmodified lines
1919 struct kiocb iocb;
2020 refcount_t ref;
2121 struct kiocb *orig_iocb;
22− struct fd fd;
2322 };
2423
2524 static struct kmem_cache *ovl_aio_request_cachep;
@@ -280,7 +279,7 @@ static rwf_t ovl_iocb_to_rwf(int ifl) · 254 unmodified lines
280279 static inline void ovl_aio_put(struct ovl_aio_req *aio_req)
281280 {
282281 if (refcount_dec_and_test(&aio_req->ref)) {
283− fdput(aio_req->fd);
282+ fput(aio_req->iocb.ki_filp);
284283 kmem_cache_free(ovl_aio_request_cachep, aio_req);
285284 }
286285 }
@@ -342,10 +341,9 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) · 55 unmodified lines
342341 if (!aio_req)
343342 goto out;
344343
345− aio_req->fd = real;
346344 real.flags = 0;
347345 aio_req->orig_iocb = iocb;
348− kiocb_clone(&aio_req->iocb, iocb, real.file);
346+ kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
349347 aio_req->iocb.ki_complete = ovl_aio_rw_complete;
350348 refcount_set(&aio_req->ref, 2);
351349 ret = vfs_iocb_iter_read(real.file, &aio_req->iocb, iter);
@@ -393,6 +391,12 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 41 unmodified lines
393391 if (!ovl_should_sync(OVL_FS(inode->i_sb)))
394392 ifl &= ~(IOCB_DSYNC | IOCB_SYNC);
395393
394+ /*
395+ * Overlayfs doesn't support deferred completions, don't copy
396+ * this property in case it is set by the issuer.
397+ */
398+ ifl &= ~IOCB_DIO_CALLER_COMP;
399+
396400 old_cred = ovl_override_creds(file_inode(file)->i_sb);
397401 if (is_sync_kiocb(iocb)) {
398402 file_start_write(real.file);
@@ -409,10 +413,9 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) · 10 unmodified lines
409413 if (!aio_req)
410414 goto out;
411415
412− aio_req->fd = real;
413416 real.flags = 0;
414417 aio_req->orig_iocb = iocb;
415− kiocb_clone(&aio_req->iocb, iocb, real.file);
418+ kiocb_clone(&aio_req->iocb, iocb, get_file(real.file));
416419 aio_req->iocb.ki_flags = ifl;
417420 aio_req->iocb.ki_complete = ovl_aio_rw_complete;
418421 refcount_set(&aio_req->ref, 2);
fs/pipe.c+0−1
@@ -537,7 +537,6 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) · 536 unmodified lines
537537 break;
538538 }
539539 ret += copied;
540− buf->offset = 0;
541540 buf->len = copied;
542541
543542 if (!iov_iter_count(from))
fs/proc/internal.h+0−2
@@ -289,9 +289,7 @@ struct proc_maps_private { · 288 unmodified lines
289289 struct inode *inode;
290290 struct task_struct *task;
291291 struct mm_struct *mm;
292−#ifdef CONFIG_MMU
293292 struct vma_iterator iter;
294−#endif
295293 #ifdef CONFIG_NUMA
296294 struct mempolicy *task_mempolicy;
297295 #endif
fs/proc/task_nommu.c+37−27
@@ -175,15 +175,28 @@ static int show_map(struct seq_file *m, void *_p) · 174 unmodified lines
175175 return nommu_vma_show(m, _p);
176176 }
177177
178−static void *m_start(struct seq_file *m, loff_t *pos)
178+static struct vm_area_struct *proc_get_vma(struct proc_maps_private *priv,
179+ loff_t *ppos)
180+{
181+ struct vm_area_struct *vma = vma_next(&priv->iter);
182+
183+ if (vma) {
184+ *ppos = vma->vm_start;
185+ } else {
186+ *ppos = -1UL;
187+ }
188+
189+ return vma;
190+}
191+
192+static void *m_start(struct seq_file *m, loff_t *ppos)
179193 {
180194 struct proc_maps_private *priv = m->private;
195+ unsigned long last_addr = *ppos;
181196 struct mm_struct *mm;
182− struct vm_area_struct *vma;
183− unsigned long addr = *pos;
184197
185− /* See m_next(). Zero at the start or after lseek. */
186− if (addr == -1UL)
198+ /* See proc_get_vma(). Zero at the start or after lseek. */
199+ if (last_addr == -1UL)
187200 return NULL;
188201
189202 /* pin the task and mm whilst we play with them */
@@ -192,44 +205,41 @@ static void *m_start(struct seq_file *m, loff_t *pos) · 2 unmodified lines
192205 return ERR_PTR(-ESRCH);
193206
194207 mm = priv->mm;
195− if (!mm || !mmget_not_zero(mm))
208+ if (!mm || !mmget_not_zero(mm)) {
209+ put_task_struct(priv->task);
210+ priv->task = NULL;
196211 return NULL;
212+ }
197213
198214 if (mmap_read_lock_killable(mm)) {
199215 mmput(mm);
216+ put_task_struct(priv->task);
217+ priv->task = NULL;
200218 return ERR_PTR(-EINTR);
201219 }
202220
203− /* start the next element from addr */
204− vma = find_vma(mm, addr);
205− if (vma)
206− return vma;
221+ vma_iter_init(&priv->iter, mm, last_addr);
207222
208− mmap_read_unlock(mm);
209− mmput(mm);
210− return NULL;
223+ return proc_get_vma(priv, ppos);
211224 }
212225
213−static void m_stop(struct seq_file *m, void *_vml)
226+static void m_stop(struct seq_file *m, void *v)
214227 {
215228 struct proc_maps_private *priv = m->private;
229+ struct mm_struct *mm = priv->mm;
216230
217− if (!IS_ERR_OR_NULL(_vml)) {
218− mmap_read_unlock(priv->mm);
219− mmput(priv->mm);
220− }
221− if (priv->task) {
222− put_task_struct(priv->task);
223− priv->task = NULL;
224− }
231+ if (!priv->task)
232+ return;
233+
234+ mmap_read_unlock(mm);
235+ mmput(mm);
236+ put_task_struct(priv->task);
237+ priv->task = NULL;
225238 }
226239
227−static void *m_next(struct seq_file *m, void *_p, loff_t *pos)
240+static void *m_next(struct seq_file *m, void *_p, loff_t *ppos)
228241 {
229− struct vm_area_struct *vma = _p;
230−
231− *pos = vma->vm_end;
232− return find_vma(vma->vm_mm, vma->vm_end);
242+ return proc_get_vma(m->private, ppos);
233243 }
234244
235245 static const struct seq_operations proc_pid_maps_ops = {
fs/reiserfs/reiserfs.h+3−3
@@ -2699,7 +2699,7 @@ struct reiserfs_iget_args { · 2698 unmodified lines
26992699 #define get_journal_desc_magic(bh) (bh->b_data + bh->b_size - 12)
27002700
27012701 #define journal_trans_half(blocksize) \
2702− ((blocksize - sizeof (struct reiserfs_journal_desc) + sizeof (__u32) - 12) / sizeof (__u32))
2702+ ((blocksize - sizeof(struct reiserfs_journal_desc) - 12) / sizeof(__u32))
27032703
27042704 /* journal.c see journal.c for all the comments here */
27052705
@@ -2711,7 +2711,7 @@ struct reiserfs_journal_desc { · 5 unmodified lines
27112711 __le32 j_len;
27122712
27132713 __le32 j_mount_id; /* mount id of this trans */
2714− __le32 j_realblock[1]; /* real locations for each block */
2714+ __le32 j_realblock[]; /* real locations for each block */
27152715 };
27162716
27172717 #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
@@ -2726,7 +2726,7 @@ struct reiserfs_journal_desc { · 8 unmodified lines
27262726 struct reiserfs_journal_commit {
27272727 __le32 j_trans_id; /* must match j_trans_id from the desc block */
27282728 __le32 j_len; /* ditto */
2729− __le32 j_realblock[1]; /* real locations for each block */
2729+ __le32 j_realblock[]; /* real locations for each block */
27302730 };
27312731
27322732 #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
fs/smb/client/cached_dir.c+6−0
@@ -452,6 +452,9 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon) · 451 unmodified lines
452452 struct cached_fid *cfid, *q;
453453 LIST_HEAD(entry);
454454
455+ if (cfids == NULL)
456+ return;
457+
455458 spin_lock(&cfids->cfid_list_lock);
456459 list_for_each_entry_safe(cfid, q, &cfids->entries, entry) {
457460 list_move(&cfid->entry, &entry);
@@ -651,6 +654,9 @@ void free_cached_dirs(struct cached_fids *cfids) · 193 unmodified lines
651654 struct cached_fid *cfid, *q;
652655 LIST_HEAD(entry);
653656
657+ if (cfids == NULL)
658+ return;
659+
654660 if (cfids->laundromat) {
655661 kthread_stop(cfids->laundromat);
656662 cfids->laundromat = NULL;
fs/smb/client/cifsglob.h+2−1
@@ -1807,6 +1807,7 @@ static inline bool is_retryable_error(int error) · 1806 unmodified lines
18071807 #define MID_RETRY_NEEDED 8 /* session closed while this request out */
18081808 #define MID_RESPONSE_MALFORMED 0x10
18091809 #define MID_SHUTDOWN 0x20
1810+#define MID_RESPONSE_READY 0x40 /* ready for other process handle the rsp */
18101811
18111812 /* Flags */
18121813 #define MID_WAIT_CANCELLED 1 /* Cancelled while waiting for response */
@@ -1943,7 +1944,7 @@ require use of the stronger protocol */ · 130 unmodified lines
19431944 * cifsInodeInfo->lock_sem cifsInodeInfo->llist cifs_init_once
19441945 * ->can_cache_brlcks
19451946 * cifsInodeInfo->deferred_lock cifsInodeInfo->deferred_closes cifsInodeInfo_alloc
1946− * cached_fid->fid_mutex cifs_tcon->crfid tconInfoAlloc
1947+ * cached_fid->fid_mutex cifs_tcon->crfid tcon_info_alloc
19471948 * cifsFileInfo->fh_mutex cifsFileInfo cifs_new_fileinfo
19481949 * cifsFileInfo->file_info_lock cifsFileInfo->count cifs_new_fileinfo
19491950 * ->invalidHandle initiate_cifs_search
fs/smb/client/cifsproto.h+1−1
@@ -512,7 +512,7 @@ extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); · 511 unmodified lines
512512
513513 extern struct cifs_ses *sesInfoAlloc(void);
514514 extern void sesInfoFree(struct cifs_ses *);
515−extern struct cifs_tcon *tconInfoAlloc(void);
515+extern struct cifs_tcon *tcon_info_alloc(bool dir_leases_enabled);
516516 extern void tconInfoFree(struct cifs_tcon *);
517517
518518 extern int cifs_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server,
fs/smb/client/connect.c+6−2
@@ -1882,7 +1882,8 @@ cifs_setup_ipc(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 1881 unmodified lines
18821882 }
18831883 }
18841884
1885− tcon = tconInfoAlloc();
1885+ /* no need to setup directory caching on IPC share, so pass in false */
1886+ tcon = tcon_info_alloc(false);
18861887 if (tcon == NULL)
18871888 return -ENOMEM;
18881889
@@ -2492,7 +2493,10 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · 603 unmodified lines
24922493 goto out_fail;
24932494 }
24942495
2495− tcon = tconInfoAlloc();
2496+ if (ses->server->capabilities & SMB2_GLOBAL_CAP_DIRECTORY_LEASING)
2497+ tcon = tcon_info_alloc(true);
2498+ else
2499+ tcon = tcon_info_alloc(false);
24962500 if (tcon == NULL) {
24972501 rc = -ENOMEM;
24982502 goto out_fail;
fs/smb/client/fs_context.c+1−0
@@ -1541,6 +1541,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, · 1540 unmodified lines
15411541
15421542 cifs_parse_mount_err:
15431543 kfree_sensitive(ctx->password);
1544+ ctx->password = NULL;
15441545 return -EINVAL;
15451546 }
15461547
fs/smb/client/inode.c+1−1
@@ -2680,7 +2680,7 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start, · 2679 unmodified lines
26802680 }
26812681
26822682 cifsFileInfo_put(cfile);
2683− return -ENOTSUPP;
2683+ return -EOPNOTSUPP;
26842684 }
26852685
26862686 int cifs_truncate_page(struct address_space *mapping, loff_t from)
fs/smb/client/misc.c+9−5
@@ -113,18 +113,22 @@ sesInfoFree(struct cifs_ses *buf_to_free) · 112 unmodified lines
113113 }
114114
115115 struct cifs_tcon *
116−tconInfoAlloc(void)
116+tcon_info_alloc(bool dir_leases_enabled)
117117 {
118118 struct cifs_tcon *ret_buf;
119119
120120 ret_buf = kzalloc(sizeof(*ret_buf), GFP_KERNEL);
121121 if (!ret_buf)
122122 return NULL;
123− ret_buf->cfids = init_cached_dirs();
124− if (!ret_buf->cfids) {
125− kfree(ret_buf);
126− return NULL;
123+
124+ if (dir_leases_enabled == true) {
125+ ret_buf->cfids = init_cached_dirs();
126+ if (!ret_buf->cfids) {
127+ kfree(ret_buf);
128+ return NULL;
129+ }
127130 }
131+ /* else ret_buf->cfids is already set to NULL above */
128132
129133 atomic_inc(&tconInfoAllocCount);
130134 ret_buf->status = TID_NEW;
fs/smb/client/smb2inode.c+3−0
@@ -539,6 +539,9 @@ static int parse_create_response(struct cifs_open_info_data *data, · 538 unmodified lines
539539 int rc = 0;
540540
541541 switch (rsp->hdr.Status) {
542+ case STATUS_IO_REPARSE_TAG_NOT_HANDLED:
543+ reparse_point = true;
544+ break;
542545 case STATUS_STOPPED_ON_SYMLINK:
543546 rc = smb2_parse_symlink_response(cifs_sb, iov,
544547 &data->symlink_target);
fs/smb/client/smb2maperror.c+0−2
@@ -877,8 +877,6 @@ static const struct status_to_posix_error smb2_error_map_table[] = { · 876 unmodified lines
877877 "STATUS_IO_REPARSE_TAG_MISMATCH"},
878878 {STATUS_IO_REPARSE_DATA_INVALID, -EIO,
879879 "STATUS_IO_REPARSE_DATA_INVALID"},
880− {STATUS_IO_REPARSE_TAG_NOT_HANDLED, -EIO,
881− "STATUS_IO_REPARSE_TAG_NOT_HANDLED"},
882880 {STATUS_REPARSE_POINT_NOT_RESOLVED, -EIO,
883881 "STATUS_REPARSE_POINT_NOT_RESOLVED"},
884882 {STATUS_DIRECTORY_IS_A_REPARSE_POINT, -EIO,
fs/smb/client/smb2ops.c+3−3
@@ -297,7 +297,7 @@ smb2_adjust_credits(struct TCP_Server_Info *server, · 296 unmodified lines
297297 cifs_server_dbg(VFS, "request has less credits (%d) than required (%d)",
298298 credits->value, new_val);
299299
300− return -ENOTSUPP;
300+ return -EOPNOTSUPP;
301301 }
302302
303303 spin_lock(&server->req_lock);
@@ -1161,7 +1161,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon, · 857 unmodified lines
11611161 /* Use a fudge factor of 256 bytes in case we collide
11621162 * with a different set_EAs command.
11631163 */
1164− if(CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
1164+ if (CIFSMaxBufSize - MAX_SMB2_CREATE_RESPONSE_SIZE -
11651165 MAX_SMB2_CLOSE_RESPONSE_SIZE - 256 <
11661166 used_len + ea_name_len + ea_value_len + 1) {
11671167 rc = -ENOSPC;
@@ -4591,7 +4591,7 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid, · 3423 unmodified lines
45914591
45924592 if (shdr->Command != SMB2_READ) {
45934593 cifs_server_dbg(VFS, "only big read responses are supported\n");
4594− return -ENOTSUPP;
4594+ return -EOPNOTSUPP;
45954595 }
45964596
45974597 if (server->ops->is_session_expired &&
fs/smb/client/smb2pdu.c+21−14
@@ -89,20 +89,26 @@ smb2_hdr_assemble(struct smb2_hdr *shdr, __le16 smb2_cmd, · 88 unmodified lines
8989 struct TCP_Server_Info *server)
9090 {
9191 struct smb3_hdr_req *smb3_hdr;
92+
9293 shdr->ProtocolId = SMB2_PROTO_NUMBER;
9394 shdr->StructureSize = cpu_to_le16(64);
9495 shdr->Command = smb2_cmd;
95− if (server->dialect >= SMB30_PROT_ID) {
96− /* After reconnect SMB3 must set ChannelSequence on subsequent reqs */
97− smb3_hdr = (struct smb3_hdr_req *)shdr;
98− /* if primary channel is not set yet, use default channel for chan sequence num */
99− if (SERVER_IS_CHAN(server))
100− smb3_hdr->ChannelSequence =
101− cpu_to_le16(server->primary_server->channel_sequence_num);
102− else
103− smb3_hdr->ChannelSequence = cpu_to_le16(server->channel_sequence_num);
104− }
96+
10597 if (server) {
98+ /* After reconnect SMB3 must set ChannelSequence on subsequent reqs */
99+ if (server->dialect >= SMB30_PROT_ID) {
100+ smb3_hdr = (struct smb3_hdr_req *)shdr;
101+ /*
102+ * if primary channel is not set yet, use default
103+ * channel for chan sequence num
104+ */
105+ if (SERVER_IS_CHAN(server))
106+ smb3_hdr->ChannelSequence =
107+ cpu_to_le16(server->primary_server->channel_sequence_num);
108+ else
109+ smb3_hdr->ChannelSequence =
110+ cpu_to_le16(server->channel_sequence_num);
111+ }
106112 spin_lock(&server->req_lock);
107113 /* Request up to 10 credits but don't go over the limit. */
108114 if (server->credits >= server->max_credits)
@@ -842,7 +848,7 @@ add_posix_context(struct kvec *iov, unsigned int *num_iovec, umode_t mode) · 733 unmodified lines
842848
843849 iov[num].iov_base = create_posix_buf(mode);
844850 if (mode == ACL_NO_MODE)
845− cifs_dbg(FYI, "Invalid mode\n");
851+ cifs_dbg(FYI, "%s: no mode\n", __func__);
846852 if (iov[num].iov_base == NULL)
847853 return -ENOMEM;
848854 iov[num].iov_len = sizeof(struct create_posix);
@@ -2234,7 +2240,7 @@ create_durable_v2_buf(struct cifs_open_parms *oparms) · 1385 unmodified lines
22342240 * (most servers default to 120 seconds) and most clients default to 0.
22352241 * This can be overridden at mount ("handletimeout=") if the user wants
22362242 * a different persistent (or resilient) handle timeout for all opens
2237− * opens on a particular SMB3 mount.
2243+ * on a particular SMB3 mount.
22382244 */
22392245 buf->dcontext.Timeout = cpu_to_le32(oparms->tcon->handle_timeout);
22402246 buf->dcontext.Flags = cpu_to_le32(SMB2_DHANDLE_FLAG_PERSISTENT);
@@ -2379,7 +2385,7 @@ add_twarp_context(struct kvec *iov, unsigned int *num_iovec, __u64 timewarp) · 138 unmodified lines
23792385 return 0;
23802386 }
23812387
2382−/* See See http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx */
2388+/* See http://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx */
23832389 static void setup_owner_group_sids(char *buf)
23842390 {
23852391 struct owner_group_sids *sids = (struct owner_group_sids *)buf;
@@ -3124,6 +3130,7 @@ void · 738 unmodified lines
31243130 SMB2_ioctl_free(struct smb_rqst *rqst)
31253131 {
31263132 int i;
3133+
31273134 if (rqst && rqst->rq_iov) {
31283135 cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
31293136 for (i = 1; i < rqst->rq_nvec; i++)
@@ -3871,7 +3878,7 @@ void smb2_reconnect_server(struct work_struct *work) · 741 unmodified lines
38713878 goto done;
38723879
38733880 /* allocate a dummy tcon struct used for reconnect */
3874− tcon = tconInfoAlloc();
3881+ tcon = tcon_info_alloc(false);
38753882 if (!tcon) {
38763883 resched = true;
38773884 list_for_each_entry_safe(ses, ses2, &tmp_ses_list, rlist) {
fs/smb/client/smbdirect.c+6−3
@@ -1401,10 +1401,13 @@ create_conn: · 1400 unmodified lines
14011401 server->smbd_conn = smbd_get_connection(
14021402 server, (struct sockaddr *) &server->dstaddr);
14031403
1404− if (server->smbd_conn)
1404+ if (server->smbd_conn) {
14051405 cifs_dbg(VFS, "RDMA transport re-established\n");
1406−
1407− return server->smbd_conn ? 0 : -ENOENT;
1406+ trace_smb3_smbd_connect_done(server->hostname, server->conn_id, &server->dstaddr);
1407+ return 0;
1408+ }
1409+ trace_smb3_smbd_connect_err(server->hostname, server->conn_id, &server->dstaddr);
1410+ return -ENOENT;
14081411 }
14091412
14101413 static void destroy_caches_and_workqueue(struct smbd_connection *info)
fs/smb/client/trace.h+2−0
@@ -935,6 +935,8 @@ DEFINE_EVENT(smb3_connect_class, smb3_##name, \ · 934 unmodified lines
935935 TP_ARGS(hostname, conn_id, addr))
936936
937937 DEFINE_SMB3_CONNECT_EVENT(connect_done);
938+DEFINE_SMB3_CONNECT_EVENT(smbd_connect_done);
939+DEFINE_SMB3_CONNECT_EVENT(smbd_connect_err);
938940
939941 DECLARE_EVENT_CLASS(smb3_connect_err_class,
940942 TP_PROTO(char *hostname, __u64 conn_id,
fs/smb/client/transport.c+24−12
@@ -18,7 +18,7 @@ · 17 unmodified lines
1818 #include <linux/bvec.h>
1919 #include <linux/highmem.h>
2020 #include <linux/uaccess.h>
21−#include <asm/processor.h>
21+#include <linux/processor.h>
2222 #include <linux/mempool.h>
2323 #include <linux/sched/signal.h>
2424 #include <linux/task_io_accounting_ops.h>
@@ -35,6 +35,8 @@ · 10 unmodified lines
3535 void
3636 cifs_wake_up_task(struct mid_q_entry *mid)
3737 {
38+ if (mid->mid_state == MID_RESPONSE_RECEIVED)
39+ mid->mid_state = MID_RESPONSE_READY;
3840 wake_up_process(mid->callback_data);
3941 }
4042
@@ -87,7 +89,8 @@ static void __release_mid(struct kref *refcount) · 46 unmodified lines
8789 struct TCP_Server_Info *server = midEntry->server;
8890
8991 if (midEntry->resp_buf && (midEntry->mid_flags & MID_WAIT_CANCELLED) &&
90− midEntry->mid_state == MID_RESPONSE_RECEIVED &&
92+ (midEntry->mid_state == MID_RESPONSE_RECEIVED ||
93+ midEntry->mid_state == MID_RESPONSE_READY) &&
9194 server->ops->handle_cancelled_mid)
9295 server->ops->handle_cancelled_mid(midEntry, server);
9396
@@ -737,7 +740,8 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ) · 643 unmodified lines
737740 int error;
738741
739742 error = wait_event_state(server->response_q,
740− midQ->mid_state != MID_REQUEST_SUBMITTED,
743+ midQ->mid_state != MID_REQUEST_SUBMITTED &&
744+ midQ->mid_state != MID_RESPONSE_RECEIVED,
741745 (TASK_KILLABLE|TASK_FREEZABLE_UNSAFE));
742746 if (error < 0)
743747 return -ERESTARTSYS;
@@ -890,7 +894,7 @@ cifs_sync_mid_result(struct mid_q_entry *mid, struct TCP_Server_Info *server) · 146 unmodified lines
890894
891895 spin_lock(&server->mid_lock);
892896 switch (mid->mid_state) {
893− case MID_RESPONSE_RECEIVED:
897+ case MID_RESPONSE_READY:
894898 spin_unlock(&server->mid_lock);
895899 return rc;
896900 case MID_RETRY_NEEDED:
@@ -989,6 +993,9 @@ cifs_compound_callback(struct mid_q_entry *mid) · 92 unmodified lines
989993 credits.instance = server->reconnect_instance;
990994
991995 add_credits(server, &credits, mid->optype);
996+
997+ if (mid->mid_state == MID_RESPONSE_RECEIVED)
998+ mid->mid_state = MID_RESPONSE_READY;
992999 }
9931000
9941001 static void
@@ -1209,7 +1216,8 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 214 unmodified lines
12091216 send_cancel(server, &rqst[i], midQ[i]);
12101217 spin_lock(&server->mid_lock);
12111218 midQ[i]->mid_flags |= MID_WAIT_CANCELLED;
1212− if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED) {
1219+ if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED ||
1220+ midQ[i]->mid_state == MID_RESPONSE_RECEIVED) {
12131221 midQ[i]->callback = cifs_cancelled_callback;
12141222 cancelled_mid[i] = true;
12151223 credits[i].value = 0;
@@ -1230,7 +1238,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, · 14 unmodified lines
12301238 }
12311239
12321240 if (!midQ[i]->resp_buf ||
1233− midQ[i]->mid_state != MID_RESPONSE_RECEIVED) {
1241+ midQ[i]->mid_state != MID_RESPONSE_READY) {
12341242 rc = -EIO;
12351243 cifs_dbg(FYI, "Bad MID state?\n");
12361244 goto out;
@@ -1417,7 +1425,8 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 180 unmodified lines
14171425 if (rc != 0) {
14181426 send_cancel(server, &rqst, midQ);
14191427 spin_lock(&server->mid_lock);
1420− if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
1428+ if (midQ->mid_state == MID_REQUEST_SUBMITTED ||
1429+ midQ->mid_state == MID_RESPONSE_RECEIVED) {
14211430 /* no longer considered to be "in-flight" */
14221431 midQ->callback = release_mid;
14231432 spin_unlock(&server->mid_lock);
@@ -1434,7 +1443,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses, · 10 unmodified lines
14341443 }
14351444
14361445 if (!midQ->resp_buf || !out_buf ||
1437− midQ->mid_state != MID_RESPONSE_RECEIVED) {
1446+ midQ->mid_state != MID_RESPONSE_READY) {
14381447 rc = -EIO;
14391448 cifs_server_dbg(VFS, "Bad MID state?\n");
14401449 goto out;
@@ -1558,14 +1567,16 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 117 unmodified lines
15581567
15591568 /* Wait for a reply - allow signals to interrupt. */
15601569 rc = wait_event_interruptible(server->response_q,
1561− (!(midQ->mid_state == MID_REQUEST_SUBMITTED)) ||
1570+ (!(midQ->mid_state == MID_REQUEST_SUBMITTED ||
1571+ midQ->mid_state == MID_RESPONSE_RECEIVED)) ||
15621572 ((server->tcpStatus != CifsGood) &&
15631573 (server->tcpStatus != CifsNew)));
15641574
15651575 /* Were we interrupted by a signal ? */
15661576 spin_lock(&server->srv_lock);
15671577 if ((rc == -ERESTARTSYS) &&
1568− (midQ->mid_state == MID_REQUEST_SUBMITTED) &&
1578+ (midQ->mid_state == MID_REQUEST_SUBMITTED ||
1579+ midQ->mid_state == MID_RESPONSE_RECEIVED) &&
15691580 ((server->tcpStatus == CifsGood) ||
15701581 (server->tcpStatus == CifsNew))) {
15711582 spin_unlock(&server->srv_lock);
@@ -1596,7 +1607,8 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 24 unmodified lines
15961607 if (rc) {
15971608 send_cancel(server, &rqst, midQ);
15981609 spin_lock(&server->mid_lock);
1599− if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
1610+ if (midQ->mid_state == MID_REQUEST_SUBMITTED ||
1611+ midQ->mid_state == MID_RESPONSE_RECEIVED) {
16001612 /* no longer considered to be "in-flight" */
16011613 midQ->callback = release_mid;
16021614 spin_unlock(&server->mid_lock);
@@ -1616,7 +1628,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon, · 13 unmodified lines
16161628 return rc;
16171629
16181630 /* rcvd frame is ok */
1619− if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_RECEIVED) {
1631+ if (out_buf == NULL || midQ->mid_state != MID_RESPONSE_READY) {
16201632 rc = -EIO;
16211633 cifs_tcon_dbg(VFS, "Bad MID state?\n");
16221634 goto out;
fs/smb/server/connection.c+3−0
@@ -197,6 +197,9 @@ int ksmbd_conn_write(struct ksmbd_work *work) · 196 unmodified lines
197197 if (work->send_no_response)
198198 return 0;
199199
200+ if (!work->iov_idx)
201+ return -EINVAL;
202+
200203 ksmbd_conn_lock(conn);
201204 sent = conn->transport->ops->writev(conn->transport, work->iov,
202205 work->iov_cnt,
fs/smb/server/server.c+3−1
@@ -115,8 +115,10 @@ static int __process_request(struct ksmbd_work *work, struct ksmbd_conn *conn, · 114 unmodified lines
115115 if (check_conn_state(work))
116116 return SERVER_HANDLER_CONTINUE;
117117
118− if (ksmbd_verify_smb_message(work))
118+ if (ksmbd_verify_smb_message(work)) {
119+ conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
119120 return SERVER_HANDLER_ABORT;
121+ }
120122
121123 command = conn->ops->get_cmd_val(work);
122124 *cmd = command;
fs/smb/server/smb2misc.c+1−3
@@ -440,10 +440,8 @@ int ksmbd_smb2_check_message(struct ksmbd_work *work) · 439 unmodified lines
440440
441441 validate_credit:
442442 if ((work->conn->vals->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU) &&
443− smb2_validate_credit_charge(work->conn, hdr)) {
444− work->conn->ops->set_rsp_status(work, STATUS_INVALID_PARAMETER);
443+ smb2_validate_credit_charge(work->conn, hdr))
445444 return 1;
446− }
447445
448446 return 0;
449447 }
fs/smb/server/smb2pdu.c+1−1
@@ -6312,7 +6312,7 @@ int smb2_read(struct ksmbd_work *work) · 6311 unmodified lines
63126312 aux_payload_buf,
63136313 nbytes);
63146314 kvfree(aux_payload_buf);
6315−
6315+ aux_payload_buf = NULL;
63166316 nbytes = 0;
63176317 if (remain_bytes < 0) {
63186318 err = (int)remain_bytes;
fs/smb/server/smbacl.c+0−1
@@ -1420,7 +1420,6 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon, · 1419 unmodified lines
14201420 out:
14211421 posix_acl_release(fattr.cf_acls);
14221422 posix_acl_release(fattr.cf_dacls);
1423− mark_inode_dirty(inode);
14241423 return rc;
14251424 }
14261425
fs/stat.c+2−45
@@ -26,37 +26,6 @@ · 25 unmodified lines
2626 #include "internal.h"
2727 #include "mount.h"
2828
29−/**
30− * fill_mg_cmtime - Fill in the mtime and ctime and flag ctime as QUERIED
31− * @stat: where to store the resulting values
32− * @request_mask: STATX_* values requested
33− * @inode: inode from which to grab the c/mtime
34− *
35− * Given @inode, grab the ctime and mtime out if it and store the result
36− * in @stat. When fetching the value, flag it as queried so the next write
37− * will use a fine-grained timestamp.
38− */
39−void fill_mg_cmtime(struct kstat *stat, u32 request_mask, struct inode *inode)
40−{
41− atomic_long_t *pnsec = (atomic_long_t *)&inode->__i_ctime.tv_nsec;
42−
43− /* If neither time was requested, then don't report them */
44− if (!(request_mask & (STATX_CTIME|STATX_MTIME))) {
45− stat->result_mask &= ~(STATX_CTIME|STATX_MTIME);
46− return;
47− }
48−
49− stat->mtime = inode->i_mtime;
50− stat->ctime.tv_sec = inode->__i_ctime.tv_sec;
51− /*
52− * Atomically set the QUERIED flag and fetch the new value with
53− * the flag masked off.
54− */
55− stat->ctime.tv_nsec = atomic_long_fetch_or(I_CTIME_QUERIED, pnsec) &
56− ~I_CTIME_QUERIED;
57−}
58−EXPORT_SYMBOL(fill_mg_cmtime);
59−
6029 /**
6130 * generic_fillattr - Fill in the basic attributes from the inode struct
6231 * @idmap: idmap of the mount the inode was found from
@@ -89,14 +58,8 @@ void generic_fillattr(struct mnt_idmap *idmap, u32 request_mask, · 26 unmodified lines
8958 stat->rdev = inode->i_rdev;
9059 stat->size = i_size_read(inode);
9160 stat->atime = inode->i_atime;
92−
93− if (is_mgtime(inode)) {
94− fill_mg_cmtime(stat, request_mask, inode);
95− } else {
96− stat->mtime = inode->i_mtime;
97− stat->ctime = inode_get_ctime(inode);
98− }
99−
61+ stat->mtime = inode->i_mtime;
62+ stat->ctime = inode_get_ctime(inode);
10063 stat->blksize = i_blocksize(inode);
10164 stat->blocks = inode->i_blocks;
10265
@@ -419,12 +382,6 @@ SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, stat · 316 unmodified lines
419382
420383 #ifdef __ARCH_WANT_NEW_STAT
421384
422−#if BITS_PER_LONG == 32
423−# define choose_32_64(a,b) a
424−#else
425−# define choose_32_64(a,b) b
426−#endif
427−
428385 #ifndef INIT_STRUCT_STAT_PADDING
429386 # define INIT_STRUCT_STAT_PADDING(st) memset(&st, 0, sizeof(st))
430387 #endif
fs/tracefs/event_inode.c+122−24
@@ -70,6 +70,7 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 69 unmodified lines
7070 struct dentry *dentry,
7171 unsigned int flags);
7272 static int dcache_dir_open_wrapper(struct inode *inode, struct file *file);
73+static int dcache_readdir_wrapper(struct file *file, struct dir_context *ctx);
7374 static int eventfs_release(struct inode *inode, struct file *file);
7475
7576 static const struct inode_operations eventfs_root_dir_inode_operations = {
@@ -79,7 +80,7 @@ static const struct inode_operations eventfs_root_dir_inode_operations = { · 3 unmodified lines
7980 static const struct file_operations eventfs_file_operations = {
8081 .open = dcache_dir_open_wrapper,
8182 .read = generic_read_dir,
82− .iterate_shared = dcache_readdir,
83+ .iterate_shared = dcache_readdir_wrapper,
8384 .llseek = generic_file_llseek,
8485 .release = eventfs_release,
8586 };
@@ -185,17 +186,49 @@ static struct dentry *create_dir(const char *name, struct dentry *parent, void * · 99 unmodified lines
185186
186187 /**
187188 * eventfs_set_ef_status_free - set the ef->status to free
189+ * @ti: the tracefs_inode of the dentry
188190 * @dentry: dentry who's status to be freed
189191 *
190192 * eventfs_set_ef_status_free will be called if no more
191193 * references remain
192194 */
193−void eventfs_set_ef_status_free(struct dentry *dentry)
195+void eventfs_set_ef_status_free(struct tracefs_inode *ti, struct dentry *dentry)
194196 {
195197 struct tracefs_inode *ti_parent;
196− struct eventfs_file *ef;
198+ struct eventfs_inode *ei;
199+ struct eventfs_file *ef, *tmp;
200+
201+ /* The top level events directory may be freed by this */
202+ if (unlikely(ti->flags & TRACEFS_EVENT_TOP_INODE)) {
203+ LIST_HEAD(ef_del_list);
204+
205+ mutex_lock(&eventfs_mutex);
206+
207+ ei = ti->private;
208+
209+ /* Record all the top level files */
210+ list_for_each_entry_srcu(ef, &ei->e_top_files, list,
211+ lockdep_is_held(&eventfs_mutex)) {
212+ list_add_tail(&ef->del_list, &ef_del_list);
213+ }
214+
215+ /* Nothing should access this, but just in case! */
216+ ti->private = NULL;
217+
218+ mutex_unlock(&eventfs_mutex);
219+
220+ /* Now safely free the top level files and their children */
221+ list_for_each_entry_safe(ef, tmp, &ef_del_list, del_list) {
222+ list_del(&ef->del_list);
223+ eventfs_remove(ef);
224+ }
225+
226+ kfree(ei);
227+ return;
228+ }
197229
198230 mutex_lock(&eventfs_mutex);
231+
199232 ti_parent = get_tracefs(dentry->d_parent->d_inode);
200233 if (!ti_parent || !(ti_parent->flags & TRACEFS_EVENT_INODE))
201234 goto out;
@@ -364,6 +397,11 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 162 unmodified lines
364397 return ret;
365398 }
366399
400+struct dentry_list {
401+ void *cursor;
402+ struct dentry **dentries;
403+};
404+
367405 /**
368406 * eventfs_release - called to release eventfs file/dir
369407 * @inode: inode to be released
@@ -372,26 +410,25 @@ static struct dentry *eventfs_root_lookup(struct inode *dir, · 2 unmodified lines
372410 static int eventfs_release(struct inode *inode, struct file *file)
373411 {
374412 struct tracefs_inode *ti;
375− struct eventfs_inode *ei;
376− struct eventfs_file *ef;
377− struct dentry *dentry;
378− int idx;
413+ struct dentry_list *dlist = file->private_data;
414+ void *cursor;
415+ int i;
379416
380417 ti = get_tracefs(inode);
381418 if (!(ti->flags & TRACEFS_EVENT_INODE))
382419 return -EINVAL;
383420
384− ei = ti->private;
385− idx = srcu_read_lock(&eventfs_srcu);
386− list_for_each_entry_srcu(ef, &ei->e_top_files, list,
387− srcu_read_lock_held(&eventfs_srcu)) {
388− mutex_lock(&eventfs_mutex);
389− dentry = ef->dentry;
390− mutex_unlock(&eventfs_mutex);
391− if (dentry)
392− dput(dentry);
421+ if (WARN_ON_ONCE(!dlist))
422+ return -EINVAL;
423+
424+ for (i = 0; dlist->dentries && dlist->dentries[i]; i++) {
425+ dput(dlist->dentries[i]);
393426 }
394− srcu_read_unlock(&eventfs_srcu, idx);
427+
428+ cursor = dlist->cursor;
429+ kfree(dlist->dentries);
430+ kfree(dlist);
431+ file->private_data = cursor;
395432 return dcache_dir_close(inode, file);
396433 }
397434
@@ -410,21 +447,70 @@ static int dcache_dir_open_wrapper(struct inode *inode, struct file *file) · 12 unmodified lines
410447 struct tracefs_inode *ti;
411448 struct eventfs_inode *ei;
412449 struct eventfs_file *ef;
450+ struct dentry_list *dlist;
451+ struct dentry **dentries = NULL;
413452 struct dentry *dentry = file_dentry(file);
453+ struct dentry *d;
414454 struct inode *f_inode = file_inode(file);
455+ int cnt = 0;
415456 int idx;
457+ int ret;
416458
417459 ti = get_tracefs(f_inode);
418460 if (!(ti->flags & TRACEFS_EVENT_INODE))
419461 return -EINVAL;
420462
463+ if (WARN_ON_ONCE(file->private_data))
464+ return -EINVAL;
465+
466+ dlist = kmalloc(sizeof(*dlist), GFP_KERNEL);
467+ if (!dlist)
468+ return -ENOMEM;
469+
421470 ei = ti->private;
422471 idx = srcu_read_lock(&eventfs_srcu);
423− list_for_each_entry_rcu(ef, &ei->e_top_files, list) {
424− create_dentry(ef, dentry, false);
472+ list_for_each_entry_srcu(ef, &ei->e_top_files, list,
473+ srcu_read_lock_held(&eventfs_srcu)) {
474+ d = create_dentry(ef, dentry, false);
475+ if (d) {
476+ struct dentry **tmp;
477+
478+ tmp = krealloc(dentries, sizeof(d) * (cnt + 2), GFP_KERNEL);
479+ if (!tmp)
480+ break;
481+ tmp[cnt] = d;
482+ tmp[cnt + 1] = NULL;
483+ cnt++;
484+ dentries = tmp;
485+ }
425486 }
426487 srcu_read_unlock(&eventfs_srcu, idx);
427− return dcache_dir_open(inode, file);
488+ ret = dcache_dir_open(inode, file);
489+
490+ /*
491+ * dcache_dir_open() sets file->private_data to a dentry cursor.
492+ * Need to save that but also save all the dentries that were
493+ * opened by this function.
494+ */
495+ dlist->cursor = file->private_data;
496+ dlist->dentries = dentries;
497+ file->private_data = dlist;
498+ return ret;
499+}
500+
501+/*
502+ * This just sets the file->private_data back to the cursor and back.
503+ */
504+static int dcache_readdir_wrapper(struct file *file, struct dir_context *ctx)
505+{
506+ struct dentry_list *dlist = file->private_data;
507+ int ret;
508+
509+ file->private_data = dlist->cursor;
510+ ret = dcache_readdir(file, ctx);
511+ dlist->cursor = file->private_data;
512+ file->private_data = dlist;
513+ return ret;
428514 }
429515
430516 /**
@@ -491,6 +577,9 @@ struct dentry *eventfs_create_events_dir(const char *name, · 60 unmodified lines
491577 struct tracefs_inode *ti;
492578 struct inode *inode;
493579
580+ if (security_locked_down(LOCKDOWN_TRACEFS))
581+ return NULL;
582+
494583 if (IS_ERR(dentry))
495584 return dentry;
496585
@@ -507,7 +596,7 @@ struct dentry *eventfs_create_events_dir(const char *name, · 10 unmodified lines
507596 INIT_LIST_HEAD(&ei->e_top_files);
508597
509598 ti = get_tracefs(inode);
510− ti->flags |= TRACEFS_EVENT_INODE;
599+ ti->flags |= TRACEFS_EVENT_INODE | TRACEFS_EVENT_TOP_INODE;
511600 ti->private = ei;
512601
513602 inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
@@ -538,6 +627,9 @@ struct eventfs_file *eventfs_add_subsystem_dir(const char *name, · 24 unmodified lines
538627 struct eventfs_inode *ei_parent;
539628 struct eventfs_file *ef;
540629
630+ if (security_locked_down(LOCKDOWN_TRACEFS))
631+ return NULL;
632+
541633 if (!parent)
542634 return ERR_PTR(-EINVAL);
543635
@@ -569,6 +661,9 @@ struct eventfs_file *eventfs_add_dir(const char *name, · 25 unmodified lines
569661 {
570662 struct eventfs_file *ef;
571663
664+ if (security_locked_down(LOCKDOWN_TRACEFS))
665+ return NULL;
666+
572667 if (!ef_parent)
573668 return ERR_PTR(-EINVAL);
574669
@@ -606,6 +701,9 @@ int eventfs_add_events_file(const char *name, umode_t mode, · 31 unmodified lines
606701 struct eventfs_inode *ei;
607702 struct eventfs_file *ef;
608703
704+ if (security_locked_down(LOCKDOWN_TRACEFS))
705+ return -ENODEV;
706+
609707 if (!parent)
610708 return -EINVAL;
611709
@@ -654,6 +752,9 @@ int eventfs_add_file(const char *name, umode_t mode, · 42 unmodified lines
654752 {
655753 struct eventfs_file *ef;
656754
755+ if (security_locked_down(LOCKDOWN_TRACEFS))
756+ return -ENODEV;
757+
657758 if (!ef_parent)
658759 return -EINVAL;
659760
@@ -791,7 +892,6 @@ void eventfs_remove(struct eventfs_file *ef) · 131 unmodified lines
791892 void eventfs_remove_events_dir(struct dentry *dentry)
792893 {
793894 struct tracefs_inode *ti;
794− struct eventfs_inode *ei;
795895
796896 if (!dentry || !dentry->d_inode)
797897 return;
@@ -800,8 +900,6 @@ void eventfs_remove_events_dir(struct dentry *dentry) · 2 unmodified lines
800900 if (!ti || !(ti->flags & TRACEFS_EVENT_INODE))
801901 return;
802902
803− ei = ti->private;
804903 d_invalidate(dentry);
805904 dput(dentry);
806− kfree(ei);
807905 }
fs/tracefs/inode.c+4−1
@@ -385,7 +385,7 @@ static void tracefs_dentry_iput(struct dentry *dentry, struct inode *inode) · 384 unmodified lines
385385
386386 ti = get_tracefs(inode);
387387 if (ti && ti->flags & TRACEFS_EVENT_INODE)
388− eventfs_set_ef_status_free(dentry);
388+ eventfs_set_ef_status_free(ti, dentry);
389389 iput(inode);
390390 }
391391
@@ -673,6 +673,9 @@ static struct dentry *__create_dir(const char *name, struct dentry *parent, · 281 unmodified lines
673673 */
674674 struct dentry *tracefs_create_dir(const char *name, struct dentry *parent)
675675 {
676+ if (security_locked_down(LOCKDOWN_TRACEFS))
677+ return NULL;
678+
676679 return __create_dir(name, parent, &simple_dir_inode_operations);
677680 }
678681
fs/tracefs/internal.h+3−2
@@ -3,7 +3,8 @@ · 2 unmodified lines
33 #define _TRACEFS_INTERNAL_H
44
55 enum {
6− TRACEFS_EVENT_INODE = BIT(1),
6+ TRACEFS_EVENT_INODE = BIT(1),
7+ TRACEFS_EVENT_TOP_INODE = BIT(2),
78 };
89
910 struct tracefs_inode {
@@ -24,6 +25,6 @@ struct inode *tracefs_get_inode(struct super_block *sb); · 14 unmodified lines
2425 struct dentry *eventfs_start_creating(const char *name, struct dentry *parent);
2526 struct dentry *eventfs_failed_creating(struct dentry *dentry);
2627 struct dentry *eventfs_end_creating(struct dentry *dentry);
27−void eventfs_set_ef_status_free(struct dentry *dentry);
28+void eventfs_set_ef_status_free(struct tracefs_inode *ti, struct dentry *dentry);
2829
2930 #endif /* _TRACEFS_INTERNAL_H */
fs/xfs/Kconfig+1−1
@@ -147,7 +147,7 @@ config XFS_ONLINE_SCRUB_STATS · 146 unmodified lines
147147 bool "XFS online metadata check usage data collection"
148148 default y
149149 depends on XFS_ONLINE_SCRUB
150− select FS_DEBUG
150+ select XFS_DEBUG
151151 help
152152 If you say Y here, the kernel will gather usage data about
153153 the online metadata check subsystem. This includes the number
fs/xfs/libxfs/xfs_log_recover.h+22−0
@@ -131,4 +131,26 @@ void xlog_check_buf_cancel_table(struct xlog *log); · 130 unmodified lines
131131 #define xlog_check_buf_cancel_table(log) do { } while (0)
132132 #endif
133133
134+/*
135+ * Transform a regular reservation into one suitable for recovery of a log
136+ * intent item.
137+ *
138+ * Intent recovery only runs a single step of the transaction chain and defers
139+ * the rest to a separate transaction. Therefore, we reduce logcount to 1 here
140+ * to avoid livelocks if the log grant space is nearly exhausted due to the
141+ * recovered intent pinning the tail. Keep the same logflags to avoid tripping
142+ * asserts elsewhere. Struct copies abound below.
143+ */
144+static inline struct xfs_trans_res
145+xlog_recover_resv(const struct xfs_trans_res *r)
146+{
147+ struct xfs_trans_res ret = {
148+ .tr_logres = r->tr_logres,
149+ .tr_logcount = 1,
150+ .tr_logflags = r->tr_logflags,
151+ };
152+
153+ return ret;
154+}
155+
134156 #endif /* __XFS_LOG_RECOVER_H__ */
fs/xfs/libxfs/xfs_sb.c+2−1
@@ -266,7 +266,8 @@ xfs_validate_sb_write( · 265 unmodified lines
266266 return -EFSCORRUPTED;
267267 }
268268
269− if (xfs_sb_has_ro_compat_feature(sbp, XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
269+ if (!xfs_is_readonly(mp) &&
270+ xfs_sb_has_ro_compat_feature(sbp, XFS_SB_FEAT_RO_COMPAT_UNKNOWN)) {
270271 xfs_alert(mp,
271272 "Corruption detected in superblock read-only compatible features (0x%x)!",
272273 (sbp->sb_features_ro_compat &
fs/xfs/libxfs/xfs_trans_inode.c+3−3
@@ -62,12 +62,12 @@ xfs_trans_ichgtime( · 61 unmodified lines
6262 ASSERT(tp);
6363 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
6464
65− /* If the mtime changes, then ctime must also change */
66− ASSERT(flags & XFS_ICHGTIME_CHG);
65+ tv = current_time(inode);
6766
68− tv = inode_set_ctime_current(inode);
6967 if (flags & XFS_ICHGTIME_MOD)
7068 inode->i_mtime = tv;
69+ if (flags & XFS_ICHGTIME_CHG)
70+ inode_set_ctime_to_ts(inode, tv);
7171 if (flags & XFS_ICHGTIME_CREATE)
7272 ip->i_crtime = tv;
7373 }
fs/xfs/scrub/scrub.c+2−2
@@ -588,6 +588,8 @@ out_nofix: · 587 unmodified lines
588588 out_teardown:
589589 error = xchk_teardown(sc, error);
590590 out_sc:
591+ if (error != -ENOENT)
592+ xchk_stats_merge(mp, sm, &run);
591593 kfree(sc);
592594 out:
593595 trace_xchk_done(XFS_I(file_inode(file)), sm, error);
@@ -595,8 +597,6 @@ out: · 1 unmodified line
595597 sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
596598 error = 0;
597599 }
598− if (error != -ENOENT)
599− xchk_stats_merge(mp, sm, &run);
600600 return error;
601601 need_drain:
602602 error = xchk_teardown(sc, 0);
fs/xfs/scrub/stats.c+4−1
@@ -185,7 +185,10 @@ xchk_stats_merge_one( · 184 unmodified lines
185185 {
186186 struct xchk_scrub_stats *css;
187187
188− ASSERT(sm->sm_type < XFS_SCRUB_TYPE_NR);
188+ if (sm->sm_type >= XFS_SCRUB_TYPE_NR) {
189+ ASSERT(sm->sm_type < XFS_SCRUB_TYPE_NR);
190+ return;
191+ }
189192
190193 css = &cs->cs_stats[sm->sm_type];
191194 spin_lock(&css->css_lock);
fs/xfs/xfs_attr_inactive.c+0−1
@@ -333,7 +333,6 @@ xfs_attr_inactive( · 332 unmodified lines
333333 int error = 0;
334334
335335 mp = dp->i_mount;
336− ASSERT(! XFS_NOT_DQATTACHED(mp, dp));
337336
338337 xfs_ilock(dp, lock_mode);
339338 if (!xfs_inode_has_attr_fork(dp))
fs/xfs/xfs_attr_item.c+4−3
@@ -547,7 +547,7 @@ xfs_attri_item_recover( · 546 unmodified lines
547547 struct xfs_inode *ip;
548548 struct xfs_da_args *args;
549549 struct xfs_trans *tp;
550− struct xfs_trans_res tres;
550+ struct xfs_trans_res resv;
551551 struct xfs_attri_log_format *attrp;
552552 struct xfs_attri_log_nameval *nv = attrip->attri_nameval;
553553 int error;
@@ -618,8 +618,9 @@ xfs_attri_item_recover( · 64 unmodified lines
618618 goto out;
619619 }
620620
621− xfs_init_attr_trans(args, &tres, &total);
622− error = xfs_trans_alloc(mp, &tres, total, 0, XFS_TRANS_RESERVE, &tp);
621+ xfs_init_attr_trans(args, &resv, &total);
622+ resv = xlog_recover_resv(&resv);
623+ error = xfs_trans_alloc(mp, &resv, total, 0, XFS_TRANS_RESERVE, &tp);
623624 if (error)
624625 goto out;
625626
fs/xfs/xfs_bmap_item.c+3−1
@@ -490,6 +490,7 @@ xfs_bui_item_recover( · 489 unmodified lines
490490 struct list_head *capture_list)
491491 {
492492 struct xfs_bmap_intent fake = { };
493+ struct xfs_trans_res resv;
493494 struct xfs_bui_log_item *buip = BUI_ITEM(lip);
494495 struct xfs_trans *tp;
495496 struct xfs_inode *ip = NULL;
@@ -515,7 +516,8 @@ xfs_bui_item_recover( · 19 unmodified lines
515516 return error;
516517
517518 /* Allocate transaction and do the work. */
518− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
519+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
520+ error = xfs_trans_alloc(mp, &resv,
519521 XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
520522 if (error)
521523 goto err_rele;
fs/xfs/xfs_export.c+14−0
@@ -146,6 +146,20 @@ xfs_nfs_get_inode( · 145 unmodified lines
146146 return ERR_PTR(error);
147147 }
148148
149+ /*
150+ * Reload the incore unlinked list to avoid failure in inodegc.
151+ * Use an unlocked check here because unrecovered unlinked inodes
152+ * should be somewhat rare.
153+ */
154+ if (xfs_inode_unlinked_incomplete(ip)) {
155+ error = xfs_inode_reload_unlinked(ip);
156+ if (error) {
157+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
158+ xfs_irele(ip);
159+ return ERR_PTR(error);
160+ }
161+ }
162+
149163 if (VFS_I(ip)->i_generation != generation) {
150164 xfs_irele(ip);
151165 return ERR_PTR(-ESTALE);
fs/xfs/xfs_extfree_item.c+3−1
@@ -660,6 +660,7 @@ xfs_efi_item_recover( · 659 unmodified lines
660660 struct xfs_log_item *lip,
661661 struct list_head *capture_list)
662662 {
663+ struct xfs_trans_res resv;
663664 struct xfs_efi_log_item *efip = EFI_ITEM(lip);
664665 struct xfs_mount *mp = lip->li_log->l_mp;
665666 struct xfs_efd_log_item *efdp;
@@ -683,7 +684,8 @@ xfs_efi_item_recover( · 17 unmodified lines
683684 }
684685 }
685686
686− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
687+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
688+ error = xfs_trans_alloc(mp, &resv, 0, 0, 0, &tp);
687689 if (error)
688690 return error;
689691 efdp = xfs_trans_get_efd(tp, efip, efip->efi_format.efi_nextents);
fs/xfs/xfs_fsmap.c+18−7
@@ -565,6 +565,19 @@ err: · 564 unmodified lines
565565 }
566566 #endif /* CONFIG_XFS_RT */
567567
568+static inline bool
569+rmap_not_shareable(struct xfs_mount *mp, const struct xfs_rmap_irec *r)
570+{
571+ if (!xfs_has_reflink(mp))
572+ return true;
573+ if (XFS_RMAP_NON_INODE_OWNER(r->rm_owner))
574+ return true;
575+ if (r->rm_flags & (XFS_RMAP_ATTR_FORK | XFS_RMAP_BMBT_BLOCK |
576+ XFS_RMAP_UNWRITTEN))
577+ return true;
578+ return false;
579+}
580+
568581 /* Execute a getfsmap query against the regular data device. */
569582 STATIC int
570583 __xfs_getfsmap_datadev(
@@ -598,7 +611,6 @@ __xfs_getfsmap_datadev( · 27 unmodified lines
598611 * low to the fsmap low key and max out the high key to the end
599612 * of the AG.
600613 */
601− info->low.rm_startblock = XFS_FSB_TO_AGBNO(mp, start_fsb);
602614 info->low.rm_offset = XFS_BB_TO_FSBT(mp, keys[0].fmr_offset);
603615 error = xfs_fsmap_owner_to_rmap(&info->low, &keys[0]);
604616 if (error)
@@ -608,12 +620,9 @@ __xfs_getfsmap_datadev( · 3 unmodified lines
608620
609621 /* Adjust the low key if we are continuing from where we left off. */
610622 if (info->low.rm_blockcount == 0) {
611− /* empty */
612− } else if (XFS_RMAP_NON_INODE_OWNER(info->low.rm_owner) ||
613− (info->low.rm_flags & (XFS_RMAP_ATTR_FORK |
614− XFS_RMAP_BMBT_BLOCK |
615− XFS_RMAP_UNWRITTEN))) {
616− info->low.rm_startblock += info->low.rm_blockcount;
623+ /* No previous record from which to continue */
624+ } else if (rmap_not_shareable(mp, &info->low)) {
625+ /* Last record seen was an unshareable extent */
617626 info->low.rm_owner = 0;
618627 info->low.rm_offset = 0;
619628
@@ -621,8 +630,10 @@ __xfs_getfsmap_datadev( · 1 unmodified line
621630 if (XFS_FSB_TO_DADDR(mp, start_fsb) >= eofs)
622631 return 0;
623632 } else {
633+ /* Last record seen was a shareable file data extent */
624634 info->low.rm_offset += info->low.rm_blockcount;
625635 }
636+ info->low.rm_startblock = XFS_FSB_TO_AGBNO(mp, start_fsb);
626637
627638 info->high.rm_startblock = -1U;
628639 info->high.rm_owner = ULLONG_MAX;
fs/xfs/xfs_icache.c+29−51
@@ -113,7 +113,7 @@ xfs_inode_alloc( · 112 unmodified lines
113113 INIT_LIST_HEAD(&ip->i_ioend_list);
114114 spin_lock_init(&ip->i_ioend_lock);
115115 ip->i_next_unlinked = NULLAGINO;
116− ip->i_prev_unlinked = NULLAGINO;
116+ ip->i_prev_unlinked = 0;
117117
118118 return ip;
119119 }
@@ -443,7 +443,7 @@ xfs_inodegc_queue_all( · 323 unmodified lines
443443 int cpu;
444444 bool ret = false;
445445
446− for_each_online_cpu(cpu) {
446+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
447447 gc = per_cpu_ptr(mp->m_inodegc, cpu);
448448 if (!llist_empty(&gc->list)) {
449449 mod_delayed_work_on(cpu, mp->m_inodegc_wq, &gc->work, 0);
@@ -463,7 +463,7 @@ xfs_inodegc_wait_all( · 13 unmodified lines
463463 int error = 0;
464464
465465 flush_workqueue(mp->m_inodegc_wq);
466− for_each_online_cpu(cpu) {
466+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
467467 struct xfs_inodegc *gc;
468468
469469 gc = per_cpu_ptr(mp->m_inodegc, cpu);
@@ -1845,9 +1845,17 @@ xfs_inodegc_worker( · 1375 unmodified lines
18451845 struct xfs_inodegc, work);
18461846 struct llist_node *node = llist_del_all(&gc->list);
18471847 struct xfs_inode *ip, *n;
1848+ struct xfs_mount *mp = gc->mp;
18481849 unsigned int nofs_flag;
18491850
1850− ASSERT(gc->cpu == smp_processor_id());
1851+ /*
1852+ * Clear the cpu mask bit and ensure that we have seen the latest
1853+ * update of the gc structure associated with this CPU. This matches
1854+ * with the release semantics used when setting the cpumask bit in
1855+ * xfs_inodegc_queue.
1856+ */
1857+ cpumask_clear_cpu(gc->cpu, &mp->m_inodegc_cpumask);
1858+ smp_mb__after_atomic();
18511859
18521860 WRITE_ONCE(gc->items, 0);
18531861
@@ -1862,7 +1870,7 @@ xfs_inodegc_worker( · 8 unmodified lines
18621870 nofs_flag = memalloc_nofs_save();
18631871
18641872 ip = llist_entry(node, struct xfs_inode, i_gclist);
1865− trace_xfs_inodegc_worker(ip->i_mount, READ_ONCE(gc->shrinker_hits));
1873+ trace_xfs_inodegc_worker(mp, READ_ONCE(gc->shrinker_hits));
18661874
18671875 WRITE_ONCE(gc->shrinker_hits, 0);
18681876 llist_for_each_entry_safe(ip, n, node, i_gclist) {
@@ -2057,6 +2065,7 @@ xfs_inodegc_queue( · 188 unmodified lines
20572065 struct xfs_inodegc *gc;
20582066 int items;
20592067 unsigned int shrinker_hits;
2068+ unsigned int cpu_nr;
20602069 unsigned long queue_delay = 1;
20612070
20622071 trace_xfs_inode_set_need_inactive(ip);
@@ -2064,18 +2073,28 @@ xfs_inodegc_queue( · 1 unmodified line
20642073 ip->i_flags |= XFS_NEED_INACTIVE;
20652074 spin_unlock(&ip->i_flags_lock);
20662075
2067− gc = get_cpu_ptr(mp->m_inodegc);
2076+ cpu_nr = get_cpu();
2077+ gc = this_cpu_ptr(mp->m_inodegc);
20682078 llist_add(&ip->i_gclist, &gc->list);
20692079 items = READ_ONCE(gc->items);
20702080 WRITE_ONCE(gc->items, items + 1);
20712081 shrinker_hits = READ_ONCE(gc->shrinker_hits);
20722082
2083+ /*
2084+ * Ensure the list add is always seen by anyone who finds the cpumask
2085+ * bit set. This effectively gives the cpumask bit set operation
2086+ * release ordering semantics.
2087+ */
2088+ smp_mb__before_atomic();
2089+ if (!cpumask_test_cpu(cpu_nr, &mp->m_inodegc_cpumask))
2090+ cpumask_test_and_set_cpu(cpu_nr, &mp->m_inodegc_cpumask);
2091+
20732092 /*
20742093 * We queue the work while holding the current CPU so that the work
20752094 * is scheduled to run on this CPU.
20762095 */
20772096 if (!xfs_is_inodegc_enabled(mp)) {
2078− put_cpu_ptr(gc);
2097+ put_cpu();
20792098 return;
20802099 }
20812100
@@ -2085,7 +2104,7 @@ xfs_inodegc_queue( · 3 unmodified lines
20852104 trace_xfs_inodegc_queue(mp, __return_address);
20862105 mod_delayed_work_on(current_cpu(), mp->m_inodegc_wq, &gc->work,
20872106 queue_delay);
2088− put_cpu_ptr(gc);
2107+ put_cpu();
20892108
20902109 if (xfs_inodegc_want_flush_work(ip, items, shrinker_hits)) {
20912110 trace_xfs_inodegc_throttle(mp, __return_address);
@@ -2093,47 +2112,6 @@ xfs_inodegc_queue( · 1 unmodified line
20932112 }
20942113 }
20952114
2096−/*
2097− * Fold the dead CPU inodegc queue into the current CPUs queue.
2098− */
2099−void
2100−xfs_inodegc_cpu_dead(
2101− struct xfs_mount *mp,
2102− unsigned int dead_cpu)
2103−{
2104− struct xfs_inodegc *dead_gc, *gc;
2105− struct llist_node *first, *last;
2106− unsigned int count = 0;
2107−
2108− dead_gc = per_cpu_ptr(mp->m_inodegc, dead_cpu);
2109− cancel_delayed_work_sync(&dead_gc->work);
2110−
2111− if (llist_empty(&dead_gc->list))
2112− return;
2113−
2114− first = dead_gc->list.first;
2115− last = first;
2116− while (last->next) {
2117− last = last->next;
2118− count++;
2119− }
2120− dead_gc->list.first = NULL;
2121− dead_gc->items = 0;
2122−
2123− /* Add pending work to current CPU */
2124− gc = get_cpu_ptr(mp->m_inodegc);
2125− llist_add_batch(first, last, &gc->list);
2126− count += READ_ONCE(gc->items);
2127− WRITE_ONCE(gc->items, count);
2128−
2129− if (xfs_is_inodegc_enabled(mp)) {
2130− trace_xfs_inodegc_queue(mp, __return_address);
2131− mod_delayed_work_on(current_cpu(), mp->m_inodegc_wq, &gc->work,
2132− 0);
2133− }
2134− put_cpu_ptr(gc);
2135−}
2136−
21372115 /*
21382116 * We set the inode flag atomically with the radix tree tag. Once we get tag
21392117 * lookups on the radix tree, this inode flag can go away.
@@ -2195,7 +2173,7 @@ xfs_inodegc_shrinker_count( · 55 unmodified lines
21952173 if (!xfs_is_inodegc_enabled(mp))
21962174 return 0;
21972175
2198− for_each_online_cpu(cpu) {
2176+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
21992177 gc = per_cpu_ptr(mp->m_inodegc, cpu);
22002178 if (!llist_empty(&gc->list))
22012179 return XFS_INODEGC_SHRINKER_COUNT;
@@ -2220,7 +2198,7 @@ xfs_inodegc_shrinker_scan( · 18 unmodified lines
22202198
22212199 trace_xfs_inodegc_shrinker_scan(mp, sc, __return_address);
22222200
2223− for_each_online_cpu(cpu) {
2201+ for_each_cpu(cpu, &mp->m_inodegc_cpumask) {
22242202 gc = per_cpu_ptr(mp->m_inodegc, cpu);
22252203 if (!llist_empty(&gc->list)) {
22262204 unsigned int h = READ_ONCE(gc->shrinker_hits);
fs/xfs/xfs_icache.h+0−1
@@ -79,7 +79,6 @@ void xfs_inodegc_push(struct xfs_mount *mp); · 78 unmodified lines
7979 int xfs_inodegc_flush(struct xfs_mount *mp);
8080 void xfs_inodegc_stop(struct xfs_mount *mp);
8181 void xfs_inodegc_start(struct xfs_mount *mp);
82−void xfs_inodegc_cpu_dead(struct xfs_mount *mp, unsigned int cpu);
8382 int xfs_inodegc_register_shrinker(struct xfs_mount *mp);
8483
8584 #endif
fs/xfs/xfs_inode.c+218−13
@@ -1642,8 +1642,11 @@ xfs_inode_needs_inactive( · 1641 unmodified lines
16421642 if (VFS_I(ip)->i_mode == 0)
16431643 return false;
16441644
1645− /* If this is a read-only mount, don't do this (would generate I/O) */
1646− if (xfs_is_readonly(mp))
1645+ /*
1646+ * If this is a read-only mount, don't do this (would generate I/O)
1647+ * unless we're in log recovery and cleaning the iunlinked list.
1648+ */
1649+ if (xfs_is_readonly(mp) && !xlog_recovery_needed(mp->m_log))
16471650 return false;
16481651
16491652 /* If the log isn't running, push inodes straight to reclaim. */
@@ -1703,8 +1706,11 @@ xfs_inactive( · 53 unmodified lines
17031706 mp = ip->i_mount;
17041707 ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY));
17051708
1706− /* If this is a read-only mount, don't do this (would generate I/O) */
1707− if (xfs_is_readonly(mp))
1709+ /*
1710+ * If this is a read-only mount, don't do this (would generate I/O)
1711+ * unless we're in log recovery and cleaning the iunlinked list.
1712+ */
1713+ if (xfs_is_readonly(mp) && !xlog_recovery_needed(mp->m_log))
17081714 goto out;
17091715
17101716 /* Metadata inodes require explicit resource cleanup. */
@@ -1736,9 +1742,21 @@ xfs_inactive( · 25 unmodified lines
17361742 ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0))
17371743 truncate = 1;
17381744
1739− error = xfs_qm_dqattach(ip);
1740− if (error)
1741− goto out;
1745+ if (xfs_iflags_test(ip, XFS_IQUOTAUNCHECKED)) {
1746+ /*
1747+ * If this inode is being inactivated during a quotacheck and
1748+ * has not yet been scanned by quotacheck, we /must/ remove
1749+ * the dquots from the inode before inactivation changes the
1750+ * block and inode counts. Most probably this is a result of
1751+ * reloading the incore iunlinked list to purge unrecovered
1752+ * unlinked inodes.
1753+ */
1754+ xfs_qm_dqdetach(ip);
1755+ } else {
1756+ error = xfs_qm_dqattach(ip);
1757+ if (error)
1758+ goto out;
1759+ }
17421760
17431761 if (S_ISLNK(VFS_I(ip)->i_mode))
17441762 error = xfs_inactive_symlink(ip);
@@ -1822,12 +1840,17 @@ xfs_iunlink_lookup( · 77 unmodified lines
18221840
18231841 rcu_read_lock();
18241842 ip = radix_tree_lookup(&pag->pag_ici_root, agino);
1843+ if (!ip) {
1844+ /* Caller can handle inode not being in memory. */
1845+ rcu_read_unlock();
1846+ return NULL;
1847+ }
18251848
18261849 /*
1827− * Inode not in memory or in RCU freeing limbo should not happen.
1828− * Warn about this and let the caller handle the failure.
1850+ * Inode in RCU freeing limbo should not happen. Warn about this and
1851+ * let the caller handle the failure.
18291852 */
1830− if (WARN_ON_ONCE(!ip || !ip->i_ino)) {
1853+ if (WARN_ON_ONCE(!ip->i_ino)) {
18311854 rcu_read_unlock();
18321855 return NULL;
18331856 }
@@ -1836,7 +1859,10 @@ xfs_iunlink_lookup( · 2 unmodified lines
18361859 return ip;
18371860 }
18381861
1839−/* Update the prev pointer of the next agino. */
1862+/*
1863+ * Update the prev pointer of the next agino. Returns -ENOLINK if the inode
1864+ * is not in cache.
1865+ */
18401866 static int
18411867 xfs_iunlink_update_backref(
18421868 struct xfs_perag *pag,
@@ -1851,7 +1877,8 @@ xfs_iunlink_update_backref( · 8 unmodified lines
18511877
18521878 ip = xfs_iunlink_lookup(pag, next_agino);
18531879 if (!ip)
1854− return -EFSCORRUPTED;
1880+ return -ENOLINK;
1881+
18551882 ip->i_prev_unlinked = prev_agino;
18561883 return 0;
18571884 }
@@ -1895,6 +1922,64 @@ xfs_iunlink_update_bucket( · 37 unmodified lines
18951922 return 0;
18961923 }
18971924
1925+/*
1926+ * Load the inode @next_agino into the cache and set its prev_unlinked pointer
1927+ * to @prev_agino. Caller must hold the AGI to synchronize with other changes
1928+ * to the unlinked list.
1929+ */
1930+STATIC int
1931+xfs_iunlink_reload_next(
1932+ struct xfs_trans *tp,
1933+ struct xfs_buf *agibp,
1934+ xfs_agino_t prev_agino,
1935+ xfs_agino_t next_agino)
1936+{
1937+ struct xfs_perag *pag = agibp->b_pag;
1938+ struct xfs_mount *mp = pag->pag_mount;
1939+ struct xfs_inode *next_ip = NULL;
1940+ xfs_ino_t ino;
1941+ int error;
1942+
1943+ ASSERT(next_agino != NULLAGINO);
1944+
1945+#ifdef DEBUG
1946+ rcu_read_lock();
1947+ next_ip = radix_tree_lookup(&pag->pag_ici_root, next_agino);
1948+ ASSERT(next_ip == NULL);
1949+ rcu_read_unlock();
1950+#endif
1951+
1952+ xfs_info_ratelimited(mp,
1953+ "Found unrecovered unlinked inode 0x%x in AG 0x%x. Initiating recovery.",
1954+ next_agino, pag->pag_agno);
1955+
1956+ /*
1957+ * Use an untrusted lookup just to be cautious in case the AGI has been
1958+ * corrupted and now points at a free inode. That shouldn't happen,
1959+ * but we'd rather shut down now since we're already running in a weird
1960+ * situation.
1961+ */
1962+ ino = XFS_AGINO_TO_INO(mp, pag->pag_agno, next_agino);
1963+ error = xfs_iget(mp, tp, ino, XFS_IGET_UNTRUSTED, 0, &next_ip);
1964+ if (error)
1965+ return error;
1966+
1967+ /* If this is not an unlinked inode, something is very wrong. */
1968+ if (VFS_I(next_ip)->i_nlink != 0) {
1969+ error = -EFSCORRUPTED;
1970+ goto rele;
1971+ }
1972+
1973+ next_ip->i_prev_unlinked = prev_agino;
1974+ trace_xfs_iunlink_reload_next(next_ip);
1975+rele:
1976+ ASSERT(!(VFS_I(next_ip)->i_state & I_DONTCACHE));
1977+ if (xfs_is_quotacheck_running(mp) && next_ip)
1978+ xfs_iflags_set(next_ip, XFS_IQUOTAUNCHECKED);
1979+ xfs_irele(next_ip);
1980+ return error;
1981+}
1982+
18981983 static int
18991984 xfs_iunlink_insert_inode(
19001985 struct xfs_trans *tp,
@@ -1926,6 +2011,8 @@ xfs_iunlink_insert_inode( · 25 unmodified lines
19262011 * inode.
19272012 */
19282013 error = xfs_iunlink_update_backref(pag, agino, next_agino);
2014+ if (error == -ENOLINK)
2015+ error = xfs_iunlink_reload_next(tp, agibp, agino, next_agino);
19292016 if (error)
19302017 return error;
19312018
@@ -1941,6 +2028,7 @@ xfs_iunlink_insert_inode( · 9 unmodified lines
19412028 }
19422029
19432030 /* Point the head of the list to point to this inode. */
2031+ ip->i_prev_unlinked = NULLAGINO;
19442032 return xfs_iunlink_update_bucket(tp, pag, agibp, bucket_index, agino);
19452033 }
19462034
@@ -2020,6 +2108,9 @@ xfs_iunlink_remove_inode( · 73 unmodified lines
20202108 */
20212109 error = xfs_iunlink_update_backref(pag, ip->i_prev_unlinked,
20222110 ip->i_next_unlinked);
2111+ if (error == -ENOLINK)
2112+ error = xfs_iunlink_reload_next(tp, agibp, ip->i_prev_unlinked,
2113+ ip->i_next_unlinked);
20232114 if (error)
20242115 return error;
20252116
@@ -2040,7 +2131,7 @@ xfs_iunlink_remove_inode( · 14 unmodified lines
20402131 }
20412132
20422133 ip->i_next_unlinked = NULLAGINO;
2043− ip->i_prev_unlinked = NULLAGINO;
2134+ ip->i_prev_unlinked = 0;
20442135 return error;
20452136 }
20462137
@@ -3529,3 +3620,117 @@ xfs_iunlock2_io_mmap( · 1482 unmodified lines
35293620 if (ip1 != ip2)
35303621 inode_unlock(VFS_I(ip1));
35313622 }
3623+
3624+/*
3625+ * Reload the incore inode list for this inode. Caller should ensure that
3626+ * the link count cannot change, either by taking ILOCK_SHARED or otherwise
3627+ * preventing other threads from executing.
3628+ */
3629+int
3630+xfs_inode_reload_unlinked_bucket(
3631+ struct xfs_trans *tp,
3632+ struct xfs_inode *ip)
3633+{
3634+ struct xfs_mount *mp = tp->t_mountp;
3635+ struct xfs_buf *agibp;
3636+ struct xfs_agi *agi;
3637+ struct xfs_perag *pag;
3638+ xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino);
3639+ xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
3640+ xfs_agino_t prev_agino, next_agino;
3641+ unsigned int bucket;
3642+ bool foundit = false;
3643+ int error;
3644+
3645+ /* Grab the first inode in the list */
3646+ pag = xfs_perag_get(mp, agno);
3647+ error = xfs_ialloc_read_agi(pag, tp, &agibp);
3648+ xfs_perag_put(pag);
3649+ if (error)
3650+ return error;
3651+
3652+ /*
3653+ * We've taken ILOCK_SHARED and the AGI buffer lock to stabilize the
3654+ * incore unlinked list pointers for this inode. Check once more to
3655+ * see if we raced with anyone else to reload the unlinked list.
3656+ */
3657+ if (!xfs_inode_unlinked_incomplete(ip)) {
3658+ foundit = true;
3659+ goto out_agibp;
3660+ }
3661+
3662+ bucket = agino % XFS_AGI_UNLINKED_BUCKETS;
3663+ agi = agibp->b_addr;
3664+
3665+ trace_xfs_inode_reload_unlinked_bucket(ip);
3666+
3667+ xfs_info_ratelimited(mp,
3668+ "Found unrecovered unlinked inode 0x%x in AG 0x%x. Initiating list recovery.",
3669+ agino, agno);
3670+
3671+ prev_agino = NULLAGINO;
3672+ next_agino = be32_to_cpu(agi->agi_unlinked[bucket]);
3673+ while (next_agino != NULLAGINO) {
3674+ struct xfs_inode *next_ip = NULL;
3675+
3676+ /* Found this caller's inode, set its backlink. */
3677+ if (next_agino == agino) {
3678+ next_ip = ip;
3679+ next_ip->i_prev_unlinked = prev_agino;
3680+ foundit = true;
3681+ goto next_inode;
3682+ }
3683+
3684+ /* Try in-memory lookup first. */
3685+ next_ip = xfs_iunlink_lookup(pag, next_agino);
3686+ if (next_ip)
3687+ goto next_inode;
3688+
3689+ /* Inode not in memory, try reloading it. */
3690+ error = xfs_iunlink_reload_next(tp, agibp, prev_agino,
3691+ next_agino);
3692+ if (error)
3693+ break;
3694+
3695+ /* Grab the reloaded inode. */
3696+ next_ip = xfs_iunlink_lookup(pag, next_agino);
3697+ if (!next_ip) {
3698+ /* No incore inode at all? We reloaded it... */
3699+ ASSERT(next_ip != NULL);
3700+ error = -EFSCORRUPTED;
3701+ break;
3702+ }
3703+
3704+next_inode:
3705+ prev_agino = next_agino;
3706+ next_agino = next_ip->i_next_unlinked;
3707+ }
3708+
3709+out_agibp:
3710+ xfs_trans_brelse(tp, agibp);
3711+ /* Should have found this inode somewhere in the iunlinked bucket. */
3712+ if (!error && !foundit)
3713+ error = -EFSCORRUPTED;
3714+ return error;
3715+}
3716+
3717+/* Decide if this inode is missing its unlinked list and reload it. */
3718+int
3719+xfs_inode_reload_unlinked(
3720+ struct xfs_inode *ip)
3721+{
3722+ struct xfs_trans *tp;
3723+ int error;
3724+
3725+ error = xfs_trans_alloc_empty(ip->i_mount, &tp);
3726+ if (error)
3727+ return error;
3728+
3729+ xfs_ilock(ip, XFS_ILOCK_SHARED);
3730+ if (xfs_inode_unlinked_incomplete(ip))
3731+ error = xfs_inode_reload_unlinked_bucket(tp, ip);
3732+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
3733+ xfs_trans_cancel(tp);
3734+
3735+ return error;
3736+}
fs/xfs/xfs_inode.h+32−2
@@ -68,8 +68,21 @@ typedef struct xfs_inode { · 67 unmodified lines
6868 uint64_t i_diflags2; /* XFS_DIFLAG2_... */
6969 struct timespec64 i_crtime; /* time created */
7070
71− /* unlinked list pointers */
71+ /*
72+ * Unlinked list pointers. These point to the next and previous inodes
73+ * in the AGI unlinked bucket list, respectively. These fields can
74+ * only be updated with the AGI locked.
75+ *
76+ * i_next_unlinked caches di_next_unlinked.
77+ */
7278 xfs_agino_t i_next_unlinked;
79+
80+ /*
81+ * If the inode is not on an unlinked list, this field is zero. If the
82+ * inode is the first element in an unlinked list, this field is
83+ * NULLAGINO. Otherwise, i_prev_unlinked points to the previous inode
84+ * in the unlinked list.
85+ */
7386 xfs_agino_t i_prev_unlinked;
7487
7588 /* VFS inode */
@@ -81,6 +94,11 @@ typedef struct xfs_inode { · 5 unmodified lines
8194 struct list_head i_ioend_list;
8295 } xfs_inode_t;
8396
97+static inline bool xfs_inode_on_unlinked_list(const struct xfs_inode *ip)
98+{
99+ return ip->i_prev_unlinked != 0;
100+}
101+
84102 static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
85103 {
86104 return ip->i_forkoff > 0;
@@ -326,6 +344,9 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) · 239 unmodified lines
326344 */
327345 #define XFS_INACTIVATING (1 << 13)
328346
347+/* Quotacheck is running but inode has not been added to quota counts. */
348+#define XFS_IQUOTAUNCHECKED (1 << 14)
349+
329350 /* All inode state flags related to inode reclaim. */
330351 #define XFS_ALL_IRECLAIM_FLAGS (XFS_IRECLAIMABLE | \
331352 XFS_IRECLAIM | \
@@ -340,7 +361,7 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) · 8 unmodified lines
340361 #define XFS_IRECLAIM_RESET_FLAGS \
341362 (XFS_IRECLAIMABLE | XFS_IRECLAIM | \
342363 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED | XFS_NEED_INACTIVE | \
343− XFS_INACTIVATING)
364+ XFS_INACTIVATING | XFS_IQUOTAUNCHECKED)
344365
345366 /*
346367 * Flags for inode locking.
@@ -575,4 +596,13 @@ void xfs_end_io(struct work_struct *work); · 228 unmodified lines
575596 int xfs_ilock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
576597 void xfs_iunlock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
577598
599+static inline bool
600+xfs_inode_unlinked_incomplete(
601+ struct xfs_inode *ip)
602+{
603+ return VFS_I(ip)->i_nlink == 0 && !xfs_inode_on_unlinked_list(ip);
604+}
605+int xfs_inode_reload_unlinked_bucket(struct xfs_trans *tp, struct xfs_inode *ip);
606+int xfs_inode_reload_unlinked(struct xfs_inode *ip);
607+
578608 #endif /* __XFS_INODE_H__ */
fs/xfs/xfs_iops.c+3−3
@@ -573,10 +573,10 @@ xfs_vn_getattr( · 572 unmodified lines
573573 stat->gid = vfsgid_into_kgid(vfsgid);
574574 stat->ino = ip->i_ino;
575575 stat->atime = inode->i_atime;
576+ stat->mtime = inode->i_mtime;
577+ stat->ctime = inode_get_ctime(inode);
576578 stat->blocks = XFS_FSB_TO_BB(mp, ip->i_nblocks + ip->i_delayed_blks);
577579
578− fill_mg_cmtime(stat, request_mask, inode);
579−
580580 if (xfs_has_v3inodes(mp)) {
581581 if (request_mask & STATX_BTIME) {
582582 stat->result_mask |= STATX_BTIME;
@@ -917,7 +917,7 @@ xfs_setattr_size( · 334 unmodified lines
917917 if (newsize != oldsize &&
918918 !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) {
919919 iattr->ia_ctime = iattr->ia_mtime =
920− current_mgtime(inode);
920+ current_time(inode);
921921 iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME;
922922 }
923923
fs/xfs/xfs_itable.c+11−0
@@ -80,6 +80,17 @@ xfs_bulkstat_one_int( · 79 unmodified lines
8080 if (error)
8181 goto out;
8282
83+ /* Reload the incore unlinked list to avoid failure in inodegc. */
84+ if (xfs_inode_unlinked_incomplete(ip)) {
85+ error = xfs_inode_reload_unlinked_bucket(tp, ip);
86+ if (error) {
87+ xfs_iunlock(ip, XFS_ILOCK_SHARED);
88+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
89+ xfs_irele(ip);
90+ return error;
91+ }
92+ }
93+
8394 ASSERT(ip != NULL);
8495 ASSERT(ip->i_imap.im_blkno != 0);
8596 inode = VFS_I(ip);
fs/xfs/xfs_log.c+0−17
@@ -715,15 +715,7 @@ xfs_log_mount( · 714 unmodified lines
715715 * just worked.
716716 */
717717 if (!xfs_has_norecovery(mp)) {
718− /*
719− * log recovery ignores readonly state and so we need to clear
720− * mount-based read only state so it can write to disk.
721− */
722− bool readonly = test_and_clear_bit(XFS_OPSTATE_READONLY,
723− &mp->m_opstate);
724718 error = xlog_recover(log);
725− if (readonly)
726− set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
727719 if (error) {
728720 xfs_warn(mp, "log mount/recovery failed: error %d",
729721 error);
@@ -772,7 +764,6 @@ xfs_log_mount_finish( · 42 unmodified lines
772764 struct xfs_mount *mp)
773765 {
774766 struct xlog *log = mp->m_log;
775− bool readonly;
776767 int error = 0;
777768
778769 if (xfs_has_norecovery(mp)) {
@@ -780,12 +771,6 @@ xfs_log_mount_finish( · 1 unmodified line
780771 return 0;
781772 }
782773
783− /*
784− * log recovery ignores readonly state and so we need to clear
785− * mount-based read only state so it can write to disk.
786− */
787− readonly = test_and_clear_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
788−
789774 /*
790775 * During the second phase of log recovery, we need iget and
791776 * iput to behave like they do for an active filesystem.
@@ -835,8 +820,6 @@ xfs_log_mount_finish( · 43 unmodified lines
835820 xfs_buftarg_drain(mp->m_ddev_targp);
836821
837822 clear_bit(XLOG_RECOVERY_NEEDED, &log->l_opstate);
838− if (readonly)
839− set_bit(XFS_OPSTATE_READONLY, &mp->m_opstate);
840823
841824 /* Make sure the log is dead if we're returning failure. */
842825 ASSERT(!error || xlog_is_shutdown(log));
fs/xfs/xfs_log_cil.c+16−36
@@ -124,7 +124,7 @@ xlog_cil_push_pcp_aggregate( · 123 unmodified lines
124124 struct xlog_cil_pcp *cilpcp;
125125 int cpu;
126126
127− for_each_online_cpu(cpu) {
127+ for_each_cpu(cpu, &ctx->cil_pcpmask) {
128128 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
129129
130130 ctx->ticket->t_curr_res += cilpcp->space_reserved;
@@ -165,7 +165,13 @@ xlog_cil_insert_pcp_aggregate( · 34 unmodified lines
165165 if (!test_and_clear_bit(XLOG_CIL_PCP_SPACE, &cil->xc_flags))
166166 return;
167167
168− for_each_online_cpu(cpu) {
168+ /*
169+ * We can race with other cpus setting cil_pcpmask. However, we've
170+ * atomically cleared PCP_SPACE which forces other threads to add to
171+ * the global space used count. cil_pcpmask is a superset of cilpcp
172+ * structures that could have a nonzero space_used.
173+ */
174+ for_each_cpu(cpu, &ctx->cil_pcpmask) {
169175 int old, prev;
170176
171177 cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
@@ -554,6 +560,7 @@ xlog_cil_insert_items( · 382 unmodified lines
554560 int iovhdr_res = 0, split_res = 0, ctx_res = 0;
555561 int space_used;
556562 int order;
563+ unsigned int cpu_nr;
557564 struct xlog_cil_pcp *cilpcp;
558565
559566 ASSERT(tp);
@@ -577,7 +584,12 @@ xlog_cil_insert_items( · 17 unmodified lines
577584 * can't be scheduled away between split sample/update operations that
578585 * are done without outside locking to serialise them.
579586 */
580− cilpcp = get_cpu_ptr(cil->xc_pcp);
587+ cpu_nr = get_cpu();
588+ cilpcp = this_cpu_ptr(cil->xc_pcp);
589+
590+ /* Tell the future push that there was work added by this CPU. */
591+ if (!cpumask_test_cpu(cpu_nr, &ctx->cil_pcpmask))
592+ cpumask_test_and_set_cpu(cpu_nr, &ctx->cil_pcpmask);
581593
582594 /*
583595 * We need to take the CIL checkpoint unit reservation on the first
@@ -663,7 +675,7 @@ xlog_cil_insert_items( · 79 unmodified lines
663675 continue;
664676 list_add_tail(&lip->li_cil, &cilpcp->log_items);
665677 }
666− put_cpu_ptr(cilpcp);
678+ put_cpu();
667679
668680 /*
669681 * If we've overrun the reservation, dump the tx details before we move
@@ -1790,38 +1802,6 @@ out_shutdown: · 1120 unmodified lines
17901802 return 0;
17911803 }
17921804
1793−/*
1794− * Move dead percpu state to the relevant CIL context structures.
1795− *
1796− * We have to lock the CIL context here to ensure that nothing is modifying
1797− * the percpu state, either addition or removal. Both of these are done under
1798− * the CIL context lock, so grabbing that exclusively here will ensure we can
1799− * safely drain the cilpcp for the CPU that is dying.
1800− */
1801−void
1802−xlog_cil_pcp_dead(
1803− struct xlog *log,
1804− unsigned int cpu)
1805−{
1806− struct xfs_cil *cil = log->l_cilp;
1807− struct xlog_cil_pcp *cilpcp = per_cpu_ptr(cil->xc_pcp, cpu);
1808− struct xfs_cil_ctx *ctx;
1809−
1810− down_write(&cil->xc_ctx_lock);
1811− ctx = cil->xc_ctx;
1812− if (ctx->ticket)
1813− ctx->ticket->t_curr_res += cilpcp->space_reserved;
1814− cilpcp->space_reserved = 0;
1815−
1816− if (!list_empty(&cilpcp->log_items))
1817− list_splice_init(&cilpcp->log_items, &ctx->log_items);
1818− if (!list_empty(&cilpcp->busy_extents))
1819− list_splice_init(&cilpcp->busy_extents, &ctx->busy_extents);
1820− atomic_add(cilpcp->space_used, &ctx->space_used);
1821− cilpcp->space_used = 0;
1822− up_write(&cil->xc_ctx_lock);
1823−}
1824−
18251805 /*
18261806 * Perform initial CIL structure initialisation.
18271807 */
fs/xfs/xfs_log_priv.h+6−8
@@ -231,6 +231,12 @@ struct xfs_cil_ctx { · 230 unmodified lines
231231 struct work_struct discard_endio_work;
232232 struct work_struct push_work;
233233 atomic_t order_id;
234+
235+ /*
236+ * CPUs that could have added items to the percpu CIL data. Access is
237+ * coordinated with xc_ctx_lock.
238+ */
239+ struct cpumask cil_pcpmask;
234240 };
235241
236242 /*
@@ -278,9 +284,6 @@ struct xfs_cil { · 41 unmodified lines
278284 wait_queue_head_t xc_push_wait; /* background push throttle */
279285
280286 void __percpu *xc_pcp; /* percpu CIL structures */
281−#ifdef CONFIG_HOTPLUG_CPU
282− struct list_head xc_pcp_list;
283−#endif
284287 } ____cacheline_aligned_in_smp;
285288
286289 /* xc_flags bit values */
@@ -705,9 +708,4 @@ xlog_kvmalloc( · 418 unmodified lines
705708 return p;
706709 }
707710
708−/*
709− * CIL CPU dead notifier
710− */
711−void xlog_cil_pcp_dead(struct xlog *log, unsigned int cpu);
712−
713711 #endif /* __XFS_LOG_PRIV_H__ */
fs/xfs/xfs_log_recover.c+2−2
@@ -329,7 +329,7 @@ xlog_find_verify_cycle( · 328 unmodified lines
329329 * try a smaller size. We need to be able to read at least
330330 * a log sector, or we're out of luck.
331331 */
332− bufblks = 1 << ffs(nbblks);
332+ bufblks = roundup_pow_of_two(nbblks);
333333 while (bufblks > log->l_logBBsize)
334334 bufblks >>= 1;
335335 while (!(buffer = xlog_alloc_buffer(log, bufblks))) {
@@ -1528,7 +1528,7 @@ xlog_write_log_records( · 1192 unmodified lines
15281528 * a smaller size. We need to be able to write at least a
15291529 * log sector, or we're out of luck.
15301530 */
1531− bufblks = 1 << ffs(blocks);
1531+ bufblks = roundup_pow_of_two(blocks);
15321532 while (bufblks > log->l_logBBsize)
15331533 bufblks >>= 1;
15341534 while (!(buffer = xlog_alloc_buffer(log, bufblks))) {
fs/xfs/xfs_mount.h+13−4
@@ -60,6 +60,7 @@ struct xfs_error_cfg { · 59 unmodified lines
6060 * Per-cpu deferred inode inactivation GC lists.
6161 */
6262 struct xfs_inodegc {
63+ struct xfs_mount *mp;
6364 struct llist_head list;
6465 struct delayed_work work;
6566 int error;
@@ -67,9 +68,7 @@ struct xfs_inodegc { · 1 unmodified line
6768 /* approximate count of inodes in the list */
6869 unsigned int items;
6970 unsigned int shrinker_hits;
70−#if defined(DEBUG) || defined(XFS_WARN)
7171 unsigned int cpu;
72−#endif
7372 };
7473
7574 /*
@@ -98,7 +97,6 @@ typedef struct xfs_mount { · 22 unmodified lines
9897 xfs_buftarg_t *m_ddev_targp; /* saves taking the address */
9998 xfs_buftarg_t *m_logdev_targp;/* ptr to log device */
10099 xfs_buftarg_t *m_rtdev_targp; /* ptr to rt device */
101− struct list_head m_mount_list; /* global mount list */
102100 void __percpu *m_inodegc; /* percpu inodegc structures */
103101
104102 /*
@@ -249,6 +247,9 @@ typedef struct xfs_mount { · 144 unmodified lines
249247 unsigned int *m_errortag;
250248 struct xfs_kobj m_errortag_kobj;
251249 #endif
250+
251+ /* cpus that have inodes queued for inactivation */
252+ struct cpumask m_inodegc_cpumask;
252253 } xfs_mount_t;
253254
254255 #define M_IGEO(mp) (&(mp)->m_ino_geo)
@@ -404,6 +405,8 @@ __XFS_HAS_FEAT(nouuid, NOUUID) · 149 unmodified lines
404405 #define XFS_OPSTATE_WARNED_SHRINK 8
405406 /* Kernel has logged a warning about logged xattr updates being used. */
406407 #define XFS_OPSTATE_WARNED_LARP 9
408+/* Mount time quotacheck is running */
409+#define XFS_OPSTATE_QUOTACHECK_RUNNING 10
407410
408411 #define __XFS_IS_OPSTATE(name, NAME) \
409412 static inline bool xfs_is_ ## name (struct xfs_mount *mp) \
@@ -426,6 +429,11 @@ __XFS_IS_OPSTATE(inode32, INODE32) · 16 unmodified lines
426429 __XFS_IS_OPSTATE(readonly, READONLY)
427430 __XFS_IS_OPSTATE(inodegc_enabled, INODEGC_ENABLED)
428431 __XFS_IS_OPSTATE(blockgc_enabled, BLOCKGC_ENABLED)
432+#ifdef CONFIG_XFS_QUOTA
433+__XFS_IS_OPSTATE(quotacheck_running, QUOTACHECK_RUNNING)
434+#else
435+# define xfs_is_quotacheck_running(mp) (false)
436+#endif
429437
430438 static inline bool
431439 xfs_should_warn(struct xfs_mount *mp, long nr)
@@ -443,7 +451,8 @@ xfs_should_warn(struct xfs_mount *mp, long nr) · 11 unmodified lines
443451 { (1UL << XFS_OPSTATE_BLOCKGC_ENABLED), "blockgc" }, \
444452 { (1UL << XFS_OPSTATE_WARNED_SCRUB), "wscrub" }, \
445453 { (1UL << XFS_OPSTATE_WARNED_SHRINK), "wshrink" }, \
446− { (1UL << XFS_OPSTATE_WARNED_LARP), "wlarp" }
454+ { (1UL << XFS_OPSTATE_WARNED_LARP), "wlarp" }, \
455+ { (1UL << XFS_OPSTATE_QUOTACHECK_RUNNING), "quotacheck" }
447456
448457 /*
449458 * Max and min values for mount-option defined I/O
fs/xfs/xfs_qm.c+16−0
@@ -1160,6 +1160,19 @@ xfs_qm_dqusage_adjust( · 1159 unmodified lines
11601160 if (error)
11611161 return error;
11621162
1163+ /*
1164+ * Reload the incore unlinked list to avoid failure in inodegc.
1165+ * Use an unlocked check here because unrecovered unlinked inodes
1166+ * should be somewhat rare.
1167+ */
1168+ if (xfs_inode_unlinked_incomplete(ip)) {
1169+ error = xfs_inode_reload_unlinked(ip);
1170+ if (error) {
1171+ xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
1172+ goto error0;
1173+ }
1174+ }
1175+
11631176 ASSERT(ip->i_delayed_blks == 0);
11641177
11651178 if (XFS_IS_REALTIME_INODE(ip)) {
@@ -1173,6 +1186,7 @@ xfs_qm_dqusage_adjust( · 7 unmodified lines
11731186 }
11741187
11751188 nblks = (xfs_qcnt_t)ip->i_nblocks - rtblks;
1189+ xfs_iflags_clear(ip, XFS_IQUOTAUNCHECKED);
11761190
11771191 /*
11781192 * Add the (disk blocks and inode) resources occupied by this
@@ -1319,8 +1333,10 @@ xfs_qm_quotacheck( · 140 unmodified lines
13191333 flags |= XFS_PQUOTA_CHKD;
13201334 }
13211335
1336+ xfs_set_quotacheck_running(mp);
13221337 error = xfs_iwalk_threaded(mp, 0, 0, xfs_qm_dqusage_adjust, 0, true,
13231338 NULL);
1339+ xfs_clear_quotacheck_running(mp);
13241340
13251341 /*
13261342 * On error, the inode walk may have partially populated the dquot
fs/xfs/xfs_refcount_item.c+4−2
@@ -477,6 +477,7 @@ xfs_cui_item_recover( · 476 unmodified lines
477477 struct xfs_log_item *lip,
478478 struct list_head *capture_list)
479479 {
480+ struct xfs_trans_res resv;
480481 struct xfs_cui_log_item *cuip = CUI_ITEM(lip);
481482 struct xfs_cud_log_item *cudp;
482483 struct xfs_trans *tp;
@@ -514,8 +515,9 @@ xfs_cui_item_recover( · 31 unmodified lines
514515 * doesn't fit. We need to reserve enough blocks to handle a
515516 * full btree split on either end of the refcount range.
516517 */
517− error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
518− mp->m_refc_maxlevels * 2, 0, XFS_TRANS_RESERVE, &tp);
518+ resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
519+ error = xfs_trans_alloc(mp, &resv, mp->m_refc_maxlevels * 2, 0,
520+ XFS_TRANS_RESERVE, &tp);
519521 if (error)
520522 return error;
521523
fs/xfs/xfs_rmap_item.c+4−2
@@ -507,6 +507,7 @@ xfs_rui_item_recover( · 506 unmodified lines
507507 struct xfs_log_item *lip,
508508 struct list_head *capture_list)
509509 {
510+ struct xfs_trans_res resv;
510511 struct xfs_rui_log_item *ruip = RUI_ITEM(lip);
511512 struct xfs_rud_log_item *rudp;
512513 struct xfs_trans *tp;

12 more lines aren’t shown here.

fs/xfs/xfs_super.c+3−85

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

fs/xfs/xfs_trace.h+45−0

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

fs/xfs/xfs_xattr.c+11−0

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

include/asm-generic/hugetlb.h+1−1

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

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

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

include/drm/drm_exec.h+31−4

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

include/drm/drm_kunit_helpers.h+3−1

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

include/linux/aer.h+2−0

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

include/linux/arm-smccc.h+2−0

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

include/linux/atomic/atomic-arch-fallback.h+1−9

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

include/linux/btf_ids.h+1−1

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

include/linux/buffer_head.h+4−1

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

include/linux/ceph/ceph_fs.h+11−13

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

include/linux/cpuhotplug.h+0−1

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

include/linux/export-internal.h+2−0

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

include/linux/fs.h+2−44

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

include/linux/hugetlb.h+4−2

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

include/linux/i2c.h+1−10

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

include/linux/if_team.h+2−0

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

include/linux/instruction_pointer.h+5−0

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

include/linux/interrupt.h+5−1

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

include/linux/kasan.h+1−1

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

include/linux/libata.h+11−3

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

include/linux/maple_tree.h+11−0

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

include/linux/memcontrol.h+2−2

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

include/linux/nfs_fs_sb.h+1−0

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

include/linux/nfs_page.h+3−1

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

include/linux/nvme-fc-driver.h+3−3

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

include/linux/pgtable.h+9−1

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

include/linux/resume_user_mode.h+1−1

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

include/linux/seqlock.h+1−1

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

include/linux/sunrpc/xdr.h+3−1

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

include/linux/swiotlb.h+16−7

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

include/linux/thermal.h+2−2

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

include/linux/trace_events.h+3−4

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

include/net/ipv6.h+6−1

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

include/net/netfilter/nf_tables.h+4−3

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

include/scsi/scsi.h+3−0

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

include/scsi/scsi_device.h+4−1

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

include/scsi/scsi_host.h+1−1

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

include/trace/events/xen.h+6−6

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

include/uapi/linux/bpf.h+3−1

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

include/uapi/linux/stddef.h+7−0

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

include/xen/arm/hypervisor.h+0−12

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

include/xen/events.h+1−2

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

io_uring/fs.c+1−1

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

io_uring/net.c+5−0

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

kernel/bpf/btf.c+1−1

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

kernel/bpf/cgroup.c+7−6

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

kernel/bpf/memalloc.c+90−4

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

kernel/bpf/offload.c+7−5

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

kernel/bpf/queue_stack_maps.c+18−3

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

kernel/crash_core.c+17−0

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

kernel/dma/swiotlb.c+22−9

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

kernel/panic.c+1−0

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

kernel/pid.c+1−1

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

kernel/power/hibernate.c+6−6

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

kernel/power/power.h+2−2

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

kernel/power/swap.c+8−6

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

kernel/sched/core.c+1−1

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

kernel/sched/cpufreq_schedutil.c+2−1

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

kernel/sched/cpupri.c+1−0

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

kernel/sched/fair.c+38−5

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

kernel/sched/idle.c+1−0

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

kernel/task_work.c+1−0

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

kernel/trace/bpf_trace.c+19−1

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

kernel/trace/ring_buffer.c+25−13

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

kernel/trace/trace.c+63−9

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

kernel/trace/trace.h+2−0

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

kernel/trace/trace_events.c+14−19

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

kernel/trace/trace_events_inject.c+2−1

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

kernel/trace/trace_events_synth.c+1−1

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

kernel/trace/trace_events_user.c+51−7

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

kernel/workqueue.c+3−6

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

lib/argv_split.c+2−2

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

lib/kunit/executor.c+33−15

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

lib/kunit/executor_test.c+8−5

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

lib/kunit/test.c+2−1

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

lib/maple_tree.c+163−58

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

lib/scatterlist.c+3−1

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

lib/test_maple_tree.c+72−15

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

mm/damon/vaddr-test.h+2−0

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

mm/damon/vaddr.c+2−1

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

mm/filemap.c+50−23

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

mm/hugetlb.c+24−19

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

mm/kasan/kasan.h+3−5

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

mm/memcontrol.c+16−3

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

mm/mempolicy.c+19−20

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

mm/migrate.c+5−2

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

mm/mremap.c+1−1

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

mm/page_alloc.c+6−6

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

mm/rmap.c+18−5

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

mm/shmem.c+1−1

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

mm/slab_common.c+18−18

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

mm/vmalloc.c+1−1

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

mm/zswap.c+20−0

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

net/ax25/Kconfig+8−8

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

net/bridge/br_forward.c+2−2

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

net/bridge/br_input.c+2−2

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

net/core/dev.c+3−3

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

net/core/flow_dissector.c+1−1

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

net/dccp/ipv4.c+2−7

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

net/dccp/ipv6.c+2−7

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

net/handshake/handshake-test.c+7−7

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

net/hsr/hsr_forward.c+1−0

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

net/hsr/hsr_framereg.c+2−2

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

net/hsr/hsr_main.h+1−1

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

net/ipv4/devinet.c+5−5

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

net/ipv4/inet_hashtables.c+20−16

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

net/ipv4/route.c+3−1

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

net/kcm/kcmsock.c+8−5

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

net/mptcp/options.c+3−2

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

net/mptcp/protocol.c+102−63

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

net/mptcp/protocol.h+23−1

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

net/mptcp/subflow.c+2−37

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

net/ncsi/ncsi-aen.c+5−0

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

net/netfilter/ipset/ip_set_core.c+10−2

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

net/netfilter/nf_conntrack_bpf.c+2−0

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

net/netfilter/nf_conntrack_extend.c+2−2

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

net/netfilter/nf_tables_api.c+59−20

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

net/netfilter/nft_set_hash.c+4−7

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

net/netfilter/nft_set_pipapo.c+2−2

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

net/netfilter/nft_set_rbtree.c+3−5

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

net/rds/rdma_transport.c+7−5

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

net/smc/smc_core.c+2−0

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

net/smc/smc_stats.h+2−1

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

net/sunrpc/clnt.c+9−5

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

net/tls/tls_sw.c+2−2

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

scripts/Makefile.modinst+2−2

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

scripts/atomic/gen-atomic-fallback.sh+1−1

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

scripts/gdb/linux/symbols.py+2−21

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

scripts/mod/file2alias.c+1−1

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

scripts/mod/modpost.c+22−2

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

scripts/package/builddeb+0−1

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

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

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

scripts/package/kernel.spec+0−3

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

security/selinux/hooks.c+8−2

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

sound/core/init.c+2−5

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

sound/core/rawmidi.c+1−1

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

sound/core/seq/seq_midi.c+2−2

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

sound/core/seq/seq_ump_client.c+23−1

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

sound/core/seq/seq_ump_convert.c+2−0

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

sound/firewire/bebob/bebob_midi.c+3−3

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

sound/firewire/dice/dice-midi.c+2−2

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

sound/firewire/digi00x/digi00x-midi.c+7−7

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

sound/firewire/fireface/ff-midi.c+2−2

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

sound/firewire/fireworks/fireworks.c+5−5

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

sound/firewire/fireworks/fireworks_midi.c+2−2

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

sound/firewire/motu/motu-midi.c+2−2

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

sound/firewire/oxfw/oxfw-midi.c+3−3

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

sound/firewire/oxfw/oxfw.c+5−5

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

sound/firewire/tascam/tascam-midi.c+6−6

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

sound/hda/intel-sdw-acpi.c+4−4

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

sound/isa/ad1848/ad1848.c+6−6

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

sound/isa/cs423x/cs4231.c+6−6

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

sound/isa/cs423x/cs4236.c+7−7

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

sound/isa/es1688/es1688.c+3−3

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

sound/isa/opti9xx/miro.c+4−4

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

sound/isa/opti9xx/opti92x-ad1848.c+8−8

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

sound/isa/sscape.c+1−1

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

sound/pci/cmipci.c+5−3

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

sound/pci/hda/cs35l56_hda.c+10−11

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

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

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

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

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

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

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

sound/pci/hda/patch_realtek.c+10−3

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

sound/pci/riptide/riptide.c+8−8

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

sound/soc/amd/yc/acp6x-mach.c+21−0

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

sound/soc/codecs/aw88395/aw88395_lib.c+2−0

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

sound/soc/codecs/cs35l56-i2c.c+0−1

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

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

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

sound/soc/codecs/cs42l42-sdw.c+20−0

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

sound/soc/codecs/cs42l42.c+20−1

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

sound/soc/codecs/cs42l42.h+1−0

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

sound/soc/codecs/cs42l43.c+8−6

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

sound/soc/codecs/rt5640.c+12−17

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

sound/soc/codecs/wm8960.c+14−5

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

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

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

sound/soc/fsl/imx-audmix.c+1−1

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

sound/soc/fsl/imx-pcm-rpmsg.c+1−0

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

sound/soc/fsl/imx-rpmsg.c+8−0

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

sound/soc/intel/avs/boards/hdaudio.c+3−0

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

sound/soc/meson/axg-spdifin.c+17−32

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

sound/soc/sh/rcar/core.c+1−0

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

sound/soc/soc-pcm.c+11−12

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

sound/soc/soc-utils.c+1−0

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

sound/soc/sof/core.c+1−2

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

sound/soc/sof/intel/mtl.c+1−1

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

sound/soc/sof/intel/mtl.h+0−1

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

sound/soc/sof/ipc4-topology.c+1−1

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

sound/soc/sof/sof-audio.c+2−1

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

sound/soc/tegra/tegra_audio_graph_card.c+17−13

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

sound/usb/caiaq/device.c+1−1

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

sound/usb/mixer.c+2−4

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

sound/usb/mixer_scarlett_gen2.c+4−4

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

sound/xen/xen_snd_front_cfg.c+1−1

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

tools/arch/x86/include/asm/msr-index.h+12−0

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

tools/include/linux/btf_ids.h+1−1

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

tools/include/linux/mm.h+1−3

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

tools/include/linux/seq_file.h+2−0

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

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

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

tools/include/uapi/drm/drm.h+69−15

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

tools/include/uapi/linux/bpf.h+3−1

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

tools/include/uapi/linux/seccomp.h+157−0

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

tools/objtool/check.c+2−1

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

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

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

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

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

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

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

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

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

tools/perf/bench/sched-seccomp-notify.c+1−1

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

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

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

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

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

tools/perf/pmu-events/metric.py+2−2

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

tools/perf/util/bpf-prologue.c+0−508

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

tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c+2−0

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

tools/perf/util/hashmap.h+0−10

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

tools/perf/util/pmu.c+1−1

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

tools/testing/memblock/internal.h+4−0

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

tools/testing/memblock/mmzone.c+1−1

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

tools/testing/memblock/tests/basic_api.c+1−1

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

tools/testing/memblock/tests/common.h+1−0

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

tools/testing/selftests/alsa/conf.c+0−1

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

tools/testing/selftests/alsa/mixer-test.c+3−8

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

tools/testing/selftests/alsa/pcm-test.c+2−2

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

tools/testing/selftests/alsa/test-pcmtest-driver.c+0−1

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

tools/testing/selftests/bpf/DENYLIST.aarch64+2−8

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

tools/testing/selftests/bpf/config+1−0

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

tools/testing/selftests/bpf/config.x86_64+0−1

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

tools/testing/selftests/bpf/prog_tests/empty_skb.c+10−2

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

tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c+37−0

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

tools/testing/selftests/bpf/prog_tests/test_bpf_ma.c+50−0

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

tools/testing/selftests/bpf/prog_tests/xdp_dev_bound_only.c+61−0

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

tools/testing/selftests/bpf/progs/kprobe_multi_override.c+13−0

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

tools/testing/selftests/bpf/progs/test_bpf_ma.c+123−0

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

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

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

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

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

tools/testing/selftests/ftrace/ftracetest+17−1

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

tools/testing/selftests/ftrace/test.d/instances/instance-event.tc+1−1

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

tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc+1−1

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

tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic_event_syntax_errors.tc+1−1

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

tools/testing/selftests/kselftest/runner.sh+2−1

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

tools/testing/selftests/kselftest_deps.sh+65−12

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

tools/testing/selftests/kvm/lib/test_util.c+1−1

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

tools/testing/selftests/kvm/riscv/get-reg-list.c+42−16

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

tools/testing/selftests/lib.mk+2−2

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

tools/testing/selftests/mm/charge_reserved_hugetlb.sh+2−2

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

tools/testing/selftests/mm/hugetlb_reparenting_test.sh+2−2

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

tools/testing/selftests/net/bind_bhash.sh+14−12

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

tools/testing/selftests/net/bind_wildcard.c+57−11

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

tools/testing/selftests/net/hsr/hsr_ping.sh+143−123

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

tools/testing/selftests/net/tls.c+4−4

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

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

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

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

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

tools/testing/selftests/netfilter/audit_logread.c+165−0

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

tools/testing/selftests/netfilter/config+1−0

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

tools/testing/selftests/netfilter/nft_audit.sh+108−0

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

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

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

tools/testing/selftests/powerpc/Makefile+3−4

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

tools/testing/selftests/powerpc/pmu/Makefile+6−5

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

tools/testing/selftests/proc/proc-empty-vm.c+1−0

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

tools/testing/selftests/user_events/abi_test.c+5−0

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

tools/testing/selftests/user_events/config+1−0

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

tools/testing/selftests/user_events/dyn_test.c+5−0

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

tools/testing/selftests/user_events/ftrace_test.c+6−0

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

tools/testing/selftests/user_events/perf_test.c+6−0

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

tools/testing/selftests/user_events/user_events_selftests.h+114−0

This diff is large: its 115 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